/* BrainTrap website. The palette and type are the game's own: corridor navy, panel slate, cream text, lamp gold (the target),
   safe teal (right), trap coral (the trap), Inter with BrainTrap's divide sign. One bold thing: the playable trap in the hero. */
@font-face { font-family: "Inter BT"; src: url("/assets/inter-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter BT"; src: url("/assets/inter-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --navy: #101A2B;
  --deep: #0B1322;
  --slate: #22374D;
  --slate-2: #2C4560;
  --cream: #FFF8EC;
  --muted: #B9C6D6;
  --gold: #FBCB61;
  --brass: #C9963F;
  --teal: #2DD4BF;
  --coral: #FF7366;
  --r-board: 18px;
  --r-btn: 14px;
  --measure: 62ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--navy); color: var(--cream);
  font: 400 1.0625rem/1.6 "Inter BT", system-ui, sans-serif; font-feature-settings: "tnum" 0;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-underline-offset: .18em; }
a:hover { color: var(--cream); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-weight: 700; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.015em; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--navy); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------------- top bar ---------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 4vw, 48px); position: relative; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand img { border-radius: 9px; }
.top nav { display: flex; gap: clamp(10px, 2.4vw, 28px); flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--muted); text-decoration: none; font-size: .98rem; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--cream); }

/* ---------------- hero: the corridor and its ceiling lamp ---------------- */
.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 5vw, 72px);
  align-items: center; padding: clamp(24px, 5vw, 72px) clamp(16px, 5vw, 72px) clamp(56px, 8vw, 112px);
  background:
    radial-gradient(ellipse 38% 26% at 72% 0%, rgba(251, 203, 97, .28), transparent 70%),
    radial-gradient(ellipse 70% 60% at 72% 30%, rgba(45, 212, 191, .07), transparent 70%),
    linear-gradient(180deg, var(--deep) 0%, var(--navy) 60%);
  margin-top: -66px; padding-top: calc(66px + clamp(24px, 5vw, 72px));
}
.wordmark {
  font-size: clamp(3.4rem, 11vw, 8.6rem); letter-spacing: -.055em; line-height: .9; margin: 0 0 .18em;
  color: var(--cream); text-shadow: 0 0 60px rgba(251, 203, 97, .18);
}
.tagline { font-size: clamp(1.3rem, 2.6vw, 1.85rem); font-weight: 700; line-height: 1.25; color: var(--gold); margin-bottom: .8em; max-width: 22ch; }
.lede { color: var(--muted); max-width: 46ch; font-size: 1.08rem; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 1.6em; }
.play {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 24px; border-radius: var(--r-btn);
  background: var(--gold); color: var(--navy); font-weight: 700; text-decoration: none; font-size: 1.05rem;
}
.play:hover { color: var(--navy); filter: brightness(1.06); }
.play.soon { background: transparent; color: var(--gold); border: 2px solid var(--gold); cursor: default; }
.ghost { color: var(--cream); font-weight: 700; text-decoration: none; padding: 12px 4px; border-bottom: 2px solid var(--slate-2); }
.ghost:hover { border-color: var(--teal); }

/* the playable board: the game's Pulse Rail */
.rail-card {
  position: relative; background: linear-gradient(180deg, #1A2B40, #15233A); border: 2px solid var(--brass);
  border-radius: var(--r-board); padding: clamp(18px, 3vw, 30px); box-shadow: 0 0 0 6px rgba(201, 150, 63, .12), 0 30px 60px rgba(0, 0, 0, .45);
}
.rail-goal { color: var(--muted); font-size: .95rem; margin-bottom: 18px; }
.rail { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0; margin: 0 0 22px; position: relative; }
.rail::before { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 4px; margin-top: -2px; background: var(--teal); opacity: .45; border-radius: 2px; }
.rail li {
  position: relative; width: clamp(46px, 7.4vw, 66px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); border: 3px solid var(--teal); font-weight: 700; font-size: clamp(1.05rem, 2.1vw, 1.45rem); font-variant-numeric: tabular-nums;
}
.rail li.gap { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 6px rgba(251, 203, 97, .14); }
.rail-card.trapped .rail li.gap { border-color: var(--coral); color: var(--coral); box-shadow: 0 0 0 6px rgba(255, 115, 102, .18); }
.rail-card.solved .rail li { border-color: var(--gold); }
.rail-card.solved .rail li.gap { color: var(--navy); background: var(--gold); }

.pip-says { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; }
.pip-says img { width: 120px; height: 120px; flex: none; margin: -10px -4px -10px -10px; }
.pip-says p {
  position: relative; margin: 0; background: var(--cream); color: var(--navy); font-weight: 700; padding: 12px 16px; border-radius: 14px; line-height: 1.35;
}
.pip-says p::before { content: ""; position: absolute; left: -9px; top: 50%; margin-top: -9px; border: 9px solid transparent; border-left: 0; border-right-color: var(--cream); }

.dial { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; }
.step, .set, .choices button {
  font: inherit; font-weight: 700; color: var(--cream); background: var(--slate); border: 0; border-radius: var(--r-btn); cursor: pointer; min-height: 52px;
}
.step { width: 64px; font-size: 1.6rem; background: #0F5F58; }
.step:hover, .choices button:hover { background: var(--slate-2); }
.step:hover { background: #12746B; }
#pulse { min-width: 150px; text-align: center; font-size: 1.45rem; font-weight: 700; background: var(--navy); border-radius: 12px; padding: 10px 0; font-variant-numeric: tabular-nums; }
#pulse::before { content: "Pulse  "; color: var(--muted); font-weight: 400; font-size: 1rem; white-space: pre; }
.set { display: block; width: 100%; background: #0F7A6E; font-size: 1.1rem; }
.set:hover { background: #12907F; }
.rail-result { min-height: 1.6em; margin: 14px 0 0; font-weight: 700; text-align: center; }
.rail-card.trapped .rail-result { color: var(--coral); }
.rail-card.solved .rail-result { color: var(--gold); }

/* ---------------- sections ---------------- */
main > section { padding: clamp(56px, 8vw, 104px) clamp(16px, 5vw, 72px); }
.sub { color: var(--muted); max-width: var(--measure); margin-bottom: 2em; }

.how { background: var(--deep); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 1.6em 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px); }
.steps li { counter-increment: step; border-top: 3px solid var(--slate-2); padding-top: 18px; }
.steps li:nth-child(2) { border-color: var(--coral); }
.steps li:nth-child(3) { border-color: var(--gold); }
.steps li::before { content: counter(step); display: block; font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--slate-2); margin-bottom: 10px; }
.steps li:nth-child(2)::before { color: var(--coral); }
.steps li:nth-child(3)::before { color: var(--gold); }
.steps p { color: var(--muted); max-width: 40ch; }

/* three traps: one board each, styled after its mechanic */
.trap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); align-items: start; }
.trap { background: var(--slate); border-radius: var(--r-board); padding: 22px; border: 2px solid transparent; }
.trap.gates { border-radius: 6px; }
.trap.shaft { border-color: #3A5674; }
.trap.towers { border-radius: 26px; }
.trap h3 { color: var(--muted); font-size: 1rem; font-weight: 700; }
.q { font-size: 1.15rem; font-weight: 700; min-height: 3.4em; }
.expr { font-size: 1.6rem; letter-spacing: .01em; }
.gate-row { display: flex; gap: 6px; align-items: center; margin: 4px 0 18px; }
.gate-row .tok { background: var(--teal); color: var(--navy); font-weight: 700; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; }
.gate-row .gate { border: 2px solid var(--brass); color: var(--gold); border-radius: 8px; width: 36px; height: 36px; display: grid; place-items: center; font-weight: 700; }
.floors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 4px 0 18px; direction: rtl; }
.floors span { background: var(--navy); border-left: 3px solid var(--teal); padding: 6px 0; text-align: center; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.floors .start { border-color: var(--gold); color: var(--gold); }
.towers-art { display: flex; gap: 14px; align-items: flex-end; height: 96px; margin: 4px 0 18px; }
.tw { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 70px; border-radius: 10px 10px 4px 4px; color: var(--navy); font-size: .85rem; font-weight: 700; padding-bottom: 6px; }
.tw b { font-size: 1.2rem; }
.tw.maya { height: 82px; background: var(--teal); }
.tw.leo { height: 92px; background: repeating-linear-gradient(180deg, var(--gold) 0 10px, #E4B651 10px 12px); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices button { font-size: 1.2rem; font-variant-numeric: tabular-nums; background: var(--navy); }
.choices button[aria-pressed="true"].is-trap { background: var(--coral); color: var(--navy); }
.choices button[aria-pressed="true"].is-right { background: var(--gold); color: var(--navy); }
.choices button[aria-pressed="true"].is-wrong { outline: 2px solid var(--muted); }
.why { min-height: 3.2em; margin: 14px 0 0; font-weight: 700; }
.why.trap-hit { color: var(--coral); }
.why.right { color: var(--gold); }
.why.wrong { color: var(--muted); }

/* chapters: a numbered corridor (it is a real sequence) */
.chapters { background: var(--deep); }
.ch-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(20px, 3vw, 48px); align-items: start; }
.ch-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 12px; }
.ch-list li { break-inside: avoid; margin-bottom: 6px; }
.ch {
  width: 100%; display: grid; grid-template-columns: 2.2em 1fr; grid-template-rows: auto auto; text-align: left; font: inherit; color: var(--cream);
  background: transparent; border: 0; border-left: 3px solid var(--slate-2); padding: 8px 10px; cursor: pointer; border-radius: 0 10px 10px 0;
}
.ch:hover { background: rgba(255, 255, 255, .04); }
.ch[aria-pressed="true"] { border-color: var(--gold); background: rgba(251, 203, 97, .08); }
.ch-n { grid-row: 1 / span 2; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch[aria-pressed="true"] .ch-n { color: var(--gold); }
.ch-name { font-weight: 700; line-height: 1.3; }
.ch-lv { color: var(--muted); font-size: .85rem; }
.ch-view { margin: 0; position: sticky; top: 24px; }
.ch-view img { border-radius: var(--r-board); border: 2px solid var(--brass); width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--slate); }
.ch-view figcaption { margin-top: 14px; display: grid; gap: 4px; }
.ch-view figcaption span { color: var(--muted); }

/* screenshots */
.shots { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(200px, 22vw, 270px); gap: 18px; overflow-x: auto; padding-bottom: 14px; scroll-snap-type: x mandatory; }
.shot { margin: 0; scroll-snap-align: start; }
.shot img { border-radius: 22px; border: 6px solid #0A111C; background: var(--slate); }
.shot figcaption { margin-top: 10px; font-weight: 700; font-size: .98rem; }

/* families */
.families { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.fam-copy p { color: var(--muted); }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.facts li { padding-left: 22px; position: relative; color: var(--muted); max-width: var(--measure); }
.facts li::before { content: ""; position: absolute; left: 0; top: .55em; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.facts strong { color: var(--cream); }

.end { text-align: center; background: radial-gradient(ellipse 50% 60% at 50% 0%, rgba(251, 203, 97, .16), transparent 70%), var(--deep); }
.end img { margin: 0 auto 8px; width: 140px; }
.end .cta { justify-content: center; }

/* footer */
.foot { padding: 36px clamp(16px, 5vw, 72px) 48px; border-top: 1px solid var(--slate); display: grid; gap: 12px; }
.foot-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0; }
.foot-brand img { border-radius: 7px; }
.foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.fine { color: var(--muted); font-size: .88rem; margin: 0; }

/* documents (privacy, support, delete data, 404) */
.doc { max-width: 760px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(16px, 5vw, 32px) 64px; }
.doc h1 { font-size: clamp(2rem, 5vw, 3rem); }
.doc h2 { font-size: 1.35rem; margin-top: 1.8em; }
.doc h3 { font-size: 1.08rem; margin-top: 1.4em; }
.doc p, .doc li { color: #D9E2EC; max-width: var(--measure); }
.doc li { margin-bottom: .5em; }
.doc .meta { color: var(--muted); font-size: .95rem; }
.lost { text-align: center; padding-top: 72px; }
.lost img { margin: 0 auto 16px; width: 140px; }
.lost p { margin: 0 auto; }

/* one orchestrated moment: the trap snaps (only when the visitor answers) */
@keyframes snap { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.rail-card.trapped .rail li.gap { animation: shake .32s ease-out 2; }
.rail-card.solved .rail li.gap { animation: snap .45s ease-out; }

@media (max-width: 900px) {
  .hero, .families, .ch-layout { grid-template-columns: 1fr; }
  .trap-grid, .steps { grid-template-columns: 1fr; }
  .ch-view { position: static; order: -1; }
  .top nav a:nth-child(3) { display: none; }
}
@media (max-width: 480px) {
  .ch-list { columns: 1; }
  .top nav { gap: 12px; }
  .top nav a:nth-child(2) { display: none; }
  .pip-says img { width: 72px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
