/* phonyfacts.com. Colour and type tokens come from game.css, which is the
   game's own stylesheet scoped under .screen (see tools/site-sync.ts). */

:root {
  --gutter: clamp(20px, 5vw, 72px);
  --lemon-edge: #b38a00;
  --placeholder: #ab98cb;
  --z: 0.72; /* zoom of the 390px-wide game screens inside the phone frames */
}

* { box-sizing: border-box; }

html {
  scrollbar-color: var(--grape-3) var(--grape);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--grape);
  color: var(--paper);
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.5;
  caret-color: var(--lemon);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

::selection { background: var(--lemon); color: var(--ink); }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.22em; }
a:hover { text-decoration-color: var(--lemon); }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: min(100% - 2 * var(--gutter), 1296px); margin-inline: auto; }

/* ---------- logo ---------- */

.top { padding-top: clamp(20px, 3vw, 36px); }

.logo {
  display: inline-block;
  color: var(--paper);
  text-decoration: none;
  font-weight: 800;
  font-stretch: 75%;
  font-size: 34px;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ---------- hero ---------- */

.hero { padding-top: clamp(28px, 4vw, 52px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 32px 64px;
  align-items: start;
}

h1 {
  margin: 0;
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(46px, 7.2vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 span { display: block; color: var(--gum); }

.lede {
  margin: 24px 0 0;
  max-width: 40em;
  font-size: clamp(18px, 1.45vw, 22px);
  line-height: 1.45;
  color: var(--paper-dim);
}

/* ---------- start + join (hero and close) ---------- */

.actions { padding-top: 10px; }

.btn-start {
  display: block;
  padding: 22px 28px;
  border-radius: 999px;
  background: var(--lemon);
  color: var(--ink);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 0 var(--lemon-edge), 0 14px 24px -8px rgba(0, 0, 0, 0.45);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out, background-color 150ms;
}

.btn-start:hover { background: #ffdc66; }
.btn-start:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--lemon-edge), 0 6px 12px -6px rgba(0, 0, 0, 0.45); }

.join { margin-top: 28px; }

.join label { display: block; margin-bottom: 10px; font-size: 17px; font-weight: 600; color: var(--paper-dim); }

.join-row { display: flex; gap: 10px; }

.join input {
  flex: 1;
  min-width: 0;
  padding: 12px 8px 12px calc(8px + 0.3em);
  border: 3px solid var(--grape-3);
  border-radius: 14px;
  background: var(--grape-2);
  color: var(--paper);
  font: inherit;
  font-weight: 800;
  font-stretch: 75%;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 150ms;
}

.join input::placeholder { color: var(--placeholder); opacity: 1; }
.join input:hover { border-color: #6a43a6; }
.join input:focus { border-color: var(--lemon); outline: none; }
.join input[aria-invalid="true"] { border-color: var(--gum); }

.join button {
  flex: none;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  box-shadow: inset 0 0 0 3px var(--grape-3);
  font: inherit;
  font-weight: 800;
  font-size: 24px;
  cursor: pointer;
  transition: box-shadow 150ms, transform 90ms ease-out;
}

.join button:hover { box-shadow: inset 0 0 0 3px var(--paper-dim); }
.join button:active { transform: translateY(2px); }

.join-msg { min-height: 1.5em; margin: 8px 0 0; font-size: 16px; font-weight: 700; color: var(--gum); }

/* ---------- polygraph trace ---------- */

.trace { position: relative; height: 84px; margin-top: clamp(20px, 2.6vw, 32px); }

.trace svg { display: block; width: 100%; height: 100%; overflow: visible; }

.trace path {
  fill: none;
  stroke: var(--gum);
  stroke-width: 3.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.pen {
  position: absolute;
  left: 96%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 5px solid var(--grape);
  border-radius: 50%;
  background: var(--lemon);
  transform: translateY(var(--pen-y, 0px));
}

/* ---------- the four seats ---------- */

.stage { margin-top: 4px; }

.seats {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.seats:focus-visible { outline-offset: 8px; }

.seat { flex: none; width: calc(390px * var(--z) + 20px); margin: 0; }
.seat:nth-child(even) { margin-top: 48px; }

.seat figcaption {
  margin: 0 0 14px 6px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.seat figcaption span { color: var(--lemon); }

.phone {
  padding: 10px;
  border-radius: 44px;
  background: var(--ink);
  box-shadow: 0 0 0 3px var(--grape-3), 0 32px 48px -16px rgba(0, 0, 0, 0.6);
}

.phone .screen {
  position: relative;
  zoom: var(--z);
  width: 390px;
  height: 620px;
  padding: 14px 20px 20px;
  overflow: hidden;
  border-radius: calc(34px / var(--z));
  background: var(--grape);
  color: var(--paper);
  font-size: 18px;
  line-height: 1.4;
}

.phone .screen > :first-child { margin-top: 0; }
.screen input.is-typing { border-color: var(--lemon); }
.screen .btn.is-pressed { transform: translateY(4px); box-shadow: 0 1px 0 var(--lemon-edge); }
.screen .reveal-card[hidden] { display: none; }
.screen .choice.is-pressed { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--lemon), 0 2px 0 var(--ink); }

/* Room for Sam's screen to scroll the newest reveal cards up into view. */
.phone [data-k="s-screen"]::after { content: ""; display: block; height: 480px; }

/* The game's smallest text is set for a phone held in the hand. Shrunk into
   these frames it would drop under 12px, so the lines that tell the story are
   set larger here (19px at zoom 0.64 is about 12px). */
.phone .screen .meta,
.phone .screen .small,
.phone .screen .round-head,
.phone .screen label,
.phone .screen .reveal-card .who,
.phone .screen .fact { font-size: 19px; }
.phone .screen .reveal-card .who { padding-right: 96px; }

.stage.is-paused * { animation-play-state: paused !important; }

.stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 36px;
  font-size: 16px;
  color: var(--paper-dim);
}

.stage-foot p { margin: 0; }

.pause {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  box-shadow: inset 0 0 0 2px var(--grape-3);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pause:hover { box-shadow: inset 0 0 0 2px var(--paper-dim); }
.pause[hidden] { display: none; }
.pause svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pause .i-play { display: none; }
.pause[aria-pressed="true"] .i-play { display: block; }
.pause[aria-pressed="true"] .i-pause { display: none; }

/* ---------- sections ---------- */

.section { padding-top: clamp(112px, 13vw, 176px); }

.section h2, .close h2 {
  max-width: 15em;
  margin: 0 0 22px;
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(42px, 5.4vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.intro { max-width: 34em; margin: 0; font-size: clamp(19px, 1.5vw, 22px); color: var(--paper-dim); text-wrap: pretty; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px 80px;
  align-items: start;
}

/* scoring */

.points { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.points li {
  display: grid;
  grid-template-columns: clamp(96px, 8.6vw, 128px) minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 20px 28px;
  border-radius: 20px;
  background: var(--grape-2);
}

.points b {
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(34px, 3.2vw, 46px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.points p { margin: 0; font-size: clamp(19px, 1.6vw, 22px); font-weight: 700; line-height: 1.3; }
.points small { display: block; margin-top: 4px; font-size: 17px; font-weight: 500; color: var(--paper-dim); }

.p-truth b { color: var(--mint); }
.p-fool b { color: var(--gum); }
.p-found b { color: var(--lemon); }
.p-double { background: var(--lemon) !important; color: var(--ink); }

/* categories */

.cat-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 48px 40px;
  margin-top: 64px;
}

.cat-group h3 {
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--grape-3);
  font-size: 17px;
  font-weight: 700;
  color: var(--paper-dim);
}

.cat-group ul { display: grid; gap: 28px; margin: 0; padding: 0; list-style: none; }

.cat-name { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
.cat-name span { margin-left: 6px; font-size: 15px; font-weight: 600; color: var(--paper-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-prompt { margin: 8px 0 0; font-size: 17px; line-height: 1.45; color: var(--paper-dim); text-wrap: pretty; }

.cat-prompt .blank {
  display: inline-block;
  width: 3em;
  height: 1em;
  border-bottom: 3px solid var(--lemon);
  vertical-align: -0.05em;
}

/* the truth */

.truth-copy h3 { margin: 48px 0 10px; font-size: 24px; font-weight: 800; line-height: 1.2; }
.truth-copy > p:not(.intro) { max-width: 34em; margin: 0; color: var(--paper-dim); }
.truth-copy > p:last-child { margin-top: 28px; }

.typed { display: grid; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; }

.typed li { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); align-items: center; gap: 18px; }

.typed-in {
  padding: 8px 14px;
  border: 3px solid var(--grape-3);
  border-radius: 12px;
  background: var(--grape-2);
  font-size: 20px;
  font-weight: 700;
}

.typed-out { font-size: 17px; font-weight: 600; line-height: 1.35; }
.typed-out.is-caught { color: var(--gum); }
.typed-out.is-ok { color: var(--mint); }

.proof { margin: 0; }

.screen.flat { padding: 0; font-size: 18px; line-height: 1.4; }
.screen.flat .prompt { font-size: clamp(26px, 2.4vw, 34px); margin-top: 0; }
.screen.flat .reveal-card, .screen.flat .stamp { animation: none; }
.screen.flat .reveal-card { padding: 26px 26px 22px; }
.screen.flat .reveal-card .text { font-size: clamp(30px, 3vw, 40px); }
.screen.flat .stamp { top: 20px; right: 20px; font-size: 32px; }
.screen.flat .fact { font-size: 19px; }

.proof figcaption { margin-top: 18px; font-size: 16px; color: var(--paper-dim); }

/* what you need */

.needs-list { margin: 48px 0 0; }

.needs-list > div {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 8px 80px;
  align-items: baseline;
  padding: 26px 0;
  border-top: 3px solid var(--grape-3);
}

.needs-list > div:last-child { border-bottom: 3px solid var(--grape-3); }

.needs-list dt { font-weight: 800; font-stretch: 75%; font-size: clamp(34px, 3.6vw, 50px); line-height: 1; letter-spacing: -0.01em; }
.needs-list dd { margin: 0; max-width: 32em; font-size: clamp(19px, 1.5vw, 21px); color: var(--paper-dim); }

/* close: the actions again, under a second trace */

.close { padding: clamp(112px, 13vw, 176px) 0 clamp(80px, 9vw, 128px); }
.close .trace { margin: 0 0 clamp(48px, 6vw, 80px); }

.close-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 40px 64px;
  align-items: center;
}

.close h2 { margin: 0; font-size: clamp(48px, 7vw, 6rem); }
.close h2 span { display: block; color: var(--lemon); }

/* footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 32px;
  padding: 40px 0 48px;
  font-size: 16px;
  color: var(--paper-dim);
}

.foot .logo { font-size: 26px; }
.foot p { flex: 1; margin: 0; }
.foot a:not(.logo) { font-weight: 700; color: var(--paper); }

/* 404 */

.lost { padding-top: clamp(48px, 8vw, 96px); }
.lost .intro { margin-top: 22px; }
.lost .join { max-width: 380px; margin-top: 44px; }
.lost p.back { margin-top: 16px; font-weight: 700; }

/* ---------- smaller screens ---------- */

@media (max-width: 1379px) {
  :root { --z: 0.64; }
}

/* Below this the four phones no longer fit side by side: they become a swipe row. */
@media (max-width: 1239px) {
  :root { --z: 0.72; }

  .seats {
    justify-content: flex-start;
    margin-inline: calc(-1 * var(--gutter));
    padding: 4px var(--gutter) 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }

  .seats::-webkit-scrollbar { display: none; }
  .seat { scroll-snap-align: start; }
  .seat:nth-child(even) { margin-top: 0; }
  .stage-foot { margin-top: 12px; }
  .phone .screen { height: 560px; }

  .cat-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero-grid, .split, .close-grid { grid-template-columns: minmax(0, 1fr); }
  .actions { max-width: 460px; padding-top: 0; }
  .needs-list > div { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 18px; }
  .btn-start { font-size: 24px; padding: 19px 24px; }
  .trace { height: 64px; }
  .stage-foot { flex-direction: column; align-items: flex-start; }
  .cat-groups { grid-template-columns: minmax(0, 1fr); gap: 44px; margin-top: 48px; }
  .points li { gap: 16px; padding: 18px 20px; }
  .typed li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .typed-in { justify-self: start; }
  .foot p { flex-basis: 100%; order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* the sample round rewinds behind a short fade */
.phone .screen { transition: opacity 450ms ease-out; }
.stage.is-rewinding .phone .screen { opacity: 0.2; }
