/* Quizthon landing: ink and paper tokens from the design system */

/* Self-hosted variable fonts (same files @fontsource ships to the app) so
   visitors' IPs never reach Google's font CDN. Latin subset only. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./fonts/fraunces-latin-opsz-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("./fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: italic;
  font-display: swap;
  font-weight: 400 700;
  src: url("./fonts/instrument-sans-latin-wght-italic.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("./fonts/spline-sans-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --paper: #f6f1e7;
  --paper-deep: #efe7d7;
  --card: #fffdf7;
  --ink: #1c2433;
  --ink-soft: #4d586c;
  --line: #ddd3bf;
  --line-strong: #b7ab8d;
  --red: #b02e0c;
  --red-soft: #f7e3da;
  --green: #1a6b42;
  --green-soft: #e0eee2;
  --amber: #7c5a00;
  --amber-soft: #f6ebcd;
  --shadow: 4px 4px 0 rgba(28, 36, 51, 0.1);
  --shadow-sm: 2px 2px 0 rgba(28, 36, 51, 0.12);
  --radius: 10px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --wrap: 75rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-body);
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    transparent 0,
    transparent 31px,
    rgba(28, 36, 51, 0.035) 31px,
    rgba(28, 36, 51, 0.035) 32px
  );
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-weight: 800;
}

a {
  color: inherit;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--red);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 2px;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
}

/* Header */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem max(1.25rem, env(safe-area-inset-right)) 0.7rem max(1.25rem, env(safe-area-inset-left));
  padding-top: max(0.7rem, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* The wordmark, identical to the app's header brand (AppShell `.brand` /
 * `.brand-accent` in frontend/src/index.css): Fraunces, "thon" in red. */
.brand {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.18s ease, letter-spacing 0.18s ease;
}

.brand-accent {
  color: var(--red);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

/* Buttons */

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.925rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(28, 36, 51, 0.16);
  text-decoration: none;
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-danger-fill {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: color-mix(in srgb, var(--paper) 45%, transparent);
  box-shadow: none;
}

.link-button {
  font: inherit;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.link-button {
  white-space: nowrap;
  font-weight: 600;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.link-button:hover {
  color: var(--red);
  text-decoration-color: var(--red);
}

/* Cards & chips */

.card {
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  border-bottom: 1.5px solid var(--line-strong);
  padding-bottom: 0.3rem;
  margin: 0 0 0.9rem;
}

.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  padding: 0.12rem 0.5rem;
  white-space: nowrap;
  transform: rotate(-1deg);
}

.chip-open {
  color: var(--amber);
  background: var(--amber-soft);
}

.quiz-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.quiz-card {
  display: block;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.quiz-card.past {
  border-color: var(--line-strong);
}

.quiz-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.quiz-card-top h3 {
  margin: 0;
  font-size: 1.15rem;
}

.deadline-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.deadline-badge.urgent .deadline-when {
  color: var(--red);
  font-weight: 600;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red);
  border-radius: 4px;
  padding: 0.08rem 0.45rem;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.7rem;
}

.progress-track {
  flex: 1;
  height: 0.55rem;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
}

.progress-label,
.save-ind {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.score-pill {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  background: var(--green-soft);
  border: 1.5px solid var(--green);
  border-radius: 8px;
  padding: 0.1rem 0.55rem;
}

.score-sep {
  color: var(--green);
}

.review-hint {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Hero */

.hero {
  padding: 3.5rem 0 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 2.5rem;
  align-items: center;
}

.hero-preview {
  padding: 1.25rem;
  max-width: 480px;
  width: 100%;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  line-height: 1.1;
  margin: 0 0 1rem;
}

.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0 0 1.5rem;
}

.cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Question card */

.q-card {
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.25rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.q-card.q-right {
  border-color: var(--green);
}

.q-card.q-wrong {
  border-color: var(--red);
}

.q-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.q-folio {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--paper-deep);
  -webkit-text-stroke: 1.2px var(--ink);
  letter-spacing: -0.04em;
}

.q-of {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-right: auto;
}

.q-verdict {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  transform: rotate(1.5deg);
}

.q-verdict.right {
  color: var(--green);
  background: var(--green-soft);
}

.q-verdict.wrong {
  color: var(--red);
  background: var(--red-soft);
}

.q-body {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 0.25rem 0 0.9rem;
}

.opt-list {
  display: grid;
  gap: 0.55rem;
}

.opt {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.975rem;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  min-height: 3rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.opt:hover:not(:disabled) {
  border-color: var(--ink);
  transform: translateX(4px);
}

.opt:active:not(:disabled) {
  transform: scale(0.99);
}

.opt:disabled {
  cursor: default;
}

.opt.selected {
  border-color: var(--ink);
  border-width: 2px;
  background: var(--paper);
}

.opt.correct {
  border-color: var(--green);
  border-width: 2px;
  background: var(--green-soft);
}

.opt.wrong {
  border-color: var(--red);
  border-width: 2px;
  background: var(--red-soft);
}

.opt-letter {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.opt.correct .opt-letter {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.opt.wrong .opt-letter {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.opt.selected:not(.correct):not(.wrong) .opt-letter {
  background: var(--ink);
  color: var(--paper);
}

.opt-text {
  flex: 1;
  min-width: 0;
}

.opt-tick {
  color: var(--green);
  font-weight: 700;
}

.opt.selected:not(.correct):not(.wrong) .opt-tick {
  color: var(--ink);
}

.opt-mark {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.opt-mark.right {
  color: var(--green);
}

.opt-mark.wrong {
  color: var(--red);
}

.q-explanation {
  margin-top: 1rem;
  border-top: 1.5px dashed var(--line-strong);
  padding-top: 0.9rem;
}

.q-explanation h3 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.q-explanation p {
  margin: 0;
}

.q-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.locked-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0.75rem 0 0;
}

/* Demo + benefits */

.split {
  padding: 2.5rem 0 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 2.5rem;
  align-items: start;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.55rem;
}

.check-list li {
  display: flex;
  gap: 0.5rem;
  color: var(--ink-soft);
}

.check-list li span:first-child {
  color: var(--green);
  font-weight: 700;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.step-num {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 1rem;
}

.step-num.one {
  background: var(--paper-deep);
}

.step-num.two {
  background: var(--amber-soft);
  color: var(--amber);
}

.step-num.three {
  background: var(--green-soft);
  color: var(--green);
}

.muted {
  color: var(--ink-soft);
}

/* Leaderboard preview — the real student board. Every rule below is ported
 * verbatim from the app (frontend/src/index.css `.bar-*`, rendered by
 * BarList.tsx) so the marketing page and the product cannot drift apart. */

.board-preview {
  max-width: 32rem;
  margin: 0 auto 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.board-preview .section-label {
  margin-top: 0;
}

.bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 3fr auto;
  align-items: center;
  gap: 0.6rem;
}

.bar-label {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  display: block;
  height: 1rem;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--ink-soft);
}

.bar-caption {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-align: right;
}

/* The viewer's own row — the one row that is ever identified. */
.bar-you .bar-fill {
  background: var(--green);
}

.bar-you .bar-label {
  font-weight: 700;
}

/* CTA / contact */

.cta-band {
  background: var(--ink);
  border-radius: 28px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--paper);
  margin: 0 0 3rem;
}

.cta-band h2 {
  color: var(--paper);
  font-size: 1.9rem;
}

.cta-band p {
  color: color-mix(in srgb, var(--paper) 80%, transparent);
  max-width: 32rem;
  margin: 0 auto 1.5rem;
}

.cta-band .cta-row {
  justify-content: center;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 2rem;
  align-items: start;
  padding-bottom: 3rem;
}

.field {
  margin: 0.75rem 0;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}

.input,
textarea.input {
  font: inherit;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

textarea.input {
  resize: vertical;
  min-height: 7rem;
}

.input:focus,
textarea.input:focus {
  border-color: var(--ink);
  outline: none;
}

.form-status {
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.form-status.ok {
  color: var(--green);
}

.form-status.note {
  color: var(--ink-soft);
}

.form-status.err {
  color: var(--red);
}

.site-footer {
  padding: 0 0 3rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.results-hero {
  text-align: center;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1rem 1.75rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.score-points {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.04em;
  line-height: 1;
}

.score-of {
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--ink-soft);
}

@media (hover: hover) and (pointer: fine) {
  .brand:hover {
    transform: translateY(-1px);
  }

  .card:not(form):hover,
  .quiz-card:hover,
  .q-card:hover,
  .results-hero:hover {
    transform: translate(-3px, -3px);
    box-shadow: 7px 7px 0 rgba(28, 36, 51, 0.12);
  }

  .btn-primary:hover {
    background: #000;
  }
}

@media (max-width: 56rem) {
  .hero,
  .split,
  .contact-grid,
  .benefit-grid,
  .how-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 2rem 0 1.75rem;
    gap: 1.5rem;
  }

  .hero-preview {
    max-width: none;
  }

  .cta-row .btn {
    flex: 1 1 12rem;
  }
}

@media (max-width: 40rem) {
  .wrap {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .app-header {
    gap: 0.5rem;
    padding: 0.55rem max(1rem, env(safe-area-inset-right)) 0.55rem max(1rem, env(safe-area-inset-left));
    padding-top: max(0.55rem, env(safe-area-inset-top));
  }

  .brand {
    font-size: 1.15rem;
  }

  .header-actions {
    gap: 0.65rem;
  }

  .header-actions .link-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.15rem;
  }

  .header-actions .btn {
    padding: 0.45rem 0.85rem;
    min-height: 44px;
    font-size: 0.875rem;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .lede {
    font-size: 1rem;
  }

  .cta-row {
    flex-direction: column;
  }

  .cta-row .btn,
  .cta-band .cta-row .btn,
  .q-actions .btn {
    width: 100%;
    flex: none;
  }

  .btn,
  .input,
  .opt,
  textarea.input {
    min-height: 44px;
  }

  .card,
  .q-card {
    padding: 1rem 0.9rem;
  }

  .quiz-card-top {
    flex-wrap: wrap;
  }

  .board-preview {
    padding: 1.1rem 0.9rem;
    max-width: 100%;
  }

  .bar-row {
    grid-template-columns: minmax(44px, auto) 3fr auto;
    gap: 0.45rem;
  }

  .bar-caption {
    font-size: 0.75rem;
  }

  .cta-band {
    padding: 1.75rem 1.1rem;
    border-radius: 20px;
  }

  .cta-band h2 {
    font-size: 1.45rem;
  }

  .score-points {
    font-size: 3.2rem;
  }

  .site-footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
