/* ─────────────────────────────────────────────
   Tokens
   ───────────────────────────────────────────── */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", ui-serif, Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --frame: 1180px;
  --gutter: clamp(20px, 4vw, 40px);
  --radius: 10px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root,
[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-elev: #ffffff;
  --bg-sunk: #efeee9;
  --fg: #111110;
  --fg-2: #3d3c39;
  --muted: #6f6d67;
  --line: rgba(17, 17, 16, 0.1);
  --line-strong: rgba(17, 17, 16, 0.18);
  --accent: #0751cf;
  --accent-fg: #ffffff;
  --accent-soft: rgba(7, 81, 207, 0.09);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 12px 32px -12px rgba(20, 20, 10, 0.18);

  /* editor (One Light-ish) */
  --ed-bg: #fbfbf9;
  --ed-panel: #f1f0eb;
  --ed-fg: #383a42;
  --ed-gutter: #a8a7a1;
  --ed-sel: rgba(7, 81, 207, 0.08);
  --c-key: #a626a4;
  --c-str: #50a14f;
  --c-num: #986801;
  --c-fn: #4078f2;
  --c-com: #a0a1a7;
  --c-prop: #e45649;
  --c-type: #c18401;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c0c0d;
  --bg-elev: #141416;
  --bg-sunk: #101012;
  --fg: #eeeeec;
  --fg-2: #c9c8c4;
  --muted: #8f8e89;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #5b8dff;
  --accent-fg: #06122b;
  --accent-soft: rgba(91, 141, 255, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 24px 60px -20px rgba(0, 0, 0, 0.7);

  /* editor (One Dark-ish) */
  --ed-bg: #17181b;
  --ed-panel: #1d1e22;
  --ed-fg: #abb2bf;
  --ed-gutter: #4b5059;
  --ed-sel: rgba(91, 141, 255, 0.1);
  --c-key: #c678dd;
  --c-str: #98c379;
  --c-num: #d19a66;
  --c-fn: #61afef;
  --c-com: #5c6370;
  --c-prop: #e06c75;
  --c-type: #e5c07b;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--accent-fg);
}

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

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "calt" 0;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.72em;
  padding: 0.1em 0.45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-elev);
  color: var(--muted);
  white-space: nowrap;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
}

.i {
  width: 16px;
  height: 16px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 6px;
}
.skip:focus {
  left: 8px;
}

/* ─────────────────────────────────────────────
   Frame: the vertical rails + crosshairs (zed-style)
   ───────────────────────────────────────────── */
.frame {
  position: relative;
  width: 100%;
  max-width: var(--frame);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.section > .frame,
.footer > .frame {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.section {
  position: relative;
  border-top: 1px solid var(--line);
}

/* crosshair "+" where section lines meet the rails */
.section > .frame::before,
.section > .frame::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 11px;
  height: 11px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) center / 1px 100% no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) center / 100% 1px no-repeat;
  pointer-events: none;
}
.section > .frame::before {
  left: -6px;
}
.section > .frame::after {
  right: -6px;
}

/* ─────────────────────────────────────────────
   Nav
   ───────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.nav-links a {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.15s, background-color 0.15s;
}
.nav-links a:hover,
.nav-links a.is-current {
  color: var(--fg);
  background: var(--bg-sunk);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.kbd-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}
.kbd-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}
.kbd-btn kbd {
  border-bottom-width: 1px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover {
  color: var(--fg);
  border-color: var(--muted);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
[data-theme="light"] .i-moon,
[data-theme="dark"] .i-sun {
  display: none;
}

/* ─────────────────────────────────────────────
   Buttons, pills, tags
   ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:active {
  transform: translateY(1px);
}
.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 14px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--fg));
}
.btn-ghost {
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
}
.btn-ghost:hover {
  border-color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tag-accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips span {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-sunk);
  font-size: 12px;
  color: var(--fg-2);
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Hero
   ───────────────────────────────────────────── */
.hero {
  border-top: 0;
  overflow: hidden;
}
.hero > .frame {
  padding-top: clamp(56px, 9vw, 104px);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero > .frame::before,
.hero > .frame::after {
  display: none;
}

/* faint dot grid behind the hero */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, #000 30%, transparent 75%);
  opacity: 0.7;
  pointer-events: none;
}

.hero-title {
  margin-top: 18px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero-title em,
.cta-title em {
  font-style: italic;
  color: var(--accent);
}
.hero-sub {
  margin-top: 24px;
  max-width: 620px;
  font-size: clamp(16px, 1.6vw, 18px);
  color: var(--muted);
  text-wrap: pretty;
}
.hero-sub strong {
  color: var(--fg);
  font-weight: 500;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}

/* ─────────────────────────────────────────────
   Timeline (hero)
   ───────────────────────────────────────────── */
.chrono {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin-top: clamp(40px, 6vw, 64px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--ed-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
}
.chrono::after {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--ed-panel);
}
.light {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.light-r { background: #ff5f57; }
.light-y { background: #febc2e; }
.light-g { background: #28c840; }
.window-title {
  margin-left: 12px;
  font-size: 12px;
  color: var(--muted);
}

.chrono-legend {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.chrono-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lg {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.lg-work { background: var(--accent); }
.lg-study { background: var(--c-type); }
.lg-project,
.lg-oss,
.lg-teach { border-radius: 50%; }
.lg-project { background: var(--fg); }
.lg-oss { background: var(--c-key); }
.lg-teach { background: var(--c-str); }

.chrono-body {
  display: grid;
  grid-template-columns: 64px 1fr;
}
.chrono-lanes {
  padding-top: var(--axis-h, 30px);
  border-right: 1px solid var(--line);
  background: var(--ed-panel);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.chrono-lanes span {
  display: flex;
  align-items: center;
  padding-left: 14px;
  border-top: 1px solid var(--line);
}

.chrono-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  outline: none;
}
.chrono-canvas {
  position: relative;
  min-width: 960px;
}

.chrono-year {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed var(--line);
}
.chrono-year span {
  position: absolute;
  top: 8px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.chrono-sep {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--line);
}
.chrono-now {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--accent);
}
.chrono-now span {
  position: absolute;
  top: 6px;
  left: 0;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 10px;
  transform: translateX(-50%);
}

.ev {
  position: absolute;
  cursor: pointer;
}
.ev:focus-visible {
  outline-offset: 3px;
}

.ev-bar {
  display: flex;
  align-items: center;
  min-width: 6px;
  padding: 0 6px;
  border: 1px solid;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  color: var(--fg-2);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.ev-bar span {
  overflow: hidden;
  text-overflow: clip;
}
.ev-work {
  background: color-mix(in srgb, var(--accent) 11%, var(--ed-bg));
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
}
.ev-study {
  background: color-mix(in srgb, var(--c-type) 14%, var(--ed-bg));
  border-color: color-mix(in srgb, var(--c-type) 40%, transparent);
}
.ev-work:hover,
.ev-work.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.ev-study:hover,
.ev-study.is-selected {
  background: var(--c-type);
  border-color: var(--c-type);
  color: #1b1400;
}
/* still going: fade out toward "now" */
.ev-bar.is-ongoing {
  border-right: 0;
  border-radius: 5px 0 0 5px;
  -webkit-mask-image: linear-gradient(90deg, #000 80%, rgba(0, 0, 0, 0.35));
  mask-image: linear-gradient(90deg, #000 80%, rgba(0, 0, 0, 0.35));
}

.ev-pin {
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 0 2px var(--ed-bg);
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}
.ev-oss { background: var(--c-key); }
.ev-teach { background: var(--c-str); }
.ev-pin:hover {
  transform: scale(1.3);
}
.ev-pin.is-selected {
  transform: scale(1.3);
  box-shadow: 0 0 0 2px var(--ed-bg), 0 0 0 3.5px var(--accent);
}
/* name tooltip on hover */
.ev-pin::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  transform: translateX(-50%) scale(0.77);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s;
}
.ev-pin.tip-end::after {
  left: auto;
  right: -4px;
  transform: scale(0.77);
  transform-origin: right bottom;
}
.ev-pin:hover::after {
  opacity: 1;
  visibility: visible;
}

.chrono-detail {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 124px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: var(--ed-panel);
}
.cd-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.cd-title {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cd-title .at {
  font-weight: 400;
  color: var(--muted);
}
.cd-stars {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.cd-desc {
  margin-top: 4px;
  max-width: 660px;
  font-size: 14px;
  color: var(--muted);
}
.cd-side {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.cd-link {
  font-size: 13px;
  color: var(--fg-2);
  transition: color 0.15s;
}
.cd-link:hover {
  color: var(--accent);
}
.cd-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.cd-nav .icon-btn {
  width: 30px;
  height: 30px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.tag-work { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.tag-study { border-color: transparent; background: color-mix(in srgb, var(--c-type) 16%, transparent); color: var(--c-type); }
.tag-oss { border-color: transparent; background: color-mix(in srgb, var(--c-key) 14%, transparent); color: var(--c-key); }
.tag-teach { border-color: transparent; background: color-mix(in srgb, var(--c-str) 16%, transparent); color: var(--c-str); }

/* stats under the hero */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: calc(100% + var(--gutter) * 2);
  margin: clamp(48px, 7vw, 72px) calc(var(--gutter) * -1) 0;
  border-top: 1px solid var(--line);
}
.stats > div {
  padding: 28px var(--gutter);
  border-left: 1px solid var(--line);
  text-align: left;
}
.stats > div:first-child {
  border-left: 0;
}
.stats dt {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stats dd {
  margin: 6px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ─────────────────────────────────────────────
   Pillars
   ───────────────────────────────────────────── */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 !important;
}
.pillar {
  padding: clamp(32px, 4vw, 48px) var(--gutter);
  border-left: 1px solid var(--line);
}
.pillar:first-child {
  border-left: 0;
}
.pillar-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg-elev);
  color: var(--accent);
}
.pillar-icon svg {
  width: 19px;
  height: 19px;
}
.pillar h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.pillar p {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Sections
   ───────────────────────────────────────────── */
.section:not(.hero):not(.pillars-section) > .frame {
  padding-top: clamp(64px, 9vw, 112px);
  padding-bottom: clamp(64px, 9vw, 112px);
}

.section-head {
  max-width: 640px;
  margin-bottom: clamp(36px, 5vw, 56px);
}
.section-head h2,
.split-col h2 {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(32px, 4.4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.section-head p {
  margin-top: 14px;
  font-size: 17px;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────── */
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
  box-shadow: var(--shadow);
}
.card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card:hover .card-media img {
  transform: scale(1.025);
}
.media-dark {
  background: #0d0d0f;
}
.media-light {
  background: #f8f8f8;
}
.media-light img {
  object-position: top;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 24px 24px;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.card h3 {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.card h3 a:hover {
  color: var(--accent);
}
.card p {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
  text-wrap: pretty;
}
.card-links {
  display: flex;
  gap: 18px;
  margin-top: auto;
  padding-top: 18px;
  font-size: 13px;
}
.card-links a {
  color: var(--fg-2);
  transition: color 0.15s;
}
.card-links a:hover {
  color: var(--accent);
}

.now-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.now-grid > .card-feature {
  grid-column: span 6;
  flex-direction: row;
}
.card-feature .card-media {
  flex: 1.6;
  aspect-ratio: auto;
  min-height: 340px;
  border-bottom: 0;
  border-right: 1px solid var(--line);
}
.card-feature .card-body {
  flex: 1;
  justify-content: center;
  padding: 36px;
}
.card-feature h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 34px;
  letter-spacing: -0.02em;
}
.card-feature .card-links {
  margin-top: 0;
  padding-top: 22px;
}
.now-grid > .card:not(.card-feature):not(.card-row) {
  grid-column: span 3;
}
.now-grid > .card-row {
  grid-column: span 6;
  flex-direction: row;
}
.card-row .card-media {
  flex: none;
  width: 42%;
  aspect-ratio: auto;
  border-bottom: 0;
  border-right: 1px solid var(--line);
}
.card-row .card-body {
  justify-content: center;
  padding: 32px 36px;
}

/* phone screenshot inside a soft backdrop */
.media-phone {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 28px 0;
  background:
    radial-gradient(circle at 50% 110%, var(--accent-soft), transparent 70%),
    var(--bg-sunk);
}
.media-phone img {
  width: 132px;
  height: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: #0e0e10;
  box-shadow: var(--shadow);
  transition: transform 0.4s var(--ease);
}
.card:hover .media-phone img {
  transform: translateY(-4px) rotate(-2deg);
}

/* TripBudget's illustrated media */
.media-formula {
  display: grid;
  place-items: center;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg-sunk);
}
.formula {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--fg-2);
}
.formula-big {
  font-size: 15px;
}
.formula-rule {
  align-self: stretch;
  height: 1px;
  background: var(--fg-2);
  margin: 2px 0;
}
.c-fn { color: var(--c-fn); }
.c-var { color: var(--c-prop); }
.budget-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 46px;
  margin-top: 14px;
}
.budget-bars span {
  width: 14px;
  height: var(--h);
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  transition: height 0.4s var(--ease);
}
.budget-bars .over {
  background: var(--c-prop);
}
.budget-bars .future {
  background: var(--line-strong);
}
.card:hover .budget-bars span:nth-child(odd) {
  height: calc(var(--h) - 10%);
}

/* ─────────────────────────────────────────────
   Open source
   ───────────────────────────────────────────── */
.oss-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.oss-feature .card-body,
.oss-zed .card-body {
  padding: 28px;
}
.oss-feature h3,
.oss-zed h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.02em;
}
.stars {
  color: var(--fg-2);
}

.pr-list {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.pr-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  transition: color 0.15s, padding-left 0.2s var(--ease);
}
.pr-list a:hover {
  color: var(--accent);
  padding-left: 6px;
}
.pr-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(130, 80, 223, 0.12);
  color: #8250df;
  font-size: 11px;
}
[data-theme="dark"] .pr-badge {
  background: rgba(163, 113, 247, 0.16);
  color: #a371f7;
}

.diff {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
  background: var(--ed-bg);
}
.diff-h {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--ed-panel);
  color: var(--muted);
}
.diff-l {
  padding: 3px 12px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ed-fg);
}
.diff-l.add {
  background: rgba(40, 200, 64, 0.1);
  color: var(--c-str);
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}
.repo {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s;
}
.repo:nth-child(3n) {
  border-right: 0;
}
.repo:nth-last-child(-n + 3) {
  border-bottom: 0;
}
.repo:hover {
  background: var(--bg-sunk);
}
.repo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.lang {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.repo h4 {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}
.repo:hover h4 {
  color: var(--accent);
}
.repo p {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.activity {
  margin-top: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}
.activity-head {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.activity-head a:hover {
  color: var(--accent);
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  background: #28c840;
  box-shadow: 0 0 0 0 rgba(40, 200, 64, 0.5);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(40, 200, 64, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 200, 64, 0);
  }
}
.activity-list a {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr auto;
  gap: 18px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background-color 0.15s;
}
.activity-list li:last-child a {
  border-bottom: 0;
}
.activity-list a:hover {
  background: var(--bg-sunk);
}
.a-name {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-desc {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-time {
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Experience
   ───────────────────────────────────────────── */
.timeline {
  border-top: 1px solid var(--line);
}
.job {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.job-when {
  padding-top: 3px;
  font-size: 13px;
  color: var(--muted);
}
.job:first-child .job-when {
  color: var(--accent);
}
.job h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.job .at {
  font-weight: 400;
  color: var(--muted);
}
.job p {
  margin-top: 8px;
  max-width: 720px;
  font-size: 15px;
  color: var(--muted);
}
.job .chips {
  margin-top: 14px;
}

/* ─────────────────────────────────────────────
   Education + stack
   ───────────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.split-col {
  padding: 0 var(--gutter);
}
.split-col + .split-col {
  border-left: 1px solid var(--line);
}
.edu {
  margin-top: 32px;
  border-top: 1px solid var(--line);
}
.edu li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.edu-when {
  padding-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.edu h3 {
  font-size: 16px;
  font-weight: 600;
}
.edu li:first-child h3 {
  color: var(--accent);
}
.edu p {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}
.langs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 22px;
  font-size: 12px;
  color: var(--muted);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 32px;
}
.stack-group h4 {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Contact CTA
   ───────────────────────────────────────────── */
.cta {
  overflow: hidden;
}
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 60% at 50% 100%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 6px var(--bg-elev), 0 0 0 7px var(--line);
}
.cta-title {
  margin-top: 32px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(38px, 5.6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  max-width: 14ch;
  text-wrap: balance;
}
.cta-sub {
  margin-top: 18px;
  max-width: 520px;
  font-size: 17px;
  color: var(--muted);
}
.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin-top: 36px;
  font-size: 13px;
}
.socials a {
  color: var(--muted);
  transition: color 0.15s;
}
.socials a:hover {
  color: var(--accent);
}

/* ─────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 24px;
  font-size: 12px;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Command palette
   ───────────────────────────────────────────── */
.palette {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14vh 16px 16px;
}
.palette[hidden] {
  display: none;
}
.palette-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 0.15s ease;
}
.palette-box {
  position: relative;
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: pop 0.18s var(--ease);
}
.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.palette-input-row svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}
.palette-input {
  flex: 1;
  height: 52px;
  border: 0;
  outline: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
}
.palette-input::placeholder {
  color: var(--muted);
}
.palette-list {
  max-height: 340px;
  padding: 6px;
  overflow: auto;
}
.palette-group {
  padding: 10px 10px 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
}
.palette-item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.palette-item .pi-icon {
  width: 18px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.palette-item[aria-selected="true"] .pi-icon {
  color: var(--accent);
}
.palette-item .pi-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.palette-empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.palette-foot {
  display: flex;
  gap: 18px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  transform: translateX(-50%);
  animation: pop 0.2s var(--ease);
}
.toast[hidden] {
  display: none;
}

/* ─────────────────────────────────────────────
   Reveal on scroll
   ───────────────────────────────────────────── */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ─────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────── */
@media (max-width: 960px) {
  .nav-links {
    display: none;
  }
  .oss-top {
    grid-template-columns: 1fr;
  }
  .repo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .repo:nth-child(3n) {
    border-right: 1px solid var(--line);
  }
  .repo:nth-child(2n) {
    border-right: 0;
  }
  .repo:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }
  .repo:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .split {
    grid-template-columns: 1fr;
    row-gap: 64px;
  }
  .split-col + .split-col {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 64px;
  }
}

@media (max-width: 760px) {
  .kbd-btn-label {
    display: none;
  }
  .kbd-btn {
    padding: 0 8px;
  }
  .chrono-legend {
    display: none;
  }
  .chrono-scroll {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px);
    mask-image: linear-gradient(90deg, transparent, #000 28px);
  }
  .chrono-body {
    grid-template-columns: 48px 1fr;
  }
  .chrono-lanes span {
    padding-left: 0;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }
  .chrono-detail {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .cd-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats > div:nth-child(3) {
    border-left: 0;
  }
  .stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .pillars {
    grid-template-columns: 1fr;
  }
  .pillar {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .pillar:first-child {
    border-top: 0;
  }
  .now-grid {
    grid-template-columns: 1fr;
  }
  .now-grid > .card,
  .now-grid > .card:not(.card-feature):not(.card-row) {
    grid-column: auto;
  }
  .now-grid > .card-feature,
  .now-grid > .card-row {
    flex-direction: column;
  }
  .card-feature .card-media {
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .card-feature .card-body {
    padding: 24px;
  }
  .card-feature h3 {
    font-size: 28px;
  }
  .card-row .card-media {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 240px;
  }
  .card-row .card-body {
    padding: 22px 24px 24px;
  }
  .media-formula {
    aspect-ratio: 16 / 10;
  }
  .repo-grid {
    grid-template-columns: 1fr;
  }
  .repo,
  .repo:nth-child(3n) {
    border-right: 0;
  }
  .repo:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
  .repo:last-child {
    border-bottom: 0;
  }
  .activity-list a {
    grid-template-columns: 1fr auto;
  }
  .a-desc {
    display: none;
  }
  .job {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .edu li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .footer-inner {
    flex-direction: column;
  }
  .footer-hint {
    display: none;
  }
}

@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;
  }
}
