/* ============================================================
   ImageTime — project page
   Editorial / academic minimalist theme
   ============================================================ */

:root {
  --bg:        #faf8f2;
  --bg-2:      #f1efe7;
  --panel:     #ffffff;
  --ink:       #191917;
  --ink-2:     #55534b;
  --muted:     #8a8779;
  --line:      #e6e2d6;
  --line-2:    #d8d3c5;
  --accent:    #8257e6;
  --accent-2:  #6a40cf;
  --hl:        #f6e7a1;
  --good:      #ec9f9a;
  --bad:       #cfe6f4;

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1140px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(25,25,23,.04), 0 8px 30px rgba(25,25,23,.06);
}

[data-theme="dark"] {
  --bg:        #16150f;
  --bg-2:      #1f1d15;
  --panel:     #211f17;
  --ink:       #f3efe4;
  --ink-2:     #c7c3b5;
  --muted:     #918d7f;
  --line:      #33301f;
  --line-2:    #3e3a27;
  --accent:    #bfa6ff;
  --accent-2:  #d3c2ff;
  --hl:        #5a5326;
  --good:      #b8635c;
  --bad:       #355a72;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 34px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ---------- shared type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 22px;
}
h2.section-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 0 0 18px;
}
h2.section-title em { font-style: italic; color: var(--accent); }
.lead {
  font-size: 1.12rem;
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0 0 8px;
}
.accent { color: var(--accent); }
.serif { font-family: var(--font-serif); }

/* ============================================================
   NAV
   ============================================================ */
header.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; gap: 22px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.32rem; font-weight: 600; letter-spacing: -.01em;
  color: var(--ink); white-space: nowrap;
}
.brand em { font-style: italic; color: var(--accent); }
.nav-links { display: flex; gap: 22px; margin-left: 8px; }
.nav-links a {
  font-size: .92rem; color: var(--ink-2); font-weight: 500;
}
.nav-links a:hover { color: var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-size: .9rem; font-weight: 500;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--ink); color: var(--ink); }
.btn svg { width: 16px; height: 16px; }
.btn-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-dark:hover { background: #000; color: #fff; }
[data-theme="dark"] .btn-dark { background: var(--ink); color: var(--bg); }
.icon-btn {
  width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%;
}
.nav-cta { }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding: 84px 0 40px; }
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 480;
  font-size: clamp(2.9rem, 7.4vw, 5.6rem);
  line-height: .98;
  letter-spacing: -.02em;
  margin: 0 0 26px;
}
.hero h1 .l2 { display: block; font-style: italic; color: var(--accent); }
.hero .lead { font-size: 1.2rem; max-width: 60ch; margin-bottom: 30px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }

.authors { color: var(--ink-2); font-size: .98rem; }
.authors .names { font-weight: 600; color: var(--ink); }
.authors .names a { color: var(--ink); border-bottom: 1px solid var(--line-2); }
.authors .names a:hover { color: var(--accent); border-color: var(--accent); }
.authors .aff { color: var(--muted); font-size: .92rem; margin-top: 3px; }
.authors sup { color: var(--accent); font-weight: 700; }

/* ---------- framed teaser panel ---------- */
.panel {
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.panel-head .r { color: var(--ink-2); }
.teaser-panel { margin-top: 44px; }
.teaser-panel img { width: 100%; }

/* PDF paper preview — constrained to a centered, paper-proportioned column */
.pdf-panel { max-width: 880px; margin-left: auto; margin-right: auto; }
.pdf-panel .panel-head .r { text-transform: none; letter-spacing: .02em; }
.pdf-panel .panel-head a { color: var(--accent); }
.pdf-panel .panel-head a:hover { color: var(--accent-2); }
.pdf-embed { background: #525659; }
.pdf-embed iframe {
  width: 100%;
  aspect-ratio: 8.5 / 11;   /* US-Letter page proportion */
  height: auto;
  border: 0; display: block;
}
/* fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1) {
  .pdf-embed iframe { height: 1140px; }
}

/* ============================================================
   STATS BAND
   ============================================================ */
.stats {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 80px; padding: 40px 0 48px;
}
.stats-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 30px;
}
.stats-head .sync { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #46b06a; display: inline-block; }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px;
}
.stat .num {
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.2rem); line-height: 1; letter-spacing: -.02em;
}
.stat .lab {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .04em;
  color: var(--muted); margin-top: 12px;
}
.stat-sub {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px;
}
.chip {
  font-family: var(--font-mono); font-size: .76rem; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 14px;
  background: var(--panel);
}
.chip b { color: var(--ink); }

/* ============================================================
   SECTIONS
   ============================================================ */
section.block { padding: 84px 0; }
section.block.tight { padding: 64px 0; }
.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start;
}

/* pull-quote */
.pullquote {
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem); line-height: 1.3;
  border-left: 3px solid var(--accent); padding-left: 24px; color: var(--ink);
  margin: 0;
}
.pullquote .q-accent { color: var(--accent); }
.prose p { color: var(--ink-2); margin: 0 0 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }

/* divider line label */
.kicker {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 18px;
  display: flex; align-items: center; gap: 14px;
}
.kicker::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ---------- failure mode tags ---------- */
.fails { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 34px; }
.fail {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 18px 18px 16px;
  background: var(--panel);
}
.fail .bad-tag {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em;
  display: inline-block; background: var(--hl); color: #6a5a14;
  padding: 2px 8px; border-radius: 5px; text-decoration: line-through;
  text-decoration-thickness: 1.5px; margin-bottom: 10px;
}
[data-theme="dark"] .fail .bad-tag { color: #e8d98e; }
.fail .fail-name { font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.fail p { font-size: .9rem; color: var(--ink-2); margin: 0; line-height: 1.5; }

/* ============================================================
   CAPABILITY TREE
   ============================================================ */
.tree {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
  margin-top: 40px; border: 1px solid var(--line-2); border-radius: var(--radius);
  overflow: hidden; background: var(--panel);
}
.tnode {
  padding: 22px 16px; text-align: center; position: relative;
  border-right: 1px solid var(--line);
}
.tnode:last-child { border-right: none; }
.tnode .lv {
  font-family: var(--font-mono); font-size: .74rem; font-weight: 600;
  letter-spacing: .06em; color: #fff; background: var(--accent);
  width: 38px; height: 38px; line-height: 38px; border-radius: 50%;
  margin: 0 auto 12px; display: block;
}
.tnode .tname { font-weight: 600; font-size: .96rem; }
.tnode .tdesc { font-size: .8rem; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.tnode .arrow { position: absolute; right: -8px; top: 30px; color: var(--line-2); z-index: 2; }
/* dopamine arc: lavender (easy) → through candy tones → rose (hard) */
.tnode:nth-child(1) .lv { background: #8b7cf0; }
.tnode:nth-child(2) .lv { background: #6aa9e9; }
.tnode:nth-child(3) .lv { background: #4fc4b8; }
.tnode:nth-child(4) .lv { background: #9ccf5f; }
.tnode:nth-child(5) .lv { background: #f6c453; }
.tnode:nth-child(6) .lv { background: #f49261; }
.tnode:nth-child(7) .lv { background: #ee6f9b; }
.tree-note { font-size: .9rem; color: var(--muted); margin-top: 16px; font-family: var(--font-mono); letter-spacing: .02em; }

/* score scales row */
.scales { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.scale {
  border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 18px; background: var(--panel);
  flex: 1; min-width: 220px;
}
.scale .st { font-family: var(--font-mono); font-size: .78rem; color: var(--accent); letter-spacing: .04em; }
.scale .sn { font-weight: 600; margin: 4px 0 2px; }
.scale p { font-size: .88rem; color: var(--ink-2); margin: 0; line-height: 1.5; }

/* ============================================================
   RESULTS / TABLE
   ============================================================ */
.results-grid { display: grid; grid-template-columns: 0.95fr 1.05fr; gap: 40px; align-items: start; }
.lb {
  width: 100%; border-collapse: collapse; font-size: .95rem;
  border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden;
}
.lb thead th {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  text-align: right; padding: 14px 14px; border-bottom: 1px solid var(--line-2);
  background: var(--bg-2);
}
.lb thead th:first-child { text-align: left; }
.lb tbody td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--line); }
.lb tbody tr:last-child td { border-bottom: none; }
.lb tbody td:first-child { text-align: left; font-weight: 600; }
.lb .rank { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; margin-right: 8px; }
.lb .ov { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb .cell-score {
  display: inline-block; min-width: 52px; text-align: center; padding: 3px 8px;
  border-radius: 6px; font-variant-numeric: tabular-nums; color: #4a2a1a;
}
[data-theme="dark"] .lb .cell-score { color: #11100c; }
.lb tbody tr:first-child td:first-child::before { content: "🏆 "; }

.curve-cap { font-size: .9rem; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* ============================================================
   FINDINGS
   ============================================================ */
.findings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 44px; }
.finding {
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 26px 24px;
  background: var(--panel); position: relative;
}
.finding .fnum {
  font-family: var(--font-serif); font-size: 2.4rem; color: var(--accent);
  line-height: 1; font-weight: 500;
}
.finding h3 { font-family: var(--font-serif); font-weight: 600; font-size: 1.3rem; margin: 14px 0 10px; line-height: 1.2; }
.finding p { font-size: .96rem; color: var(--ink-2); margin: 0; line-height: 1.55; }

/* ============================================================
   GALLERY
   ============================================================ */
.gal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 40px; }
.gal-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.gcard {
  border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); cursor: zoom-in; transition: transform .15s ease, box-shadow .15s ease;
}
.gcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.gcard img { width: 100%; aspect-ratio: auto; }
.gcard .gcap {
  padding: 12px 16px; font-size: .86rem; color: var(--ink-2);
  border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px;
}
.gcard .gcap span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .gcap .tag { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); white-space: nowrap; flex: none; }

/* domain filter bar */
.gal-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.gal-filter button {
  font-family: var(--font-mono); font-size: .73rem; letter-spacing: .02em;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2);
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.gal-filter button:hover { color: var(--ink); border-color: var(--ink); }
.gal-filter button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.gcard.hide { display: none; }

/* dense contact-sheet mode (shown when "All" is selected) */
.gal-grid.dense { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.gal-grid.dense .gcard { border-radius: 9px; }
.gal-grid.dense .gcap { display: none; }

/* ============================================================
   FIGURE ALBUM (flip-through viewer)
   ============================================================ */
.album { margin-top: 34px; }
.album-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px; min-height: 360px;
}
.album-stage img {
  max-height: 58vh; max-width: 100%; width: auto; object-fit: contain; cursor: zoom-in;
  border-radius: 6px;
}
.album-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--panel) 86%, transparent); color: var(--ink);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s ease, background .12s ease;
}
.album-nav:hover { border-color: var(--ink); background: var(--panel); }
.album-nav.prev { left: 16px; }
.album-nav.next { right: 16px; }
.album-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.album-tabs button {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .02em;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.album-tabs button:hover { color: var(--ink); border-color: var(--ink); }
.album-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.album-cap { margin-top: 14px; }

/* ============================================================
   CITATION
   ============================================================ */
.cite-box {
  border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); margin-top: 30px;
}
.cite-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.cite-box pre {
  margin: 0; padding: 20px 18px; overflow-x: auto;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; color: var(--ink-2);
}
.copy-btn {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2);
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--ink); }

/* ============================================================
   FOOTER
   ============================================================ */
footer.foot {
  border-top: 1px solid var(--line); background: var(--bg-2);
  padding: 50px 0 60px; margin-top: 40px;
}
.foot-grid { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.foot .brand2 { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; }
.foot .brand2 em { font-style: italic; color: var(--accent); }
.foot p { color: var(--muted); font-size: .9rem; max-width: 40ch; margin: 12px 0 0; }
.foot-links { display: flex; gap: 40px; }
.foot-links .col h4 {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px; font-weight: 500;
}
.foot-links .col a { display: block; color: var(--ink-2); font-size: .92rem; margin-bottom: 8px; }
.foot-links .col a:hover { color: var(--accent); }
.foot-bottom {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted); font-family: var(--font-mono); letter-spacing: .02em;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(15,14,10,.88); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .lb-close {
  position: absolute; top: 22px; right: 28px; color: #fff; font-size: 2rem;
  background: none; border: none; cursor: pointer; line-height: 1;
}
.lightbox .lb-cap {
  position: absolute; bottom: 26px; left: 0; right: 0; text-align: center;
  color: #f3efe4; font-family: var(--font-mono); font-size: .82rem; letter-spacing: .03em;
}

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .two-col, .results-grid { grid-template-columns: 1fr; gap: 32px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .tree { grid-template-columns: repeat(2, 1fr); }
  .tnode { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .tnode .arrow { display: none; }
  .findings { grid-template-columns: 1fr; }
  .gal-grid, .gal-grid.cols3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .nav-inner { padding: 12px 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 56px 0 30px; }
  .nav-cta-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; opacity: 1; transform: none; }
}
