/* Tokens: light by default, dark via OS preference or manual toggle */
:root {
  --bg: #f6f8fb; --tint: #eaf0f6; --card: #ffffff;
  --text: #0f1b2d; --muted: #4a5a70; --line: #d5dde8;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #d9f1ee;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --max: 1120px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1624; --tint: #121d2f; --card: #16233a;
  --text: #e8eef7; --muted: #9db0c8; --line: #25354f;
  --accent: #4fd1c1; --accent-ink: #062521; --accent-soft: #123a3a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1624; --tint: #121d2f; --card: #16233a;
    --text: #e8eef7; --muted: #9db0c8; --line: #25354f;
    --accent: #4fd1c1; --accent-ink: #062521; --accent-soft: #123a3a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { background: var(--bg); color: var(--text); font: 17px/1.65 var(--body); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(var(--max), calc(100% - 48px)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 300; padding: 10px 14px; background: var(--accent); color: var(--accent-ink); border-radius: 8px; }
.skip:focus { left: 12px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -.02em; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.4rem); font-weight: 800; max-width: 15em; text-wrap: balance; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-weight: 700; margin-bottom: 20px; text-wrap: balance; }
h3 { font-size: 1.12rem; font-weight: 700; }
.sub { color: var(--muted); max-width: 60ch; margin-bottom: 28px; }

/* Header */
.topbar { position: fixed; inset: 0 0 auto; z-index: 100; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-color: var(--line); }
.nav { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { font: 700 1.05rem var(--display); }
.nav-links { display: flex; gap: 26px; }
.nav-links a { font-size: .92rem; color: var(--muted); padding: 6px 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); border-color: var(--accent); }
.nav-tools { display: flex; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--accent); }
.menu-btn { display: none; }

/* Hero */
.hero { padding: 132px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 64px; align-items: center; }
.status { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 6px 14px; border-radius: 99px; background: var(--accent-soft); color: var(--text); font-size: .88rem; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.lead { max-width: 56ch; margin-top: 22px; color: var(--muted); font-size: 1.12rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn { display: inline-flex; align-items: center; min-height: 46px; padding: 0 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 600; font-size: .95rem; transition: border-color .2s, transform .2s; }
.btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.portrait { max-width: 400px; justify-self: end; width: 100%; }
.hero-photo { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center top; border-radius: 28px 28px 28px 6px; border: 1px solid var(--line); background: var(--tint); }
.photo-fallback { display: grid; place-items: center; aspect-ratio: 4 / 5; border-radius: 28px 28px 28px 6px; background: var(--accent); color: var(--accent-ink); font: 800 5rem var(--display); }
.portrait figcaption { display: grid; margin-top: 14px; font-size: .92rem; color: var(--muted); }
.portrait figcaption strong { color: var(--text); font-family: var(--display); font-size: 1.05rem; }

/* One orchestrated load moment: hero only */
@media (prefers-reduced-motion: no-preference) {
  .hero-text > *, .portrait { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
  .hero-text > :nth-child(2) { animation-delay: .08s; }
  .hero-text > :nth-child(3) { animation-delay: .16s; }
  .hero-text > :nth-child(4) { animation-delay: .24s; }
  .portrait { animation-delay: .2s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 56px; border-top: 1px solid var(--line); }
.facts div { padding: 20px 20px 0 0; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { font: 700 1.05rem var(--display); margin-top: 2px; }

/* Sections */
.section { padding: 96px 0; }
.tint { background: var(--tint); }
.split { display: grid; grid-template-columns: .8fr 1.2fr; gap: 64px; align-items: start; }
.prose p { margin-bottom: 16px; color: var(--muted); max-width: 64ch; }
.prose strong { color: var(--text); }
.prose h3 { margin: 26px 0 6px; }
.values { margin-top: 24px; display: grid; gap: 14px; }
.values li { padding-left: 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.values strong { color: var(--text); }
.checks { display: grid; gap: 8px; margin-top: 10px; }
.checks li { position: relative; padding-left: 26px; color: var(--muted); }
.checks li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 6px; height: 11px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 40px; margin-top: 30px; }
.skills h3 { margin-bottom: 6px; color: var(--accent); }
.skills p { color: var(--muted); font-size: .96rem; }

/* Timeline (a true sequence) */
.timeline { position: relative; margin-top: 30px; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.job { position: relative; padding-bottom: 38px; }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: -28px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.job.current::before { background: var(--accent); }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px; }
.job-head time { color: var(--muted); font-size: .9rem; }
.company { color: var(--accent); font-weight: 600; font-size: .95rem; margin: 2px 0 10px; }
.job ul { display: grid; gap: 6px; max-width: 72ch; color: var(--muted); font-size: .97rem; }
.job li { position: relative; padding-left: 18px; }
.job li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 6px; height: 2px; background: var(--accent); }
.note { margin-top: 10px; font-size: .88rem; color: var(--muted); font-style: italic; }

/* Projects as ruled rows, not a card grid */
.projects { border-top: 1px solid var(--line); }
.projects li { display: grid; grid-template-columns: 1fr 1.3fr .9fr; gap: 12px 32px; padding: 26px 0; border-bottom: 1px solid var(--line); align-items: start; }
.kind { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.projects li > p { color: var(--muted); font-size: .96rem; }
.stack { font-size: .9rem; color: var(--text) !important; font-weight: 500; }

.contact { border-top: 1px solid var(--line); }
.contact h2 { max-width: 16em; }
footer { padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 900px) {
  .hero-grid, .split { grid-template-columns: 1fr; gap: 40px; }
  .portrait { justify-self: start; max-width: 320px; }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .projects li { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { width: calc(100% - 36px); }
  .menu-btn { display: grid; }
  .nav-links { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0; padding: 8px 18px 16px; background: var(--bg); border-bottom: 1px solid var(--line); display: none; }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px 0; }
  .hero { padding-top: 108px; }
  .section { padding: 68px 0; }
  .skills { grid-template-columns: 1fr; }
  .actions .btn { flex: 1 1 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print { .topbar, .skip, .actions, .nav-tools { display: none; } body { background: #fff; color: #000; } .section { padding: 24px 0; } }