/* CSAHacks: Colour Chapters direction
   Collège Sainte-Anne de Lachine — bright warm cream, Canal blue, Sainte-Anne gold, midnight navy */

:root {
  /* Palette tokens */
  --bg: #faf6ec;
  --surface: #efe9d9;
  --ink: #161a24;
  --muted: #4b5162;
  --accent: #044ca0;
  --accent-strong: #0b5ec2;
  --accent-ink: #ffffff;
  --accent-light: #7ec8f2;

  /* Minor-element palette: Sainte-Anne red, bright blue, canal green */
  --red: #c41439;
  --blue: #2790f3;
  --green: #049b5c;
  --line: rgba(22, 26, 36, 0.1);

  /* Chapter fields */
  --field-dark: #111c36;
  --field-dark-ink: #faf6ec;
  --field-stone: #faf6ec;
  --field-stone-ink: #161a24;
  --field-blue: #044ca0;
  --field-blue-deep: #093574;
  --field-blue-ink: #f5f5f3;
  --field-bone: #faf6ec;
  --field-bone-ink: #161a24;

  /* Canal Blue accordion scale (dark to light) */
  --panel-1: #0b2458;
  --panel-1-ink: #f5f5f3;
  --panel-2: #044ca0;
  --panel-2-ink: #f5f5f3;
  --panel-3: #2874c4;
  --panel-3-ink: #f5f5f3;
  --panel-4: #76a6df;
  --panel-4-ink: #101828;
  --panel-5: #b8d3f2;
  --panel-5-ink: #101828;

  /* Typography: Bricolage Grotesque (playful geometric display) + DM Sans (friendly modern body) */
  /* Bungee: chunky arcade/sign lettering for titles. Nunito: rounded, friendly UI and body. JetBrains Mono: code-flavoured labels. */
  --font-title: 'Bungee', 'Arial Black', Impact, sans-serif;
  --font-display: 'Nunito', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-text: 'Nunito', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Strict five-step type scale */
  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.375rem, 1.12rem + 1vw, 2.15rem);
  --step-head: clamp(1.75rem, 1.15rem + 2.6vw, 3.25rem);
  --step-display: clamp(2.85rem, 1.6rem + 6.2vw, 7.25rem);

  /* Layout system: one margin, one gutter, friendly crisp radii */
  --margin: clamp(1.125rem, 2.5vw, 2.25rem);
  --gutter: clamp(1rem, 2vw, 1.75rem);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  /* Motion tokens */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 260ms;
  --t-chapter: 300ms;
  --t-reveal: 800ms;

  /* Dynamic fixed-header tokens (updated per chapter in JS; transparent on hero) */
  --header-bg: transparent;
  --header-ink: #f5f5f3;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

html {
  font-synthesis: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-body);
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl, dd {
  margin: 0;
}

ul[class], ol[class] {
  padding: 0;
  list-style: none;
}

img, video, svg, canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  background: var(--surface);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  touch-action: manipulation;
}

:target {
  scroll-margin-top: 4.5rem;
}

::selection {
  background: var(--blue);
  color: #ffffff;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

section[id] {
  scroll-margin-top: 3.75rem;
}

.chapter--projects :focus-visible,
.swatch--projects:focus-visible,
.subpage--apply :focus-visible {
  outline-color: #141414;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--margin);
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: var(--step-body);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--margin);
}

/* ---------- Shared utilities ---------- */
.wrap {
  padding-inline: var(--margin);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-wrap: balance;
  hyphens: none;
}

p {
  text-wrap: pretty;
}

.head {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: var(--step-head);
  line-height: 1;
  letter-spacing: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.35rem;
  padding: 0 2rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-body);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-press) var(--ease-spring), background-color var(--t-hover) ease, color var(--t-hover) ease;
}

.button:active {
  transform: translateY(1px) scale(0.96);
}

.link {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 0.08em;
  transition: text-decoration-color var(--t-hover) ease, opacity var(--t-hover) ease;
}

.link-plain {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    background: var(--accent-strong);
    transform: translateY(-2px) scale(1.02);
  }

  .link:hover {
    text-decoration-color: var(--link-hover, currentColor);
  }
}

/* Language toggle button */
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.85rem;
  min-height: 2.25rem;
  padding: 0 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-small);
  letter-spacing: 0.02em;
  transition: transform var(--t-press) var(--ease-spring), background-color var(--t-hover) ease;
}

.lang-btn--hero {
  background: #f5f5f3;
  color: #141414;
}

.lang-btn--light {
  background: var(--field-dark);
  color: var(--field-dark-ink);
}

.lang-btn:active {
  transform: scale(0.95);
}

@media (hover: hover) and (pointer: fine) {
  .lang-btn:hover {
    background: var(--accent-strong);
    color: var(--accent-ink);
  }
}

/* On dark hero, dark footer, and blue subbar: crisp white pill like Sainte-Anne */
.chapter-bar.is-over-dark .lang-btn,
.subbar--blue .lang-btn {
  background: #ffffff;
  color: #14181c;
}

@media (hover: hover) and (pointer: fine) {
  .chapter-bar.is-over-dark .lang-btn:hover,
  .subbar--blue .lang-btn:hover {
    background: #dcebfb;
    color: #044ca0;
  }
}

/* ---------- Fixed Chapter Bar (always visible, colour-synced per chapter) ---------- */
.chapter-bar {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 40;
  background-color: var(--header-bg);
  color: var(--header-ink);
  box-shadow: 0 1px 0 transparent;
  transition:
    background-color var(--t-chapter) ease,
    color var(--t-chapter) ease,
    box-shadow var(--t-chapter) ease;
}

.chapter-bar.is-scrolled:not(.is-over-hero) {
  box-shadow: 0 1px 0 var(--line);
}

/* Reading progress: a thin red / blue / green ribbon under the bar */
.chapter-bar__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0 33.34%, var(--blue) 33.34% 66.67%, var(--green) 66.67% 100%);
  clip-path: inset(0 calc(100% - var(--progress, 0) * 100%) 0 0);
  opacity: 0;
  transition: opacity var(--t-chapter) ease;
  pointer-events: none;
}

.chapter-bar.is-scrolled:not(.is-over-hero) .chapter-bar__progress {
  opacity: 1;
}

.chapter-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  gap: 1.5rem;
}

.chapter-bar__brand {
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: var(--step-body);
  text-decoration: none;
}

.chapter-bar__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-small);
}

.chapter-bar__nav a[href="#weekend"] { --link-hover: var(--red); }
.chapter-bar__nav a[href="#projects"] { --link-hover: var(--blue); }
.chapter-bar__nav a[href="#faq"] { --link-hover: var(--green); }

.chapter-bar__nav a[aria-current="true"] {
  text-decoration-color: var(--link-hover, currentColor);
  text-decoration-thickness: 0.14em;
}

.chapter-bar__cta {
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 0.09em;
}

@media (max-width: 767px) {
  .chapter-bar__nav {
    gap: 0.75rem;
  }

  .chapter-bar__nav a:not(.chapter-bar__cta) {
    display: none;
  }
}

/* ---------- HERO: Full-bleed animated ASCII view. The first screen is pure ASCII; a band below the fold
   (--hero-band) fades into the page colour as you scroll (hero-dither.js). ---------- */
.hero {
  --hero-ground: #0c1a3a;
  --hero-band: clamp(260px, 40vh, 420px);
  background: var(--hero-ground);
  min-height: calc(100svh + var(--hero-band));
  display: flex;
}

.hero__view {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding-top: 4.5rem;
  padding-bottom: calc(var(--hero-band) + clamp(4rem, 8vh, 6.5rem));
  /* Page colour at the very bottom so a sub-pixel canvas edge can never show a navy hairline */
  background: linear-gradient(to bottom, var(--hero-ground) calc(100% - 8px), var(--field-stone) calc(100% - 8px));
  color: #f5f5f3;
}

.hero__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 36%;
}

/* With JS the photo is only the canvas's source: never flash it on screen */
.js .hero__photo {
  opacity: 0;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 900ms cubic-bezier(0.33, 1, 0.68, 1);
  pointer-events: none;
}

.hero__canvas.is-active {
  opacity: 1;
}

/* Once the ASCII canvas is live the photo underneath is hidden, so it can't peek out at a sub-pixel edge */
.hero__view:has(.hero__canvas.is-active) .hero__photo {
  visibility: hidden;
  transition: visibility 0s linear 420ms;
}

/* Soft dark radial scrim behind the copy so it stays crisp while the dithered pavilion shines around it.
   It stops above the fold so it never touches the dissolve band. */
.hero__scrim {
  position: absolute;
  inset: 0 0 var(--hero-band);
  z-index: 2;
  background: radial-gradient(ellipse 72% 46% at 50% 47%, rgba(7, 14, 36, 0.72) 0%, rgba(7, 14, 36, 0.45) 55%, rgba(7, 14, 36, 0) 100%); /* taste-skill-ignore */
  pointer-events: none;
}

/* The band below the fold. Before the canvas is ready it is a plain gradient over the photo;
   once the canvas is live it is only a measuring stick for hero-dither.js. */
.hero__fade {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: var(--hero-band);
  z-index: 3;
  background: linear-gradient(to bottom, rgba(250, 246, 236, 0) 0%, var(--field-stone) 100%); /* taste-skill-ignore */
  pointer-events: none;
  transition: opacity 420ms var(--ease-out);
}

.hero__canvas.is-active ~ .hero__fade {
  opacity: 0;
}

.hero__center {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  width: 100%;
  max-width: 78rem;
}

/* Logo space: a big square marked only by corner brackets, like a camera viewfinder.
   Swap the placeholder span for an <img> or <svg> when the logo is ready. */
.hero__logo {
  --corner: clamp(26px, 3vw, 40px);
  --stroke: 3px;
  justify-self: end;
  display: grid;
  place-items: center;
  width: min(100%, clamp(16rem, 34vw, 30rem));
  aspect-ratio: 1;
  border-radius: 6px;
  background:
    linear-gradient(#ffffff, #ffffff) top left / var(--corner) var(--stroke) no-repeat,
    linear-gradient(#ffffff, #ffffff) top left / var(--stroke) var(--corner) no-repeat,
    linear-gradient(#ffffff, #ffffff) top right / var(--corner) var(--stroke) no-repeat,
    linear-gradient(#ffffff, #ffffff) top right / var(--stroke) var(--corner) no-repeat,
    linear-gradient(#ffffff, #ffffff) bottom left / var(--corner) var(--stroke) no-repeat,
    linear-gradient(#ffffff, #ffffff) bottom left / var(--stroke) var(--corner) no-repeat,
    linear-gradient(#ffffff, #ffffff) bottom right / var(--corner) var(--stroke) no-repeat,
    linear-gradient(#ffffff, #ffffff) bottom right / var(--stroke) var(--corner) no-repeat,
    rgba(7, 14, 36, 0.55);
}

.hero__logo img,
.hero__logo svg {
  width: 82%;
  height: 82%;
  object-fit: contain;
  background: transparent;
}

.hero__logo-ph {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

/* Date and place under the button, set off by a thin rule */
.hero__when {
  width: 100%;
  margin-top: 0.75rem;
  padding-top: 1.1rem;
  border-top: 2px solid #ffffff;
}

.hero__date {
  font-weight: 700;
  font-size: var(--step-lead);
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 1px 16px rgba(4, 10, 28, 0.95);
}

.hero__where {
  margin-top: 0.3rem;
  font-weight: 700;
  color: #dbe6f7;
  text-shadow: 0 1px 16px rgba(4, 10, 28, 0.95);
}

.hero__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(1rem, 2vw, 1.5rem);
  text-align: left;
}

.hero__headline {
  font-family: var(--font-title);
  font-size: clamp(2.6rem, 0.9rem + 4.6vw, 6.25rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: #f5f5f3;
  text-shadow: 0 4px 32px rgba(4, 12, 32, 0.4);
}

.hero__tagline {
  max-width: 34ch;
  font-size: var(--step-body);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 16px rgba(4, 10, 28, 0.95);
}

.hero__headline .line {
  padding-inline: 0.04em;
}

.hero__action {
  margin-top: 0.35rem;
  background: #ffffff;
  color: #14181c;
}

@media (hover: hover) and (pointer: fine) {
  .hero__action:hover {
    background: #dcebfb;
    color: #044ca0;
  }
}

/* Header over the busy hero: a soft dark backdrop so the links stay readable */
.chapter-bar::before {
  content: "";
  position: absolute;
  inset: 0 0 -2.5rem;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(4, 10, 28, 0.78), rgba(4, 10, 28, 0));
  opacity: 0;
  transition: opacity var(--t-chapter) ease;
  pointer-events: none;
}

.chapter-bar.is-over-hero::before {
  opacity: 1;
}

/* ---------- Chapters (base) ---------- */
.chapter {
  width: 100%;
  padding-block: clamp(5.5rem, 8vw, 7.5rem) clamp(4.5rem, 7vw, 6.5rem);
}

/* ---------- CHAPTER 1: how-it-works (Fixed-width sliding curtain panels, zero squishing) ---------- */
.chapter--weekend {
  background: var(--field-stone);
  color: var(--field-stone-ink);
  padding-top: clamp(3rem, 5vw, 4.5rem);
  min-height: 92svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.weekend__intro {
  align-items: end;
  margin-bottom: clamp(2.5rem, 4.5vw, 4rem);
}

.weekend__heading {
  grid-column: 1 / 6;
}

.weekend__copy {
  grid-column: 7 / 13;
  font-size: var(--step-body);
  max-width: 52ch;
}

/* Voyage: a little boat floats on the top edge of the cards, sailing from the deep end (stage 1) to the shallow end (stage 5) */
.voyage {
  --stage: 0;
  position: relative;
  padding-top: 40px;
  overflow: hidden;
}

/* Sits over the open panel: each closed panel is 1/10.5 of the row, so the open one starts at stage × (100% / 10.5) */
.voyage__boat {
  position: absolute;
  top: 0;
  left: calc(var(--stage) * (100% / 10.5) + clamp(1.75rem, 3vw, 2.75rem));
  z-index: 5;
  pointer-events: none;
  width: 64px;
  height: 48px;
  transition: left 700ms var(--ease-in-out);
}

/* Ripples live on the water only: the layer starts at the cards' top edge and clips anything above it */
.voyage__ripples {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  border-radius: var(--radius);
}

/* Bubbles trail a boat that is under water */
.voyage__bubble {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid rgba(250, 246, 236, 0.8);
}

.voyage__bubble.is-dark {
  border-color: rgba(16, 24, 40, 0.45);
}

/* Wake: a foamy streak on the surface behind the stern; --wake (0–1) follows the boat's speed */
.voyage__flip {
  position: absolute;
  inset: 0;
  transition: transform 260ms var(--ease-out);
}

.voyage.is-heading-back .voyage__flip {
  transform: scaleX(-1);
}

.voyage__wake {
  position: absolute;
  top: 38px;
  right: calc(100% - 16px);
  width: 210px;
  height: 18px;
  overflow: visible;
  color: rgb(250, 246, 236);
  opacity: var(--wake, 0);
  transform-origin: right center;
  transform: scaleX(calc(0.15 + var(--wake, 0) * 0.85));
  pointer-events: none;
}

.voyage__foam {
  fill: currentColor;
  animation: voyage-foam 900ms linear infinite;
}

.voyage__foam--late {
  animation-delay: -450ms;
}

/* Foam bits peel off the stern and drift back as they dissolve */
@keyframes voyage-foam {
  0% { transform: translateX(0); opacity: 0.9; }
  100% { transform: translateX(-46px); opacity: 0; }
}

/* Small curl of water pushed up at the bow */
.voyage__bow {
  position: absolute;
  top: 31px;
  left: calc(100% - 9px);
  width: 16px;
  height: 12px;
  fill: rgb(250, 246, 236);
  opacity: var(--wake, 0);
  transform-origin: left bottom;
  transform: scale(calc(0.4 + var(--wake, 0) * 0.6));
  pointer-events: none;
}

.voyage__boat.is-over-light .voyage__wake {
  color: rgba(16, 24, 40, 0.5);
}

.voyage__boat.is-over-light .voyage__bow {
  fill: rgba(16, 24, 40, 0.5);
}

.voyage__splash {
  position: absolute;
  top: 18px;
  z-index: 6;
  pointer-events: none;
}

.voyage__splash svg {
  display: block;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.voyage__boat-svg {
  display: block;
  transform-origin: 50% 90%;
  transition: transform 260ms var(--ease-out);
  animation: voyage-bob 2.6s ease-in-out infinite;
}

@keyframes voyage-bob {
  0%, 100% { translate: 0 0; rotate: -2deg; }
  50% { translate: 0 3px; rotate: 2deg; }
}

@media (prefers-reduced-motion: reduce) {
  .voyage__boat {
    transition: none;
  }

  .voyage__boat-svg,
  .voyage__foam {
    animation: none;
  }
}

.panels {
  --panel-open-w: clamp(460px, 56vw, 860px);
  display: flex;
  width: 100%;
  height: 520px;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.panel {
  position: relative;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  transition: flex-grow 420ms var(--ease-in-out);
}

.panel.is-open {
  flex: 6.5 1 0%;
}

.panel--1 { background: var(--panel-1); color: var(--panel-1-ink); }
.panel--2 { background: var(--panel-2); color: var(--panel-2-ink); }
.panel--3 { background: var(--panel-3); color: var(--panel-3-ink); }
.panel--4 { background: var(--panel-4); color: var(--panel-4-ink); }
.panel--5 { background: var(--panel-5); color: var(--panel-5-ink); }

.panel__trigger {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1.5rem 1rem;
  text-align: left;
}

.panel.is-open .panel__trigger {
  pointer-events: none;
}

.panel__sliver-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-body);
  letter-spacing: -0.02em;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: opacity 200ms ease, transform var(--t-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .panel:not(.is-open) .panel__trigger {
    cursor: pointer;
  }

  .panel:not(.is-open):hover {
    filter: brightness(1.07);
  }

  .panel:not(.is-open):hover .panel__sliver-label {
    transform: rotate(180deg) translateY(5px);
  }
}

.panel__mobile-icon {
  display: none;
}

.panel__collapse {
  display: contents;
}

.panel.is-open .panel__sliver-label {
  opacity: 0;
}

/* Fixed-width inner stage: slides open cleanly without EVER squishing the photo or reflowing text */
.panel__content {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--panel-open-w);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 2rem;
  padding: clamp(1.75rem, 3vw, 2.75rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 0s linear 220ms;
}

.panel.is-open .panel__content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 280ms ease 110ms, visibility 0s linear 0s;
}

.panel__text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.panel__title {
  font-size: var(--step-lead);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.panel__desc {
  font-size: var(--step-body);
  line-height: 1.55;
  max-width: 34ch;
}

.panel__photo-wrap {
  height: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.16);
}

.panel__photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ---------- CHAPTER 2: project tracks (tilted cards; hover or tap fills the card and pops its photo up) ---------- */
.chapter--projects {
  background: var(--bg);
  color: var(--ink);
  padding-block: clamp(4rem, 7vw, 6rem);
}

.showcase__head {
  max-width: 40rem;
  margin-inline: auto;
  text-align: center;
}

.showcase__intro {
  margin-top: 1rem;
  font-size: var(--step-body);
  color: var(--muted);
}

.tracks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: start;
  /* Head room for the photos that pop up above the cards */
  margin-top: clamp(8rem, 12vw, 11rem);
}

.track {
  position: relative;
  margin-top: var(--lift, 0px);
}

.track:hover,
.track:focus-within,
.track.is-active {
  z-index: 2;
}

.track__card {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(18rem, 25vw, 21rem);
  text-align: left;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 640ms var(--ease-out);
}

.track__face {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 1.55rem 1.4rem 1.25rem;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1.5px solid #e4dfd2;
  box-shadow: inset 0 5px 0 var(--track), 0 10px 30px -18px rgba(22, 26, 36, 0.35);
  overflow: hidden;
  transition: border-color 620ms var(--ease-out), box-shadow 620ms var(--ease-out);
}

/* Rising colour curtain: tweens smoothly from bottom to top filling the card */
.track__face::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 0;
  background: var(--track);
  transform: translateY(102%);
  transition: transform 660ms cubic-bezier(0.25, 0.85, 0.25, 1);
  pointer-events: none;
}

.track__title {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 1.05rem + 0.7vw, 1.6rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink);
  transition: color 420ms var(--ease-out) 40ms;
}

.track__fact {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-right: 3.25rem;
  font-size: var(--step-small);
  line-height: 1.5;
  color: var(--muted);
  transition: color 420ms var(--ease-out) 160ms;
}

.track__icon {
  position: absolute;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--track);
  color: #ffffff;
  transition: background-color 480ms var(--ease-out), color 480ms var(--ease-out), transform 600ms var(--ease-out);
}

.track__icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Photo waits behind the card face, then slides up out of the top edge */
.track__photo {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 0;
  width: 82%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--field-dark);
  opacity: 0;
  transform: translate(-50%, 6%) rotate(0deg) scale(0.9);
  transition: transform 640ms var(--ease-out), opacity 280ms ease 120ms;
}

.track__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.track.is-active .track__card,
.track__card:focus-visible {
  transform: rotate(0deg) translateY(-6px);
}

.track.is-active .track__face,
.track__card:focus-visible .track__face {
  border-color: var(--track);
}

.track.is-active .track__face::before,
.track__card:focus-visible .track__face::before {
  transform: translateY(0%);
}

.track.is-active .track__title,
.track__card:focus-visible .track__title {
  color: #ffffff;
  transition: color 460ms var(--ease-out) 160ms;
}

.track.is-active .track__fact,
.track__card:focus-visible .track__fact {
  color: #ffffff;
  transition: color 460ms var(--ease-out) 60ms;
}

.track.is-active .track__icon,
.track__card:focus-visible .track__icon {
  background: #ffffff;
  color: var(--track);
  transform: rotate(-12deg);
}

.track.is-active .track__photo,
.track__card:focus-visible .track__photo {
  opacity: 1;
  transform: translate(-50%, -64%) rotate(-4deg) scale(1);
  transition: transform 680ms var(--ease-out), opacity 320ms ease 80ms;
}

@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .track__card {
    cursor: default;
  }

  .track__card:hover {
    transform: rotate(0deg) translateY(-6px);
  }

  .track__card:hover .track__face {
    border-color: var(--track);
  }

  .track__card:hover .track__face::before {
    transform: translateY(0%);
  }

  .track__card:hover .track__title {
    color: #ffffff;
    transition: color 460ms var(--ease-out) 160ms;
  }

  .track__card:hover .track__fact {
    color: #ffffff;
    transition: color 460ms var(--ease-out) 60ms;
  }

  .track__card:hover .track__icon {
    background: #ffffff;
    color: var(--track);
    transform: rotate(-12deg);
  }

  .track__card:hover .track__photo {
    opacity: 1;
    transform: translate(-50%, -64%) rotate(-4deg) scale(1);
    transition: transform 680ms var(--ease-out), opacity 320ms ease 80ms;
  }
}

.track__card:active {
  transform: rotate(0deg) translateY(-6px) scale(0.985);
}

@media (prefers-reduced-motion: reduce) {
  .track__card,
  .track__face,
  .track__face::before,
  .track__title,
  .track__fact,
  .track__photo,
  .track__icon {
    transition: none;
  }
}

/* ---------- CHAPTER 3: faq (Smoothly animated accordion + AI tile) ---------- */
.chapter--faq {
  background: var(--bg);
  color: var(--ink);
  padding-top: clamp(3.5rem, 6vw, 5rem);
}

.faq__layout {
  align-items: start;
}

.faq__left {
  grid-column: 1 / 5;
  position: sticky;
  top: 5.5rem;
}

.faq__sub {
  margin-top: 0.9rem;
  font-size: var(--step-body);
  color: var(--muted);
  max-width: 30ch;
}

.faq__list {
  grid-column: 5 / 13;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tile {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  transition: background-color var(--t-ui) ease, color var(--t-ui) ease, transform var(--t-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .tile:not(.is-open):not(.tile--ai):hover {
    background: #e5dec9;
  }
}

.tile.is-open {
  background: var(--accent);
  color: var(--accent-ink);
}

.tile--ai {
  background: #14181c;
  color: #f5f5f3;
  transition: background-color var(--t-ui) ease, color var(--t-ui) ease;
}

.tile--ai.is-open {
  background: #14181c;
  color: #f5f5f3;
}

.tile__summary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
  padding: 1.25rem 1.5rem;
  text-align: left;
}

.tile__question {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-body);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.tile__icon {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.tile__icon::before,
.tile__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 3px;
  background: currentColor;
  transform: translateY(-50%);
  transition: transform var(--t-ui) var(--ease-out);
}

.tile__icon::after {
  transform: translateY(-50%) rotate(90deg);
}

.tile.is-open .tile__icon::after {
  transform: translateY(-50%) rotate(0deg);
}

/* Smooth height animation on open & close */
.tile__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 340ms var(--ease-out);
}

.tile.is-open .tile__panel {
  grid-template-rows: 1fr;
}

.tile__body {
  overflow: hidden;
  padding: 0 1.5rem;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 240ms ease, transform 300ms var(--ease-out), padding-bottom 300ms var(--ease-out);
}

.tile.is-open .tile__body {
  padding-bottom: 1.5rem;
  opacity: 1;
  transform: none;
}

.tile__body p {
  font-size: var(--step-body);
  line-height: 1.55;
  max-width: 54ch;
  white-space: pre-line;
}

/* Inline AI question tile (textbox directly in the tile heading row) */
.tile__summary--input {
  padding: 0 0.75rem 0 1.5rem;
  gap: 0.75rem;
  cursor: text;
}

.tile__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 4.5rem;
  border: 0;
  background: transparent;
  color: var(--field-blue-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-body);
  line-height: 1.25;
  letter-spacing: -0.015em;
  padding: 0;
  outline: none;
}

.tile__input::placeholder {
  color: #cfe0ff;
  opacity: 1;
}

.tile__send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: #14181c;
  transition: transform var(--t-press) var(--ease-spring), background-color var(--t-hover) ease, color var(--t-hover) ease;
}

.tile__send-icon {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t-press) var(--ease-out);
}

.tile__send:active {
  transform: scale(0.95);
}

.tile__send:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (hover: hover) and (pointer: fine) {
  .tile__send:hover {
    background: var(--green);
    color: #ffffff;
  }

  .tile__send:hover .tile__send-icon {
    transform: translateX(2px);
  }
}

.tile--ai .tile__body p {
  color: #f5f5f3;
  max-width: 58ch;
  white-space: pre-wrap;
}

.tile--ai .tile__body p.is-streaming::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.2em;
  vertical-align: -0.15em;
  background: var(--green);
  animation: cursor-blink 750ms steps(2, end) infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.tile--ai .tile__body p.is-error {
  color: #ff9685;
}

.tile--ai .tile__body .tile__disclaimer {
  margin-top: 0.75rem;
  font-size: var(--step-small);
  line-height: 1.4;
  color: #c8daf8;
}

.tile--ai .tile__body p.is-error + .tile__disclaimer {
  display: none;
}

/* ---------- FOOTER ---------- */
.chapter--footer {
  background: var(--field-dark);
  color: var(--field-dark-ink);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) clamp(1.25rem, 2.5vw, 1.75rem);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem 3rem;
}

/* Footer logo spot: same corner-bracket placeholder as the hero, small */
.footer__logo {
  --corner: 14px;
  --stroke: 2px;
  display: grid;
  place-items: center;
  width: 5rem;
  aspect-ratio: 1;
  text-decoration: none;
  background:
    linear-gradient(currentColor, currentColor) top left / var(--corner) var(--stroke) no-repeat,
    linear-gradient(currentColor, currentColor) top left / var(--stroke) var(--corner) no-repeat,
    linear-gradient(currentColor, currentColor) top right / var(--corner) var(--stroke) no-repeat,
    linear-gradient(currentColor, currentColor) top right / var(--stroke) var(--corner) no-repeat,
    linear-gradient(currentColor, currentColor) bottom left / var(--corner) var(--stroke) no-repeat,
    linear-gradient(currentColor, currentColor) bottom left / var(--stroke) var(--corner) no-repeat,
    linear-gradient(currentColor, currentColor) bottom right / var(--corner) var(--stroke) no-repeat,
    linear-gradient(currentColor, currentColor) bottom right / var(--stroke) var(--corner) no-repeat;
}

.footer__logo img,
.footer__logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.footer__logo-ph {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(250, 246, 236, 0.6);
}

.footer__contact {
  display: grid;
  gap: 0.55rem;
}

.footer__contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  text-decoration: none;
}

.footer__contact-link img,
.footer__contact-link svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  background: transparent;
}

.footer__contact-link svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
  .footer__contact-link:hover span {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }
}

@media (hover: hover) and (pointer: fine) {
  .chapter--footer a:hover {
    color: var(--field-dark-ink);
  }
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-body);
  color: var(--field-dark-ink);
  text-decoration: none;
}

.social-link--compact {
  font-size: var(--step-small);
  gap: 0.45rem;
}

.social-link__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  background: transparent;
  flex: 0 0 auto;
}

.social-link--compact .social-link__icon {
  width: 18px;
  height: 18px;
}

/* ---------- SUBPAGES (apply.html, interest.html, attributions.html) ---------- */
.subpage {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.subpage--apply,
.subpage--attr {
  background: var(--bg);
  color: var(--ink);
}

.subpage--interest {
  background: var(--field-blue);
  color: var(--field-blue-ink);
}

.subpage__main {
  flex: 1 0 auto;
}

.subbar {
  background: var(--bg);
  color: var(--ink);
  padding-block: 1.25rem;
}

.subbar--blue {
  background: var(--field-blue);
  color: var(--field-blue-ink);
}

.subbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.subbar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-body);
}

.subbar__back-icon {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .subbar__back:hover .subbar__back-icon {
    transform: translateX(-2px);
  }
}

.subbar__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.subbar__brand {
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: var(--step-body);
  text-decoration: none;
}

.subfooter {
  background: var(--field-dark);
  color: var(--field-dark-ink);
  padding-block: 1.75rem;
}

.subfooter__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.subfooter__brand {
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: var(--step-body);
  text-decoration: none;
}

.subfooter__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  font-size: var(--step-small);
}

/* ---------- APPLICATION CENTER HUB (apply.html) ---------- */
.hub {
  padding-block: clamp(2rem, 4vw, 3.5rem) clamp(4rem, 7vw, 6rem);
  max-width: 1180px;
  margin-inline: auto;
}

.hub__header {
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.hub__title {
  margin-bottom: 1rem;
}

.hub__subtitle {
  max-width: 58ch;
  font-size: var(--step-body);
  color: var(--ink);
}

.hub__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.45rem;
  min-height: 8.25rem;
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease;
}

.hub-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-lead);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.hub-card__sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-small);
  letter-spacing: 0.02em;
}

.hub-card--active {
  background: var(--field-blue);
  color: var(--field-blue-ink);
}

.hub-card--active .hub-card__sub {
  color: var(--accent-light);
}

.hub-card--active:active {
  transform: scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .hub-card--active:hover {
    background: #14181c;
    color: #ffffff;
    transform: translateY(-3px);
  }

  .hub-card--active:hover .hub-card__sub {
    color: var(--accent-light);
  }
}

.hub-card--disabled {
  background: var(--surface);
  color: #555046;
  cursor: not-allowed;
}

.hub-card--disabled .hub-card__sub {
  color: #5d584e;
}

/* ---------- DEDICATED INTEREST FORM (interest.html) ---------- */
.chapter--interest {
  background: var(--field-blue);
  color: var(--field-blue-ink);
  padding-top: clamp(2rem, 4vw, 3.5rem);
  padding-bottom: clamp(4.5rem, 7vw, 6.5rem);
}

.chapter--interest .button {
  background: #ffffff;
  color: #14181c;
}

@media (hover: hover) and (pointer: fine) {
  .chapter--interest .button:hover {
    background: #dcebfb;
    color: #044ca0;
  }
}

.interest__header {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: end;
  margin-bottom: 2.25rem;
}

.interest__heading-group {
  grid-column: 1 / 6;
}

.interest__lead-group {
  grid-column: 7 / 13;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.15rem;
}

.interest__lead {
  font-size: var(--step-body);
  max-width: 54ch;
}

.embed-shell {
  width: 100%;
  border-radius: var(--radius);
  background: #f5f5f3;
  overflow: hidden;
}

.embed-frame {
  display: block;
  width: 100%;
  height: clamp(780px, 82vh, 1120px);
  border: 0;
  background: #f5f5f3;
}

.embed-fallback {
  margin-top: 1.25rem;
  font-size: var(--step-small);
  color: var(--field-blue-ink);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- DEDICATED ATTRIBUTIONS PAGE (attributions.html) ---------- */
.attr {
  padding-block: clamp(2rem, 4vw, 3.5rem) clamp(4rem, 7vw, 6rem);
  max-width: 1080px;
  margin-inline: auto;
}

.attr__header {
  margin-bottom: 2.5rem;
}

.attr__title {
  margin-bottom: 0.85rem;
}

.attr__lead {
  max-width: 58ch;
}

.attr__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.attr__item {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  align-items: center;
}

.attr__thumb {
  width: 124px;
  height: 92px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.attr__name {
  font-size: var(--step-body);
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.attr__meta {
  font-size: var(--step-small);
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.attr__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-small);
}

/* ---------- Motion helpers (always safe without JS) ---------- */
.lines .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.lines [data-line] {
  display: block;
}

@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] {
    opacity: 0;
    transform: translateY(18px);
    animation: csa-rise var(--t-reveal) var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 90ms + 120ms);
  }

  .js .lines [data-line] {
    transform: translateY(105%);
    animation: csa-line 900ms var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 110ms + 140ms);
  }

  /* Opening: hold the hero copy until the ASCII background is drawn, then bring it in as one sequence */
  .js .hero:not(.is-ready) [data-rise],
  .js .hero:not(.is-ready) .lines [data-line] {
    animation-play-state: paused;
  }

  .js .hero [data-rise] {
    animation-delay: calc(var(--i, 0) * 110ms + 260ms);
  }

  .js .hero .lines [data-line] {
    animation-delay: calc(var(--i, 0) * 110ms + 300ms);
  }

  /* The logo frame settles in from slightly larger rather than sliding up */
  .js .hero__logo[data-rise] {
    transform: scale(1.06);
    animation-name: csa-settle;
    animation-duration: 1000ms;
  }

  .reveal-on [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 700ms var(--ease-out), transform 850ms var(--ease-out);
  }

  .reveal-on [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }
}

@keyframes csa-rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes csa-settle {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes csa-line {
  to {
    transform: none;
  }
}

/* ---------- Tablet layout (<= 1024px) ---------- */
@media (max-width: 1024px) {
  .faq__left {
    grid-column: 1 / 13;
    position: static;
    margin-bottom: 1.75rem;
  }

  .faq__list {
    grid-column: 1 / 13;
  }

  .attr__list {
    grid-template-columns: 1fr;
  }
}

/* ---------- Phone layout (<= 767px) ---------- */
@media (max-width: 767px) {
  .hero {
    --hero-band: clamp(200px, 30vh, 280px);
  }

  .hero__view {
    align-content: start;
    padding-top: clamp(5.75rem, 13vh, 7.5rem);
    padding-bottom: calc(var(--hero-band) + 6.5rem);
  }

  /* Copy sits near the top on phones, so the dark pool behind it moves up too */
  .hero__scrim {
    background: radial-gradient(ellipse 100% 46% at 50% 34%, rgba(7, 14, 36, 0.8) 0%, rgba(7, 14, 36, 0.5) 55%, rgba(7, 14, 36, 0) 100%); /* taste-skill-ignore */
  }

  /* Phones: logo space on top, copy centred underneath */
  .hero__center {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 1.75rem;
  }

  .hero__logo {
    justify-self: center;
    width: min(66vw, 17rem);
  }

  .hero__copy {
    align-items: center;
    text-align: center;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero__headline {
    font-size: clamp(2.2rem, 11vw, 3.6rem);
  }


  /* Chapter 1 mobile: vertical stack */
  .weekend__intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .weekend__heading,
  .weekend__copy {
    width: 100%;
    text-align: left;
  }

  /* Phone boat: rides the top edge of the open card, parked left of the +/- icon */
  .voyage {
    padding-top: 40px;
  }

  .voyage__boat {
    left: auto;
    right: 3.25rem;
    transition: none;
  }

  .panels {
    flex-direction: column;
    height: auto;
    gap: 22px;
    border-radius: 0;
    overflow: visible;
  }

  .panel,
  .panel.is-open {
    flex: none;
    display: block;
    border-radius: var(--radius-sm);
  }

  .panel__trigger {
    position: static;
    width: 100%;
    min-height: 4.25rem;
    padding: 1rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
  }

  .panel.is-open .panel__trigger {
    pointer-events: auto;
  }

  .panel__sliver-label {
    writing-mode: horizontal-tb;
    transform: none;
    opacity: 1;
  }

  .panel.is-open .panel__sliver-label {
    opacity: 1;
  }

  .panel__mobile-icon {
    position: relative;
    display: block;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
  }

  .panel__mobile-icon::before,
  .panel__mobile-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 16px;
    height: 3px;
    background: currentColor;
    transform: translateY(-50%);
    transition: transform 280ms var(--ease-out);
  }

  .panel__mobile-icon::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .panel.is-open .panel__mobile-icon::after {
    transform: translateY(-50%) rotate(0deg);
  }

  /* Smooth vertical accordion animation on mobile */
  .panel__collapse {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 340ms var(--ease-out);
  }

  .panel.is-open .panel__collapse {
    grid-template-rows: 1fr;
  }

  .panel__content {
    position: static;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.15rem;
    padding: 0 1.25rem;
    opacity: 0;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 240ms ease, padding-bottom 300ms var(--ease-out);
  }

  .panel.is-open .panel__content {
    padding-bottom: 1.5rem;
    opacity: 1;
    transition: opacity 260ms ease 80ms, padding-bottom 300ms var(--ease-out);
  }

  .panel__title {
    display: none;
  }

  .panel__photo-wrap {
    aspect-ratio: 3 / 2;
    height: auto;
  }

  /* Chapter 2 mobile */
  /* Every card keeps photo-sized room above it, so opening one never shifts the page */
  .tracks {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 9rem;
    margin-top: 9rem;
  }

  .track {
    margin-top: 0;
  }

  .track__card {
    height: 15rem;
  }

  .track__photo {
    width: 74%;
  }

  /* AI box mobile */
  .ai-box__row {
    flex-direction: column;
  }

  /* Application center mobile */
  .hub__grid {
    grid-template-columns: 1fr;
  }

  /* Interest form mobile */
  .interest__header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .interest__heading-group,
  .interest__lead-group {
    width: 100%;
    text-align: left;
  }

  .subbar__brand {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .cell,
  .cell--span2,
  .cell--submit {
    grid-column: span 1;
    min-height: 4.5rem;
  }

  /* Attributions mobile */
  .attr__item {
    grid-template-columns: 1fr;
  }

  .attr__thumb {
    width: 100%;
    height: 160px;
  }

}


/* ==========================================================================
   Playful layer: chunky outlines, sticker shadows, bouncy hovers, plus the
   content blocks added from the audit (hero status, times, sponsors).
   ========================================================================== */
:root {
  --line: 2.5px solid var(--ink);
  --bounce: cubic-bezier(0.34, 1.7, 0.6, 1);
}

/* Buttons: one flat layer, a springy little hop on hover */
.button,
.hero__action {
  border: 0;
  box-shadow: none;
  transition: transform 260ms var(--bounce), background-color var(--t-hover) ease, color var(--t-hover) ease;
}

.button:active {
  transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  .button:hover,
  .hero__action:hover {
    box-shadow: none;
    transform: translateY(-2px) rotate(-1deg);
  }
}

/* Schedule: a time on every stage */
.panel__text {
  justify-content: flex-start;
}

.panel__desc {
  margin-top: auto;
}

.panel__time {
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.panel__time--sliver {
  position: absolute;
  top: 1.25rem;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  transition: opacity 200ms ease;
}

.panel.is-open .panel__time--sliver {
  opacity: 0;
}

/* Track cards: outlined, photo peeking out at rest, deeper fills so white text passes AA */
.track:nth-child(1) { --track-deep: #1b6fd0; }
.track:nth-child(2) { --track-deep: #037a48; }
.track:nth-child(3) { --track-deep: #c41439; }

.track__card {
  height: clamp(14rem, 19vw, 16rem);
}

.track__face {
  box-shadow: inset 0 5px 0 var(--track);
}

.track__face::before {
  background: var(--track-deep, var(--track));
}

.track__photo {
  opacity: 1;
  transform: translate(-50%, -38%) rotate(-3deg) scale(0.94);
}

.track__icon {
  transition: background-color 480ms var(--ease-out), color 480ms var(--ease-out), transform 600ms var(--bounce);
}

/* Sponsors: heading, one sentence, one button */
.chapter--sponsors {
  background: var(--bg);
  color: var(--ink);
  padding-top: clamp(2rem, 4vw, 3rem);
}

.sponsors {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: 1.25rem;
  align-items: start;
}

.sponsors__heading {
  grid-column: 1 / 5;
}

.sponsors__body {
  grid-column: 5 / 13;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.sponsors__text {
  max-width: 46ch;
  font-size: var(--step-lead);
  line-height: 1.3;
}

.sponsors__aside {
  color: var(--muted);
  font-size: var(--step-small);
}

/* Project photo placeholders */
.track__ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  padding-top: 9%;
  background: color-mix(in srgb, var(--track) 16%, #ffffff);
  color: color-mix(in srgb, var(--track) 70%, #1a1a2e);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.track__ph svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Print / no-JS: never leave revealed content invisible */
@media print {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 1024px) {
  .sponsors__heading,
  .sponsors__body {
    grid-column: 1 / 13;
  }
}

@media (max-width: 767px) {
  /* Comfortable 44px touch targets */
  .chapter-bar__nav a,
  .footer__contact-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .lang-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Track cards on phones: photo sits on top of the card, no reserved gaps */
  .tracks {
    row-gap: 1.75rem;
    margin-top: 2.25rem;
  }

  .track__card {
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .track__photo,
  .track.is-active .track__photo,
  .track__card:focus-visible .track__photo {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    opacity: 1;
    transform: none;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .track__ph {
    justify-content: center;
    padding-top: 0;
  }

  .track__face {
    position: relative;
    inset: auto;
    min-height: 10.5rem;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .panel__time--sliver {
    position: static;
    flex: 0 0 auto;
    margin-right: 0.75rem;
    text-align: left;
  }

  .panel.is-open .panel__time--sliver {
    opacity: 0.85;
  }

  .panel__sliver-label {
    flex: 1;
  }

  .panel .panel__text > .panel__time {
    display: none;
  }
}
