/* ─────────────────────────────────────────────────────────────────────
   Justin / Ziheng Zhong — personal site
   Engineering notebook aesthetic
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* ── Colors ── light */
  --bg: #ffffff;
  --ink: oklch(0.20 0.010 60);
  --muted: oklch(0.55 0.008 60);
  --faint: oklch(0.78 0.006 60);
  --hair: oklch(0.92 0.004 60);
  --grid: oklch(0.955 0.003 60);
  --paper: oklch(0.985 0.003 60);

  /* accent (will be overwritten by tweak) */
  --accent: oklch(0.64 0.19 35);
  --accent-soft: oklch(0.95 0.04 35);

  /* ── Type ── */
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --serif: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;

  /* ── Sizing ── */
  --max: 1240px;
  --gutter: clamp(20px, 4vw, 56px);
  --baseline: 8px;
  --density: 1;

  /* ── Background pattern ── set by tweak */
  --bg-image: none;
}

[data-theme="dark"] {
  --bg: oklch(0.155 0.008 60);
  --ink: oklch(0.94 0.005 60);
  --muted: oklch(0.62 0.008 60);
  --faint: oklch(0.36 0.006 60);
  --hair: oklch(0.26 0.006 60);
  --grid: oklch(0.21 0.005 60);
  --paper: oklch(0.18 0.006 60);
  --accent: oklch(0.72 0.18 35);
  --accent-soft: oklch(0.28 0.06 35);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; padding: 0; margin: 0; }

html {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "ss02", "cv02", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background patterns ── */
body[data-bg="grid"] {
  --bg-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
body[data-bg="dots"] {
  --bg-image: radial-gradient(circle, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px;
}
body[data-bg="lines"] {
  --bg-image: linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 100% 28px;
}

/* ── Selection ── */
::selection { background: var(--accent); color: var(--bg); }

/* ── Custom cursor ring ── */
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 24px; height: 24px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9999;
  mix-blend-mode: difference;
  transition: width 120ms ease, height 120ms ease, opacity 200ms;
  opacity: 0;
}
.cursor-ring.visible { opacity: 0.5; }
.cursor-ring.hovering { width: 40px; height: 40px; opacity: 0.9; }
.cursor-coords {
  position: fixed;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
  z-index: 9998;
  transform: translate(16px, 16px);
  opacity: 0;
  transition: opacity 200ms;
  letter-spacing: -0.01em;
}
.cursor-coords.visible { opacity: 0.85; }
body.no-cursor .cursor-ring,
body.no-cursor .cursor-coords { display: none; }
@media (hover: none), (pointer: coarse) {
  .cursor-ring, .cursor-coords { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────
   HEADER
   ───────────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hair);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  font-size: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand .prompt { color: var(--muted); }
.brand .name { color: var(--ink); }
.brand .path { color: var(--muted); }
.brand .blink {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: -2px;
  animation: blink 1.05s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.site-nav {
  display: flex;
  gap: 2px;
  align-items: center;
  font-size: 12px;
}
.site-nav a {
  padding: 8px 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  position: relative;
  transition: color 160ms;
}
.site-nav a::before { content: "["; opacity: 0; margin-right: 2px; transition: opacity 160ms; }
.site-nav a::after { content: "]"; opacity: 0; margin-left: 2px; transition: opacity 160ms; }
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::before, .site-nav a:hover::after { opacity: 1; }
.site-nav a.current { color: var(--ink); }
.site-nav a.current::before, .site-nav a.current::after { opacity: 1; color: var(--accent); }

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  align-items: center;
}

@media (max-width: 520px) {
  .header-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    padding-inline: 12px;
  }
  .brand .path,
  .brand .blink,
  .header-actions {
    display: none;
  }
  .site-nav {
    justify-content: center;
    flex-wrap: wrap;
  }
  .site-nav a {
    padding-inline: 6px;
  }
}

.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  transition: background 160ms, color 160ms;
}
.icon-btn:hover { background: var(--hair); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ─────────────────────────────────────────────────────────────────────
   LAYOUT — sticky sidebar + main column
   ───────────────────────────────────────────────────────────────────── */

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(36px, 6vw, 80px) var(--gutter) 120px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: clamp(40px, 6vw, 96px);
  position: relative;
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 48px; }
}

/* line-number gutter */
.shell::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--gutter) - 16px);
  width: 1px;
  background: var(--hair);
}
@media (max-width: 820px) { .shell::before { display: none; } }

.sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}
@media (max-width: 820px) { .sidebar { position: static; } }

.avatar-frame {
  position: relative;
  width: 168px;
  height: 168px;
}
.avatar-frame .crop {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hair);
  filter: grayscale(0.15) contrast(1.02);
  position: relative;
  z-index: 1;
}
.avatar-frame .crop img { width: 100%; height: 100%; object-fit: cover; }
.avatar-frame .ring {
  position: absolute;
  inset: -10px;
  border: 1px dashed var(--faint);
  border-radius: 50%;
  z-index: 0;
}
.avatar-frame .tag {
  position: absolute;
  bottom: -4px;
  right: -16px;
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--hair);
  padding: 4px 8px;
  color: var(--muted);
  z-index: 2;
  letter-spacing: 0.04em;
}
.avatar-frame .tag .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: 1px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.id-block .name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 8px;
}
.id-block .handle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.id-block .handle .slash { color: var(--accent); }

.id-block .roles {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.7;
}
.id-block .roles .edu-line {
  display: grid;
  grid-template-columns: 44px max-content;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.id-block .roles .edu-line span:last-child { white-space: nowrap; }
.id-block .roles .pill {
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid var(--hair);
  color: var(--ink);
  letter-spacing: 0.04em;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.contact-list li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: baseline;
  color: var(--muted);
}
.contact-list .k { color: var(--faint); }
.contact-list a {
  color: var(--ink);
  border-bottom: 1px dotted var(--faint);
  overflow-wrap: anywhere;
}
.contact-list a:hover { border-bottom-color: var(--accent); color: var(--accent); }

.github-heatmap {
  --heatmap-cell: 10px;
  --heatmap-gap: 3px;
  --heat-0: color-mix(in oklab, var(--hair) 72%, var(--bg));
  --heat-1: oklch(0.82 0.10 145);
  --heat-2: oklch(0.70 0.14 145);
  --heat-3: oklch(0.58 0.16 145);
  --heat-4: oklch(0.40 0.14 145);
  display: grid;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin-top: -8px;
}
.github-heatmap:empty { display: none; }
.heatmap-months,
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(var(--heatmap-weeks), var(--heatmap-cell));
  gap: var(--heatmap-gap);
}
.heatmap-months {
  height: 12px;
  align-items: end;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}
.heatmap-month {
  overflow: hidden;
  white-space: nowrap;
}
.heatmap-grid {
  grid-template-rows: repeat(7, var(--heatmap-cell));
}
.heatmap-cell,
.heatmap-sample {
  width: var(--heatmap-cell);
  height: var(--heatmap-cell);
  border-radius: 2px;
  background: var(--heat-0);
  border: 1px solid color-mix(in oklab, var(--hair) 72%, transparent);
}
.heatmap-cell.level-1,
.heatmap-sample.level-1 { background: var(--heat-1); border-color: transparent; }
.heatmap-cell.level-2,
.heatmap-sample.level-2 { background: var(--heat-2); border-color: transparent; }
.heatmap-cell.level-3,
.heatmap-sample.level-3 { background: var(--heat-3); border-color: transparent; }
.heatmap-cell.level-4,
.heatmap-sample.level-4 { background: var(--heat-4); border-color: transparent; }
.heatmap-cell.is-future {
  opacity: 0;
}
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.social-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.social-row a {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  color: var(--muted);
  transition: color 160ms, border-color 160ms, transform 160ms;
}
.social-row a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.social-row svg { width: 14px; height: 14px; }

/* ─────────────────────────────────────────────────────────────────────
   MAIN COLUMN
   ───────────────────────────────────────────────────────────────────── */

.main { min-width: 0; }

.section {
  position: relative;
  padding: 28px 0 calc(48px * var(--density));
  scroll-margin-top: 88px;
}
.section + .section { border-top: 1px solid var(--hair); padding-top: calc(48px * var(--density)); }

.sec-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
}
.sec-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
  font-weight: 500;
}
.sec-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 3.8vw, 42px);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.sec-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
@media (max-width: 520px) {
  .sec-head { grid-template-columns: auto 1fr; }
  .sec-file { display: none; }
}

.sec-rule {
  font-family: var(--mono);
  color: var(--faint);
  letter-spacing: 0;
  user-select: none;
  font-size: 10px;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  margin: -10px 0 28px;
}

/* ── Hero (home page) ── */
.hero {
  padding-top: 8px;
  padding-bottom: calc(56px * var(--density));
  border-bottom: 1px solid var(--hair);
}
.hero .kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero .kicker::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--accent);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  color: var(--ink);
}
.hero h1 .em,
.hero h1 .hl {
  color: var(--accent);
  font-style: italic;
}
.hero h1 .amp {
  font-family: var(--serif);
  display: inline-block;
  transform: translateY(2px);
  margin: 0 4px;
  color: var(--muted);
}
.hero .lede {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 60ch;
  margin: 0 0 32px;
}
.hl { background: none; padding: 0; }
.hero .meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  border-top: 1px solid var(--hair);
  margin-top: 32px;
}
.hero .meta-grid .cell {
  padding: 16px 16px 16px 0;
  border-right: 1px solid var(--hair);
  font-size: 11px;
}
.hero .meta-grid .cell + .cell { padding-left: 20px; }
.hero .meta-grid .cell:last-child { border-right: 0; }
.hero .meta-grid .k {
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.hero .meta-grid .v {
  color: var(--ink);
  font-weight: 500;
}
.hero .meta-grid .v .accent { color: var(--accent); }
.hero .meta-grid .latest-projects {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  line-height: 1.45;
}
.hero .meta-grid .latest-projects li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

/* ── Prose block ── */
.prose p {
  font-size: 14px;
  line-height: 1.72;
  margin: 0 0 16px;
  color: var(--ink);
  max-width: 62ch;
}
.prose p:last-child { margin-bottom: 0; }
.prose .note {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--muted);
  line-height: 1.4;
  margin: 24px 0;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  max-width: 56ch;
}

/* ── News timeline ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--hair);
  align-items: baseline;
  font-size: 13px;
  transition: padding 240ms ease;
}
.timeline li:last-child { border-bottom: 0; }
.timeline li:hover { padding-left: 8px; }
.timeline .date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.timeline .ev { color: var(--ink); line-height: 1.55; }

/* ── Education / experience rows ── */
.row-list { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--hair);
  position: relative;
}
.row:last-child { border-bottom: 0; }
.row .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}
.row .sub {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--muted);
  margin: 2px 0 10px;
  font-weight: 400;
}
.row .meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.row .meta .k { color: var(--faint); }
.row .meta .v { color: var(--ink); }
.row .range {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── Skills as a grid ── */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  border-top: 1px solid var(--hair);
  border-left: 1px solid var(--hair);
}
.skill {
  padding: 18px 20px;
  border-right: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: var(--bg);
}
.skill .k {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.skill .k::before {
  content: "";
  width: 4px; height: 4px;
  background: var(--accent);
}
.skill .items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.skill .chip {
  font-size: 11px;
  color: var(--ink);
  border: 1px solid var(--hair);
  padding: 3px 8px;
  transition: border-color 160ms, color 160ms, background 160ms;
}
.skill .chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── Projects (projects.html) ── */
.project {
  display: grid;
  grid-template-columns: 80px 1fr 220px;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--hair);
  position: relative;
}
.project:last-child { border-bottom: 0; }
.project .idx {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.06em;
  padding-top: 4px;
}
.project .body .title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.15;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: -0.01em;
  transition: color 160ms;
  overflow-wrap: anywhere;
}
.project:hover .body .title { color: var(--accent); }
.project .body .tagline {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.project .body .desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 60ch;
  margin: 0;
  overflow-wrap: anywhere;
}
.project .body,
.project .side { min-width: 0; }
.project .side {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project .side .row-k { color: var(--faint); letter-spacing: 0.06em; margin-bottom: 3px; }
.project .side .row-v { color: var(--ink); }
.project .side .stack { display: flex; flex-wrap: wrap; gap: 4px; }
.project .side .lang {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--hair);
  color: var(--ink);
  letter-spacing: 0.04em;
}
.project .side .lang.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.project .repo-meta {
  display: grid;
  gap: 3px;
}
.project .repo-link {
  color: var(--ink);
  overflow-wrap: anywhere;
  transition: color 160ms;
}
.project .repo-link:hover { color: var(--accent); }
.project .repo-fact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
}
.project .arrow {
  position: absolute;
  right: 0;
  top: 32px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 200ms, transform 240ms;
  transform: translateX(-4px);
}
.project .arrow:focus-visible {
  opacity: 1;
  transform: translateX(0);
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}
.project:hover .arrow { opacity: 1; transform: translateX(0); color: var(--accent); }
@media (max-width: 720px) {
  .project { grid-template-columns: 32px minmax(0, 1fr); }
  .project .side { grid-column: 2; }
}

/* ── Leadership block reused on projects page ── */
.lead-block {
  padding: 22px 24px;
  border: 1px solid var(--hair);
  background: var(--paper);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  position: relative;
}
.lead-block::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}
.lead-block .title {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--ink);
}
.lead-block .loc { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.lead-block .desc { font-size: 13px; line-height: 1.65; color: var(--ink); max-width: 56ch; }
.lead-block .range {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-top: 4px;
}

/* ─────────────────────────────────────────────────────────────────────
   CV PAGE
   ───────────────────────────────────────────────────────────────────── */

.cv-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 64px var(--gutter) 120px;
}
.cv-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 24px;
  margin-bottom: 32px;
  gap: 24px;
  flex-wrap: wrap;
}
.cv-head .who h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.cv-head .who .sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.cv-head .who .sub .accent { color: var(--accent); }
.cv-head .meta {
  font-size: 11px;
  text-align: right;
  color: var(--muted);
  line-height: 1.7;
}
.cv-head .meta a { color: var(--ink); border-bottom: 1px dotted var(--faint); }
.cv-head .meta a:hover { border-color: var(--accent); color: var(--accent); }
.cv-head .meta .k { color: var(--faint); margin-right: 6px; }

.cv-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.cv-btn {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--hair);
  padding: 8px 14px;
  letter-spacing: 0.06em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 160ms, color 160ms, background 160ms;
}
.cv-btn:hover { border-color: var(--accent); color: var(--accent); }
.cv-btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cv-btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.cv-btn svg { width: 12px; height: 12px; }

.cv-section { margin-bottom: 40px; }
.cv-section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
}
.cv-section-head .num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.1em;
  padding-top: 4px;
}
.cv-section-head h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  margin: 0;
  letter-spacing: -0.005em;
}
.cv-section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--hair);
  align-self: center;
}

.cv-entry {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--hair);
}
.cv-entry:last-child { border-bottom: 0; }
.cv-entry .h {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 3px;
}
.cv-entry .s {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 8px;
}
.cv-entry .d {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
  max-width: 64ch;
}
.cv-entry .d .label { color: var(--muted); }
.cv-entry .when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-align: right;
}

/* ─────────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--hair);
  background: var(--paper);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.footer-inner .signoff {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
}
.footer-inner .build { font-family: var(--mono); }
.footer-inner .build .ok { color: var(--accent); }

/* ─────────────────────────────────────────────────────────────────────
   Page reveal
   ───────────────────────────────────────────────────────────────────── */

[data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms ease;
}
[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* progress indicator on left margin */
.scroll-progress {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}
@media (max-width: 980px) { .scroll-progress { display: none; } }
.scroll-progress a {
  display: grid;
  grid-template-columns: 16px auto;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  letter-spacing: 0.06em;
  transition: color 200ms;
  position: relative;
}
.scroll-progress a::before {
  content: "";
  width: 12px;
  height: 1px;
  background: var(--faint);
  transition: width 200ms, background 200ms;
}
.scroll-progress a.current {
  color: var(--ink);
}
.scroll-progress a.current::before { width: 24px; background: var(--accent); }
.scroll-progress a:hover { color: var(--ink); }
.scroll-progress a:hover::before { background: var(--accent); }

/* ─────────────────────────────────────────────────────────────────────
   Print (CV)
   ───────────────────────────────────────────────────────────────────── */

@media print {
  .site-header, .site-footer, .cv-actions, .cursor-ring, .cursor-coords, .scroll-progress, #tweaks-root { display: none !important; }
  body { background: #fff; color: #000; }
  .cv-shell { padding: 24px; max-width: 100%; }
  .cv-entry { break-inside: avoid; }
  .cv-section { break-inside: avoid; }
}
