/* --- self-hosted webfonts ------------------------------------------------
   Served from this domain rather than Google's CDN, so no visitor IP address
   is sent to a third party just to render text. font-display:swap means text
   is readable immediately using the fallback while the file loads.
   Paths are relative to this stylesheet (css/style.css -> css/fonts/).
-------------------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-v20-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-v20-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-v20-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/inter-v20-latin-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/space-grotesk-v22-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/space-grotesk-v22-latin-700.woff2') format('woff2');
}

/* =========================================================================
   Mind the Stack — design tokens
   Concept: the wordplay is "mind the gap" (transit signage) + "tech stack"
   (layers). The visual language borrows from wayfinding signage — flat
   colour bands, confident sans display type, hairline rules — and turns
   the literal idea of a "stack" into a recurring layered-block motif used
   in the hero and the quiz progress tower.
   ========================================================================= */

:root {
  /* colour */
  --ink: #151c2c;
  --ink-soft: #4a5468;
  --paper: #f4f1e9;
  --paper-raised: #fbfaf6;
  --amber: #f0a93d;
  --amber-ink: #6b4a10;
  --teal: #1e6e6b;
  --teal-deep: #14504e;
  --green: #3f8f5c;
  --red: #c1443c;
  --rule: #d8d2c2;
  --rule-on-ink: rgba(244, 241, 233, 0.18);

  /* type */
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* layout */
  --content-width: 1080px;
  --content-narrow: 680px;
  --radius: 3px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

a { color: var(--teal-deep); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { color: var(--teal); }

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: 0 24px;
}

/* Focus visibility, kept everywhere on purpose */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* =========================================================================
   Nav + footer bands
   ========================================================================= */

.site-header {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 4px solid var(--amber);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 24px;
  flex-wrap: wrap;
}

.site-nav .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--paper);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.site-nav .logo .dot { color: var(--amber); }

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--paper);
  opacity: 0.85;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a:hover, .site-nav a.active { opacity: 1; color: var(--amber); }

.site-footer {
  background: var(--ink);
  color: var(--paper);
  margin-top: 64px;
  padding: 40px 0 28px;
  border-top: 4px solid var(--teal);
}
.site-footer .container { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer p { color: rgba(244,241,233,0.7); margin: 0; font-size: 0.9rem; }
.site-footer a { color: var(--paper); }

/* =========================================================================
   Hero — the "stack of layers" signature moment
   ========================================================================= */

.hero {
  background: var(--ink);
  color: var(--paper);
  padding: 64px 0 76px;
}

.hero .container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero h1 { color: var(--paper); }
.hero .lede { color: rgba(244,241,233,0.82); font-size: 1.15rem; max-width: 46ch; }

.hero-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

/* the literal stack graphic */
.stack-graphic { display: flex; flex-direction: column-reverse; gap: 8px; }
.stack-graphic .layer {
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0;
  transform: translateY(16px);
  animation: layer-rise 0.55s ease forwards;
}
.stack-graphic .layer:nth-child(1) { background: var(--teal); color: var(--paper); animation-delay: 0.05s; }
.stack-graphic .layer:nth-child(2) { background: var(--amber); animation-delay: 0.2s; width: 88%; }
.stack-graphic .layer:nth-child(3) { background: var(--paper-raised); animation-delay: 0.35s; width: 96%; }
.stack-graphic .layer:nth-child(4) { background: var(--paper); animation-delay: 0.5s; width: 76%; }

@keyframes layer-rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .stack-graphic .layer { opacity: 1; transform: none; animation: none; }
}

@media (max-width: 780px) {
  .hero .container { grid-template-columns: 1fr; }
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  line-height: 1;
}

.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: #ffbb52; color: var(--ink); }

.btn-outline { background: transparent; border-color: currentColor; color: var(--paper); }
.btn-outline:hover { background: rgba(244,241,233,0.1); color: var(--paper); }

.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: #232c40; color: var(--paper); }

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

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* =========================================================================
   Sections & index-card style panels (deliberately not the rounded
   soft-shadow SaaS card kit — flat colour, solid border, small tab)
   ========================================================================= */

.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }
.section-alt { background: var(--paper-raised); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head p { color: var(--ink-soft); margin: 6px 0 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

.card {
  background: var(--paper-raised);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  top: -1.5px; left: 18px;
  width: 30px; height: 6px;
  background: var(--amber);
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-soft); margin-bottom: 0; }
.card a.card-link { position: absolute; inset: 0; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 2px;
  background: var(--teal);
  color: #fff;
  margin-bottom: 10px;
}
.tag.difficulty-easy { background: var(--green); }
.tag.difficulty-medium { background: var(--amber); color: var(--ink); }
.tag.difficulty-hard { background: var(--red); }

/* =========================================================================
   Quiz
   ========================================================================= */

.quiz-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 780px) {
  .quiz-layout { grid-template-columns: 1fr; }
}

.tower {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  position: sticky;
  top: 24px;
}
.tower .block {
  height: 30px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--paper-raised);
  color: var(--ink-soft);
}
.tower .block.done { background: var(--teal); color: #fff; border-color: var(--teal-deep); }
.tower .block.current { background: var(--amber); color: var(--ink); border-color: var(--ink); }
.tower-label { font-size: 0.8rem; color: var(--ink-soft); margin-top: 10px; text-align: center; }

.quiz-card {
  background: var(--paper-raised);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 32px;
}

.quiz-meta { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.quiz-meta .score { margin-left: auto; font-family: var(--font-display); font-weight: 700; }

.quiz-question { font-size: 1.3rem; margin-bottom: 24px; }

.quiz-options { display: grid; gap: 12px; }
.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  cursor: pointer;
}
.quiz-option:hover { background: #ece7d8; }
.quiz-option .letter { font-family: var(--font-display); font-weight: 700; color: var(--teal-deep); margin-right: 10px; }

.quiz-feedback {
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
  border: 1.5px solid var(--ink);
}
.quiz-feedback.correct { background: #e4f2e8; border-color: var(--green); }
.quiz-feedback.incorrect { background: #f7e6e4; border-color: var(--red); }
.quiz-feedback .verdict { font-family: var(--font-display); font-weight: 700; margin-bottom: 6px; display: block; }
.quiz-feedback.correct .verdict { color: var(--green); }
.quiz-feedback.incorrect .verdict { color: var(--red); }
.quiz-feedback .source { color: var(--ink-soft); font-size: 0.85rem; margin-top: 10px; }

.round-summary { text-align: center; }
.round-summary .big-score { font-family: var(--font-display); font-size: 3rem; font-weight: 700; color: var(--teal-deep); }

/* =========================================================================
   Leaderboard
   ========================================================================= */

.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}
.leaderboard-table th { font-family: var(--font-display); font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
.leaderboard-table tr:first-child td { font-weight: 700; }
.leaderboard-table .rank { font-family: var(--font-display); color: var(--teal-deep); width: 48px; }

/* =========================================================================
   Forms (public + admin)
   ========================================================================= */

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.field .hint { color: var(--ink-soft); font-size: 0.82rem; margin-top: 4px; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="date"],
textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--paper-raised);
  color: var(--ink);
}
textarea { min-height: 140px; resize: vertical; font-family: var(--font-body); }

.form-error {
  background: #f7e6e4;
  border: 1.5px solid var(--red);
  color: #7a2b26;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.form-success {
  background: #e4f2e8;
  border: 1.5px solid var(--green);
  color: #235b3a;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 0.92rem;
}

/* honeypot field — visually hidden, still in the tab order for bots that
   don't render CSS, invisible and unreachable for real users */
.hp-field { position: absolute; left: -9999px; top: -9999px; }

/* =========================================================================
   Articles
   ========================================================================= */

.article-body { max-width: var(--content-narrow); font-size: 1.05rem; }
.article-body h2 { margin-top: 1.6em; }
.article-body p { margin-bottom: 1.2em; }
.article-meta { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 28px; }

/* =========================================================================
   Admin
   ========================================================================= */

.admin-shell { min-height: 100vh; display: flex; }
.admin-sidebar { width: 220px; background: var(--ink); color: var(--paper); padding: 24px 18px; flex-shrink: 0; }
.admin-sidebar .logo { font-family: var(--font-display); font-weight: 700; margin-bottom: 28px; display: block; color: var(--paper); text-decoration: none; }
.admin-sidebar nav a { display: block; color: rgba(244,241,233,0.8); text-decoration: none; padding: 9px 10px; border-radius: var(--radius); font-size: 0.92rem; margin-bottom: 2px; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(244,241,233,0.1); color: var(--paper); }
.admin-main { flex: 1; padding: 32px 40px; max-width: 980px; }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); font-size: 0.92rem; vertical-align: top; }
.admin-table th { color: var(--ink-soft); font-family: var(--font-display); font-weight: 600; }
.admin-table .actions { display: flex; gap: 8px; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.login-box { background: var(--paper-raised); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 36px; width: 100%; max-width: 380px; }

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; align-items: center; gap: 16px; }
  .admin-sidebar nav { display: flex; gap: 4px; }
  .admin-main { padding: 24px; }
}

/* --- bank-or-risk decision + bust screens ------------------------------- */
.round-summary.decision .banked-line {
  font-size: 1.05rem;
  color: var(--ink);
  margin: 4px 0 20px;
}
.decision-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.decision-actions form { margin: 0; }
.risk-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  max-width: 42ch;
  margin: 0 auto;
  line-height: 1.5;
}
.tag.tag-danger { background: var(--red); color: #fff; }
.round-summary.busted { border-color: var(--red); }
.round-summary .big-score.zero { color: var(--red); }
.round-summary .lost-line {
  color: var(--ink-soft);
  margin: 4px 0 0;
  text-decoration: line-through;
}
.round-summary .regret {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.at-risk-line {
  font-size: 0.85rem;
  color: var(--amber-ink);
  background: rgba(240, 169, 61, 0.14);
  border-left: 3px solid var(--amber);
  padding: 7px 11px;
  margin: 0 0 16px;
  border-radius: 2px;
}
@media (max-width: 520px) {
  .decision-actions { flex-direction: column; }
  .decision-actions .btn { width: 100%; }
}

/* --- leaderboard listing with player taglines --------------------------- */
.board { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.board-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--paper-raised);
  margin-bottom: 8px;
}
.board-row.top { border-color: var(--teal-deep); box-shadow: 3px 3px 0 var(--teal-deep); }
.board-rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-soft);
  min-width: 2ch;
  text-align: right;
  padding-top: 1px;
}
.board-row.top .board-rank { color: var(--teal-deep); }
.board-body { flex: 1; min-width: 0; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.board-name { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.board-score { font-family: var(--font-display); font-weight: 700; color: var(--teal-deep); }
.board-tagline {
  margin: 5px 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.board-meta { margin: 5px 0 0; font-size: 0.78rem; color: var(--ink-soft); }
.board-more { margin-top: 18px; }
.board-section { border-top: 1px solid var(--rule); }

.unlocked-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--green);
  color: #fff;
  padding: 2px 6px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
}
.locked-hint {
  border-left: 3px solid var(--rule);
  padding-left: 10px;
  margin: 12px 0;
}

/* admin moderation bits */
.admin-lede { color: var(--ink-soft); max-width: 62ch; }
.tagline-hidden { opacity: 0.45; text-decoration: line-through; }
.admin-table .muted { color: var(--ink-soft); }
.row-actions { white-space: nowrap; }
.row-actions .inline { display: inline; margin: 0 6px 0 0; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--teal-deep);
  cursor: pointer;
  text-decoration: underline;
}
.link-btn.danger { color: var(--red); }

/* --- footer links + legal pages ----------------------------------------- */
.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 0;
  margin: 0;
}
.article-body h3 {
  margin-top: 1.4em;
  margin-bottom: 0.4em;
  font-size: 1.02rem;
}
.article-body ul { margin: 0 0 1.2em; padding-left: 1.3em; }
.article-body li { margin-bottom: 0.4em; }
.article-body code {
  background: rgba(21, 28, 44, 0.07);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.9em;
}
.contact-email {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.6em;
}
@media (max-width: 520px) {
  .footer-links { flex-direction: column; gap: 8px; }
}

/* --- claim code ---------------------------------------------------------- */
.field .opt { color: var(--ink-soft); font-weight: 400; font-size: 0.85em; }
.claim-code-box {
  border: 2px dashed var(--ink);
  border-radius: 3px;
  padding: 16px 18px;
  margin: 18px auto 20px;
  max-width: 340px;
  background: var(--paper-raised);
}
.claim-code-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
.claim-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0 0 10px;
  user-select: all;
}
.claim-code-note {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.45;
  margin: 0;
}
