/* ============== Tokens ============== */
:root {
  --paper: oklch(0.97 0.005 80);
  --paper-2: oklch(0.94 0.008 80);
  --ink: oklch(0.18 0.01 240);
  --ink-2: oklch(0.32 0.01 240);
  --ink-3: oklch(0.55 0.01 240);
  --rule: oklch(0.85 0.01 80);
  --rule-2: oklch(0.90 0.008 80);
  --accent: oklch(0.62 0.16 35);
  --accent-ink: oklch(0.32 0.12 35);
  --signal: oklch(0.72 0.17 145);

  --font-mono: "JetBrains Mono", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", "Source Serif 4", Georgia, serif;

  --pad-x: clamp(20px, 5vw, 64px);
  --pad-section: clamp(72px, 10vw, 140px);
  --max: 1280px;

  --tex-opacity: 0.06;
}

[data-theme="dark"] {
  --paper: oklch(0.16 0.008 240);
  --paper-2: oklch(0.20 0.01 240);
  --ink: oklch(0.96 0.005 80);
  --ink-2: oklch(0.82 0.01 80);
  --ink-3: oklch(0.62 0.01 80);
  --rule: oklch(0.30 0.01 240);
  --rule-2: oklch(0.24 0.01 240);
  --accent: oklch(0.74 0.16 45);
  --accent-ink: oklch(0.86 0.12 45);
  --signal: oklch(0.78 0.17 145);
}

[data-theme="terminal"] {
  --paper: oklch(0.14 0.02 150);
  --paper-2: oklch(0.18 0.025 150);
  --ink: oklch(0.88 0.16 145);
  --ink-2: oklch(0.72 0.14 145);
  --ink-3: oklch(0.52 0.10 145);
  --rule: oklch(0.32 0.06 145);
  --rule-2: oklch(0.24 0.05 150);
  --accent: oklch(0.85 0.18 90);
  --accent-ink: oklch(0.90 0.18 90);
  --signal: oklch(0.78 0.17 145);
}

[data-density="compact"] {
  --pad-section: clamp(48px, 7vw, 96px);
}
[data-density="airy"] {
  --pad-section: clamp(96px, 14vw, 200px);
}

/* ============== Reset / base ============== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  position: relative;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ============== Texture ============== */
body[data-texture="grid"]::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to right, var(--ink) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ink) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: var(--tex-opacity);
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
body[data-texture="dots"]::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--ink) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: calc(var(--tex-opacity) * 1.4);
}
body[data-texture="lines"]::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(
    0deg, var(--ink) 0 1px, transparent 1px 32px
  );
  opacity: var(--tex-opacity);
}
body[data-texture="paper"]::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(var(--ink) 0.5px, transparent 0.5px),
    radial-gradient(var(--ink) 0.5px, transparent 0.5px);
  background-size: 8px 8px, 13px 13px;
  background-position: 0 0, 4px 7px;
  opacity: calc(var(--tex-opacity) * 0.8);
}

/* ============== Layout primitives ============== */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  position: relative;
  z-index: 1;
}

.section {
  padding-top: var(--pad-section);
  padding-bottom: var(--pad-section);
  border-top: 1px solid var(--rule);
  position: relative;
}
.section:first-of-type { border-top: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.section-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}
@media (max-width: 720px) {
  .section-grid { grid-template-columns: 1fr; gap: 24px; }
}

.section-label {
  position: sticky;
  top: 24px;
}
.section-label .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}
.section-label .name {
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}

/* ============== Top bar ============== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad-x);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar .left, .topbar .right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar .mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.topbar .mark .glyph {
  width: 14px; height: 14px;
  background: var(--ink);
  position: relative;
}
.topbar .mark .glyph::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--paper);
}
.topbar .nav {
  display: flex;
  gap: 18px;
  color: var(--ink-3);
}
.topbar .nav a:hover { color: var(--ink); }
.topbar .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
}
.topbar .status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--signal) 25%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@media (max-width: 720px) {
  .topbar .nav { display: none; }
}

/* ============== Hero ============== */
.hero {
  padding-top: clamp(60px, 10vw, 120px);
  padding-bottom: clamp(60px, 10vw, 120px);
  position: relative;
}
.hero-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 56px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.hero-meta .right { text-align: right; }

.hero h1 {
  font-family: var(--font-sans);
  font-size: clamp(48px, 8.5vw, 132px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
}
.hero h1 .accent {
  color: var(--accent);
  font-style: italic;
  font-family: var(--font-serif);
  font-weight: 400;
}
.hero-sub {
  margin-top: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 80px);
  align-items: start;
}
@media (max-width: 720px) {
  .hero-sub { grid-template-columns: 1fr; gap: 32px; }
}
.hero-intro {
  display: flex;
  flex-direction: column;
}
.hero-sub .lede {
  margin: 0;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 38ch;
  text-wrap: pretty;
}
.hero-project-note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(11px, 0.95vw, 13px);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  max-width: 56ch;
}
.hero-video-wrap {
  min-width: 0;
}
.hero-video-wrapper {
  position: relative;
}
.hero-video-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 22px 12px 10px;
  background: linear-gradient(to top, oklch(0.08 0.01 240 / 0.82) 0%, transparent 100%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: oklch(0.88 0.01 80 / 0.9);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hero-video-overlay-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}
.hero-video-frame {
  margin: 0;
  border: 1px solid var(--rule);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--paper-2) 72%, var(--accent) 28%), var(--paper-2));
  padding: 10px;
  overflow: hidden;
}
.hero-video-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px -10px 10px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.hero-video-bar-dots {
  display: flex;
  gap: 4px;
}
.hero-video-bar-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.hero-video-bar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.hero-video {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.hero-video-caption {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hero-video-controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.hero-video-audio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.hero-video-audio:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hero-video-volume {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  padding: 6px 10px;
  min-height: 32px;
}
.hero-video-volume span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hero-video-volume input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rule) 78%, var(--paper));
  outline: none;
}
.hero-video-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--accent) 70%, var(--ink));
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 24%, transparent);
  cursor: pointer;
}
.hero-video-volume input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rule) 78%, var(--paper));
}
.hero-video-volume input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1px solid color-mix(in oklab, var(--accent) 70%, var(--ink));
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 24%, transparent);
  cursor: pointer;
}
.hero-video-volume[data-muted="true"] input[type="range"]::-webkit-slider-thumb {
  background: var(--ink-3);
  border-color: var(--ink-3);
  box-shadow: none;
}
.hero-video-volume[data-muted="true"] input[type="range"]::-moz-range-thumb {
  background: var(--ink-3);
  border-color: var(--ink-3);
  box-shadow: none;
}
.hero-video-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.hero-video-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .hero-video-controls {
    gap: 6px;
  }
  .hero-video-volume {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .hero-video-volume input[type="range"] {
    width: min(58vw, 190px);
  }
}
.hero-sub .stack,
.hero-stack {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero-stack {
  margin-top: 30px;
  max-width: 760px;
}
.hero-sub .stack .row,
.hero-stack .row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  border-top: 1px dashed var(--rule);
  padding: 8px 0;
}
.hero-sub .stack .k,
.hero-stack .k {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.hero-sub .stack .v,
.hero-stack .v { color: var(--ink); }

@media (max-width: 720px) {
  .hero-video {
    aspect-ratio: 16 / 10;
  }
  .hero-stack {
    margin-top: 22px;
  }
}

.hero-rule {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.hero-rule .line {
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.hero-rule .tick {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-rule .tick::before {
  content: "";
  width: 1px; height: 8px; background: var(--ink-3);
}

/* ============== About ============== */
.about-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 5vw, 80px);
}
@media (max-width: 900px) {
  .about-body { grid-template-columns: 1fr; }
}
.about-body p {
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 24px;
  text-wrap: pretty;
}
.about-body p .em {
  color: var(--accent);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}
.about-focus {
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}
.about-focus-item {
  margin: 0 0 12px;
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}
.about-focus-item:last-child { margin-bottom: 0; }
.about-focus-label {
  display: inline-block;
  min-width: 96px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.about-footnote {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.about-footnote-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 6px;
}
.about-card {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  position: relative;
}
.about-card .head {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding: 10px 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.about-card .body {
  padding: 14px;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 14px;
}
.about-card .body .k { color: var(--ink-3); }
.about-card .body .v { color: var(--ink); }

/* ============== Projects ============== */
.projects {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}
.project {
  display: grid;
  grid-template-columns: 60px 1fr 1.2fr 220px;
  gap: clamp(16px, 3vw, 32px);
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
}
.project:hover {
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}
.project:hover .project-arrow {
  transform: translateX(4px);
  color: var(--accent);
}
.project:hover .project-title {
  color: var(--accent-ink);
}
@media (max-width: 1200px) {
  .project { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .project .project-desc, .project .project-meta, .project .project-tags { grid-column: 2; }
}
.project-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding-top: 4px;
}
.project-title {
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 0.2s ease;
  font-family: var(--font-sans);
}
.project-title .arrow {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--ink-3);
  transition: transform 0.25s ease, color 0.2s ease;
  vertical-align: middle;
}
.project:hover .project-title .arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}
.project-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  min-width: 0;
}
.project-run {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-family: var(--font-mono);
}
.project-run-try {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.project-run-cmd {
  font-size: 12.5px;
  color: var(--ink);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3px 9px;
}
a.project-run-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}
a.project-run-link:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.project-run-ext {
  font-size: 10px;
  color: var(--accent);
}
/* Featured-on chip: a mini terminal window - dark ground + phosphor green
   in every theme, distinguishing it from the accent-tinted "try it" chip. */
a.project-run-link.project-featured-link {
  color: var(--signal);
  background: oklch(0.16 0.02 150);
  border-color: oklch(0.34 0.06 145);
}
a.project-run-link.project-featured-link:hover {
  border-color: var(--signal);
  color: var(--signal);
}
a.project-run-link.project-featured-link .project-run-ext {
  color: var(--signal);
}
.project-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.project-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--rule);
  padding: 3px 8px;
  color: var(--ink-2);
  border-radius: 999px;
  background: var(--paper);
}
.project-lang-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.project-lang-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* schematic illustration on hover */
.project-schema {
  grid-column: 1 / -1;
  height: 0;
  overflow: hidden;
  transition: height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.project[data-open="true"] .project-schema {
  height: 220px;
}
.project-schema[data-image="true"] {
  height: auto;
  max-height: 0;
  transition: max-height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.project[data-open="true"] .project-schema[data-image="true"] {
  height: auto;
  max-height: 800px;
}
.project-schema-inner {
  height: 220px;
  margin-top: 16px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-schema[data-image="true"] .project-schema-inner {
  height: auto;
  overflow: visible;
}
.project-schema-inner svg {
  width: 100%;
  height: 100%;
  color: var(--ink-2);
}
.project-schema-img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  height: auto;
  display: block;
  opacity: 0.88;
  filter: saturate(0.7);
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.project-schema-inner:hover .project-schema-img {
  opacity: 1;
  filter: saturate(1);
}
.project-schema-img-label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--paper-2);
  padding: 2px 6px;
  border: 1px solid var(--rule);
}
.proj-gallery {
  width: 100%;
  display: flex;
  flex-direction: column;
}
.proj-gallery-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  position: relative;
  z-index: 1;
}
.proj-gallery-bar .project-schema-img-label {
  position: static;
  background: none;
  border: none;
  padding: 0;
}
.proj-gallery-btn {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  padding: 0;
}
.proj-gallery-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.proj-gallery-counter {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  min-width: 28px;
  text-align: center;
}
.proj-gallery-caption {
  position: static;
  background: none;
  border: none;
  padding: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-thumb {
  display: block;
  margin-top: 12px;
  width: 100%;
  max-width: 160px;
  height: auto;
  border: 1px solid var(--rule);
  opacity: 0.72;
  filter: saturate(0.55);
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.project:hover .project-thumb {
  opacity: 0.9;
  filter: saturate(0.8);
}

/* ============== Writing ============== */
.writing-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--rule);
}
.write-item {
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  align-items: start;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  cursor: pointer;
  transition: padding-left 0.3s ease;
}
.write-item:hover { padding-left: 12px; }
.write-item:hover .write-title { color: var(--accent-ink); }
.write-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}
.write-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}
.write-title-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.write-title .arr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  margin-left: 6px;
}
.write-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  margin: 0;
  max-width: 64ch;
}
.write-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.write-body {
  padding: 28px 0 36px;
  border-bottom: 1px solid var(--rule);
}
.post-content {
  max-width: 72ch;
}
.post-p {
  font-size: clamp(15px, 1.2vw, 17px);
  color: var(--ink-2);
  line-height: 1.75;
  margin: 0 0 18px;
}
.post-imgs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.post-figure {
  margin: 0;
}
.post-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
}
.post-caption {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-top: 6px;
  display: block;
}
.post-list {
  margin: 0 0 18px 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-2);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.6;
}
.post-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 20px;
}
.post-link {
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.post-link:hover {
  border-bottom-color: var(--accent);
}
@media (max-width: 720px) {
  .post-imgs { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .write-item { grid-template-columns: 1fr; gap: 4px; }
  .write-tag { text-align: left; }
}

/* ============== Experience ============== */
.exp-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}
.exp {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.exp-when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding-top: 4px;
}
.exp-role { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.exp-place { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.exp-desc { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
@media (max-width: 720px) {
  .exp { grid-template-columns: 1fr; gap: 6px; }
}

/* ============== Contact ============== */
.contact {
  padding-top: var(--pad-section);
  padding-bottom: var(--pad-section);
  border-top: 1px solid var(--rule);
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
}
@media (max-width: 720px) { .contact-grid { grid-template-columns: 1fr; } }
.contact h2 {
  font-size: clamp(40px, 6vw, 88px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0;
}
.contact h2 .em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.contact-link {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  align-items: baseline;
  transition: padding-left 0.25s ease;
}
.contact-link:last-child { border-bottom: 1px solid var(--rule); }
.contact-link:hover { padding-left: 8px; }
.contact-link:hover .v { color: var(--accent); }
.contact-link .k { color: var(--ink-3); text-transform: uppercase; }
.contact-link .v { color: var(--ink); transition: color 0.2s ease; }

/* ============== Footer ============== */
.footer {
  padding: 32px var(--pad-x);
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-wrap: wrap;
  gap: 12px;
}

/* ============== Reveal animation ============== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ============== Cursor blink ============== */
.cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.85em;
  background: currentColor;
  vertical-align: -0.05em;
  margin-left: 0.05em;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* ============== Type variants ============== */
[data-type="serif"] {
  --font-sans: "Instrument Serif", "Source Serif 4", Georgia, serif;
}
[data-type="serif"] .hero h1 {
  font-weight: 400;
  letter-spacing: -0.02em;
}
[data-type="serif"] .hero h1 .accent {
  font-style: italic;
}
[data-type="grotesk"] {
  --font-sans: "Space Grotesk", "Inter Tight", system-ui, sans-serif;
}
[data-type="humanist"] {
  --font-sans: "Fraunces", Georgia, serif;
  --font-serif: "Instrument Serif", Georgia, serif;
}

/* ============== Open Source ============== */
.oss-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.oss-filter {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 10px;
  border: 1px solid var(--rule);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.oss-filter:hover { color: var(--ink); }
.oss-filter[data-active="true"] {
  color: var(--accent-ink);
  border-color: var(--accent);
}
.oss-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}
.oss-item {
  position: relative;
  display: grid;
  grid-template-columns: 100px 1fr 130px;
  gap: 24px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  transition: padding-left 0.3s ease;
}
.oss-item:hover { padding-left: 12px; }
.oss-item:hover .oss-title { color: var(--accent-ink); }
.oss-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}
.oss-main { min-width: 0; }
.oss-title {
  display: block;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}
/* Stretch the title link over the whole row, so the row stays clickable
   without wrapping the notes (and their own links) in an anchor. */
.oss-title::after {
  content: "";
  position: absolute;
  inset: 0;
}
.oss-title .arr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.oss-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-right: 10px;
  letter-spacing: 0.02em;
}
.oss-note {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  margin: 4px 0 0;
  max-width: 64ch;
}
/* Lifted above the stretched title link so cross-references stay clickable. */
.oss-note-link {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.oss-note-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.oss-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.oss-badge[data-state="merged"] { color: var(--accent); }
.oss-badge[data-state="open"]   { color: var(--signal); }
.oss-empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 720px) {
  .oss-item { grid-template-columns: 1fr; gap: 4px; }
  .oss-badge { text-align: left; }
}
.oss-collapse {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 10px;
  margin-bottom: 16px;
  border: 1px solid var(--rule);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.oss-collapse:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
}
