/* CV site. Tokens come from the design; the neural-network band keeps its
   own fixed dark colours in both themes. */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("fonts/space-grotesk-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-stretch: 100%;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
}

:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

.t-dark {
  color-scheme: dark;
  --bg: #12111c; --surface: #1b1a28; --line: #2e2c40; --line-strong: #6a6882;
  --ink: #edecf4; --muted: #a09eb4;
  --primary: #23cbb4; --on-primary: #12111c; --psoft: #0e3236; --on-psoft: #23cbb4;
  --accent: #ef663e; --on-accent: #12111c; --accent-text: #ef663e; --asoft: #2e1a1c;
  --deep: #004b4e; --on-deep: #edecf4;
}
.t-light {
  color-scheme: light;
  --bg: #f5f3ee; --surface: #ffffff; --line: #dcd9d0; --line-strong: #7e7b90;
  --ink: #12111c; --muted: #55536a;
  --primary: #004b4e; --on-primary: #ffffff; --psoft: #d3f5ef; --on-psoft: #004b4e;
  --accent: #ef663e; --on-accent: #12111c; --accent-text: #b4441f; --asoft: #fce3da;
  --deep: #004b4e; --on-deep: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/26px var(--font-body);
  transition: background 0.2s, color 0.2s;
}

a { color: var(--primary); }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

h1, h2, h3, p { margin: 0; }

h1 {
  font: 600 clamp(40px, 9vw, 56px)/1.07 var(--font-display);
  letter-spacing: -0.02em;
}
h2 {
  font: 600 clamp(30px, 7vw, 40px)/1.1 var(--font-display);
  letter-spacing: -0.015em;
}
h2.h-small { font-size: 28px; line-height: 34px; letter-spacing: -0.01em; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.label, .eyebrow {
  font: 500 13px/20px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow { color: var(--accent-text); }
.lead { font-size: 18px; line-height: 30px; color: var(--muted); }
.small { font-size: 14px; line-height: 22px; color: var(--muted); }
.title { font: 500 20px/28px var(--font-display); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags-wide { gap: 12px; }
.tag {
  font: 400 14px/26px var(--font-mono);
  background: var(--psoft);
  color: var(--on-psoft);
  border-radius: 4px;
  padding: 2px 8px;
}
.entry .tag { align-self: flex-start; font-size: 13px; }
.tag-accent { background: var(--asoft); color: var(--accent-text); }

.actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { color: var(--on-primary); filter: brightness(1.1); }
.btn-outline { border: 1px solid var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-text { padding: 0 4px; }

/* ------------------------------------------------------------------ nav */

.site-header { border-bottom: 1px solid var(--line); }
.nav {
  padding-top: 16px;
  padding-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font: 600 20px/28px var(--font-display);
  color: var(--ink);
  text-decoration: none;
}
.nav-right { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font: 500 13px/20px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-links a { padding: 12px 10px; text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }
.nav-links a.is-primary { color: var(--primary); }
.nav-controls { display: flex; gap: 12px; align-items: center; }

.lang-switch {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.lang-switch button {
  min-width: 44px;
  min-height: 40px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font: 500 13px/20px var(--font-mono);
  background: transparent;
  color: var(--muted);
}
.lang-switch button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.theme-toggle {
  min-height: 44px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.toggle-track {
  position: relative;
  display: block;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--psoft);
  border: 1px solid var(--line-strong);
}
.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  transition: transform 0.2s;
}
.t-dark .toggle-knob { transform: translateX(20px); }

/* ----------------------------------------------------------------- hero */

.hero {
  padding-top: 96px;
  padding-bottom: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: flex-end;
}
.hero-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero-main .lead { max-width: 620px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-card { flex: 1 1 280px; gap: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 4px 14px;
  font: 500 13px/20px var(--font-mono);
  letter-spacing: 0.04em;
}
.badge-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--on-accent); }

/* ------------------------------------------------------------- sections */

.section { padding-top: 64px; padding-bottom: 64px; }
.section-about { padding-top: 96px; display: flex; flex-direction: column; gap: 32px; }
.section-more { padding-bottom: 96px; display: flex; flex-direction: column; gap: 32px; }

.section-head { display: flex; flex-direction: column; gap: 16px; }
.section-head.narrow { max-width: 720px; }
.section-head-row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
}
.head-text { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------- projects */

.slider-controls { display: flex; gap: 12px; align-items: center; }
.count { font: 400 13px/20px var(--font-mono); color: var(--muted); }
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn-primary { border: none; background: var(--primary); color: var(--on-primary); }

.track {
  display: flex;
  gap: 32px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }

.project {
  flex: 0 0 min(360px, 82vw);
  scroll-snap-align: start;
  padding: 0;
  overflow: hidden;
}
.project-cover {
  height: 190px;
  background: var(--psoft);
  color: var(--on-psoft);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font: 500 28px/34px var(--font-display);
  text-align: center;
  overflow-wrap: anywhere;
}
.project-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; flex-grow: 1; }
.project-body p { color: var(--muted); flex-grow: 1; }
.project-link {
  margin-top: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  text-decoration: none;
}

/* ------------------------------------------------- neural network band */

.nn { background: var(--deep); color: var(--on-deep); }
.nn-inner {
  padding-top: 96px;
  padding-bottom: 96px;
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: center;
}
.nn-text { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.nn .eyebrow { color: #23cbb4; }
.nn .lead { color: inherit; }
.nn .tag { background: #12111c; color: #23cbb4; }
.nn .btn-primary { background: #23cbb4; color: #12111c; }
.nn .btn-text { color: #23cbb4; }
.nn .btn-text:hover { color: #edecf4; }

.demo {
  flex: 999 1 600px;
  min-width: 0;
  background: #12111c;
  color: #edecf4;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.demo .label, .demo-caption { color: #a09eb4; }
.demo-caption { font: 400 13px/20px var(--font-mono); }
.demo-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo-clear {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #6a6882;
  background: transparent;
  color: #edecf4;
  font: 400 14px/22px var(--font-mono);
  cursor: pointer;
}
.demo-clear:hover { border-color: #edecf4; }
.demo-body { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.demo-pad { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }

#demo-canvas {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 8px;
  border: 1px solid #6a6882;
  background-color: #1b1a28;
  background-image: linear-gradient(#2e2c40 1px, transparent 1px), linear-gradient(90deg, #2e2c40 1px, transparent 1px);
  background-size: 25px 25px;
  cursor: crosshair;
  touch-action: none; /* drawing must not scroll the page */
}

.demo-layers {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.demo-layer { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.demo-layer .demo-caption { font-size: 12px; text-align: center; }
.demo-dots {
  flex-grow: 1;
  display: grid;
  grid-auto-flow: column;
  align-content: center;
  gap: 4px;
}
.demo-dots span { display: block; width: 8px; height: 8px; border-radius: 999px; background: #2e2c40; }
.demo-dots.is-large { gap: 6px; }
.demo-dots.is-large span { width: 12px; height: 12px; }
.demo-seen-wrap { flex-grow: 1; display: flex; align-items: center; }
#demo-seen {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 4px;
  border: 1px solid #2e2c40;
  background: #1b1a28;
  image-rendering: pixelated;
}

.demo-out { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.demo-bars { display: flex; flex-direction: column; gap: 6px; }
.demo-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 13px/16px var(--font-mono);
}
.demo-bar > span:first-child { width: 12px; color: #a09eb4; }
.demo-bar-track { flex-grow: 1; height: 10px; background: #1b1a28; border-radius: 4px; overflow: hidden; }
.demo-bar-fill { height: 10px; width: 0; border-radius: 4px; background: #23cbb4; transition: width 0.15s; }
.demo-bar.is-top .demo-bar-fill { background: #ef663e; }
.demo-guess { margin-top: 8px; display: flex; align-items: baseline; gap: 8px; }
.demo-digit { font: 600 40px/44px var(--font-display); color: #ef663e; }
.demo-digit.is-empty { color: #6a6882; }
.demo-error { font-size: 14px; line-height: 22px; color: #a09eb4; }

/* ------------------------------------------------------ work and school */

.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 32px; }
.timeline-col { display: flex; flex-direction: column; gap: 16px; }
.entry { gap: 4px; }
.entry .when { color: var(--primary); }
.entry-next { background: transparent; border: 1px dashed var(--line-strong); }
.entry-next .when { color: var(--accent-text); }

.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 24px; }
.more-grid .entry { gap: 8px; }

/* --------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  padding-top: 64px;
  padding-bottom: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
  justify-content: space-between;
}
.footer-inner .head-text { gap: 12px; }
.footer-inner .actions { margin-top: 0; }

@media (max-width: 640px) {
  .hero { padding-top: 56px; }
  .nn-inner { padding-top: 64px; padding-bottom: 64px; }
  .demo { padding: 16px; }
  .demo-pad { margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body, .toggle-knob, .demo-bar-fill { transition: none; }
}
