/* ============================================================
   Editorial Engineering — portfolio stylesheet
   Newsreader (display serif) · Hanken Grotesk (body) · JetBrains Mono (technical)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --paper:      oklch(98.8% 0.006 85);
  --paper-2:    oklch(96.6% 0.008 80);
  --paper-3:    oklch(94.2% 0.010 80);
  --ink:        oklch(23% 0.022 262);
  --ink-soft:   oklch(43% 0.020 262);
  --ink-faint:  oklch(57% 0.016 262);
  --line:       oklch(88% 0.010 262);
  --line-soft:  oklch(92% 0.008 262);
  --accent:     oklch(48% 0.135 256);
  --accent-ink: oklch(40% 0.135 256);
  --accent-tint: oklch(48% 0.135 256 / 0.10);
  --warm:       oklch(58% 0.125 48);
  --warm-tint:  oklch(58% 0.125 48 / 0.12);
  --shadow-1:   0 1px 2px oklch(23% 0.02 262 / 0.04), 0 4px 14px oklch(23% 0.02 262 / 0.05);
  --shadow-2:   0 2px 6px oklch(23% 0.02 262 / 0.06), 0 18px 40px oklch(23% 0.02 262 / 0.10);

  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1120px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 14px;

  color-scheme: light;
}

[data-theme="dark"] {
  --paper:      oklch(19% 0.018 264);
  --paper-2:    oklch(22.5% 0.020 264);
  --paper-3:    oklch(26% 0.022 264);
  --ink:        oklch(94% 0.012 90);
  --ink-soft:   oklch(78% 0.016 262);
  --ink-faint:  oklch(62% 0.018 262);
  --line:       oklch(33% 0.022 264);
  --line-soft:  oklch(28% 0.020 264);
  --accent:     oklch(74% 0.125 250);
  --accent-ink: oklch(80% 0.110 250);
  --accent-tint: oklch(74% 0.125 250 / 0.14);
  --warm:       oklch(74% 0.110 55);
  --warm-tint:  oklch(74% 0.110 55 / 0.14);
  --shadow-1:   0 1px 2px oklch(0% 0 0 / 0.20), 0 4px 14px oklch(0% 0 0 / 0.28);
  --shadow-2:   0 2px 6px oklch(0% 0 0 / 0.24), 0 18px 44px oklch(0% 0 0 / 0.42);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01";
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.5s ease;
}

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

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* ---------- Atmospheric background ---------- */
.bg-grain {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1300px 820px at 10% -10%, color-mix(in oklab, var(--accent) 17%, transparent), transparent 62%),
    radial-gradient(1050px 720px at 100% 4%, color-mix(in oklab, var(--warm) 16%, transparent), transparent 58%),
    radial-gradient(1000px 680px at 50% 112%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 60%);
  opacity: 0.85;
  transition: opacity 0.5s ease;
}
[data-theme="dark"] .bg-grain {
  background:
    radial-gradient(1300px 820px at 10% -10%, color-mix(in oklab, var(--accent) 24%, transparent), transparent 62%),
    radial-gradient(1050px 720px at 100% 4%, color-mix(in oklab, var(--warm) 20%, transparent), transparent 58%),
    radial-gradient(1000px 680px at 50% 112%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 60%);
}
.bg-grain::after {
  content: ""; position: absolute; inset: 0;
  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='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.030; mix-blend-mode: multiply;
}
[data-theme="dark"] .bg-grain::after { mix-blend-mode: screen; opacity: 0.045; }

/* ---------- Layout primitives ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(72px, 11vh, 140px); position: relative; }
.section + .section { border-top: 1px solid var(--line-soft); }

.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: inline-flex; align-items: baseline; gap: 0.7em;
}
.kicker .num { color: var(--accent); font-weight: 500; }
.kicker::before {
  content: ""; width: 26px; height: 1px; background: var(--accent);
  align-self: center; opacity: 0.7;
}

.section-head { margin-bottom: clamp(32px, 5vh, 56px); max-width: 720px; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-top: 18px;
}
.section-head .lede {
  margin-top: 18px; font-size: 1.08rem; color: var(--ink-soft); max-width: 60ch;
  text-wrap: pretty;
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--accent); color: white; padding: 10px 16px; border-radius: 8px;
  transition: top 0.2s ease; font-weight: 600;
}
.skip:focus { top: 16px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in oklab, var(--paper) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 24px;
}
.brand {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.9rem;
  letter-spacing: 0.02em; display: inline-flex; align-items: center; gap: 10px;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  font-size: 0.86rem; color: var(--ink-soft); padding: 8px 13px; border-radius: 8px;
  font-weight: 500; position: relative; transition: color 0.2s ease, background 0.2s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--paper-2); }
.nav-tools { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line); display: grid; place-items: center;
  color: var(--ink-soft); transition: all 0.25s ease; background: var(--paper);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Compact top-bar controls */
.nav-tools .nav-cta.btn { height: 34px; padding: 0 12px; font-size: 0.82rem; border-radius: 8px; gap: 7px; }
.nav-tools .nav-cta.btn svg { width: 15px; height: 15px; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 19px; border-radius: 10px; font-weight: 600; font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: 1px solid transparent; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: white; box-shadow: var(--shadow-1); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
[data-theme="dark"] .btn-primary { color: oklch(18% 0.02 264); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--paper); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-line { color: var(--ink-soft); padding-inline: 4px; }
.btn-line:hover { color: var(--accent); }

.nav-cta { display: inline-flex; }

.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(56px, 9vh, 104px); padding-bottom: clamp(56px, 9vh, 110px); position: relative; }
.hero-grid {
  display: grid; grid-template-columns: 1.55fr 1fr; gap: clamp(32px, 6vw, 80px);
  align-items: end;
}
.hero-status {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em;
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: 100px;
  padding: 6px 14px 6px 11px; background: var(--paper-2);
}
.hero-status .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: oklch(64% 0.17 150);
  box-shadow: 0 0 0 0 oklch(64% 0.17 150 / 0.5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 oklch(64% 0.17 150 / 0.5); }
  70% { box-shadow: 0 0 0 7px oklch(64% 0.17 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(64% 0.17 150 / 0); }
}
.hero h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.9rem, 8.2vw, 6.2rem); line-height: 0.98;
  letter-spacing: -0.028em; margin-top: 26px;
}
.hero h1 .accent { font-style: italic; color: var(--accent); font-weight: 400; }
.hero-role {
  font-family: var(--font-mono); font-size: clamp(0.86rem, 1.5vw, 1.02rem);
  letter-spacing: 0.01em; color: var(--ink-soft); margin-top: 24px;
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
}
.hero-role .sep { color: var(--accent); }
.hero-tagline {
  margin-top: 26px; font-size: clamp(1.05rem, 1.7vw, 1.22rem); color: var(--ink-soft);
  max-width: 46ch; text-wrap: pretty; line-height: 1.55;
}
.hero-cta { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }

.hero-aside {
  border-left: 1px solid var(--line); padding-left: clamp(20px, 3vw, 36px);
  padding-bottom: 6px;
}
.hero-aside .ha-label {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
}
.hero-stats { display: grid; gap: 22px; margin-top: 18px; }
.hero-stats .stat .v {
  font-family: var(--font-display); font-size: 2.1rem; line-height: 1; color: var(--ink);
  font-weight: 500;
}
.hero-stats .stat .v small { font-size: 1rem; color: var(--accent); }
.hero-stats .stat .l { font-size: 0.82rem; color: var(--ink-faint); margin-top: 6px; }

.hero-marquee {
  margin-top: clamp(48px, 8vh, 92px); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding-block: 16px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}
.marquee-track {
  display: flex; gap: 44px; width: max-content; animation: marquee 38s linear infinite;
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.marquee-track span { display: inline-flex; align-items: center; gap: 44px; }
.marquee-track span::after { content: "—"; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }
.hero-marquee:hover .marquee-track { animation-play-state: paused; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.about-aside { position: sticky; top: 100px; }
.about-portrait {
  aspect-ratio: 4/5; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background:
    linear-gradient(150deg, var(--paper-2), var(--paper-3));
  position: relative; box-shadow: var(--shadow-1);
}
.about-portrait .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.14em; text-transform: uppercase; text-align: center; gap: 10px;
  background-image: repeating-linear-gradient(45deg, transparent 0 14px, color-mix(in oklab, var(--line) 50%, transparent) 14px 15px);
}
.about-portrait .ph-mono { font-family: var(--font-display); font-size: 2.4rem; font-style: italic; color: var(--ink-faint); letter-spacing: 0; }
.about-meta { margin-top: 22px; display: grid; gap: 14px; }
.about-meta .row {
  display: flex; justify-content: space-between; gap: 16px; font-size: 0.88rem;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
.about-meta .row .k { color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; }
.about-meta .row .val { color: var(--ink); text-align: right; font-weight: 500; }

.about-body p {
  font-size: clamp(1.08rem, 1.5vw, 1.3rem); line-height: 1.6; color: var(--ink);
  text-wrap: pretty; margin-bottom: 1.1em; font-weight: 400;
}
.about-body p .lead-cap::first-letter { } /* reserved */
.about-body p strong { font-weight: 600; color: var(--ink); }
.about-body .pull {
  font-family: var(--font-display); font-style: italic; font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  line-height: 1.35; color: var(--accent-ink); border-left: 2px solid var(--accent);
  padding-left: 22px; margin: 32px 0; font-weight: 400;
}
.about-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

/* ---------- Tag / badge ---------- */
.tag {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em;
  padding: 5px 11px; border-radius: 7px; border: 1px solid var(--line);
  color: var(--ink-soft); background: var(--paper-2); white-space: nowrap;
}
.tag.solid { background: var(--accent-tint); color: var(--accent-ink); border-color: transparent; }
.tag.tag-lang { background: var(--warm-tint); color: var(--warm); border-color: transparent; }

/* ---------- Research ---------- */
.pub {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  padding: clamp(22px, 3vw, 34px); box-shadow: var(--shadow-1);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}
.pub + .pub { margin-top: 22px; }
.pub:hover { box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.pub-top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: baseline; justify-content: space-between; }
.pub-venue {
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); display: inline-flex; gap: 10px; align-items: center;
}
.pub-venue .yr { color: var(--ink-faint); }
.pub-type {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px;
}
.pub h3 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.18; margin-top: 16px; letter-spacing: -0.01em;
}
.pub-authors { margin-top: 12px; color: var(--ink-soft); font-size: 0.95rem; }
.pub-authors .me { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pub-cite {
  margin-top: 14px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint);
  line-height: 1.7; background: var(--paper); border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 12px 14px; word-break: break-word;
}
.pub-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pub-abstract {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s ease;
  margin-top: 0;
}
.pub-abstract > div { overflow: hidden; }
.pub.open .pub-abstract { grid-template-rows: 1fr; margin-top: 18px; }
.pub-abstract p {
  color: var(--ink-soft); font-size: 0.98rem; line-height: 1.7; padding-top: 18px;
  border-top: 1px solid var(--line-soft); text-wrap: pretty;
}
.abstract-toggle {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono);
  font-size: 0.76rem; letter-spacing: 0.04em; color: var(--accent); font-weight: 500;
}
.abstract-toggle .chev { transition: transform 0.3s ease; }
.pub.open .abstract-toggle .chev { transform: rotate(180deg); }

.wip {
  margin-top: 22px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start;
  border: 1px dashed var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 28px);
  background: var(--warm-tint);
}
.wip .wip-badge {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--warm); border: 1px solid var(--warm); border-radius: 6px; padding: 4px 9px; white-space: nowrap;
  align-self: start;
}
.wip h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; line-height: 1.2; }
.wip p { color: var(--ink-soft); font-size: 0.96rem; margin-top: 8px; text-wrap: pretty; }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }
.filter {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em;
  padding: 8px 15px; border-radius: 100px; border: 1px solid var(--line);
  color: var(--ink-soft); background: var(--paper); transition: all 0.2s ease;
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-theme="dark"] .filter[aria-pressed="true"] { background: var(--accent); color: oklch(18% 0.02 264); border-color: var(--accent); }
.filter .count { opacity: 0.55; margin-left: 6px; }

.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow 0.35s ease, border-color 0.35s ease, opacity 0.35s ease;
}
.card.hide { display: none; }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--accent) 35%, var(--line)); }
.card-thumb {
  aspect-ratio: 16/9; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  display: grid; place-items: center;
}
.card-thumb .ph {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
}
.card-thumb svg.glyph { width: 56px; height: 56px; color: var(--accent); opacity: 0.85; }
.card-thumb img.glyph { width: 56px; height: 56px; object-fit: contain; opacity: 0.95; }
.thumb-a { background: linear-gradient(140deg, oklch(94% 0.05 256), oklch(90% 0.07 256)); }
.thumb-b { background: linear-gradient(140deg, oklch(94% 0.05 150), oklch(90% 0.06 168)); }
.thumb-c { background: linear-gradient(140deg, oklch(95% 0.05 70), oklch(91% 0.07 48)); }
.thumb-d { background: linear-gradient(140deg, oklch(94% 0.05 310), oklch(90% 0.06 286)); }
.thumb-e { background: linear-gradient(140deg, oklch(94% 0.04 200), oklch(90% 0.06 214)); }
[data-theme="dark"] .thumb-a { background: linear-gradient(140deg, oklch(34% 0.07 256), oklch(28% 0.06 256)); }
[data-theme="dark"] .thumb-b { background: linear-gradient(140deg, oklch(34% 0.07 158), oklch(28% 0.05 168)); }
[data-theme="dark"] .thumb-c { background: linear-gradient(140deg, oklch(36% 0.07 60), oklch(29% 0.06 44)); }
[data-theme="dark"] .thumb-d { background: linear-gradient(140deg, oklch(34% 0.07 304), oklch(28% 0.05 286)); }
[data-theme="dark"] .thumb-e { background: linear-gradient(140deg, oklch(34% 0.06 204), oklch(28% 0.05 214)); }
.card-thumb .grid-overlay {
  position: absolute; inset: 0; opacity: 0.5;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 26px 26px; mix-blend-mode: overlay;
}
.card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card-eyebrow { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.card h3 {
  font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; line-height: 1.15;
  margin-top: 8px; letter-spacing: -0.01em;
}
.card p { color: var(--ink-soft); font-size: 0.95rem; margin-top: 10px; line-height: 1.55; text-wrap: pretty; flex: 1; }
.card-stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.card-stack .tag { font-size: 0.68rem; padding: 4px 9px; }
.card-links { display: flex; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.card-links a {
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-soft); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; transition: color 0.2s ease, gap 0.2s ease;
}
.card-links a:hover { color: var(--accent); gap: 9px; }
.card-links a svg { width: 14px; height: 14px; }

/* ---------- Experience ---------- */
.timeline { position: relative; }
.tl-item {
  display: grid; grid-template-columns: 200px 1fr; gap: clamp(20px, 4vw, 56px);
  padding-block: clamp(26px, 4vh, 40px); position: relative;
}
.tl-item + .tl-item { border-top: 1px solid var(--line-soft); }
.tl-when { }
.tl-when .yr { font-family: var(--font-mono); font-size: 0.84rem; color: var(--accent); letter-spacing: 0.02em; }
.tl-when .place { font-family: var(--font-display); font-size: 1.3rem; margin-top: 8px; line-height: 1.2; font-weight: 500; }
.tl-when .where { font-size: 0.84rem; color: var(--ink-faint); margin-top: 6px; }
.tl-role h3 { font-size: 1.06rem; font-weight: 600; letter-spacing: -0.005em; }
.tl-role .stack { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); margin-top: 6px; letter-spacing: 0.03em; }
.tl-bullets { list-style: none; margin-top: 16px; display: grid; gap: 11px; }
.tl-bullets li { position: relative; padding-left: 24px; color: var(--ink-soft); font-size: 0.97rem; line-height: 1.55; text-wrap: pretty; }
.tl-bullets li::before {
  content: ""; position: absolute; left: 2px; top: 0.62em; width: 7px; height: 7px;
  border: 1.5px solid var(--accent); border-radius: 2px; transform: rotate(45deg);
}
.tl-bullets li strong { color: var(--ink); font-weight: 600; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.skill-group { background: var(--paper); padding: clamp(22px, 3vw, 32px); transition: background 0.3s ease; }
.skill-group:hover { background: var(--paper-2); }
.skill-group .sg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.skill-group .sg-num { font-family: var(--font-mono); font-size: 0.74rem; color: var(--accent); }
.skill-group h3 { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); font-weight: 600; }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-list .s {
  font-size: 0.9rem; color: var(--ink); padding: 7px 13px; border-radius: 8px;
  background: var(--paper-2); border: 1px solid var(--line); transition: all 0.2s ease; cursor: default;
}
.skill-group:hover .skill-list .s { background: var(--paper-3); }
.skill-list .s:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- Writing ---------- */
.writing-list { display: grid; gap: 2px; }
.post {
  display: grid; grid-template-columns: auto 1fr auto; gap: clamp(16px, 3vw, 40px);
  align-items: center; padding: clamp(20px, 3vh, 28px) clamp(8px, 2vw, 22px);
  border-radius: var(--radius); transition: background 0.25s ease, padding-left 0.25s ease;
  border-bottom: 1px solid var(--line-soft); position: relative;
}
.writing-list .post:last-child { border-bottom: none; }
.post:hover { background: var(--paper-2); }
.post-meta { display: flex; flex-direction: column; gap: 6px; min-width: 96px; }
.post-date { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-faint); letter-spacing: 0.02em; }
.post-kind {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; width: fit-content; font-weight: 500;
}
.post-kind.eng { background: var(--accent-tint); color: var(--accent-ink); }
.post-kind.res { background: var(--warm-tint); color: var(--warm); }
.post-main h3 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.2; letter-spacing: -0.01em; transition: color 0.2s ease;
}
.post:hover .post-main h3 { color: var(--accent); }
.post-main p { color: var(--ink-soft); font-size: 0.92rem; margin-top: 6px; text-wrap: pretty; max-width: 62ch; }
.post-read {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; transition: color 0.2s ease, gap 0.2s ease;
}
.post:hover .post-read { color: var(--accent); gap: 12px; }
.post-read svg { width: 15px; height: 15px; }

/* Writing channels (problem-solving + notes) */
.channels { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 30px; }
.channel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  padding: clamp(22px, 3vw, 30px); display: flex; flex-direction: column; gap: 14px;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.channel:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--accent) 35%, var(--line)); }
.channel-top { display: flex; align-items: center; gap: 14px; }
.channel-ic {
  width: 44px; height: 44px; border-radius: 11px; flex: none; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-tint); border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent);
}
.channel-ic svg { width: 21px; height: 21px; }
.channel h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.45rem; line-height: 1.1; letter-spacing: -0.01em; }
.channel .ch-count { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--ink-faint); margin-top: 4px; }
.channel p { color: var(--ink-soft); font-size: 0.96rem; line-height: 1.55; text-wrap: pretty; }
.channel .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.channel .chips .tag { font-size: 0.68rem; padding: 4px 9px; }
.channel .go {
  margin-top: auto; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--accent);
  display: inline-flex; align-items: center; gap: 8px; transition: gap 0.2s ease;
}
.channel:hover .go { gap: 12px; }
.channel .go svg { width: 15px; height: 15px; }

/* ---------- Contact ---------- */
.contact-card {
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); overflow: hidden;
  background: var(--paper-2); box-shadow: var(--shadow-1);
  display: grid; grid-template-columns: 1.1fr 0.9fr;
}
.contact-left { padding: clamp(30px, 5vw, 56px); }
.contact-left h2 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1.04; letter-spacing: -0.02em;
}
.contact-left h2 .accent { font-style: italic; color: var(--accent); }
.contact-left p { color: var(--ink-soft); margin-top: 18px; font-size: 1.05rem; max-width: 42ch; text-wrap: pretty; }
.contact-cta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
.contact-right {
  border-left: 1px solid var(--line); padding: clamp(24px, 4vw, 40px);
  display: flex; flex-direction: column; gap: 2px; background: var(--paper);
}
.cl {
  display: flex; align-items: center; gap: 16px; padding: 16px 8px;
  border-bottom: 1px solid var(--line-soft); transition: padding-left 0.25s ease, color 0.2s ease;
}
.contact-right .cl:last-child { border-bottom: none; }
.cl:hover { padding-left: 16px; }
.cl .ic { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-soft); flex: none; transition: all 0.2s ease; }
.cl:hover .ic { color: var(--accent); border-color: var(--accent); }
.cl .ic svg { width: 18px; height: 18px; }
.cl .cl-k { display: block; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.cl .cl-v { display: block; font-size: 0.95rem; color: var(--ink); font-weight: 500; margin-top: 2px; word-break: break-word; }
.cl .arr { margin-left: auto; color: var(--ink-faint); transition: transform 0.2s ease, color 0.2s ease; }
.cl:hover .arr { color: var(--accent); transform: translate(3px, -3px); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 44px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.footer-inner .fb { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); letter-spacing: 0.03em; }
.footer-inner .fb a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.footer-inner .fb a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.to-top { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 8px; }
.to-top:hover { color: var(--accent); }
.to-top svg { width: 15px; height: 15px; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: 0.06s; }
.reveal[data-d="2"] { transition-delay: 0.12s; }
.reveal[data-d="3"] { transition-delay: 0.18s; }
.reveal[data-d="4"] { transition-delay: 0.24s; }
.reveal[data-d="5"] { transition-delay: 0.30s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* Hero load animation */
.hero-anim { opacity: 0; transform: translateY(26px); animation: heroIn 0.9s cubic-bezier(.2,.7,.2,1) forwards; }
.hero-anim[data-d="1"] { animation-delay: 0.05s; }
.hero-anim[data-d="2"] { animation-delay: 0.18s; }
.hero-anim[data-d="3"] { animation-delay: 0.30s; }
.hero-anim[data-d="4"] { animation-delay: 0.42s; }
.hero-anim[data-d="5"] { animation-delay: 0.54s; }
.hero-anim[data-d="6"] { animation-delay: 0.66s; }
@keyframes heroIn { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hero-anim { opacity: 1; transform: none; animation: none; }
}
/* Safety net: guarantee hero content is visible even if the timeline stalls */
.anims-ready .hero-anim { opacity: 1; transform: none; animation: none; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; gap: 40px; }
  .hero-aside { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 28px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .about-aside { position: static; max-width: 340px; }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-card { grid-template-columns: 1fr; }
  .contact-right { border-left: none; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .channels { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 1fr; gap: 16px; }
  .post { grid-template-columns: 1fr; gap: 12px; align-items: start; }
  .post-read { display: none; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .hero-stats .stat .v { font-size: 1.7rem; }
}
@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-cta .btn { flex: 1; justify-content: center; }
}

/* ---------- Mobile menu ---------- */
.mobile-menu {
  position: fixed; inset: 0; z-index: 150; background: var(--paper);
  display: flex; flex-direction: column; padding: 24px var(--gutter);
  transform: translateX(100%); transition: transform 0.4s cubic-bezier(.2,.7,.2,1);
}
.mobile-menu.open { transform: none; }
.mm-top { display: flex; justify-content: space-between; align-items: center; height: 44px; margin-bottom: 30px; }
.mm-links { display: flex; flex-direction: column; gap: 4px; }
.mm-links a {
  font-family: var(--font-display); font-size: 2rem; font-weight: 500; padding: 12px 0;
  border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: baseline;
}
.mm-links a .n { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.mm-cta { margin-top: auto; display: flex; gap: 12px; padding-top: 24px; }
.mm-cta .btn { flex: 1; justify-content: center; }
.mm-close { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; }

/* ============================================================
   Tweakable variants (driven by the Tweaks panel)
   --accent / --font-* / --radius are set inline on <html>;
   these classes cover what variables can't express.
   ============================================================ */
body.density-compact .section { padding-block: clamp(46px, 7vh, 86px); }
body.density-spacious .section { padding-block: clamp(98px, 15vh, 188px); }

body.no-nums .kicker .num { display: none; }
body.no-nums .kicker { gap: 0; }
body.no-nums .mm-links a .n { display: none; }

body.bg-minimal .bg-grain { opacity: 0; }
body.bg-grid .bg-grain {
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 54px 54px; opacity: 0.5;
}
body.bg-grid .bg-grain::after { opacity: 0; }

body.no-motion .reveal { opacity: 1; transform: none; transition: none; }
body.no-motion .hero-anim { animation: none; opacity: 1; transform: none; }
body.no-motion .marquee-track { animation: none; }

/* ============================================================
   Blog / Notes / Content / Post-detail pages
   (subpages that reuse the portfolio design system)
   ============================================================ */
.page-head { padding-bottom: 0; }
.page-head h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.02em;
  margin-top: 14px;
}
.page-head h1 .accent { font-style: italic; color: var(--accent); }
.page-head .lede { margin-top: 16px; font-size: 1.05rem; color: var(--ink-soft); max-width: 62ch; text-wrap: pretty; }

.list-section { padding-top: clamp(28px, 4vh, 44px); }

.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.blog-grid.one-col { grid-template-columns: 1fr; }
@media (max-width: 760px) { .blog-grid { grid-template-columns: 1fr; } }

.blog-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  padding: clamp(20px, 3vw, 26px); display: flex; flex-direction: column; gap: 12px;
  color: inherit;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
a.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--accent) 35%, var(--line)); }
.blog-card h3 {
  font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; line-height: 1.2;
  letter-spacing: -0.01em; transition: color 0.2s ease;
}
a.blog-card:hover h3 { color: var(--accent); }
.blog-card .excerpt { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; text-wrap: pretty; }
.blog-card .blog-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.blog-card .card-meta {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
.blog-card .date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.02em; }

/* Markdown body inside note/content cards */
.md-body { color: var(--ink-soft); font-size: 0.96rem; line-height: 1.6; }
.md-body :is(h1,h2,h3,h4) { font-family: var(--font-display); font-weight: 500; color: var(--ink); line-height: 1.2; margin: 0.6em 0 0.3em; }
.md-body p { margin: 0.5em 0; text-wrap: pretty; }
.md-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.md-body ul, .md-body ol { padding-left: 1.3em; margin: 0.5em 0; }
.md-body pre { background: var(--paper-3); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.84rem; white-space: pre-wrap; }
.md-body code { font-family: var(--font-mono); font-size: 0.86em; background: var(--paper-3); padding: 0.12em 0.4em; border-radius: 5px; }
.md-body pre code { background: none; padding: 0; }
.md-body img { border-radius: 10px; margin: 0.6em 0; }
.md-body blockquote { border-left: 2px solid var(--accent); padding-left: 16px; color: var(--ink-soft); font-style: italic; margin: 0.6em 0; }

.empty-state {
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--paper-2);
  padding: clamp(40px, 8vh, 80px); text-align: center; color: var(--ink-faint);
  font-family: var(--font-mono); letter-spacing: 0.06em;
}

/* Toggle buttons (hints / approaches) */
.toggle-btn {
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em;
  padding: 6px 13px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-soft);
  background: var(--paper); transition: all 0.2s ease;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.toggle-box { margin-top: 12px; }
.toggle-box hr { border: none; border-top: 1px solid var(--line-soft); margin: 12px 0; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; align-items: center; margin-top: clamp(38px, 6vh, 60px); }
.pager a, .pager > span {
  font-family: var(--font-mono); font-size: 0.82rem; min-width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--line); color: var(--ink-soft);
  background: var(--paper); transition: all 0.2s ease;
}
.pager a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.pager .current { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 500; }
[data-theme="dark"] .pager .current { background: var(--accent); color: oklch(18% 0.02 264); border-color: var(--accent); }
.pager .gap { border: none; background: none; color: var(--ink-faint); min-width: 24px; }
.pager .pg-arrow svg { width: 17px; height: 17px; }
.pager .pg-arrow.disabled { opacity: 0.35; border-color: var(--line-soft); background: none; cursor: default; }

/* Back link (icon button) */
.back-link {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 0.78rem; letter-spacing: 0.02em; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 100px; padding: 7px 15px 7px 11px;
  background: var(--paper); transition: all 0.2s ease; margin-bottom: 24px;
}
.back-link:hover { border-color: var(--accent); color: var(--accent); }
.back-link:hover svg { transform: translateX(-2px); }
.back-link svg { width: 15px; height: 15px; transition: transform 0.2s ease; }

/* ---------- Post detail ---------- */
.article-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(28px, 5vw, 52px); align-items: start; }
@media (max-width: 940px) { .article-wrap { grid-template-columns: 1fr; } }
/* min-width:0 lets the columns shrink so wide code/markdown wraps instead of
   forcing the grid (and the sidebar) to overflow. */
.article, .col-aside { min-width: 0; }
.article-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0 30px; }
.article-meta a.tag:hover { border-color: var(--accent); color: var(--accent); }
.article-content { color: var(--ink); font-size: 1.06rem; line-height: 1.75; }
.article-content :is(h1,h2,h3,h4,h5,h6) { font-family: var(--font-display); font-weight: 500; line-height: 1.18; letter-spacing: -0.01em; margin: 1.4em 0 0.5em; }
.article-content h1 { font-size: 1.9rem; } .article-content h2 { font-size: 1.55rem; } .article-content h3 { font-size: 1.3rem; }
.article-content p { margin: 0 0 1.1em; text-wrap: pretty; }
.article-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-content ul, .article-content ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.article-content li { margin: 0.3em 0; }
.article-content pre { background: var(--paper-3); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.86rem; white-space: pre-wrap; margin: 0 0 1.1em; }
.article-content code { font-family: var(--font-mono); font-size: 0.88em; background: var(--paper-3); padding: 0.12em 0.4em; border-radius: 5px; }
.article-content pre code { background: none; padding: 0; }
.article-content img { border-radius: 12px; margin: 1em 0; box-shadow: var(--shadow-1); }
.article-content blockquote { border-left: 2px solid var(--accent); padding-left: 20px; color: var(--ink-soft); font-style: italic; margin: 1.2em 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.1em 0; font-size: 0.92rem; }
.article-content th, .article-content td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

.aside-stack { display: grid; gap: 22px; position: sticky; top: 100px; }
@media (max-width: 940px) { .aside-stack { position: static; } }
.widget { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); padding: clamp(20px, 3vw, 26px); overflow: hidden; min-width: 0; }
.widget .sidebar-title { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; color: var(--ink-faint); margin-bottom: 14px; }
.widget .list-sidebar { list-style: none; display: grid; gap: 10px; }
.widget .list-sidebar a { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.4; transition: color 0.2s ease; overflow-wrap: anywhere; }
.widget .list-sidebar a:hover { color: var(--accent); }
/* Keep note/markdown content inside the narrow sidebar — long words, URLs and
   code wrap instead of stretching the widget. */
.widget .md-body { overflow-wrap: anywhere; word-break: break-word; }
.widget .md-body pre, .widget .md-body img, .widget .md-body table { max-width: 100%; }
.widget .blog-tags { max-width: 100%; }
.widget .blog-tags .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Blog post cards (redesigned) ---------- */
.post-card {
  position: relative; display: flex; flex-direction: column; gap: 13px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  padding: clamp(22px, 3vw, 28px); padding-left: clamp(24px, 3vw, 30px); color: inherit; overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .35s ease;
}
.post-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: top;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--accent) 32%, var(--line)); }
.post-card:hover::before { transform: scaleY(1); }
.pc-top { display: flex; align-items: center; gap: 11px; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; }
.pc-cat { text-transform: uppercase; color: var(--accent); font-weight: 500; }
.pc-top .dotsep { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faint); opacity: .55; flex: none; }
.pc-date { color: var(--ink-faint); }
.post-card h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.3rem, 2.2vw, 1.6rem); line-height: 1.18; letter-spacing: -0.01em; transition: color .2s ease; }
.post-card:hover h3 { color: var(--accent); }
.post-card .excerpt { color: var(--ink-soft); font-size: 0.94rem; line-height: 1.55; text-wrap: pretty; }
.pc-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pc-read { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; flex: none; transition: color .2s ease, gap .2s ease; }
.post-card:hover .pc-read { color: var(--accent); gap: 11px; }
.pc-read svg { width: 14px; height: 14px; }

/* ---------- highlight.js dark palette ----------
   The page loads the github (light) hljs theme; its base token color is dark
   and disappears on the dark code background. Override tokens in dark mode
   with a github-dark palette (higher specificity than the single-class theme). */
[data-theme="dark"] .hljs { color: #c9d1d9; background: transparent; }
[data-theme="dark"] .hljs-comment,
[data-theme="dark"] .hljs-quote { color: #8b949e; font-style: italic; }
[data-theme="dark"] .hljs-keyword,
[data-theme="dark"] .hljs-selector-tag,
[data-theme="dark"] .hljs-doctag,
[data-theme="dark"] .hljs-template-tag,
[data-theme="dark"] .hljs-type,
[data-theme="dark"] .hljs-meta .hljs-keyword,
[data-theme="dark"] .hljs-deletion { color: #ff7b72; }
[data-theme="dark"] .hljs-built_in,
[data-theme="dark"] .hljs-attr,
[data-theme="dark"] .hljs-variable,
[data-theme="dark"] .hljs-template-variable,
[data-theme="dark"] .hljs-symbol,
[data-theme="dark"] .hljs-bullet { color: #ffa657; }
[data-theme="dark"] .hljs-title,
[data-theme="dark"] .hljs-title.class_,
[data-theme="dark"] .hljs-title.function_,
[data-theme="dark"] .hljs-section { color: #d2a8ff; }
[data-theme="dark"] .hljs-string,
[data-theme="dark"] .hljs-attribute,
[data-theme="dark"] .hljs-addition,
[data-theme="dark"] .hljs-meta .hljs-string,
[data-theme="dark"] .hljs-regexp { color: #a5d6ff; }
[data-theme="dark"] .hljs-number,
[data-theme="dark"] .hljs-literal,
[data-theme="dark"] .hljs-selector-id,
[data-theme="dark"] .hljs-selector-class { color: #79c0ff; }
[data-theme="dark"] .hljs-name,
[data-theme="dark"] .hljs-tag { color: #7ee787; }
[data-theme="dark"] .hljs-meta,
[data-theme="dark"] .hljs-link { color: #8b949e; }
[data-theme="dark"] .hljs-emphasis { font-style: italic; }
[data-theme="dark"] .hljs-strong { font-weight: 700; }
