/* ============ From the Feed — design tokens ============ */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem;
  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px;
  --shadow: 0 1px 2px rgb(18 18 18 / 0.05), 0 4px 14px rgb(18 18 18 / 0.05);
}
:root, [data-theme='light'] {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f4f2ee;
  --border: #e3e0da;
  --divider: #ebe8e3;
  --text: #29261f;
  --muted: #6b6b6b;
  --faint: #a3a09b;
  --accent: #43701c;
  --accent-hover: #745016;
  --accent-soft: #f6efdf;
  --band: #121212;
  --band-text: #ffffff;
  --chip-on: #43701c;
  --chip-on-text: #ffffff;
}
[data-theme='dark'] {
  --bg: #151413;
  --surface: #1d1c1a;
  --surface-2: #232220;
  --border: #363431;
  --divider: #2b2a27;
  --text: #d9d7d3;
  --muted: #9b9893;
  --faint: #6e6b66;
  --accent: #9fc45d;
  --accent-hover: #b7d98a;
  --accent-soft: #332a12;
  --band: #0c0c0c;
  --band-text: #f2f0ed;
  --chip-on: #9fc45d;
  --chip-on-text: #16100f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 820px; margin: 0 auto; padding: 0 var(--space-5); }

/* ============ header ============ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--band);
  color: var(--band-text);
  border-bottom: 3px solid var(--accent);
}
.site-header .bar {
  max-width: 1080px; margin: 0 auto; padding: var(--space-3) var(--space-5);
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: inherit; min-width: 0; }
.brand svg { flex: none; }
.brand .t1 { font-weight: 800; font-size: var(--text-sm); letter-spacing: 0.14em; white-space: nowrap; }
.brand .t2 { font-size: var(--text-xs); color: #bbb8b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-tools { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: 0.55; pointer-events: none; }
#search {
  width: clamp(150px, 26vw, 280px);
  padding: 0.5rem 0.75rem 0.5rem 2.1rem;
  font-size: var(--text-sm); font-family: inherit;
  border-radius: 999px; border: 1px solid #3a3936;
  background: #1f1e1c; color: #eceae6;
}
#search::placeholder { color: #8b8883; }
#search:focus { outline: 2px solid var(--accent); border-color: transparent; }
.theme-btn {
  background: #1f1e1c; border: 1px solid #3a3936; color: #eceae6;
  width: 38px; height: 38px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-btn:hover { border-color: var(--accent); }

/* year nav */
.year-nav {
  background: var(--band);
  overflow-x: auto; scrollbar-width: none;
}
.year-nav::-webkit-scrollbar { display: none; }
.year-nav .inner {
  max-width: 1080px; margin: 0 auto; padding: 0 var(--space-5) var(--space-3);
  display: flex; gap: var(--space-2);
}
.year-link {
  flex: none; text-decoration: none;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em;
  color: #c9c6c1; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid #3a3936;
}
.year-link:hover, .year-link.active { color: #fff; border-color: var(--accent); background: rgb(143 94 12 / 0.28); }

/* ============ hero ============ */
.hero { padding: var(--space-16) 0 var(--space-12); }
.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.22em;
  color: var(--accent); text-transform: uppercase;
}
.kicker::before { content: ''; width: 26px; height: 3px; background: var(--accent); }
.hero h1 {
  font-size: var(--text-2xl); line-height: 1.12; font-weight: 800;
  letter-spacing: -0.01em; margin: var(--space-4) 0 var(--space-4);
}
.hero .lede { color: var(--muted); max-width: 60ch; }
.hero .lede strong { color: var(--text); }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3); margin-top: var(--space-10);
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: var(--space-4) var(--space-4);
}
.stat .v { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: var(--text-xs); color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

/* eras */
.eras { padding: var(--space-6) 0 var(--space-8); }
.eras h2 { font-size: var(--text-lg); font-weight: 800; margin-bottom: var(--space-4); }
.era-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--space-3); }
.era-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-4); text-decoration: none; color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.era-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.era-card .n { font-size: var(--text-xs); font-weight: 800; color: var(--accent); letter-spacing: 0.1em; }
.era-card .h { font-weight: 700; font-size: var(--text-sm); margin: 2px 0 4px; }
.era-card .b { font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

/* filters */
.filter-bar {
  position: sticky; top: var(--header-h, 64px); z-index: 40;
  background: var(--bg); border-bottom: 1px solid var(--divider);
  padding: var(--space-2) 0;
}
.filter-bar .inner { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em;
  padding: 0.32rem 0.85rem; border-radius: 999px;
}
.chip[aria-pressed='true'] { background: var(--chip-on); color: var(--chip-on-text); border-color: var(--chip-on); }
#result-count { font-size: var(--text-xs); color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ============ timeline ============ */
.year-section { padding-top: var(--space-10); }
.year-band {
  display: flex; align-items: stretch; border-radius: 3px; overflow: hidden;
  scroll-margin-top: 130px;
}
.year-band .tab { width: 13px; background: var(--accent); flex: none; }
.year-band .label {
  flex: 1; background: var(--band); color: var(--band-text);
  padding: var(--space-4) var(--space-5);
  font-weight: 800; font-size: var(--text-lg); letter-spacing: 0.12em; text-transform: uppercase;
}
.year-meta { font-size: var(--text-xs); font-weight: 600; color: var(--muted); margin: var(--space-2) 0 0; letter-spacing: 0.05em; }
.year-intro { color: var(--muted); font-style: italic; font-size: var(--text-sm); margin-top: var(--space-3); max-width: 68ch; }

.month-head {
  display: flex; align-items: baseline; gap: var(--space-3);
  margin: var(--space-8) 0 var(--space-2);
  scroll-margin-top: 130px;
}
.month-head h3 {
  font-size: var(--text-sm); font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent);
}
.month-head .rule { flex: 1; height: 2px; background: var(--accent); opacity: 0.9; }

.entry {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-5); margin-top: var(--space-4);
  box-shadow: var(--shadow);
}
.entry-head { display: flex; gap: var(--space-3); align-items: baseline; }
.date-chip {
  flex: none; font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.08em;
  color: var(--accent); text-transform: uppercase; white-space: nowrap;
  padding-top: 2px;
}
.entry-title { font-weight: 700; font-size: var(--text-sm); line-height: 1.5; }
.entry-title strong { font-weight: 800; }

.msg { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--text); white-space: pre-line; overflow-wrap: break-word; }
.msg.clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; overflow: hidden; }
.readmore {
  background: none; border: none; color: var(--accent); font-weight: 700;
  font-size: var(--text-xs); letter-spacing: 0.04em; padding: var(--space-1) 0 0;
}
.readmore:hover { color: var(--accent-hover); text-decoration: underline; }

.media { margin-top: var(--space-4); }
.media a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.media img { width: 100%; height: auto; transition: transform 0.25s ease; }
.media a:hover img { transform: scale(1.015); }
.media .hint { font-size: var(--text-xs); color: var(--faint); margin-top: var(--space-1); }

.entry-src {
  margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--divider);
  font-size: var(--text-xs); color: var(--muted);
  display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
}
.entry-src a { font-weight: 700; color: var(--accent); text-decoration: none; }
.entry-src a:hover { text-decoration: underline; }
.entry-src .eng { font-variant-numeric: tabular-nums; }

/* footer */
.site-footer {
  margin-top: var(--space-20); background: var(--band); color: #bbb8b3;
  border-top: 3px solid var(--accent);
  padding: var(--space-10) 0;
  font-size: var(--text-xs);
}
.site-footer .inner { display: flex; gap: var(--space-4); flex-wrap: wrap; justify-content: space-between; align-items: center; }
.site-footer .from { color: var(--accent); font-weight: 800; letter-spacing: 0.14em; }
.site-footer a { color: #e8e6e2; }

#to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 42px; height: 42px; border-radius: 999px; border: none;
  background: var(--accent); color: #fff; box-shadow: var(--shadow);
  display: none; align-items: center; justify-content: center;
}
#to-top.show { display: inline-flex; }

.hidden { display: none !important; }
#no-results {
  margin: var(--space-12) 0; text-align: center; color: var(--muted);
  font-size: var(--text-sm);
}
#no-results strong { color: var(--text); }

@media (max-width: 640px) {
  .entry { padding: var(--space-4); }
  .entry-head { flex-direction: column; gap: var(--space-1); }
  .site-header .bar { gap: var(--space-2); }
  .brand .t2 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .media img, .era-card { transition: none; }
}

/* in-app video player */
.video-thumb { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); cursor: pointer; position: relative; }
.video-thumb img { width: 100%; height: auto; display: block; transition: transform 0.25s ease; }
.video-thumb:hover img { transform: scale(1.015); }
.video-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inline-video { display: block; width: 100%; height: auto; max-height: 82vh; border-radius: var(--radius); border: 1px solid var(--border); background: #000; }
@media (prefers-reduced-motion: reduce) { .video-thumb img { transition: none; } }

/* ---- Team Minis: multi-photo grid ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: var(--space-4); }
.media-grid .cell { display: block; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.media-grid .cell img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; display: block; }
