/* Tokens from Vault1 design system: palatino-burgundy (editorial, warm serif). */
:root {
  --pb-burgundy-700: #5c2233;
  --pb-burgundy-600: #7c3043;
  --pb-burgundy-500: #a3415a;
  --pb-burgundy-100: #f5eaed;
  --pb-cream-50: #f5f4f0;
  --pb-cream-200: #ebe7e3;
  --pb-cream-300: #e0ddd5;
  --pb-paper: #faf9f7;
  --pb-ink-900: #3a3a3a;
  --pb-ink-700: #4a4a4a;
  --pb-ink-500: #6a6a6a;
  --pb-border: #dddddd;
  --pb-border-soft: #e0ddd5;

  --font-serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-sm: 4px;
  --radius-md: 6px;
  --line-height-body: 1.618;
  --line-height-tight: 1.3;
  --measure: 56rem;   /* width of the centered content column */

  --fg: var(--pb-ink-700);
  --fg-strong: var(--pb-ink-900);
  --fg-muted: var(--pb-ink-500);
  --bg: var(--pb-cream-50);
  --bg-surface: var(--pb-paper);
  --accent: var(--pb-burgundy-600);
  --accent-hover: var(--pb-burgundy-500);
  --accent-tint: var(--pb-burgundy-100);
  --border: var(--pb-border);
  --border-soft: var(--pb-border-soft);

  --edu: var(--pb-burgundy-600);   --edu-tint: #f3e6ea;
  --proj: #a8792f;                 --proj-tint: #f4ecdd;
  --work: #35706b;                 --work-tint: #e2eeec;
  --focus-ring: 0 0 0 2px var(--accent-tint), 0 0 0 3px var(--accent);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  line-height: var(--line-height-body);
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 5vw, 2.5rem) 4rem;
}

/* Header */
header { text-align: center; }
.avatar {
  display: block;
  width: 8.5rem;
  height: 8.5rem;
  margin: 0 auto 1.2rem;
  border-radius: 999px;
  object-fit: cover;
  object-position: 50% 42%;
  border: 1px solid var(--border-soft);
  box-shadow: 0 6px 20px rgba(60, 40, 45, 0.10);
}
h1 {
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 700;
  color: var(--fg-strong);
  line-height: var(--line-height-tight);
  margin: 0;
  letter-spacing: 0.01em;
}
.subtitle {
  color: var(--fg-muted);
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
}
.subtitle a { color: var(--accent); text-decoration: none; }
.subtitle a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Link pills */
.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.links a:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-tint);
}
.links svg { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }

a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* Section */
section { margin-top: clamp(2.5rem, 7vw, 3.5rem); }
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin: 0 0 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* Education and work entries */
.entry { padding: 1.1rem 0; }
.entry + .entry { border-top: 1px solid var(--border-soft); }
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.school { font-weight: 700; color: var(--fg-strong); font-size: 1.12rem; }
.school a { color: var(--accent); text-decoration: none; }
.school a:hover { color: var(--accent-hover); text-decoration: underline; }
.place { color: var(--fg-strong); font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.degree-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  font-style: italic;
  color: var(--fg);
  margin-top: 0.15rem;
}
.dates { color: var(--fg-muted); white-space: nowrap; font-size: 0.95rem; }
.detail { margin: 0.5rem 0 0; font-size: 0.95rem; color: var(--fg); }
.detail .label { font-style: italic; color: var(--fg-muted); }

.bullets { margin: 0.6rem 0 0; padding-left: 1.2rem; font-size: 0.95rem; color: var(--fg); }
.bullets li { margin: 0.4rem 0; }
.bullets li::marker { color: var(--accent); }

/* Summary */
.summary { margin: 0; font-size: 1.05rem; color: var(--fg); }
.summary + .summary { margin-top: 1rem; }
.role { color: var(--accent); font-weight: 700; }

/* Skills */
.skills { margin: 0; padding: 0; list-style: none; }
.skills li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 0;
}
.skills li + li { border-top: 1px solid var(--border-soft); }
.skill-name { font-weight: 700; color: var(--fg-strong); font-size: 1.05rem; }
.skill-note { font-style: normal; color: var(--fg); font-size: 0.95rem; text-align: left; flex-basis: 100%; }

footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* On-this-page rail: fixed left nav with scroll-spy */
html { scroll-behavior: smooth; }
.toc { position: fixed; top: 50%; transform: translateY(-50%); left: max(1rem, calc((100vw - var(--measure)) / 2 - 10.5rem)); width: 9rem; z-index: 50; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc a { display: block; padding: 0.7rem 0 0.7rem 1rem; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--fg-muted); font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.25; transition: color 0.15s, border-color 0.15s; }
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 700; }
.toc a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
@media (max-width: 1290px) { .toc { display: none; } }

/* Project page header */
.backlink {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.backlink:hover { color: var(--accent); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--proj);
  margin: 0 0 0.6rem;
}
.project h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
.project-meta { color: var(--fg-muted); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em; margin: 0.6rem 0 0; }

/* Project gallery: one card per project, each with a cover slot */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1.4rem;
}
.pcard {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.pcover {
  aspect-ratio: 16 / 9;
  background: var(--bg-surface);
  background: color-mix(in srgb, var(--pc, var(--proj)) 10%, var(--bg-surface));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.pcover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pcard:hover .pcover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(60, 40, 45, 0.12); }
.pcard:focus-visible { outline: none; }
.pcard:focus-visible .pcover { box-shadow: var(--focus-ring); }
.ptitle {
  margin: 0.7rem 0 0;
  font-weight: 700;
  font-size: 1rem;
  line-height: var(--line-height-tight);
  color: var(--pc, var(--fg-strong));
}
.pcard:hover .ptitle { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.pmeta {
  margin: 0.3rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* Report: abstract, sections, tables, figures, equations, references */
.report h3 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin: 2rem 0 0.6rem;
}
.report h3 .num { color: var(--fg-muted); font-family: var(--font-mono); font-size: 0.8rem; margin-right: 0.5rem; }
.report p { margin: 0 0 1rem; }
.report .lead { font-weight: 700; color: var(--fg-strong); }

.abstract {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  margin: 0;
}
.abstract h2 {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border: 0;
  margin: 0 0 0.5rem;
  padding: 0;
}
.abstract p { margin: 0; font-size: 0.95rem; }

.authors { margin: 0.9rem 0 0; font-size: 0.95rem; color: var(--fg); }
.authors .affil { display: block; color: var(--fg-muted); font-size: 0.85rem; margin-top: 0.15rem; }

figure.tbl, figure.fig { margin: 1.6rem 0; }
.tbl-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.45;
}
table.data th, table.data td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.6rem;
}
table.data thead th {
  color: var(--fg-strong);
  font-weight: 700;
  border-top: 2px solid var(--fg-strong);
  border-bottom: 1px solid var(--fg-strong);
  white-space: nowrap;
}
table.data tbody tr + tr td { border-top: 1px solid var(--border-soft); }
table.data tbody tr:last-child td { border-bottom: 2px solid var(--fg-strong); }
table.data .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data th.n { text-align: right; }

figcaption.cap {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.5;
}
figcaption.cap .lbl { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-strong); margin-right: 0.4rem; }

figure.fig a { display: block; border: 1px solid var(--border-soft); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-surface); }
figure.fig img { display: block; width: 100%; height: auto; }

.eq {
  margin: 1.2rem 0;
  text-align: center;
}
.eq .expr { font-size: 1.05rem; color: var(--fg-strong); }
.eq .reading { display: block; margin-top: 0.5rem; font-size: 0.8rem; color: var(--fg-muted); font-style: italic; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 0.15rem; }
.frac .num { border-bottom: 1px solid var(--fg-strong); padding: 0 0.35rem 0.1rem; }
.frac .den { padding: 0.1rem 0.35rem 0; }

.cite { color: var(--accent); text-decoration: none; white-space: nowrap; }
.cite:hover { text-decoration: underline; }

ol.refs { margin: 0; padding-left: 1.4rem; font-size: 0.85rem; color: var(--fg); }
ol.refs li { margin: 0 0 0.7rem; line-height: 1.5; }
ol.refs li::marker { color: var(--fg-muted); font-family: var(--font-mono); font-size: 0.8rem; }
ol.refs a { color: var(--accent); text-decoration: none; word-break: break-word; }
ol.refs a:hover { text-decoration: underline; }

.findings { margin: 0; padding-left: 1.2rem; font-size: 0.95rem; }
.findings li { margin: 0.5rem 0; }
.findings li::marker { color: var(--accent); }

/* Video embed */
.video { margin: 0; }
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--pb-ink-900);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}
.video-frame img, .video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.video-frame img { object-fit: cover; }
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4.5rem;
  height: 3.1rem;
  border-radius: var(--radius-md);
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(60, 40, 45, 0.35);
  transition: background 0.15s, transform 0.15s;
}
.video-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 0.55rem 0 0.55rem 0.92rem;
  border-color: transparent transparent transparent var(--pb-paper);
}
.video-frame:hover .video-play { background: var(--accent-hover); transform: translate(-50%, -50%) scale(1.06); }
.video-frame:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.video-caption {
  margin: 0.7rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-align: center;
}
