:root {
  --bg: #0a0a0c;
  --surface: #111115;
  --border: #212128;
  --border-strong: #55555f;
  --border-card: #2a2a33;
  --card-shadow: none;
  --text: #ededf0;
  --muted: #8d8d99;
  --accent: #6aa5ff;
  --accent-solid: #2563eb;
  --glass: rgba(10, 10, 12, 0.72);
  --ok: #34d399;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-2: #34d399;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --nav-h: 60px;
  --col-label: 190px;
  color-scheme: dark;
}
html[data-mode="light"] {
  --bg: #fcfcfd;
  --surface: #f0f2f7;
  --border: #d9dce4;
  --border-strong: #8a92a5;
  --border-card: #c5cad6;
  --card-shadow: 0 1px 2px rgba(15, 17, 23, 0.06), 0 4px 14px rgba(15, 17, 23, 0.05);
  --text: #0c0e13;
  --muted: #475066;
  --accent: #1d4ed8;
  --accent-solid: #2563eb;
  --glass: rgba(252, 252, 253, 0.78);
  --ok: #047857;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --accent-2: #047857;
  --shadow: 0 20px 50px rgba(15, 17, 23, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
  transition: background 0.2s ease, color 0.2s ease;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.mono { font-family: var(--font-mono); }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 max(24px, env(safe-area-inset-left)) 0 max(24px, env(safe-area-inset-right)); }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 6px; text-decoration: none; }
.skip:focus { top: 12px; }

html:not([data-mode="light"]) img.inv { filter: brightness(0) invert(0.9); }

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--nav-h);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-solid); color: #fff; font-size: 12.5px; font-weight: 500; }
.nav-links { display: flex; gap: 2px; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 14px; padding: 8px 12px; border-radius: 6px; transition: color 0.15s; }
.nav-links a:hover, .nav-links a.is-current { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); cursor: pointer; transition: border-color 0.15s; }
.icon-btn:hover { border-color: var(--muted); }
.lang { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px; border-radius: 8px; border: 1px solid var(--border-strong); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; }
.lang-btn { border: 0; background: transparent; color: var(--muted); font: inherit; padding: 6px 7px; border-radius: 5px; cursor: pointer; transition: color 0.15s; }
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { color: var(--accent); font-weight: 500; }
.lang-sep { color: var(--muted); }
.i-moon { display: none; }
html[data-mode="light"] .i-sun { display: none; }
html[data-mode="light"] .i-moon { display: block; }
.burger { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.burger span { display: block; width: 15px; height: 1.5px; background: currentColor; transition: transform 0.2s, opacity 0.2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 8px; font: 500 14.5px var(--font-body);
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn.primary { background: var(--accent-solid); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--muted); }
.btn-icon { gap: 8px; }

.hero { position: relative; overflow: hidden; padding: calc(var(--nav-h) + 88px) 0 80px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px; opacity: 0.5;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 50% 30%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 70% 75% at 50% 30%, #000 30%, transparent 78%);
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: 0; background: radial-gradient(640px 320px at 18% 0%, var(--accent-soft), transparent 70%); pointer-events: none; }
.eyebrow { font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 64px; align-items: end; }
.hero h1 { font-size: clamp(40px, 6.4vw, 68px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.02; }
.grad { background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.role { margin-top: 20px; font-size: 16px; color: var(--muted); }
.lead { margin-top: 20px; max-width: 46ch; font-size: 20px; line-height: 1.5; letter-spacing: -0.01em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.socials { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 28px; }
.socials a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: 14.5px; transition: color 0.15s; }
.socials a:hover { color: var(--text); }

.facts { border-top: 1px solid var(--border); }
.facts > div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.facts dt { color: var(--muted); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 9px; vertical-align: 1px; }

.icon-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.icon-row li { display: grid; place-items: center; }
.icon-row img { opacity: 0.92; transition: opacity 0.15s, transform 0.15s; }
.icon-row img:hover { opacity: 1; transform: translateY(-2px); }
.icon-row .txt { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.section { padding: 72px 0; border-top: 1px solid var(--border); }
.section-grid { display: grid; grid-template-columns: var(--col-label) 1fr; gap: 24px 40px; align-items: start; }
.section-label { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; position: sticky; top: calc(var(--nav-h) + 24px); }

.reveal { opacity: 0.25; transform: translateY(12px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

.prose { display: grid; gap: 18px; max-width: 66ch; color: var(--muted); }
.prose-lead { color: var(--text); font-size: 19px; line-height: 1.55; letter-spacing: -0.01em; }

.skills { display: grid; }
.skill-row { display: grid; grid-template-columns: 170px 1fr; gap: 12px 24px; padding: 14px 0; }
.skill-row:first-child { padding-top: 0; }
.skill-row h3 { font-size: 14px; font-weight: 500; color: var(--muted); padding-top: 3px; }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-list li { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12.5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); transition: border-color 0.15s, background 0.15s, color 0.15s; }
.skill-list li:hover { border-color: var(--accent-solid); background: var(--accent-soft); color: var(--accent); }
.skill-list img { flex: none; width: 16px; height: 16px; }

.entries { position: relative; display: grid; gap: 36px; padding-left: 32px; }
.entries::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--border-card); }
.entry { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 16px; }
.entry::before { content: ""; position: absolute; left: -32px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent-solid); box-shadow: 0 0 0 4px var(--accent-soft); }
.entry-when { font-family: var(--font-mono); font-size: 13px; color: var(--muted); padding-top: 4px; }
.entry-body h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.entry-org { font-weight: 400; color: var(--muted); }
.entry-body ul { display: grid; gap: 8px; margin-top: 12px; max-width: 64ch; }
.entry-body li { position: relative; padding-left: 16px; color: var(--muted); font-size: 15.5px; }
.entry-body li::before { content: ""; position: absolute; left: 0; top: 0.78em; width: 6px; height: 1px; background: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font: 500 13.5px var(--font-body); padding: 6px 13px; border-radius: 999px; cursor: pointer; border: 1px solid var(--border-strong); background: transparent; color: var(--muted); transition: color 0.15s, border-color 0.15s, background 0.15s; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.is-active { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }

.projects { display: grid; gap: 14px; margin-top: 16px; }
.proj { display: grid; grid-template-columns: 1fr 190px 96px; gap: 12px 28px; align-items: start; padding: 22px 24px; background: var(--surface); border: 1px solid var(--border-card); border-radius: 12px; box-shadow: var(--card-shadow); transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.2s; }
.proj:hover { border-color: var(--accent-solid); }
.proj[hidden] { display: none; }
.proj.is-out { opacity: 0; transform: translateY(6px); }
.proj h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.proj h3 a { text-decoration: none; }
.proj h3 a:hover { color: var(--accent); }
.proj-main p { margin-top: 6px; color: var(--muted); font-size: 15px; max-width: 56ch; }
.proj .icon-row { padding-top: 2px; }
.proj-links { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 14px; padding-top: 2px; }
.proj-links a { color: var(--accent); text-decoration: none; }
.proj-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

.rows { display: grid; }
.rows li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.rows li:first-child { padding-top: 0; }
.rows-main { font-weight: 500; }
.rows-sub { color: var(--muted); font-size: 15px; text-align: right; }

.contact { display: grid; gap: 14px; justify-items: start; padding: 32px; border: 1px solid var(--border-card); border-radius: 16px; box-shadow: var(--card-shadow); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); }
.contact-text { color: var(--muted); font-size: 17px; }
.email { font-size: clamp(16px, 3vw, 24px); letter-spacing: -0.01em; overflow-wrap: anywhere; max-width: 100%; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.footer { border-top: 1px solid var(--border); padding: 24px 0 36px; color: var(--muted); font-size: 13.5px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.case-link { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--accent); text-decoration: none; }
.case-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.case { padding: calc(var(--nav-h) + 48px) 0 72px; }
.case-wrap { max-width: 820px; }
.case-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 32px; color: var(--muted); text-decoration: none; font-size: 14.5px; transition: color 0.15s; }
.case-back:hover { color: var(--text); }
.case-head .eyebrow { margin-bottom: 14px; }
.case h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.12; }
.case-head .lead { margin-top: 18px; max-width: 60ch; color: var(--muted); }
.case-block { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border); }
.case-block h2 { margin-bottom: 14px; font-size: 14px; font-weight: 500; color: var(--muted); }
.case-block p { max-width: 68ch; color: var(--text); font-size: 16.5px; }
.case-list { display: grid; gap: 12px; max-width: 68ch; }
.case-list li { position: relative; padding-left: 16px; color: var(--muted); font-size: 16px; }
.case-list li::before { content: ""; position: absolute; left: 0; top: 0.85em; width: 6px; height: 1px; background: var(--muted); }
.case-list strong { color: var(--text); font-weight: 600; }
.case-steps { display: grid; gap: 8px; max-width: 68ch; padding-left: 24px; list-style: decimal; color: var(--muted); font-size: 16px; }
.case code { font-family: var(--font-mono); font-size: 0.86em; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-card); background: var(--surface); color: var(--text); overflow-wrap: anywhere; }
.case-links { display: flex; flex-wrap: wrap; gap: 10px; }
.case-fig { margin: 28px 0 0; }
.case-fig img { width: 100%; height: auto; border-radius: 14px; }
.case-fig figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; }
.case-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: 14px; cursor: zoom-in; }
.case-zoom img { border: 1px solid var(--border-card); }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; color: var(--text); }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.82); }
.lightbox[open] { animation: lightbox-in 0.18s ease; }
.lightbox[open]::backdrop { animation: lightbox-fade 0.18s ease; }
.lightbox img { display: block; width: auto; height: auto; max-width: 96vw; max-height: 90vh; border-radius: 14px; }
.lightbox-close { position: absolute; top: -14px; right: -14px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); cursor: pointer; }
.lightbox-close:hover { border-color: var(--muted); }
@keyframes lightbox-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 1500px) {
  .container { max-width: 1160px; }
}
@media (max-width: 1080px) {
  .hero-grid { gap: 40px; }
  .section-grid { --col-label: 150px; gap: 24px 28px; }
  .proj { grid-template-columns: 1fr 170px 84px; gap: 12px 20px; }
}
@media (min-width: 761px) and (max-width: 900px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: 8px 7px; font-size: 13.5px; }
  .brand-name { font-size: 14px; }
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .facts { max-width: 560px; }
  .section-grid { grid-template-columns: 1fr; gap: 20px; }
  .section-label { position: static; }
  .proj { grid-template-columns: 1fr auto; }
  .proj .icon-row { grid-column: 1 / -1; grid-row: 2; }
  .proj-links { flex-direction: row; gap: 4px 16px; }
}
@media (max-width: 760px) {
  .burger { display: flex; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; gap: 0; padding: 4px 24px 12px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    opacity: 0; transform: translateY(-6px); visibility: hidden; transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    max-height: calc(100vh - var(--nav-h)); max-height: calc(100dvh - var(--nav-h)); overflow-y: auto;
  }
  .icon-btn { width: 40px; height: 40px; }
  .lang { height: 40px; }
  .chip { padding: 8px 14px; }
  .contact { padding: 26px; }
  .nav-links.open { opacity: 1; transform: none; visibility: visible; }
  .nav-links a { padding: 14px 0; font-size: 16px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .hero { padding-top: calc(var(--nav-h) + 56px); padding-bottom: 56px; }
  .section { padding: 52px 0; }
  .skill-row { grid-template-columns: 1fr; gap: 8px; }
  .entry { grid-template-columns: 1fr; gap: 4px; }
  .rows li { flex-direction: column; gap: 2px; }
  .rows-sub { text-align: left; }
}
@media (max-width: 460px) {
  .container { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .nav-links { padding-left: 20px; padding-right: 20px; }
  .brand-name { font-size: 14px; }
  .lead { font-size: 18px; }
  .prose-lead { font-size: 17.5px; }
  .hero-actions .btn { flex: 1 1 150px; }
  .socials { gap: 10px 20px; }
  .facts > div { grid-template-columns: 84px 1fr; }
  .proj { grid-template-columns: 1fr; padding: 18px; }
  .proj .icon-row { grid-row: auto; }
  .contact { padding: 20px; border-radius: 14px; }
  .contact-actions .btn { flex: 1 1 130px; }
  .entries { padding-left: 28px; }
  .entry::before { left: -28px; }
  .footer-inner { flex-direction: column; }
}
@media (max-width: 340px) {
  .brand-name { display: none; }
  .hero h1 { font-size: 36px; }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .lightbox[open], .lightbox[open]::backdrop { animation: none; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; color: #000 !important; font-size: 10.5pt; line-height: 1.45; }
  * { transition: none !important; box-shadow: none !important; }
  img.inv { filter: none !important; }

  .hero::before, .hero::after, .entries::before, .entry::before,
  .nav, .skip, .toast, .hero-actions, .socials, .filters, .proj-links, .contact-actions,
  .facts-stack, .proj .icon-row, .section-label::after { display: none !important; }

  .reveal { opacity: 1 !important; transform: none !important; }
  .proj.is-out, .proj[hidden] { display: grid !important; opacity: 1 !important; transform: none !important; }

  .container { max-width: none; padding: 0; }
  .hero { padding: 0 0 6mm; }
  .hero-grid { display: block; }
  .hero h1 { font-size: 24pt; }
  .grad { background: none; color: #000 !important; -webkit-text-fill-color: #000; }
  .eyebrow { color: #444 !important; margin-bottom: 4pt; }
  .entries { padding-left: 0; }
  .role, .lead { color: #333 !important; font-size: 11pt; margin-top: 3pt; }
  .facts { margin-top: 6pt; border-color: #ccc; }
  .facts > div { grid-template-columns: 90px 1fr; padding: 3pt 0; border-color: #ddd; font-size: 10pt; }
  .facts dt { color: #555; }
  .status-dot { background: #000; }

  .section { padding: 5mm 0 0; border-color: #bbb; break-inside: avoid-page; }
  .section-grid { grid-template-columns: 110px 1fr; gap: 10pt; }
  .section-label { position: static; color: #000; font-size: 10.5pt; font-weight: 600; }

  .prose, .prose-lead, .entry-body li, .proj-main p, .rows-sub, .contact-text, .entry-org, .skill-row h3, .entry-when { color: #222 !important; font-size: 10pt; }
  .prose-lead { font-size: 10.5pt; }
  .skill-row { padding: 4pt 0; border-color: #ddd; grid-template-columns: 120px 1fr; }
  .skill-list { gap: 2pt 12pt; }
  .skill-list li { font-size: 10pt; border: 0 !important; background: none !important; padding: 0 !important; }
  .skill-list img { width: 11px; height: 11px; }
  .entry-body li::before { background: #000; }
  .proj { grid-template-columns: 1fr; padding: 6pt 8pt; background: none !important; border: 1px solid #ddd; border-radius: 4px; break-inside: avoid; }
  .proj h3 a, .proj-links a { color: #000; }
  .rows li, .rows li:first-child { padding: 3pt 0; border-color: #ddd; }
  .email { font-size: 11pt; }
  .contact { padding: 0; border: 0; background: none; }
  .footer { border: 0; padding-top: 4mm; color: #555; }
  a { color: #000; text-decoration: none; }
}
