/* ============================================================
   Wenhao Chai — Academic Journal redesign
   Warm paper, oxblood accent, hairline rules, journal-margin index
   ============================================================ */

:root {
  /* Palette: cool ivory, oxblood red (Princeton-adjacent but deeper) */
  --paper: #F6F3EC;
  --paper-2: #EFEBE1;
  --ink: #15141A;
  --ink-2: #2A2830;
  --ink-3: #5E5B66;
  --ink-4: #8F8B96;
  --rule: #D9D3C3;
  --rule-2: #E6E1D2;
  --accent: #7A1A1A;        /* oxblood */
  --accent-hover: #5C1212;
  --accent-soft: rgba(122, 26, 26, 0.08);

  --font-serif: 'Newsreader', 'Iowan Old Style', 'Georgia', serif;
  --font-sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --max: 1180px;
  --gutter: clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* very subtle paper grain */
  background-image:
    radial-gradient(rgba(60,50,30,0.015) 1px, transparent 1px);
  background-size: 5px 5px;
  background-position: 0 0;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--accent); color: #fff; }

/* ============================================================
   Unified body typography — serif prose for all descriptive copy
   ============================================================ */
.prose,
ul.log li > span:last-child,
p.tile-desc,
p.lede,
.entry-desc,
.item-desc,
.card-desc {
  font-family: var(--font-serif) !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  color: var(--ink-2);
  letter-spacing: -0.003em;
}
ul.log li > span:last-child { font-size: 15.5px !important; }

/* ============================================================
   News log — shared across homepage + news archive
   ============================================================ */
.log {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}
.log li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-2);
  align-items: baseline;
  color: var(--ink-2);
  line-height: 1.55;
}
.log .glyph { display: none; }
@media (max-width: 600px) {
  .log li {
    grid-template-columns: 72px 1fr;
    gap: 10px;
    padding: 9px 0;
  }
}
.log .date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  text-transform: uppercase;
  white-space: nowrap;
}
.log .glyph {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
  justify-self: start;
  line-height: 1.25;
}
.log .g-paper { color: var(--accent); }

.log a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding: 0 1px;
  transition: background 0.15s, color 0.15s;
}
.log a:hover { background: var(--accent); color: #fff; }
/* Unified link style — matches .log a / .hero-bio a everywhere:
   ink color, oxblood underline, hover = oxblood bg + white text */
.prose a,
.log li > span:last-child a,
.tile-desc a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding: 0 1px;
  transition: background 0.15s, color 0.15s;
}
.prose a:hover,
.log li > span:last-child a:hover,
.tile-desc a:hover {
  background: var(--accent);
  color: #fff;
}
.tile-desc {
  font-size: 15.5px;
  line-height: 1.6;
}

/* ---------- Layout shell with journal margin ---------- */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: nowrap;
}
.brand {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand .brand-mark {
  display: block;
  height: 26px;
  width: auto;
  transform: translateY(-3px);
}
.brand em {
  font-style: italic;
  color: var(--ink-3);
  font-weight: 400;
}
.nav {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  align-items: center;
}
.nav a {
  font-family: var(--font-serif);
  padding: 8px 11px;
  font-size: 16px;
  color: var(--ink-2);
  font-weight: 400;
  letter-spacing: -0.005em;
  border-radius: 0;
  position: relative;
  transition: color 0.15s;
  white-space: nowrap;
}
.nav a:hover { color: var(--accent); }
.nav a.active {
  color: var(--accent);
}
.nav a.active::after {
  content: '';
  position: absolute;
  left: 11px; right: 11px; bottom: 2px;
  height: 1px;
  background: var(--accent);
}

/* Calendar link in topbar — plain nav link, same as others */
.nav a.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}
.nav a.nav-cta:hover { color: var(--accent-hover); }
.nav-cta svg { width: 12px; height: 12px; stroke: currentColor; }

/* Responsive topbar */
@media (max-width: 980px) {
  .brand em { display: none; }
  .nav a { padding: 8px 9px; font-size: 15px; }
  .brand { font-size: 20px; }
}
@media (max-width: 720px) {
  .topbar-inner { gap: 12px; padding: 12px var(--gutter); }
  .nav { gap: 0; }
  .nav a { padding: 6px 7px; font-size: 14px; }
  .nav-cta { margin-left: 4px; padding: 6px 9px; font-size: 11px; }
  .nav-cta svg { display: none; }
  .brand { font-size: 18px; }
}
@media (max-width: 560px) {
  .nav a { font-size: 13px; }
}

/* ---------- Journal section wrapper ---------- */
section.journal {
  border-bottom: 1px solid var(--rule);
  padding: clamp(56px, 8vw, 96px) 0;
  position: relative;
}
section.journal:last-of-type { border-bottom: none; }

/* Margin index (01, 02…) */
.idx {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.idx::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

/* ---------- Hero ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.hero-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(44px, 6.2vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  color: var(--ink);
}
.hero-name .amp {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.hero-role {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-3);
  margin: 0 0 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  max-width: 640px;
}
.hero-role .pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--accent);
  margin-right: 8px;
  background: var(--paper);
}

.hero-bio {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 640px;
  margin: 0;
  font-weight: 400;
}
.hero-bio p { margin: 0 0 14px; }
.hero-bio p:last-child { margin-bottom: 0; }

.hero-bio a, .prose a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  transition: background 0.15s, color 0.15s;
  padding: 0 1px;
}
.hero-bio a:hover, .prose a:hover {
  background: var(--accent);
  color: #fff;
}

/* Right column: avatar + actions */
.aside {
  position: sticky;
  top: 90px;
}
.avatar-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--paper-2);
  overflow: hidden;
  border-radius: 2px;
  box-shadow:
    0 1px 0 var(--rule),
    0 24px 48px -24px rgba(20, 15, 10, 0.25);
}
.avatar-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.02);
}
.avatar-caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--ink-4);
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
}

.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  border-radius: 2px;
  transition: all 0.18s;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn .arrow {
  font-family: var(--font-mono);
  transition: transform 0.18s;
}
.btn:hover .arrow { transform: translateX(3px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-outline:hover {
  border-color: var(--ink);
}

/* Social dock — equal-width cells */
.dock {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin-top: 20px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.dock a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  height: 38px;
  color: var(--ink-3);
  transition: color 0.15s, background 0.15s;
  border-right: 1px solid var(--rule-2);
}
.dock a:last-child { border-right: none; }
.dock a:hover {
  color: var(--accent);
  background: var(--paper-2);
}
.dock svg { width: 15px; height: 15px; }
.dock .dock-text {
  padding: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  line-height: 1;
}
.dock.dock-primary {
  margin-top: 24px;
  border-top: none;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.dock.dock-primary .dock-text {
  color: var(--accent);
  height: 42px;
  flex: 1;
  border-right: 1px solid var(--rule-2);
}
.dock.dock-primary .dock-text:last-child { border-right: none; }
.dock.dock-primary .dock-text:hover { background: var(--accent); color: #fff; }

/* ---------- Section heading ---------- */
.sec-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.sec-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(32px, 3.6vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}
.sec-title em {
  font-style: italic;
  color: var(--accent);
}
.sec-more {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 0;
  transition: color 0.15s;
}
.sec-more:hover {
  color: var(--accent-hover);
}
.sec-more .arrow { transition: transform 0.18s; font-size: 12px; }
.sec-more:hover .arrow { transform: translateX(3px); }

/* ---------- Pinned cards ---------- */
.pinned {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--rule);
  background: var(--paper);
  margin-bottom: 56px;
}
@media (max-width: 760px) { .pinned { grid-template-columns: 1fr; } }
.pin {
  padding: 28px;
  border-right: 1px solid var(--rule);
  position: relative;
}
.pin:last-child { border-right: none; }
@media (max-width: 760px) {
  .pin { border-right: none; border-bottom: 1px solid var(--rule); }
  .pin:last-child { border-bottom: none; }
}
.pin-label {
  margin-bottom: 14px;
}
.pin-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.pin-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  line-height: 1.2;
}
.pin-title a {
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.pin-title a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.pin-body {
  font-family: var(--font-serif);
  font-size: 15.5px;
  color: var(--ink-2);
  line-height: 1.65;
  margin: 0;
}
.pin-body code.install-cmd {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.copy-btn {
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 4px;
  cursor: pointer;
  opacity: 0.5;
  vertical-align: -2px;
  transition: opacity 0.15s, transform 0.15s;
  color: var(--accent);
}
.copy-btn:hover { opacity: 1; }
.copy-btn:active { transform: scale(0.9); }
.copy-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: absolute;
  transition: opacity 0.2s, transform 0.2s;
}
.copy-btn { position: relative; }
.copy-btn .icon-check { opacity: 0; transform: scale(0.6); }
.copy-btn.copied .icon-copy { opacity: 0; transform: scale(0.6); }
.copy-btn.copied .icon-check { opacity: 1; transform: scale(1); color: var(--accent); }

.pin-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding: 0 1px;
  transition: background 0.15s, color 0.15s;
}
.pin-body a:hover { background: var(--accent); color: #fff; }

/* ---------- News log (changelog style) ---------- */
.log {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}
.log li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-2);
  align-items: baseline;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
@media (max-width: 600px) {
  .log li {
    grid-template-columns: 72px 1fr;
    gap: 10px;
    font-size: 13.5px;
    padding: 8px 0;
  }
}
.log .date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  text-transform: uppercase;
  white-space: nowrap;
}
.log .glyph {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
  justify-self: start;
  line-height: 1.25;
}
/* Category label color */
.log .g-paper { color: var(--accent); }

.log a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding: 0 1px;
  transition: background 0.15s, color 0.15s;
}
.log a:hover { background: var(--accent); color: #fff; }

/* ---------- Film/feature strip ---------- */
.strip {
  padding: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.strip-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 64px var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 760px) {
  .strip-inner { grid-template-columns: 1fr; gap: 24px; padding: 44px var(--gutter); }
}
.strip-meta .idx { margin-bottom: 20px; }
.strip-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 16px;
}
.strip-desc {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink-3);
  margin: 0 0 20px;
  max-width: 48ch;
  line-height: 1.55;
}
.strip-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.strip-cta .cta-label {
  border-bottom: 1px solid var(--accent);
  padding-bottom: 3px;
}
.strip-cta .play {
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
}
.strip-cta .play::before {
  content: '';
  width: 0; height: 0;
  border-left: 6px solid var(--accent);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  margin-left: 2px;
}
.strip-thumb {
  aspect-ratio: 16/9;
  background: #1a1814 url('https://img.youtube.com/vi/ePpGJDR1FxM/maxresdefault.jpg') center/cover;
  position: relative;
  border: 1px solid var(--rule);
  overflow: hidden;
  cursor: pointer;
}
.strip-thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 55%, rgba(0,0,0,0.35));
}
.strip-thumb .playbtn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(246,243,236,0.92);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
  z-index: 1;
}
.strip-thumb:hover .playbtn { transform: translate(-50%, -50%) scale(1.06); }
.strip-thumb .playbtn::before {
  content: '';
  width: 0; height: 0;
  border-left: 16px solid var(--accent);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 5px;
}
.strip-thumb .thumb-label {
  position: absolute;
  left: 16px; bottom: 14px;
  color: #f6f3ec;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ---------- Footer ---------- */
footer.foot {
  padding: 48px 0 36px;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  font-size: 13px;
  color: var(--ink-3);
}
.foot-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.foot-brand {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
}
.foot-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ---------- Utility ---------- */
.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;
}

/* scroll hint */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--ink-4);
  text-transform: uppercase;
}
.scroll-hint::after {
  content: '';
  display: block;
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, var(--ink-4), transparent);
  margin: 8px auto 0;
}
@media (max-width: 860px) { .scroll-hint { display: none; } }


/* ========================================================
   Subpage additions
   ======================================================== */

/* Page hero band */
.page-hero {
  padding: clamp(56px, 7vw, 84px) 0 clamp(40px, 5vw, 56px);
  border-bottom: 1px solid var(--rule);
}
.page-hero .kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.page-hero .kicker::before {
  content: '';
  width: 28px; height: 1px;
  background: var(--accent);
}
.page-hero h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(44px, 5.8vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
}
.page-hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.page-hero .lede {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
  margin: 0;
}
.page-hero .lede a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding: 0 1px;
  transition: background 0.15s, color 0.15s;
}
.page-hero .lede a:hover { background: var(--accent); color: #fff; }

/* Two-column layout with margin TOC on left */
.with-toc {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) {
  .with-toc { grid-template-columns: 1fr; gap: 28px; }
}
.toc {
  position: sticky;
  top: 90px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}
.toc .toc-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin-bottom: 6px; }
.toc a {
  color: var(--ink-3);
  display: inline-block;
  padding: 3px 0;
  transition: color 0.15s;
}
.toc a:hover, .toc a.active { color: var(--accent); }

/* Year group heading */
.year-head {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(36px, 4vw, 52px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.year-head .year-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 400;
}
.year-group { margin-bottom: 56px; }
.year-group:last-child { margin-bottom: 0; }

/* Card grid (blogs, datasets, codebases) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.tile {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 22px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background 0.18s;
  position: relative;
}
.tile:hover { background: var(--paper-2); }
.tile-thumb {
  aspect-ratio: 16/10;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  overflow: hidden;
  position: relative;
}
.tile-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.tile-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  background:
    repeating-linear-gradient(135deg,
      var(--paper-2) 0, var(--paper-2) 8px,
      var(--paper) 8px, var(--paper) 16px);
}
.tile-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.tile-meta .dot { color: var(--rule); }
.tile-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}
.tile-title a {
  transition: color 0.15s;
  border-bottom: 1px solid transparent;
}
.tile-title a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tile-desc {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.tile-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.tile-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tile-links a:hover { color: var(--ink); }
.tile-links a::after { content: '→'; transition: transform 0.15s; }
.tile-links a:hover::after { transform: translateX(2px); }

/* Subsection heading (for page sections within a single page) */
.sub-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.sub-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.1;
}
.sub-head h2 em { font-style: italic; color: var(--accent); }
.sub-head .sub-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.sub-section { margin-bottom: 72px; }
.sub-section:last-child { margin-bottom: 0; }

/* Life / photo gallery */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1px;
  grid-auto-flow: dense;
  gap: 4px;
}
.photo-grid.full-bleed {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
  padding: 0 8px;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 760px) { .photo-grid.full-bleed { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .photo-grid.full-bleed { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px)  { .photo-grid { grid-template-columns: repeat(1, 1fr); } }
.photo-grid .ph {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  overflow: hidden;
  margin: 0;
}
.photo-grid .ph img {
  width: 100%;
  height: auto;
  display: block;
}
.photo-grid .ph figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 16px 12px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.photo-grid .ph:hover figcaption { opacity: 1; }
.photo-grid .ph { cursor: zoom-in; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(15, 14, 20, 0.94);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 48px 24px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  display: block;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.lightbox-caption {
  position: absolute;
  left: 0; right: 0; bottom: 18px;
  text-align: center;
  color: #f0ecdc;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.6;
  padding: 0 24px;
}
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: transparent;
  border: 0;
  color: #f0ecdc;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1;
  padding: 12px 16px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { opacity: 1; }
.lightbox-close { top: 14px; right: 14px; font-size: 22px; }
.lightbox-prev  { left: 14px; top: 50%; transform: translateY(-50%); font-size: 32px; }
.lightbox-next  { right: 14px; top: 50%; transform: translateY(-50%); font-size: 32px; }

/* Travel log / timeline list */
.travel-log {
  list-style: none;
  padding: 0; margin: 0;
}
.travel-log li {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-2);
  align-items: baseline;
  font-size: 15px;
  color: var(--ink-2);
}
.travel-log .when {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.travel-log .where {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--ink);
}
.travel-log .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  justify-self: end;
}

/* Sub-page body prose */
.prose.prose-wide p,
.prose.prose-wide ul {
  max-width: none;
}
.prose p {
  font-family: var(--font-serif);
  font-size: clamp(16px, 1.35vw, 18px);
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 18px;
  max-width: 62ch;
}
.prose h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(20px, 1.8vw, 24px);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 32px 0 14px;
  line-height: 1.25;
}
.prose h3:first-child { margin-top: 0; }
.prose b, .prose strong {
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.92em;
  letter-spacing: 0.01em;
}
.prose ul {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  max-width: 62ch;
}
.prose ul li {
  font-family: var(--font-serif);
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.6;
  color: var(--ink-2);
  padding: 8px 0 8px 28px;
  border-bottom: 1px dashed var(--rule);
  position: relative;
}
.prose ul li::before {
  content: counter(principle, decimal-leading-zero);
  counter-increment: principle;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 0.05em;
  position: absolute;
  left: 0;
  top: 11px;
}
.prose ul {
  counter-reset: principle;
}
.prose s {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  opacity: 0.7;
}

/* In-section "top of page" link */
.topic-return {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-top: 20px;
  transition: color 0.15s;
}
.topic-return:hover { color: var(--accent); }

/* ============ RESEARCH PAGE ============ */

/* Topic matrix: 3 columns of themed work with labeled sub-areas */
.topic-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  margin-top: 12px;
}
@media (max-width: 900px) {
  .topic-matrix { grid-template-columns: 1fr; }
}
.topic-col {
  padding: 22px 22px 28px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: relative;
}
.topic-col h4 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.topic-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: none;
}
.topic-col ul li {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule-2);
  position: relative;
}
.topic-col ul li:last-child { border-bottom: none; }
.topic-col ul li::before { content: none; }
.topic-col ul li .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-4);
  margin-right: 6px;
  text-transform: lowercase;
}
.topic-col ul li a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding: 0 1px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.topic-col ul li a:hover { background: var(--accent); color: #fff; }

/* Era group header — thick band above a matrix */
.topic-era {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 20px;
  padding: 22px 0 6px;
  border-top: 2px solid var(--ink);
  margin-top: 40px;
}
.topic-era:first-of-type { margin-top: 0; }
.topic-era h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(22px, 2vw, 28px);
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}
.topic-era h3 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.topic-era .span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
}
.topic-era-q {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-3);
  margin: 8px 0 18px;
  max-width: 62ch;
}

/* Video gallery (featured talks/demos) */
.video-toolbar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}
.video-toolbar .label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.video-filter {
  background: none;
  border: 1px solid var(--rule);
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 2px;
}
.video-filter:hover { color: var(--accent); border-color: var(--accent); }
.video-filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.video-card {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  padding: 0;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
}
.video-card:hover { background: var(--paper-2); }
.video-card.hidden { display: none; }
.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--ink);
  overflow: hidden;
  display: block;
}
.video-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.02);
  transition: transform 0.3s;
}
.video-card:hover .video-thumb img { transform: scale(1.03); }
.video-thumb .play-btn {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(246, 243, 236, 0.92);
  border: 1px solid rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.video-thumb .play-btn::before {
  content: '';
  width: 0; height: 0;
  border-left: 14px solid var(--accent);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 4px;
}
.video-card:hover .play-btn {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.06);
}
.video-card:hover .play-btn::before { border-left-color: #fff; }
.video-card-meta {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.video-card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.25;
  color: var(--ink);
  margin: 0;
}
.video-card-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-top: 4px;
}
.video-card-sub a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
}
.video-card-sub a:hover { border-bottom-color: var(--accent); }

/* Principles pull-quote box */
.principles {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 28px 32px;
  margin: 36px 0 0;
  position: relative;
}
.principles::before {
  content: '§';
  position: absolute;
  top: -14px;
  left: 20px;
  font-family: var(--font-serif);
  font-size: 32px;
  color: var(--accent);
  background: var(--paper);
  padding: 0 8px;
  line-height: 1;
}
.principles h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
  font-weight: 500;
}
