/* =========================================================
   Temir Nurlanbek - portfolio
   Monochrome + Apple blue. Geist sans. Shared across pages.
   ========================================================= */

:root {
  --font-display: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --max: 1160px;
  --gutter: clamp(20px, 5vw, 56px);
  --r-card: 16px;
  --r-input: 10px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-elev: #0f0f11;
  --surface: #141416;
  --surface-2: #1b1b1f;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.17);
  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  --text-faint: #6c6c76;
  --accent: #3b93ff;
  --accent-strong: #62a8ff;
  --accent-ink: #06121f;
  --accent-soft: rgba(59,147,255,0.13);
  --accent-line: rgba(59,147,255,0.32);
  --grid-line: rgba(255,255,255,0.032);
  --shadow: 0 22px 50px -28px rgba(0,0,0,0.85);
  /* contribution heatmap: an accent ramp rather than GitHub green, so the
     card reads as part of this site instead of an embedded widget */
  --gh-0: rgba(255,255,255,0.06);
  --gh-1: rgba(59,147,255,0.26);
  --gh-2: rgba(59,147,255,0.48);
  --gh-3: rgba(59,147,255,0.72);
  --gh-4: #3b93ff;
}

html[data-theme="light"] {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: rgba(9,9,11,0.10);
  --border-strong: rgba(9,9,11,0.20);
  --text: #0a0a0b;
  --text-dim: #52525b;
  --text-faint: #8a8a92;
  --accent: #0071e3;
  --accent-strong: #005bb8;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0,113,227,0.09);
  --accent-line: rgba(0,113,227,0.26);
  --grid-line: rgba(9,9,11,0.045);
  --shadow: 0 20px 44px -28px rgba(20,22,28,0.30);
  --gh-0: rgba(9,9,11,0.07);
  --gh-1: rgba(0,113,227,0.22);
  --gh-2: rgba(0,113,227,0.44);
  --gh-3: rgba(0,113,227,0.68);
  --gh-4: #0071e3;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ambient background: faint grid + one static glow, no warmth */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient .grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 78%);
}
.ambient .glow {
  position: absolute; top: -30vh; left: 50%; transform: translateX(-50%);
  width: 90vw; height: 70vh; border-radius: 50%; filter: blur(90px);
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  opacity: 0.7;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); position: relative; z-index: 1; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.03em; line-height: 1.04; }
.display { font-size: clamp(44px, 8vw, 88px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.0; }
.h-sec { font-size: clamp(30px, 5vw, 50px); font-weight: 600; letter-spacing: -0.03em; }
.lead { color: var(--text-dim); font-size: clamp(16px, 2vw, 19px); max-width: 58ch; }
.mono { font-family: var(--font-mono); }
.kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; color: var(--accent); text-transform: none; }

/* word-by-word reveal */
.words .word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.words .word-inner { display: inline-block; transform: translateY(115%); transition: transform 0.85s var(--ease); transition-delay: calc(var(--i,0) * 50ms); }
.words.in .word-inner { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .words .word-inner { transform: none; transition: none; } }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
/* failsafe: force visible even if JS observers/timers stall */
.reveal:not(.in) { animation: reveal-fallback 0.4s var(--ease) 1.8s forwards; }
.words:not(.in) .word-inner { animation: reveal-fallback 0.4s var(--ease) 1.8s forwards; }
@keyframes reveal-fallback { to { opacity: 1; transform: none; } }
.reveal.d1 { transition-delay: 0.06s; } .reveal.d2 { transition-delay: 0.12s; }
.reveal.d3 { transition-delay: 0.18s; } .reveal.d4 { transition-delay: 0.24s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  padding: 12px 22px; border-radius: var(--r-pill); border: 1px solid transparent; cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }

/* ---------- Nav ---------- */
header.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease); }
header.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(150%) blur(14px); -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom-color: var(--border);
}
.nav-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a { font-size: 14px; color: var(--text-dim); padding: 8px 13px; border-radius: 8px; transition: color 0.2s, background 0.2s; position: relative; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 3px; height: 2px; background: var(--accent); border-radius: 2px; }
.nav-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); transition: color 0.2s, border-color 0.2s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.cmdk-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-faint); font-size: 13px; cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.cmdk-btn:hover { color: var(--text-dim); border-color: var(--border-strong); }
.cmdk-btn kbd { font-family: var(--font-mono); font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; color: var(--text-dim); }
.nav-burger { display: none; }
@media (max-width: 800px) {
  .nav-links { position: fixed; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border); padding: 8px var(--gutter) 16px;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
  .nav-links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 13px 4px; font-size: 16px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav-links a.active::after { display: none; }
  .nav-links a.active { color: var(--accent); }
  .cmdk-btn .label { display: none; }
  .nav-burger { display: inline-flex; }
}

/* ---------- Page header ---------- */
.page-head { padding: 128px 0 8px; }
.page-head .h-sec { margin-top: 14px; }
.page-head .lead { margin-top: 18px; }

/* ---------- Section shell ---------- */
section.block { padding: clamp(64px, 9vw, 104px) 0; }
.sec-head { max-width: 60ch; margin-bottom: clamp(32px, 5vw, 52px); }
.sec-head .lead { margin-top: 16px; }

/* ---------- Hero ---------- */
.hero { display: flex; align-items: center; padding: 108px 0 28px; }
@media (min-width: 881px) { .hero { min-height: calc(100svh - 150px); } }
.stats-block { padding-top: clamp(120px, 22vh, 240px); }
@media (max-width: 880px) { .stats-block { padding-top: 72px; } }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 6vw, 72px); align-items: center; width: 100%; }
.status { display: inline-flex; align-items: center; gap: 9px; padding: 6px 14px 6px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-dim); font-weight: 500; }
.status .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: relative; }
@media (prefers-reduced-motion: no-preference) {
  .status .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: ping 2.4s var(--ease) infinite; }
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3); opacity: 0; } }
.hero h1 { margin: 24px 0 0; }
.hero .role { font-family: var(--font-mono); font-size: clamp(13px, 1.8vw, 16px); color: var(--accent); margin-top: 16px; }
.hero .lead { margin-top: 18px; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.portrait-wrap { position: relative; justify-self: center; width: 100%; max-width: 360px; }
.portrait { position: relative; aspect-ratio: 4/5; border-radius: 22px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
/* <picture> is an inline box by default, which would break the img's height:100%.
   display:contents removes it from the box tree so the img lays out as a direct
   child of .portrait, exactly as it did before the responsive swap. */
.portrait picture { display: contents; }
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.02); transition: filter 0.55s var(--ease), transform 0.55s var(--ease); }
.portrait:hover img { filter: grayscale(0) contrast(1); transform: scale(1.03); }
.portrait-badge { position: absolute; left: -12px; bottom: 22px; z-index: 2; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 13px; padding: 11px 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; }
.portrait-badge .apple { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--text); }
.portrait-badge .apple svg { width: 17px; height: 17px; }
.portrait-badge .t { font-size: 12px; line-height: 1.3; }
.portrait-badge .t b { font-family: var(--font-display); font-size: 13px; font-weight: 600; display: block; }
.portrait-badge .t span { color: var(--text-faint); }
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .portrait-wrap { order: -1; max-width: 280px; }
  .portrait-badge { left: 6px; }
}

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border); }
.stat { background: var(--bg); padding: 26px 24px; }
.stat .num { font-family: var(--font-display); font-size: clamp(30px, 4.4vw, 46px); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stat .num .suf { color: var(--accent); }
.stat .lbl { color: var(--text-dim); font-size: 13.5px; margin-top: 10px; max-width: 22ch; }
@media (max-width: 720px) { .stats-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Card (shared) ---------- */
.card { position: relative; border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface); padding: 26px;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card .card-ico { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.card .card-ico svg { width: 21px; height: 21px; }
.card h3 { font-size: 22px; margin-top: 4px; }
.card p { color: var(--text-dim); margin-top: 10px; font-size: 15px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.tag { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); padding: 5px 11px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--bg); }
.tile-head { display: flex; align-items: center; gap: 9px; color: var(--text-dim); font-size: 13px; font-weight: 500; }
.tile-head svg { width: 16px; height: 16px; color: var(--accent); }

/* ---------- Bento (home snapshot) ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.b-globe { grid-column: span 3; min-height: 200px; display: flex; flex-direction: column;
  background:
    radial-gradient(1px 1px at 12% 24%, rgba(255,255,255,0.35), transparent 100%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,0.28), transparent 100%),
    radial-gradient(1px 1px at 55% 68%, rgba(255,255,255,0.22), transparent 100%),
    radial-gradient(1.5px 1.5px at 88% 55%, rgba(160,200,255,0.30), transparent 100%),
    radial-gradient(1px 1px at 30% 82%, rgba(255,255,255,0.20), transparent 100%),
    linear-gradient(158deg, #0b1224 0%, #070a12 55%, #04060b 100%);
  border-color: rgba(96,152,255,0.16); }
.b-globe .tile-head { color: #9db4d8; }
.b-globe .globe-cap b { color: #f4f6fb; }
.b-globe .globe-cap span { color: #74839c; }
.globe3d { position: relative; flex: 1; min-height: 90px; margin-top: 8px; border-radius: 12px; overflow: hidden; cursor: grab; }
.globe3d::before { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 68%; aspect-ratio: 1; border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(59,147,255,0.16) 30%, rgba(59,147,255,0.05) 58%, transparent 72%);
  animation: globe-breathe 5.5s ease-in-out infinite; }
@keyframes globe-breathe { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .globe3d::before { animation: none; } }
.globe3d > div { position: absolute !important; inset: 0; z-index: 1; }
@media (min-width: 881px) { .b-globe, .b-conn { height: 290px; min-height: 0; } }
@media (max-width: 880px) { .globe3d { min-height: 110px; } }
.b-conn { grid-column: span 3; display: flex; flex-direction: column; }
.conn-note { margin-top: auto; padding-top: 16px; color: var(--text-faint); font-size: 12.5px; font-family: var(--font-mono); line-height: 1.5; }
@media (max-width: 880px) {
  .bento { grid-template-columns: 1fr; width: 100% !important; height: auto !important; }
  .b-globe, .b-conn { grid-column: auto; height: auto !important; }
  .b-globe { min-height: 240px; }
}

/* ---------- Pointer-tracking border glow (ported, single-accent) ---------- */
.glow-fx { pointer-events: none; position: absolute; inset: 0; border-radius: inherit; opacity: var(--active, 0); transition: opacity 0.3s var(--ease); z-index: 2; }
.glow-fx::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from calc(var(--start, 0) * 1deg - 45deg) at 50% 50%,
    transparent 0deg, var(--accent) 45deg, var(--accent-strong) 60deg, transparent 110deg);
  -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; }
@media (hover: none), (prefers-reduced-motion: reduce) { .glow-fx { display: none; } }

/* ---------- Tools marquee (Home) ---------- */
.marquee-label { text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-bottom: 20px; }
.marquee-band { padding: 6px 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
.marquee { display: flex; width: max-content; }
.marquee-group { display: flex; align-items: center; }
.m-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 0 30px; }
.m-item img { height: 38px; width: auto; max-width: 64px; display: block; transition: transform 0.35s var(--ease), filter 0.35s var(--ease); }
.m-name { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); white-space: nowrap;
  opacity: 0; transform: translateY(7px) scale(0.94); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); pointer-events: none; }
.m-item:hover img { transform: translateY(-5px) scale(1.1); filter: drop-shadow(0 6px 14px rgba(59,147,255,0.35)); }
.m-item:hover .m-name { opacity: 1; transform: none; }
@media (hover: none) { .m-name { opacity: 1; transform: none; } }
.m-item.fallback { font-family: var(--font-mono); font-size: 15px; color: var(--text-dim); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .marquee { animation: marquee-scroll 34s linear infinite; }
  .marquee-band:hover .marquee { animation-play-state: paused; }
}
@keyframes marquee-scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { width: 100%; flex-wrap: wrap; justify-content: center; }
  .marquee-group { flex-wrap: wrap; justify-content: center; }
  .marquee-group + .marquee-group { display: none; }
  .m-item { padding: 10px 22px; }
}

/* globe */
.globe-stage { position: relative; flex: 1; display: grid; place-items: center; margin: 6px 0; }
.globe-svg { width: 100%; max-width: 320px; height: auto; overflow: visible; }
.g-line { fill: none; stroke: var(--text-faint); stroke-width: 1; opacity: 0.34; stroke-dasharray: 2 4; stroke-linecap: round; }
.g-outline { fill: none; stroke: var(--text-faint); stroke-width: 1.1; opacity: 0.45; }
.g-arc { fill: none; stroke: var(--accent); stroke-width: 1.6; opacity: 0.9; stroke-linecap: round; }
.g-point { fill: var(--accent); }
.g-ring { fill: none; stroke: var(--accent); stroke-width: 1.1; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .g-ring { animation: gring 2.6s var(--ease) infinite; }
  .g-ring.b { animation-delay: 1.3s; }
}
@keyframes gring { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(3.4); opacity: 0; } }
.g-dot { fill: var(--accent); }
.g-label { position: absolute; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); background: color-mix(in srgb, var(--bg-elev) 84%, transparent); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); white-space: nowrap; }
.globe-cap b { font-family: var(--font-display); font-size: clamp(18px, 2.6vw, 23px); font-weight: 600; letter-spacing: -0.02em; display: block; }
.globe-cap span { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* tools */
.tools-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 16px; }
.tool { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); display: grid; place-items: center; position: relative;
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), background 0.22s var(--ease); }
.tool:hover { transform: translateY(-3px); border-color: var(--accent-line); background: var(--surface-2); }
.tool img { width: 25px; height: 25px; opacity: 0.72; transition: opacity 0.22s; }
.tool:hover img { opacity: 1; }
.tool.tool-fallback { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text-dim); }
@media (max-width: 520px) { .tools-grid { grid-template-columns: repeat(4, 1fr); } }

/* connect list */
.conn-list { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.conn-list a { display: flex; align-items: center; gap: 11px; padding: 9px 6px; border-radius: 8px; color: var(--text-dim); font-size: 14px; transition: color 0.2s, background 0.2s; }
.conn-list a:hover { color: var(--accent); background: var(--accent-soft); }
.conn-list a svg { width: 16px; height: 16px; }

/* ---------- Grid of cards (work / features) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card-grid.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .card-grid, .card-grid.two { grid-template-columns: 1fr; } }

/* ---------- Work rows (detailed) ---------- */
.work-list { display: grid; gap: 16px; }
.prow { display: grid; grid-template-columns: 1fr 220px; gap: 28px; align-items: center; padding: 32px;
  border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.prow:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.prow h3 { font-size: clamp(24px, 3.2vw, 32px); font-weight: 600; margin-top: 10px; }
.prow p { color: var(--text-dim); margin-top: 12px; font-size: 15.5px; max-width: 54ch; }
.prow .tags { margin-top: 16px; }
.pvis { align-self: stretch; min-height: 130px; border-radius: 13px; border: 1px solid var(--border);
  background: radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 55%), var(--bg); display: grid; place-items: center; color: var(--accent); }
.pvis svg { width: 48px; height: 48px; }
@media (max-width: 760px) { .prow { grid-template-columns: 1fr; gap: 20px; padding: 26px; } .pvis { min-height: 116px; } }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 14px; }
.xp { display: grid; grid-template-columns: 190px 1fr; gap: 28px; padding: 30px; border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.xp:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.xp .when { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.xp .when .now { color: var(--accent); display: inline-flex; align-items: center; gap: 7px; }
.xp .when .now::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.xp .place { color: var(--text-dim); margin-top: 8px; font-size: 13px; }
.xp h3 { font-size: 23px; font-weight: 600; }
.xp .co { color: var(--accent); }
.xp p { color: var(--text-dim); margin-top: 12px; font-size: 15.5px; max-width: 62ch; }
.xp .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
@media (max-width: 720px) { .xp { grid-template-columns: 1fr; gap: 12px; padding: 24px; } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 6vw, 64px); align-items: center; }
.about-copy p { color: var(--text-dim); font-size: 17px; margin-top: 16px; max-width: 56ch; }
.about-copy p strong { color: var(--text); font-weight: 600; }
.quote { margin-top: 30px; padding: 20px 24px; border-left: 2px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0;
  font-size: clamp(18px, 2.3vw, 22px); line-height: 1.42; font-weight: 500; letter-spacing: -0.01em; }
.about-visual { position: relative; aspect-ratio: 1/1; border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border);
  background: radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 55%), var(--surface); display: grid; place-items: center; padding: 28px; }
.terminal { width: 100%; font-family: var(--font-mono); font-size: 13px; }
.terminal .bar { display: flex; gap: 7px; margin-bottom: 16px; }
.terminal .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.terminal .line { color: var(--text-dim); margin: 6px 0; white-space: nowrap; overflow: hidden; }
.terminal .line .p { color: var(--accent); }
.terminal .line .k { color: var(--text); }
.terminal .pass { color: var(--accent); }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } .about-visual { order: -1; max-width: 420px; } }

/* ---------- CTA band ---------- */
.cta-band { text-align: center; }
.cta-band h2 { font-size: clamp(34px, 6vw, 68px); font-weight: 700; letter-spacing: -0.03em; }
.cta-band .lead { margin: 18px auto 0; text-align: center; }
.cta-band .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 32px; }

/* ---------- Socials ---------- */
.socials { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; margin-top: 36px; }
.social { display: inline-flex; align-items: center; gap: 9px; padding: 10px 17px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-size: 14px; font-weight: 500; transition: color 0.2s, border-color 0.2s, transform 0.2s; }
.social:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-2px); }
.social svg { width: 16px; height: 16px; }

/* ---------- Footer ---------- */
footer.foot { padding: 36px 0; border-top: 1px solid var(--border); }
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.foot .muted { color: var(--text-faint); font-size: 13px; font-family: var(--font-mono); }
.foot-links { display: flex; gap: 16px; }
.foot-links a { color: var(--text-dim); font-size: 13px; transition: color 0.2s; }
.foot-links a:hover { color: var(--accent); }

/* ---------- Command palette ---------- */
.cmdk-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 14vh 20px 20px;
  background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,0.5)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cmdk-overlay.open { display: flex; }
.cmdk { width: 100%; max-width: 540px; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 15px; box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6); overflow: hidden; opacity: 0; transform: translateY(-8px) scale(0.99); }
.cmdk-overlay.open .cmdk { animation: pop 0.22s var(--ease) forwards; }
@keyframes pop { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cmdk { opacity: 1; transform: none; } }
.cmdk-search { display: flex; align-items: center; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.cmdk-search svg { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }
.cmdk-search input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-body); font-size: 16px; }
.cmdk-search input::placeholder { color: var(--text-faint); }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: 8px; }
.cmdk-group { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); padding: 10px 12px 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.cmdk-item[aria-selected="true"] { background: var(--accent-soft); }
.cmdk-item .ci { width: 31px; height: 31px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-dim); flex-shrink: 0; }
.cmdk-item[aria-selected="true"] .ci { color: var(--accent); border-color: var(--accent-line); }
.cmdk-item .ci svg { width: 16px; height: 16px; }
.cmdk-item .cl { font-size: 14.5px; color: var(--text); font-weight: 500; }
.cmdk-item .cs { font-size: 12px; color: var(--text-faint); margin-left: auto; font-family: var(--font-mono); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--text-faint); font-size: 14px; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 6px; }
.cmdk-foot kbd { font-family: var(--font-mono); font-size: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

/* utility */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 8px; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.center-narrow { max-width: 62ch; }

/* =========================================================
   Mobile polish
   ========================================================= */
@media (max-width: 800px) {
  /* nav: icon-only search, tighter tools */
  .cmdk-btn { width: 38px; padding: 0; justify-content: center; }
  .cmdk-btn kbd { display: none; }
  .nav-tools { gap: 6px; }
  .brand { font-size: 16px; }
}

@media (max-width: 600px) {
  :root { --r-card: 14px; }

  /* rhythm */
  section.block { padding: 52px 0; }
  .page-head { padding: 104px 0 4px; }
  .hero { padding: 96px 0 20px; }
  .hero h1 { margin-top: 20px; }
  .hero .cta-row { margin-top: 24px; }

  /* full-width, easy-thumb CTAs */
  .cta-row { width: 100%; }
  .cta-row .btn { flex: 1 1 auto; justify-content: center; min-height: 48px; }
  .cta-band .cta-row .btn { flex: 1 1 100%; }

  /* portrait */
  .portrait-wrap { max-width: 240px; }
  .portrait-badge { padding: 9px 12px; bottom: 14px; }

  /* stats: tighter cells */
  .stat { padding: 20px 18px; }
  .stat .lbl { font-size: 13px; }

  /* cards & rows */
  .card { padding: 20px; }
  .prow { padding: 20px; }
  .prow p { font-size: 15px; }
  .xp { padding: 20px; }
  .quote { padding: 16px 18px; font-size: 17px; }

  /* marquee: closer items */
  .m-item { padding: 0 20px; }
  .m-item img { height: 32px; }

  /* terminal card: keep lines inside */
  .terminal { font-size: 12px; }
  .about-visual { padding: 20px; }

  /* long email button never overflows */
  .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; }

  /* command palette closer to top, slimmer chrome */
  .cmdk-overlay { padding: 9vh 12px 12px; }
  .cmdk-foot { display: none; }

  /* footer stacks centered */
  .foot-inner { flex-direction: column; text-align: center; gap: 10px; }

  /* softer ambient glow on small screens */
  .ambient .glow { width: 140vw; height: 50vh; }
}

@media (max-width: 380px) {
  .display { font-size: 38px; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   CRAFT LAYER
   Cursor spotlight, hover-dim lists, scroll progress, grain,
   view transitions, keyboard sheet, toasts, blueprint mode, print.
   ========================================================= */

/* ---------- Scroll progress hairline ---------- */
.scroll-prog {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transform-origin: 0 50%; transform: scaleX(0); z-index: 2;
  border-radius: 0 2px 2px 0; pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .scroll-prog.css-driven { animation: scroll-prog-grow linear both; animation-timeline: scroll(root block); }
}
@keyframes scroll-prog-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Cursor spotlight ---------- */
.spotlight {
  position: fixed; top: 0; left: 0; width: 600px; height: 600px; z-index: 0;
  pointer-events: none; opacity: 0; transition: opacity 0.5s var(--ease);
  background: radial-gradient(circle closest-side,
    color-mix(in srgb, var(--accent) 12%, transparent), transparent 100%);
  will-change: transform;
}
html[data-theme="light"] .spotlight {
  background: radial-gradient(circle closest-side,
    color-mix(in srgb, var(--accent) 8%, transparent), transparent 100%);
}
.spotlight.on { opacity: 1; }
@media (hover: none), (prefers-reduced-motion: reduce) { .spotlight { display: none; } }

/* ---------- Film grain ---------- */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 0; pointer-events: none; opacity: 0.032;
  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.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: no-preference) {
  body::after { animation: grain 6s steps(6) infinite; }
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }   20% { transform: translate(-3%,2%); }
  40% { transform: translate(2%,-3%); }    60% { transform: translate(-2%,-2%); }
  80% { transform: translate(3%,1%); }
}
html[data-theme="light"] body::after { opacity: 0.02; }

/* ---------- Hover-dim lists (pure CSS, no JS) ---------- */
@media (hover: hover) {
  .work-list:has(.prow:hover) .prow:not(:hover),
  .timeline:has(.xp:hover) .xp:not(:hover),
  .card-grid:has(.card:hover) .card:not(:hover),
  .stats-grid:has(.stat:hover) .stat:not(:hover),
  .socials:has(.social:hover) .social:not(:hover) {
    opacity: 0.48; filter: saturate(0.55);
  }
  .work-list .prow, .timeline .xp, .card-grid .card, .stats-grid .stat, .socials .social {
    transition: opacity 0.35s var(--ease), filter 0.35s var(--ease),
                transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  }
}
@media (prefers-reduced-motion: reduce) {
  .work-list .prow, .timeline .xp, .card-grid .card, .stats-grid .stat, .socials .social { transition: none; }
}

/* ---------- Live local time ---------- */
.local-time {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.local-time .lt-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.local-time.asleep .lt-dot { background: var(--text-faint); box-shadow: none; }
.local-time.inline { margin-left: 2px; }
.local-time .lt-sep { color: var(--text-faint); margin-right: 8px; opacity: 0.6; }
.status .local-time { font-size: 12px; }
@media (max-width: 560px) { .status .local-time { display: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 300;
  transform: translate(-50%, 18px); opacity: 0; pointer-events: none;
  background: var(--bg-elev); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="ok"] { border-color: var(--accent-line); }

/* ---------- Keyboard shortcut sheet ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 120; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,0.5));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.sheet-overlay.open { display: flex; }
.sheet {
  width: 100%; max-width: 440px; background: var(--bg-elev);
  border: 1px solid var(--border-strong); border-radius: 15px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
  opacity: 0; transform: translateY(-8px) scale(0.99); animation: pop 0.22s var(--ease) forwards;
}
.sheet-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
}
.sheet-hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.sheet-body { padding: 8px; max-height: 60vh; overflow-y: auto; }
.sheet-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 12px; border-radius: 9px; font-size: 14px; color: var(--text-dim);
}
.sheet-row:hover { background: var(--surface); color: var(--text); }
.sheet-keys { display: inline-flex; gap: 5px; flex-shrink: 0; }
.sheet-keys kbd {
  font-family: var(--font-mono); font-size: 11.5px; min-width: 22px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 6px; color: var(--text);
}
.sheet-foot {
  padding: 11px 18px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint);
}

/* ---------- Blueprint mode (konami) ---------- */
html[data-blueprint] body * { outline: 1px solid color-mix(in srgb, var(--accent) 30%, transparent) !important; outline-offset: -1px; }
html[data-blueprint] .ambient .grid { mask-image: none; -webkit-mask-image: none; opacity: 0.9; }
html[data-blueprint] .ambient .glow, html[data-blueprint] .spotlight { opacity: 0.25; }
html[data-blueprint] body::before {
  content: "BLUEPRINT"; position: fixed; left: 14px; bottom: 14px; z-index: 250;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em;
  color: var(--accent); border: 1px solid var(--accent-line); background: var(--bg-elev);
  padding: 5px 10px; border-radius: 6px; pointer-events: none;
}

/* ---------- Copy-email affordance ---------- */
.copy-btn {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; color: var(--text-faint);
  background: transparent; border: 1px dashed var(--border-strong); border-radius: var(--r-pill);
  padding: 10px 17px; transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.copy-btn svg { width: 15px; height: 15px; }

/* ---------- Cross-document view transitions ---------- */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out 0.22s var(--ease) both; }
  ::view-transition-new(root) { animation: vt-in 0.34s var(--ease) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }
header.nav { view-transition-name: site-nav; }
footer.foot { view-transition-name: site-foot; }
.portrait-wrap { view-transition-name: portrait; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- 404 ---------- */
.four04 { text-align: center; padding: 22vh 0 12vh; }
.four04 .code {
  font-family: var(--font-mono); font-size: clamp(72px, 16vw, 168px); font-weight: 500;
  letter-spacing: -0.05em; line-height: 1; color: transparent;
  background: linear-gradient(180deg, var(--text) 20%, transparent 118%); -webkit-background-clip: text; background-clip: text;
}
.four04 .lead { margin: 18px auto 0; }

/* ---------- Print: the page becomes a clean one-page resume ---------- */
@media print {
  .ambient, .spotlight, .scroll-prog, .toast, .sheet-overlay, .cmdk-overlay,
  header.nav, .marquee-band, .marquee-label, .cta-band, .glow-fx, .globe3d,
  .about-visual, .pvis, body::after { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .reveal, .words .word-inner { opacity: 1 !important; transform: none !important; animation: none !important; }
  .card, .prow, .xp, .stat { break-inside: avoid; border-color: #ddd !important; background: #fff !important; box-shadow: none !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: #555; }
  section.block, .page-head, .hero { padding: 12px 0 !important; min-height: 0 !important; }
  .lead, .card p, .prow p, .xp p { color: #333 !important; }
}

/* ---------- Hero keyboard hint ---------- */
.kbd-hint {
  margin-top: 22px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.kbd-hint kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 6px; min-width: 20px; text-align: center;
}
@media (hover: none) { .kbd-hint { display: none; } }

/* ---------- Live widgets (Spotify / WakaTime / GitHub) ----------
   Cards share the .card surface. Widths follow the same 6-column .bento grid
   as the snapshot section, and fall back to a single column under 880px via
   the existing .bento media query. */
.live-bento { margin-top: 20px; }
.live-block .sec-head .lead { margin-top: 10px; }
.b-spotify, .b-waka, .b-gh { display: flex; flex-direction: column; }
.b-spotify { grid-column: span 4; min-height: 172px; }
.b-waka    { grid-column: span 2; min-height: 172px; }
.b-gh      { grid-column: span 6; }
@media (max-width: 880px) {
  .b-spotify, .b-waka, .b-gh { grid-column: auto; height: auto !important; }
}

/* skeleton shimmer while the fetch is in flight */
.w-loading [data-slot="title"],
.w-loading [data-slot="artist"],
.w-loading [data-slot="hours"] { border-radius: 5px; color: transparent !important; background: var(--surface-2); }
.w-loading [data-slot="title"]  { width: 62%; }
.w-loading [data-slot="artist"] { width: 42%; }
.w-loading .sp-art { background: var(--surface-2); }
@media (prefers-reduced-motion: no-preference) {
  .w-loading [data-slot="title"],
  .w-loading [data-slot="artist"],
  .w-loading [data-slot="hours"],
  .w-loading .sp-art { animation: w-pulse 1.5s var(--ease) infinite; }
}
@keyframes w-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---- Spotify ---- */
.b-spotify .tile-head svg { color: #1db954; }
.sp-track { display: flex; align-items: center; gap: 14px; margin: auto -8px 0; padding: 8px;
  border-radius: 12px; transition: background 0.2s var(--ease); }
.sp-track:hover { background: var(--surface-2); }
.sp-art { width: 58px; height: 58px; flex: none; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); display: block; }
.sp-art img { width: 100%; height: 100%; object-fit: cover; }
.sp-meta { min-width: 0; flex: 1; }
.sp-meta b { display: block; font-family: var(--font-display); font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-meta > span { display: block; margin-top: 3px; font-size: 13px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* equalizer, only while something is actually playing */
.sp-bars { display: none; align-items: flex-end; gap: 3px; height: 17px; flex: none; }
[data-playing="true"] .sp-bars { display: flex; }
.sp-bars i { width: 3px; height: 30%; border-radius: 2px; background: #1db954; }
@media (prefers-reduced-motion: no-preference) {
  [data-playing="true"] .sp-bars i { animation: eq 900ms var(--ease) infinite; }
  .sp-bars i:nth-child(2) { animation-delay: 180ms; }
  .sp-bars i:nth-child(3) { animation-delay: 360ms; }
  .sp-bars i:nth-child(4) { animation-delay: 540ms; }
}
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* ---- WakaTime ---- */
.wk-num { margin-top: auto; display: flex; align-items: baseline; gap: 6px;
  font-family: var(--font-display); font-size: clamp(32px, 4.4vw, 44px); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1; }
.wk-num .suf { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--text-faint); letter-spacing: 0; }
.wk-sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 9px; }

/* ---- GitHub contributions ---- */
.gh-cal { margin-top: 18px; display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr);
  gap: 3px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.gh-cal i { width: 11px; height: 11px; border-radius: 2px; background: var(--gh-0); }
.gh-cal i[data-l="1"] { background: var(--gh-1); }
.gh-cal i[data-l="2"] { background: var(--gh-2); }
.gh-cal i[data-l="3"] { background: var(--gh-3); }
.gh-cal i[data-l="4"] { background: var(--gh-4); }
.gh-legend { display: flex; align-items: center; gap: 5px; margin-top: 14px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.gh-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--gh-0); }
.gh-legend i[data-l="1"] { background: var(--gh-1); }
.gh-legend i[data-l="2"] { background: var(--gh-2); }
.gh-legend i[data-l="3"] { background: var(--gh-3); }
.gh-legend i[data-l="4"] { background: var(--gh-4); }

/* =========================================================
   RÉSUMÉ, NOTES, STACK, COLOPHON
   Sections the strongest portfolios in the corpus all carry.
   ========================================================= */

/* ---------- Résumé pill in the nav ---------- */
.resume-pill {
  display: inline-flex; align-items: center; height: 38px; padding: 0 15px;
  border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent-line); background: var(--accent-soft);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.resume-pill:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.nav-resume-mobile { display: none; }
@media (max-width: 900px) { .resume-pill { display: none; } .nav-resume-mobile { display: block; } }
@media (max-width: 800px) { .nav-resume-mobile { color: var(--accent) !important; } }

/* ---------- Résumé document ---------- */
.resume {
  border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface);
  padding: clamp(26px, 4vw, 46px);
}
.resume-print-head { display: none; }
.rsec + .rsec { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--border); }
.rsec-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
}
.rsec-body { color: var(--text-dim); font-size: 16px; max-width: 68ch; }
.rjob + .rjob { margin-top: 28px; }
.rjob-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.rjob-head h3 { font-size: 20px; font-weight: 600; }
.rjob-head .co { color: var(--accent); }
.rjob-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }
.rlist { list-style: none; margin: 14px 0 0; padding: 0; }
.rlist li {
  position: relative; padding-left: 20px; margin-top: 9px;
  color: var(--text-dim); font-size: 15.5px; max-width: 72ch;
}
.rlist li::before {
  content: ""; position: absolute; left: 3px; top: 0.68em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: 0.75;
}
.rlist strong { color: var(--text); font-weight: 600; }
.rjob .tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.rmetrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rmetric {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg); padding: 16px 18px;
}
.rmetric b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.rmetric span { display: block; color: var(--text-dim); font-size: 12.5px; margin-top: 6px; }
@media (max-width: 760px) { .rmetrics { grid-template-columns: 1fr 1fr; } }
.rstack { display: grid; gap: 12px; }
.rstack > div { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: baseline; }
.rstack dt { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); }
.rstack dd { color: var(--text-dim); font-size: 15.5px; }
@media (max-width: 640px) { .rstack > div { grid-template-columns: 1fr; gap: 4px; } }
.rlinks { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.rlinks a { color: var(--accent); font-size: 15px; }
.rlinks a:hover { text-decoration: underline; text-underline-offset: 3px; }
.resume-stamp {
  margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint);
}

/* ---------- Notes ---------- */
.notes-layout { display: grid; grid-template-columns: 200px 1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.notes-index { position: sticky; top: 96px; }
.notes-index-title {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px;
}
.notes-index ol { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.notes-index li { counter-increment: n; }
.notes-index a {
  display: block; padding: 7px 0 7px 24px; position: relative;
  color: var(--text-dim); font-size: 13.5px; line-height: 1.4; transition: color 0.2s;
}
.notes-index a::before {
  content: counter(n, decimal-leading-zero); position: absolute; left: 0; top: 7px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
}
.notes-index a:hover, .notes-index a.current { color: var(--accent); }
.notes-index a.current::before { color: var(--accent); }
@media (max-width: 900px) { .notes-layout { grid-template-columns: 1fr; } .notes-index { position: static; } }

.notes-list { display: grid; gap: 18px; }
.note {
  border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface);
  padding: clamp(24px, 3.5vw, 40px); scroll-margin-top: 92px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.note:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.note:target { border-color: var(--accent-line); }
.note-meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
}
.note-link { margin-left: auto; color: var(--text-faint); opacity: 0; transition: opacity 0.2s, color 0.2s; }
.note:hover .note-link { opacity: 1; }
.note-link:hover { color: var(--accent); }
@media (hover: none) { .note-link { opacity: 1; } }
.note h2 {
  font-size: clamp(22px, 3vw, 30px); font-weight: 600; letter-spacing: -0.025em;
  margin-top: 12px; max-width: 26ch;
}
.note p { color: var(--text-dim); font-size: 16.5px; line-height: 1.68; margin-top: 16px; max-width: 68ch; }
.note p em { color: var(--text); font-style: italic; }

/* ---------- Stack by layer ---------- */
.stack-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 820px) { .stack-grid { grid-template-columns: 1fr; } }
.stack-card {
  border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); padding: 24px;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.stack-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.stack-card h3 {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}
.stack-card p { color: var(--text-faint); font-size: 13px; margin-bottom: 14px; }
.stack-card .tags { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- Colophon ---------- */
.colophon {
  border-top: 1px solid var(--border); margin-top: 40px; padding-top: 22px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); line-height: 1.75; max-width: 68ch;
}
.colophon b { color: var(--text-dim); font-weight: 500; }
.colophon a { color: var(--accent); }
.colophon a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Print: résumé and notes ---------- */
@page { size: A4; margin: 10mm 12mm; }
@media print {
  .resume { border: 0 !important; padding: 0 !important; background: #fff !important; }
  .resume-print-head { display: block !important; margin-bottom: 18px; }
  .resume-print-head h2 { font-size: 26px; margin-bottom: 4px; }
  .resume-print-head p { font-size: 11px; color: #444 !important; }
  .rsec + .rsec { margin-top: 16px; padding-top: 12px; border-top: 1px solid #e5e5e5 !important; }
  .rsec-title { color: #000 !important; font-size: 10px; margin-bottom: 8px; }
  .rjob, .rsec, .note { break-inside: avoid; }
  .rlist li { font-size: 11.5px; margin-top: 4px; color: #222 !important; }
  .rlist li::before { background: #000 !important; }
  .rsec-body, .rstack dd, .rmetric span { font-size: 11.5px; color: #222 !important; }
  .rjob-head h3 { font-size: 13.5px; }
  .rjob-head .co { color: #000 !important; }
  .rmetric { border-color: #e5e5e5 !important; padding: 8px 10px; }
  .rmetric b { font-size: 16px; }
  .resume-stamp { color: #666 !important; }
  .notes-index, .resume .cta-row, #printResume, .copy-btn, .resume-pill,
  .page-head, .kicker { display: none !important; }
  .notes-layout { grid-template-columns: 1fr !important; }
  footer.foot { display: none !important; }
  .rsec + .rsec { margin-top: 12px; padding-top: 10px; }
  .resume-print-head { margin-bottom: 12px; }
  .resume-print-head h2 { font-size: 22px; }
  .rjob + .rjob { margin-top: 12px; }
  .rlist { margin-top: 6px; }
  .rlist li { font-size: 11px; margin-top: 3px; padding-left: 15px; }
  .rlist li::before { left: 2px; width: 4px; height: 4px; }
  .rsec-body { font-size: 11px; }
  .rjob .tags { margin-top: 7px; }
  /* Metrics collapse from four boxes to one compact line on paper */
  .rmetrics { display: flex !important; flex-wrap: wrap; gap: 6px 22px; }
  .rmetric { border: 0 !important; padding: 0 !important; background: none !important;
             display: flex; align-items: baseline; gap: 7px; }
  .rmetric b { font-size: 13px; }
  .rmetric span { font-size: 10px; margin-top: 0; max-width: none; }
  .rlinks { gap: 4px 16px; }
  .rlinks a { font-size: 10.5px; color: #000 !important; }
  /* the link text is already the URL here, so don't print it twice */
  .rlinks a[href^="http"]::after { content: none !important; }
  .rstack dd { font-size: 11px; }
  .tag { font-size: 9.5px !important; padding: 2px 7px !important; border-color: #ddd !important; color: #333 !important; }
  .rstack { gap: 6px; }
  .rstack dt { font-size: 10.5px; }
  .rmetrics { gap: 8px; }
  .resume-stamp { margin-top: 16px; padding-top: 10px; }
}
