/* Self-hosted variable fonts (latin subset, SIL Open Font License) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f8f9;
  --surface: #ffffff;
  --text: #0f1a1f;
  --muted: #4b5a63;
  --border: #e2e8eb;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --accent-soft: #e6f4f2;
  --on-accent: #ffffff;
  --danger: #c81e1e;
  --shadow: 0 1px 2px rgb(15 26 31 / 0.04), 0 8px 24px rgb(15 26 31 / 0.06);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --container: 1120px;
  --header-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1215;
  --bg-alt: #0f181c;
  --surface: #121d22;
  --text: #e6edf3;
  --muted: #9aaab4;
  --border: #22313a;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: rgb(45 212 191 / 0.12);
  --on-accent: #04201d;
  --danger: #f87171;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1215;
    --bg-alt: #0f181c;
    --surface: #121d22;
    --text: #e6edf3;
    --muted: #9aaab4;
    --border: #22313a;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: rgb(45 212 191 / 0.12);
    --on-accent: #04201d;
  --danger: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

/* ==========================================================================
   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-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

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

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon .fill, symbol .fill { fill: currentColor; stroke: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px; top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { top: 12px; color: var(--on-accent); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}
.narrow { max-width: 820px; }
.center { text-align: center; margin-top: 40px; }

/* ==========================================================================
   Buttons, badges, tags
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgb(34 197 94 / 0.2);
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
}
:root[data-theme="dark"] .tag { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag { color: var(--accent); } }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.nav-links {
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0;
  display: none;
  flex-direction: column;
  padding: 8px 20px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.nav-links.open { display: flex; }
.nav-links a {
  display: block;
  padding: 12px 4px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active { color: var(--accent); }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .nav-links {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding: 0;
    background: none;
    border: 0;
  }
  .nav-links a { padding: 8px 12px; font-size: 0.95rem; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  display: grid;
  gap: 40px;
  align-items: center;
  padding-block: 56px 72px;
}
.hero h1 {
  margin-top: 20px;
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}
.hero-role {
  margin-top: 6px;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--accent);
}
.hero-lede {
  margin-top: 18px;
  max-width: 34em;
  font-size: 1.1rem;
  color: var(--muted);
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.cv-link { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; min-height: 46px; font-weight: 600; font-size: 0.95rem; }
.cv-link[hidden], .cv-btn[hidden] { display: none; }

.proof { display: grid; gap: 16px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border); }
.proof li { display: grid; gap: 2px; }
.proof strong { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.2; }
.proof span { font-size: 0.88rem; color: var(--muted); line-height: 1.45; }
@media (min-width: 560px) { .proof { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

.hero-card {
  margin: 0;
  padding: 8px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
}
.hero-card div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.hero-card div:last-child { border-bottom: 0; }
.hero-card dt { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); padding-top: 2px; }
.hero-card dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.4fr 1fr; padding-block: 96px 112px; gap: 64px; }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding-block: 80px; }
.section.alt { background: var(--bg-alt); }
.section h2 { font-size: clamp(1.75rem, 4vw, 2.25rem); margin-bottom: 36px; }
.sub-title { font-size: 1.2rem; margin: 48px 0 20px; }

.about-text { font-size: 1.1rem; color: var(--muted); max-width: 42em; }
.about-text strong { color: var(--text); font-weight: 600; }
#about h2 { margin-bottom: 20px; }

.grid { display: grid; gap: 20px; }
@media (min-width: 640px) { .cards-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.95rem; }

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.card-icon .icon { width: 22px; height: 22px; }

/* Stack */
.stack { display: grid; gap: 24px; }
.stack-group { display: grid; gap: 10px; }
.stack-group h3 { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
.stack-items { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 500;
}
@media (min-width: 820px) {
  .stack-group { grid-template-columns: 160px 1fr; align-items: baseline; }
}

/* Timeline */
.timeline { position: relative; display: grid; gap: 8px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
}
.timeline li { position: relative; padding: 0 0 24px 36px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px solid var(--accent);
}
.timeline li.current::before { background: var(--accent); }
.tl-date { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.timeline h3 { font-size: 1.08rem; margin-top: 2px; }
.tl-org { color: var(--accent); font-weight: 500; }
.timeline ul { margin-top: 8px; display: grid; gap: 4px; }
.timeline ul li { padding: 0 0 0 16px; color: var(--muted); font-size: 0.95rem; }
.timeline ul li::before {
  width: 5px; height: 5px;
  top: 0.65em;
  border: 0;
  background: var(--muted);
}

.edu { display: grid; gap: 12px; }
@media (min-width: 640px) { .edu { grid-template-columns: 1fr 1fr; } }
.edu li { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.edu strong { display: block; }
.languages { margin-top: 16px; color: var(--muted); font-size: 0.95rem; }
.languages span { font-family: var(--mono); font-size: 0.78rem; margin-right: 6px; }
.edu span { color: var(--muted); font-size: 0.92rem; }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 28px; }
.filter-btn {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.filter-btn:hover { color: var(--text); border-color: var(--accent); }
.filter-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.project { padding: 0; overflow: hidden; }
.card[hidden] { display: none; }
.project-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.project-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.4s ease; }
.project:hover .project-media img { transform: scale(1.03); }
.project-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 23px, var(--border) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--border) 23px 24px);
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--accent);
}
.project-body { display: flex; flex-direction: column; gap: 12px; flex: 1; padding: 22px 24px 24px; }
.project-body h3 { margin: 0; }
.pbr { display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
.pbr dt { font-family: var(--mono); font-size: 0.72rem; color: var(--text); text-transform: uppercase; letter-spacing: 0.06em; }
.pbr dd { margin: 0 0 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: auto; padding-top: 4px; font-size: 0.92rem; font-weight: 500; }
.project-links a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.project-links a:hover { text-decoration: underline; }
.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.soon { border-style: dashed; background: transparent; }
.soon .card-icon { background: transparent; border: 1px dashed var(--border); color: var(--muted); }
.soon-label { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

/* GitHub */
.repo { gap: 10px; text-decoration: none; color: inherit; }
.repo:hover { color: inherit; }
.repo h3 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--accent); font-size: 1rem; overflow-wrap: anywhere; }
.repo p { flex: 1; }
.repo-meta { display: flex; gap: 16px; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.repo-meta span { display: inline-flex; align-items: center; gap: 5px; }
.repo-meta .icon { width: 14px; height: 14px; }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Testimonials */
.quote { justify-content: space-between; gap: 20px; margin: 0; }
.quote blockquote { margin: 0; font-size: 1rem; color: var(--text); line-height: 1.7; }
.quote blockquote::before {
  content: "\201C";
  display: block;
  height: 0.6em;
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
  font-family: Georgia, serif;
}
.quote figcaption { border-top: 1px solid var(--border); padding-top: 16px; font-size: 0.9rem; }
.quote figcaption strong { display: block; }
.quote figcaption .who { color: var(--muted); }
.quote .tag { margin-top: 10px; }

/* Contact */
.contact { display: grid; gap: 48px; }
@media (min-width: 900px) { .contact { grid-template-columns: 1fr 1fr; gap: 64px; } }
.contact-info h2 { margin-bottom: 16px; }
.contact-info > p { color: var(--muted); max-width: 32em; }
.contact-list { display: grid; gap: 14px; margin: 28px 0; }
.contact-list li { display: flex; align-items: center; gap: 12px; }
.contact-list .icon { color: var(--accent); }
.contact-list a { color: var(--text); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.contact-list a:hover { color: var(--accent); text-decoration: underline; }

.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.cv-btn { margin-top: 24px; }

.contact-form {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.field { display: grid; gap: 6px; }
.field label { font-size: 0.9rem; font-weight: 600; }
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field [aria-invalid="true"] { border-color: var(--danger); }
.form-status { min-height: 1.5em; font-size: 0.92rem; color: var(--muted); }
.form-status.ok { color: var(--accent); }
.form-status.err { color: var(--danger); }

/* Footer */
.site-footer { padding-block: 32px; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 0.92rem; }
.footer-brand { font-weight: 700; color: var(--text); }

.noscript { padding: 16px 20px; text-align: center; }

/* ==========================================================================
   Motion
   ========================================================================== */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

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