/* Hack the Wu · Year of the Goat. Lunar New Year red and gold over warm paper. Headings are Fraunces with its
   soft axis turned up, so the letters have the rounded cuts of the paper-cut art; body text, buttons and
   radius are shared with the chapter site (Rethink Sans).
   The hero and the closing section are always night; the sections between follow light/dark mode. */
:root {
  --red: #a61e2a;
  --red-deep: #7c121c;
  --red-strong: #8f1823;
  --gold: #e3a83b;
  --gold-soft: #f6e3b8;
  --navy: #141b4d;

  /* the night scene, fixed in both modes */
  --night-0: #1d0509;
  --night-1: #3d0a12;
  --night-2: #7c121c;
  --ink: #2b060b;
  --moon: #f0c35a;

  --bg: #fbf5ea;
  --surface: #fffdf8;
  --surface-2: #f4e9d6;
  --text: #2a1414;
  --muted: #6e5551;
  --border: #e6d6bd;

  --radius: 10px;
  --radius-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Rethink Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --maxw: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --nav: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a0c0e;
    --surface: #241114;
    --surface-2: #2c1418;
    --text: #f6ebdc;
    --muted: #c4aaa3;
    --border: #44222a;
    --red: #d8434e;
    --red-strong: #e5606a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--nav); scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; overflow-x: clip; font-variation-settings: "SOFT" 100; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.1; }
h1, h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.03em; text-wrap: balance; }
h1 { font-size: clamp(3rem, 1.2rem + 6vw, 6.4rem); line-height: .98; }
h2 { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); color: var(--red); }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
.container { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.sprite { position: absolute; }
a:focus-visible, .btn:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Buttons: same shape and hover/press steps as the chapter site */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: .65em 1.3em; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--red); color: #fff; font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color .12s var(--ease), border-color .12s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.985); transition-duration: .09s; }
.btn-sm { min-height: 40px; padding: .35em .95em; font-size: .92rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: color-mix(in srgb, var(--text) 25%, transparent); }
.btn-light { background: var(--gold); color: var(--ink); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--red-strong); transform: translateY(-1px); transition-duration: .15s; }
  .btn-ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); border-color: color-mix(in srgb, var(--text) 45%, transparent); }
  .btn-light:hover { background: #ecb955; }
  .btn-ghost-light:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .75); }
}

/* Header: fixed. With JS it sits clear over the night hero and turns solid once the hero has passed. */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  transition: background-color .25s var(--ease), border-color .25s var(--ease);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav); gap: 16px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; color: var(--red); text-decoration: none; letter-spacing: -0.02em; transition: color .25s var(--ease); }
.top-nav { display: flex; align-items: center; gap: 4px; }
.top-nav a:not(.btn) { position: relative; padding: 10px 12px; color: var(--muted); font-weight: 500; text-decoration: none; transition: color .12s var(--ease); }
.top-nav a:not(.btn)::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .12s var(--ease); }
.top-nav a:not(.btn):hover { color: var(--text); }
.top-nav a:not(.btn):hover::after { transform: scaleX(1); transform-origin: left; }
.top-nav .btn { margin-left: 8px; }
.js .top:not(.is-solid) { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.js .top:not(.is-solid) .brand { color: var(--gold-soft); }
.js .top:not(.is-solid) .top-nav a:not(.btn) { color: rgba(246, 227, 214, .78); }
.js .top:not(.is-solid) .top-nav a:not(.btn):hover { color: #fff; }
.js .top:not(.is-solid) .btn { background: var(--gold); color: var(--ink); }
@media (max-width: 560px) { .top-nav a:not(.btn) { display: none; } }

/* Hero entrance (driven by GSAP in main.js; a safety class shows the words by 900ms) */
@media (prefers-reduced-motion: no-preference) {
  .m-enter [data-enter] h1, .m-enter [data-enter-item] { opacity: 0; }
  .m-enter.m-enter-done [data-enter] h1, .m-enter.m-enter-done [data-enter-item] { opacity: 1; transition: opacity .4s var(--ease); }
}
.line-mask { padding-bottom: .12em; margin-bottom: -.12em; }

/* ---------- Hero: the paper-cut night ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100svh; display: flex; flex-direction: column;
  background: linear-gradient(var(--night-0) 0%, var(--night-1) 40%, var(--night-2) 100%);
  color: #f6e3d6;
}
.scene { position: absolute; inset: 0; pointer-events: none; }
.hero-inner { position: relative; z-index: 6; flex: 1; display: flex; align-items: center; padding-top: calc(var(--nav) + 24px); padding-bottom: clamp(150px, 26vh, 260px); pointer-events: none; }
.hero-text { max-width: min(600px, 46vw); pointer-events: auto; }
.eyebrow { font-size: .92rem; font-weight: 500; color: rgba(246, 227, 184, .8); margin-bottom: 20px; }
.hero h1 { margin-bottom: 28px; color: #fff6e2; font-weight: 600; }
.h1-sub { display: block; margin-top: .14em; font-size: .56em; font-weight: 400; font-style: italic; letter-spacing: -0.01em; line-height: 1.1; color: var(--moon); }
.hero-lead { font-size: clamp(1.1rem, 1rem + .3vw, 1.3rem); line-height: 1.5; max-width: 44ch; margin-bottom: 36px; color: #f3dccf; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 560px) { .hero-actions .btn { flex: 1 1 100%; } }

.stars i { position: absolute; width: var(--r); height: var(--r); border-radius: 50%; background: #fbe6a6; opacity: var(--o); }

.lantern { position: absolute; left: var(--x); top: var(--y); width: var(--s); }
.lantern svg { display: block; width: 100%; aspect-ratio: 60 / 84; animation: bob 7s ease-in-out infinite; animation-delay: var(--d); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }

.ridge { position: absolute; left: 0; bottom: 0; width: 100%; }
.ridge-far { height: clamp(190px, 40vh, 380px); fill: #8f1823; opacity: .55; z-index: 2; }
.ridge-mid { height: clamp(150px, 30vh, 290px); fill: #5c0d16; z-index: 4; }
.ridge-near { height: clamp(110px, 20vh, 200px); fill: var(--ink); z-index: 5; }
.wheat { position: absolute; left: 0; right: 0; bottom: -6px; height: clamp(64px, 12vh, 120px); z-index: 5; }
.wheat svg { position: absolute; bottom: 0; left: var(--x); height: var(--h); aspect-ratio: 40 / 200; color: var(--c); transform-origin: 50% 100%; animation: sway var(--t) ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes sway { from { transform: rotate(calc(var(--lean) - 4deg)); } to { transform: rotate(calc(var(--lean) + 5deg)); } }

/* The peak sits between the far and mid ridges, so the crag's foot disappears behind the range. */
.peak { position: absolute; z-index: 3; bottom: 0; right: max(0px, calc(50vw - 700px)); height: min(96%, 860px); aspect-ratio: 700 / 840; pointer-events: none; }
.peak svg { display: block; width: 100%; height: 100%; overflow: visible; }
.moon { fill: var(--moon); }
.moon-ring { fill: none; stroke: #fbe6a6; stroke-opacity: .6; stroke-width: 2; stroke-dasharray: 2 10; stroke-linecap: round; }
.crag { fill: var(--ink); }
.crag-facet { fill: #4a0b13; }
.peak-goat { --goat: var(--ink); --goat-cut: var(--moon); pointer-events: auto; cursor: pointer; }
.g-body { fill: var(--goat, #2b060b); }
.g-cut { fill: var(--goat-cut, #f0c35a); }

@media (max-width: 900px) {
  .hero-inner { flex: none; align-items: flex-start; padding-top: calc(var(--nav) + 40px); padding-bottom: 0; }
  .hero-text { max-width: 600px; }
  .peak { position: relative; right: auto; height: auto; width: min(92vw, 440px); margin: auto auto 0; padding-top: 40px; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vh, 128px) 0; overflow-x: clip; }
/* roughly one section per screen on a laptop or larger, like the chapter site */
@media (min-width: 1024px) and (min-height: 640px) {
  .section { min-height: 100svh; display: grid; align-content: center; padding-top: calc(var(--nav) + 48px); }
}
.section-alt { background: var(--surface-2); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px var(--gutter); align-items: end; margin-bottom: clamp(36px, 5vh, 56px); }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); max-width: 46ch; font-size: 1.1rem; }
@media (max-width: 860px) { .section-head { grid-template-columns: 1fr; } }

.points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px var(--gutter); margin-top: clamp(40px, 8vh, 96px); }
.points article { border-top: 2px solid var(--red); padding-top: 20px; }
.points h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.3rem); letter-spacing: -0.02em; margin-bottom: 14px; }
.points p { color: var(--muted); margin: 0; max-width: 34ch; }
@media (max-width: 860px) { .points { grid-template-columns: 1fr; } }

/* ---------- The climb ---------- */
.climb-stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--gutter); align-items: center; }
.climb-text h2 { margin-bottom: clamp(28px, 4vh, 44px); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 20px; padding: 20px 0; border-top: 1px solid var(--border); transition: opacity .35s var(--ease); }
.step-n { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--gold); padding-top: .2em; font-variant-numeric: tabular-nums; transition: color .35s var(--ease); }
.step h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.5rem, 1.2rem + .8vw, 1.9rem); letter-spacing: -0.02em; margin-bottom: 6px; transition: color .35s var(--ease); }
.step p { margin: 0; color: var(--muted); max-width: 40ch; }
.is-live .step { opacity: .38; }
.is-live .step.is-on { opacity: 1; }
.is-live .step.is-on h3, .is-live .step.is-on .step-n { color: var(--red); }

.climb-art svg { display: block; width: 100%; height: auto; max-height: min(78svh, 680px); margin: 0 auto; overflow: visible; }
.climb-sun { fill: var(--gold); }
.mtn-back { fill: color-mix(in srgb, var(--red) 28%, var(--surface-2)); }
.mtn { fill: #a61e2a; }
.mtn-facet { fill: #8f1823; }
.ledge { fill: var(--gold-soft); opacity: .9; }
.trail, .trail-lit { fill: none; stroke-linecap: round; }
.trail { stroke: rgba(246, 227, 184, .45); stroke-width: 3; stroke-dasharray: 1 11; }
.trail-lit { stroke: var(--gold); stroke-width: 4; stroke-dasharray: 1; }
.stop { fill: #7c121c; stroke: var(--gold-soft); stroke-width: 3; transition: fill .3s var(--ease); }
.stop.is-on, .climb:not(.is-live) .stop { fill: var(--gold); }
.climber { --goat: var(--ink); --goat-cut: var(--gold); }
@media (max-width: 900px) {
  .climb-stage { grid-template-columns: 1fr; }
  .climb-art { order: -1; }
  .climb-art svg { max-height: 420px; }
}

/* ---------- Details: a ticket, stamped with the goat seal ---------- */
.ticket { display: grid; grid-template-columns: minmax(0, 1fr) clamp(180px, 24%, 280px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); position: relative; }
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 48px) var(--gutter); margin: 0; padding: clamp(28px, 4vw, 56px); }
.details div { border-top: 2px solid var(--red); padding-top: 16px; }
.details dt { font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.details dd { margin: 0; font-family: var(--font-display); font-size: clamp(1.3rem, 1.1rem + .7vw, 1.7rem); line-height: 1.2; font-weight: 500; }
.ticket-stub { position: relative; display: grid; place-items: center; padding: 32px; border-left: 2px dashed var(--border); }
/* the punched notches where the stub tears off */
.ticket-stub::before, .ticket-stub::after { content: ""; position: absolute; left: -15px; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); }
.ticket-stub::before { top: -15px; clip-path: inset(50% 0 0 0); }
.ticket-stub::after { bottom: -15px; clip-path: inset(0 0 50% 0); }
.seal {
  width: min(100%, 190px); aspect-ratio: 1; border-radius: 22%; rotate: -8deg;
  background: var(--red); display: grid; place-items: center;
  box-shadow: inset 0 0 0 8px var(--red), inset 0 0 0 11px color-mix(in srgb, var(--gold) 80%, transparent);
}
.seal-char { font-family: "Noto Serif SC", serif; font-weight: 700; font-size: clamp(4rem, 2rem + 6vw, 7rem); line-height: 1; color: var(--gold-soft); }
@media (max-width: 760px) {
  .ticket { grid-template-columns: 1fr; }
  .ticket-stub { border-left: 0; border-top: 2px dashed var(--border); }
  .ticket-stub::before, .ticket-stub::after { top: -15px; bottom: auto; clip-path: inset(0 50% 0 0); }
  .ticket-stub::before { left: -15px; clip-path: inset(0 0 0 50%); }
  .ticket-stub::after { left: auto; right: -15px; }
  .seal { width: 150px; }
}
@media (max-width: 480px) { .details { grid-template-columns: 1fr; } }

/* ---------- FAQ: one answer open at a time ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gutter); align-items: start; }
.faq-grid .section-head { display: block; margin: 0; position: sticky; top: calc(var(--nav) + 32px); }
.faq { border-bottom: 1px solid var(--border); }
.qa { border-top: 1px solid var(--border); interpolate-size: allow-keywords; }
.qa summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 0; cursor: pointer; list-style: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary h3 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(1.3rem, 1.1rem + .6vw, 1.6rem); letter-spacing: -0.015em; transition: color .15s var(--ease); }
.qa summary::after { content: ""; flex: none; width: 18px; height: 18px;
  background: linear-gradient(var(--red), var(--red)) center / 100% 2px no-repeat, linear-gradient(var(--red), var(--red)) center / 2px 100% no-repeat;
  transition: rotate .3s var(--ease); }
.qa[open] summary::after { rotate: 45deg; }
.qa[open] summary h3, .qa summary:hover h3 { color: var(--red); }
.qa p { margin: 0; padding: 0 42px 28px 0; color: var(--muted); max-width: 60ch; }
.qa::details-content { block-size: 0; overflow: clip; transition: block-size .35s var(--ease), content-visibility .35s allow-discrete; }
.qa[open]::details-content { block-size: auto; }
@media (max-width: 860px) {
  .faq-grid { grid-template-columns: 1fr; }
  .faq-grid .section-head { position: static; margin-bottom: 28px; }
}

/* ---------- Close and footer ---------- */
.close { position: relative; isolation: isolate; overflow: hidden; background: var(--night-1); color: #f6e3d6; padding: clamp(96px, 16vh, 168px) 0 clamp(72px, 10vh, 112px); }
.sparks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.close h2 { color: #fff6e2; font-size: clamp(2.4rem, 1.5rem + 3vw, 4.25rem); max-width: 16ch; margin-bottom: 20px; }
.close .lead { font-size: 1.15rem; max-width: 48ch; margin-bottom: 32px; color: #f2d9cc; }
.foot { background: var(--night-1); color: #e9c9bd; font-size: .9rem; padding: 0 0 40px; }
.foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 28px; background: linear-gradient(rgba(255, 255, 255, .15), rgba(255, 255, 255, .15)) var(--gutter) 0 / calc(100% - 2 * var(--gutter)) 1px no-repeat; }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-brand img { height: 36px; width: auto; }
.foot a { color: #fff; }
.foot .muted { color: #d9b3a8; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-property: color, background-color, border-color, opacity !important; }
}
