/* Chess Knight homepage, "Garden Folio". Tokens live in style.css. */

body.home { overflow-x: hidden; }

.btn {
  display: inline-flex; align-items: center; gap: .5em; text-decoration: none; font-weight: 700;
  padding: .8em 1.5em; border-radius: 999px; font-size: 1rem; color: var(--ink);
  background: var(--card); border: 2px solid var(--outline); box-shadow: 3px 3px 0 var(--outline);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translate(-1px, -2px); box-shadow: 4px 5px 0 var(--outline); color: var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--outline); }
.btn-primary { background: var(--meadow); color: #FFFBF0; }
.btn-primary:hover { color: #FFFBF0; }
.btn-sun { background: var(--sun); color: #2A251D; font-size: 1.1rem; }
.btn-sun:hover { color: #2A251D; }

h1 em, h2 em, h3 em { font-style: italic; color: var(--meadow-deep); font-variation-settings: 'SOFT' 100, 'WONK' 1; }

/* ------------------------------------------------------------------ nav */
/* Plain links across the top with no bar behind them: each part is ink or cream,
   whichever stands out more against what's behind it (.light is set by nav() in home.js). */
.home-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.6rem;
  padding: 14px max(20px, 4vw);
}
/* each part (logo, links, button) picks its own colour from what's right behind it */
.home-nav > * { --fg: var(--ink); --halo: rgba(255, 251, 240, .8); color: var(--fg); transition: color .3s ease; }
.home-nav > .light { --fg: #FBF6EA; --halo: rgba(16, 20, 14, .7); }
.home-nav .brand { text-shadow: 0 0 3px var(--halo), 0 0 10px var(--halo), 0 0 22px var(--halo); }
.home-nav .brand:hover { color: var(--fg); }
.home-nav .brand .logo-light { display: none; }
.home-nav .brand.light .logo { display: none; }
.home-nav .brand.light .logo-light { display: block; }
.home-nav nav { display: flex; gap: 1.6rem; margin-left: auto; }
.home-nav nav a, .nav-cta {
  color: var(--fg); text-decoration: none; font-weight: 700; text-shadow: 0 0 3px var(--halo), 0 0 10px var(--halo), 0 0 22px var(--halo);
  text-underline-offset: .3em; text-decoration-thickness: 2px; transition: color .3s ease, background .2s;
}
.home-nav nav a:hover { text-decoration: underline; color: var(--fg); }
.nav-cta { border: 2px solid currentColor; border-radius: 999px; padding: .45em 1.05em; }
.nav-cta:hover { background: var(--fg); color: var(--paper); text-shadow: none; }
.home-nav .nav-cta.light:hover { color: #1F2A1F; }

/* --------------------------------------------------------------- the dive */
.dive { position: relative; height: 580vh; } /* 420vh of animation + a 60vh pause at the end (dive() in home.js) */
/* The stage fills the tallest the screen gets (Safari with its toolbars tucked away), so
   no page background shows under it; things pinned to its bottom are raised by --hidden,
   the part Safari's toolbars can cover, so they're in view either way. */
.dive-stage { position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: hidden; background: #2F372C; --hidden: 0px; }
@supports (height: 100lvh) { .dive-stage { --hidden: calc(100lvh - 100svh); } }
.garden, .seasons, .transit { position: absolute; inset: 0; }
.garden { z-index: 1; transform-origin: 20% 62%; will-change: transform; }
.garden-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.garden-piece { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 3; pointer-events: none; }
/* a Grok piece (keyed out) stands on its own instead of aligning with a stand-in photo */
.garden-piece.free {
  inset: auto; left: 50%; bottom: 4vh; height: min(78vh, 90vw); width: auto; object-fit: contain; translate: -50% 0;
  filter: drop-shadow(0 18px 22px rgba(42, 37, 29, .25));
}

/* The words stand in front of everything, cream on a soft dark shade so they read over
   the busy garden and the knight alike. */
.hero-copy {
  position: absolute; z-index: 6; left: 0; right: 0; top: max(96px, 15vh);
  display: flex; flex-direction: column; align-items: center; text-align: center; will-change: transform, opacity;
}
/* No layer of their own (no transform or opacity here), so both shades sit under all the words
   instead of the subtitle's shade darkening the bottom of the headline. */
.hero-text, .hero-actions { position: relative; width: min(72vw, calc(100% - 32px)); }
.hero-text::before, .hero-actions::before { /* the shade behind the words */
  content: ''; position: absolute; z-index: -1; left: 50%; translate: -50% -50%; border-radius: 50%; pointer-events: none;
}
.hero-text::before {
  top: 55%; width: 130%; height: 230%;
  background: radial-gradient(closest-side, rgba(18, 22, 16, .74), rgba(18, 22, 16, .5) 55%, rgba(18, 22, 16, 0));
}
.hero-actions::before {
  top: 42%; width: 100%; height: 150%;
  background: radial-gradient(closest-side, rgba(18, 22, 16, .7), rgba(18, 22, 16, .42) 55%, rgba(18, 22, 16, 0));
}
.hero-actions p { color: #FBF6EA; text-shadow: 0 1px 3px rgba(0, 0, 0, .6), 0 0 16px rgba(0, 0, 0, .45); }


.hero-badge {
  display: inline-flex; align-items: center; gap: .55rem; padding: .35em .9em .35em .4em; border-radius: 999px;
  background: rgba(255, 251, 240, .85); border: 1.5px solid rgba(42, 37, 29, .18); backdrop-filter: blur(6px);
  font-size: .86rem; font-weight: 600; color: var(--ink-soft); box-shadow: 0 6px 18px -10px rgba(42, 37, 29, .4);
}
.badge-dots { display: inline-flex; }
.badge-dots i { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid #FFFBF0; margin-left: -.35rem; }
.badge-dots i:first-child { margin-left: 0; background: var(--meadow); }
.badge-dots i:nth-child(2) { background: var(--coral); }
.badge-dots i:nth-child(3) { background: var(--sun); }
/* the same serif headline, with an italic accent, as every other section */
.hero-text h1 {
  font-family: var(--display); font-weight: 750; letter-spacing: -.02em; line-height: 1.02;
  font-size: clamp(2.6rem, 1rem + 5vw, 14rem); margin: .2em 0 0;
  color: #FBF6EA; text-shadow: 0 2px 20px rgba(0, 0, 0, .35);
}
.hero-text h1 em { color: var(--sun); }   /* like "Ready when you are." further down */
.hero-actions p { font-size: clamp(1rem, .55rem + .62vw, 2.4rem); max-width: 36em; margin: .9em auto 1.3em; font-weight: 600; }

.transit { z-index: 2; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; will-change: opacity; }
.seasons { z-index: 3; opacity: 0; will-change: opacity; pointer-events: none; } /* nothing to click; it sits over the hero */
.season { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; }
.season.on { opacity: 1; }
.season img, .season video { width: 100%; height: 100%; object-fit: cover; display: block; }
.seasons::after { /* gentle vignette */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(42, 37, 29, .45));
}
/* comic-book caption boxes */
.caption {
  position: absolute; z-index: 8; background: var(--card); border: 2.5px solid var(--outline); border-radius: 6px;
  box-shadow: 6px 6px 0 var(--outline); padding: 1.4rem 1.6rem 1.5rem;
}
/* The seasons scene: big words in the open space left of the woman statue, no box.
   The video is cover-fitted, so where she lands depends on the window's shape:
   --fw/--fh are the video's drawn size and --free the room left of her (she starts
   29% across the frame). The words are sized to fit that room completely. */
.scene-caption {
  --m: max(24px, 4vw);
  --fw: max(100vw, 100svh * 16 / 9);
  --fh: calc(var(--fw) * 9 / 16);
  --free: calc(50vw - .21 * var(--fw) - var(--m));
  position: absolute; inset: 0; z-index: 8; pointer-events: none; opacity: 0; will-change: opacity;
}
/* a soft cream wash behind the words: it fades out just where she begins, and above the table */
.scene-wash { opacity: var(--sc, 1); }
.scene-words { opacity: clamp(0, (var(--sc, 1) - .45) / .55, 1); }   /* the words wait for their backing */
.scene-wash {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(250, 244, 228, .9) 0, rgba(250, 244, 228, .84) calc(var(--m) + var(--free) * .62),
    rgba(250, 244, 228, .66) calc(var(--m) + var(--free) * .9), rgba(250, 244, 228, 0) calc(var(--m) + var(--free) * 1.14));
  -webkit-mask-image: linear-gradient(180deg, #000 0 50%, transparent 66%); mask-image: linear-gradient(180deg, #000 0 50%, transparent 66%);
}
/* the statues and table are cut out of the words layer, with the video's cover fit */
.scene-words {
  position: absolute; inset: 0;
  -webkit-mask-image: linear-gradient(#000 0 0), url("/static/media/seasons-mask.png");
  mask-image: linear-gradient(#000 0 0), url("/static/media/seasons-mask.png");
  -webkit-mask-size: 100% 100%, cover; mask-size: 100% 100%, cover;
  -webkit-mask-position: 0 0, center; mask-position: 0 0, center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.scene-text { position: absolute; left: var(--m); width: var(--free); top: max(88px, calc(50svh - .415 * var(--fh))); }
.scene-head {
  margin: 0; font-size: calc(var(--free) / 7.1); line-height: .92; letter-spacing: -.025em; white-space: nowrap;
  color: var(--ink); text-shadow: 0 0 .25em rgba(250, 244, 228, .7);
}
.scene-head span, .scene-head em { display: block; }
.scene-head em { color: var(--meadow-deep); }
.scene-caption p {
  margin: 1.4em 0 0; max-width: 86%;
  font-size: clamp(14px, calc(var(--free) / 24), 24px); line-height: 1.5; font-weight: 600; color: var(--ink);
  text-shadow: 0 0 .6em rgba(250, 244, 228, .9);
}

.scroll-cue {
  position: absolute; z-index: 8; left: 50%; bottom: 22px; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: .3rem;
  color: #FFFBF0; text-decoration: none; font-weight: 800; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.scroll-cue svg { width: 18px; height: 28px; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { translate: 0 0; } 50% { translate: 0 6px; } }

/* seasonal particles over the scene */
.season-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.season-fx i { position: absolute; top: -6%; display: block; will-change: transform; animation: drift linear infinite; }
.season-fx.spring i { width: 10px; height: 7px; border-radius: 60% 40% 60% 40%; background: #FBF3E1; border: 1.5px solid #2A251D; }
.season-fx.summer i { width: 6px; height: 6px; border-radius: 50%; background: #F5D27A; box-shadow: 0 0 10px 4px rgba(245, 210, 122, .65); animation-name: hover; }
.season-fx.fall i { width: 14px; height: 9px; border-radius: 0 80% 0 80%; background: #C9773E; border: 1.5px solid #2A251D; }
.season-fx.fall i:nth-child(3n) { background: #D9A443; }
.season-fx.fall i:nth-child(4n) { background: #9E5A35; }
.season-fx.winter i { width: 90px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, .22); filter: blur(8px); animation-name: mist; }
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0); }
  100% { transform: translate(-18vw, 112vh) rotate(540deg); }
}
@keyframes hover {
  0% { transform: translate(0, 30vh); opacity: 0; }
  20%, 80% { opacity: 1; }
  100% { transform: translate(6vw, 10vh); opacity: 0; }
}
@keyframes mist {
  0% { transform: translate(-10vw, 60vh); opacity: 0; }
  30%, 70% { opacity: 1; }
  100% { transform: translate(20vw, 50vh); opacity: 0; }
}

/* ---------------------------------------------------------------- story */
.story { padding: 7rem max(24px, 5vw) 3rem; max-width: 1320px; margin: 0 auto; }
.story-intro, .section-title { text-align: center; max-width: 820px; margin: 0 auto 4rem; }
.story-intro h2, .section-title h2, .coach-copy h2, .final-cta h2 {
  font-size: clamp(2.2rem, 1.2rem + 3.4vw, 4.4rem); line-height: 1.02; letter-spacing: -.02em; font-weight: 750;
}
.section-title .lede { font-size: 1.15rem; color: var(--ink-soft); }
/* how it works: the spaced-repetition loop */
.story-intro .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 40em; margin: 0 auto; }
.loop { list-style: none; padding: 0; margin: 0 0 3rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.2rem; counter-reset: step; }
.loop li {
  position: relative; background: var(--card); border: 2.5px solid var(--outline); border-radius: 12px; padding: 1.2rem 1.2rem 1.3rem;
  box-shadow: 5px 5px 0 var(--outline);
}
.loop li:not(:last-child)::after { /* arrow to the next step */
  content: '→'; position: absolute; right: -1.45rem; top: 50%; translate: 0 -50%; z-index: 2;
  display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--sun); border: 2px solid var(--outline); font-weight: 900; font-size: 1.05rem; color: #2A251D;
}
.loop .step {
  display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; margin-bottom: .7rem;
  background: var(--sun); border: 2px solid var(--outline); font-weight: 800;
}
.loop h3 { font-size: 1.2rem; margin: 0 0 .35rem; }
.loop p { margin: 0; color: var(--ink-soft); }

/* The Leitner boxes as a pawn's walk up one file of the board. */
.ptrack {
  background: var(--card); border: 2.5px solid var(--outline); border-radius: 14px; box-shadow: 6px 6px 0 var(--outline);
  padding: clamp(1.3rem, 2.5vw, 2rem) clamp(1.2rem, 3vw, 2.4rem); margin-bottom: 3rem;
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.5fr); gap: clamp(1.4rem, 3vw, 3rem); align-items: center;
}
.ptrack-head h3 { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.9rem); line-height: 1.15; margin: 0 0 .7rem; }
.ptrack-head h3 em { color: var(--meadow-deep); }
.ptrack-head p { margin: 0; color: var(--ink-soft); }
.ptrack-file {
  position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 3px solid var(--outline); border-radius: 10px; overflow: visible; background: var(--outline);
}
.psq { position: relative; aspect-ratio: 1; background: var(--sq-light); }
.psq:nth-child(even) { background: var(--sq-dark); }
.psq:first-child { border-radius: 7px 0 0 7px; }
.psq.goal { border-radius: 0 7px 7px 0; background: color-mix(in srgb, var(--sun) 55%, var(--sq-light)); }
.psq::before { /* rank number, like the board's coordinates */
  content: attr(data-rank); position: absolute; top: .2em; left: .35em; font: 800 clamp(9px, 1.4vw, 13px) var(--sans); color: #2A251D; opacity: .7;
}
.psq .when {
  position: absolute; top: calc(100% + .55rem); left: 50%; translate: -50% 0; white-space: nowrap;
  font-size: clamp(.68rem, .6rem + .3vw, .85rem); font-weight: 700; color: var(--ink-soft);
}
.psq.goal .when { color: var(--meadow-deep); }
.psq.passed { box-shadow: inset 0 -5px 0 color-mix(in srgb, var(--meadow) 70%, transparent); }
.runner {
  position: absolute; top: 0; left: 0; width: calc(100% / 7); aspect-ratio: 1; translate: calc(var(--at) * 100%) 0;
  display: grid; place-items: center; pointer-events: none;
  transition: translate .55s cubic-bezier(.45, 0, .2, 1);  /* one square is its own width */
}
.runner.back { transition-duration: .9s; }
.runner img { grid-area: 1 / 1; width: 82%; height: 82%; transition: opacity .4s, transform .4s; filter: drop-shadow(0 3px 0 rgba(42, 37, 29, .35)); }
.runner .queen { opacity: 0; transform: scale(.6); }
.runner.promoted .pawn { opacity: 0; transform: scale(.6); }
.runner.promoted .queen { opacity: 1; transform: scale(1); }
.runner.hop img { animation: hop .55s ease; }
.runner.miss img { animation: shake .5s ease; }
@keyframes hop { 40% { translate: 0 -22%; } }
@keyframes shake { 20%, 60% { translate: -7% 0; } 40%, 80% { translate: 7% 0; } }
.ptrack-status {
  display: flex; align-items: center; gap: .6rem; margin: 2.6rem 0 0; min-height: 2.2rem; font-weight: 700;
}
.ptrack-status .mark { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 2px solid var(--outline); font-size: .95rem; flex: none; background: var(--paper); }
.ptrack-status.ok .mark { background: var(--meadow); color: #FFFBF0; }
.ptrack-status.no .mark { background: var(--coral); color: #FFFBF0; }
.ptrack-status.win .mark { background: var(--sun); }

.why { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.6rem; align-items: stretch; }
.curve-card {
  display: flex; flex-direction: column; justify-content: space-between;
  margin: 0; background: var(--card); border: 2.5px solid var(--outline); border-radius: 14px; box-shadow: 6px 6px 0 var(--outline);
  padding: 1.2rem 1.2rem .9rem;
}
.curve-card svg { width: 100%; height: auto; display: block; }
.curve .grid { stroke: var(--line-strong); stroke-width: 1; }
.curve .axis { font: 600 12px var(--sans); fill: var(--muted); }
.curve .review { stroke: var(--sun-deep); stroke-width: 1.5; stroke-dasharray: 4 4; }
.curve .forget { fill: none; stroke: var(--coral); stroke-width: 3.5; stroke-linecap: round; }
.curve .keep { fill: none; stroke: var(--meadow); stroke-width: 3.5; stroke-linejoin: round; }
.curve .lab { font: 800 14px var(--sans); }
.curve .forget-lab { fill: var(--coral-deep); }
.curve .keep-lab { fill: var(--meadow-deep); }
.curve-card figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.why-head h3 { font-size: clamp(1.4rem, 1.1rem + 1vw, 2.1rem); line-height: 1.2; max-width: 30em; margin: 0 0 1.4rem; }
.why-head h3 em { color: var(--meadow-deep); }
.compare {
  background: var(--card); border: 2.5px solid var(--outline); border-radius: 14px; box-shadow: 6px 6px 0 var(--outline);
  padding: 1.3rem 1.4rem 1.1rem; display: flex; flex-direction: column;
}
.compare h3 { font-size: 1.25rem; margin: 0 0 1rem; }
.compare-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.compare-table th, .compare-table td { border-bottom: 1.5px solid var(--line); padding: .7rem .35rem; }
.compare-table thead th { font-size: .74rem; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 700; text-align: center; vertical-align: bottom; line-height: 1.2; }
.compare-table tbody th { text-align: left; font-weight: 600; color: var(--ink); line-height: 1.3; text-transform: none; letter-spacing: 0; font-size: .92rem; }
.compare-table td { text-align: center; font-weight: 800; font-size: 1.05rem; }
.compare-table td.no { color: color-mix(in srgb, var(--coral-deep) 70%, transparent); }
.compare-table td.yes { color: var(--meadow-deep); }
.compare-table .us { background: color-mix(in srgb, var(--meadow) 16%, transparent); }
.compare-table thead th.us { color: var(--meadow-deep); border-radius: 8px 8px 0 0; }
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table tbody tr:last-child td.us { border-radius: 0 0 8px 8px; }
.compare-note { margin: auto 0 0; padding-top: 1rem; font-size: .8rem; color: var(--muted); }

/* -------------------------------------------------------------- lessons */
.lessons { padding: 3rem max(24px, 5vw) 6rem; max-width: 1180px; margin: 0 auto; }
.diagnosis { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.6rem; align-items: stretch; }
.diag-list, .diag-today {
  background: var(--card); border: 2.5px solid var(--outline); border-radius: 12px; box-shadow: 6px 6px 0 var(--outline);
}
.diag-list { display: flex; flex-direction: column; padding: 1.4rem 1.6rem 1.3rem; }
.diag-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.diag-title { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.diag-source { font-size: .82rem; color: var(--muted); font-weight: 600; }
.diag-key, .diag-rows li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) minmax(130px, 38%); gap: .9rem; align-items: center; }
.diag-key { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-bottom: .35rem; }
.diag-key span:first-child { grid-column: 2; }
.diag-rows { list-style: none; margin: 0; padding: 0; }
.diag-rows li { padding: .7rem 0; border-top: 1.5px solid var(--line); }
.diag-rows .n { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.diag-rows .t { font-weight: 700; line-height: 1.3; }
.diag-rows .t small { display: block; margin-top: .15rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.diag-rows .lost { display: flex; align-items: center; gap: .7rem; }
.diag-rows .lost b { flex: none; width: 5.3em; font-size: .9rem; font-variant-numeric: tabular-nums; }
.diag-rows .bar { flex: 1; height: 10px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.diag-rows .bar i { display: block; height: 100%; border-radius: 999px; background: var(--sun-deep); }
.diag-rows li.top .n { color: var(--coral-deep); }
.diag-rows li.top .bar i { background: var(--coral); }
.diag-how { margin: auto 0 0; padding-top: 1rem; border-top: 1.5px solid var(--line); font-size: .86rem; line-height: 1.5; color: var(--ink-soft); }
.diag-how b { color: var(--ink); }
.diag-today { display: flex; flex-direction: column; overflow: hidden; }
.diag-art { aspect-ratio: 2.4 / 1; background: var(--sun-soft); border-bottom: 2.5px solid var(--outline); position: relative; overflow: hidden; }
.diag-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.diag-art:has(img) { aspect-ratio: 16 / 9; }   /* the lesson's picture, uncropped */
.diag-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.diag-body { display: flex; flex-direction: column; flex: 1; padding: 1.3rem 1.5rem 1.5rem; }
.diag-body .btn { margin-top: auto; align-self: flex-start; }
.diag-body h3 { font-size: 1.6rem; margin: .1rem 0 .4rem; }
.diag-why { color: var(--ink-soft); margin: 0 0 .9rem; }
.diag-q { font-family: var(--display); font-style: italic; font-size: 1.15rem; margin: 0 0 1.2rem; }

/* ------------------------------------------------------------ the coach */
.coach-section {
  max-width: 1200px; margin: 0 auto; padding: 3rem max(24px, 5vw) 7rem;
  display: grid; grid-template-columns: minmax(240px, .75fr) minmax(0, 1.25fr); gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.coach-portrait { margin: 0; justify-self: center; max-width: 340px; }
.coach-portrait .xray { filter: drop-shadow(10px 12px 0 rgba(42, 37, 29, .14)); }
.coach-portrait img { width: 100%; height: auto; display: block; }
/* The X-ray: the bust turns see-through in a circle around the cursor; underneath, clipped
   to the bust's outline, is the engine that does the thinking. */
@property --xr { syntax: '<length>'; inherits: true; initial-value: 0px; }
.xray { position: relative; --xx: 50%; --xy: 40%; --xr: 0px; transition: --xr .4s cubic-bezier(.2, .8, .2, 1); }
.xray.on { --xr: 120px; }
.xray-bust {
  position: relative; z-index: 2;
  -webkit-mask-image: radial-gradient(circle at var(--xx) var(--xy), transparent calc(var(--xr) * .8), #000 var(--xr));
  mask-image: radial-gradient(circle at var(--xx) var(--xy), transparent calc(var(--xr) * .8), #000 var(--xr));
}
.xray-engine {
  position: absolute; inset: 0; z-index: 1; overflow: hidden; display: grid; place-items: center; align-content: center; gap: .6rem;
  background: radial-gradient(circle at 50% 38%, #2C5E47, #12291F 72%);
  -webkit-mask-image: url("/static/media/coach/coach-knight.png"); mask-image: url("/static/media/coach/coach-knight.png");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.engine-out {
  position: absolute; left: 0; right: 0; top: 0; margin: 0; padding: 0 8%;
  font: 500 10px/1.55 ui-monospace, 'JetBrains Mono', 'Fira Code', monospace; color: rgba(205, 233, 214, .42);
  white-space: pre-wrap; word-break: break-all;   /* still: an animated layer under the bust made it tear */
}
.engine-logo {
  position: relative; width: 66%; margin-top: -14%;
  /* the icon's square tile melts into the dark green, so no hard edges show through the smoke */
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent 100%); mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
}
.engine-name { position: relative; font: 700 .8rem ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: #DDF0E2; }
/* smoke mode: the canvas draws the bust (the <img> stays for layout and alt text) */
.xray.smoke { touch-action: pan-y; cursor: grab; }
.xray.smoke .xray-bust { visibility: hidden; }
.xray.smoke .xray-engine { display: none; }   /* the canvas draws the engine (and the shadow) itself */
.coach-portrait .xray.smoke { filter: none; }
/* while the GPU context is lost: the plain bust, with its shadow, nothing underneath */
.xray.smoke-off .xray-bust { visibility: visible; filter: drop-shadow(10px 12px 0 rgba(42, 37, 29, .14)); }
.xray.smoke-off .xray-smoke { visibility: hidden; }
.xray-smoke { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; }
.xray-hint { margin-top: .9rem; text-align: center; font-size: .85rem; color: var(--muted); font-weight: 600; }
.xray-hint .no-hover { display: none; }
@media (hover: none) { .xray-hint .can-hover { display: none; } .xray-hint .no-hover { display: inline; } }
@media (prefers-reduced-motion: reduce) { .xray { transition: none; } }
.coach-copy .lede { font-size: 1.12rem; color: var(--ink-soft); }
.quote-card {
  margin-top: 1.6rem; background: var(--card); border: 2.5px solid var(--outline); border-radius: 10px; padding: 1.2rem 1.4rem;
  box-shadow: 6px 6px 0 var(--outline); rotate: -.6deg;
}
.quote-card .q-move { font-family: var(--display); font-weight: 750; font-size: 1.4rem; display: flex; align-items: center; gap: .6rem; }
.quote-card .q-move span {
  font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #FFFBF0;
  background: var(--c-blunder); padding: .25em .7em; border-radius: 4px; border: 2px solid var(--outline);
}
.quote-card p { margin: .7rem 0 0; font-size: 1.05rem; }
.quote-card .q-take { background: var(--sun-soft); padding: .7rem .9rem; border-radius: 6px; font-size: .98rem; border: 2px dashed var(--sun-deep); }

/* ------------------------------------------------------------ final cta */
.final-cta {
  position: relative; isolation: isolate; overflow: hidden; margin: 0 max(16px, 3vw) 3rem; border-radius: 14px;
  padding: clamp(4rem, 8vw, 8rem) max(24px, 5vw); text-align: center;
  background: var(--meadow-deep); border: 3px solid var(--outline); box-shadow: 8px 8px 0 var(--outline);
}
.final-cta h2 { color: #FFFBF0; }
.final-cta h2 em { color: var(--sun); }
.final-cta .lede { color: #E7EAD6; font-size: 1.2rem; margin-bottom: 2rem; }
.final-inner { position: relative; z-index: 2; }
/* a row of herald trumpets on each side, flags with the knight hanging under them */
.final-horns { position: absolute; width: clamp(190px, 25vw, 360px); bottom: 6%; z-index: 1; }
.final-horns.left { left: 0; }
.final-horns.right { right: 0; }
.final-horns svg { width: 100%; height: auto; display: block; overflow: visible; }
.final-horns .flag { transform-box: fill-box; transform-origin: 50% 0; animation: flag-sway 4.5s ease-in-out infinite; animation-delay: calc(var(--i) * -1.4s); }
@keyframes flag-sway { 50% { transform: rotate(2.2deg) skewX(-2deg); } }
/* point at the button and the trumpets blare: they lift, shake, sound waves burst from
   the bells and the flags flutter (.blaring is set in home.js, which also plays the sound) */
.final-horns .horn { transform-box: view-box; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.final-horns.left .horn { transform-origin: 0 100%; }
.final-horns.right .horn { transform-origin: 100% 100%; }
.final-cta.blaring .final-horns.left .horn { transform: rotate(-4deg); }
.final-cta.blaring .final-horns.right .horn { transform: rotate(4deg); }
.final-horns .wave {
  fill: none; stroke: #F8DC8E; stroke-width: 3.5; stroke-linecap: round; opacity: 0;
  transform-box: fill-box; transform-origin: 0% 50%;
}
.final-cta.blaring .final-horns .wave { animation: blast .9s ease-out infinite; animation-delay: calc(var(--k) * .3s + var(--i) * .08s); }
@keyframes blast {
  0% { opacity: 0; transform: translateX(0) scale(.6); }
  20% { opacity: .95; }
  100% { opacity: 0; transform: translateX(48px) scale(1.8); }
}
.final-cta.blaring .final-horns .body { animation: buzz .08s linear infinite; }
@keyframes buzz { 50% { transform: translate(.9px, -.7px); } }
.final-cta.blaring .final-horns .flag { animation-duration: .7s; }
@media (prefers-reduced-motion: reduce) {
  .final-horns .flag, .final-cta.blaring .final-horns .body { animation: none; }
  .final-horns .horn { transition: none; }
  .final-cta.blaring .final-horns .wave { animation: none; opacity: .8; transform: translateX(14px); }
}
/* phones: smaller trumpets in the bottom corners, under the button */
@media (max-width: 700px) {
  .final-cta { padding-bottom: 168px; }
  .final-horns { width: 136px; bottom: 10px; }
}

/* --------------------------------------------------------------- footer */
/* Cream-white type printed straight onto a green night sky, with the statue
   skyline (Grok art) along the bottom. The sky is the same green as the page,
   and a fine paper grain lies over all of it. */
.site-foot {
  --foot-green: var(--meadow-deep);   /* the skyline art's sky is recoloured to match */
  --foot-ink: #F7F1E3;
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--foot-green); color: var(--foot-ink); border-top: 3px solid var(--outline);
  padding: clamp(56px, 6.5vw, 112px) clamp(20px, 5vw, 80px) 0;
}
.site-foot::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .22; mix-blend-mode: overlay; /* over the art, under the text */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}
.foot-defs { position: absolute; width: 0; height: 0; }
.foot-inner {
  position: relative; z-index: 2; max-width: 1360px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 2.6fr) minmax(0, 1.2fr); gap: clamp(2rem, 4vw, 4.5rem);
}
.site-foot a { color: var(--foot-ink); text-decoration: none; }
/* print grain on the big lettering only; small text stays crisp */
.foot-brand .brand span { filter: url(#foot-grain); }
.foot-brand .brand { display: inline-flex; align-items: center; gap: .7rem; font-family: var(--display); font-weight: 500; font-size: clamp(1.6rem, 1.1rem + 1vw, 2.4rem); letter-spacing: -.01em; }
.foot-brand .brand .logo { height: 1.6em; width: auto; }
.foot-tag { font-family: var(--display); font-style: italic; font-size: clamp(1.02rem, .9rem + .25vw, 1.25rem); line-height: 1.6; margin: 1.3rem 0 0; opacity: .92; max-width: 22em; }
.foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.site-foot h4 {
  font-family: var(--display); font-weight: 500; font-size: clamp(.86rem, .8rem + .15vw, 1.05rem);
  text-transform: uppercase; letter-spacing: .16em; margin: .55rem 0 1.4rem; color: var(--foot-ink);
}
.site-foot h4::after { content: ''; display: block; width: 2.6rem; height: 1.5px; background: currentColor; margin-top: .85rem; opacity: .85; }
.foot-cols a { display: block; font-size: clamp(.95rem, .88rem + .2vw, 1.12rem); margin: 0 0 .85rem; opacity: .9; }
.foot-cols a:hover { opacity: 1; text-decoration: underline; text-underline-offset: .2em; }
.foot-cta p { font-family: var(--display); font-style: italic; font-size: clamp(1rem, .92rem + .2vw, 1.15rem); line-height: 1.55; margin: 0 0 1.3rem; opacity: .92; }
.foot-btn { display: inline-flex; align-items: stretch; border: 1.5px solid var(--foot-ink); font-weight: 600; }
.foot-btn span { padding: .75em 1.4em; }
.foot-btn i { display: grid; place-items: center; padding: 0 .95em; font-style: normal; font-size: 1.15em; background: var(--foot-ink); color: var(--foot-green); transition: padding .2s ease; }
.foot-btn:hover i { padding: 0 1.25em; }
.foot-bottom {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .6rem 2rem;
  padding-top: clamp(1.4rem, 2.5vw, 2.4rem); font-size: .9rem; opacity: .85;
}
.foot-built { font-family: var(--display); font-style: italic; }
.foot-built b { font-weight: 400; margin: 0 .7em; opacity: .7; }
/* full width; its empty sky tucks up under the text */
.foot-skyline {
  position: relative; z-index: 1; aspect-ratio: 2160 / 864; min-height: 250px; /* narrow screens crop the sides */
  margin: clamp(-260px, -13vw, -30px) calc(-1 * clamp(20px, 5vw, 80px)) 0;
}
.foot-skyline img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%); mask-image: linear-gradient(180deg, transparent 0, #000 22%);
}

/* --------------------------------------------------------------- motion */
.reveal { opacity: 0; translate: 0 36px; transition: opacity .9s cubic-bezier(.2, .7, .2, 1), translate .9s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; translate: 0 0; }
.spot-card.reveal:nth-child(4n + 2) { transition-delay: .08s; }
.spot-card.reveal:nth-child(4n + 3) { transition-delay: .16s; }
.spot-card.reveal:nth-child(4n + 4) { transition-delay: .24s; }

/* without motion: the hero, then the seasons scene, no dive */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; translate: none; }
  .dive { height: auto; }
  .dive-stage { position: relative; height: auto; }
  .garden, .seasons { position: relative; height: 100vh; }
  .seasons { opacity: 1; }
  .transit, .scroll-cue { display: none; }
  .scene-caption { opacity: 1; --sc: 1; }
  .season-fx i, .scroll-cue svg { animation: none; }
}

@media (max-width: 900px) {
  .coach-section, .why { grid-template-columns: 1fr; }
  .loop { grid-template-columns: 1fr 1fr; }
  .loop li:not(:last-child)::after { display: none; }
  .ptrack { grid-template-columns: 1fr; }
  .home-nav nav { display: none; }
  .home-nav .nav-cta { margin-left: auto; }
  .foot-inner { grid-template-columns: 1fr; }
  .diagnosis { grid-template-columns: 1fr; }
  .foot-cols { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .hero-copy { top: 92px; }
}

/* stand-in seasons until the Grok renders arrive: one still, graded per season */
.season.stand-in.winter img { filter: saturate(.35) brightness(1.06) contrast(.95) hue-rotate(-8deg); }
.season.stand-in.spring img { filter: saturate(1.1) brightness(1.04); }
.season.stand-in.summer img { filter: saturate(1.35) brightness(1.06) contrast(1.05); }
.season.stand-in.fall img { filter: sepia(.45) saturate(1.35) hue-rotate(-14deg); }

/* Hero video: the piece is in the footage, so the separate cut-out isn't shown. */
.garden.in-footage .garden-piece { display: none; }
/* winter now has snow */
.season-fx.winter i { width: 6px; height: 6px; border-radius: 50%; background: #FFFDF6; border: 1px solid rgba(42, 37, 29, .5); filter: none; animation-name: drift; }

/* badge and button grow with the headline on big screens */
.hero-badge { font-size: clamp(.86rem, .4rem + .5vw, 1.9rem); }
.hero-actions .btn { font-size: clamp(1.05rem, .55rem + .6vw, 2.2rem); }
.badge-dots i { width: 1.35em; height: 1.35em; margin-left: -.35em; }

/* --------------------------------------------------------------- portrait */
/* Tall screens see a slice of the landscape art. The knight stands right of centre,
   wholly in view; the headline sits above it and the subtitle and button at its feet. The seasons words move to the bottom, on
   a cream wash, where they don't cover the statues. */
@media (max-aspect-ratio: 4/5) {
  .garden-img { object-position: 60% 50%; }
  .hero-copy { top: calc(env(safe-area-inset-top) + 66px); bottom: calc(env(safe-area-inset-bottom) + 88px + var(--hidden)); justify-content: space-between; }
  .hero-text, .hero-actions { width: calc(100% - 32px); }
  .hero-text h1 { font-size: min(8.6vw, 4.6rem); margin-top: .35em; }
  .hero-badge { font-size: clamp(.75rem, .5rem + 1vw, 1rem); }
  .hero-actions p { font-size: clamp(1rem, .7rem + 1.2vw, 1.4rem); max-width: 21em; margin: 0 auto 1.1em; }
  .scroll-cue { bottom: calc(env(safe-area-inset-bottom) + 14px + var(--hidden)); white-space: nowrap; }

}

/* Anything narrower than 3:2 (phones, square-ish windows): the room beside the statue
   gets too narrow for the seasons words, so they move to the bottom on a cream wash. */
@media (max-aspect-ratio: 3/2) {
  .scene-words { -webkit-mask-image: none; mask-image: none; }
  .scene-wash {
    background: linear-gradient(0deg, rgba(250, 244, 228, .94) 0, rgba(250, 244, 228, .88) 30%, rgba(250, 244, 228, 0) 56%);
    -webkit-mask-image: none; mask-image: none;
  }
  .scene-text {
    left: max(20px, 5vw); right: max(20px, 5vw); width: auto; top: auto;
    bottom: calc(env(safe-area-inset-bottom) + max(30px, 5vh) + var(--hidden));
  }
  .scene-head { font-size: min(10.4vw, 5rem); }
  .scene-caption p { font-size: clamp(1rem, .8rem + .8vw, 1.25rem); max-width: 34em; margin-top: .9em; }
}

/* short landscape screens (phones on their side): a tighter hero, and the scene's words
   stay in front (on a phone on its side they would run into the table) */
@media (max-height: 520px) and (min-aspect-ratio: 4/5) {
  .scene-words { -webkit-mask-image: none; mask-image: none; }
  .scene-caption p { max-width: 100%; }
  .hero-copy { top: 54px; }
  .hero-text h1 { font-size: min(1rem + 4.4vw, 14vh); }
  .hero-badge { font-size: .75rem; }
  .hero-actions p { font-size: .95rem; margin: .5em auto .8em; max-width: 34em; }
  .hero-actions .btn { font-size: .95rem; padding: .7em 1.2em; }
  .scroll-cue { display: none; }
}

/* ------------------------------------------------------------------ phones */
@media (max-width: 760px) {
  /* the links tuck away while you read down and come back when you scroll up (home.js) */
  .home-nav { gap: 1rem; padding: max(10px, env(safe-area-inset-top)) 16px 10px; transition: transform .3s ease; }
  .home-nav.tucked { transform: translateY(calc(-100% - 6px)); }
  .home-nav .brand { font-size: 1.05rem; }
  .home-nav .brand .logo { height: 34px; }
  .nav-cta { padding: .5em 1em; background: var(--halo); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

  .story { padding: 4.5rem 18px 2rem; }
  .story-intro h2, .section-title h2, .coach-copy h2, .final-cta h2, .why-head h3, .ptrack-head h3 { text-wrap: balance; }
  .story-intro, .section-title { margin-bottom: 2.4rem; }
  .story-intro .lede, .section-title .lede { font-size: 1.05rem; }
  .loop { grid-template-columns: 1fr; gap: .9rem; margin-bottom: 2rem; }
  .loop li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .9rem; padding: 1rem 1.1rem; box-shadow: 4px 4px 0 var(--outline); }
  .loop .step { grid-row: span 2; margin: 0; }
  .loop li:not(:last-child)::after { display: grid; right: auto; top: auto; left: 50%; bottom: -1.45rem; translate: -50% 0; rotate: 90deg; }
  .loop h3 { font-size: 1.1rem; margin: .25rem 0 .25rem; }
  .ptrack { padding: 1.2rem 1rem 1.1rem; margin-bottom: 2rem; box-shadow: 5px 5px 0 var(--outline); }
  /* the waits alternate under and over the file so each has two squares of room */
  .ptrack-file { margin-top: 2rem; }
  .psq .when { font-size: .75rem; }
  .psq:nth-child(even) .when { top: auto; bottom: calc(100% + .5rem); }
  .ptrack-status { margin-top: 2.4rem; }
  .why-head h3 { margin-bottom: 1.1rem; }
  .why { gap: 1.2rem; }
  .curve-card { padding: 1rem .9rem .8rem; box-shadow: 5px 5px 0 var(--outline); }
  .curve-card svg { overflow: visible; }
  .curve .axis { font-size: 19px; }
  .curve .lab { font-size: 27px; }
  .compare { padding: 1.1rem .9rem 1rem; box-shadow: 5px 5px 0 var(--outline); }
  .compare h3 { font-size: 1.15rem; }
  .compare-table thead th { font-size: .75rem; padding: .5rem .15rem; }
  .compare-table tbody th { width: 42%; font-size: .88rem; padding: .6rem .35rem .6rem 0; }
  .compare-table td { padding: .6rem .15rem; }

  .lessons { padding: 2rem 18px 4rem; }
  .diag-list { padding: 1.1rem 1rem 1rem; }
  .diag-key { display: flex; justify-content: space-between; padding-left: 2.2rem; font-size: .75rem; }
  .diag-rows li { grid-template-columns: 1.4rem minmax(0, 1fr); column-gap: .8rem; row-gap: .5rem; }
  .diag-rows .lost { grid-column: 2; }
  .diag-body { padding: 1.1rem 1.1rem 1.3rem; }
  .diag-body h3 { font-size: 1.4rem; }

  .coach-section { padding: 1.5rem 18px 4.5rem; gap: 1.8rem; }
  .coach-portrait { max-width: 250px; }
  .quote-card { padding: 1rem 1.1rem; }
  .quote-card .q-move span { font-size: .75rem; }
  .final-cta { margin: 0 12px 2.5rem; padding-top: 3.2rem; }
  .final-cta .lede { font-size: 1.05rem; }

  .site-foot h4 { margin: .3rem 0 .9rem; }
  .foot-cols { grid-template-columns: 1fr 1fr; gap: .6rem 1.5rem; }
  .foot-cols a { padding: .5rem 0; margin: 0 0 .1rem; }
}
@media (max-width: 420px) { .home-nav .brand span { display: none; } }
@media (max-width: 380px) { .hero-badge .badge-dots { display: none; } .hero-badge { padding-left: .9em; } }
/* tablets: no label under 12px */
@media (max-width: 1099px) {
  .compare-table thead th, .diag-key, .quote-card .q-move span { font-size: .75rem; }
  .psq .when { font-size: max(.75rem, .6rem + .3vw); }
}

/* wide screens: the words in a column on the left, so the knight stands clear on the right */
@media (min-aspect-ratio: 4/5) and (min-width: 900px) {
  .hero-copy { left: max(32px, 5vw); right: auto; width: min(42vw, 1100px); top: max(110px, 19vh); align-items: flex-start; text-align: left; }
  .hero-text, .hero-actions { width: 100%; }
  .hero-text h1 { font-size: clamp(2.3rem, .3rem + 3.6vw, 10rem); }   /* two lines in the column */
  .hero-actions p { margin: .9em 0 1.3em; max-width: 30em; }
  .hero-text::before { left: 44%; width: 122%; height: 210%; background: radial-gradient(closest-side, rgba(18, 22, 16, .82), rgba(18, 22, 16, .6) 55%, rgba(18, 22, 16, 0)); }
  .hero-actions::before { left: 40%; width: 112%; background: radial-gradient(closest-side, rgba(18, 22, 16, .78), rgba(18, 22, 16, .52) 55%, rgba(18, 22, 16, 0)); }
}