/* ==========================================================================
   rishabht.com — design system
   Dark, blue-tinted charcoal. Typography does most of the work; colour and
   motion are used sparingly. Every page on the site shares this file.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Palette */
  --bg: #0E0E0F;
  --bg-2: #151516;
  --surface: #1B1B1D;
  --surface-hover: #232326;
  --line: #2C2C30;
  --line-soft: #1F1F22;
  --text: #EDEDEF;
  --text-2: #A6A6AD;
  --muted: #7A7A82;
  --accent: #5B93FF;
  --accent-hover: #8DB4FF;
  --accent-soft: rgba(91, 147, 255, .12);
  --accent-line: rgba(91, 147, 255, .38);

  /* Type */
  --font-sans: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Layout */
  --maxw: 1160px;
  --gutter: clamp(20px, 5vw, 48px);
  --header-h: 64px;
  --section-gap: clamp(96px, 12vw, 152px);
  --radius: 14px;
  --radius-sm: 8px;

  /* Motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-hover: 200ms;
  --t-reveal: 460ms;

  /* Names used by the older subpage markup */
  --background: var(--bg);
  --link: var(--accent);
  --semester-line: var(--line);
  --course-line: var(--line-soft);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

main { flex: 1 0 auto; }

::selection { background: rgba(91, 147, 255, .28); color: var(--text); }

img, video, svg { max-width: 100%; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t-hover) var(--ease);
}
a:hover { color: var(--accent-hover); }

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

p { margin: 0 0 1.1em; }
h1, h2, h3 { margin: 0; font-weight: 560; letter-spacing: -.02em; text-wrap: balance; }

.wrap {
  width: min(var(--maxw), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .02em;
}

.visually-hidden,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  text-decoration: none;
}

[hidden] { display: none !important; }

/* Small arrow used on links: nudges diagonally on hover. */
.arrow {
  display: inline-block;
  transition: transform var(--t-hover) var(--ease);
}
a:hover .arrow,
a:focus-visible .arrow { transform: translate(2px, -2px); }
.arrow-right { transition: transform var(--t-hover) var(--ease); display: inline-block; }
a:hover .arrow-right,
a:focus-visible .arrow-right { transform: translateX(3px); }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color 240ms var(--ease), border-color 240ms var(--ease), backdrop-filter 240ms var(--ease);
}
.site-header.is-scrolled,
.site-header.is-open {
  background: rgba(14, 14, 15, .78);
  border-bottom-color: var(--line-soft);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 540;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: border-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.brand:hover .brand-mark { border-color: var(--accent-line); color: var(--accent-hover); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  position: relative;
  padding: 8px 12px;
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
  transition: color var(--t-hover) var(--ease);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 240ms var(--ease);
}
.site-nav a:hover { color: var(--text); }
.site-nav a:hover::after { transform: scaleX(1); background: var(--line); }
.site-nav a[aria-current]:not([aria-current="false"]) { color: var(--text); }
.site-nav a[aria-current]:not([aria-current="false"])::after { transform: scaleX(1); background: var(--accent); }

.site-nav .nav-contact {
  margin-left: 10px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  transition: border-color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease);
}
.site-nav .nav-contact::after { display: none; }
.site-nav .nav-contact:hover { border-color: var(--accent-line); background: var(--accent-soft); }

.menu-button {
  display: none;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin-right: -10px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.menu-icon { position: relative; width: 16px; height: 10px; }
.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 240ms var(--ease), top 240ms var(--ease);
}
.menu-icon::before { top: 1px; }
.menu-icon::after { top: 7.5px; }
.is-open .menu-icon::before { top: 4.25px; transform: rotate(45deg); }
.is-open .menu-icon::after { top: 4.25px; transform: rotate(-45deg); }

@media (max-width: 760px) {
  .menu-button { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 24px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg);
    box-shadow: 0 24px 48px rgba(0, 0, 0, .35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 0s linear 200ms;
  }
  .site-header.is-open .site-nav {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  }
  .site-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 17px;
  }
  .site-nav a::after { display: none; }
  .site-nav a[aria-current]:not([aria-current="false"]) { color: var(--accent-hover); }
  .site-nav .nav-contact {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    border-bottom: 1px solid var(--line);
  }
}

/* ==========================================================================
   Shared section scaffolding
   ========================================================================== */

.section { padding-top: var(--section-gap); }
/* Land anchor jumps on the section heading, not on the empty space above it. */
.section[id] { scroll-margin-top: calc(8px - var(--section-gap)); }

.section-head {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 16px 24px;
  margin-bottom: clamp(36px, 5vw, 56px);
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}
.section-label {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.section-label b { color: var(--accent); font-weight: 500; }
.section-title {
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.12;
  letter-spacing: -.03em;
}
.section-aside {
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.section-aside:hover { color: var(--text); }

@media (max-width: 860px) {
  .section-head { grid-template-columns: minmax(0, 1fr) auto; }
  .section-label { grid-column: 1 / -1; }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease), transform var(--t-hover) var(--ease);
}
.button:hover { color: var(--text); border-color: #3A3A40; background: var(--bg-2); }
.button:active { transform: translateY(1px); }
.button-primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}
.button-primary:hover { border-color: #fff; background: #fff; color: var(--bg); }

/* Scroll reveal: only hides content once JS has confirmed it can show it again. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--t-reveal) var(--ease), transform var(--t-reveal) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Work
   ========================================================================== */

.feature-list { display: grid; gap: 20px; }

.feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  transition: background-color 240ms var(--ease), border-color 240ms var(--ease);
}
.feature:hover { color: var(--text); background: var(--surface); border-color: var(--line); }
.feature:focus-visible { outline-offset: 4px; border-radius: var(--radius); }
.feature.is-reversed { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
.feature.is-reversed .feature-media { order: 2; }

.feature-media {
  position: relative;
  overflow: hidden;
  background: #0B0B0C;
  min-height: 320px;
}
.feature-media.is-contain img,
.feature-media.is-contain video { object-fit: contain; }
@media (max-width: 900px) {
  .feature-media { min-height: 0; aspect-ratio: 16 / 10; }
  .feature-media.is-contain { aspect-ratio: 16 / 9; }
}
.feature-media img,
.feature-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 320ms var(--ease);
}
.feature-media video { opacity: 0; }
.feature-media.is-playing video { opacity: 1; }
.feature-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 14, 15, 0) 50%, rgba(14, 14, 15, .38));
  box-shadow: inset -1px 0 0 var(--line-soft);
  transition: opacity 240ms var(--ease);
  pointer-events: none;
}
.feature.is-reversed .feature-media::after { box-shadow: inset 1px 0 0 var(--line-soft); }
.feature:hover .feature-media::after { opacity: .4; }

.feature-body {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 3vw, 40px);
}
.feature-title {
  margin-bottom: 12px;
  font-size: clamp(22px, 2.2vw, 26px);
  line-height: 1.2;
}
.feature-summary { margin-bottom: 24px; color: var(--text-2); font-size: 15.5px; line-height: 1.6; }

.feature-cta { color: var(--text); font-size: 14px; white-space: nowrap; }
.feature-cta .arrow { color: var(--accent); }
.feature:hover .feature-cta .arrow { transform: translate(3px, -3px); }

@media (max-width: 900px) {
  .feature,
  .feature.is-reversed { grid-template-columns: minmax(0, 1fr); }
  .feature.is-reversed .feature-media { order: 0; }
  .feature-media::after,
  .feature.is-reversed .feature-media::after { box-shadow: inset 0 -1px 0 var(--line-soft); }
}

/* Writing list */
.writing {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  margin-top: clamp(56px, 7vw, 80px);
}
.writing-intro h3 { margin-bottom: 8px; font-size: 17px; }
.writing-intro p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.writing-intro a { font-size: 14px; text-decoration: none; }

.row-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.row-list li { border-bottom: 1px solid var(--line-soft); }
.row-link {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px 24px;
  margin-inline: -14px;
  padding: 18px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--t-hover) var(--ease);
}
.row-link:hover { color: var(--text); background: var(--bg-2); }
.row-link time { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.row-title { font-size: 16.5px; font-weight: 500; line-height: 1.4; }
.row-desc { display: block; margin-top: 4px; color: var(--text-2); font-size: 14px; font-weight: 400; line-height: 1.5; }
.row-link .arrow { color: var(--muted); }
.row-link:hover .arrow { color: var(--accent); transform: translate(3px, -3px); }

@media (max-width: 860px) {
  .writing { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .row-link { grid-template-columns: minmax(0, 1fr) auto; }
  .row-link time { grid-column: 1 / -1; }
}

/* ==========================================================================
   Experience
   ========================================================================== */

.exp-list { margin: 0; padding: 0; list-style: none; }
.exp {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 8px 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line-soft);
  transition: opacity 240ms var(--ease);
}
.exp:last-child { border-bottom: 1px solid var(--line-soft); }
@media (hover: hover) {
  .exp-list:hover .exp:not(:hover),
  .exp-list:focus-within .exp:not(:focus-within) { opacity: .62; }
}
.exp-when {
  margin: 0;
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}
.exp-now {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.exp h3 { font-size: 18px; line-height: 1.35; letter-spacing: -.015em; }
.exp h3 a { color: var(--text); text-decoration: none; }
.exp h3 a:hover { color: var(--accent-hover); }
.exp h3 .arrow { color: var(--muted); font-size: 14px; }
.exp-role { margin: 2px 0 10px; color: var(--text-2); font-size: 15px; }
.exp-desc { max-width: 64ch; margin: 0 0 14px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.exp-desc:last-child { margin-bottom: 0; }
.exp.is-minor { padding-block: 18px; }
.exp.is-minor h3 { font-size: 16px; }
.exp.is-minor .exp-role { margin-bottom: 0; font-size: 14px; }

@media (max-width: 860px) {
  .exp { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ==========================================================================
   About
   ========================================================================== */

.about-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}
.about-side { position: sticky; top: calc(var(--header-h) + 32px); }
.portrait {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  filter: saturate(.92) contrast(1.02);
}
.facts {
  margin: 20px 0 0;
  font-size: 13.5px;
}
.facts div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.facts dt { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; padding-top: 2px; }
.facts dd { margin: 0; color: var(--text-2); }

.about-text { max-width: 62ch; font-size: clamp(16px, 1.35vw, 18px); line-height: 1.75; color: var(--text-2); }
.about-text p:first-child { color: var(--text); font-size: clamp(19px, 1.8vw, 22px); line-height: 1.55; letter-spacing: -.01em; }
.about-text strong { color: var(--text); font-weight: 500; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .about-side { position: static; display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 20px; align-items: start; }
  .facts { margin: 0; }
  .facts div:first-child { border-top: 0; padding-top: 0; }
}
@media (max-width: 480px) {
  .about-side { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 168px; }
  .facts div:first-child { border-top: 1px solid var(--line-soft); padding-top: 10px; }
}

/* ==========================================================================
   Highlights
   ========================================================================== */

.highlights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.highlights li {
  padding: 20px clamp(14px, 2.2vw, 24px);
  border-left: 1px solid var(--line-soft);
}
.highlights li:first-child { border-left: 0; }
.highlight-figure {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(34px, 3.6vw, 44px);
  font-weight: 500;
  line-height: 1;
  color: var(--accent-hover);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.highlight-figure small { margin-left: 2px; color: var(--muted); font-size: .45em; letter-spacing: 0; }
.highlights h3 { margin-bottom: 6px; font-size: 15px; font-weight: 520; letter-spacing: -.01em; }
.highlights p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.highlights-more {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.highlights-more span { color: var(--text-2); }

@media (max-width: 900px) {
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .highlights li:nth-child(3) { border-left: 0; }
  .highlights li:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact { padding-bottom: clamp(80px, 10vw, 128px); }
.contact-title {
  max-width: 16ch;
  margin-bottom: 22px;
  font-size: clamp(36px, 5.2vw, 60px);
  line-height: 1.04;
  letter-spacing: -.045em;
}
.contact-lead { max-width: 52ch; margin-bottom: 36px; color: var(--text-2); font-size: clamp(16px, 1.35vw, 18px); }

.email-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 28px;
  padding: 6px 6px 6px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}
.email-link {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.6vw, 17px);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.email-link:hover { color: var(--accent-hover); }
.copy-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin-left: 12px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease);
}
.copy-button:hover { background: var(--surface); color: var(--text); border-color: var(--line); }
.copy-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.copy-button .icon-check { display: none; color: #7FC4A4; }
.copy-button.is-copied .icon-copy { display: none; }
.copy-button.is-copied .icon-check { display: block; }
.copy-button.is-copied { color: var(--text); }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}
.contact-links a { color: var(--text-2); text-decoration: none; }
.contact-links a:hover { color: var(--text); }
.contact-links .arrow { color: var(--muted); }
.contact-links a:hover .arrow { color: var(--accent); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 32px;
  padding-block: 28px 32px;
}
.site-footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-clock { font-family: var(--font-mono); font-size: 12px; }

/* ==========================================================================
   Subpages
   ========================================================================== */

.page {
  width: min(var(--maxw), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
  padding-block: clamp(48px, 8vw, 88px) clamp(80px, 10vw, 120px);
}
.page-narrow { width: min(760px, calc(100% - 2 * var(--gutter))); }
.js .page { animation: rise 460ms var(--ease) both; }

.page-intro { margin-bottom: clamp(40px, 6vw, 64px); }
.page-intro .section-label { margin-bottom: 18px; }
.page-heading {
  margin: 0 0 16px;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -.04em;
}
.page-lead { max-width: 58ch; margin: 0; color: var(--text-2); font-size: clamp(16px, 1.35vw, 18px); }

.back-link,
.project-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
}
.back-link:hover,
.project-back:hover { color: var(--text); }
.back-link .arrow-left,
.project-back .arrow-left { display: inline-block; transition: transform var(--t-hover) var(--ease); }
.back-link:hover .arrow-left,
.project-back:hover .arrow-left { transform: translateX(-3px); }

.small-note { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Coursework */
.coursework-section {
  border-top: 1px solid var(--line-soft);
}
.coursework-section:last-of-type { border-bottom: 1px solid var(--line-soft); }
.coursework-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
  list-style: none;
  font-size: 19px;
  font-weight: 520;
  letter-spacing: -.015em;
  transition: color var(--t-hover) var(--ease);
}
.coursework-section summary:hover { color: var(--accent-hover); }
.coursework-section summary::-webkit-details-marker { display: none; }
.coursework-section summary .summary-meta { margin-left: auto; color: var(--muted); font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
.coursework-section summary::after {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 220ms var(--ease);
}
.coursework-section[open]:not(.is-closing) summary::after { transform: translateY(2px) rotate(225deg); }
.disclosure-content { padding-bottom: 22px; }
.course-list { margin: 0; padding: 0; list-style: none; }
.course-list li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: baseline;
  gap: 20px;
  padding: 11px 0;
  color: var(--text-2);
  font-size: 16px;
}
.course-list li + li { border-top: 1px solid var(--line-soft); }
.course-list.course-list-names li { display: block; }
.course-code { color: var(--muted); font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }

/* Notes index */
.note-list-entry { border-top: 1px solid var(--line-soft); }
.note-list-entry:last-of-type { border-bottom: 1px solid var(--line-soft); }
.note-card {
  display: block;
  margin-inline: -16px;
  padding: 26px 16px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--t-hover) var(--ease);
}
.note-card:hover { color: var(--text); background: var(--bg-2); }
.note-card h2 { margin: 0 0 8px; font-size: clamp(19px, 2vw, 22px); line-height: 1.35; letter-spacing: -.02em; }
.note-card-description { margin: 0 0 16px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.note-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.note-card-meta time, .note-read-time { white-space: nowrap; }
.note-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.note-tag { padding: 1px 8px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--text-2); font-size: 11.5px; }
.notes-divider { display: none; }

/* Notes articles */
.note-page { width: min(740px, calc(100% - 2 * var(--gutter))); font-size: 17px; line-height: 1.75; }
.note-page article > p,
.note-page article > ul,
.note-page article > ol { color: #CFCFD4; }
.note-header { margin-bottom: 44px; padding-bottom: 32px; border-bottom: 1px solid var(--line-soft); }
.note-header .page-heading { margin: 14px 0 14px; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.12; letter-spacing: -.035em; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.note-deck { margin: 0; color: var(--text-2); font-size: 18px; }
.note-page h2 { margin: 52px 0 16px; font-size: 24px; line-height: 1.3; letter-spacing: -.025em; }
.note-page h3 { margin: 32px 0 12px; font-size: 19px; font-weight: 540; }
.note-page hr { margin: 48px 0; border: 0; border-top: 1px solid var(--line-soft); }
.note-page li { margin-bottom: 10px; }
.note-page ul, .note-page ol { padding-left: 22px; }
.note-page code { font-family: var(--font-mono); font-size: .84em; color: var(--text); overflow-wrap: anywhere; }
.note-page :not(pre) > code { padding: 2px 5px; border-radius: 4px; background: var(--surface); }
.note-page pre { overflow-x: auto; margin: 26px 0; padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-2); line-height: 1.65; }
.note-page pre code { overflow-wrap: normal; }
.math-block { overflow-x: auto; overflow-y: hidden; margin-block: 26px; padding-block: 6px; color: var(--text); }
.math-block .katex-display { margin: 0; }
.note-page .katex { font-size: 1.06em; color: var(--text); }
.note-page .katex-error { color: var(--text) !important; }
.note-figure { margin: 34px 0; }
.diagram-scroll { overflow-x: auto; }
.note-figure svg { display: block; min-width: 520px; width: 100%; height: auto; }
.note-figure svg rect { fill: var(--bg-2); stroke: var(--line); }
.note-figure svg path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.note-figure svg marker path { fill: var(--accent); }
.note-figure svg text { fill: var(--text); font: 15px var(--font-sans); }
.note-figure svg .diagram-muted { fill: var(--muted); font-size: 13px; }
.note-figure img { display: block; width: 100%; height: auto; padding: 14px; border-radius: 10px; background: #EDEDEF; }
.note-page figcaption { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.table-scroll { max-width: 100%; overflow-x: auto; margin: 26px 0 12px; }
.note-page table { width: 100%; border-collapse: collapse; font-size: 15px; text-align: left; }
.note-page th, .note-page td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.note-page th { color: var(--accent); font-weight: 540; }
.boundary-demo { margin: 34px 0; padding: 24px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--bg-2); }
.boundary-demo h3 { margin-top: 0; }
.boundary-demo > label { display: flex; justify-content: space-between; gap: 16px; }
.boundary-demo output { color: var(--accent); font-variant-numeric: tabular-nums; }
.boundary-demo input[type="range"] { width: 100%; margin: 16px 0; accent-color: var(--accent); }
.boundary-demo fieldset { margin: 0 0 18px; padding: 0; border: 0; }
.boundary-demo legend { margin-bottom: 8px; color: var(--muted); font-size: 15px; }
.boundary-demo fieldset label { display: block; margin: 6px 0; font-size: 15px; }
.boundary-demo input[type="radio"] { accent-color: var(--accent); }
.demo-results { padding-top: 16px; border-top: 1px solid var(--line-soft); }
.demo-results p { margin-bottom: 10px; font-size: 15px; }
.demo-results p:last-child { margin-bottom: 0; color: var(--muted); }
.references { color: var(--text-2); font-size: 14.5px; overflow-wrap: anywhere; }
.references li { margin-bottom: 14px; padding-left: 4px; scroll-margin-top: calc(var(--header-h) + 24px); }
.references li:target { border-radius: 4px; background: var(--accent-soft); }

/* Project detail pages */
.project-detail { width: min(880px, calc(100% - 2 * var(--gutter))); }
.project-header { margin-bottom: 40px; }
.project-header .page-heading { margin-bottom: 14px; }
.project-lead { margin: 0 0 18px; color: var(--text-2); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.5; }
.project-meta { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.project-header .project-meta { margin-bottom: 18px; }
.project-header .project-lead { max-width: 60ch; }
.project-header .tags { margin-top: 4px; }

/* Cupid CAD viewer */
.cad-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: none;
  max-height: none;
  height: min(560px, 70vh);
  min-height: 380px;
  margin: 0;
  padding: 0;
  color: inherit;
  transition-property: none;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: radial-gradient(70% 70% at 50% 45%, #1A1A1D, #111113);
}
.cad-stage model-viewer { display: block; width: 100%; height: 100%; --progress-bar-color: var(--accent); --poster-color: transparent; background: transparent; outline-offset: -4px; }
.cad-label { position: absolute; z-index: 2; top: 16px; left: 18px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; pointer-events: none; }
.cad-toolbar { position: absolute; z-index: 2; top: 12px; right: 12px; display: flex; gap: 6px; }
.cad-toolbar button,
.cad-error button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(14, 14, 15, .7); color: var(--text); font: inherit; font-size: 13px; transition: background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease); }
.cad-toolbar button { display: grid; place-items: center; width: 36px; height: 36px; padding: 8px; }
.cad-toolbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cad-toolbar button:hover,
.cad-toolbar button[aria-pressed="true"] { background: var(--surface-hover); border-color: var(--accent-line); }
.cad-toolbar button:disabled { opacity: .45; }
.cad-progress { position: absolute; top: 45%; left: 50%; width: 180px; transform: translate(-50%, -50%); color: var(--muted); font-size: 13px; text-align: center; }
.cad-progress p { margin-bottom: 12px; font-family: var(--font-mono); font-size: 12px; }
.cad-progress-track { height: 2px; overflow: hidden; background: var(--line); }
.cad-progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 120ms linear; }
.cad-caption { margin-top: 14px; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.cad-caption p { margin: 0; }
.cad-error { margin-top: 18px; color: var(--muted); }
.cad-stage.is-expanded {
  position: fixed;
  inset: 0;
  height: 100%;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
}
.cad-stage::backdrop { background: var(--bg); }
html:has(.cad-stage.is-expanded) { overflow: hidden; }
.project-prose { max-width: 640px; margin-top: 44px; color: var(--text-2); font-size: 17px; line-height: 1.75; }
.project-prose h2 { margin: 0 0 12px; color: var(--text); font-size: 22px; letter-spacing: -.02em; }

@media (max-width: 620px) {
  .cad-stage { height: 420px; }
  .note-page { font-size: 16px; }
  .note-page h2 { font-size: 21px; }
  .note-page pre { padding: 14px; }
  .boundary-demo { padding: 16px; }
  .course-list li { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; font-size: 15px; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}

.feature-media.cad-preview { background: var(--bg); }

/* ==========================================================================
   Homepage v2: intro, counter, rows, chips, marquee, stats, dock
   ========================================================================== */

.site-nav a b { color: var(--accent); font-weight: inherit; }

/* Blocks */
.block { padding-top: clamp(88px, 11vw, 136px); }
.block-title {
  margin: 0 0 28px;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.05em;
}
.block-title span { color: var(--accent); }
.block-label {
  margin: 0 0 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.block-lead { max-width: 64ch; margin: 0 0 40px; color: var(--text-2); font-size: clamp(16px, 1.5vw, 18px); line-height: 1.7; }
.aside-line { margin: 24px 0 0; color: var(--muted); font-size: 14.5px; }
.aside-line a { text-decoration: none; }

.more-link {
  display: inline-flex;
  gap: 8px;
  margin-top: 26px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.more-link:hover { color: var(--accent-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-hover); }
.badge-live { border-color: rgba(127, 196, 164, .35); background: rgba(127, 196, 164, .1); color: #9ED6BC; }
.badge-live::before { content: ""; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #7FC4A4; }

.row-preview {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  width: 280px;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0B0B0C;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease);
}
.row-preview:not([src]) { display: none; }
.row-preview.is-on { opacity: 1; }
/* Experience: chip rows */
.chip-rows { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.chip-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-org {
  min-width: 190px;
  margin-right: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.02em;
  text-decoration: none;
}
.chip-org:hover { color: var(--accent-hover); }
.chip {
  padding: 3px 11px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}
@media (max-width: 560px) {
  .chip-rows { gap: 22px; }
  .chip-org { flex-basis: 100%; min-width: 0; }
}

/* Marquee */
.toolbox .block-label { margin: 0 auto 22px; }
.marquee {
  display: flex;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  margin: 0;
  padding: 0 12px 0 0;
  list-style: none;
  animation: marquee 38s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track li {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg-2);
  white-space: nowrap;
}
.marquee-track b { font-weight: 600; letter-spacing: -.01em; }
.marquee-track span { padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* Robotics stats */
.stat-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
.stat { display: flex; align-items: flex-start; gap: 14px; margin: 0; }
.stat-big {
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 700;
  line-height: .9;
  letter-spacing: -.06em;
  color: var(--accent-hover);
}
.stat-text { padding-top: 4px; font-size: 17px; font-weight: 520; line-height: 1.35; }
.stat-text small { display: block; margin-top: 4px; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; }
.roles {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 40px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
}
.roles em { color: var(--text-2); }
.roles-sep { width: 1px; height: 14px; margin-inline: 10px; background: var(--line); align-self: center; }
.callout { margin: 32px 0 0; color: var(--text-2); font-size: 15px; }
.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: border-color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease);
}
.pill-link:hover { color: var(--text); border-color: var(--accent-line); background: var(--surface); }
@media (max-width: 760px) {
  .stat-line { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

/* Writing */
.article-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.article-list li { border-bottom: 1px solid var(--line-soft); }
.article-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  margin-inline: -16px;
  padding: 20px 16px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--t-hover) var(--ease);
}
.article-list a:hover { color: var(--text); background: var(--bg-2); }
.article-title { font-size: 18px; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; }
.article-list a:hover .article-title { color: var(--accent-hover); }
.article-desc { grid-column: 1; color: var(--text-2); font-size: 14.5px; line-height: 1.55; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.article-list time { grid-column: 2; grid-row: 1; color: var(--muted); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
@media (max-width: 640px) {
  .article-list a { grid-template-columns: minmax(0, 1fr); }
  .article-list time { grid-column: 1; grid-row: auto; }
  .article-desc { -webkit-line-clamp: 2; }
}

/* Math */
.math-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.math-grid li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background:
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box;
  background-image:
    linear-gradient(rgba(91, 147, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 147, 255, .05) 1px, transparent 1px);
  background-size: 16px 16px;
  transition: border-color var(--t-hover) var(--ease), transform var(--t-hover) var(--ease);
}
.math-grid li:hover { border-color: var(--line); transform: translateY(-2px); }
.math-big { margin-bottom: 8px; font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.05em; }
.math-grid span:not(.math-big) { font-size: 15px; font-weight: 520; line-height: 1.35; }
.math-grid small { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }
@media (max-width: 860px) { .math-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Contact */
.contact-block { padding-bottom: clamp(96px, 12vw, 160px); }

/* Floating dock */
.dock {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(22, 22, 24, .82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.dock a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--text-2);
  transition: color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease);
}
.dock a:hover { color: var(--text); background: var(--surface-hover); }
.dock svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dock-sep { width: 1px; height: 20px; margin-inline: 4px; background: var(--line); }
.dock-top { opacity: .4; pointer-events: none; transition: opacity 200ms var(--ease) !important; }
.dock.is-scrolled .dock-top { opacity: 1; pointer-events: auto; }
@media (max-width: 480px) { .dock { right: 12px; bottom: 12px; } }

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .marquee { overflow-x: auto; }
}
/* Keep the footer clear of the floating dock. */
body:has(.dock) .footer-inner { padding-bottom: 88px; }
html { overflow-x: clip; }
.abbr-tip { width: max-content; max-width: min(240px, 70vw); white-space: normal; text-align: center; }

/* ==========================================================================
   Homepage v3: matte black, electric blue, serif display
   ========================================================================== */

:root { --font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif; }

/* Matte grain over everything, very faint. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .05;
  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");
}

.brand-mark { border-color: var(--accent-line); color: var(--accent-hover); background: transparent; }

/* Hero */
.hero3 {
  position: relative;
  display: grid;
  place-items: center;
  min-height: max(380px, calc(86svh - var(--header-h)));
  margin-top: calc(-1 * var(--header-h));
  padding-block: var(--header-h) 52px;
  overflow: hidden;
  isolation: isolate;
}
.dots { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.hero3::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 26% at 50% 50%, rgba(14, 14, 15, .55), rgba(14, 14, 15, 0)),
    linear-gradient(to bottom, rgba(14, 14, 15, 0) 88%, var(--bg));
}
.hero3-inner { text-align: center; pointer-events: none; }
.hero3 [data-enter] { animation: rise 700ms var(--ease) both; animation-delay: var(--d, 0ms); }
.hero3-hi {
  margin: 0;
  color: var(--text-2);
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 38px);
  font-style: italic;
}
.hero3-name {
  margin: -.06em 0 0;
  font-family: var(--font-serif);
  font-size: clamp(86px, 17vw, 230px);
  font-weight: 400;
  font-style: italic;
  line-height: .9;
  letter-spacing: -.035em;
}
.hero3-name > span:not(.mag) { color: var(--accent); font-style: normal; }
.hero3-line {
  margin: 22px 0 0;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.5vw, 17px);
}
.rotator {
  position: relative;
  display: inline-grid;
  height: 1.5em;
  overflow: hidden;
  vertical-align: bottom;
  color: var(--accent-hover);
}
.rotator-word { grid-area: 1 / 1; white-space: nowrap; transform: translateY(110%); transition: transform 520ms var(--ease), opacity 520ms var(--ease); opacity: 0; }
.rotator-word.is-in { transform: none; opacity: 1; }
.rotator-word.is-out { transform: translateY(-110%); opacity: 0; }
.hero3-hint {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  white-space: nowrap;
}
@media (hover: none) { .hero3-hint { display: none; } }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  display: inline-flex;
  gap: 8px;
  transform: translateX(-50%);
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.scroll-cue:hover { color: var(--text); }

/* Intro */
.intro3 { padding-top: clamp(80px, 12vw, 150px); }
.intro3-lead {
  max-width: 30ch;
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.15;
  letter-spacing: -.015em;
}
.intro3-lead .pill { font-family: var(--font-sans); font-size: .55em; vertical-align: .25em; padding: 2px 10px; }
.intro3-lead .abbr { font-style: italic; border-bottom-color: var(--accent); }
.intro3-lead .abbr-tip { font-family: var(--font-sans); font-style: normal; letter-spacing: 0; }
.intro3-sub { max-width: 62ch; margin: 0; color: var(--text-2); font-size: clamp(16px, 1.5vw, 18px); line-height: 1.7; }
mark {
  padding: 0 .15em;
  background: linear-gradient(to top, var(--accent-soft) 0 45%, transparent 45%);
  color: var(--text);
}

/* Sections */
.sec {
  --maxw: 1000px;
  padding-top: clamp(36px, 4.5vw, 60px);
}
.sec-lead { max-width: 60ch; margin: 0 0 36px; color: var(--text-2); font-size: clamp(16px, 1.5vw, 18px); line-height: 1.7; }

/* Hand-drawn underline that draws in when its section appears. */
.scribble { position: relative; display: inline-block; }
.scribble svg {
  position: absolute;
  left: -2%;
  bottom: -.12em;
  width: 104%;
  height: .26em;
  overflow: visible;
}
.scribble path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  transition: stroke-dashoffset 900ms var(--ease) 250ms;
}
.is-visible .scribble path,
html:not(.js) .scribble path { stroke-dashoffset: 0; }

.more {
  display: inline-flex;
  gap: 8px;
  margin-top: 28px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.more:hover { color: var(--accent-hover); }

/* Project rows */
.rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.rows li { border-bottom: 1px solid var(--line-soft); }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(145px, 180px) minmax(0, 1fr);
  align-items: center;
  gap: 2px clamp(12px, 2vw, 24px);
  padding: 8px 0;
  color: var(--text);
  text-decoration: none;
}
.row-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.feature-media.row-thumb { min-height: 0; aspect-ratio: 8 / 5; }
.row:hover { color: var(--text); }
.row-name { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; transition: color var(--t-hover) var(--ease), transform var(--t-hover) var(--ease); }
.row:hover .row-name { color: var(--accent-hover); transform: translateX(4px); }
.row-desc { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.4; }
.row-tags { display: flex; gap: 6px; }
.tag {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}
.row:hover .tag { border-color: var(--accent-line); color: var(--accent-hover); }
@media (max-width: 760px) {
  .row { grid-template-columns: 52px minmax(0, 1fr); }
  .row-thumb { grid-row: span 2; }
  .row-name { align-self: end; }
  .row-desc { align-self: start; }
}

/* Jobs */
.jobs { margin: 0; padding: 0; list-style: none; }
.job {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px 32px;
  padding: 22px 0;
  border-top: 1px solid var(--line-soft);
  transition: opacity 240ms var(--ease);
}
.job:last-child { border-bottom: 1px solid var(--line-soft); }
@media (hover: hover) { .jobs:hover .job:not(:hover) { opacity: .5; } }
.job-when { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.job h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.job h3 a { color: var(--text); text-decoration: none; }
.job h3 a:hover { color: var(--accent-hover); }
.job p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.55; }
.job-tag { color: var(--accent); font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
@media (max-width: 760px) {
  .job { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* Toolkit */
.kit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kit-col {
  padding: 26px 24px 22px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--bg-2);
  transition: border-color 240ms var(--ease), transform 240ms var(--ease);
}
.kit-col:hover { border-color: var(--accent-line); transform: translateY(-3px); }
.kit-col h3 { margin: 0 0 16px; font-family: var(--font-serif); font-size: 28px; font-weight: 400; font-style: italic; }
.kit-col ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.kit-col li { padding: 4px 11px; border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 14px; }
@media (max-width: 860px) { .kit { grid-template-columns: minmax(0, 1fr); } }

/* Notes */
.notes3 { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.notes3 li { border-bottom: 1px solid var(--line-soft); }
.notes3 a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: clamp(14px, 3vw, 24px);
  padding: 14px 0;
  color: var(--text);
  text-decoration: none;
}
.note3-title { font-size: 18px; font-weight: 500; letter-spacing: -.015em; transition: color var(--t-hover) var(--ease); }
.notes3 a:hover .note3-title { color: var(--accent-hover); }
.notes3 time { flex-shrink: 0; color: var(--text-2); font-family: var(--font-mono); font-size: 13px; }

/* Numbers */
.numbers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.numbers li { display: flex; flex-direction: column; gap: 8px; }
.num { font-family: var(--font-serif); font-size: clamp(52px, 6vw, 80px); line-height: .9; color: var(--accent); }
.numbers li span:last-child { color: var(--text-2); font-size: 14.5px; line-height: 1.45; }
@media (max-width: 760px) { .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; } }

/* Contact */
.contact3 { padding-bottom: clamp(28px, 4vw, 56px); }
.contact3 .email-row {
  gap: 4px 8px;
  margin-bottom: 0;
  padding-inline-start: clamp(12px, 3vw, 20px);
}
.contact3 .copy-button { margin-left: 0; padding-inline: 8px; }
@media (min-width: 380px) {
  .contact3 .email-row { flex-wrap: nowrap; }
}
.aside3 { margin: 40px 0 0; color: var(--muted); font-size: 14.5px; }

/* Serif headings across subpages too */
.page-heading { font-family: var(--font-serif); font-weight: 400; font-style: italic; letter-spacing: -.02em; }
.note-header .page-heading { font-style: normal; letter-spacing: -.015em; }

/* v3.1: more minimal */
.hero3-line { line-height: 1.5; }
.rotator { vertical-align: top; height: 1.5em; justify-items: start; text-align: left; transition: width 420ms var(--ease); }
.rotator-word { line-height: 1.5em; }
.hero3-hint { display: none; }

.work-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2.4vw, 24px); }
.work-cols > div {
  padding: clamp(18px, 2.8vw, 28px);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.col-label {
  margin: 0 0 12px;
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.work-list { margin: 0; padding-inline-start: 1em; color: var(--text-2); }
.work-list li + li { margin-top: 10px; }
.work-list li::marker { color: var(--muted); }
.work-list a { align-self: flex-start; color: var(--text); font-size: 17px; font-weight: 500; letter-spacing: -.015em; text-decoration: none; transition: color var(--t-hover) var(--ease); }
.work-list a:hover { color: var(--accent-hover); }
.work-list p { margin: 0; }
.work-list p a { font-size: inherit; letter-spacing: inherit; text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.work-list span { color: var(--muted); font-size: 14px; }
@media (max-width: 760px) { .work-cols { grid-template-columns: minmax(0, 1fr); } }

/* v3.2 */
.hero3-line { position: relative; z-index: 1; }
.rotator-word.is-out { pointer-events: none; }
.work-list .work-name { color: var(--text); font-size: 17px; font-weight: 500; letter-spacing: -.015em; }
.page-heading .dot { color: var(--accent); font-style: normal; }

.courses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.courses li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--bg-2);
  transition: border-color var(--t-hover) var(--ease), transform var(--t-hover) var(--ease);
}
.courses li:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.courses .course-code { color: var(--accent); font-family: var(--font-mono); font-size: 12px; }
.courses .course-name { color: var(--text); font-size: 16px; line-height: 1.4; }
@media (max-width: 620px) { .courses { grid-template-columns: minmax(0, 1fr); } }
/* Only clip vertically, so a word can never get cut off at the side. */
.rotator { overflow: visible; overflow-y: clip; transition: none; }
.work-list .work-under { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.work-list .work-under a { align-self: auto; color: var(--text-2); font-size: inherit; font-weight: 400; letter-spacing: 0; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.work-list .work-under a:hover { color: var(--accent-hover); text-decoration-color: var(--accent); }

/* ==========================================================================
   v4 effects
   ========================================================================== */

/* Project preview with physics */
.row-preview.is-physics {
  width: 300px;
  transform-origin: 50% 50%;
  transition: opacity 220ms var(--ease);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(91, 147, 255, .18);
}

.copy-button { transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease), transform 260ms var(--ease); }


/* ==========================================================================
   v5: dot-assembly intro
   ========================================================================== */

/* The name is hidden until the dots have assembled it (never longer than 4s). */
.hero3-name { transition: opacity 700ms var(--ease), filter 700ms var(--ease); }
@media (prefers-reduced-motion: no-preference) {
  .js .hero3-name:not(.is-ready) {
    opacity: 0;
    filter: brightness(2.2);
    animation: name-fallback 1ms 4s forwards;
  }
}
@keyframes name-fallback { to { opacity: 1; filter: none; } }

/* Cross-page transitions: project titles carry over from the list into their page. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: 420ms; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 260ms; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* Spring-driven nav indicator (replaces the per-link underline on desktop) */
@media (min-width: 761px) { .site-nav.has-indicator { position: relative; } }
.nav-indicator {
  position: absolute;
  left: 0;
  bottom: 3px;
  width: 1px;
  height: 1px;
  background: var(--accent);
  transform-origin: 0 50%;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}
@media (min-width: 761px) {
  .site-nav.has-indicator a::after { display: none; }
}
@media (max-width: 760px) { .nav-indicator { display: none; } }
.nav-label { display: inline-block; white-space: nowrap; }

/* Spring-driven project preview */
.row-preview.is-spring {
  width: 300px;
  transform-origin: 50% 50%;
  transition: opacity 200ms var(--ease);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(91, 147, 255, .16);
}

/* Spring rail beside lists */
.has-rail { position: relative; }
.rail {
  position: absolute;
  top: 0;
  left: -22px;
  width: 2px;
  height: 1px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: 50% 0;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}
@media (max-width: 1240px) { .rail { left: -12px; } }
@media (max-width: 560px) { .rail { display: none; } }
.copy-label { display: inline-block; min-width: 6ch; text-align: left; }

/* Note demos: small live plots that appear on hover/focus */
.notes3 a { position: relative; }
.note-demo {
  position: absolute;
  top: 50%;
  right: 96px;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(-50%) translateX(6px);
  transition: opacity 240ms var(--ease), transform 320ms var(--ease);
  pointer-events: none;
}
.note-demo.is-on { opacity: 1; transform: translateY(-50%); }
.note-demo canvas { display: block; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg-2); }
.note-demo-caption { max-width: 150px; color: var(--muted); font-family: var(--font-mono); font-size: 10px; line-height: 1.35; letter-spacing: .02em; text-align: right; }
@media (max-width: 1180px), (hover: none) { .note-demo { display: none; } }

/* FTC CAD showcases */
.project-brief { width: min(980px, calc(100% - 2 * var(--gutter))); }
.brief-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  grid-template-areas: "heading model";
  column-gap: clamp(24px, 4vw, 54px);
  align-items: center;
}
.project-brief .project-header { grid-area: heading; margin: 0; }
.project-brief .project-header .page-heading { line-height: 1; }
.project-brief .project-lead { margin: 0; line-height: 1.4; }
.brief-cad { grid-area: model; min-width: 0; }
.brief-cad .cad-stage:not(.is-expanded) { height: clamp(280px, 36vw, 432px); min-height: 0; background: var(--bg); }
.brief-cad .cad-caption { margin-top: 8px; color: var(--text-2); }

@media (max-width: 680px) {
  .brief-overview { grid-template-columns: 1fr; grid-template-areas: "heading" "model"; }
  .project-brief { padding-top: 28px; }
  .project-brief .project-back { margin-bottom: 20px; }
  .project-brief .project-header { margin-bottom: 16px; }
  .project-brief .project-header .page-heading { margin-bottom: 8px; }
  .brief-cad { margin-bottom: 18px; }
  .brief-cad .cad-stage:not(.is-expanded) { height: clamp(200px, 62vw, 330px); }
}
