/* The site header, one definition for every page.
 *
 * The sign-in page and the public pages (Academy, Talent, Pricing, How it works, How it's built, and the
 * reset, verify and certificate pages) each used to style their own header, so the menu jumped to a
 * different place when you moved between them and only one of them had the language switch. This file is
 * loaded last on every page, so it is the one that wins.
 *
 * Left to right: logo, then (pushed to the right) the menu, the language switch, the theme choice.
 */

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4);
  height: auto;
  min-height: var(--topbar-h, 72px);
  padding: var(--sp-2) var(--gutter, clamp(18px, 4vw, 64px));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line-soft);
}

.topbar .brand { gap: 10px; font-size: var(--text-xl); letter-spacing: -.055em; }
.topbar .brand-mark { width: 34px; height: 34px; border-radius: 10px 10px 10px 3px; font-size: 19px; }

.topbar .topnav {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.topbar .topnav a { font-size: var(--text-sm); }

/* Signed in, the menu is hidden and the short status line (or, failing that, the language switch) takes the right edge. */
.topbar .topbar-note { margin-left: auto; color: var(--muted); font-size: var(--text-sm); }
.topbar .topbar-note:empty { display: none; }
.topbar .topnav.hidden + .lang-switch { margin-left: auto; }

/* The language switch: both options always visible, the chosen one filled. */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
}
.lang-switch button {
  min-width: 44px;
  min-height: 30px;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.active { background: var(--brand-600); color: var(--on-brand); }
.lang-switch button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

@media (max-width: 700px) {
  .topbar { gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); }
  .topbar .topnav { margin-left: 0; width: 100%; order: 3; }
  .topbar .lang-switch { margin-left: auto; }
}

/* Same spacing around each menu item on every page, so the menu is the same width everywhere. */
.topbar .topnav a { padding: var(--sp-2) 2px; }

/* "Skip to content": invisible until a keyboard user tabs to it. It used to be styled only inside the app,
   so on the public pages it showed as a plain link above the header. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 30;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: var(--weight-semibold);
  border-radius: 0 0 var(--r-sm, 8px) 0;
}
.skip-link:focus { left: 0; }

/* Shown only when the server is slow to answer, usually because the free host was asleep. */
.wake-hint {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 14px;
  background: var(--warn-surface); color: var(--warn-ink); border: 1px solid var(--warn-border);
  box-shadow: var(--e-2, 0 8px 24px rgba(0,0,0,.2)); font-size: 14.5px; line-height: 1.45; text-align: center;
}
.wake-hint.hidden { display: none; }

/* A thin moving line at the very top while the page is waiting for the server, so a slow answer never
   looks like a frozen page. The app sets aria-busy on <body> whenever a request is in flight. */
body[aria-busy="true"]::before {
  content: ""; position: fixed; top: 0; left: 0; z-index: 60; height: 3px; width: 35%;
  background: linear-gradient(90deg, transparent, var(--brand-400), var(--accent-400), transparent);
  animation: jachai-wait 1.1s ease-in-out infinite;
}
@keyframes jachai-wait { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { body[aria-busy="true"]::before { animation: none; width: 100%; opacity: .6; } }

/* Decorative glows may extend past the screen edge; the page itself must never scroll sideways. */
html { overflow-x: hidden; }

/* ---- Drop-downs (built by select.js; the real <select> stays in the page, hidden) ------------------------- */
.dd { position: relative; display: block; width: 100%; min-width: 0; }
.dd-native { position: absolute !important; left: 0; bottom: 0; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.dd-button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 46px;
  padding: 10px 14px; text-align: left; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-strong, var(--line)); border-radius: var(--r-md, 11px);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.dd-button::after {
  content: ""; flex: none; width: 9px; height: 9px; margin-top: -3px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); color: var(--muted);
  transition: transform .18s ease;
}
.dd.is-open .dd-button::after { transform: rotate(-135deg); margin-top: 3px; }
.dd-button:hover:not(:disabled) { border-color: var(--brand-400); }
.dd-button:focus-visible, .dd.is-open .dd-button {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400) 32%, transparent);
}
.dd-button:disabled { opacity: .55; cursor: not-allowed; background: var(--surface-sunk); }
.dd.is-placeholder .dd-text { color: var(--muted); font-weight: 500; }
.dd-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-list {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px;
  max-height: 280px; overflow-y: auto; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md, 11px);
  box-shadow: 0 14px 34px rgba(15, 30, 40, .18), 0 2px 6px rgba(15, 30, 40, .08);
  animation: dd-in .12s ease-out;
}
.dd.dd-up .dd-list { top: auto; bottom: calc(100% + 6px); }
.dd-list[hidden] { display: none; }
.dd-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; cursor: pointer;
  font-weight: 500; line-height: 1.3; color: var(--ink);
}
.dd-option.is-active { background: var(--surface-brand, var(--surface-sunk)); }
.dd-option.is-selected { font-weight: 700; color: var(--brand-ink); }
.dd-option.is-selected::after { content: "✓"; margin-left: auto; padding-left: 10px; font-weight: 800; color: var(--brand-600); }
.dd-option[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dd-list { animation: none; } .dd-button::after, .dd-button { transition: none; } }
/* The side menu uses a slightly tinted button. */
.sidebar .dd-button { background: var(--surface); }

/* Role buttons on the sign-in card: every one reads left to right, top aligned, the same width. */
.demo-role { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; width: 100%; text-align: left; }

/* The "other payment options" fold-out */
.more-pay { margin: var(--sp-4) 0; border: 1px solid var(--line); border-radius: var(--r-md, 11px); background: var(--surface-sunk); }
.more-pay > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; cursor: pointer;
  list-style: none; font-weight: 700; color: var(--brand-ink); border-radius: inherit;
}
.more-pay > summary::-webkit-details-marker { display: none; }
.more-pay > summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin-top: -3px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .18s ease;
}
.more-pay[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.more-pay > summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-400) 45%, transparent); outline-offset: 2px; }
.more-pay > .form-row { padding: 0 16px 16px; }
