/* ============================================================
   Strategy Games Playground — "The Strategy Board"
   A graph-paper field manual. Strategy's native artifact is the
   grid (2x2 matrices, payoff tables), so the whole system is built
   on a drafting-paper field with coordinate markers and print
   spot-colours that encode each game's type.

   Palette : cool drafting paper + blue-black ink + 3 print spots
   Type    : Archivo (display) / Newsreader (prose) / Plex Mono (data)
   Used by the hub and every game. No build step.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap');

:root {
  /* paper + ink */
  --paper:    #ecefe8;   /* cool drafting paper (not cream) */
  --paper-2:  #f6f7f2;   /* raised surface — cards / panels */
  --paper-3:  #fbfcf9;   /* insets */
  --ink:      #15191e;   /* blue-black — text + strong elements */
  --ink-soft: #3c434b;   /* secondary text */
  --muted:    #6c7178;   /* captions / data labels */
  --rule:     #c8cdc2;   /* hairline rules */
  --rule-2:   #d8dcd2;   /* lighter rule */
  --grid:        rgba(21, 25, 30, 0.045);  /* fine graph lines */
  --grid-major:  rgba(21, 25, 30, 0.075);  /* every 5th line */

  /* print spot colours — one per game type */
  --framework:  #0e6b57;  /* viridian  */
  --simulation: #c8431f;  /* vermilion */
  --quiz:       #2d4bc4;  /* cobalt    */

  /* analytic readouts */
  --good: #0e6b57;
  --warn: #9a6a10;
  --bad:  #b23a2e;

  --radius: 3px;
  --maxw:   1080px;
  --gutter: 72px;        /* coordinate gutter width on the board */

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --prose:   'Newsreader', Georgia, 'Times New Roman', serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--prose);
  font-size: 17px;
  line-height: 1.6;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* shared type roles ----------------------------------------- */
.eyebrow, .mono {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
.display { font-family: var(--display); }
.muted { color: var(--muted); }
.note  { font-family: var(--mono); font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }
.center { text-align: center; }
.kbd {
  font-family: var(--mono); font-size: 13px; background: var(--ink); color: var(--paper);
  border-radius: 2px; padding: 1px 6px;
}
hr.sep { border: 0; border-top: 1px solid var(--rule); margin: 22px 0; }

h1, h2, h3 { font-family: var(--display); color: var(--ink); line-height: 1.08; }

/* ====================== HERO (hub) ========================== */
.hero { padding: 64px 0 26px; }
.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.hero__eyebrow { display: block; margin-bottom: 20px; }
.hero h1 {
  font-weight: 900;
  font-size: clamp(42px, 7vw, 84px);
  letter-spacing: -0.035em;
  margin: 0 0 18px;
  text-transform: uppercase;
}
.hero h1 .rule-word {
  /* highlighter-style underline that clones cleanly across wraps */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(transparent 74%, var(--simulation) 74%, var(--simulation) 90%, transparent 90%);
}
.hero__thesis {
  font-size: clamp(18px, 2.1vw, 22px);
  color: var(--ink-soft);
  max-width: 32ch;
  margin: 0 0 22px;
}
.hero__meta { margin: 0; }

/* signature: a 2x2 payoff matrix that argues the playground ---- */
.payoff {
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: 1fr 22px;
  gap: 10px;
}
.payoff__ylab {
  grid-column: 1; grid-row: 1;
  writing-mode: vertical-rl; transform: rotate(180deg);
  text-align: center; align-self: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.payoff__xlab {
  grid-column: 2; grid-row: 2; text-align: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.payoff__cells {
  grid-column: 2; grid-row: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0;
  border: 1.5px solid var(--ink);
  background: var(--ink);                 /* shows as the inner gridlines */
  aspect-ratio: 1 / 0.82;
}
.cell {
  background: var(--paper-2);
  padding: 16px 16px 14px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 92px;
}
.cell .cell__k { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.cell .cell__v { font-family: var(--display); font-weight: 700; font-size: 18px; }
.cell--win { background: var(--simulation); color: var(--paper); }
.cell--win .cell__k { color: rgba(255,255,255,0.8); }
.cell--win .cell__v { color: var(--paper); }
.cell--win .here {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
}
.cell--win .here::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--paper); }

/* ====================== THE BOARD (sessions) ================ */
#hub {
  padding: 22px 0 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 16px;
  align-items: stretch;
}
.board-rule {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 2px solid var(--ink); padding-top: 12px; margin-top: 8px;
}
.board-rule h2 { font-size: 13px; font-family: var(--mono); font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; margin: 0; }
.board-rule .note { margin: 0; }

/* each game is a card in the board grid; the session coordinate rides on the card */
.card__coord {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.4;
  margin: 2px 0 8px;
}
.card__coord .s { color: var(--ink); font-weight: 600; letter-spacing: 0.06em; }

/* ====================== CARDS (plays) ======================= */
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  overflow: hidden;
}
.card::before {            /* type-coded top edge */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--type, var(--rule));
}
.card.framework  { --type: var(--framework); }
.card.simulation { --type: var(--simulation); }
.card.quiz       { --type: var(--quiz); }

.card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card__type {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--type, var(--muted));
}
.card__icon { font-size: 22px; line-height: 1; }
.card h3 { font-size: 19px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.card p { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; flex: 1; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.card.playable { transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.card.playable:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: 6px 6px 0 var(--rule-2);
}

.card.soon { background: transparent; border-style: dashed; }
.card.soon::before { background: var(--rule); }
.card.soon .card__icon { filter: grayscale(1); opacity: 0.55; }
.card.soon h3 { color: var(--ink-soft); }

.card p.card__stamp {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em;
  color: var(--good); margin: 0 0 10px; flex: initial;
}

/* ====================== BUTTONS ============================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--paper-2); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 2px;
  padding: 9px 14px; cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .08s ease;
  text-decoration: none;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-soft); }
.btn.ghost { background: transparent; border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.pill-soon {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px dashed var(--rule); border-radius: 2px; padding: 6px 10px;
}

/* ====================== GAME PAGE CHROME =================== */
.game-shell { padding-bottom: 64px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 20px 0 18px; margin-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}
.topbar .brand { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.topbar .crumbs { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.topbar .crumbs a { color: var(--ink); }

.panel {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  margin: 18px 0;
}
.panel > h2 { margin: 0 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -0.015em; }
.panel > h2:first-child + p { margin-top: 0; }

.row { display: flex; gap: 22px; flex-wrap: wrap; }
.col { flex: 1; min-width: 260px; }

/* ---------- mission strip (mounted by assets/js/howto.js) ----------
   The goal is always visible; steps + the strategy idea live in a
   collapsed "How to play" so the first decision is above the fold. */
.mission {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--type, var(--ink));
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 18px 0;
}
.mission__goal {
  margin: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.mission__label {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--type, var(--muted));
  margin-right: 10px; white-space: nowrap;
}
.mission__how { margin-top: 6px; }
.mission__how summary {
  cursor: pointer; display: inline-block;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.mission__how summary:hover { color: var(--ink); }
.mission__how[open] { padding-bottom: 6px; }
.mission__steps {
  list-style: none; counter-reset: step;
  margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px 22px;
}
.mission__steps li {
  counter-increment: step;
  position: relative; padding-left: 30px;
  font-size: 15px; line-height: 1.45; color: var(--ink-soft);
}
.mission__steps li::before {
  content: "0" counter(step);
  position: absolute; left: 0; top: 2px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  color: var(--type, var(--muted)); letter-spacing: 0.04em;
}
.mission__steps .kbd { font-size: 11.5px; padding: 0 5px; }
.mission__note { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); }
.mission__note strong { font-family: var(--display); font-size: 13.5px; color: var(--ink); }

/* ---------- debrief reflection block ---------- */
.reflect { border-top: 1px dashed var(--rule); margin-top: 18px; padding-top: 14px; }
.reflect h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.reflect ul { margin: 0; padding-left: 20px; }
.reflect li { color: var(--ink-soft); font-size: 15px; line-height: 1.55; margin: 6px 0; }

/* ---------- preset chips (e.g. Five Forces industries) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip {
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--rule); border-radius: 2px; background: var(--paper-3);
  color: var(--ink); padding: 6px 11px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.chip:hover { border-color: var(--ink); }
.chip.sel { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* ---------- sliders ---------- */
.slider-field { margin: 16px 0; }
.slider-field label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; margin-bottom: 8px; color: var(--ink);
}
.slider-field label .val { color: var(--simulation); font-weight: 600; }
input[type="range"] {
  width: 100%; appearance: none; -webkit-appearance: none;
  height: 4px; border-radius: 0; background: var(--rule); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 0; transform: rotate(45deg);
  background: var(--ink); cursor: pointer; border: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 0; background: var(--ink); cursor: pointer; border: 0;
}
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--simulation); outline-offset: 2px; }

/* ---------- score badge + gauge ---------- */
.score-badge {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 16px 24px; border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--paper-3); min-width: 132px;
}
.score-badge .num { font-family: var(--display); font-size: 44px; font-weight: 900; line-height: 1; letter-spacing: -0.02em; }
.score-badge .lbl { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.bar { height: 8px; border-radius: 0; background: var(--rule); overflow: hidden; border: 1px solid var(--rule-2); }
.bar > span { display: block; height: 100%; transition: width .25s ease; }

/* ---------- quiz ---------- */
.q-option {
  display: block; width: 100%; text-align: left; margin: 8px 0;
  font-family: var(--prose); font-size: 16px;
  padding: 13px 15px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--paper-3); color: var(--ink);
  cursor: pointer; transition: border-color .12s ease, background .12s ease;
}
.q-option:hover { border-color: var(--ink); }
.q-option.correct { border-color: var(--good); background: rgba(14,107,87,0.10); }
@keyframes tick-in {
  0%   { background: var(--paper-3); }
  55%  { background: rgba(14, 107, 87, 0.24); }
  100% { background: rgba(14, 107, 87, 0.10); }
}
.q-option.correct { animation: tick-in 0.4s ease; }
.q-option.wrong   { border-color: var(--bad);  background: rgba(178,58,46,0.10); }
.q-option:disabled { cursor: default; }
.feedback {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--paper-3); border: 1px solid var(--rule); border-left-width: 4px;
}
.feedback.good { border-left-color: var(--good); }
.feedback.bad  { border-left-color: var(--bad); }
.feedback.flat { border-left-color: var(--rule); }
.feedback__verdict { margin: 0; font-size: 15.5px; line-height: 1.5; }
.feedback__why { margin-top: 8px; }
.feedback__why summary {
  cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.feedback__why summary:hover { color: var(--ink); }
.feedback__why-body { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--ink-soft); }

/* ---------- delight: verdict stamp + hero reveal ---------- */
@keyframes stamp-in {
  0%   { transform: scale(1.5) rotate(-6deg); opacity: 0; }
  55%  { transform: scale(0.97) rotate(1.2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.stamp-in { animation: stamp-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.35) backwards; }

@keyframes cell-in { from { opacity: 0; transform: translateY(8px); } }
.payoff .cell { animation: cell-in 0.5s ease backwards; }
.payoff .cell:nth-child(1) { animation-delay: 0.05s; }
.payoff .cell:nth-child(2) { animation-delay: 0.30s; }  /* the win cell lands last */
.payoff .cell:nth-child(3) { animation-delay: 0.13s; }
.payoff .cell:nth-child(4) { animation-delay: 0.21s; }

/* ---------- challenge banner + share card (share.js) ---------- */
.challenge-banner {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--paper-3); border: 1px solid var(--ink);
  border-left: 4px solid var(--simulation);
  border-radius: var(--radius);
  padding: 10px 14px; margin: 14px 0 0;
}
.challenge-banner__icon { font-size: 18px; }
.challenge-banner__text { margin: 0; font-size: 15px; }
.challenge-banner__x {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--muted); padding: 2px 6px;
}
.challenge-banner__x:hover { color: var(--ink); }

.share-card {
  border: 1.5px dashed var(--ink); border-radius: var(--radius);
  background: var(--paper-3);
  padding: 14px 16px; margin-top: 14px;
}
.share-card__eyebrow {
  margin: 0 0 4px; font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.share-card__line { margin: 0 0 10px; font-size: 15.5px; }
.share-card__vs { margin: 0 0 10px; font-family: var(--mono); font-size: 13px; }
.share-card__vs.good { color: var(--good); }
.share-card__vs.bad { color: var(--bad); }
.share-card__acts { display: flex; flex-flow: row wrap; gap: 8px; align-items: center; }
.share-card__fallback {
  width: 100%; font-family: var(--mono); font-size: 12px;
  border: 1px solid var(--rule); border-radius: 2px; padding: 8px; background: var(--paper-2);
  flex-basis: 100%;
}

/* ---------- author byline (byline.js) ---------- */
.byline {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding: 14px 0 4px;
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted);
}
.byline a { color: var(--ink); }
.byline > * + *::before { content: "· "; color: var(--muted); }

/* ====================== FOOTER ============================= */
.site-footer {
  border-top: 2px solid var(--ink);
  margin-top: 56px; padding: 26px 0 60px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ====================== A11Y / MOTION ====================== */
:focus-visible { outline: 2px solid var(--simulation); outline-offset: 2px; }

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

/* ====================== RESPONSIVE ========================= */
@media (max-width: 820px) {
  .hero { padding-top: 40px; }
  .hero__inner { grid-template-columns: 1fr; gap: 34px; }
  .payoff { max-width: 420px; }
  .cell .cell__k { font-size: 9.5px; letter-spacing: 0.06em; }
  .board-rule .note { display: none; }
}
