/* =============================================================================
   ahmadusman.eu — design system
   Dark-first "secure terminal" aesthetic, editorial typography.
   Fonts: Geist (UI), Geist Mono (terminal accents), Instrument Serif (accents).
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #060a12;
  --bg-elev: #0a111d;
  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.08);
  --surface-solid: #0c1422;
  --inset-bg: rgba(0, 0, 0, 0.28);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #eceff4;
  --text-2: #a7afbd;
  --text-3: #7b8496;
  --accent: #3ee6a8;
  --accent-2: #7aa7ff;
  --accent-ink: #03140d;
  --accent-soft: rgba(62, 230, 168, 0.1);
  --accent-line: rgba(62, 230, 168, 0.35);
  --accent-glow: rgba(62, 230, 168, 0.38);
  --info-soft: rgba(122, 167, 255, 0.1);
  --info-line: rgba(122, 167, 255, 0.4);
  --violet: #c3a2ff;
  --violet-soft: rgba(195, 162, 255, 0.1);
  --violet-line: rgba(195, 162, 255, 0.38);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.1);
  --danger-line: rgba(255, 107, 122, 0.45);
  --warn: #ffc65c;
  --warn-soft: rgba(255, 198, 92, 0.1);
  --warn-line: rgba(255, 198, 92, 0.42);
  --grid-line: rgba(0, 240, 255, 0.045);
  --spot: rgba(62, 230, 168, 0.075);
  --glow-a: rgba(0, 240, 255, 0.1);
  --glow-b: rgba(37, 255, 156, 0.07);
  --noise-opacity: 0;
  --header-bg: rgba(6, 10, 18, 0.82);
  --backdrop-dim: rgba(3, 4, 6, 0.62);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 48px -32px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-2);

  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-serif: 'Instrument Serif', ui-serif, Georgia, 'Times New Roman', serif;

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f3;
  --bg-elev: #ffffff;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-2: rgba(12, 17, 22, 0.035);
  --surface-3: rgba(12, 17, 22, 0.065);
  --surface-solid: #ffffff;
  --inset-bg: rgba(12, 17, 22, 0.03);
  --border: rgba(12, 17, 22, 0.09);
  --border-2: rgba(12, 17, 22, 0.16);
  --text: #0c1116;
  --text-2: #444d5a;
  --text-3: #5f6875;
  --accent: #067a59;
  --accent-2: #2a5bd7;
  --accent-ink: #ffffff;
  --accent-soft: rgba(6, 122, 89, 0.08);
  --accent-line: rgba(6, 122, 89, 0.32);
  --accent-glow: rgba(6, 122, 89, 0.3);
  --info-soft: rgba(42, 91, 215, 0.07);
  --info-line: rgba(42, 91, 215, 0.32);
  --violet: #6b3fd0;
  --violet-soft: rgba(107, 63, 208, 0.07);
  --violet-line: rgba(107, 63, 208, 0.3);
  --danger: #c8283f;
  --danger-soft: rgba(200, 40, 63, 0.07);
  --danger-line: rgba(200, 40, 63, 0.35);
  --warn: #9a6200;
  --warn-soft: rgba(154, 98, 0, 0.08);
  --warn-line: rgba(154, 98, 0, 0.32);
  --grid-line: rgba(12, 17, 22, 0.05);
  --spot: rgba(6, 122, 89, 0.06);
  --glow-a: rgba(6, 160, 110, 0.12);
  --glow-b: rgba(42, 91, 215, 0.1);
  --noise-opacity: 0.05;
  --header-bg: rgba(246, 246, 243, 0.78);
  --backdrop-dim: rgba(236, 236, 232, 0.62);
  --shadow-card: 0 1px 2px rgba(12, 17, 22, 0.04), 0 18px 40px -28px rgba(12, 17, 22, 0.22);
  --shadow-pop: 0 30px 80px -20px rgba(12, 17, 22, 0.35), 0 0 0 1px var(--border-2);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  scrollbar-color: var(--border-2) transparent;
}
html.is-locked { overflow: hidden; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
p, li { text-wrap: pretty; }
em { font-style: italic; }

[hidden] { display: none !important; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }

.icon {
  display: inline-block;
  flex: none;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-text {
  display: inline-grid;
  place-items: center;
  width: 1.1em;
  height: 1.1em;
  font: 700 0.74em/1 var(--font-mono);
  letter-spacing: -0.04em;
}

kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  box-shadow: inset 0 -1px 0 var(--border);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -64px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* Inline links inside running text */
:is(.bento-bio, .now-list, .tl-org, .tl-note, .pub-more, .feed-source, .msg--bot, .lab-sub, .verdict-text, .section-intro, .footer-meta, .wip-card > p, .error-card > p) a:not(.btn) {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
:is(.bento-bio, .now-list, .tl-org, .tl-note, .pub-more, .feed-source, .msg--bot, .lab-sub, .verdict-text, .section-intro, .footer-meta, .wip-card > p, .error-card > p) a:not(.btn):hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Theme switch: circular reveal via the View Transitions API (see site.js) */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.no-transitions *, .no-transitions *::before, .no-transitions *::after { transition: none !important; }

/* ---------- Backdrop ---------- */
/* Dark (default): the original terminal backdrop — a full-page cyan grid with two soft glows. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 80% -10%, var(--glow-a), transparent 60%),
    radial-gradient(800px 500px at -10% 20%, var(--glow-b), transparent 55%);
}
.backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
}
.backdrop-glow { display: none; }

/* Light: lighter grid that fades out, drifting glows and a little paper grain. */
:root[data-theme="light"] .backdrop { background: none; }
:root[data-theme="light"] .backdrop-grid {
  background-size: 56px 56px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 15%, transparent 72%);
}
:root[data-theme="light"] .backdrop-glow {
  display: block;
  position: absolute;
  width: 72vmax;
  height: 72vmax;
  border-radius: 50%;
  will-change: transform;
}
.backdrop-glow--a {
  top: -38vmax;
  left: -22vmax;
  background: radial-gradient(closest-side, var(--glow-a), transparent);
  animation: drift-a 24s ease-in-out infinite alternate;
}
.backdrop-glow--b {
  top: -34vmax;
  right: -28vmax;
  background: radial-gradient(closest-side, var(--glow-b), transparent);
  animation: drift-b 28s ease-in-out infinite alternate;
}
.backdrop-noise {
  position: absolute;
  inset: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
@keyframes drift-a { to { transform: translate3d(9vmax, 7vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-7vmax, 9vmax, 0) scale(1.05); } }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s;
}
.site-header.is-scrolled,
.site-header.nav-open {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: var(--border);
}
.header-inner {
  max-width: calc(var(--container) + var(--gutter) * 2);
  height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-wrap { display: flex; align-items: center; gap: 9px; flex: 0 1 auto; min-width: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
}
.brand-user { color: var(--accent); }
.brand-path { color: var(--text-2); }
.brand-cmd {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--text);
  font-size: 13.5px;
  white-space: nowrap;
}
.brand-cmd-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand-caret {
  flex: none;
  width: 0.55em;
  height: 1.1em;
  margin-left: 2px;
  border-radius: 1px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.site-nav { position: relative; flex: none; margin-left: auto; }
.site-nav ul { display: flex; align-items: center; gap: 2px; }
.site-nav a {
  position: relative;
  z-index: 1;
  display: block;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.site-nav a:hover,
.site-nav a.is-active { color: var(--text); }
.nav-indicator {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 34px;
  margin-top: -17px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s var(--ease), width 0.45s var(--ease), opacity 0.25s;
}
.nav-indicator.is-visible { opacity: 1; }

.header-actions { display: flex; flex: none; align-items: center; gap: 8px; margin-left: 8px; }
:is(.brand, .brand-wrap) + .header-actions { margin-left: auto; }

.cmdk-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 7px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.cmdk-trigger:hover { color: var(--text); border-color: var(--accent-line); }
.cmdk-trigger .icon { width: 16px; height: 16px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent-line); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--sm .icon { width: 15px; height: 15px; }
.icon-btn.is-done { color: var(--accent); border-color: var(--accent-line); }

.theme-toggle .icon { transition: transform 0.5s var(--ease); }
.theme-toggle:hover .icon { transform: rotate(-20deg); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }
.menu-toggle .icon-close,
.nav-open .menu-toggle .icon-menu { display: none; }
.nav-open .menu-toggle .icon-close { display: block; }

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn .icon { width: 17px; height: 17px; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-3); border-color: var(--accent-line); transform: translateY(-1px); }
.btn-text { padding-inline: 10px; color: var(--text-2); }
.btn-text:hover { color: var(--text); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-sm { --btn-h: 38px; padding: 0 15px; font-size: 14px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-xs { --btn-h: 30px; padding: 0 11px; gap: 6px; font-size: 13px; }
.btn-xs .icon { width: 13px; height: 13px; }
.btn-xs.btn-text { padding-inline: 8px; }

.link-btn { color: var(--text-2); font: inherit; transition: color 0.2s; }
.link-btn:hover { color: var(--accent); }

/* ---------- Shared bits ---------- */
.pulse {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ping 2.2s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.7; }
  80%, 100% { transform: scale(2.8); opacity: 0; }
}

.prompt { color: var(--accent); }
.accent-serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--accent);
  padding-right: 0.04em;
}

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font: 500 12px/1.2 var(--font-sans);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  isolation: isolate;
  padding: clamp(20px, 2.4vw, 28px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s, background-color 0.35s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -100%), var(--spot), transparent 42%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.card:hover::before { opacity: 1; }
.card:hover { border-color: var(--border-2); }

.card-label {
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-static {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.3;
}

/* ---------- Reveal ---------- */
.js [data-reveal] { opacity: 0; }
.js [data-reveal].is-visible {
  animation: reveal 0.8s var(--ease) both;
  animation-delay: calc(var(--stagger, 0) * 70ms);
}
@keyframes reveal {
  from { opacity: 0; translate: 0 18px; }
  to { opacity: 1; translate: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(40px, 9vh, 104px);
  padding-bottom: clamp(40px, 7vh, 88px);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
}
.hero-copy > * { animation: rise 0.9s var(--ease) both; }
.hero-copy > :nth-child(2) { animation-delay: 0.06s; }
.hero-copy > :nth-child(3) { animation-delay: 0.12s; }
.hero-copy > :nth-child(4) { animation-delay: 0.18s; }
.hero-copy > :nth-child(5) { animation-delay: 0.24s; }
.hero-copy > :nth-child(6) { animation-delay: 0.3s; }
@keyframes rise {
  from { opacity: 0; translate: 0 16px; }
  to { opacity: 1; translate: none; }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.pill:hover { color: var(--text); border-color: var(--accent-line); }
.pill.mono { font-size: 12.5px; letter-spacing: 0.02em; }
.pill.mono:hover { color: var(--text-2); border-color: var(--border-2); }

.hero-title {
  margin-top: 24px;
  font-size: clamp(3rem, 8.4vw, 6.6rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.055em;
  padding-bottom: 0.05em;
  color: var(--text);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) and (color: color-mix(in oklab, red 50%, blue)) {
  .hero-title {
    background: linear-gradient(180deg, var(--text) 35%, color-mix(in oklab, var(--text) 50%, var(--bg)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.hero-lead {
  margin-top: 26px;
  max-width: 33ch;
  color: var(--text-2);
  font-size: clamp(1.18rem, 2vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: -0.012em;
}
.hero-lead .accent-serif { font-size: 1.14em; line-height: 1; }

.hero-role {
  margin-top: 22px;
  min-height: 1.7em;
  color: var(--text-3);
  font-size: 14.5px;
}
.hero-role-arrow { margin: 0 4px; }
.rotator { color: var(--text); }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

.hero-cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }

.socials { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 8px; }
.socials a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, transform 0.25s var(--ease), background-color 0.2s;
}
.socials a:hover { color: var(--text); border-color: var(--accent-line); background: var(--surface-2); transform: translateY(-2px); }
.socials .icon, .socials .icon-text { width: 18px; height: 18px; }

/* Identity card */
.id-card {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 380px;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid var(--border-2);
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  box-shadow: var(--shadow-pop);
  transform: perspective(1200px) rotateX(var(--tilt-y, 0deg)) rotateY(var(--tilt-x, 0deg));
  transition: transform 0.6s var(--ease);
  animation: rise 1s 0.2s var(--ease) both;
}
.id-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--angle), transparent 0 68%, var(--accent) 80%, var(--accent-2) 86%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: border-spin 7s linear infinite;
  pointer-events: none;
}
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes border-spin { to { --angle: 360deg; } }

.id-card-photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  background: #fff;
}
.id-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.id-card-photo::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3ee6a8, transparent);
  box-shadow: 0 0 18px 4px rgba(62, 230, 168, 0.45);
  opacity: 0;
  animation: scan 7s 1.2s var(--ease) infinite;
}
@keyframes scan {
  0% { top: 0; opacity: 0; }
  6% { opacity: 0.9; }
  30% { top: calc(100% - 2px); opacity: 0.9; }
  34%, 100% { top: calc(100% - 2px); opacity: 0; }
}
.id-chip {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(62, 230, 168, 0.45);
  background: rgba(8, 9, 12, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #e9fff6;
  font: 500 12px/1 var(--font-mono);
}
.id-chip .icon { width: 14px; height: 14px; color: #3ee6a8; }

.id-card-body { padding: 16px 10px 6px; font-size: 12.5px; }
.id-kv > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 0;
  border-top: 1px dashed var(--border-2);
}
.id-kv > div:first-child { border-top: 0; }
.id-kv dt { color: var(--text-3); }
.id-kv dd { min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-kv a { color: var(--accent-2); text-decoration: none; }
.id-kv a:hover { text-decoration: underline; }
.id-kv .id-ok { display: flex; align-items: center; gap: 6px; color: var(--accent); }

/* ---------- Sections ---------- */
.section { position: relative; padding-block: clamp(64px, 9vw, 112px); }
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(var(--container), calc(100% - var(--gutter) * 2));
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--border-2), transparent);
}
.section-head { max-width: 780px; margin-bottom: clamp(32px, 5vw, 56px); }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--text-2);
  font-size: 12.5px;
}
.eyebrow-index {
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
}
.eyebrow-cmd::before { content: "$ "; color: var(--text-3); }
.section-title {
  font-size: clamp(2.2rem, 5.2vw, 3.7rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
}
.section-title .accent-serif { letter-spacing: -0.02em; }
.section-intro {
  margin-top: 18px;
  max-width: 62ch;
  color: var(--text-2);
  font-size: clamp(1.03rem, 1.4vw, 1.15rem);
}

/* ---------- About ---------- */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.bento-bio { grid-column: span 4; }
.bento-now { grid-column: span 2; }
.bento > .card:nth-child(n + 3) { grid-column: span 2; }

.bio-lead {
  margin-bottom: 16px;
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.bento-bio p + p { margin-top: 14px; }
.bento-bio p:not(.bio-lead) { color: var(--text-2); }
.bento-bio strong { color: var(--text); font-weight: 600; }

.now-list { display: grid; gap: 16px; }
.now-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
}
.now-list .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }

.lang-list { display: grid; gap: 14px; }
.lang-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
}
.lang-meter { display: inline-flex; gap: 4px; }
.lang-meter i { width: 18px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.lang-meter[data-level="3"] i,
.lang-meter[data-level="2"] i:nth-child(-n + 2),
.lang-meter[data-level="1"] i:first-child { background: var(--accent); }
.lang-level { min-width: 12ch; color: var(--text-3); font: 12px var(--font-mono); text-align: right; }

/* ---------- Research ---------- */
.research-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.research-card { display: flex; flex-direction: column; gap: 12px; }
.research-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
.research-icon .icon { width: 22px; height: 22px; }
.research-card h3 { margin-top: 6px; font-size: 1.15rem; }
.research-card p { color: var(--text-2); font-size: 15px; }
.research-refs { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.research-card p.research-refs { font-size: 12px; }
.research-refs a {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.research-refs a:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* Attestation playground */
.lab { margin-top: 24px; padding: clamp(20px, 3vw, 36px); }
.lab-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 20px 32px; }
.lab-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; letter-spacing: 0.02em; }
.lab-title { margin-top: 10px; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.035em; }
.lab-sub { margin-top: 10px; max-width: 72ch; color: var(--text-2); font-size: 15px; }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  transition: background-color 0.2s, border-color 0.2s;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.25s var(--ease), background-color 0.2s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.switch:hover { color: var(--text); }

.lab-body {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
}
.lab-panel {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--inset-bg);
}
.lab-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.lab-label .icon { width: 15px; height: 15px; }

.chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stage {
  position: relative;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}
.stage:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -12px;
  width: 12px;
  height: 1px;
  background: var(--border-2);
}
.stage-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--text); font-weight: 600; }
.stage-version { margin-top: 2px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-hash { margin-top: 10px; color: var(--text-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--border-2); transition: background-color 0.3s, box-shadow 0.3s; }
.stage-flag {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  border: 1px solid currentColor;
}
.stage-flag:empty { display: none; }
.stage[data-state="measuring"] { border-color: var(--info-line); box-shadow: 0 0 0 3px var(--info-soft); }
.stage[data-state="measuring"] .stage-dot { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.stage[data-state="ok"] { border-color: var(--accent-line); background: var(--accent-soft); }
.stage[data-state="ok"] .stage-dot { background: var(--accent); }
.stage[data-state="bad"] { border-color: var(--danger-line); background: var(--danger-soft); }
.stage[data-state="bad"] .stage-dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.stage[data-state="unknown"] { border-color: var(--warn-line); background: var(--warn-soft); }
.stage[data-state="unknown"] .stage-dot { background: var(--warn); }
.stage-flag[data-kind="tampered"] { color: var(--danger); }
.stage-flag[data-kind="updated"] { color: var(--accent-2); }

.pcr {
  margin-top: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 6px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border-2);
  font-size: 12px;
}
.pcr-name { color: var(--accent); font-weight: 600; }
.pcr-op { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcr-value { grid-column: 1 / -1; color: var(--text); font-size: 12.5px; word-break: break-all; }
.pcr-value.is-flash { animation: flash 0.7s var(--ease); }
@keyframes flash { from { color: var(--accent); text-shadow: 0 0 14px var(--accent-glow); } }

.verdict {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.3s, background-color 0.3s;
}
.verdict-icon { width: 28px; height: 28px; color: var(--text-3); transition: color 0.3s; }
.verdict-title { font-weight: 600; letter-spacing: -0.01em; }
.verdict-text { margin-top: 2px; color: var(--text-2); font-size: 14px; }
.verdict[data-state="running"] .verdict-icon { color: var(--accent-2); animation: pulse-op 1s ease-in-out infinite; }
.verdict[data-state="trusted"] { border-color: var(--accent-line); background: var(--accent-soft); }
.verdict[data-state="trusted"] .verdict-icon { color: var(--accent); }
.verdict[data-state="untrusted"] { border-color: var(--danger-line); background: var(--danger-soft); }
.verdict[data-state="untrusted"] .verdict-icon { color: var(--danger); }
.verdict[data-state="stale"] { border-color: var(--warn-line); background: var(--warn-soft); }
.verdict[data-state="stale"] .verdict-icon { color: var(--warn); }
@keyframes pulse-op { 50% { opacity: 0.35; } }

.lab-facts { margin-top: 14px; display: grid; gap: 6px; font-size: 12px; }
.lab-facts > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; }
.lab-facts dt { color: var(--text-3); }
.lab-facts dd { min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lab-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }

.lab-log {
  margin-top: 16px;
  max-height: 220px;
  overflow: auto;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--inset-bg);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.7;
}
.lab-log:empty::before { content: "$ waiting for input…"; color: var(--text-3); }
.lab-log li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; animation: rise 0.3s var(--ease) both; }
.lab-log .t { color: var(--text-3); }
.lab-log .ok { color: var(--accent); }
.lab-log .err { color: var(--danger); }
.lab-log .warn { color: var(--warn); }
.lab-log .info { color: var(--accent-2); }
.lab-log .dim { color: var(--text-3); }

/* ---------- Publications ---------- */
.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-count { font: 11px var(--font-mono); opacity: 0.7; }
.chip-count:empty { display: none; }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-width: min(300px, 100%);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-3);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-field:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font-size: 14px; }
.search-field input::placeholder { color: var(--text-3); }
.search-field .icon { width: 16px; height: 16px; }

.pub-list { border-top: 1px solid var(--border); }
.pub {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 8px 24px;
  padding: 24px 12px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s, box-shadow 0.25s;
}
.pub:hover { background: var(--surface); }
.pub:target { animation: target-flash 2.4s var(--ease); }
@keyframes target-flash {
  0%, 35% { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  100% { background: transparent; box-shadow: inset 3px 0 0 transparent; }
}
.pub[hidden] { display: none; }
.pub-year { padding-top: 3px; color: var(--text-3); font-size: 14px; }
.js .pub:not(.show-year) .pub-year { visibility: hidden; }
.pub-title { font-size: 1.12rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.015em; }
.pub-title a {
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size 0.35s var(--ease), color 0.2s;
}
.pub-title a:hover { color: var(--accent); background-size: 100% 1px; }
.pub-authors { margin-top: 6px; color: var(--text-2); font-size: 14.5px; }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-venue { margin-top: 2px; color: var(--text-3); font-size: 14.5px; }
.pub-venue em { color: var(--text-2); }
.pub-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid;
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.02em;
}
.badge--journal { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.badge--conference { color: var(--accent-2); border-color: var(--info-line); background: var(--info-soft); }
.badge--workshop { color: var(--violet); border-color: var(--violet-line); background: var(--violet-soft); }
.badge--thesis { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.badge--manuscript { color: var(--text-2); border-color: var(--border-2); background: var(--surface-2); }
.tag {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  line-height: 1;
}
.pub-actions { display: flex; align-items: flex-start; gap: 6px; padding-top: 1px; }
.pub-empty { padding: 32px 12px; color: var(--text-3); text-align: center; }
.pub-more { margin-top: 24px; color: var(--text-3); font-size: 14.5px; }

/* ---------- Experience & education ---------- */
.journey { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); }
.col-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 1.05rem;
  font-weight: 600;
}
.col-title .icon { width: 20px; height: 20px; color: var(--accent); }

.timeline { position: relative; display: grid; gap: 14px; }
.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 6px;
  width: 1px;
  background: linear-gradient(var(--accent-line), var(--border) 35%, transparent);
}
.tl-item {
  position: relative;
  margin-left: 30px;
  padding: 18px 20px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s;
}
.tl-item:hover { border-color: var(--border-2); }
.tl-item::before {
  content: "";
  position: absolute;
  top: 23px;
  left: -30px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  background: var(--bg);
}
.tl-item.is-current::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl-time { color: var(--text-3); font-size: 12.5px; }
.tl-item.is-current .tl-time { color: var(--accent); }
.tl-title { margin-top: 6px; font-size: 1.08rem; letter-spacing: -0.015em; }
.tl-org { margin-top: 3px; color: var(--text-2); font-size: 14.5px; }
.tl-points { margin-top: 12px; display: grid; gap: 7px; }
.tl-points li { position: relative; padding-left: 18px; color: var(--text-2); font-size: 14.5px; }
.tl-points li::before {
  content: "";
  position: absolute;
  top: 0.75em;
  left: 2px;
  width: 7px;
  height: 1px;
  background: var(--accent);
}
.tl-note { margin-top: 10px; color: var(--text-2); font-size: 14.5px; }

.certs { margin-top: clamp(44px, 6vw, 68px); }
.cert-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cert { display: flex; flex-direction: column; gap: 4px; padding: 20px; }
.cert-mark {
  align-self: flex-start;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.cert-name { font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.cert-meta { color: var(--text-3); font-size: 12px; }

/* ---------- Teaching ---------- */
.teach-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.course-list li {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 2px 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.course-list li:first-child { padding-top: 0; border-top: 0; }
.course-code { grid-row: span 2; color: var(--accent); font-size: 13px; font-weight: 600; padding-top: 2px; }
.course-code a { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--accent-line); }
.course-code a:hover { border-bottom-style: solid; }
.course-name { font-weight: 500; line-height: 1.4; }
.course-meta { color: var(--text-3); font-size: 12px; }

.supervision-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.supervision-head .card-label { margin: 0; }
.tabs {
  display: none;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.js .tabs { display: inline-flex; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border-2); }
.tab-panel + .tab-panel { margin-top: 18px; }
.js .tab-panel + .tab-panel { margin-top: 0; }
.tab-panel-title { margin: 6px 0 4px; color: var(--text-2); font-size: 14px; }
.js .tab-panel-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.thesis-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.45;
}
.thesis-list li:first-child { border-top: 0; }
.thesis-list a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-3);
  font: 12px var(--font-mono);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.thesis-list a:hover { color: var(--accent); border-color: var(--accent-line); }
.thesis-list .icon { width: 12px; height: 12px; }

/* ---------- Assistant + feed ---------- */
.console { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }

.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.chat-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--accent-line); }
.chat-name { font-weight: 600; letter-spacing: -0.01em; }
.chat-status { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; }
.chat-status .pulse { width: 7px; height: 7px; }

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 460px;
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
}
.msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  animation: rise 0.35s var(--ease) both;
}
.msg--bot {
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  background: var(--surface-2);
}
.msg--user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
}
.msg p + p, .msg p + ul, .msg ul + p { margin-top: 8px; }
.msg ul { display: grid; gap: 6px; }
.msg li { position: relative; padding-left: 14px; }
.msg li::before { content: "›"; position: absolute; left: 0; color: var(--accent); }
.msg code { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); font: 0.88em var(--font-mono); }
.msg .msg-meta { display: block; margin-top: 2px; color: var(--text-3); font-size: 13px; }
.msg--typing { display: inline-flex; gap: 5px; padding: 15px 16px; }
.msg--typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: bounce 1.2s infinite; }
.msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.msg--typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 20px 14px; }
.suggestion {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  text-align: left;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.suggestion:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }

.chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px 14px;
  padding: 6px 6px 6px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: var(--inset-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-form:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.chat-prompt { color: var(--accent); }
.chat-form input { flex: 1; min-width: 0; height: 40px; border: 0; outline: none; background: none; font-size: 15px; }
.chat-form input::placeholder { color: var(--text-3); }
.chat-send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 0.2s, opacity 0.2s;
}
.chat-send:hover { transform: translateY(-1px); }
.chat-send:disabled { opacity: 0.5; }
.chat-send .icon { width: 17px; height: 17px; }

.feed { display: flex; flex-direction: column; }
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.feed-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.feed-title .icon { color: var(--accent); }
.feed-status { display: inline-flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.feed-status .pulse { width: 7px; height: 7px; }
.feed-status.is-offline .pulse { background: var(--warn); }
.feed-status.is-offline .pulse::after { display: none; }
.feed-list { flex: 1; display: grid; align-content: start; }
.feed-item { padding: 13px 0; border-top: 1px solid var(--border); }
.feed-item:first-child { border-top: 0; }
.feed-item a {
  display: block;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
  transition: color 0.2s;
}
.feed-item a:hover { color: var(--accent); }
.feed-meta { margin-top: 4px; color: var(--text-3); font: 11.5px var(--font-mono); }
.feed-skeleton {
  height: 46px;
  margin: 10px 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.feed-source { margin-top: 14px; color: var(--text-3); font-size: 11.5px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.contact-rows li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.contact-rows li:first-child { padding-top: 0; border-top: 0; }
.contact-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
.contact-icon .icon { width: 18px; height: 18px; }
.contact-text { display: flex; flex-direction: column; min-width: 0; }
.contact-label { color: var(--text-3); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.contact-text a {
  color: var(--text);
  font-size: 15.5px;
  font-weight: 500;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.2s;
}
.contact-text a:hover { color: var(--accent); }
.contact-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }

.profile-links { display: grid; gap: 4px; }
.profile-links a {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s;
}
.profile-links a:hover { background: var(--surface-2); border-color: var(--border); }
.profile-links .icon,
.profile-links .icon-text { width: 18px; height: 18px; color: var(--text-2); }
.profile-handle { color: var(--text-3); font-size: 12px; transition: color 0.2s; }
.profile-links a:hover .profile-handle { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { padding-block: 36px 48px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 28px; }
.footer-meta { font-size: 12.5px; }
.footer-meta kbd { margin: 0 2px; }
.site-footer .footer-meta a[href="#top"] { text-decoration: none; }
.site-footer .icon { width: 13px; height: 13px; }

/* ---------- Command palette ---------- */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 120px) 16px 16px;
}
.cmdk[hidden] { display: none; }
.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop-dim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease both;
}
@keyframes fade-in { from { opacity: 0; } }
.cmdk-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(660px, 100%);
  max-height: min(580px, 78vh);
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-pop);
  animation: pop-in 0.22s var(--ease) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}
.cmdk-input-row .icon { width: 18px; height: 18px; }
.cmdk-input-row input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; color: var(--text); font-size: 16px; }
.cmdk-input-row input::placeholder { color: var(--text-3); }
.cmdk-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.cmdk-group {
  padding: 12px 10px 6px;
  color: var(--text-3);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cmdk-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text-2);
  cursor: pointer;
}
.cmdk-item[aria-selected="true"] { background: var(--surface-3); }
.cmdk-item-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: color 0.15s, border-color 0.15s;
}
.cmdk-item-icon .icon, .cmdk-item-icon .icon-text { width: 16px; height: 16px; }
.cmdk-item[aria-selected="true"] .cmdk-item-icon { color: var(--accent); border-color: var(--accent-line); }
.cmdk-item-text { display: flex; flex-direction: column; min-width: 0; }
.cmdk-item-title { display: block; color: var(--text); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-sub { display: block; color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-hint { color: var(--text-3); font: 11px var(--font-mono); }
.cmdk-item mark { background: none; color: var(--accent); }
.cmdk-empty { padding: 28px; color: var(--text-3); text-align: center; }
.cmdk-foot {
  display: flex;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 11.5px;
}
.cmdk-foot kbd { margin-right: 3px; }

/* ---------- Dialog + toast ---------- */
.dialog {
  width: min(660px, calc(100% - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}
.dialog[open] { animation: pop-in 0.22s var(--ease) both; }
.dialog::backdrop { background: var(--backdrop-dim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h3 { font-size: 1rem; }
.bibtex {
  max-height: 52vh;
  overflow: auto;
  padding: 18px 20px;
  background: var(--inset-bg);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dialog-actions { display: flex; justify-content: flex-end; padding: 14px 16px; border-top: 1px solid var(--border); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sub pages (project page, 404) ---------- */
.page-hero { padding-top: clamp(56px, 12vh, 128px); padding-bottom: clamp(48px, 8vh, 96px); }
.section--flush { padding-top: 0; }
.section--flush::before { display: none; }
.error-code + .page-title { margin-top: 14px; }
.page-hero .eyebrow { margin-bottom: 22px; }
.page-title {
  max-width: 18ch;
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.05em;
}
.page-lead { margin-top: 22px; max-width: 56ch; color: var(--text-2); font-size: clamp(1.1rem, 1.8vw, 1.3rem); }
.page-meta { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.wip-card, .error-card { max-width: 760px; }
.wip-card p + p, .error-card p + p { margin-top: 12px; }
.wip-card p, .error-card p { color: var(--text-2); }
.wip-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--warn);
  font: 500 12.5px var(--font-mono);
}
.wip-status .pulse { background: var(--warn); }
.related { margin-top: 18px; display: grid; gap: 4px; }
.related a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.related a:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.related .mono { color: var(--text-3); font-size: 12px; }
.error-code {
  font: 600 clamp(5rem, 18vw, 10rem)/0.9 var(--font-mono);
  letter-spacing: -0.06em;
  color: var(--text);
}
.error-code span { color: var(--danger); }
.error-log { margin-top: 18px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--inset-bg); font-size: 12.5px; line-height: 1.8; color: var(--text-2); overflow-x: auto; }
.error-log .err { color: var(--danger); }
.error-log .dim { color: var(--text-3); }
.error-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1140px) {
  .cmdk-trigger-label, .cmdk-trigger-kbd { display: none; }
  .cmdk-trigger { width: 36px; padding: 0; justify-content: center; }
  .research-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .menu-toggle { display: inline-grid; }
  .header-actions { margin-left: auto; }
  .site-nav {
    position: absolute;
    top: calc(var(--header-h) - 2px);
    left: var(--gutter);
    right: var(--gutter);
    margin: 0;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--border-2);
    background: var(--surface-solid);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.2s, transform 0.2s var(--ease), visibility 0s 0.2s;
  }
  .nav-open .site-nav { opacity: 1; visibility: visible; transform: none; transition: opacity 0.2s, transform 0.2s var(--ease); }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .site-nav a { padding: 12px 14px; border-radius: 10px; font-size: 16px; }
  .site-nav a.is-active { background: var(--surface-2); }
  .nav-indicator { display: none; }

  .hero-grid { grid-template-columns: 1fr; }
  .id-card { justify-self: start; max-width: 400px; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-bio, .bento-now { grid-column: 1 / -1; }
  .bento > .card:nth-child(n + 3) { grid-column: span 1; }
  .bento > .card:last-child { grid-column: 1 / -1; }
  .journey, .teach-grid, .console, .contact-grid, .lab-body { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 561px) and (max-width: 960px) {
  .id-card {
    max-width: none;
    justify-self: stretch;
    display: grid;
    grid-template-columns: minmax(200px, 0.8fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }
  .id-card-body { padding: 10px 14px; }
}

@media (max-width: 720px) {
  .pub { grid-template-columns: minmax(0, 1fr); padding-inline: 4px; }
  .js .pub:not(.show-year) .pub-year { visibility: visible; }
  .pub-year { padding: 0; font-size: 12.5px; }
  .pub-actions { margin-top: 6px; }
  .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage::after { display: none; }
  .lab-actions .btn { flex: 1 1 calc(50% - 10px); }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand { font-size: 14px; }
  .brand-wrap { gap: 7px; }
  .brand-cmd { font-size: 12px; }
  .pill.mono { font-size: 11px; letter-spacing: 0; padding-inline: 10px 12px; }
  .bento { grid-template-columns: minmax(0, 1fr); }
  .bento > .card:nth-child(n) { grid-column: auto; }
  .research-grid { grid-template-columns: minmax(0, 1fr); }
  .id-card { max-width: none; }
  .id-card-photo { aspect-ratio: 1 / 1; }
  .id-card-photo img { object-position: 50% 18%; }
  .msg { max-width: 94%; }
  .chat-messages { padding: 16px; }
  .chat-suggestions { padding-inline: 16px; }
  .thesis-list li { flex-direction: column; gap: 6px; }
  .contact-rows li { grid-template-columns: 40px minmax(0, 1fr); }
  .contact-rows .icon-btn { display: none; }
  .search-field { width: 100%; }
  .cmdk { padding-top: 12px; }
  .cmdk-foot { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Without JavaScript: hide controls that need it ---------- */
html:not(.js) :is([data-cmdk-open], [data-theme-toggle], [data-copy], [data-vcard], [data-cite],
  .pub-toolbar, .chat-suggestions, .chat-form, .feed-skeleton, .menu-toggle) { display: none !important; }

@media (forced-colors: active) {
  .hero-title { background: none; -webkit-text-fill-color: currentColor; }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js [data-reveal] { opacity: 1; }
  .id-card { transform: none !important; }
  .id-card-photo::after, .backdrop-glow, .brand-caret, .caret { animation: none !important; }
  .id-card-photo::after { display: none; }
}

@media print {
  .backdrop, .site-header, .skip-link, .cmdk, .toast, .dialog, .lab, .console,
  .socials, .hero-cta, .id-card, .pub-toolbar, .pub-actions, .contact-actions, .tabs, .icon-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .js [data-reveal] { opacity: 1 !important; animation: none !important; }
  .card, .tl-item { box-shadow: none; background: #fff; border-color: #ccc; break-inside: avoid; }
  .hero-title { -webkit-text-fill-color: #000; color: #000; background: none; }
  .section { padding-block: 20px; }
  .section::before { display: none; }
  a { color: #000; }
  .js .tab-panel[hidden] { display: block !important; }
}
