/* Learnt's visual system ([E111] Phase 1, 2026-11-09). One set of tokens and components
   for every Learnt page; Phases 2-5 switch pages over one at a time. Every rule is scoped
   to html:not(.gg) so Goalie Guide never changes (tests/unit/learnt-system.test.js).
   Pages are light unless they opt in: data-l-theme="dark", or "system" to follow the device.
   Reference: /style-board. Fonts: self-hosted, SIL OFL 1.1 (/fonts/OFL.txt). */

@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/hanken-grotesk.woff2') format('woff2'); }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/onest.woff2') format('woff2'); }

html:not(.gg) {
  /* Color: deep navy ink on a faintly indigo paper; indigo is the one accent.
     Aqua and apricot are glows for the background field only, never text. */
  --l-ink: #0E1330;
  --l-muted: #525A7A;
  --l-line: #E3E6F0;
  --l-page: #F7F8FC;
  --l-surface: #FFFFFF;
  --l-indigo: #4338CA;
  --l-indigo-hover: #3730A3;
  --l-indigo-press: #312E81;
  --l-indigo-tint: #EEF0FD;
  --l-btn-bg: #4338CA;
  --l-btn-fg: #FFFFFF;
  --l-aqua: #22B8CF;
  --l-apricot: #F6A97A;
  --l-success: #15803D;
  --l-warning: #B45309;
  --l-danger: #B91C1C;
  --l-focus: #4338CA;

  /* Glass: frosted panels for what floats above the page (hero, dialogs, sign-in card). */
  --l-glass-bg: rgba(255, 255, 255, 0.58);
  --l-glass-line: rgba(255, 255, 255, 0.78);
  --l-glass-blur: 18px;
  --l-glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 24px 56px -24px rgba(30, 27, 90, 0.32);

  /* Type: Hanken Grotesk for headings, Onest for text. Scale ratio 1.2 from 16px. */
  --l-font-display: 'Hanken Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --l-font-text: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --l-font-mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, monospace;
  --l-text-xs: 0.75rem;
  --l-text-sm: 0.875rem;
  --l-text-md: 1rem;
  --l-text-lg: 1.2rem;
  --l-text-xl: 1.44rem;
  --l-text-2xl: 1.728rem;
  --l-text-3xl: 2.488rem;
  --l-text-4xl: clamp(2.2rem, 5vw, 3.5rem);
  --l-track-display: -0.03em;

  /* Space (4px base), radius, elevation */
  --l-s1: 4px; --l-s2: 8px; --l-s3: 12px; --l-s4: 16px; --l-s5: 24px; --l-s6: 32px; --l-s7: 48px; --l-s8: 72px;
  --l-r-sm: 8px; --l-r-md: 12px; --l-r-lg: 20px; --l-r-pill: 999px;
  --l-shadow-1: 0 1px 2px rgba(14, 19, 48, 0.06), 0 1px 1px rgba(14, 19, 48, 0.04);
  --l-shadow-2: 0 12px 32px -12px rgba(14, 19, 48, 0.18);

  /* Motion: quick for controls, calm for surfaces, slow for the ambient field */
  --l-fast: 160ms;
  --l-calm: 420ms;
  --l-ambient: 26s;
  --l-ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --l-ease-inout: cubic-bezier(0.45, 0, 0.25, 1);
}

html:not(.gg)[data-l-theme="dark"] {
  --l-ink: #E9EBF8; --l-muted: #A3A9C9; --l-line: #272C4E; --l-page: #0B0E1F; --l-surface: #131733;
  --l-indigo: #A5A3FF; --l-indigo-hover: #BDBBFF; --l-indigo-press: #8E8BFF; --l-indigo-tint: #1C2150;
  --l-btn-bg: #A5A3FF; --l-btn-fg: #0B0E1F; --l-aqua: #4FD3E6; --l-apricot: #F7B48A;
  --l-success: #4ADE80; --l-warning: #FBBF24; --l-danger: #F87171; --l-focus: #A5A3FF;
  --l-glass-bg: rgba(28, 33, 72, 0.55); --l-glass-line: rgba(255, 255, 255, 0.14);
  --l-glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 24px 56px -24px rgba(0, 0, 0, 0.6);
  --l-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4); --l-shadow-2: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not(.gg)[data-l-theme="system"] {
    --l-ink: #E9EBF8; --l-muted: #A3A9C9; --l-line: #272C4E; --l-page: #0B0E1F; --l-surface: #131733;
    --l-indigo: #A5A3FF; --l-indigo-hover: #BDBBFF; --l-indigo-press: #8E8BFF; --l-indigo-tint: #1C2150;
    --l-btn-bg: #A5A3FF; --l-btn-fg: #0B0E1F; --l-aqua: #4FD3E6; --l-apricot: #F7B48A;
    --l-success: #4ADE80; --l-warning: #FBBF24; --l-danger: #F87171; --l-focus: #A5A3FF;
    --l-glass-bg: rgba(28, 33, 72, 0.55); --l-glass-line: rgba(255, 255, 255, 0.14);
    --l-glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 24px 56px -24px rgba(0, 0, 0, 0.6);
    --l-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4); --l-shadow-2: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ── Base (only on pages that opt in with .l-system on <html>). Zero specificity (:where), so a
   page's own layout rules always win over these defaults. ── */
:where(html:not(.gg).l-system) body { background: var(--l-page); color: var(--l-ink); font: 400 var(--l-text-md)/1.6 var(--l-font-text); -webkit-font-smoothing: antialiased; }
:where(html:not(.gg).l-system) :where(h1, h2, h3, h4) { font-family: var(--l-font-display); font-weight: 600; letter-spacing: var(--l-track-display); line-height: 1.12; text-wrap: balance; margin: 0; }
:where(html:not(.gg).l-system) :where(a) { color: var(--l-indigo); text-underline-offset: 3px; }
:where(html:not(.gg).l-system) :focus-visible { outline: 2px solid var(--l-focus); outline-offset: 3px; }

/* ── Wordmark: lowercase "learnt", the t in indigo ──────────────────────── */
html:not(.gg) .l-wordmark { font: 700 1.35rem/1 var(--l-font-display); letter-spacing: -0.045em; color: var(--l-ink); text-decoration: none; display: inline-flex; }
html:not(.gg) .l-wordmark .t { color: var(--l-indigo); }

/* ── Buttons: primary, secondary, quiet; two sizes ──────────────────────── */
html:not(.gg) .l-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--l-s2); box-sizing: border-box;
  min-height: 44px; padding: 0 var(--l-s5); border-radius: var(--l-r-pill); border: 1px solid transparent;
  font: 600 var(--l-text-sm)/1 var(--l-font-text); letter-spacing: 0.005em; text-decoration: none; cursor: pointer;
  transition: background var(--l-fast) var(--l-ease), border-color var(--l-fast) var(--l-ease), color var(--l-fast) var(--l-ease),
              transform var(--l-fast) var(--l-ease), box-shadow var(--l-fast) var(--l-ease);
}
html:not(.gg) .l-btn:hover { transform: translateY(-1px); }
html:not(.gg) .l-btn:active { transform: translateY(0); }
html:not(.gg) .l-btn:focus-visible { outline: 2px solid var(--l-focus); outline-offset: 3px; }
html:not(.gg) .l-btn[disabled], html:not(.gg) .l-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
html:not(.gg) .l-btn--primary { background: var(--l-btn-bg); color: var(--l-btn-fg); box-shadow: var(--l-shadow-1), 0 1px 0 rgba(255, 255, 255, 0.18) inset; }
html:not(.gg) .l-btn--primary:hover { background: var(--l-indigo-hover); box-shadow: var(--l-shadow-2); }
html:not(.gg) .l-btn--primary:active { background: var(--l-indigo-press); }
html:not(.gg) .l-btn--secondary { background: var(--l-surface); color: var(--l-ink); border-color: var(--l-line); box-shadow: var(--l-shadow-1); }
html:not(.gg) .l-btn--secondary:hover { border-color: var(--l-muted); }
html:not(.gg) .l-btn--quiet { background: transparent; color: var(--l-indigo); padding: 0 var(--l-s3); }
html:not(.gg) .l-btn--quiet:hover { background: var(--l-indigo-tint); transform: none; }
html:not(.gg) .l-btn--sm { min-height: 36px; padding: 0 var(--l-s4); font-size: var(--l-text-xs); }
html:not(.gg) .l-btn--glass { background: var(--l-glass-bg); color: var(--l-ink); border-color: var(--l-glass-line); box-shadow: var(--l-glass-shadow);
  -webkit-backdrop-filter: blur(var(--l-glass-blur)) saturate(160%); backdrop-filter: blur(var(--l-glass-blur)) saturate(160%); }

/* ── Fields ─────────────────────────────────────────────────────────────── */
html:not(.gg) .l-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
html:not(.gg) .l-field label { font: 500 var(--l-text-sm)/1.3 var(--l-font-text); color: var(--l-ink); }
html:not(.gg) .l-field :is(input, select, textarea) {
  font: 400 1rem/1.4 var(--l-font-text); color: var(--l-ink); background: var(--l-surface);
  border: 1px solid var(--l-line); border-radius: var(--l-r-md); padding: 11px 14px; min-height: 44px; width: 100%; box-sizing: border-box;
  transition: border-color var(--l-fast) var(--l-ease), box-shadow var(--l-fast) var(--l-ease);
}
html:not(.gg) .l-field :is(input, select, textarea)::placeholder { color: var(--l-muted); opacity: 0.8; }
html:not(.gg) .l-field :is(input, select, textarea):hover { border-color: color-mix(in srgb, var(--l-muted) 45%, var(--l-line)); }
html:not(.gg) .l-field :is(input, select, textarea):focus { outline: none; border-color: var(--l-indigo); box-shadow: 0 0 0 4px color-mix(in srgb, var(--l-indigo) 18%, transparent); }
html:not(.gg) .l-field .l-help { font-size: var(--l-text-sm); color: var(--l-muted); }
html:not(.gg) .l-field .l-error { font-size: var(--l-text-sm); color: var(--l-danger); }
html:not(.gg) .l-field[data-invalid] :is(input, select, textarea) { border-color: var(--l-danger); }

/* ── Surfaces: card, glass, pill, badge ─────────────────────────────────── */
html:not(.gg) .l-card { background: var(--l-surface); border: 1px solid var(--l-line); border-radius: var(--l-r-lg); padding: var(--l-s5); box-shadow: var(--l-shadow-1); }
html:not(.gg) .l-glass {
  background: var(--l-glass-bg); border: 1px solid var(--l-glass-line); border-radius: var(--l-r-lg); box-shadow: var(--l-glass-shadow);
  -webkit-backdrop-filter: blur(var(--l-glass-blur)) saturate(160%); backdrop-filter: blur(var(--l-glass-blur)) saturate(160%);
}
html:not(.gg) .l-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--l-r-pill); font: 500 var(--l-text-xs)/1 var(--l-font-text); color: var(--l-ink); background: var(--l-indigo-tint); }
html:not(.gg) .l-badge { display: inline-flex; padding: 3px 8px; border-radius: 6px; font: 600 0.6875rem/1.3 var(--l-font-text); letter-spacing: 0.02em; }
html:not(.gg) .l-badge--success { color: var(--l-success); background: color-mix(in srgb, var(--l-success) 12%, transparent); }
html:not(.gg) .l-badge--warning { color: var(--l-warning); background: color-mix(in srgb, var(--l-warning) 14%, transparent); }
html:not(.gg) .l-badge--danger { color: var(--l-danger); background: color-mix(in srgb, var(--l-danger) 12%, transparent); }

/* ── Tabs (Course Editor navigation, Phase 4) ───────────────────────────── */
html:not(.gg) .l-tabs { display: flex; gap: var(--l-s1); padding: var(--l-s1); border-radius: var(--l-r-pill); background: color-mix(in srgb, var(--l-line) 55%, transparent); overflow-x: auto; scrollbar-width: none; }
html:not(.gg) .l-tabs a { flex: none; padding: 8px 14px; border-radius: var(--l-r-pill); font: 500 var(--l-text-sm)/1 var(--l-font-text); color: var(--l-muted); text-decoration: none; transition: background var(--l-fast) var(--l-ease), color var(--l-fast) var(--l-ease); }
html:not(.gg) .l-tabs a:hover { color: var(--l-ink); }
html:not(.gg) .l-tabs a[aria-current="page"] { background: var(--l-surface); color: var(--l-ink); box-shadow: var(--l-shadow-1); }

/* ── Aura: the ambient color field, a slow drift behind hero areas, CSS only. The glows sit
   to the right and below, so headings and text on the left stay on calm page color. ── */
html:not(.gg) .l-aura { position: absolute; inset: -20%; z-index: -1; pointer-events: none; filter: blur(64px) saturate(115%); opacity: 0.6; }
html:not(.gg) .l-aura > span { position: absolute; border-radius: 50%; will-change: transform; }
html:not(.gg) .l-aura > span:nth-child(1) { width: 46%; height: 58%; right: 2%; top: 2%; background: var(--l-indigo); animation: l-drift-a var(--l-ambient) var(--l-ease-inout) infinite alternate; }
html:not(.gg) .l-aura > span:nth-child(2) { width: 40%; height: 50%; right: 22%; bottom: 0; background: var(--l-aqua); animation: l-drift-b calc(var(--l-ambient) * 1.15) var(--l-ease-inout) infinite alternate; }
html:not(.gg) .l-aura > span:nth-child(3) { width: 34%; height: 40%; left: 22%; bottom: -12%; background: var(--l-apricot); animation: l-drift-c calc(var(--l-ambient) * 1.3) var(--l-ease-inout) infinite alternate; }
@keyframes l-drift-a { to { transform: translate(8%, 6%) scale(1.08); } }
@keyframes l-drift-b { to { transform: translate(-10%, 8%) scale(0.94); } }
@keyframes l-drift-c { to { transform: translate(-6%, -10%) scale(1.1); } }

/* ── Reveal: sections settle in as they enter, from an already-readable state ─ */
html:not(.gg) .l-reveal { animation: l-settle var(--l-calm) var(--l-ease) both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
@keyframes l-settle { from { opacity: 0.35; transform: translateY(14px); } to { opacity: 1; transform: none; } }
html:not(.gg) .l-float { animation: l-float 9s var(--l-ease-inout) infinite alternate; }
@keyframes l-float { to { transform: translateY(-8px); } }

/* ── Fallbacks ──────────────────────────────────────────────────────────── */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html:not(.gg) :is(.l-glass, .l-btn--glass) { background: var(--l-surface); }
}
@media (prefers-reduced-transparency: reduce) {
  html:not(.gg) :is(.l-glass, .l-btn--glass) { background: var(--l-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.gg) :is(.l-aura > span, .l-reveal, .l-float) { animation: none; }
  html:not(.gg) .l-btn { transition: none; }
  html:not(.gg) .l-btn:hover { transform: none; }
}
html:not(.gg)[data-l-motion="off"] :is(.l-aura > span, .l-reveal, .l-float) { animation: none; }
@media (forced-colors: active) {
  html:not(.gg) :is(.l-btn, .l-card, .l-glass, .l-tabs a[aria-current="page"]) { border: 1px solid CanvasText; }
}
