/* =========================================================================
   Game Project Report Card · styles.css
   Editorial-audit aesthetic: serif display, mono data, hairline rules.
   Zero build. Theme via [data-theme] on <html>. All colors are tokens.
   ========================================================================= */

/* ---------- tokens ---------- */
:root, [data-theme="light"] {
  color-scheme: light;
  --page:        #f7f6f2;
  --surface:     #fdfcfa;
  --surface-2:   #f1efe9;
  --ink:         #12110e;
  --ink-2:       #52514e;
  --muted:       #898781;
  --hairline:    #e1e0d9;
  --baseline:    #c3c2b7;
  --accent:      #256abf;
  --accent-strong:#1c5cab;
  --accent-wash: #e7f0fb;
  --on-accent:   #ffffff;
  --good:        #006300;
  --bad:         #d03b3b;
  /* categorical (validated, fixed order) */
  --s1: #2a78d6;  /* blue   · craig7351 */
  --s2: #008300;  /* green  · OCF */
  --s3: #e87ba4;
  --s4: #eda100;
  --s5: #1baf7a;
  --s6: #eb6834;
  /* sequential blue ramp (heatmap) */
  --q100:#cde2fb; --q150:#b7d3f6; --q200:#9ec5f4; --q250:#86b6ef;
  --q300:#6da7ec; --q350:#5598e7; --q400:#3987e5; --q450:#2a78d6;
  --q500:#256abf; --q550:#1c5cab; --q600:#184f95; --q650:#104281; --q700:#0d366b;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(18,17,14,.05), 0 6px 24px -12px rgba(18,17,14,.12);
  --font-body: "Inter", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  --font-display: "Newsreader", "Noto Serif TC", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface:     #1a1a19;
  --surface-2:   #222220;
  --ink:         #f4f3ef;
  --ink-2:       #c3c2b7;
  --muted:       #898781;
  --hairline:    #2c2c2a;
  --baseline:    #383835;
  --accent:      #3987e5;
  --accent-strong:#6da7ec;
  --accent-wash: #16233a;
  --on-accent:   #ffffff;
  --good:        #0ca30c;
  --bad:         #e66767;
  --s1: #3987e5;
  --s2: #008300;
  --s3: #d55181;
  --s4: #c98500;
  --s5: #199e70;
  --s6: #d95926;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px -14px rgba(0,0,0,.6);
}

/* ---------- reset-ish ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.appbar__inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__logo { color: var(--accent); font-size: 26px; }
.brand__name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  letter-spacing: .01em;
}
.appbar__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--ink-2); padding: 6px 12px; cursor: pointer;
  font-size: .85rem; line-height: 1; transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-wash); text-decoration: none; }
.icon-btn .material-symbols-rounded { font-size: 19px; }
.icon-btn__txt { font-family: var(--font-mono); font-size: .8rem; font-weight: 500; }
.gh-star {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--ink-2); padding: 6px 12px; font-size: .85rem; line-height: 1;
}
.gh-star:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-wash); text-decoration: none; }
.gh-star .material-symbols-rounded { font-size: 18px; }
.gh-star__count { font-family: var(--font-mono); font-size: .8rem; }
@media (max-width: 560px) { .gh-star__label { display: none; } }

/* ---------- page nav ---------- */
.pagenav {
  position: sticky; top: 53px; z-index: 39;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.pagenav__inner {
  max-width: 1120px; margin: 0 auto; padding: 8px 16px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.pagenav__inner::-webkit-scrollbar { display: none; }
.navpill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 12px; border-radius: 999px; font-size: .82rem;
  color: var(--ink-2); border: 1px solid transparent;
}
.navpill .material-symbols-rounded { font-size: 17px; }
.navpill:hover { background: var(--surface-2); text-decoration: none; }
.navpill--active { background: var(--ink); color: var(--page); }
.navpill--active:hover { background: var(--ink); }

/* ---------- layout primitives ---------- */
#page { max-width: 1120px; margin: 0 auto; padding: 32px 20px 72px; min-height: 55vh; }
.section { margin: 56px 0; }
.overline {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent-strong);
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.overline::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.section > h2, .h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.7rem;
  line-height: 1.25; margin: 0 0 8px;
}
.section-sub { color: var(--ink-2); font-size: .95rem; max-width: 68ch; margin: 0 0 24px; }
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.mono { font-family: var(--font-mono); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.small { font-size: .85rem; color: var(--ink-2); }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-family: var(--font-mono);
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--hairline);
}

/* ---------- hero ---------- */
.hero { padding: 40px 0 8px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.1rem, 5.4vw, 3.4rem); line-height: 1.12;
  letter-spacing: -.01em; margin: 10px 0 14px; max-width: 22ch;
}
.hero h1 em { font-style: italic; color: var(--accent-strong); }
.hero p.lede { font-size: 1.06rem; color: var(--ink-2); max-width: 62ch; margin: 0 0 28px; }
.statband {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
}
.stat { padding: 18px 18px 16px; border-left: 1px solid var(--hairline); }
.stat:first-child { border-left: none; }
.stat b {
  display: block; font-family: var(--font-mono); font-weight: 600;
  font-size: 1.7rem; line-height: 1.1; color: var(--ink);
}
.stat span { font-size: .8rem; color: var(--muted); }
@media (max-width: 640px) {
  .statband { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(odd) { border-left: none; }
  .stat:nth-child(even) { border-left: 1px solid var(--hairline); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--hairline); }
}

/* ---------- chart shared ---------- */
.viz { padding: 22px; }
.viz h3 { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; }
.viz .viz-sub { font-size: .82rem; color: var(--muted); margin: 0 0 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 14px; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.axis-note { font-size: .75rem; color: var(--muted); margin-top: 10px; }

/* tooltip */
.tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--ink); color: var(--page);
  font-size: .78rem; line-height: 1.45; padding: 7px 11px; border-radius: 8px;
  max-width: 280px; opacity: 0; transform: translateY(4px);
  transition: opacity .12s, transform .12s; box-shadow: var(--shadow);
}
.tip.show { opacity: 1; transform: translateY(0); }
.tip b { font-family: var(--font-mono); }

/* ranking bars */
.rank-row { display: grid; grid-template-columns: minmax(130px, 200px) 1fr 52px; align-items: center; gap: 12px; padding: 7px 0; }
.rank-row a { color: var(--ink); font-size: .9rem; }
.rank-row .bar-track { height: 22px; background: var(--surface-2); border-radius: 5px; position: relative; }
.rank-row .bar {
  position: absolute; inset: 0 auto 0 0; border-radius: 5px 4px 4px 5px;
  min-width: 4px; transition: width .5s cubic-bezier(.2,.7,.3,1);
}
.rank-row .val { font-family: var(--font-mono); font-size: .92rem; font-weight: 600; text-align: right; }
@media (max-width: 560px) { .rank-row { grid-template-columns: minmax(96px, 130px) 1fr 46px; } }

/* heatmap */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 660px; }
.heat th {
  font-size: .72rem; font-weight: 500; color: var(--muted);
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 6px; text-align: center;
}
.heat th.rowh { text-align: left; letter-spacing: 0; text-transform: none; font-family: var(--font-body); font-size: .85rem; color: var(--ink); white-space: nowrap; }
.heat th.rowh a { color: var(--ink); }
.heat td {
  text-align: center; padding: 9px 6px; border-radius: 6px;
  font-family: var(--font-mono); font-size: .85rem; font-weight: 600;
  min-width: 52px; cursor: default;
}
.heat td.total { outline: 2px solid var(--ink); outline-offset: -2px; }

/* radar small-multiples */
.radar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.radar-cell { padding: 14px 10px 10px; text-align: center; }
.radar-cell h4 { margin: 6px 0 0; font-size: .88rem; font-weight: 600; }
.radar-cell h4 a { color: var(--ink); }
.radar-cell .small { display: block; margin-top: 1px; }

/* project entry cards */
.entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.entry {
  display: flex; flex-direction: column; gap: 10px; padding: 20px;
  color: var(--ink); position: relative; transition: border-color .15s, transform .15s;
}
.entry:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.entry__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.entry__title { font-family: var(--font-display); font-weight: 600; font-size: 1.18rem; }
.entry__score {
  font-family: var(--font-mono); font-weight: 600; font-size: 1.15rem;
  color: var(--accent-strong); white-space: nowrap;
}
.entry__score small { font-size: .7rem; color: var(--muted); font-weight: 400; }
.entry p { margin: 0; font-size: .88rem; color: var(--ink-2); }
.entry__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.author-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ---------- project page ---------- */
.proj-head { padding: 34px 0 6px; }
.proj-head .crumbs { font-size: .8rem; color: var(--muted); font-family: var(--font-mono); }
.proj-head h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.9rem, 4.6vw, 2.9rem); line-height: 1.12; margin: 8px 0 8px;
}
.proj-head .tagline { color: var(--ink-2); font-size: 1.02rem; max-width: 64ch; margin: 0 0 18px; }
.proj-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 26px; }
.proj-links a {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--hairline); border-radius: 999px; padding: 6px 14px;
  font-size: .84rem; color: var(--ink-2);
}
.proj-links a:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }
.proj-links .material-symbols-rounded { font-size: 17px; }

.scorecard { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: stretch; }
@media (max-width: 860px) { .scorecard { grid-template-columns: 1fr; } }
.score-hero { padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.score-hero .big { font-family: var(--font-mono); font-weight: 600; font-size: 3.4rem; line-height: 1; }
.score-hero .big small { font-size: 1.1rem; color: var(--muted); font-weight: 400; }
.score-hero .tier { font-size: .85rem; color: var(--ink-2); }
.dimbars { padding: 20px 24px; }
.dimbar { display: grid; grid-template-columns: minmax(120px, 168px) 1fr 40px; gap: 12px; align-items: center; padding: 5px 0; }
.dimbar .lbl { font-size: .85rem; color: var(--ink-2); }
.dimbar .lbl a { color: var(--ink-2); }
.dimbar .track { height: 12px; background: var(--surface-2); border-radius: 4px; position: relative; }
.dimbar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; min-width: 3px; }
.dimbar .v { font-family: var(--font-mono); font-size: .85rem; font-weight: 600; text-align: right; }
@media (max-width: 560px) { .dimbar { grid-template-columns: minmax(96px, 120px) 1fr 36px; } }

.dim-article { border-top: 1px solid var(--hairline); padding: 22px 0; display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
@media (max-width: 780px) { .dim-article { grid-template-columns: 1fr; gap: 6px; } }
.dim-article h3 { margin: 0; font-size: 1.02rem; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.dim-article .dscore { font-family: var(--font-mono); font-weight: 600; color: var(--accent-strong); }
.dim-article p { margin: 0; font-size: .93rem; color: var(--ink-2); }
.dim-article code, .li-list code, .prose code {
  font-family: var(--font-mono); font-size: .84em;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: 4px; padding: 1px 5px; white-space: nowrap;
}

.hl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .hl-grid { grid-template-columns: 1fr; } }
.li-card { padding: 22px; }
.li-card h3 { margin: 0 0 12px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.li-card h3 .material-symbols-rounded { font-size: 20px; }
.li-card.pos h3 .material-symbols-rounded { color: var(--good); }
.li-card.neg h3 .material-symbols-rounded { color: var(--bad); }
.li-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.li-list li { font-size: .89rem; color: var(--ink-2); padding-left: 18px; position: relative; }
.li-list li::before {
  content: ""; position: absolute; left: 2px; top: .58em;
  width: 7px; height: 7px; border-radius: 2px; background: var(--baseline);
}
.li-card.pos .li-list li::before { background: var(--good); }
.li-card.neg .li-list li::before { background: var(--bad); }
.li-list b { color: var(--ink); font-weight: 600; }

.callout { padding: 20px 24px; border-left: 4px solid var(--accent); }
.callout h3 { margin: 0 0 8px; font-size: 1rem; }
.callout p { margin: 0 0 8px; font-size: .9rem; color: var(--ink-2); }
.callout p:last-child { margin-bottom: 0; }

.facts { width: 100%; border-collapse: collapse; font-size: .89rem; }
.facts th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 14px 8px 0; white-space: nowrap; vertical-align: top; }
.facts td { padding: 8px 0; color: var(--ink); border-bottom: 1px solid var(--hairline); }
.facts tr:last-child td { border-bottom: none; }
.facts th { border-bottom: 1px solid var(--hairline); }
.facts tr:last-child th { border-bottom: none; }

.proj-next { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; }
.proj-next a { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }

/* ---------- authors ---------- */
.author-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .author-grid { grid-template-columns: 1fr; } }
.author-card { padding: 24px; }
.author-card h3 { margin: 0 0 2px; font-family: var(--font-display); font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.author-card .small { margin-bottom: 12px; display: block; }
.author-card p { font-size: .9rem; color: var(--ink-2); margin: 0 0 10px; }
.author-facts { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.author-facts div b { display: block; font-family: var(--font-mono); font-size: 1.2rem; }
.author-facts div span { font-size: .75rem; color: var(--muted); }

/* timeline */
.tl { position: relative; margin: 8px 0 0; padding: 0 0 0 26px; list-style: none; }
.tl::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--hairline); }
.tl li { position: relative; padding: 0 0 26px; }
.tl li::before {
  content: ""; position: absolute; left: -24px; top: 7px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--s1); border: 2px solid var(--page);
}
.tl .tl-date { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.tl h4 { margin: 2px 0 4px; font-size: 1.05rem; }
.tl h4 a { color: var(--ink); }
.tl h4 .num { color: var(--accent-strong); font-size: .95rem; margin-left: 8px; }
.tl p { margin: 0; font-size: .88rem; color: var(--ink-2); max-width: 70ch; }
.tl .tl-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* line chart + sparklines */
.spark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.spark { padding: 14px 16px 10px; }
.spark h4 { margin: 0; font-size: .82rem; font-weight: 500; color: var(--ink-2); }
.spark .delta { font-family: var(--font-mono); font-size: .78rem; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* ---------- methodology / prose ---------- */
.prose { max-width: 76ch; }
.prose h3 { font-size: 1.1rem; margin: 28px 0 8px; }
.prose p, .prose li { font-size: .95rem; color: var(--ink-2); }
.prose table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 14px 0; }
.prose th { text-align: left; font-weight: 600; color: var(--ink); border-bottom: 2px solid var(--ink); padding: 8px 10px 8px 0; }
.prose td { border-bottom: 1px solid var(--hairline); padding: 8px 10px 8px 0; color: var(--ink-2); vertical-align: top; }
.table-scroll { overflow-x: auto; }
.check { color: var(--good); font-weight: 600; }

/* ---------- glossary ---------- */
.search-wrap { position: relative; max-width: 420px; margin: 0 0 22px; }
.search-wrap .material-symbols-rounded { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
.search-wrap input {
  width: 100%; padding: 11px 14px 11px 42px;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: .92rem; font-family: var(--font-body);
}
.search-wrap input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.gloss-list { display: flex; flex-direction: column; gap: 10px; }
.gloss-list details { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
.gloss-list summary {
  cursor: pointer; padding: 13px 18px; font-weight: 600; font-size: .95rem;
  display: flex; align-items: baseline; gap: 10px; list-style: none;
}
.gloss-list summary::-webkit-details-marker { display: none; }
.gloss-list summary::before { content: "+"; font-family: var(--font-mono); color: var(--accent-strong); }
.gloss-list details[open] summary::before { content: "−"; }
.gloss-list summary .tag { font-weight: 400; }
.gloss-list .def { padding: 0 18px 14px 36px; font-size: .89rem; color: var(--ink-2); }
.empty { color: var(--muted); font-size: .9rem; padding: 20px 0; }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--hairline); margin-top: 24px;
  padding: 28px 20px 40px; text-align: center; color: var(--muted); font-size: .84rem;
}
.footer p { margin: 0 0 10px; }
.footer__links { display: flex; justify-content: center; gap: 10px; }
.footer__link { padding: 8px; border-radius: 50%; }

/* ---------- dialog (shell contract) ---------- */
.dialog { border: none; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); padding: 0; max-width: 640px; width: calc(100% - 40px); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog__bar { display: flex; padding: 8px; }
.dialog__spacer { flex: 1; }
.dialog__body { padding: 0 24px 24px; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
