/* Academy (/academy), and the pieces the Bootcamp page shares with it: page head
   with a position, position boards, the intake finale. Everything here reads
   without JavaScript; js/academy.js adds the scenes. The pinned chapters layout
   (.is-pinned) only exists while the motion layer runs it. */

/* ---------- Page head: copy and one position ---------- */
.ac-head { padding-block: clamp(2rem, 6vh, 4rem) clamp(4rem, 10vh, 7rem); overflow-x: clip; }
.ac-head-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: center; min-height: min(calc(100dvh - var(--nav-h) - 5rem), 42rem); }
.ac-eyebrow { font-size: .9375rem; color: var(--muted); }
/* a link in the eyebrow (the Bootcamp breadcrumb): a 44px tap target that does not move the line */
.ac-eyebrow a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .3em; }
.ac-eyebrow a:hover { color: var(--fg); }
.ac-head h1 { margin-top: 1.25rem; font-size: var(--d-1); line-height: 1.2; max-width: 15em; }
.ac-lede { margin-top: 1.5rem; max-width: 32rem; color: var(--fg-2); font-size: clamp(1.0625rem, 1.3vw, 1.25rem); line-height: 1.6; }
.ac-head .ctas, .ac-finale .ctas { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2.25rem; }
.ac-status { margin-top: 1.5rem; display: inline-flex; align-items: center; gap: .65rem; font-size: .875rem; color: var(--fg-2); }
.ac-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--fg); }
.ac-status.open .ac-dot { background: var(--fg); }
.ac-status.open .ac-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--fg); opacity: 0; animation: ac-ping 2.8s var(--ease) infinite; }
@keyframes ac-ping { 0% { transform: scale(.5); opacity: .5; } 70%, 100% { transform: scale(1.6); opacity: 0; } }

.ac-hero { position: relative; justify-self: end; width: fit-content; margin: 0; }
.ac-hero-drawing { top: -2.5rem; right: -3rem; width: 17rem; height: 17rem; --sq: 4.25rem; }
.ac-hero-sheet { position: relative; z-index: 1; padding: clamp(1.5rem, 2.5vw, 2.25rem) clamp(1.5rem, 2.5vw, 2.25rem) 1rem 1rem; }
.ac-hero-cap { position: relative; z-index: 1; margin-top: 1rem; padding-left: 1rem; max-width: 19rem; font-size: .8125rem; line-height: 1.5; color: var(--muted); }
.hero-pos { --pos-s: clamp(4rem, 6.2vw, 5.5rem); }

/* Failsafe: the head waits for its intro, and shows itself if the motion layer never starts */
.js-motion:not(.ac-ready) .ac-head-copy > *, .js-motion:not(.ac-ready) .ac-hero { opacity: 0; animation: ac-show 0s 2.5s forwards; }
@keyframes ac-show { to { opacity: 1; } }

/* ---------- Position: a fragment of a tournament board, with coordinates ---------- */
.pos { --s: var(--pos-s, 3.25rem); position: relative; display: grid; width: max-content;
  grid-template-columns: 1rem repeat(var(--nf), var(--s)); grid-template-rows: repeat(var(--nr), var(--s)) 1.25rem; }
.pos .rk, .pos .fl { font-size: .75rem; color: var(--muted); display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.pos .fl { font-family: var(--display); font-size: .75rem; }
.pos .sq { position: relative; background: var(--tb-l); }
.pos .sq.d { background: var(--tb-d); background-image: linear-gradient(135deg, rgba(255,255,255,.07), transparent 55%); }
.pos .sq.hl::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--fg) 16%, transparent); opacity: var(--hl, 1); }
.pos .frame { position: absolute; left: 1rem; top: 0; width: calc(var(--s) * var(--nf)); height: calc(var(--s) * var(--nr)); border: 1px solid var(--tb-edge); pointer-events: none; }
.pos .trace { position: absolute; left: 1rem; top: 0; width: calc(var(--s) * var(--nf)); height: calc(var(--s) * var(--nr)); overflow: visible; pointer-events: none; z-index: 1; color: var(--fg); }
.pos .trace path { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-dasharray: 3 4; stroke-linecap: round; }
.pos .trace circle { fill: currentColor; }
.pos .ring { position: absolute; inset: 11%; overflow: visible; pointer-events: none; }
.pos .ring circle { fill: none; stroke: var(--fg); stroke-width: 1.3; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.pos .sq.d .ring circle { stroke: var(--tb-l); }
.pos .dot { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--muted); }
.pos .sq.d .dot { background: var(--tb-l); opacity: .7; }
.pos-piece { position: absolute; left: 1rem; top: 0; width: var(--s); height: var(--s); z-index: 2; pointer-events: none;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%)); }
.pos-piece [data-piece] { position: absolute; inset: 8%; transform: translateY(var(--lift, 0%)) scale(var(--ps, 1)); transform-origin: 50% 90%; }
.pos-piece .pc { filter: drop-shadow(0 6px 5px rgba(0,0,0,.16)); }
html[data-theme="dark"] .pos-piece .pc { filter: drop-shadow(0 6px 6px rgba(0,0,0,.5)); }

/* A gate on the boundary between two ranks: two bars that part on approval */
.gate { position: absolute; left: 1rem; height: 0; z-index: 3; pointer-events: none; }
.gate i { position: absolute; top: -1.5px; width: 50%; height: 3px; background: var(--fg); transform: scaleX(.14); }
.gate i::after { content: ""; position: absolute; top: -3px; width: 1px; height: 9px; background: var(--fg); }
.gate .gl { left: 0; transform-origin: 0 50%; }
.gate .gl::after { left: 0; }
.gate .gr { right: 0; transform-origin: 100% 50%; }
.gate .gr::after { right: 0; }

/* ---------- The chapters: a pawn climbs one rank per phase ---------- */
.ch-scene { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
.ch-side { position: sticky; top: calc(var(--nav-h) + 2rem); }
.ch-board-wrap { position: relative; width: max-content; margin-top: clamp(2rem, 5vh, 3rem); }
.ch-drawing { left: -3.5rem; bottom: -3rem; width: 19rem; height: 19rem; --sq: 4.25rem; }
.ch-board { position: relative; z-index: 1; padding: 1.5rem 1.75rem .9rem 1rem; }
.ch-pos { --pos-s: clamp(3.4rem, 8vh, 4.75rem); }
.ch-pos .gate { width: calc(var(--s) * 3); top: calc(var(--s) * var(--gr)); }
.ch-list { display: grid; gap: clamp(3rem, 8vh, 5rem); }
.ac-ch { position: relative; padding-top: clamp(3.5rem, 6vw, 5.25rem); }
.ch-num { position: absolute; z-index: 0; top: 0; left: -.35rem; font-family: var(--display); font-size: clamp(4.5rem, 7vw, 6.75rem); line-height: 1; letter-spacing: -.02em; color: color-mix(in srgb, var(--fg) 13%, var(--bg)); }
.ch-card { position: relative; z-index: 1; padding: clamp(1.5rem, 3vw, 2.5rem); }
.ch-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; font-weight: 500; font-size: .9375rem; color: var(--muted); }
.ch-sq { font-family: var(--display); font-weight: 400; font-size: .75rem; padding: .2rem .45rem; border: 1px solid var(--line-2); color: var(--fg-2); }
.ch-sep { width: 4px; height: 4px; margin: 0 .15rem; background: var(--line-2); transform: rotate(45deg); }
.ch-card h3 { margin-top: .7rem; font-size: clamp(1.5rem, 2.4vw, 2.2rem); line-height: 1.15; }
.ch-summary { margin-top: .75rem; color: var(--fg-2); font-size: 1.125rem; }
.ch-focus { color: var(--muted); }
.ch-topics-h { margin-top: 1.5rem; font-size: .8125rem; font-weight: 500; letter-spacing: .02em; color: var(--muted); }
.ch-topics { margin-top: .5rem; display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.75rem; }
.ch-topics li { display: flex; align-items: baseline; gap: .7rem; padding: .55rem 0; border-top: 1px solid var(--line); color: var(--fg-2); font-size: .96875rem; line-height: 1.45; }
.ch-topics li::before { content: ""; flex: none; width: 5px; height: 5px; background: var(--fg); transform: translateY(-2px) rotate(45deg); }
.ch-gate { margin-top: 1.5rem; display: flex; align-items: center; gap: .8rem; font-size: .875rem; color: var(--fg-2); }
.ch-gate-ico { flex: none; display: flex; justify-content: space-between; width: 1.6rem; height: 3px; }
.ch-gate-ico i { width: 28%; height: 100%; background: var(--fg); }
.ch-more { margin-top: .4rem; font-size: .9375rem; }
.ch-rail { display: none; }
.ch-duration { margin-top: clamp(2.5rem, 6vh, 4rem); }

/* Pinned (desktop, set by js/academy.js): one chapter at a time over the board */
.ac-chapters.is-pinned { padding-block: 0; }
.ac-chapters.is-pinned .ch-wrap { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding-top: calc(var(--nav-h) + .75rem); padding-bottom: 1.5rem; }
.ac-chapters.is-pinned .ch-scene { align-items: center; }
.ac-chapters.is-pinned .ch-side { position: static; }
.ac-chapters.is-pinned .ch-list { gap: 0; }
.ac-chapters.is-pinned .ac-ch { grid-area: 1 / 1; }
.ac-chapters.is-pinned .ch-rail { display: grid; grid-template-columns: repeat(var(--n), 1fr); column-gap: 1rem; margin-top: clamp(1.25rem, 3.5vh, 2.5rem); }
.ch-rail .bar { grid-column: 1 / -1; position: relative; height: 1px; margin-bottom: .8rem; background: var(--line); }
.ch-rail .bar i { position: absolute; inset: -.5px 0; background: var(--fg); transform: scaleX(0); transform-origin: 0 50%; }
.ch-rail .lbl { font-weight: 500; font-size: .9375rem; color: var(--muted); transition: color .35s; }
.ch-rail .lbl.on { color: var(--fg); }
.ac-chapters.is-pinned .ch-duration { margin-top: .6rem; }

/* ---------- The phase gate ---------- */
.ac-gate { position: relative; margin-top: clamp(3rem, 7vw, 5rem); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.gate-steps { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); }
/* the line runs from the first step to the edge of the board, where the gate is */
.gate-line { position: absolute; left: 1.4rem; right: calc(1rem + var(--pos-s) * 3); top: 1.4rem; height: 1px; background: var(--line); }
.gate-line i { position: absolute; inset: -.5px 0; background: var(--fg); transform-origin: 0 50%; }
.gate-no { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 2.8rem; height: 2.8rem; font-family: var(--display); font-size: .9375rem; border: 1px solid var(--fg); background: var(--bg); }
.gate-step h3 { margin-top: 1.25rem; font-family: var(--display); font-weight: 400; font-size: clamp(1.05rem, 1.4vw, 1.2rem); line-height: 1.35; }
.gate-step p { margin-top: .6rem; color: var(--fg-2); max-width: 20rem; }
.ac-gate { --pos-s: 2.9rem; }
.gate-end { position: relative; padding-top: 0; }
.gate-mini { left: 1rem; top: var(--pos-s); width: calc(var(--pos-s) * 3); }

/* ---------- How you learn: four squares ---------- */
.ac-method { margin: clamp(3rem, 7vw, 5rem) 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.75rem, 1.5vw, 1.25rem); max-width: 62rem; }
.ac-tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: clamp(15rem, 25vw, 19.5rem); padding: clamp(1.5rem, 3.2vw, 2.75rem); }
.ac-tile.alt { background: color-mix(in srgb, var(--fg) 5%, var(--vl)); }
.tile-co { position: absolute; top: 1rem; left: 1.25rem; font-family: var(--display); font-size: .75rem; color: var(--muted); }
.tile-no { position: absolute; top: .6rem; right: 1.25rem; font-family: var(--display); font-size: clamp(3rem, 5vw, 4.5rem); line-height: 1; color: color-mix(in srgb, var(--fg) 11%, transparent); }
.ac-tile h3 { font-size: clamp(1.2rem, 1.8vw, 1.55rem); line-height: 1.25; }
.ac-tile p { margin-top: .65rem; color: var(--fg-2); max-width: 26rem; }

/* ---------- Eligibility and assessment ---------- */
.ac-elig { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(2rem, 5vw, 5rem); }
.ac-elig-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 4vw, 4rem); }
.elig-col h3 { font-family: var(--display); font-weight: 400; font-size: 1.125rem; padding-bottom: .9rem; border-bottom: 1px solid var(--fg); }
.elig-col p { margin-top: 1rem; color: var(--fg-2); }

/* ---------- Program catalog ---------- */
/* groups flow into balanced columns, so short groups never leave holes */
.ac-cat { margin-top: clamp(2.5rem, 6vw, 4rem); columns: 3; column-gap: clamp(2rem, 4vw, 4rem); }
.cat-group { break-inside: avoid; padding-bottom: 2.75rem; }
.cat-group h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line-2); font-weight: 600; font-size: .9375rem; }
.cat-n { font-family: var(--display); font-weight: 400; font-size: .75rem; color: var(--muted); }
.cat-group li { padding: .6rem 0; border-bottom: 1px solid var(--line); color: var(--fg-2); font-size: .96875rem; line-height: 1.45; }
.cat-link { margin-top: 2.25rem; }

/* ---------- Intake finale ---------- */
.ac-finale { position: relative; padding-block: clamp(4rem, 10vw, 8rem) clamp(4rem, 8vw, 6rem); }
.ac-finale-panel { max-width: 44rem; margin: 0 auto; padding: clamp(2rem, 5vw, 3.75rem); text-align: center; }
.ac-finale-panel .ac-status { margin-top: 0; }
.ac-finale-panel h2 { margin-top: 1.1rem; font-size: clamp(1.9rem, 4.6vw, 3.6rem); line-height: 1.2; }
.ac-finale-body { max-width: 30rem; margin: 1.25rem auto 0; color: var(--fg-2); font-size: 1.125rem; }
.ac-finale .ctas { justify-content: center; margin-top: 2rem; }
.ac-finale .note { margin-top: 1.5rem; }

/* ---------- Tablets and phones ---------- */
@media (max-width: 960px) {
  .ac-head-grid { grid-template-columns: 1fr; min-height: 0; gap: 3rem; }
  .ac-hero { justify-self: start; }
  .ac-hero-drawing { top: -1.5rem; right: -1.5rem; width: 12rem; height: 12rem; --sq: 3rem; }
  .ch-scene { grid-template-columns: 1fr; }
  .ch-side { position: static; }
  .ch-list { gap: 2.5rem; }
  .ac-gate { grid-template-columns: 1fr; }
  .gate-steps { grid-template-columns: 1fr; gap: 1.75rem; }
  .gate-line { display: none; }
  .gate-step { display: grid; grid-template-columns: 2.8rem minmax(0, 1fr); column-gap: 1.25rem; }
  .gate-step h3 { grid-column: 2; margin-top: .55rem; }
  .gate-step p { grid-column: 2; }
  .gate-no { grid-row: 1 / span 2; }
  .gate-end { margin-left: 4.05rem; }
  .ac-elig { grid-template-columns: 1fr; gap: 2rem; }
  .ac-cat { columns: 2; }
}
@media (max-width: 620px) {
  .hero-pos { --pos-s: 4rem; }
  .ch-topics { grid-template-columns: 1fr; }
  .ch-pos { --pos-s: 3.1rem; }
  .ac-method { grid-template-columns: 1fr; }
  .ac-tile { min-height: 12.5rem; }
  .ac-elig-cols { grid-template-columns: 1fr; }
  .ac-cat { columns: 1; }
  .gate-end { margin-left: 4.05rem; }
}
