/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #08080a;
  --bg-elev: #131316;
  --bg-elev-2: #1c1c20;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f7;
  --text-dim: #a1a1a8;
  --text-faint: #6e6e76;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.14);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 40px rgba(0,0,0,.5);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --bg-elev-2: #f2f2f5;
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.18);
  --text: #12121a;
  --text-dim: #55555e;
  --text-faint: #86868b;
  --accent: #0060df;
  --accent-soft: rgba(0, 96, 223, 0.10);
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 40px rgba(0,0,0,.08);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #fbfbfd;
    --bg-elev: #ffffff;
    --bg-elev-2: #f2f2f5;
    --border: rgba(0, 0, 0, 0.10);
    --border-strong: rgba(0, 0, 0, 0.18);
    --text: #12121a;
    --text-dim: #55555e;
    --text-faint: #86868b;
    --accent: #0060df;
    --accent-soft: rgba(0, 96, 223, 0.10);
    --shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 40px rgba(0,0,0,.08);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -0.022em; font-weight: 600; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.2rem; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.section { padding-block: clamp(36px, 5vw, 64px); }
.eyebrow {
  font-size: .78rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px;
}
.lead { font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--text-dim); max-width: 62ch; }
.muted { color: var(--text-dim); }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--accent);
  color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 8px; height: 60px; }
.nav__brand {
  font-weight: 600; color: var(--text); letter-spacing: -.02em;
  margin-right: auto; display: flex; align-items: center; gap: 10px;
}
.nav__brand:hover { text-decoration: none; opacity: .8; }
.nav__brand img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.nav__links { display: flex; gap: 4px; align-items: center; }
.nav__links a {
  color: var(--text-dim); font-size: .93rem; padding: 7px 12px;
  border-radius: 8px; white-space: nowrap;
}
.nav__links a:hover { color: var(--text); background: var(--bg-elev-2); text-decoration: none; }
.nav__links a[aria-current="page"] { color: var(--text); }

.theme-toggle {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  background: transparent; border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-dim); cursor: pointer; padding: 0; margin-left: 4px;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
  html:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 660px) {
  .nav__links a { padding: 7px 8px; font-size: .87rem; }
  .nav__links a.is-optional { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; font-size: .95rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--bg-elev-2); }
.btn svg { width: 17px; height: 17px; flex: none; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(48px, 7vw, 80px) clamp(28px, 4vw, 48px); position: relative; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto; height: 460px; z-index: -1;
  background: radial-gradient(60% 60% at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(28px, 5vw, 56px); align-items: start;
}
.hero__photo {
  width: 200px; height: 200px; flex: none;
  align-self: start; justify-self: end;
  border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero h1 { margin-bottom: 18px; }
.hero__role { color: var(--accent); font-weight: 600; margin-bottom: 8px; letter-spacing: -.01em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
@media (max-width: 720px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__photo { width: 120px; height: 120px; justify-self: start; }
}

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--bg-elev); padding: 22px 18px; }
.stat__value { font-size: clamp(1.5rem, 3.2vw, 2rem); font-weight: 600; letter-spacing: -.03em; }
.stat__label { font-size: .82rem; color: var(--text-faint); margin-top: 2px; }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- app grid ---------- */
.app-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px;
}
.app-card {
  display: flex; gap: 16px; align-items: flex-start; padding: 18px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); color: inherit;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.app-card:hover {
  text-decoration: none; transform: translateY(-3px);
  border-color: var(--border-strong); background: var(--bg-elev-2);
}
.app-card__icon {
  width: 60px; height: 60px; flex: none; border-radius: 14px;
  border: 1px solid var(--border); object-fit: cover;
}
.app-card__body { min-width: 0; display: block; }
.app-card__name {
  font-weight: 600; letter-spacing: -.015em; display: flex;
  align-items: center; gap: 8px; flex-wrap: wrap;
}
.app-card__tag { display: block; font-size: .88rem; color: var(--text-dim); margin-top: 3px; }
.app-card__meta {
  font-size: .78rem; color: var(--text-faint); margin-top: 9px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}

.badge {
  font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.badge--neutral {
  background: var(--bg-elev-2); color: var(--text-faint); border-color: var(--border);
}

/* ---------- timeline ---------- */
.timeline { display: grid; gap: 0; }
.job {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px;
  padding-block: 30px; border-top: 1px solid var(--border);
}
.job:first-child { border-top: 0; padding-top: 0; }
.job__period { font-size: .86rem; color: var(--text-faint); padding-top: 4px; }
.job__title { font-size: 1.18rem; font-weight: 600; letter-spacing: -.02em; }
.job__company { color: var(--text-dim); font-size: .95rem; margin-bottom: 12px; }
.job ul { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: .96rem; }
.job li { margin-block: 5px; }
.job li::marker { color: var(--text-faint); }
@media (max-width: 700px) {
  .job { grid-template-columns: 1fr; gap: 10px; }
  .job__period { padding-top: 0; }
}

/* ---------- generic cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.card h3 { margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: .84rem; color: var(--text-dim); padding: 6px 12px;
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 999px;
}

.skill-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding-block: 18px; }
.skill-row + .skill-row { border-top: 1px solid var(--border); }
.skill-row__label { font-weight: 600; font-size: .95rem; }
@media (max-width: 620px) { .skill-row { grid-template-columns: 1fr; gap: 10px; } }

/* ---------- project page ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); font-size: .9rem; margin-bottom: 28px;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.project-hero { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.project-hero__icon {
  width: 96px; height: 96px; border-radius: 22px; flex: none;
  border: 1px solid var(--border); box-shadow: var(--shadow); object-fit: cover;
}
.project-hero__body { flex: 1 1 320px; min-width: 0; }
.project-hero h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); margin-bottom: 10px; }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-top: 36px;
}
.fact { background: var(--bg-elev); padding: 16px 18px; }
.fact__label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-faint); margin-bottom: 4px;
}
.fact__value { font-weight: 500; font-size: .96rem; }

.shot {
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-elev); padding: 8px; box-shadow: var(--shadow);
}
.prose p + p { margin-top: 16px; }
.prose { color: var(--text-dim); max-width: 68ch; }
.bullets { padding-left: 20px; color: var(--text-dim); }
.bullets li { margin-block: 8px; }
.bullets li::marker { color: var(--accent); }

.project-nav {
  display: flex; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding-top: 28px; border-top: 1px solid var(--border);
}
.project-nav a { font-size: .95rem; color: var(--text-dim); }
.project-nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- contact form ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 40px; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label { font-size: .9rem; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .error { font-size: .82rem; color: #ff6b6b; min-height: 0; }
.field .error:empty { display: none; }
.form-note { font-size: .85rem; color: var(--text-faint); margin-top: 14px; }

.contact-links { display: grid; gap: 10px; }
.contact-link {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.contact-link:hover { text-decoration: none; border-color: var(--border-strong); background: var(--bg-elev-2); }
.contact-link svg { width: 20px; height: 20px; flex: none; color: var(--text-dim); }
.contact-link small { display: block; color: var(--text-faint); font-size: .8rem; }

/* ---------- floating contact button ---------- */
.fab {
  position: fixed; z-index: 60;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 20px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: .93rem; font-weight: 600; line-height: 1;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.fab:hover {
  text-decoration: none; transform: translateY(-2px);
  background: color-mix(in srgb, var(--text) 88%, var(--bg));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .28);
}
.fab:active { transform: translateY(0); }
.fab svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 480px) {
  .fab { padding: 15px; }
  .fab span { display: none; }
  .fab svg { width: 20px; height: 20px; }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); padding-block: 40px;
  color: var(--text-faint); font-size: .88rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--text-dim); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
