/* Layout: sticky header, split hero (who I am + live architecture explorer), then experience timeline,
   incident slider, projects, skills, education and contact. Dark "coffee with milk" theme by default. */
:root {
  --bg: #1d1a17;
  --surface: #25211d;
  --surface-2: #2d2823;
  --text: #ece5d8;
  --muted: #a89f90;
  --line: #3a342d;
  --accent: #d6a874;
  --accent-ink: #1d1a17;
  --ok: #9fbf9a;
  --shadow: rgba(0, 0, 0, .35);

  --f-display: "Geologica", "Segoe UI", system-ui, sans-serif;
  --f-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 18px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2ede5;
  --surface: #fbf8f3;
  --surface-2: #ebe4d8;
  --text: #2a241e;
  --muted: #6b6155;
  --line: #d9cfc0;
  --accent: #8a5c2b;
  --accent-ink: #fbf8f3;
  --ok: #466e41;
  --shadow: rgba(60, 40, 20, .12);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
p { margin: 0; text-wrap: pretty; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 50;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--radius-sm); text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 760px) {
  .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
}
.mono { font-family: var(--f-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.top.scrolled { border-bottom-color: var(--line); }
.top .wrap { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1rem/1 var(--f-display); letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; flex: none; color: var(--accent); }
.brand-mark .pulse { transform-origin: 12px 12px; animation: pulse 2.8s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(.4); opacity: .9; } 70%, 100% { transform: scale(1.25); opacity: 0; } }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  position: relative; padding: 8px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: .9375rem; transition: color .2s ease, background .2s ease;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="true"] { color: var(--text); }
.nav a[aria-current="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent);
}
.tools { display: flex; gap: 6px; align-items: center; }
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
  font: 500 .8125rem/1 var(--f-mono); color: var(--text);
  transition: border-color .2s ease, transform .2s var(--ease);
}
.tool:hover { border-color: var(--accent); }
.tool:active { transform: scale(.96); }
.tool kbd { font: inherit; color: var(--muted); }
.tool svg { width: 16px; height: 16px; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
@media (max-width: 980px) { .nav { display: none; } .tools { margin-left: auto; } }
@media (max-width: 520px) { .brand-name { font-size: .9375rem; } .tool-search span, .tool-search kbd { display: none; } .tool-search { padding: 0; width: 40px; } }
@media (max-width: 360px) { .brand-name { display: none; } }

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 0 22px; border-radius: 999px;
  font: 600 1rem/1 var(--f-body); text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  transition: transform .25s var(--ease), border-color .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.btn:active { transform: translateY(0) scale(.98); }
.btn .ico { width: 18px; height: 18px; transition: transform .3s var(--ease); }
.btn:hover .ico-right { transform: translateX(4px); }
.btn:hover .ico-down { transform: translateY(3px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:hover { border-color: var(--accent); }

/* ---------- hero ---------- */
.hero { position: relative; isolation: isolate; }
.sky {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent);
}
.hero .wrap {
  display: grid; gap: 48px; align-items: center;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  padding-block: 48px 48px;
}
@media (max-width: 1020px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-block: 32px 48px; } }
.who { display: grid; gap: 24px; min-width: 0; }
.who-top { display: flex; align-items: center; gap: 32px; padding-left: 12px; }
.avatar { position: relative; width: 112px; height: 112px; flex: none; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; }
.avatar svg { position: absolute; inset: -24px; width: calc(100% + 48px); height: calc(100% + 48px); color: var(--accent); overflow: visible; }
.avatar .orbit { transform-origin: 80px 80px; }
.avatar .orbit-a { animation: spin 18s linear infinite; }
.avatar .orbit-b { animation: spin 31s linear infinite reverse; }
.avatar .moon { fill: var(--text); opacity: .7; }
.avatar img { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 18%, transparent); }
@keyframes spin { to { transform: rotate(360deg); } }
.status {
  display: inline-flex; align-items: center; gap: 10px; width: fit-content;
  font: 500 .8125rem/1.2 var(--f-mono); color: var(--ok);
  padding: 8px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: ping 2.4s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }
.where { display: block; margin-top: 8px; font: 400 .8125rem/1.4 var(--f-mono); color: var(--muted); }
.hero h1 { font-size: clamp(2.6rem, 5.4vw, 4.4rem); font-weight: 700; line-height: .98; letter-spacing: -.035em; }
.hero h1 span { display: block; color: var(--muted); font-weight: 300; }
.role { font: 500 1.0625rem/1.5 var(--f-mono); color: var(--accent); margin-top: -8px; }
.role span { white-space: nowrap; }
.lede { font-size: 1.1875rem; line-height: 1.6; color: var(--text); max-width: 42ch; }
.lede em { font-style: normal; color: var(--accent); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.now {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 16px 18px; border: 1px dashed var(--line); border-radius: 14px; max-width: 46ch;
}
.now-label {
  font: 500 .6875rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--ok);
  padding: 6px 8px; border-radius: 6px; background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.now ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .9375rem; color: var(--muted); }
.now li::before { content: "› "; color: var(--accent); }
.hero-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-links a {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
  border: 1px solid var(--line); transition: color .2s, border-color .2s, transform .25s var(--ease);
}
.hero-links a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.hero-links svg { width: 17px; height: 17px; }
.hero-mail { margin-left: 8px; font: 400 .8125rem/1 var(--f-mono); color: var(--muted); user-select: all; }

/* explorer */
.explorer { min-width: 0; position: relative; }
.ex-tabs {
  position: relative; display: flex; gap: 2px; padding: 4px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  overflow-x: auto; scrollbar-width: none; width: fit-content; max-width: 100%;
}
.ex-tabs::-webkit-scrollbar { display: none; }
.ex-tab {
  position: relative; z-index: 1; flex: none;
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  padding: 9px 12px; border-radius: 999px; font: 500 .875rem/1 var(--f-body); color: var(--muted);
  transition: color .25s ease;
}
.ex-tab:hover { color: var(--text); }
.ex-tab[aria-selected="true"] { color: var(--accent-ink); }
.ex-ind {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--accent);
  transition: transform .45s var(--ease), width .45s var(--ease);
}
.ex-stage {
  position: relative; border-radius: var(--radius);
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 26%, transparent) 1px, transparent 0) 0 0 / 24px 24px;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 50%, #000 70%, transparent 100%);
          mask-image: radial-gradient(120% 100% at 50% 50%, #000 70%, transparent 100%);
}
.ex-head { display: flex; justify-content: space-between; gap: 12px; font: 400 .75rem/1.4 var(--f-mono); color: var(--muted); padding: 2px 4px 0; }
.ex-head b { color: var(--text); font-weight: 500; }
.ex-canvas { display: block; width: 100%; aspect-ratio: 16 / 10; touch-action: pan-y; cursor: grab; }
.ex-canvas.dragging { cursor: grabbing; }
@media (max-width: 600px) { .ex-canvas { aspect-ratio: 5 / 6; } }
.ex-caption { font-size: .9375rem; color: var(--muted); margin: 6px 4px 12px; min-height: 3em; }
.ex-tip {
  position: absolute; z-index: 3; pointer-events: none; width: max-content; max-width: 250px;
  background: var(--surface); color: var(--text); border: 1px solid var(--accent);
  border-radius: 12px; padding: 10px 12px; font-size: .875rem; line-height: 1.45;
  box-shadow: 0 14px 40px var(--shadow);
}
.ex-tip b { display: block; font: 500 .75rem/1.2 var(--f-mono); color: var(--accent); margin-bottom: 4px; }
.term { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-bottom: 1px solid var(--line); font: 400 .6875rem/1 var(--f-mono); color: var(--muted); }
.term-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.term-bar i:first-child { background: color-mix(in srgb, var(--accent) 70%, var(--line)); }
.term-bar span { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-log {
  list-style: none; margin: 0; padding: 10px 16px 4px;
  font: 400 .75rem/1.75 var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums;
  height: calc(1.75em * 5 + 14px); overflow: hidden;
}
.ex-log .cmd { color: var(--text); }
.ex-log li.out { white-space: normal; text-overflow: clip; }
.ex-log li.warn { color: var(--accent); }
.term-input { display: flex; align-items: center; gap: 10px; padding: 6px 16px 12px; font: 400 .8125rem/1.4 var(--f-mono); }
.term-input .prompt { color: var(--ok); white-space: nowrap; }
.term-input input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; padding: 4px 0;
  caret-color: var(--accent); outline: none; border-bottom: 1px dashed transparent;
}
.term-input input:focus { border-bottom-color: var(--line); }
.term-input input::placeholder { color: var(--muted); opacity: .7; }
.term:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.ex-log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: logIn .45s var(--ease); }
.ex-log .ok { color: var(--ok); }
.ex-log .warn { color: var(--accent); }
.ex-log .ts { margin-right: 10px; }
@keyframes logIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- sections ---------- */
.section { padding-block: 64px; }
.section + .section { border-top: 1px solid var(--line); }
.sec-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 36px; }
.eyebrow { display: block; font: 500 .75rem/1 var(--f-mono); color: var(--muted); margin-bottom: 14px; }
.eyebrow b { color: var(--ok); font-weight: 500; }
.section h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); font-weight: 600; line-height: 1.08; letter-spacing: -.025em; }
.sec-note { color: var(--muted); max-width: 46ch; }
@media (max-width: 760px) { .section { padding-block: 56px; } }

/* reveal: scroll-driven animations where supported; JS fallback adds .pre for the rest */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rv { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
  }
}
@keyframes rise { from { transform: translateY(26px); } }
.js .rv { transition: transform .8s var(--ease), opacity .8s var(--ease); }
.js .rv.pre { transform: translateY(18px); }

/* ---------- experience ---------- */
.timeline { display: grid; gap: 0; position: relative; }
.job { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; position: relative; padding-bottom: 40px; }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: 216px; top: 10px; bottom: -10px; width: 0; border-left: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); }
.job:last-child::before { display: none; }
.job-when { font: 500 .8125rem/1.5 var(--f-mono); color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }
.job-when .dur { display: block; color: var(--accent); }
.job-body { position: relative; display: grid; gap: 16px; min-width: 0; padding-left: 0; }
.job-body::before {
  content: ""; position: absolute; left: -21px; top: 8px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.job.current .job-body::before { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.job h3 { font-size: 1.375rem; font-weight: 600; letter-spacing: -.01em; }
.job h3 small { display: block; font: 400 1rem/1.4 var(--f-body); color: var(--muted); margin-top: 4px; }
.job-stack { font: 400 .8125rem/1.6 var(--f-mono); color: var(--muted); }
@media (max-width: 760px) {
  .job { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-left: 24px; }
  .job::before { left: 5px; top: 14px; }
  .job-body::before { left: -24px; top: -26px; }
  .job-when { padding-left: 0; }
}

.case {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .25s ease;
}
.case:hover, .case[open] { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.case summary {
  list-style: none; cursor: pointer; padding: 18px 22px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center;
}
.case summary .chev { grid-column: 2; grid-row: 1 / span 2; }
.case summary::-webkit-details-marker { display: none; }
.case summary .sum-title { display: block; margin: 0; font: 600 1.0625rem/1.3 var(--f-display); }
.case summary .sum-sub { display: block; color: var(--muted); font-size: .9375rem; margin-top: 2px; }
.case .chev { margin-left: auto; width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: transform .35s var(--ease), background .2s; }
.case .chev svg { width: 14px; height: 14px; }
.case[open] .chev { transform: rotate(180deg); background: var(--surface-2); }
.case-body { padding: 0 22px 22px; display: grid; gap: 18px; }
.case ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.case li { position: relative; padding-left: 22px; }
.case li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 8px; height: 2px; border-radius: 2px; background: var(--accent); }
.metrics { display: flex; flex-wrap: wrap; gap: 8px; }
.metric {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2);
  font: 400 .8125rem/1 var(--f-mono); color: var(--muted);
}
.metric b { font: 600 1rem/1 var(--f-display); color: var(--text); }

/* ---------- incidents slider ---------- */
.slider-ctl { display: flex; align-items: center; gap: 10px; }
.round {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: border-color .2s, transform .2s var(--ease), opacity .2s;
}
.round svg { width: 18px; height: 18px; }
.round:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.round:active:not(:disabled) { transform: scale(.94); }
.round:disabled { opacity: .35; cursor: default; }
.track {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(88%, 420px); gap: 20px;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 4px 2px 8px; margin: -4px -2px 0; scrollbar-width: none; cursor: grab;
}
.track::-webkit-scrollbar { display: none; }
/* touch screens swipe card by card; on desktop buttons, drag and the scrubber move the track */
@media (hover: none) { .track { scroll-snap-type: x mandatory; } }
.track.dragging, .track.scrubbing { scroll-snap-type: none; }
.track.dragging { cursor: grabbing; user-select: none; }
.track.dragging a { pointer-events: none; }
.inc {
  scroll-snap-align: start; min-width: 0; display: flex; flex-direction: column; gap: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.inc-top { display: flex; justify-content: space-between; gap: 12px; font: 500 .75rem/1.3 var(--f-mono); color: var(--muted); }
.inc-top .sev { color: var(--accent); }
.inc h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.inc dl { margin: 0; display: grid; gap: 14px; }
.inc dt { font: 500 .6875rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 6px; }
.inc dd { margin: 0; font-size: .96875rem; }
.inc dd.fix { color: var(--ok); }
.scrub { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.scrub output { font: 500 .8125rem/1 var(--f-mono); color: var(--muted); min-width: 4.5ch; font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 28px; background: transparent; cursor: pointer; margin: 0;
  --fill: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill) 100% no-repeat, var(--line);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); transition: transform .2s var(--ease);
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
input[type="range"]:disabled { opacity: .4; cursor: default; }
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }

/* ---------- projects ---------- */
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.projects { display: grid; gap: 20px; container: projects / inline-size; }
.proj {
  position: relative; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .25s ease, opacity .3s ease;
}
.proj::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--spin), transparent 0 70%, var(--accent) 85%, transparent 100%);
  -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 exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .4s ease;
}
.proj:hover::before { opacity: 1; animation: orbitBorder 4s linear infinite; }
@keyframes orbitBorder { to { --spin: 360deg; } }
.proj { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 28px; align-items: start; }
.proj-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* cards switch to two columns based on their container, not the viewport */
@container projects (min-width: 820px) {
  .proj { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; padding: 32px; }
}
.proj-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.proj-side .links { margin-top: 0; }
.proj-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.proj h3 { font-size: clamp(1.4rem, 2.4vw, 1.875rem); font-weight: 600; letter-spacing: -.02em; }
.tag { font: 500 .6875rem/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.tag.live { color: var(--ok); }
.proj p { color: var(--muted); }
.proj ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: .96875rem; }
.proj li { position: relative; padding-left: 20px; }
.proj li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 8px; height: 2px; border-radius: 2px; background: var(--accent); }
.big-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.big-metrics div { background: var(--surface-2); border-radius: 14px; padding: 16px; }
.big-metrics b { display: block; font: 600 1.625rem/1 var(--f-display); letter-spacing: -.02em; }
.big-metrics span { display: block; font: 400 .75rem/1.35 var(--f-mono); color: var(--muted); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font: 400 .75rem/1 var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; }
.links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: auto; }
.links a { font: 500 .875rem/1 var(--f-mono); color: var(--accent); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.links a:hover { text-decoration: underline; }
.links svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.links a:hover svg { transform: translate(2px, -2px); }

/* skill highlighting */
.dim .hl-target:not(.hit) { opacity: .38; }
.hl-target.hit { border-color: var(--accent) !important; }

/* ---------- skills ---------- */
.skills { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px 32px; }
@media (min-width: 640px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.skill-group h3 { font: 500 .75rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 14px; }
.skill-group .row { display: flex; flex-wrap: wrap; gap: 8px; }
.skill {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 14px;
  font: 500 .875rem/1 var(--f-body); cursor: pointer; transition: border-color .2s, background .2s, color .2s, transform .2s var(--ease);
}
.skill:hover { border-color: var(--accent); }
.skill:active { transform: scale(.96); }
.skill[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.skill.plain { cursor: default; color: var(--muted); }
.skill.plain:hover { border-color: var(--line); }
.used {
  margin-top: 28px; min-height: 52px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); font-size: .9375rem;
}
.used b { color: var(--text); font-weight: 500; }
.used a { color: var(--accent); }

/* ---------- education ---------- */
.edu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .edu { grid-template-columns: minmax(0, 1fr); } }
.edu-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 8px; align-content: start; }
.edu-card h3 { font-size: 1.125rem; font-weight: 600; }
.edu-card p { color: var(--muted); }
.edu-card .when { font: 500 .8125rem/1 var(--f-mono); color: var(--accent); }
.lang-row { display: flex; justify-content: space-between; gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.lang-row:last-child { border-bottom: 0; }
.lang-row span:last-child { font: 400 .8125rem/1.6 var(--f-mono); color: var(--muted); text-align: right; }

/* ---------- contact ---------- */
.contact .wrap { display: grid; gap: 40px; align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1020px) { .contact .wrap { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.contact-main { display: grid; gap: 28px; min-width: 0; }
.response { margin: 0; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.response pre { margin: 0; padding: 18px 20px; overflow-x: auto; font: 400 .8125rem/1.75 var(--f-mono); color: var(--muted); }
.response .k { color: var(--text); }
.response .v { color: var(--accent); }
.response .b, .response .ok { color: var(--ok); }
.response .c { color: var(--muted); }
.contact h2 { max-width: 22ch; font-size: clamp(1.75rem, 3vw, 2.4rem); }
.mail-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.mail { font: 600 clamp(1.3rem, 3.4vw, 2.4rem)/1.1 var(--f-display); letter-spacing: -.025em; overflow-wrap: anywhere; color: var(--text); text-decoration: none; }
.mail:hover { color: var(--accent); }
.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.foot { padding-block: 28px 40px; border-top: 1px solid var(--line); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font: 400 .8125rem/1.5 var(--f-mono); color: var(--muted); }

/* ---------- footer popover ---------- */
.inc-note { margin: -16px 0 28px; }
.hood-btn { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 4px 0; }
.hood-btn:hover { color: var(--accent); }
.hood {
  margin: auto auto 80px; width: min(460px, calc(100% - 32px)); padding: 22px 24px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px var(--shadow);
}
.hood:not([popover]) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; }
.hood::backdrop { background: color-mix(in srgb, var(--bg) 40%, transparent); }
.hood h3 { font-size: 1.0625rem; font-weight: 600; margin-bottom: 12px; }
.hood ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: .9375rem; color: var(--muted); }
.hood li { position: relative; padding-left: 20px; }
.hood li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font: 500 .9375rem/1 var(--f-body);
  transition: transform .35s var(--ease), opacity .35s var(--ease);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- command palette ---------- */
.palette {
  width: min(560px, calc(100% - 32px)); max-height: min(520px, 80vh); padding: 0; margin: 12vh auto auto;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px var(--shadow); overflow: hidden;
}
.palette::backdrop { background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(4px); }
.palette[open] { animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.palette label { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette label svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 400 1.0625rem/1.2 var(--f-body); }
.palette input::placeholder { color: var(--muted); }
.palette ul { list-style: none; margin: 0; padding: 8px; overflow-y: auto; max-height: 380px; }
.palette li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 12px; border-radius: 10px; cursor: pointer; }
.palette li small { font: 400 .75rem/1.4 var(--f-mono); color: var(--muted); }
.palette li[aria-selected="true"] { background: var(--surface-2); }
.palette li[aria-selected="true"] small { color: var(--accent); }
.palette .empty { padding: 20px 12px; color: var(--muted); cursor: default; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .rv.pre { transform: none; opacity: 1; }
}

/* ---------- project screenshots ---------- */
.shot { margin: 0; display: grid; gap: 10px; perspective: 1400px; }
.shot-frame {
  border-radius: 14px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -24px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
  transform: rotateY(-7deg) rotateX(3deg) scale(.98); transform-origin: 30% 50%;
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.proj:hover .shot-frame, .shot-frame:focus-within { transform: none; box-shadow: 0 30px 70px -20px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.shot-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); font: 400 .6875rem/1 var(--f-mono); color: var(--muted); }
.shot-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.shot-bar i:first-child { background: color-mix(in srgb, var(--accent) 70%, var(--line)); }
.shot-bar span { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top;
  -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent);
}
/* a light screenshot is toned down on the dark theme so it does not glare, and comes back to full brightness on hover */
:root:not([data-theme="light"]) .shot-light img { filter: brightness(.82) saturate(.9); transition: filter .6s var(--ease); }
:root:not([data-theme="light"]) .proj:hover .shot-light img { filter: none; }
.shot figcaption { font: 400 .75rem/1.4 var(--f-mono); color: var(--muted); }
.proj-main .chips { margin-top: 4px; }

/* ---------- certificates ---------- */
:root { interpolate-size: allow-keywords; }
.cert-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 680px) { .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .cert-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cert {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  transition: border-color .25s ease, transform .3s var(--ease);
}
.cert:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.cert::before {
  content: ""; position: absolute; top: 22px; right: 22px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}
.cert-top { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-right: 20px; font: 500 .75rem/1.4 var(--f-mono); color: var(--muted); }
.cert-date { color: var(--accent); }
.cert h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.25; }
.cert .chips { margin-top: 2px; }
.cert-id { margin-top: auto; }
.cert-id {
  align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; cursor: pointer;
  font: 400 .75rem/1 var(--f-mono); color: var(--muted); background: transparent;
  border: 1px dashed var(--line); border-radius: 8px; padding: 7px 10px; min-height: 30px;
}
.cert-id span { color: var(--accent); }
.cert-id:hover { color: var(--text); border-color: var(--accent); }
.cert-more { margin-top: 16px; }
.cert-more > summary { list-style: none; width: fit-content; margin: 8px 0 0; }
.cert-more > summary::-webkit-details-marker { display: none; }
.cert-more .when-open, .cert-more[open] .when-closed { display: none; }
.cert-more[open] .when-open { display: inline; }
.chev-ico { transition: transform .4s var(--ease); }
.cert-more[open] .chev-ico { transform: rotate(180deg); }
.cert-more[open] > summary { margin-bottom: 20px; }
/* height animation where the browser can animate to auto; elsewhere the panel simply opens */
.cert-more::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size .55s var(--ease), content-visibility .55s allow-discrete;
}
.cert-more[open]::details-content { block-size: auto; }
.cert-more[open] .cert { animation: certIn .5s var(--ease) both; }
.cert-more[open] .cert:nth-child(2) { animation-delay: .05s; }
.cert-more[open] .cert:nth-child(3) { animation-delay: .1s; }
.cert-more[open] .cert:nth-child(4) { animation-delay: .15s; }
.cert-more[open] .cert:nth-child(5) { animation-delay: .2s; }
.cert-more[open] .cert:nth-child(6) { animation-delay: .25s; }
.cert-more[open] .cert:nth-child(7) { animation-delay: .3s; }
@keyframes certIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- terminal extras ---------- */
.ex-log .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 6px -1px 0; border: 1px solid var(--line); }
body.show-grid::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  --col: calc((min(100vw, 1240px) - 64px - 11 * 20px) / 12);
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent) 0 var(--col), transparent var(--col) calc(var(--col) + 20px));
  background-size: min(100vw - 64px, 1176px) 100%; background-position: center; background-repeat: no-repeat;
}
