/* ---------- Tokens ---------- */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #16161a;
  --muted: #62626b;
  --line: #e4e2dc;
  --accent: #3b3bf5;
  --accent-soft: #e6e6ff;
  --accent-text: #ffffff;
  --glow: rgba(59, 59, 245, 0.16);

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-head: "Inter Tight", "Inter", system-ui, sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, serif;

  --radius: 16px;
  --max: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e12;
    --surface: #17171d;
    --text: #f2f1ec;
    --muted: #9a9aa5;
    --line: #26262e;
    --accent: #8b8bff;
    --accent-soft: #23234a;
    --accent-text: #0e0e12;
    --glow: rgba(139, 139, 255, 0.18);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e12;
  --surface: #17171d;
  --text: #f2f1ec;
  --muted: #9a9aa5;
  --line: #26262e;
  --accent: #8b8bff;
  --accent-soft: #23234a;
  --accent-text: #0e0e12;
  --glow: rgba(139, 139, 255, 0.18);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
em { font-family: var(--font-serif); font-style: italic; font-weight: 600; letter-spacing: -0.02em; color: var(--accent); }
::selection { background: var(--accent); color: var(--accent-text); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo { font: 700 20px var(--font-head); text-decoration: none; letter-spacing: -0.03em; }
.logo .dot { color: var(--accent); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 15px; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; transition: transform .2s;
}
.icon-btn:hover { transform: rotate(15deg); }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font: 500 15px var(--font-body); text-decoration: none;
  border: 1px solid var(--text); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--glow); }
.btn svg { transition: transform .2s; }
.btn:hover svg { transform: translateX(3px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); }
.btn-small { padding: 8px 16px; font-size: 14px; }

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100svh - 68px - 76px);
  display: flex; flex-direction: column; justify-content: center;
  padding-block: 64px;
}
.hero-kicker {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 0;
}
.hero-kicker::before { content: ""; width: 40px; height: 3px; background: var(--accent); }
.hero-name {
  font: 700 clamp(24px, 3.2vw, 36px)/1.1 var(--font-head);
  letter-spacing: -0.02em; color: var(--text);
}
.hero-creds { font-size: 0.6em; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.hero-title {
  font-size: clamp(40px, 7vw, 88px);
  font-weight: 600; letter-spacing: -0.045em; line-height: 1.04;
  margin: 24px 0 28px;
}
.hero-title em { font-size: 0.96em; }
.hero-sub { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 560px; margin: 0 0 40px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Marquee ---------- */
.marquee {
  border-block: 1px solid var(--line); overflow: hidden; padding: 18px 0;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex; gap: 32px; width: max-content;
  font: 500 clamp(22px, 3vw, 32px) var(--font-head); letter-spacing: -0.02em;
  animation: scroll 40s linear infinite;
}
.marquee-track span:nth-child(even) { color: var(--accent); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding-block: clamp(80px, 12vw, 140px); }
.section-head { margin-bottom: 56px; }
.eyebrow { display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.section h2 { font-size: clamp(32px, 4.6vw, 52px); font-weight: 600; letter-spacing: -0.035em; }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(240px, 360px) 1fr; gap: 64px; align-items: center; }
.portrait { margin: 0; }
.portrait img {
  width: 100%; height: auto; aspect-ratio: 940 / 1088; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .35);
}
.about-copy p { color: var(--muted); margin: 0 0 18px; }
.about-copy .lead { font: 500 clamp(22px, 2.6vw, 28px)/1.35 var(--font-head); color: var(--text); letter-spacing: -0.02em; }
.skills {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 32px; margin-top: 56px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px;
}
.skills h3 { grid-column: 1 / -1; }
.skills h3 { font-size: 18px; margin: 0; }
.skill-label { font-size: 13px; color: var(--muted); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 8px 0 0; }
.chips li {
  font-size: 14px; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text);
  transition: transform .2s;
}
.chips li:hover { transform: translateY(-2px); }

/* Experience */
.timeline { list-style: none; padding: 0; margin: 0; }
.job {
  display: grid; grid-template-columns: 180px 1fr; gap: 32px;
  padding: 32px 0; border-top: 1px solid var(--line);
  transition: padding-left .3s ease;
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job:hover { padding-left: 12px; }
.job-when { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; padding-top: 4px; }
.job h3 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 600; margin-bottom: 10px; }
.job .at { color: var(--muted); font-weight: 500; }
.job p { color: var(--muted); margin: 0; max-width: 640px; }

/* Highlights */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px 28px; position: relative; overflow: hidden;
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), var(--glow), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 16px 40px var(--glow); }
.card:hover::after { opacity: 1; }
.stat { display: block; font: italic 600 56px/1 var(--font-serif); color: var(--accent); margin-bottom: 24px; }
.card h3 { font-size: 20px; margin-bottom: 10px; }
.card p { color: var(--muted); margin: 0; font-size: 16px; }

/* Contact */
.contact { text-align: center; }
.contact-title { font-size: clamp(38px, 6.4vw, 80px) !important; max-width: 900px; margin: 0 auto 20px; }
.contact > p { color: var(--muted); font-size: 18px; margin: 0 0 40px; }
.contact-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; }
.email {
  font: 500 clamp(20px, 3vw, 30px) var(--font-head); text-decoration: none; letter-spacing: -0.02em;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  transition: background-size .35s ease; padding-bottom: 2px; word-break: break-all;
}
.email:hover { background-size: 100% 2px; }
.socials { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 28px; padding: 0; margin: 40px 0 0; }
.socials a { text-decoration: none; color: var(--muted); transition: color .2s; }
.socials a:hover { color: var(--accent); }

/* Footer */
.footer {
  display: flex; justify-content: space-between; gap: 16px;
  padding-block: 32px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

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

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .portrait { max-width: 320px; }
  .skills { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
  .job { grid-template-columns: 1fr; gap: 8px; }
  .br-lg { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .skills { grid-template-columns: 1fr; padding: 24px; }
  .footer { flex-direction: column; }
}
