/* The one site header, on every page: the 3D app, Events, Academy, its courses and lessons.
   Markup: tools/site-header.mjs writes it into each page. Live parts (who's signed in, the sign-up pitch): js/sitehead.js.
   The sign-in dialog and the sign-up popup (js/learn/account.js, signup-offer.js) are styled here too, since any page can open them.
   Pages define their own colours; the fallbacks below are the same palette, so this file works under any of them. */

:root {
  --site-head-h: 58px;
  --site-head-total: calc(var(--site-head-h) + env(safe-area-inset-top, 0px)); /* what the header takes from the top edge; pages offset by it */
}
@media (max-width: 640px) { :root { --site-head-h: 52px; } }

/* ---------------------------------------------------------------- the bar */
.site-head {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: var(--site-head-total); box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: rgba(3, 5, 10, 0.78); border-bottom: 1px solid var(--line, rgba(156, 184, 222, 0.16));
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  font-family: var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif);
}
/* The 3D app draws over the whole window, so its header floats on top instead of taking space (z-index 5: the app's own dialogs sit above it). */
.site-head.sh-fixed { position: fixed; top: 0; left: 0; right: 0; z-index: 5; }
body.ui-hidden .site-head, html.embed .site-head { display: none; }
.site-head a { -webkit-tap-highlight-color: transparent; }
.site-head :focus-visible { outline: 2px solid var(--amber, #ffb547); outline-offset: 2px; }

.sh-brand { flex: none; display: inline-flex; align-items: center; gap: 10px; color: var(--ink, #e2e9f3); text-decoration: none; }
.sh-mark { width: 30px; height: 30px; fill: none; stroke: var(--amber, #ffb547); stroke-width: 1.6; }
.sh-mark circle { fill: rgba(255, 181, 71, 0.15); }
.sh-text { display: flex; flex-direction: column; gap: 4px; }
.sh-name { font: 700 17px/1 var(--font-display, "Chakra Petch", "Segoe UI", system-ui, sans-serif); letter-spacing: 0.04em; white-space: nowrap; }
.sh-name i { font-style: normal; color: var(--amber, #ffb547); }
.sh-tag { font: 500 10px/1 var(--font-display, "Chakra Petch", "Segoe UI", system-ui, sans-serif); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-dim, #8e9cb2); white-space: nowrap; }

.sh-nav { align-self: stretch; display: flex; margin-left: 14px; }
.sh-nav a {
  position: relative; display: flex; align-items: center; padding: 0 14px;
  color: var(--ink-dim, #8e9cb2); font: 500 14.5px var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif); text-decoration: none; white-space: nowrap;
}
.sh-nav a:hover { color: var(--ink, #e2e9f3); background: rgba(255, 255, 255, 0.04); }
.sh-nav a[aria-current] { color: var(--ink, #e2e9f3); }
.sh-nav a[aria-current]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--amber, #ffb547); }

/* signed out: Log in (and the sign-up pitch); signed in: who, and Log out */
.sh-acct { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sh-btn { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong, rgba(156, 184, 222, 0.3)); background: none; color: var(--ink, #e2e9f3); font: 500 14.5px var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif); white-space: nowrap; cursor: pointer; }
.sh-btn:hover { border-color: var(--amber, #ffb547); }
.sh-btn[data-sh-out] { border-color: transparent; color: var(--ink-dim, #8e9cb2); }
.sh-btn[data-sh-out]:hover { color: var(--ink, #e2e9f3); border-color: transparent; background: rgba(255, 255, 255, 0.04); }
.sh-me { display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 2px; font: 500 14.5px var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif); color: var(--ink, #e2e9f3); }
.sh-me i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--font-display, "Chakra Petch", sans-serif); font-style: normal; color: #0b0f18; background: linear-gradient(135deg, #ffb547, #c7b4ff); }
.sh-me span { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "2 more free lessons": shown while accounts are on and nobody is signed in (signupOffer.bind adds .offer) */
.sh-offer { display: none; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; background: var(--amber, #ffb547); color: var(--amber-ink, #1d1203); font: 600 14.5px var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif); text-decoration: none; white-space: nowrap; }
.sh-offer.offer { display: inline-flex; }
.sh-offer svg { width: 17px; height: 17px; flex: none; }
.sh-offer:hover { filter: brightness(1.06); }

@media (max-width: 899px) { .sh-offer.offer { display: none; } }
@media (max-width: 640px) {
  .site-head { gap: 4px; }
  .sh-text { display: none; }
  .sh-nav { margin-left: 2px; }
  .sh-nav a { padding: 0 9px; font-size: 14px; }
  .sh-nav a[aria-current]::after { left: 6px; right: 6px; }
  .sh-btn { padding: 7px 10px; font-size: 14px; }
  .sh-me span { display: none; }
}

/* ---------------------------------------------------------------- the Log in / Create account dialog, and the sign-up popup */
.acct { --panel-solid: #0c1320; --ink-body: #c9d3e1; --bad: #ff7a66; --good: #7ee0a1; font-family: var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif); }
.acct .btn { display: inline-flex; align-items: center; gap: 9px; padding: 13px 22px; border-radius: 14px; font: 600 16px var(--font-body, "Barlow", "Segoe UI", system-ui, sans-serif); text-decoration: none; border: 1px solid transparent; }
.acct .btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acct .btn.primary { background: var(--amber, #ffb547); color: #1d1203; box-shadow: 0 10px 34px -10px rgba(255, 181, 71, 0.7); }
.acct .btn.primary:hover { filter: brightness(1.06); }
.acct button.btn { cursor: pointer; }
.acct { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; background: none; color: var(--ink); overflow: visible; }
.acct::backdrop { background: rgba(2, 4, 10, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.acct[open] { animation: acct-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
@keyframes acct-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.acct-card {
  position: relative; display: grid; gap: 12px; padding: 28px 26px 22px; border-radius: 24px; max-height: calc(100dvh - 32px); overflow-y: auto;
  background: radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255, 181, 71, 0.16), transparent 60%), var(--panel-solid);
  border: 1px solid var(--line-strong); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
}
.acct-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.05); color: var(--ink-dim); font-size: 22px; line-height: 1; cursor: pointer; }
.acct-x:hover { color: var(--ink); background: rgba(255, 255, 255, 0.1); }
.acct-logo svg { width: 40px; height: 40px; fill: none; stroke: var(--amber); stroke-width: 2; }
.acct h2 { margin: -4px 0 0; font: 700 26px/1.15 var(--font-display); }
.acct-sub { margin: -6px 0 0; color: var(--ink-dim); font-size: 15.5px; line-height: 1.45; }
.acct-msg { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(126, 224, 161, 0.08); border: 1px solid rgba(126, 224, 161, 0.3); font-size: 14.5px; line-height: 1.45; }
.acct-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 4px 0 2px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.acct-tabs button { padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink-dim); font: 600 14.5px var(--font-body); cursor: pointer; }
.acct-tabs button[aria-selected="true"] { background: rgba(255, 181, 71, 0.14); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, 0.45); }
.acct-f { display: grid; gap: 6px; font: 600 13.5px var(--font-body); color: var(--ink-body); }
.acct-f small { font-weight: 400; color: var(--ink-faint); }
.acct-f input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.35); color: var(--ink); font: 400 16px var(--font-body); } /* 16px: no zoom on iPhone */
.acct-f input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.2); }
.acct-f input[aria-invalid="true"] { border-color: var(--bad); }
.acct-f em { font: 500 13px var(--font-body); font-style: normal; color: var(--bad); }
.acct-f em:empty { display: none; }
.acct-pw { position: relative; display: block; }
.acct-pw input { padding-right: 70px; }
.acct-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 6px 10px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.06); color: var(--ink-dim); font: 600 12.5px var(--font-body); cursor: pointer; }
.acct-hint { margin-top: -6px; color: var(--ink-faint); font-size: 13px; }
.acct-err { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 122, 102, 0.1); border: 1px solid rgba(255, 122, 102, 0.4); color: #ffd2ca; font-size: 14.5px; }
.acct-go { justify-content: center; margin-top: 4px; cursor: pointer; }
.acct-go:disabled { opacity: 0.7; cursor: progress; }
.acct-go.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: acct-spin 0.7s linear infinite; }
@keyframes acct-spin { to { transform: rotate(360deg); } }
.acct-foot { margin: 0; text-align: center; color: var(--ink-faint); font-size: 13px; }
.acct-code { text-align: center; letter-spacing: 0.4em; font: 600 26px ui-monospace, Menlo, Consolas, monospace !important; }
.acct-check { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-body); font: 500 14px/1.4 var(--font-body); cursor: pointer; }
.acct-check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--amber); }
.acct-check small { display: block; color: var(--ink-faint); font-size: 12.5px; }
.acct-alt { margin: 0; text-align: center; color: var(--ink-faint); font-size: 14px; }
.acct-link { padding: 4px 2px; border: 0; background: none; color: var(--ink-dim); font: 600 14px var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.acct-link:hover { color: var(--ink); }
.acct-link:disabled { color: var(--ink-faint); text-decoration: none; cursor: default; }
.acct-toast { position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; background: var(--panel-solid); border: 1px solid rgba(126, 224, 161, 0.45); color: var(--ink); animation: acct-in 0.35s ease, acct-in 0.35s ease 3.2s reverse forwards; }
.offer-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--amber-ink, #1d1203); background: var(--amber); box-shadow: 0 8px 26px -8px rgba(255, 181, 71, 0.7); }
.offer-icon svg { width: 24px; height: 24px; }
.offer-card .acct-sub { margin: 0; }
.offer-go { justify-content: center; margin-top: 6px; cursor: pointer; }
.offer-login { justify-self: center; padding: 4px; border: 0; background: none; color: var(--ink-dim); font: 500 14.5px var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.offer-login:hover { color: var(--ink); }
@media (max-width: 640px) { .acct-card { padding: 24px 18px 18px; } }
