/* ============================================================
 * EDITORIAL — full design system port from direction-editorial.jsx
 * Cool bone paper, Source Serif body, Source Sans UI, ox-blood accent.
 * ============================================================ */

:root {
  --paper:        #f4f0e6;
  --paper-deep:   #ebe5d4;
  --paper-card:   #fbf8ef;
  --paper-callout:#ede7d6;

  --ink:          #1d1b17;
  --ink-soft:     #3b362c;
  --muted:        #8a7f6e;
  --muted-light:  #b0a692;

  --rule:         #d8d0be;
  --rule-light:   #e4ddcc;

  --accent:       #a64326;
  --accent-deep:  #7d2e1a;
  --accent-soft:  #efe0d5;

  --serif:        "Source Serif 4", Georgia, serif;
  --display:      "Source Serif 4", Georgia, serif;
  --ui:           "Source Sans 3", Inter, -apple-system, sans-serif;
  --mono:         "JetBrains Mono", ui-monospace, monospace;
}

/* Dark theme tokens (kept minimal — site is editorial paper by default) */
[data-theme="dark"] {
  --paper:        #1c1a15;
  --paper-deep:   #232017;
  --paper-card:   #1f1c16;
  --paper-callout:#262218;
  --ink:          #f4f0e6;
  --ink-soft:     #d6cfbe;
  --muted:        #8a7f6e;
  --muted-light:  #6b6356;
  --rule:         #3a352b;
  --rule-light:   #2a2620;
  --accent:       #d97a5c;
  --accent-deep:  #c45b3c;
  --accent-soft:  #4a2d22;
}

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

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }

em  { font-style: italic; }
strong { font-weight: 600; color: var(--ink); }

/* ============================================================
 * MASTHEAD (sticky)
 * ============================================================ */
.masthead {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 80px;
  font-family: var(--ui); font-size: 13px;
  border-bottom: 1px solid var(--rule-light);
}
.masthead .brand {
  font-family: var(--serif); font-weight: 500;
  font-size: 15px; letter-spacing: 0.1px;
  color: var(--ink); border: none;
}
.masthead nav {
  display: flex; gap: 32px; align-items: center;
  color: var(--ink-soft);
}
.masthead nav a {
  color: var(--ink-soft); border: none; text-decoration: none;
  cursor: pointer; font-family: var(--ui); font-size: 13px;
}
.masthead nav a:hover { color: var(--accent); }
.masthead nav .sep { width: 1px; height: 16px; background: var(--rule); }
.masthead nav .cv {
  font-family: var(--ui);
}

.theme-toggle {
  background: transparent; border: 1px solid var(--rule);
  color: var(--ink-soft); cursor: pointer; padding: 4px 9px;
  border-radius: 2px; font-size: 12px; font-family: var(--ui);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
 * FLOATING TOC RAIL
 * ============================================================ */
.toc-rail {
  position: fixed; top: 50%; left: 24px;
  transform: translateY(-50%);
  z-index: 30; font-family: var(--ui);
  padding: 14px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.toc-rail:hover {
  background: var(--paper);
  border-color: var(--rule-light);
  box-shadow: 0 8px 28px rgba(40,30,15,0.08);
}
.toc-rail .toc-item {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; padding: 5px 0;
  color: var(--ink-soft);
  font-size: 12px; font-weight: 400;
  white-space: nowrap;
}
.toc-rail .toc-item .dash {
  display: inline-block; width: 6px; height: 2px;
  background: var(--muted-light);
  border-radius: 2px; flex: none;
  transition: width 0.18s, background 0.18s;
}
.toc-rail:hover .toc-item .dash { background: var(--muted); }
.toc-rail .toc-item .label {
  opacity: 0; max-width: 0; overflow: hidden;
  transition: opacity 0.18s, max-width 0.18s;
}
.toc-rail:hover .toc-item .label { opacity: 1; max-width: 240px; }
.toc-rail .toc-item.active { color: var(--accent); font-weight: 500; }
.toc-rail .toc-item.active .dash { width: 18px; background: var(--accent); }

@media (max-width: 1100px) {
  .toc-rail { display: none; }
}

/* ============================================================
 * PAGE LAYOUT
 * ============================================================ */
.page {
  max-width: 1280px; margin: 0 auto;
  padding: 0 80px 160px;
}
.page main {
  max-width: 1120px; margin: 0 auto;
}

/* ============================================================
 * HERO
 * ============================================================ */
.hero {
  padding: 140px 80px 32px;
  max-width: 1280px; margin: 0 auto;
}
.hero-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 72px;
  align-items: start;
}
.portrait-frame {
  width: 200px; height: 250px;
  border-radius: 3px; overflow: hidden;
  background: var(--paper-deep);
}
.portrait-frame img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 300;
  font-size: 88px;
  line-height: 0.98;
  letter-spacing: -2.2px;
  margin: 0 0 14px;
  color: var(--ink);
}
.hero .subtitle {
  font-family: var(--ui);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.1px;
  margin: 0 0 40px;
}
.hero .lede,
.hero p {
  font-size: 19px; line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 18px;
  max-width: 720px;
}
.hero .lede:last-of-type, .hero p:last-of-type { margin-bottom: 0; }

.btn-row {
  display: flex; gap: 10px; margin-top: 40px; flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-radius: 2px;
  font-weight: 500;
  border: 1px solid var(--rule);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

/* ============================================================
 * SECTION HEADS
 * ============================================================ */
.section-head {
  margin-bottom: 32px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--ink);
}
.section-head .num {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}

section.research,
section.pubs,
section.models,
section.teaching,
section.contact {
  padding-top: 32px;
}

section.research { padding-top: 16px; }

/* §1/§2/etc. paragraph indicators hidden per user preference */
.section-head .num { display: none; }
.section-head { margin-bottom: 16px; }

/* ============================================================
 * RESEARCH — drop-cap intro + two-column threads
 * ============================================================ */
.research-intro {
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 60px;
  max-width: 820px;
}
.research-intro::first-letter {
  font-family: var(--display);
  font-weight: 400;
  font-size: 76px;
  float: left;
  line-height: 0.85;
  margin-right: 12px;
  margin-top: 8px;
  color: var(--accent);
  letter-spacing: -2px;
}

.threads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}
.thread {
  display: flex; flex-direction: column;
}
.thread-head {
  position: relative;
  padding-left: 56px;
  margin-bottom: 28px;
}
.thread-head .numeral {
  position: absolute; left: 0; top: 4px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: 44px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}
.thread-head .rule-and-title {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}
.thread-head h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.thread .body {
  flex: 1;
}
.thread .body p { margin: 0 0 20px; }
.thread .body p:last-child { margin-bottom: 28px; }

/* Editorial figure (with cap rule above caption) */
.ed-figure {
  margin: 32px 0 0;
  padding: 0;
}
.ed-figure .plate {
  aspect-ratio: 16 / 10;
  background: var(--paper-deep);
  border: 1px solid var(--rule-light);
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  padding: 12px; overflow: hidden;
}
.ed-figure .plate img {
  max-width: 100%; max-height: 100%;
  display: block;
}
.ed-figure figcaption {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--rule-light);
  font-family: var(--ui);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.ed-figure figcaption .tag {
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--accent);
  margin-right: 8px;
}

/* Project list inside thread */
.project-list {
  margin-top: 28px;
  border-top: 1px solid var(--rule);
}
.project-list a {
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  cursor: pointer;
}
.project-list a:hover { background: var(--paper-deep); }
.project-list .project-title {
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 4px;
}
.project-list .project-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}
.project-list .project-cta {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
}

/* ============================================================
 * DEEP-DIVE COLLAPSIBLES (Plural / Neurosymbolic / Attention)
 * ============================================================ */
.deep-dives {
  margin-top: 96px;
}
.deep-dives .part-heading {
  font-family: var(--display);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 64px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.deep-dives .part-heading:first-child { margin-top: 0; }

details {
  border-bottom: 1px solid var(--rule-light);
  padding: 6px 0;
}
details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 0 14px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.2px;
  color: var(--ink);
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  font-family: var(--ui);
  font-weight: 400;
  font-size: 22px;
  color: var(--muted);
  margin-left: 24px;
  transition: transform 0.18s;
}
details[open] summary::after { content: "−"; color: var(--accent); }

details .section-preview {
  margin: 0 0 18px;
  font-family: var(--ui);
  font-size: 14px;
  color: var(--muted);
}

.detail-content {
  padding: 16px 0 32px;
}
.detail-content p { margin: 0 0 18px; }
.detail-content h4 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  margin: 32px 0 12px;
  color: var(--ink);
  letter-spacing: -0.1px;
}

.detail-content figure { margin: 32px 0; padding: 0; }
.detail-content .plate {
  background: var(--paper-deep);
  border: 1px solid var(--rule-light);
  border-radius: 2px;
  padding: 18px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.detail-content .plate img {
  max-width: 100%; height: auto; display: block;
}
.detail-content figcaption {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--rule-light);
  font-family: var(--ui);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.detail-content figcaption .tag {
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--accent);
  margin-right: 8px;
}

.equation-block {
  margin: 22px 0;
  padding: 14px 18px;
  background: var(--paper-callout);
  border-left: 2px solid var(--accent-soft);
  font-size: 16px;
  overflow-x: auto;
}

/* ============================================================
 * PUBLICATIONS — year buckets
 * ============================================================ */
.pub-year {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 28px;
  margin-bottom: 32px;
}
.pub-year .year-label {
  font-family: var(--display);
  font-weight: 300;
  font-size: 48px;
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1;
}
.pub-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-light);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
}
.pub-row:last-child { border-bottom: none; }
.pub-row .authors { color: var(--ink-soft); font-size: 14px; }
.pub-row .title-it {
  font-style: italic; font-size: 17px; margin: 3px 0 2px; color: var(--ink);
}
.pub-row .venue { color: var(--muted); font-size: 13px; }
.pub-row .chips { display: flex; gap: 8px; }
.chip {
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid var(--rule);
  background: transparent;
  font-weight: 500;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
 * MODELS
 * ============================================================ */
.models-intro {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 720px;
}
.model-list { display: grid; gap: 14px; }
.model-card {
  position: relative;
  padding: 24px 28px;
  background: var(--paper-deep);
  border-radius: 3px;
  transition: background 0.15s;
}
.model-card:hover { background: #e4dcc6; }
[data-theme="dark"] .model-card:hover { background: #2c2820; }
.model-card a.main {
  text-decoration: none;
  color: var(--ink);
  display: block;
  border: none;
}
.model-card .m-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 6px;
}
.model-card .m-body {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.model-card .m-chip {
  margin-top: 12px;
  display: inline-block;
  color: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
 * TEACHING
 * ============================================================ */
.teach-list { border-top: 1px solid var(--rule); }
.teach-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  font-size: 16px;
}
.teach-row .year {
  font-family: var(--ui);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.teach-row .title-it {
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
}
.teach-row .title-it a {
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.teach-row .title-it a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.teach-row .venue { font-size: 14px; color: var(--muted); }
.teach-row .role {
  font-family: var(--ui);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.3px;
}

/* ============================================================
 * CONTACT
 * ============================================================ */
section.contact { padding-bottom: 40px; }
.contact-email {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.6;
}
.contact-email .mono {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  letter-spacing: 0.3px;
}
.contact-email .mono .at { color: var(--muted); }

.colophon {
  margin-top: 100px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-light);
  font-family: var(--ui);
  font-size: 12px;
  color: var(--muted-light);
  display: flex;
  justify-content: space-between;
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 900px) {
  .masthead { padding: 16px 24px; }
  .masthead nav { gap: 18px; font-size: 12px; }
  .masthead nav .sep { display: none; }
  .hero { padding: 60px 24px 60px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .portrait-frame { width: 160px; height: 200px; }
  .hero h1 { font-size: 56px; letter-spacing: -1.4px; }
  .page { padding: 0 24px 80px; }
  .threads { grid-template-columns: 1fr; gap: 56px; }
  .pub-year { grid-template-columns: 1fr; gap: 8px; }
  .pub-year .year-label { font-size: 32px; }
  .pub-row { grid-template-columns: 1fr; }
  .teach-row { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
}
