/* Keats Learning Academy — design tokens (shared across every page). */

/* Route transition tokens — single source of truth. Tune the whole
   transition system from these four variables. */
:root {
  --t-exit-dur: 180ms;
  --t-enter-dur: 240ms;
  --t-exit-ease: cubic-bezier(0.4, 0, 1, 1);
  --t-enter-ease: cubic-bezier(0, 0, 0.2, 1);
}

/* Top progress bar (mounted by shared-assets/RouteTransition.js).
   z-index 100000 so it sits ABOVE the branded loader overlay (99999). */
.route-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 100000; pointer-events: none;
}
.route-progress .route-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--navy-700, #21346e), var(--gold-500, #d9a24a));
  box-shadow: 0 0 8px rgba(217, 162, 74, 0.5);
  transition: width 250ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 200ms ease;
  border-radius: 0 2px 2px 0;
}
.route-progress[data-state="active"] .route-progress-bar { width: 75%; }
.route-progress[data-state="done"]   .route-progress-bar { width: 100%; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .route-progress .route-progress-bar { transition: width 80ms ease, opacity 80ms ease; }
}

/* ====================================================================
   Branded route-loading overlay (#keats-loader). Sits between the page
   and the progress bar (z-index 99999, with progress bar at 100000).
   Markup is injected once per page before </body> — see the codemod in
   shared-assets/RouteTransition.js. JS handlers in that same file
   show/hide the overlay around cross-document navigations.
   ==================================================================== */
:root {
  /* Navy hero gradient — matches the site's heroes */
  --ov-bg: linear-gradient(165deg, #0d1530 0%, #131d3f 55%, #1a2652 100%);
  --ov-fade-in: 80ms;
  --ov-fade-out: 100ms;
  --ov-ease-in: cubic-bezier(0.22, 1, 0.36, 1);
  --ov-ease-out: cubic-bezier(0.4, 0, 1, 1);
}

.keats-loader {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  background: var(--ov-bg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ov-fade-out) var(--ov-ease-out);
}
/* .show: animated fade-in (used on the click-source page).
   html.keats-navigating: instant — visible on the new page's first
   paint, so the user sees a continuous branded overlay across the
   page boundary. */
.keats-loader.show {
  opacity: 1; pointer-events: auto;
  transition: opacity var(--ov-fade-in) var(--ov-ease-in);
}
html.keats-navigating .keats-loader {
  opacity: 1; pointer-events: auto;
  transition: none;
}

.keats-loader .stack {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  position: relative; z-index: 1;
  /* Always at rest position. The wordmark itself doesn't move
     (no settle animation, no breathing), so navigation feels snappy. */
}

.keats-loader .wordmark {
  font-family: var(--font-display, 'Rubik', system-ui, sans-serif);
  font-size: 60px; line-height: 1; font-weight: 600;
  letter-spacing: -0.025em;
  color: #fff;
  display: flex; align-items: center;
}
.keats-loader .wordmark .dot {
  color: var(--gold-400, #e6b968);
  margin-left: 2px;
  animation: keatsDotPulse 1.6s ease-in-out infinite;
}
.keats-loader .tagline {
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold-300, #f0cf92); font-weight: 600; opacity: 0.85;
  display: flex; align-items: center; gap: 14px;
}
.keats-loader .tagline::before,
.keats-loader .tagline::after {
  content: ""; width: 18px; height: 1px;
  background: var(--gold-300, #f0cf92); opacity: 0.5;
}

@keyframes keatsDotPulse {
  0%, 100% { opacity: 1;    transform: translateY(0);   }
  50%      { opacity: 0.45; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .keats-loader .wordmark .dot { animation: none; }
}

@media (max-width: 600px) {
  .keats-loader .wordmark { font-size: 44px; }
  .keats-loader .tagline  { font-size: 10px; letter-spacing: 0.18em; }
}

html { scroll-behavior: smooth; }
:root {
  --navy-950: #0d1530;
  --navy-900: #131d3f;
  --navy-800: #1a2652;
  --navy-700: #21346e;
  --navy-600: #2c4389;
  --navy-500: #3d56a8;
  --navy-400: #6c7fc4;
  --navy-300: #a3b0db;
  --navy-200: #cdd4ec;
  --navy-100: #e8ecf7;
  --navy-50:  #f3f5fb;
  --gold-700: #8c6720;
  --gold-600: #b78838;
  --gold-500: #d9a24a;
  --gold-400: #e6b968;
  --gold-300: #f0cf92;
  --gold-100: #f7e7c5;
  --gold-50:  #fbf3e0;
  --ink:      #0a0e1e;
  --ink-soft: #161a20;
  --paper:    #fafaf7;
  --paper-2:  #f2f1ea;
  --line:     rgba(13, 21, 48, 0.10);
  --line-strong: rgba(13, 21, 48, 0.18);
  --font-display: 'Rubik', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --shadow-sm: 0 1px 2px rgba(13,21,48,0.06), 0 2px 8px rgba(13,21,48,0.04);
  --shadow:    0 4px 10px rgba(13,21,48,0.08), 0 20px 50px rgba(13,21,48,0.10);
  --shadow-lg: 0 10px 30px rgba(13,21,48,0.14), 0 40px 100px rgba(13,21,48,0.20);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { overflow-x: hidden; }
img, video, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 3px; border-radius: 4px; }

.container {
  width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 24px;
}
@media (min-width: 768px) { .container { padding: 0 40px; } }
@media (min-width: 1200px) { .container { padding: 0 64px; } }

.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 500; color: var(--navy-500);
  display: inline-flex; align-items: center; gap: 8px;
}

::selection { background: var(--gold-300); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-200); border-radius: 999px; }

/* Mobile/desktop visibility helpers used by SiteNav */
.mobile-only { display: none; }
.desktop-only { display: flex; }
@media (max-width: 900px) {
  .mobile-only { display: flex; }
  .desktop-only { display: none !important; }
}

/* Body main pad-top to clear fixed nav */
main { padding-top: 0; }

/* Long-form prose helpers */
.prose h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 3.5vw, 42px); letter-spacing: -0.025em; margin: 48px 0 18px; }
.prose h3 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 36px 0 12px; }
.prose p, .prose li { font-size: 17px; line-height: 1.7; color: var(--navy-800); }
.prose ul { padding-left: 22px; margin: 0 0 22px; }
.prose ul li { margin-bottom: 10px; }
.prose strong { color: var(--navy-950); font-weight: 600; }
.prose a { color: var(--navy-700); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--gold-700); }
.prose blockquote {
  border-left: 3px solid var(--gold-500); padding-left: 22px; margin: 28px 0;
  font-style: italic; color: var(--navy-800);
}

@media (max-width: 980px) {
  .pt-hero-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
  .pt-reason-grid { grid-template-columns: 1fr 1fr !important; }
  .pt-subject-grid { grid-template-columns: 1fr 1fr !important; }
  .pt-split { grid-template-columns: 1fr !important; gap: 48px !important; }
  .pt-profile-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 600px) {
  .pt-reason-grid { grid-template-columns: 1fr !important; }
  .pt-subject-grid { grid-template-columns: 1fr !important; }
}

/* ================================================================
   LEGAL SECTION — client-side route transitions for the SPA shell.
   Hero strip + <article> animate together on route change.
   ================================================================ */
html, body { background: var(--paper); }

.legal-article {
  font-family: var(--font-body);
}
.legal-article h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; letter-spacing: -0.02em;
  margin: 56px 0 16px; color: var(--ink);
  scroll-margin-top: 100px;
}
.legal-article h2:first-child { margin-top: 0; }
.legal-article h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 18px; letter-spacing: -0.015em;
  margin: 32px 0 10px; color: var(--ink);
}
.legal-article p, .legal-article li {
  font-size: 15.5px; line-height: 1.7; color: var(--ink-soft);
}
.legal-article p { margin: 0 0 16px; }
.legal-article ul { padding-left: 20px; margin: 0 0 16px; }
.legal-article li { margin-bottom: 8px; }
.legal-article a { color: var(--navy-700); text-decoration: underline; text-underline-offset: 3px; }
.legal-article strong { color: var(--ink); font-weight: 600; }
.legal-article .callout {
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 20px 22px;
  display: flex; gap: 14px; align-items: flex-start;
  margin: 24px 0;
}
.legal-article .callout .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-500); flex-shrink: 0; margin-top: 8px;
}
.legal-article .callout p { margin: 0; font-size: 14.5px; }
.legal-article .meta {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--ink-soft); opacity: 0.55; text-transform: uppercase;
  margin-bottom: 8px;
}

@media (max-width: 860px) {
  .legal-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .legal-sidebar { position: static !important; }
}

/* Route transition phases. Phases drive opacity + translateY only.
   Tightened timings (was exit 180ms / enter 240ms) for snappier perceived
   load: exit 120ms, enter 180ms. Total transition ~260ms (down from 380ms).
   Keep cubic-beziers and translate amplitudes from the original spec. */
.legal-hero, .legal-article { will-change: opacity, transform; }

.legal-phase-exiting {
  animation: legal-route-exit 120ms cubic-bezier(0.4, 0, 1, 1) forwards;
}
.legal-phase-entering {
  animation: legal-route-enter 180ms cubic-bezier(0, 0, 0.2, 1) forwards;
}
.legal-phase-idle { /* no animation */ }

@keyframes legal-route-exit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}
@keyframes legal-route-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .legal-phase-exiting,
  .legal-phase-entering {
    animation-duration: 100ms !important;
  }
  @keyframes legal-route-exit {
    from { opacity: 1; }
    to   { opacity: 0; }
  }
  @keyframes legal-route-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}
