/* ==========================================================================
   Robert (Yueshan) Jin · academic site
   ========================================================================== */

:root {
  --bg: #f6f3ee;
  --bg-2: #efebe4;
  --surface: #fffdf9;
  --ink: #15171b;
  --ink-2: #4a4e57;
  --ink-3: #7b7f88;
  --line: rgba(21, 23, 27, 0.1);
  --line-2: rgba(21, 23, 27, 0.16);
  --accent: #e2462a;
  --accent-ink: #b8321a;
  --accent-soft: rgba(226, 70, 42, 0.1);
  --blue: #2f5bd8;
  --blue-soft: rgba(47, 91, 216, 0.1);
  --green: #1f8a5b;
  --green-soft: rgba(31, 138, 91, 0.11);
  --violet: #7a4fd6;
  --violet-soft: rgba(122, 79, 214, 0.1);
  --shadow: 0 1px 2px rgba(21, 23, 27, 0.04), 0 8px 24px -12px rgba(21, 23, 27, 0.18);
  --shadow-lg: 0 2px 4px rgba(21, 23, 27, 0.04), 0 24px 60px -24px rgba(21, 23, 27, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101114;
  --bg-2: #16181c;
  --surface: #191b20;
  --ink: #eeebe5;
  --ink-2: #b4b2ad;
  --ink-3: #85848a;
  --line: rgba(238, 235, 229, 0.09);
  --line-2: rgba(238, 235, 229, 0.16);
  --accent: #ff6a4a;
  --accent-ink: #ff8a70;
  --accent-soft: rgba(255, 106, 74, 0.13);
  --blue: #7d9dff;
  --blue-soft: rgba(125, 157, 255, 0.13);
  --green: #4fcf96;
  --green-soft: rgba(79, 207, 150, 0.12);
  --violet: #b294ff;
  --violet-soft: rgba(178, 148, 255, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101114;
    --bg-2: #16181c;
    --surface: #191b20;
    --ink: #eeebe5;
    --ink-2: #b4b2ad;
    --ink-3: #85848a;
    --line: rgba(238, 235, 229, 0.09);
    --line-2: rgba(238, 235, 229, 0.16);
    --accent: #ff6a4a;
    --accent-ink: #ff8a70;
    --accent-soft: rgba(255, 106, 74, 0.13);
    --blue: #7d9dff;
    --blue-soft: rgba(125, 157, 255, 0.13);
    --green: #4fcf96;
    --green-soft: rgba(79, 207, 150, 0.12);
    --violet: #b294ff;
    --violet-soft: rgba(178, 148, 255, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px -24px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16.5px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

/* fine grain texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 200;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; text-decoration: none;
  transition: top 0.2s;
}
.skip:focus { top: 12px; }

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  max-width: calc(var(--max) + 48px); margin: 0 auto; padding: 14px 24px;
}
.nav::before {
  content: ""; position: absolute; inset: 8px 12px; z-index: -1; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid transparent;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  opacity: 0; transition: opacity 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.nav.is-scrolled::before { opacity: 1; border-color: var(--line); box-shadow: var(--shadow); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent); color: #fff; font: italic 400 22px/1 var(--serif);
  transition: transform 0.5s var(--ease), border-radius 0.5s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); border-radius: 50%; }

.nav nav { margin-left: auto; }
.nav-links { display: flex; gap: 2px; list-style: none; margin: 0; padding: 4px; position: relative; }
.nav-links a {
  position: relative; z-index: 1; display: block; padding: 6px 14px; border-radius: 999px;
  font-size: 14px; color: var(--ink-2); text-decoration: none; transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); }
.nav-pill {
  position: absolute; z-index: 0; top: 4px; height: calc(100% - 8px); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease), opacity 0.3s;
  opacity: 0; pointer-events: none;
}

.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s;
  position: relative; overflow: hidden;
}
.theme-toggle:hover { transform: rotate(18deg); }
.theme-toggle svg { position: absolute; transition: transform 0.5s var(--ease), opacity 0.3s; }
.i-moon { transform: translateY(24px) rotate(-60deg); opacity: 0; }
:root[data-theme="dark"] .i-sun { transform: translateY(-24px) rotate(60deg); opacity: 0; }
:root[data-theme="dark"] .i-moon { transform: none; opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { transform: translateY(-24px) rotate(60deg); opacity: 0; }
  :root:not([data-theme="light"]) .i-moon { transform: none; opacity: 1; }
}

/* ---------- Layout ---------- */
main { max-width: calc(var(--max) + 48px); margin: 0 auto; padding: 0 24px; }

.section { padding: 96px 0 24px; }
.section-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 36px; }
.kicker { font: 500 13px/1 var(--mono); color: var(--accent); letter-spacing: 0.04em; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h2 { font: 400 clamp(36px, 5vw, 52px)/1.05 var(--serif); letter-spacing: -0.015em; }
h3 { font-weight: 600; font-size: 17px; line-height: 1.35; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(40px, 8vw, 96px) 0 40px; }
.hero-glow {
  position: absolute; z-index: -1; pointer-events: none;
  width: 720px; height: 720px; left: var(--mx, 30%); top: var(--my, 40%);
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%),
              radial-gradient(closest-side at 70% 60%, var(--violet-soft), transparent 70%);
  filter: blur(20px);
  transition: left 0.9s var(--ease), top 0.9s var(--ease);
}
.hero-grid > *, .about-grid > *, .edu-grid > *, .cards > * { min-width: 0; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
  padding: 6px 14px 6px 10px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); font-size: 13px; color: var(--ink-2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

h1 { font: 400 clamp(54px, 8.4vw, 104px)/0.95 var(--serif); letter-spacing: -0.03em; margin-bottom: 26px; }
h1 em { font-style: italic; color: var(--accent); }
h1 .cn { font-size: 0.42em; letter-spacing: 0; color: var(--ink-3); vertical-align: 0.55em; font-family: var(--sans); font-weight: 400; }

.lede { font-size: clamp(17px, 1.6vw, 19.5px); color: var(--ink-2); max-width: 36em; margin: 0 0 22px; }
.lede strong { color: var(--ink); font-weight: 600; }

.rotator { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; font-size: 14.5px; }
.rot-label { font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.rot-window { position: relative; display: block; overflow: hidden; height: 1.6em; min-width: 0; flex: 1; }
.rot-text { display: inline-block; max-width: 100%; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; vertical-align: top; color: var(--ink); font-weight: 500; transition: transform 0.5s var(--ease), opacity 0.5s var(--ease); }
.rot-text.out { transform: translateY(-110%); opacity: 0; }
.rot-text.in { transform: translateY(110%); opacity: 0; transition: none; }

.cta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.btn {
  --tx: 0px; --ty: 0px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 20px; border-radius: 999px; font: 500 15px/1 var(--sans);
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transform: translate(var(--tx), var(--ty));
  transition: transform 0.35s var(--ease), background 0.25s, box-shadow 0.25s, border-color 0.25s, color 0.25s;
}
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent); color: #fff; box-shadow: 0 12px 30px -10px var(--accent); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn:active { transform: translate(var(--tx), var(--ty)) scale(0.97); }
.btn-lg { padding: 16px 26px; font-size: 16.5px; }

.socials { display: flex; gap: 8px; margin-left: 4px; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.3s var(--ease), border-color 0.2s;
}
.icon-btn:hover { color: var(--ink); background: var(--surface); border-color: var(--ink); transform: translateY(-2px); }

/* portrait */
.portrait { margin: 0; justify-self: end; width: min(100%, 400px); }
.portrait-card {
  position: relative; border-radius: 28px; overflow: hidden;
  aspect-ratio: 731 / 900; background: var(--bg-2);
  box-shadow: var(--shadow-lg);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s var(--ease);
  will-change: transform;
}
.portrait-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.portrait-card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.02); transition: transform 1.2s var(--ease); }
.portrait-card:hover img { transform: scale(1.06); }
.portrait-shine {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(400px circle at var(--sx, 50%) var(--sy, 50%), rgba(255, 255, 255, 0.22), transparent 45%);
  mix-blend-mode: soft-light;
}
.portrait-card:hover .portrait-shine { opacity: 1; }
.portrait figcaption { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); background: var(--surface);
}
.pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--green); animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(3); opacity: 0; } }

/* ticker */
.ticker {
  --gap: 44px;
  display: flex; gap: var(--gap); list-style: none; margin: 72px 0 0; padding: 18px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.ticker li { flex: none; font: italic 400 22px/1 var(--serif); color: var(--ink-3); display: flex; align-items: center; gap: var(--gap); animation: marquee 32s linear infinite; }
.ticker li::after { content: "✦"; font-style: normal; font-size: 12px; color: var(--accent); }
.ticker:hover li { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-100% - var(--gap))); } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(32px, 6vw, 72px); align-items: start; }
.prose p { margin: 0 0 1.1em; font-size: 18px; color: var(--ink-2); }
.prose p:first-child::first-letter {
  float: left; font: 400 76px/0.82 var(--serif); color: var(--accent); margin: 6px 10px 0 0;
}
.prose a, .t-body a {
  color: var(--ink); text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1.5px no-repeat;
  transition: background-size 0.3s var(--ease), color 0.2s;
}
.prose a:hover { color: var(--accent-ink); background-size: 100% 100%; background-image: linear-gradient(var(--accent-soft), var(--accent-soft)); }
.prose strong { color: var(--ink); font-weight: 600; }

.interests {
  position: sticky; top: 96px;
  padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.interests h3, .skill-group h3 { font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tags li {
  padding: 6px 12px; border-radius: 999px; font-size: 13.5px; background: var(--bg); border: 1px solid var(--line);
  color: var(--ink-2); transition: transform 0.25s var(--ease), border-color 0.2s, color 0.2s, background 0.2s; cursor: default;
}
.tags li:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.facts { margin: 22px 0 0; display: grid; gap: 0; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px dashed var(--line-2); font-size: 14.5px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; text-align: right; font-weight: 500; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  position: relative; padding: 26px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 12px;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), border-color 0.3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(360px circle at var(--cx, 50%) var(--cy, 50%), var(--accent-soft), transparent 60%);
}
.spot:hover::before { opacity: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.when { font: 400 12.5px/1 var(--mono); color: var(--ink-3); }
.badge { font: 500 12px/1 var(--sans); padding: 6px 10px; border-radius: 999px; }
.badge-research { background: var(--blue-soft); color: var(--blue); }
.badge-build { background: var(--accent-soft); color: var(--accent-ink); }
.badge-teach { background: var(--green-soft); color: var(--green); }
.card h3 { font: 400 27px/1.1 var(--serif); letter-spacing: -0.01em; margin-top: 8px; }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; flex: 1; }
.mini-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 6px 0 0; }
.mini-tags li { font: 400 12px/1 var(--mono); color: var(--ink-3); padding: 5px 8px; border-radius: 6px; background: var(--bg); }

/* ---------- Timeline ---------- */
.filters { margin-left: auto; display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.filter {
  border: 0; background: transparent; color: var(--ink-2); font: 500 13.5px/1 var(--sans);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background 0.25s, color 0.25s;
}
.filter:hover { color: var(--ink); }
.filter.is-active { background: var(--ink); color: var(--bg); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 186px; top: 8px; bottom: 8px; width: 1px; background: var(--line-2);
}
.timeline::after {
  content: ""; position: absolute; left: 186px; top: 8px; width: 1px; height: var(--fill, 0px);
  background: linear-gradient(var(--accent), var(--violet)); transition: height 0.2s linear;
}
.t-item {
  position: relative; display: grid; grid-template-columns: 160px 1fr; gap: 52px; padding: 22px 0;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), filter 0.4s;
}
.t-item::before {
  content: ""; position: absolute; left: 181px; top: 31px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink-3); z-index: 1; transition: border-color 0.3s, background 0.3s, transform 0.3s var(--ease);
}
.t-item:hover::before { border-color: var(--accent); background: var(--accent); transform: scale(1.25); }
.t-item.is-dim { opacity: 0.22; filter: grayscale(1); }
.t-date { font: 400 13px/1.5 var(--mono); color: var(--ink-3); padding-top: 4px; text-align: right; }
.t-body {
  padding: 18px 22px; margin: -18px -22px; border-radius: var(--radius-sm);
  transition: background 0.3s;
}
.t-item:hover .t-body { background: var(--surface); }
.t-body h3 { font-size: 18px; }
.at { display: block; font-weight: 400; color: var(--accent-ink); font-size: 15.5px; margin-top: 2px; }
.t-meta { margin: 4px 0 0; color: var(--ink-3); font-size: 13.5px; }
.t-body ul { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 15.5px; }
.t-body li { margin: 6px 0; }
.t-body li::marker { color: var(--accent); }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.edu-list { display: grid; gap: 18px; }
.edu {
  display: flex; gap: 18px; padding: 24px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform 0.4s var(--ease), box-shadow 0.4s;
}
.edu:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.edu-logo {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-ink); font: 600 12.5px/1 var(--mono); letter-spacing: 0.02em;
}
.edu:nth-child(2) .edu-logo { background: var(--blue-soft); color: var(--blue); }
.edu p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.edu .t-meta { font-size: 13.5px; color: var(--ink-3); }
.skills { display: grid; gap: 26px; padding: 26px; border-radius: var(--radius); border: 1px dashed var(--line-2); }

/* ---------- Contact ---------- */
.contact { padding-bottom: 72px; }
.contact-card {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(48px, 8vw, 88px) 24px; border-radius: 32px;
  background: var(--ink); color: var(--bg);
}
.contact-card::before {
  content: ""; position: absolute; inset: -40%; z-index: 0;
  background: conic-gradient(from 0deg at 50% 50%, transparent 0 60%, rgba(226, 70, 42, 0.45), transparent 85%);
  animation: spin 14s linear infinite;
}
.contact-card::after { content: ""; position: absolute; inset: 1px; border-radius: 31px; background: var(--ink); z-index: 0; opacity: 0.94; }
.contact-card > * { position: relative; z-index: 1; }
@keyframes spin { to { transform: rotate(1turn); } }
.contact-card h2 { font-size: clamp(48px, 8vw, 88px); margin: 14px 0 12px; }
.contact-card p { color: color-mix(in srgb, var(--bg) 70%, transparent); max-width: 30em; margin: 0 auto 30px; font-size: 17px; }
.contact-card .cta { justify-content: center; }
.contact-card .btn-primary { background: var(--bg); color: var(--ink); }
.contact-card .btn-primary:hover { background: var(--accent); color: #fff; }
.contact-card .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.contact-card .btn-ghost:hover { border-color: var(--bg); }

/* ---------- Footer ---------- */
.footer {
  max-width: calc(var(--max) + 48px); margin: 0 auto; padding: 28px 24px 40px;
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--ink-3);
  border-top: 1px solid var(--line);
}
.footer p { margin: 0; }
.footer .to-top { margin-left: auto; text-decoration: none; color: var(--ink-2); }
.footer .to-top:hover { color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-lg);
  transition: transform 0.4s var(--ease), opacity 0.3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { justify-self: start; width: min(100%, 340px); order: -1; }
  .portrait figcaption { justify-content: flex-start; }
  .about-grid, .edu-grid { grid-template-columns: 1fr; }
  .interests { position: static; }
  .cards { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav nav { display: none; }
  .theme-toggle { margin-left: auto; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .section { padding-top: 72px; }
  .filters { margin-left: 0; width: 100%; overflow-x: auto; }
  .timeline::before, .timeline::after { left: 5px; }
  .t-item { grid-template-columns: 1fr; gap: 6px; padding-left: 30px; }
  .t-item::before { left: 0; top: 27px; }
  .t-date { text-align: left; }
  .t-body { margin: 0 -14px; padding: 12px 14px; }
  .ticker { margin-top: 48px; }
  .socials { margin-left: 0; }
  .portrait { width: min(62%, 230px); }
  .portrait-card { border-radius: 22px; }
  .rotator { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rot-window { width: 100%; }
  .cta .btn { flex: 1 1 auto; justify-content: center; }
  .prose p { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .ticker { flex-wrap: wrap; white-space: normal; mask-image: none; -webkit-mask-image: none; gap: 14px 28px; }
  .ticker li { gap: 28px; }
}

/* ==========================================================================
   Classical typography layer (v2)
   ========================================================================== */
:root {
  --times: "Times New Roman", Times, "Liberation Serif", "Songti SC", serif;
  --garamond: "Cormorant Garamond", "Times New Roman", serif;
  --gold: #b08a3e;
}
:root[data-theme="dark"] { --gold: #d2b06a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --gold: #d2b06a; } }

/* monogram logo */
.brand { gap: 12px; }
.monogram { width: 40px; height: 44px; overflow: visible; fill: none; stroke: none; transition: transform .7s var(--ease); }
.monogram .mg-outer { stroke: var(--gold); stroke-width: 1.3; }
.monogram .mg-inner { stroke: var(--gold); stroke-width: .6; opacity: .7; }
.monogram .mg-laurel { stroke: var(--gold); stroke-width: .9; stroke-linecap: round; }
.monogram text { font-family: var(--serif); font-style: italic; fill: var(--ink); stroke: none; }
.monogram .mg-r { font-size: 25px; }
.monogram .mg-j { font-size: 23px; fill: var(--accent); }
.brand:hover .monogram { transform: rotate(-6deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.bt-name { font: 600 19px/1 var(--garamond); letter-spacing: .02em; font-variant: small-caps; }
.bt-sub { font: italic 400 12.5px/1.2 var(--garamond); color: var(--ink-3); letter-spacing: .04em; margin-top: 3px; }

/* art toggle */
.art-toggle {
  display: inline-flex; align-items: center; gap: 9px; padding: 6px 7px 6px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; color: var(--ink);
  font: italic 500 16px/1 var(--garamond); letter-spacing: .03em; transition: border-color .3s, transform .3s var(--ease);
}
.art-toggle:hover { border-color: var(--gold); transform: translateY(-1px); }
.at-track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); transition: background .4s; }
.at-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-3); transition: transform .5s var(--ease), background .4s; }
.art-toggle:hover .at-knob { background: var(--gold); transform: translateX(4px); }
.art-toggle.is-going .at-knob { transform: translateX(14px); background: var(--gold); }
.art-toggle.is-going .at-track { background: color-mix(in srgb, var(--gold) 30%, transparent); }
.nav nav + .art-toggle { margin-left: 8px; }

/* page-leave curtain */
.curtain {
  position: fixed; inset: 0; z-index: 300; pointer-events: none; background: #120d08;
  clip-path: circle(0px at var(--cx, 90%) var(--cy, 4%)); transition: clip-path 1.05s cubic-bezier(.7,0,.2,1);
}
.curtain.is-on { clip-path: circle(150vmax at var(--cx, 90%) var(--cy, 4%)); }

/* roman-numeral kickers, small caps labels */
.kicker { font: italic 500 22px/1 var(--garamond); color: var(--gold); letter-spacing: .02em; }
.eyebrow { font: 500 15px/1 var(--garamond); letter-spacing: .06em; font-variant: small-caps; }
.rot-label, .interests h3, .skill-group h3 { font: 600 13px/1 var(--garamond); letter-spacing: .16em; text-transform: uppercase; }
.when, .t-date, .mini-tags li { font-family: var(--garamond); font-style: italic; font-size: 15px; letter-spacing: .01em; }
.mini-tags li { font-size: 13.5px; }
.edu-logo { font: 600 15px/1 var(--garamond); letter-spacing: .06em; }

/* Times New Roman for prose */
.lede, .prose p, .card p, .t-body ul, .edu p:not(.t-meta), .contact-card p, .rot-text {
  font-family: var(--times);
}
.lede { font-size: clamp(19px, 1.75vw, 22px); line-height: 1.55; }
.prose p { font-size: 20.5px; line-height: 1.62; }
.card p { font-size: 17px; line-height: 1.55; }
.t-body ul { font-size: 17.5px; line-height: 1.55; }
.edu p:not(.t-meta) { font-size: 17px; }
.contact-card p { font-size: 19.5px; }
.rot-text { font-size: 17px; font-style: italic; }
.lede strong, .prose strong { font-weight: 700; }

.t-body h3, .edu h3 { font: 400 23px/1.2 var(--serif); letter-spacing: -0.005em; }
.at { font-family: var(--garamond); font-style: italic; font-size: 18px; font-weight: 500; }
.prose p:first-child::first-letter { font-size: 84px; margin: 4px 12px 0 0; color: var(--accent); }
.facts dd { font-family: var(--garamond); font-size: 17px; font-weight: 600; }

/* subtle ornament under section titles */
.section-head h2::after {
  content: ""; display: block; width: 64px; height: 9px; margin-top: 10px; opacity: .8;
  background: radial-gradient(circle, var(--gold) 2px, transparent 2.5px) center / 9px 9px no-repeat,
              linear-gradient(var(--gold), var(--gold)) left center / 26px 1px no-repeat,
              linear-gradient(var(--gold), var(--gold)) right center / 26px 1px no-repeat;
}
@media (max-width: 900px) { .bt-sub { display: none; } .art-toggle { margin-left: auto; } .theme-toggle { margin-left: 8px; } }
@media (max-width: 420px) { .bt-name { font-size: 17px; } }
.nav-links a { font: 500 17px/1 var(--garamond); letter-spacing: .05em; font-variant: small-caps; }
