/* Due Diligence — design system */
:root {
  --paper: #f5efe3;
  --paper-2: #ebe2d0;
  --card: #fffaf0;
  --ink: #161a24;
  --ink-2: #3b4152;
  --muted: #6a6f7d;
  --line: #d9cdb5;
  --red: #c8102e;
  --red-soft: #f6d4d8;
  --green: #1d7a52;
  --green-soft: #d2eddf;
  --gold: #b7791f;
  --gold-soft: #f8e6bf;
  --manila: #e9cf8f;
  --manila-2: #dcbb6c;
  --focus: #2457d6;
  --shadow: 0 1px 0 rgba(22, 26, 36, .06), 0 8px 24px -10px rgba(22, 26, 36, .28);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #10131b;
  --paper-2: #171b26;
  --card: #1c2130;
  --ink: #f1ece2;
  --ink-2: #cdc7bb;
  --muted: #9aa0ad;
  --line: #2f3546;
  --red: #ff5a6e;
  --red-soft: #3a1820;
  --green: #4fd39a;
  --green-soft: #143024;
  --gold: #f2b84b;
  --gold-soft: #3a2e14;
  --manila: #6b5a2f;
  --manila-2: #8a7339;
  --focus: #8fb0ff;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(120, 100, 60, .09) 1px, transparent 0);
  background-size: 22px 22px;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--red); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.1; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 7vw, 4.2rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 4.4vw, 2.3rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .92rem; padding: 7px 10px; border-radius: 8px; }
.nav-links a:hover, .nav-links a[aria-current="page"] { background: var(--paper-2); color: var(--ink); }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--ink); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; font-size: 1.05rem; flex: none; }
.icon-btn:hover { background: var(--paper-2); }
.menu-btn { display: none; }
@media (max-width: 820px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 12px 14px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 1rem; }
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.site-footer { border-top: 1px solid var(--line); padding: 28px 16px 40px; text-align: center; color: var(--muted); font-size: .9rem; }
.site-footer a { color: var(--ink-2); }

/* Buttons */
.btn {
  appearance: none; border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  font: 700 1rem/1.1 var(--sans); padding: 13px 20px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  min-height: 46px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
[data-theme="dark"] .btn.red, [data-theme="dark"] .btn.green { color: #10131b; }
.btn.small { padding: 8px 12px; font-size: .9rem; min-height: 38px; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Hero */
.hero { display: grid; gap: 24px; padding: 18px 0 8px; align-items: center; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.15fr .85fr; padding-top: 36px; } }
.kicker { font-family: var(--mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--red); font-weight: 600; margin-bottom: 10px; display: inline-block; }
.hero h1 em { font-style: italic; color: var(--red); }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 36em; }
.hero-card { position: relative; min-height: 290px; }
.stamp {
  display: inline-block; font-family: var(--mono); font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  border: 3px solid currentColor; padding: 4px 10px; border-radius: 6px; transform: rotate(-8deg); font-size: .95rem;
}
.stamp.red { color: var(--red); }
.stamp.green { color: var(--green); }
.stamp.gold { color: var(--gold); }

/* Folder / dossier */
.folder {
  position: relative; background: var(--manila); border-radius: 4px 14px 14px 14px; padding: 18px; box-shadow: var(--shadow);
  margin-top: 22px;
}
.folder::before {
  content: attr(data-tab); position: absolute; top: -24px; left: 0; height: 26px; padding: 3px 16px 0; background: var(--manila);
  border-radius: 10px 10px 0 0; font: 700 .72rem/1.9 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(22, 26, 36, .75);
}
[data-theme="dark"] .folder::before { color: rgba(255, 255, 255, .78); }
.sheet { background: var(--card); border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); position: relative; }
.sheet .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font: 600 .74rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; border-radius: 6px; background: var(--paper-2); color: var(--ink-2); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.gold { background: var(--gold-soft); color: var(--gold); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }

/* Mode picker */
.modes { display: grid; gap: 12px; margin: 18px 0; }
@media (min-width: 700px) { .modes { grid-template-columns: repeat(3, 1fr); } }
.mode {
  text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer;
  font: inherit; color: inherit; transition: border-color .15s, transform .15s;
}
.mode:hover { transform: translateY(-2px); border-color: var(--ink-2); }
.mode[aria-pressed="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.mode strong { display: block; font-family: var(--serif); font-size: 1.2rem; margin-bottom: 4px; }
.mode span { color: var(--muted); font-size: .92rem; }

/* Game HUD */
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; }
.hud div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hud b { display: block; font-family: var(--mono); font-size: 1.15rem; }
.hud small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.progress { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; background: var(--red); width: 0; transition: width .4s ease; }

.pitch-quote { font-family: var(--serif); font-size: clamp(1.15rem, 3.6vw, 1.45rem); line-height: 1.4; margin: 0 0 12px; }
.pitch-quote::before { content: "“"; color: var(--red); font-size: 1.6em; line-height: 0; vertical-align: -.35em; margin-right: 2px; }
.ask { font-family: var(--mono); font-size: .88rem; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }

.dd { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 700px) { .dd { grid-template-columns: repeat(3, 1fr); } }
.dd-item {
  border: 2px dashed var(--line); border-radius: 12px; background: var(--card); padding: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  min-height: 84px; position: relative; transition: border-color .15s, background .15s;
}
.dd-item:hover:not([disabled]) { border-color: var(--ink-2); }
.dd-item[disabled] { cursor: default; }
.dd-item .dd-label { font: 700 .74rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.dd-item .dd-body { margin-top: 6px; font-size: .95rem; }
.dd-item.open { border-style: solid; border-color: var(--gold); background: var(--gold-soft); cursor: default; }
.dd-item.locked .dd-body { filter: blur(5px); user-select: none; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .dd-item.open { animation: pop .3s ease; } }

.decide { margin-top: 18px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .decide { grid-template-columns: repeat(4, 1fr); } }
.decide .btn { width: 100%; }

/* Reveal */
.reveal-list { display: grid; gap: 12px; }
.reveal-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-left: 6px solid var(--line); border-radius: 12px; padding: 14px;
}
.reveal-row.win { border-left-color: var(--green); }
.reveal-row.loss { border-left-color: var(--red); }
.reveal-row.meh { border-left-color: var(--gold); }
.reveal-row h3 { margin: 0; font-size: 1.15rem; }
.reveal-row .val { font-family: var(--mono); font-weight: 700; text-align: right; }
.reveal-row p { grid-column: 1 / -1; margin: 4px 0 0; font-size: .93rem; color: var(--ink-2); }
.reveal-row .why { grid-column: 1 / -1; font-size: .85rem; }
@media (prefers-reduced-motion: no-preference) { .reveal-row { animation: slideIn .45s ease both; } }

.big-number { font-family: var(--mono); font-weight: 700; font-size: clamp(2.4rem, 10vw, 4.4rem); line-height: 1; letter-spacing: -.03em; }
.result-hero { text-align: center; padding: 26px 18px; }
.archetype { font-family: var(--serif); font-size: clamp(1.6rem, 6vw, 2.6rem); font-weight: 800; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 18px 0; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats div { background: var(--paper-2); border-radius: 10px; padding: 10px; text-align: center; }
.stats b { display: block; font-family: var(--mono); font-size: 1.25rem; }
.stats small { color: var(--muted); font-size: .75rem; }

canvas.share-card { width: 100%; max-width: 540px; height: auto; border-radius: 12px; box-shadow: var(--shadow); display: block; margin: 0 auto; }

.banner { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 12px; padding: 14px 16px; margin: 12px 0 20px; }
.banner strong { font-family: var(--serif); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Lightning */
.lightning-stage { text-align: center; }
.timer-bar { height: 10px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin: 10px 0 18px; }
.timer-bar i { display: block; height: 100%; background: var(--gold); width: 100%; }
.flash-card { min-height: 190px; display: grid; place-items: center; font-family: var(--serif); font-size: clamp(1.25rem, 4.5vw, 1.8rem); line-height: 1.3; padding: 26px; }
.flash-card.good { box-shadow: 0 0 0 4px var(--green); }
.flash-card.bad { box-shadow: 0 0 0 4px var(--red); }
@media (prefers-reduced-motion: no-preference) { .flash-card.bad { animation: shake .3s ease; } }
.bb-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.bb-buttons .btn { font-size: 1.15rem; padding: 18px; }
.feedback-line { min-height: 3.2em; margin-top: 12px; font-size: .95rem; color: var(--ink-2); }

/* Timeline */
.timeline { position: relative; margin: 20px 0; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 3px; background: linear-gradient(var(--green), var(--gold) 50%, var(--red)); border-radius: 3px; }
.tl-item { position: relative; margin-bottom: 12px; }
.tl-item::before { content: ""; position: absolute; left: -24px; top: 18px; width: 13px; height: 13px; border-radius: 50%; background: var(--card); border: 3px solid var(--ink-2); }
.tl-item.hype::before { border-color: var(--green); }
.tl-item.crack::before { border-color: var(--gold); }
.tl-item.fall::before { border-color: var(--red); }
.tl-item button { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; color: inherit; cursor: pointer; }
.tl-item button:hover { border-color: var(--ink-2); }
.tl-date { font-family: var(--mono); font-size: .8rem; color: var(--red); font-weight: 700; letter-spacing: .05em; }
.tl-title { font-weight: 700; display: block; }
.tl-detail { padding: 10px 14px 4px; color: var(--ink-2); font-size: .95rem; }
.meter { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.meter-track { flex: 1; min-width: 160px; height: 14px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.meter-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold), var(--red)); transition: width .5s; }

/* Quiz */
.quiz-card { padding: 22px; }
.quiz-statement { font-family: var(--serif); font-size: clamp(1.15rem, 3.8vw, 1.4rem); line-height: 1.4; }
.quiz-answer { margin-top: 14px; padding: 12px 14px; border-radius: 10px; }
.quiz-answer.right { background: var(--green-soft); }
.quiz-answer.wrong { background: var(--red-soft); }

/* Red flags */
.flag-card { display: flex; flex-direction: column; gap: 6px; }
.flag-card .flag-icon { font-size: 1.7rem; line-height: 1; }
.flag-card h3 { margin: 0; }
.flag-card .eg { font-size: .88rem; color: var(--muted); }
textarea, input[type="text"], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px;
}
textarea { min-height: 140px; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--ink-2); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.scan-out mark { background: var(--red-soft); color: var(--red); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.generated { font-family: var(--serif); font-size: clamp(1.2rem, 4vw, 1.6rem); line-height: 1.35; }
.generated .company { font-family: var(--mono); font-size: .95rem; color: var(--red); display: block; margin-bottom: 8px; letter-spacing: .06em; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Ledger */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 8px 14px; font: 600 .9rem var(--sans); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ledger-item h3 { margin-bottom: 4px; }
.ledger-item .years { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.ledger-item.hidden-spoiler .spoil { filter: blur(6px); user-select: none; }
.ledger-item details summary { cursor: pointer; font-weight: 600; color: var(--red); margin-top: 6px; }

.section { margin: 44px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.prose p, .prose li { color: var(--ink-2); }
.prose h2 { margin-top: 1.4em; }
.sources li { word-break: break-word; margin-bottom: 6px; }
.notice { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; }
hr.rule { border: 0; border-top: 1px dashed var(--line); margin: 28px 0; }

@keyframes pop { from { transform: scale(.96); } to { transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes stampIn { from { opacity: 0; transform: rotate(-8deg) scale(2.2); } to { opacity: 1; transform: rotate(-8deg) scale(1); } }
@media (prefers-reduced-motion: no-preference) { .stamp.animate { animation: stampIn .35s cubic-bezier(.2, 1.4, .5, 1) both; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.hidden { display: none !important; }
