/* Raleway, served from this site. Weights 300, 400, 700 and 800 come from one variable file.
   Digits live in the latin file, which carries the lnum feature. */
@font-face {
  font-family: 'Raleway';
  src: url(/fonts/raleway-latin-wght-normal.woff2) format('woff2');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Raleway';
  src: url(/fonts/raleway-latin-ext-wght-normal.woff2) format('woff2');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --black: #111111;
  --white: #FFFFFF;
  --yellow: #FCCD07; /* the logo's yellow; see docs/decisions.md */
  --muted: #555555;
  --body-text: #333333;
  --font: 'Raleway', system-ui, sans-serif;
  --focus-ring: 3px solid var(--black);
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-weight: 400;
  /* Lining figures on every number on the site. */
  font-variant-numeric: lining-nums;
  font-feature-settings: 'lnum' 1;
}

/* Inputs don't inherit font settings by default. */
button, input, textarea, select {
  font: inherit;
  font-variant-numeric: lining-nums;
  font-feature-settings: 'lnum' 1;
  color: inherit;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

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

/* ---------- Views ---------- */
/* early.js sets data-view="welcome" before paint for a browser that already has a badge. */
html[data-view="welcome"] #question { display: none; }
html[data-view="welcome"] #welcome[hidden] { display: flex; }

/* ---------- Page 1: the question ---------- */
/* Phones first: the whole page fits one screen, including inside the Reddit and Twitter apps. */
.question {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4svh, 48px);
  width: 100%;
  max-width: calc(880px + 2 * 20px); /* 880px of content, as in the reference, plus side padding */
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.question__mark {
  display: block;
  width: min(220px, 26svh, 52vw);
  height: auto;
}

.question__headline {
  margin: 0;
  font-weight: 800;
  font-size: clamp(26px, 5.2vw + 6px, 48px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
  max-width: 22ch;
}

/* The headline breaks after "working for you," on wide screens only. */
.wide-break { display: none; }

.question__picks {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pick {
  min-height: 60px;
  width: 100%;
  padding: 0 20px;
  border: 2px solid var(--black);
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (hover: hover) {
  .pick:hover { background: var(--yellow); }
}
.pick:active,
.pick[aria-pressed="true"] { background: var(--yellow); }
.pick:disabled { cursor: progress; }
.pick:disabled:not([aria-pressed="true"]) { opacity: 0.45; }

.question__error {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

/* Honeypot: off-screen, never seen or reached by keyboard. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.turnstile:empty { display: none; }

@media (min-width: 720px) {
  .question { gap: 48px; padding-top: 48px; padding-bottom: 48px; }
  .question__mark { width: 220px; }
  .question__headline { max-width: 20ch; }
  .question__picks { flex-direction: row; flex-wrap: wrap; gap: 16px; }
  .pick { flex: 1 1 280px; width: auto; min-height: 76px; font-size: 24px; }
}

/* Wide enough for each part of the question on one line: break where the copy file says. */
@media (min-width: 960px) {
  .question__headline { max-width: none; text-wrap: wrap; }
  .wide-break { display: inline; }
}

/* Short screens (landscape phones, in-app browsers with toolbars): tighten further. */
@media (max-height: 560px) {
  .question { gap: 14px; }
  .question__mark { width: min(120px, 22svh); }
  .question__headline { font-size: clamp(22px, 4.6svh, 32px); }
  .pick { min-height: 52px; font-size: 18px; }
}

/* ---------- Page 2: the welcome (filled out in milestone 3) ---------- */
.welcome {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) 20px 64px;
}
.welcome__intro { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.welcome__headline {
  margin: 0;
  font-weight: 800;
  font-size: clamp(32px, 6vw + 8px, 48px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.welcome__headline:focus { outline: none; }
.welcome__line { margin: 0; font-size: clamp(17px, 1.5vw + 12px, 20px); line-height: 1.5; color: var(--body-text); }

.welcome { display: flex; flex-direction: column; gap: clamp(32px, 6vw, 72px); }
@media (min-width: 720px) { .welcome { padding-top: 112px; max-width: calc(880px + 2 * 24px); padding-left: 24px; padding-right: 24px; } }

.card {
  border: 2px solid var(--black);
  border-radius: 20px;
  padding: clamp(20px, 4vw, 32px);
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border: 2px solid var(--black);
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
}
.button--dark { background: var(--black); color: var(--white); }
/* Components that set display need [hidden] restated. Without this, page 2 would show under page 1. */
.question[hidden], .welcome[hidden], .button[hidden], .card[hidden], .comment-form[hidden] { display: none; }
.button:disabled { opacity: 0.5; cursor: progress; }

/* Results and badge side by side on wide screens, stacked on phones. */
/* A heading with the block it introduces. */
.welcome__group { display: flex; flex-direction: column; gap: 16px; }
.welcome__group[hidden] { display: none; }
.welcome__top { display: flex; flex-wrap: wrap; gap: 24px; }
.results { flex: 1 1 380px; display: flex; flex-direction: column; gap: 20px; }
.badge-card { flex: 1 1 300px; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.bar { display: flex; flex-direction: column; gap: 8px; }
.bar__label { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 18px; }
.bar__track { height: 18px; border: 2px solid var(--black); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; width: 0; transition: width 600ms ease; }
.bar__fill--me { background: var(--black); }
.bar__fill--it { background: var(--yellow); }
@media (prefers-reduced-motion: reduce) { .bar__fill { transition: none; } }
.results__count, .badge-card__caption, .comments__empty { margin: 0; font-size: 14px; color: var(--muted); }
.comments__empty[hidden] { display: none; }

.badge-card__badge { display: block; width: 200px; height: auto; }

.comment-form { display: flex; flex-direction: column; gap: 12px; }
.comment-form textarea::placeholder { color: var(--muted); opacity: 1; }
.comment-form textarea {
  width: 100%;
  border: 2px solid var(--black);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px; /* 16px keeps iOS from zooming in */
  line-height: 1.5;
  resize: vertical;
}
.comment-form__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.comment-form__note { flex: 1 1 200px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.comment-form__status { margin: 0; font-size: 15px; font-weight: 700; }

.comments { display: flex; flex-direction: column; gap: 16px; }
.comments__heading, .section-heading { margin: 0; font-weight: 800; font-size: clamp(24px, 3vw + 12px, 30px); }
.comments__list { display: flex; flex-direction: column; gap: 12px; }
.comment { border: 2px solid var(--black); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.comment__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.comment__answer { color: var(--muted); }
.comment__body { margin: 0; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Page 3: the reveal ---------- */
.reveal {
  width: 100%;
  max-width: calc(1120px + 2 * 24px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
}
.reveal__header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 20px; border-bottom: 2px solid var(--black);
}
.reveal__mark { display: block; width: clamp(64px, 18vw, 96px); height: auto; }
.reveal__from { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.reveal__from-logo { display: block; height: 32px; width: auto; }
.reveal__from-text { font-weight: 700; color: var(--black); }
.reveal__from[data-has-logo="true"] .reveal__from-text,
.reveal__from[data-has-logo="false"] .reveal__from-logo { display: none; }

.reveal__main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 48px 64px; margin-top: 40px; }
.reveal__poll { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.reveal__headline { margin: 0; font-weight: 800; font-size: clamp(28px, 3vw + 14px, 40px); line-height: 1.1; letter-spacing: -0.01em; }
.reveal__picks .pick { font-size: 20px; }
@media (min-width: 720px) { .reveal__picks { flex-direction: row; flex-wrap: wrap; gap: 12px; } .reveal__picks .pick { flex: 1 1 220px; width: auto; min-height: 60px; font-size: 20px; } }

.reveal[data-show-results="false"] [data-reveal-results],
.reveal[data-want-a-say="false"] [data-say] { display: none; }

/* In page 3's single column, the page 2 card sizing (a flex basis) would become a height. */
.reveal .results { flex: none; }

.say { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.say__line { flex: 1 1 200px; font-size: 16px; line-height: 1.5; color: var(--body-text); }
.say__button { min-height: 52px; padding: 0 28px; font-weight: 800; font-size: 18px; }

.manifesto { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 20px; font-size: clamp(16px, 0.5vw + 14px, 18px); line-height: 1.6; }
.manifesto__heading { margin: 0 0 4px; font-weight: 700; font-size: clamp(30px, 3vw + 14px, 40px); line-height: 1.1; }
.manifesto p { margin: 0; }

.reveal__footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 64px; padding-top: 24px; border-top: 2px solid var(--black); font-size: 14px; color: var(--muted);
}
.reveal__learn { background: var(--white); color: var(--black); text-decoration: none; }
/* Hidden until a "Learn more" link is set on the review page. */
.reveal__learn[data-href=""] { display: none; }

/* ---------- Privacy and terms: the small link and the page ---------- */
.policy { margin: 0; font-size: 12px; line-height: 1.5; text-align: center; color: var(--muted); }
.policy a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.policy a:hover { color: var(--black); }
/* Page 1, only when its setting is on: pinned to the bottom so the mark, question, and buttons stay centered. */
.question { position: relative; }
.question > .policy { position: absolute; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); }
.question:has(> .policy) { padding-bottom: max(40px, calc(env(safe-area-inset-bottom) + 30px)); }
.reveal > .policy { margin-top: 20px; }

.policy-page { width: 100%; max-width: 720px; margin: 0 auto; padding: max(32px, env(safe-area-inset-top)) 20px 64px; display: flex; flex-direction: column; gap: 24px; font-size: 16px; line-height: 1.6; }
.policy-page__home { align-self: flex-start; }
.policy-page__home img { display: block; width: 72px; height: auto; }
.policy-page h1 { margin: 0; font-weight: 800; font-size: clamp(30px, 5vw + 8px, 44px); line-height: 1.1; }
.policy-page h2 { margin: 0 0 8px; font-weight: 800; font-size: 22px; }
.policy-page p { margin: 0 0 12px; }
