/* 日本遊戲 IP 殿堂 · component layer
   所有顏色、字體、間距皆來自 token（見 DESIGN.md 第 7 節）。
   系列主題只覆寫 token，不新增元件。 */

/* ---------- tokens ---------- */
:root {
  --ground: #0f1216;
  --surface: #171c22;
  --surface-2: #1e242b;
  --line: #2c343d;
  --ink: #eef1f4;
  --ink-muted: #a2acb6;
  --accent: #e0561f;
  --accent-ink: #0f1216;
  --focus: #ffd166;

  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "Microsoft JhengHei", serif;
  --font-pixel: "DotGothic16", "Noto Sans TC", monospace;

  --measure: 68ch;
  --shell: 1200px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;

  --radius: 2px;
  --radius-lg: 6px;

  --shadow-card: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-dialog: 0 24px 60px rgba(0, 0, 0, .5);

  --motif: none;
  --display-font: var(--font-serif);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--ground);
  background-image: var(--motif);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.85;
  letter-spacing: .01em;
}

h1, h2, h3, h4 {
  font-family: var(--display-font);
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.shell { width: min(var(--shell), 100% - var(--sp-6)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 40;
  background: var(--accent); color: var(--accent-ink);
  padding: var(--sp-3) var(--sp-4); font-weight: 700;
}
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ground) 88%, var(--surface));
  position: sticky; top: 0; z-index: 20;
}
.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5); min-height: 68px;
}
.brand {
  display: flex; align-items: baseline; gap: var(--sp-3);
  text-decoration: none; color: var(--ink); min-width: 0;
}
.brand strong { font-family: var(--display-font); font-size: 1.25rem; letter-spacing: .04em; }
.brand span { color: var(--ink-muted); font-size: .8125rem; letter-spacing: .12em; text-transform: uppercase; }
.masthead-nav { display: flex; gap: var(--sp-5); align-items: center; }
.masthead-nav a {
  color: var(--ink-muted); text-decoration: none; font-size: .9375rem; font-weight: 600;
  padding: var(--sp-2) 0;
}
.masthead-nav a:hover, .masthead-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- hall hero ---------- */
.hall-hero { padding: var(--sp-8) 0 var(--sp-6); }
.hall-hero h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); font-weight: 700; }
.hall-hero .lede { max-width: 54ch; color: var(--ink-muted); margin-top: var(--sp-4); }
.hall-hero .counts { margin-top: var(--sp-5); font-size: .9375rem; color: var(--ink-muted); }
.hall-hero .counts b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- generic section ---------- */
.section { padding: var(--sp-7) 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: var(--sp-6); }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { color: var(--ink-muted); margin: var(--sp-3) 0 0; max-width: var(--measure); }

/* ---------- wing grid (大廳翼廊) ---------- */
.wing-grid {
  display: grid; gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.wing-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); text-decoration: none; color: var(--ink);
  overflow: hidden;
}
.wing-card:hover { border-color: var(--accent); box-shadow: var(--shadow-card); }
.wing-card__media { aspect-ratio: 16 / 9; background: var(--surface-2); }
.wing-card__media img { width: 100%; height: 100%; object-fit: cover; }
.wing-card__media--empty {
  display: grid; place-items: center; color: var(--ink-muted); font-size: .8125rem;
}
.wing-card__body { padding: var(--sp-4) var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }
.wing-card__kicker { font-size: .8125rem; color: var(--ink-muted); letter-spacing: .04em; }
.wing-card__name { font-size: 1.25rem; font-weight: 700; font-family: var(--display-font); }
.wing-card__en { font-size: .8125rem; color: var(--ink-muted); }
.wing-card__tagline { font-size: .9375rem; color: var(--ink-muted); line-height: 1.7; }
.wing-card__meta {
  margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: var(--sp-3);
  font-size: .8125rem; color: var(--ink-muted); font-variant-numeric: tabular-nums;
}

/* hall filters */
.hall-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.hall-tools button {
  font: inherit; font-size: .9375rem; font-weight: 600;
  min-height: 44px; padding: 0 var(--sp-4);
  background: var(--surface); color: var(--ink-muted);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.hall-tools button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- corridor (年代走廊) ---------- */
.corridor { display: flex; gap: var(--sp-5); overflow-x: auto; padding-bottom: var(--sp-3); scrollbar-width: thin; }
.corridor-stop { flex: 0 0 auto; width: 190px; }
.corridor-stop time { font-family: var(--font-pixel); font-size: 1.6rem; color: var(--accent); display: block; }
.corridor-stop .who { font-weight: 700; }
.corridor-stop .what { font-size: .8125rem; color: var(--ink-muted); }

/* ---------- notes / facts ---------- */
.fact-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); }
.fact dt { font-size: .8125rem; color: var(--ink-muted); }
.fact dd { margin: var(--sp-2) 0 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fact dd + p { font-size: .8125rem; color: var(--ink-muted); margin-top: var(--sp-2); }

/* ---------- wing header (系列頁) ---------- */
.wing-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: var(--sp-7) 0 var(--sp-6);
}
.wing-header__grid { display: grid; gap: var(--sp-6); grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: end; }
.wing-header h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.wing-header__ja { font-size: 1rem; color: var(--ink-muted); margin-top: var(--sp-2); }
.wing-header__tagline { color: var(--ink-muted); margin-top: var(--sp-4); max-width: 44ch; }
.wing-header__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin-top: var(--sp-5); font-size: .9375rem; color: var(--ink-muted); }
.wing-header__meta b { color: var(--ink); font-weight: 600; }
.wing-header__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-lg); }
.wing-header__media figcaption { font-size: .8125rem; color: var(--ink-muted); margin-top: var(--sp-2); }

/* ---------- prose ---------- */
.prose { max-width: var(--measure); }
.prose p { font-size: 1.0625rem; }
.prose h3 { font-size: 1.25rem; margin: var(--sp-6) 0 var(--sp-3); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: var(--sp-2); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: var(--sp-5); padding: var(--sp-4) 0; border-top: 1px solid var(--line);
}
.timeline li:first-child { border-top: 0; }
.timeline time { font-family: var(--font-pixel); font-size: 1.25rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: 1.0625rem; font-family: var(--font-sans); font-weight: 700; }
.timeline p { margin: var(--sp-2) 0 0; color: var(--ink-muted); font-size: .9375rem; max-width: var(--measure); }

/* ---------- mechanics ---------- */
.mech-grid { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.mech-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.mech-card__media { aspect-ratio: 3 / 2; background: var(--surface-2); }
.mech-card__media img { width: 100%; height: 100%; object-fit: cover; }
.mech-card__body { padding: var(--sp-4) var(--sp-4) var(--sp-5); }
.mech-card__era { font-family: var(--font-pixel); font-size: .9375rem; color: var(--accent); }
.mech-card h3 { font-size: 1.0625rem; font-family: var(--font-sans); margin: var(--sp-2) 0 var(--sp-3); }
.mech-card p { font-size: .9375rem; color: var(--ink-muted); margin: 0 0 var(--sp-3); }
.mech-card figcaption { font-size: .8125rem; color: var(--ink-muted); }

/* ---------- works (系列作品年表) ---------- */
.works { display: grid; gap: var(--sp-6); }
.works-era h3 {
  font-size: .9375rem; font-weight: 700; letter-spacing: .06em;
  color: var(--ink-muted); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
}
.work-list { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.work {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4);
}
.work time { font-variant-numeric: tabular-nums; color: var(--ink-muted); font-size: .9375rem; padding-top: 2px; }
.work .title { font-weight: 700; }
.work .title-ja { display: block; font-size: .8125rem; color: var(--ink-muted); font-weight: 400; }
.work .note { font-size: .8125rem; color: var(--ink-muted); margin-top: var(--sp-2); }
.platform {
  display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1px var(--sp-2);
  color: var(--ink-muted); margin-top: var(--sp-2);
}

/* ---------- gallery ---------- */
.gallery { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.gallery figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { font-size: .8125rem; color: var(--ink-muted); padding: var(--sp-3); }

/* ---------- figures / note-box ---------- */
.doc-figure { margin: var(--sp-6) 0; }
.doc-figure img { width: 100%; border-radius: var(--radius-lg); }
.doc-figure figcaption { font-size: .8125rem; color: var(--ink-muted); margin-top: var(--sp-2); }

.note-box {
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  background: var(--surface); border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5); margin: var(--sp-6) 0;
}
.note-box h3 { font-size: .9375rem; font-family: var(--font-sans); margin-bottom: var(--sp-2); }
.note-box p:last-child { margin-bottom: 0; }

/* ---------- credit list ---------- */
.credit-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: var(--sp-6); font-size: .8125rem; color: var(--ink-muted); }
.credit-list li { break-inside: avoid; margin-bottom: var(--sp-2); }

/* ---------- states ---------- */
.state { padding: var(--sp-7) 0; color: var(--ink-muted); }
.state--error { color: var(--ink); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: var(--sp-8);
  padding: var(--sp-6) 0 var(--sp-7); font-size: .8125rem; color: var(--ink-muted);
}
.site-footer p { margin: 0 0 var(--sp-2); }
.site-footer a { color: var(--ink-muted); }

/* ---------- lightbox ---------- */
.lightbox {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-dialog);
  padding: var(--sp-4); max-width: min(1100px, 92vw);
}
.lightbox::backdrop { background: rgba(0, 0, 0, .72); }
.lightbox img { max-height: 74vh; width: auto; margin-inline: auto; }
.lightbox figcaption { font-size: .8125rem; color: var(--ink-muted); margin-top: var(--sp-3); }
.lightbox__close {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  width: 44px; height: 44px; font-size: 1.5rem; line-height: 1;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
}
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; font-size: 1.5rem; line-height: 1;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
}
.lightbox__nav--prev { left: var(--sp-3); }
.lightbox__nav--next { right: var(--sp-3); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .wing-header__grid { grid-template-columns: 1fr; }
  .credit-list { columns: 1; }
}
@media (max-width: 640px) {
  body { line-height: 1.8; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3) 0; }
  .masthead-nav { gap: var(--sp-4); flex-wrap: wrap; }
  .masthead-nav a { min-height: 44px; display: inline-flex; align-items: center; }  /* 觸控目標 */
  .hall-tools button { min-height: 44px; }
  .timeline li { grid-template-columns: 1fr; gap: var(--sp-2); }
  .work { grid-template-columns: 1fr; gap: var(--sp-1); }
  .shell { width: min(var(--shell), 100% - var(--sp-5)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
