/*
 * pgbroadcast.com's one stylesheet.
 *
 * QuizBroadcast's site sheet (TiktokBilgi's src/site/site.css), cut down to the
 * parts this page uses: the same tokens, the same page shell and the same
 * components, so the two products' sites read as one family, as their apps do.
 * What is the race's own is marked where it starts.
 *
 * Logical properties throughout, as there: the site speaks the app's eleven languages, and the Arabic and Urdu
 * pages mirror without a single [dir='rtl'] override.
 */

:root {
  color-scheme: dark;

  /* Three colours and no fourth: black, white, red. Every neutral is white at
     an alpha, so the greys are all the same ink seen through the one ground,
     and a raised surface is black with a rule around it, not a lighter box. */
  --bg: #000000;
  --border: rgba(255, 255, 255, 0.28);
  --border-strong: rgba(255, 255, 255, 0.52);

  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.62);
  --text-faint: rgba(255, 255, 255, 0.48);

  /* The platform's red, the broadcast screen's accent and the brand tile's:
     5.36:1 on black, legible as body text as well as a fill and a rule. */
  --accent: #ff1500;
  --good: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --wrap: 1120px;
  --font:
    'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  /* The contact page and the 404 are short: without this the footer stops
     where their text ran out. */
  min-block-size: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: 'Cascadia Mono', 'SF Mono', Consolas, monospace;
  font-size: 0.9em;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

/* --------------------------------------------------------------- buttons -- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  /* Black ink on the red fill: 5.36:1, against 3.9:1 for white. */
  color: var(--bg);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding-block: 9px;
  padding-inline: 16px;
}

/* An edge, not a brightening: no filter can lighten #ff1500, whose red is
   already at 255 and whose blue is 0. */
.btn:hover {
  border-color: var(--text);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.large {
  font-size: 1.05rem;
  padding-block: 13px;
  padding-inline: 26px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* -------------------------------------------------------------- language -- */

/* The language bar above the top bar: one plain link to each language's page,
   with no script. */
.langbar {
  border-block-end: 1px solid var(--border);
}

.langbar .locales {
  padding-block: 8px;
}

.locales {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.locale {
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding-block: 3px;
  padding-inline: 8px;
}

.locale:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.locale[aria-current='page'] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---------------------------------------------------------------- topbar -- */

.site-top {
  position: sticky;
  inset-block-start: 0;
  z-index: 5;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--border);
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

/* The race's tile as it is (brand/mark.svg): the chequered flag cut out of the
   red, which on this black reads the way it does in the app's own top bar. */
.mark {
  inline-size: 32px;
  block-size: 32px;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-inline-start: auto;
  font-size: 0.92rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

/* On a wide screen the bar is one row and the two `auto` margins space brand,
   navigation and actions across it; on a narrow one it wraps, and the actions
   keep to the far side. */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
  flex-wrap: wrap;
}

/* The navigation is the first thing to go on a phone: the page is one scroll,
   and the bar's job there is the two buttons. */
@media (max-width: 720px) {
  .site-nav {
    display: none;
  }
}

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

.hero-inner {
  display: grid;
  gap: 40px;
  padding-block: 64px 48px;
}

@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    padding-block: 80px 56px;
  }
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: start;
}

.eyebrow {
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
}

.lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-inline-size: 60ch;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.note {
  font-size: 0.88rem;
  color: var(--text-faint);
  max-inline-size: 56ch;
}

.hero-shot,
.duel-shot {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/*
 * A picture of the broadcast screen (web/static/shots/, `npm run site:shots`):
 * the card cut from the 1080 × 1920 stage, photographed on this page's black.
 * The card's panel is translucent on air, over the broadcaster's camera; here
 * the black shows through it instead, so no frame is drawn around it — the
 * card's own rule is the edge.
 */
.screen {
  display: block;
  inline-size: min(380px, 86vw);
  aspect-ratio: 830 / 1160;
}

/* The line under a picture that says what it is: the designer's sample cup,
   not a real broadcast. A picture with no such line reads as a promise. */
.shot-note {
  font-size: 0.82rem;
  color: var(--text-faint);
  text-align: center;
  text-wrap: balance;
  max-inline-size: 40ch;
}

/* ----------------------------------------------------------------- intro -- */

/* The page opens on every game, not the car race: the car race's own hero
   follows the strip, its title a heading under the page's one h1. */
.hero h2 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.hero .intro-point {
  font-size: 1.25rem;
  color: var(--accent);
  margin-block-start: 4px;
}

.intro .screen {
  inline-size: min(440px, 86vw);
}

/* The intro's pictures, one game's every four seconds, by CSS alone: the home
   page runs no script. They are stacked in one grid cell and each fades in for
   its four seconds of a 32 s turn, the delays putting each at its own place in
   the turn from the start. Eight pictures, as `GAMES` in src/site/render.ts has
   eight games: a ninth needs the turn and the steps below made over. */
.rotator {
  display: grid;
}

.rotator > .screen {
  grid-area: 1 / 1;
  opacity: 0;
  animation: rotate 32s infinite;
}

.rotator > .screen:first-child {
  opacity: 1;
}

.rotator > .screen:nth-child(2) {
  animation-delay: -28s;
}

.rotator > .screen:nth-child(3) {
  animation-delay: -24s;
}

.rotator > .screen:nth-child(4) {
  animation-delay: -20s;
}

.rotator > .screen:nth-child(5) {
  animation-delay: -16s;
}

.rotator > .screen:nth-child(6) {
  animation-delay: -12s;
}

.rotator > .screen:nth-child(7) {
  animation-delay: -8s;
}

.rotator > .screen:nth-child(8) {
  animation-delay: -4s;
}

/* Shown for 4 s of the 32 (12.5%), faded out over 0.6 s (1.875%), and faded in
   over the last 0.6 s of the turn, as the picture before it fades out. */
@keyframes rotate {
  0%,
  12.5% {
    opacity: 1;
  }
  14.375%,
  98.125% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rotator > .screen {
    animation: none;
  }
}

/* ----------------------------------------------------------------- games -- */

/* Every game's picture side by side, scrolled sideways: a row, so on a phone
   the next game peeks in at the edge and says there is more. */
.games-strip {
  margin: 0;
  padding: 4px 0 18px;
  list-style: none;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--border-strong) transparent;
}

.games-strip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.games-strip li {
  flex: 0 0 auto;
  inline-size: min(250px, 68vw);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.games-strip .game-shot {
  display: block;
  margin-block-end: 6px;
}

.games-strip .screen {
  inline-size: 100%;
}

.games-strip h3 {
  font-size: 1.15rem;
}

.games-strip h3 a {
  color: var(--text);
  text-decoration: none;
}

.games-strip h3 a:hover {
  color: var(--accent);
}

.games-strip p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.games-strip .typed {
  align-self: start;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  padding-block: 2px;
  padding-inline: 12px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------- shared -- */

section {
  padding-block: 56px;
}

.need {
  padding-block: 40px 0;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-block-end: 12px;
}

.section-lede {
  color: var(--text-dim);
  max-inline-size: 70ch;
  margin-block-end: 28px;
}

.section-more {
  margin-block-start: 24px;
  font-size: 0.95rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.need-card {
  max-inline-size: 720px;
}

.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-dim);
}

.ticks li {
  position: relative;
  padding-inline-start: 24px;
}

.ticks li::before {
  content: '✓';
  position: absolute;
  inset-inline-start: 0;
  color: var(--good);
  font-weight: 700;
}

/* ----------------------------------------------------------------- steps -- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 18px;
}

.step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-number {
  inline-size: 30px;
  block-size: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step h3 {
  font-size: 1.1rem;
}

.step p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* -------------------------------------------------------------- features -- */

/* `min(…, 100%)` rather than a bare minimum: a hard 300px floor plus the wrap's
   padding is wider than a 360px phone, and the whole page scrolls sideways. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 20px;
  align-items: start;
}

.feature h3 {
  font-size: 1.1rem;
}

.feature p {
  color: var(--text-dim);
}

.feature.wide {
  grid-column: 1 / -1;
}

.feature.wide > p {
  font-size: 1.05rem;
  max-inline-size: 84ch;
}

/* Four cards in two rows of two, where three columns would leave one alone. */
.grid.pairs {
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding-block: 3px;
  padding-inline: 10px;
}

/* -------------------------------------------------------------- the race -- */

/*
 * The five numbers, in the order a viewer types them, each with what its two
 * ends do: the same words as the lobby's legend and the app's guide
 * (`race.param.*` in src/shared/i18n/en.json), and the duel's two the same way
 * (`race.aim.*`). A grid of three columns — the number and its name, then its
 * low end and its high one — that folds to one on a phone.
 */
.params {
  list-style: none;
  margin: 0;
  padding: 0;
  max-inline-size: 760px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) 1fr 1fr;
  gap: 4px 16px;
  align-items: center;
  border-block-start: 1px solid var(--border);
  padding-block-start: 6px;
}

.param-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.param-number {
  inline-size: 24px;
  block-size: 24px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.param-end {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.param-end code {
  color: var(--text);
  margin-inline-end: 6px;
}

@media (max-width: 640px) {
  .param {
    grid-template-columns: 1fr 1fr;
  }

  .param-name {
    grid-column: 1 / -1;
  }
}

/* A viewer's whole car or aim, as they would type it in the chat: the lobby's
   own red pill, with the button's black ink (`.feature p` would make it grey). */
.feature .typed {
  align-self: start;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  padding-block: 4px;
  padding-inline: 14px;
  letter-spacing: 0.04em;
}

/* -------------------------------------------------------------- the duel -- */

/* The duel's cards beside its one picture, and the rocket launch's beside
   its own, as the hero's text is beside its own; on a narrower window the
   picture follows the cards. */
.duel-inner {
  display: grid;
  gap: 32px;
  align-items: start;
}

@media (min-width: 900px) {
  .duel-inner {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* ----------------------------------------------------------------- shots -- */

/* The car race's pictures sit under its cards, in the section itself. */
.subhead {
  margin-block: 48px 8px;
  font-size: 1.4rem;
}

/* Three scenes side by side, taken in at a glance; `auto-fit` so that on a
   narrow window they stack rather than shrink past reading. */
.gallery {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 28px;
  justify-items: center;
}

.gallery li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-inline-size: 300px;
}

.gallery .screen {
  inline-size: 100%;
}

.gallery p {
  color: var(--text-dim);
  font-size: 0.92rem;
  text-align: center;
  text-wrap: pretty;
}

/* ------------------------------------------------------------------- faq -- */

.qa-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}

.qa {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.qa dt {
  font-weight: 650;
  margin-block-end: 6px;
}

.qa dd {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------- closing -- */

.closing {
  border-block-start: 1px solid var(--border);
}

.closing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.closing h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

.closing p {
  color: var(--text-dim);
  max-inline-size: 60ch;
}

/* ----------------------------------------------------------------- prose -- */

.prose h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-block-end: 20px;
}

.prose .card {
  max-inline-size: 760px;
}

.prose .lede {
  margin-block-end: 8px;
}

/* --------------------------------------------------------------- contact -- */

/* The site's only form. The fields are the card's own black with a rule
   around them, like everything raised here — not a lighter well. */
.contact-form {
  margin-block-start: 24px;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span,
.field > label {
  font-weight: 600;
  font-size: 0.95rem;
}

.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding-block: 10px;
  padding-inline: 12px;
  inline-size: 100%;
}

.field textarea {
  resize: vertical;
  min-block-size: 10rem;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Send is disabled until the page's script arms it, and while a message goes
   out; only the second is something to wait for. */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.contact-form[aria-busy='true'] .btn:disabled {
  cursor: progress;
}

.contact-form[aria-busy='true'] .field input,
.contact-form[aria-busy='true'] .field textarea {
  color: var(--text-dim);
}

.contact-status {
  color: var(--text-dim);
}

.contact-status.error {
  color: var(--accent);
}

/* The honeypot. Clipped out of sight rather than `display: none`, which the
   cheaper scripts know to skip; a person never sees it or tabs into it. */
.contact-trap {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.contact-done {
  margin-block-start: 24px;
}

.contact-done:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contact-note {
  margin-block-start: 16px;
}

/* What the contact page's script hides — the sent form, the thank-you card
   before it — stays hidden, whatever display its class gives it. */
[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- footer -- */

.site-foot {
  border-block-start: 1px solid var(--border);
  padding-block: 40px 20px;
}

.foot-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 28px;
}

.foot-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  grid-column: 1 / -1;
}

@media (min-width: 900px) {
  .foot-brand {
    grid-column: auto;
    max-inline-size: 40ch;
  }
}

.disclaimer {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.foot-links h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-block-end: 10px;
}

.foot-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
}

.foot-links a {
  color: var(--text-dim);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--accent);
}

.foot-legal {
  margin-block-start: 28px;
  padding-block-start: 16px;
  border-block-start: 1px solid var(--border);
  color: var(--text-faint);
}
