:root { color-scheme: only light; }
html, body { background-color: #faf8f3; forced-color-adjust: none; }
/* ===== Design tokens ===== */
:root {
  --bg: #faf9f6;
  --bg-alt: #f3f2ee;
  --surface: #ffffff;
  --text: #1c1c1f;
  --text-muted: #55555c;
  --border: #e4e2dc;
  --accent: #2f4bd8;
  --accent-hover: #2339b0;
  --accent-soft: #eaedfc;
  --success: #17703f;
  --error: #b42318;

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

  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 4.5rem;
  --radius-sm: 6px; --radius: 8px; --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(28,28,31,.05);
  --shadow: 0 8px 24px -12px rgba(28,28,31,.18);
  --nav-h: 64px;
  --t: 180ms ease;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.65 var(--font-body); overflow-x: hidden; }
body.menu-open { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: 0; }
p { margin: 0 0 var(--s-4); }
a { color: inherit; }
img, svg { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--surface); padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--s-4); }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; margin: 0; }
.mono { font-family: var(--font-mono); font-size: .8125rem; color: var(--text-muted); margin: 0; }
.accent { color: var(--accent); }
.accent-text { color: var(--accent); font-weight: 500; margin: var(--s-1) 0 0; }
.text-link { color: var(--accent); font-weight: 500; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-5); border-radius: 999px; border: 1px solid transparent; font: 500 .9375rem var(--font-body); text-decoration: none; cursor: pointer; transition: background var(--t), border-color var(--t), color var(--t), transform var(--t); }
.btn--primary { background: var(--text); color: var(--surface); }
.btn--primary:hover { background: var(--accent); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--text); }
.btn--sm { min-height: 38px; padding: 0 var(--s-4); font-size: .875rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }

/* ===== Badges ===== */
.badges { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.badge { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font: 500 .8125rem var(--font-body); color: var(--text); }
.badge--sm { font-size: .75rem; padding: 2px 9px; background: var(--bg); }
.badge--accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ===== Nav ===== */
.nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); background: var(--bg); border-bottom: 1px solid var(--border); }
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav__logo { font: 700 1.125rem var(--font-display); text-decoration: none; letter-spacing: 0; }
.dot { color: var(--accent); }
.nav__toggle { width: 44px; height: 44px; display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.nav__toggle span { width: 18px; height: 2px; background: var(--text); transition: transform var(--t), opacity var(--t); }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav__menu { position: fixed; inset: var(--nav-h) 0 0 0; background: var(--bg); padding: var(--s-5) var(--s-4); display: none; flex-direction: column; gap: var(--s-5); overflow-y: auto; }
.nav__menu.is-open { display: flex; }
.nav__menu ul { display: flex; flex-direction: column; }
.nav__menu ul a { display: block; padding: var(--s-3) 0; font: 500 1.125rem var(--font-display); text-decoration: none; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.nav__menu ul a.is-active, .nav__menu ul a:hover { color: var(--text); }

/* ===== Sections ===== */
.section { padding: var(--s-8) 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section__title { font-size: 2rem; margin-bottom: var(--s-6); }
.sub-title { font-size: 1.125rem; margin-bottom: var(--s-4); }
.eyebrow { font: 500 .8125rem var(--font-mono); color: var(--text-muted); margin-bottom: var(--s-4); }
.lead { font-size: 1.0625rem; color: var(--text-muted); }

/* Hero */
.hero { padding-top: var(--s-7); }
.hero__grid { display: grid; gap: var(--s-6); align-items: center; }
.hero__title { font-size: 2.25rem; margin-bottom: var(--s-3); }
.hero__text { color: var(--text-muted); max-width: 58ch; font-size: 1.0625rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: var(--s-6) 0; }
.socials { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: .9375rem; }
.socials a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 2px; word-break: break-all; }
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.hero__visual { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: var(--s-5); box-shadow: var(--shadow-sm); max-width: 440px; width: 100%; justify-self: center; }
.graph__grid line { stroke: var(--border); stroke-dasharray: 2 4; }
.graph__edges line { stroke: var(--text); stroke-opacity: .25; stroke-width: 1.2; }
.graph__nodes circle { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.graph__nodes circle.out { fill: var(--accent); stroke: var(--accent); }
.graph__label { font: 12px var(--font-mono); fill: var(--text-muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-5); box-shadow: var(--shadow-sm); transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
.card__title { font-size: 1.125rem; margin-bottom: var(--s-2); }
.cards { display: grid; gap: var(--s-4); }

/* About */
.about__grid { display: grid; gap: var(--s-6); }
.about__text p { color: var(--text-muted); font-size: 1.0625rem; }
.timeline { border-left: 2px solid var(--border); padding-left: var(--s-5); display: grid; gap: var(--s-5); }
.timeline__item { position: relative; }
.timeline__item::before { content: ""; position: absolute; left: calc(-1 * var(--s-5) - 7px); top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--error); border: 2px solid var(--error); }
.timeline__item.is-current::before { background: var(--success); border-color: var(--success); animation: live-pulse 1.8s ease-in-out infinite; }
.timeline__item h4 { font-size: 1.0625rem; margin: var(--s-2) 0 var(--s-1); }
.timeline__item .muted { margin-bottom: var(--s-1); }

/* Skills */
.skills__grid { display: grid; gap: var(--s-4); }
.skill .card__title { margin-bottom: var(--s-4); }

/* Projects */
.projects__grid { display: grid; gap: var(--s-5); }
.project { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.project:hover { border-color: var(--text); box-shadow: var(--shadow); transform: translateY(-2px); }
.project__thumb { position: relative; height: 150px; display: grid; place-items: center; background: var(--bg-alt) radial-gradient(var(--border) 1px, transparent 1px) 0 0 / 16px 16px; border-bottom: 1px solid var(--border); }
.project__thumb svg { width: 72px; height: 72px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.project__tag { position: absolute; top: var(--s-3); left: var(--s-3); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: .75rem; }
.project__body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); flex: 1; }
.project__body .muted { margin: 0; }
.project__actions { margin-top: auto; padding-top: var(--s-3); display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* Experience */
.exp__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-3); }
.exp .muted { margin-bottom: var(--s-4); }
.cert .muted { margin-bottom: var(--s-2); }

/* Contact */
.contact__grid { display: grid; gap: var(--s-6); }
.contact__list { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.contact__list li { display: grid; gap: 2px; }
.contact__list a { color: var(--text); text-decoration: none; word-break: break-word; }
.contact__list a:hover { color: var(--accent); }
.form { display: grid; gap: var(--s-4); }
.field { display: grid; gap: var(--s-1); }
.field label { font-weight: 500; font-size: .9375rem; }
.field input, .field textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; transition: border-color var(--t), box-shadow var(--t); }
.field textarea { resize: vertical; min-height: 120px; }
.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(--error); }
.field__error { color: var(--error); font-size: .8125rem; margin: 0; min-height: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form__status { margin: 0; font-size: .9375rem; }
.form__status.is-success { color: var(--success); }
.form__status.is-error { color: var(--error); }

/* Footer */
.footer { padding: var(--s-7) 0; border-top: 1px solid var(--border); }
.footer__inner { display: grid; gap: var(--s-4); justify-items: start; }
.footer nav, .footer__social { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.footer a:not(.nav__logo) { color: var(--text-muted); text-decoration: none; font-size: .9375rem; }
.footer a:hover { color: var(--accent); }

/* ===== Breakpoints ===== */
@media (min-width: 640px) {
  .container { padding: 0 var(--s-6); }
  .skills__grid, .cards--3 { grid-template-columns: repeat(2, 1fr); }
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .nav__toggle { display: none; }
  .nav__menu { position: static; display: flex; flex-direction: row; align-items: center; padding: 0; background: none; gap: var(--s-5); overflow: visible; }
  .nav__menu ul { flex-direction: row; gap: var(--s-5); }
  .nav__menu ul a { padding: 0; border: 0; font: 500 .9375rem var(--font-body); position: relative; }
  .nav__menu ul a.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--accent); border-radius: 2px; }
  .hero { padding-top: var(--s-8); }
  .hero__grid { max-width: 820px; }
  .about__grid { grid-template-columns: 1.2fr 1fr; gap: var(--s-8); }
  .cards--3 { grid-template-columns: repeat(3, 1fr); }
  .contact__grid { grid-template-columns: 1fr 1.1fr; gap: var(--s-8); }
  .footer__inner { grid-template-columns: auto 1fr auto; align-items: center; }
  .footer nav { justify-content: center; }
  .footer__inner > p { grid-column: 1 / -1; }
}

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

/* ===== Restyle: grain + refined surfaces ===== */
:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .02' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --radius: 8px; --radius-lg: 8px;
  --shadow-sm: 0 1px 0 rgba(28,28,31,.04), 0 2px 6px -2px rgba(28,28,31,.06);
}
body::before { content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none; background-image: var(--grain); opacity: .13; mix-blend-mode: multiply; }
body::after { content: ""; position: fixed; inset: 0; z-index: 59; pointer-events: none; background-image: var(--grain-soft); opacity: .05; mix-blend-mode: multiply; }
.section--alt { background: color-mix(in srgb, var(--bg-alt) 70%, transparent); border-block: 0; }
.section { position: relative; }
.section__title { font-size: 2rem; letter-spacing: 0; }
.hero { padding-block: 32px 40px; }
.hero__title { font-size: 2.25rem; letter-spacing: 0; line-height: 1.08; max-width: 14ch; }
.eyebrow { display: inline-flex; align-items: center; gap: var(--s-2); padding: 0; border: 0; background: transparent; font-size: .625rem; color: var(--text-muted); margin-bottom: 20px; }
.eyebrow::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: status-pulse 1.8s ease-in-out infinite; }
.card { border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.card:hover { border-color: color-mix(in srgb, var(--text) 35%, var(--border)); }
.skill .card__title, .exp .card__title, .cert .card__title { font-size: 1.1875rem; }
.skill .card__title::before { content: "◆"; color: var(--accent); font-size: .7em; margin-right: var(--s-2); vertical-align: middle; }
.project__thumb { height: 170px; }
.badge { transition: border-color var(--t), color var(--t); }
.badge:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary { box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.btn--primary:hover { transform: translateY(-1px); }
.nav { background: var(--bg); }
.field input, .field textarea { background: var(--surface); }
#contact { padding-bottom: calc(var(--s-8) + var(--s-6)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Editorial layout and progressive motion ===== */
.hero__greeting { display: block; color: var(--text); font-size: 1.5rem; font-weight: 500; margin-bottom: 6px; }
.hero__name { display: block; }
.hero__period { color: var(--text); }
.hero__splash { width: 100%; max-width: 420px; aspect-ratio: 1 / 1; margin: 16px auto 24px; mix-blend-mode: multiply; }
.hero__splash img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 94%, transparent 100%); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 94%, transparent 100%); mask-composite: intersect; }
.hero__text { font-size: .9375rem; line-height: 1.6; max-width: 60ch; margin-bottom: 0; }
.hero__cta { flex-wrap: nowrap; gap: 8px; margin: 22px 0; }
.hero__cta .btn { padding-inline: 14px; font-size: .8125rem; white-space: nowrap; min-height: 44px; border-radius: var(--radius-sm); }
.socials { gap: 20px; flex-wrap: nowrap; font-size: .8125rem; }
.socials a { display: inline-flex; align-items: center; gap: 6px; border: 0; min-height: 32px; word-break: normal; transition: color var(--t); }
.socials svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.section { padding-block: 48px; }
.hero { padding-block: 32px 40px; }
.about__grid { display: block; max-width: 74ch; }
.about__text p { font-size: 1rem; }
.about__text p:last-child { margin-bottom: 0; }
.timeline { border-left-width: 1px; margin-left: 5px; max-width: 760px; gap: 0; padding-left: 26px; }
.timeline__item { padding: 0 0 24px; }
.timeline__item + .timeline__item { padding-top: 24px; border-top: 1px solid var(--border); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { left: -32px; top: 5px; width: 11px; height: 11px; border-width: 1px; }
.timeline__item + .timeline__item::before { top: 29px; }
.timeline__item .card__title { font-size: 1.0625rem; line-height: 1.4; margin-bottom: 4px; }
.timeline__item .accent-text { margin: 0 0 6px; }
.timeline__item .mono { margin-bottom: 8px; }
.timeline__item .muted { font-size: .9375rem; margin-bottom: 0; }
.exp__head { display: block; margin-bottom: 10px; }
.exp__head > .mono { margin-top: 8px; }
.exp .badges { margin-top: 12px; }
.nav__menu ul a { transition: color var(--t); }
.nav__menu ul a:hover, .nav__menu ul a.is-active { color: var(--accent); }
.btn--ghost:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--accent); }
.skill:hover { box-shadow: var(--shadow); }
.project__body { gap: 14px; }
.hero__grid > div > * { animation: entrance 550ms ease both; }
.hero__grid .hero__title { animation-delay: 60ms; }
.hero__grid .hero__splash { animation-delay: 110ms; }
.hero__grid .hero__text { animation-delay: 150ms; }
.hero__grid .hero__cta { animation-delay: 200ms; }
.hero__grid .socials { animation-delay: 250ms; }
.reveal-pending { opacity: 0; transform: translateY(16px); transition: opacity 550ms ease, transform 550ms ease; }
.reveal-pending.is-revealed { opacity: 1; transform: none; }
@keyframes entrance { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 transparent; }
  50% { opacity: .65; transform: scale(.9); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); opacity: 1; }
  70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 0%, transparent); opacity: .75; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}
@media (min-width: 390px) {
  .container { padding-inline: 24px; }
  .hero__title { font-size: 2.5rem; }
  .eyebrow { font-size: .6875rem; }
  .hero__cta .btn { font-size: .875rem; padding-inline: 16px; }
}
@media (min-width: 640px) {
  .container { padding-inline: 32px; }
  .hero { padding-block: 52px 56px; }
  .hero__title { font-size: 3.5rem; }
  .hero__greeting { font-size: 1.75rem; }
  .hero__splash { margin-block: 20px 28px; }
  .hero__text { font-size: 1rem; }
  .hero__cta .btn { padding-inline: 22px; font-size: .9375rem; }
  .section { padding-block: 64px; }
  .section__title { font-size: 2.5rem; }
  .eyebrow { font-size: .75rem; }
}
@media (min-width: 960px) {
  .hero__grid { max-width: 1120px; }
  .hero { padding-block: 64px 72px; }
  .hero__title { font-size: 4.5rem; max-width: 17ch; }
  .hero__greeting { font-size: 2rem; }
  .hero__text { max-width: 64ch; }
  .hero__cta { margin-block: 28px 24px; }
  .socials { font-size: .9375rem; }
}
@media (min-width: 960px) and (max-width: 1199px) {
  .nav__menu, .nav__menu ul { gap: 12px; }
  .nav__menu ul a { font-size: .8125rem; }
  .nav__logo { font-size: 1rem; }
  .nav__menu > .btn { padding-inline: 12px; font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-pending { opacity: 1; transform: none; }
  .hero__grid > div > *, .eyebrow::before, .timeline__item.is-current::before { animation: none; }
}
