/* ===== Tokens ===== */
:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --alt: #efebe4;
  --chip: #f3efe8;
  --ink: #16181d;
  --ink-2: #464b55;
  --ink-3: #6f7480;
  --line: #e2ddd4;
  --accent: #c3262b;
  --accent-hover: #a41f24;
  --accent-on-dark: #f27d74;
  --dark: #16181d;
  --dark-2: #1f2229;
  --on-dark: #f3f0ea;
  --on-dark-2: #b9b5ad;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --container: 1160px;
  --gutter: 24px;
  --radius: 16px;
  --header-h: 68px;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { color: var(--ink); margin: 0; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.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; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 12px; color: #fff; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -.01em;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 24px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: 700 .95rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-small { padding: 9px 16px; font-size: .88rem; gap: 8px; }
.btn-small .icon { width: 16px; height: 16px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 245, 241, .9);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; margin-right: auto; color: var(--ink); text-decoration: none; }
.lang-switch {
  display: inline-grid; place-items: center;
  min-width: 42px; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none;
  font-weight: 700; font-size: .8rem; letter-spacing: .08em;
  transition: border-color .2s;
}
.lang-switch:hover { border-color: var(--ink); color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--ink); color: #fff;
  font-weight: 800; font-size: .82rem; letter-spacing: .04em;
}
.brand-name { font-weight: 700; font-size: 1.02rem; }

.site-nav { display: flex; align-items: center; gap: 32px; }
.site-nav ul { display: flex; gap: 26px; }
.site-nav ul a {
  position: relative;
  color: var(--ink-2); text-decoration: none;
  font-weight: 600; font-size: .94rem;
}
.site-nav ul a:hover, .site-nav ul a.is-active { color: var(--ink); }
.site-nav ul a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

.nav-toggle {
  display: none;
  width: 44px; height: 44px; margin-right: -10px;
  border: 0; background: none; cursor: pointer;
  position: relative;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  position: absolute; left: 11px; width: 22px; height: 2px; border-radius: 2px;
  background: var(--ink); content: ""; transition: transform .2s, opacity .2s;
}
.nav-toggle-bar { top: 21px; }
.nav-toggle-bar::before { left: 0; top: -7px; }
.nav-toggle-bar::after { left: 0; top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 960px) {
  .header-inner { gap: 10px; }
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 16px;
    padding: 8px var(--gutter) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 32px -24px rgba(22, 24, 29, .35);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav ul a { display: block; padding: 12px 0; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
  .site-nav ul a.is-active::after { display: none; }
  .site-nav .btn { align-self: flex-start; }
}

/* ===== Hero ===== */
.hero { padding: 56px 0 24px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 64px; align-items: center; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.7rem, 6.2vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  margin-bottom: 24px;
}
.lead { color: var(--ink); font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.45; font-weight: 500; max-width: 30ch; }
.hero-sub { max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 28px; }
.hero-meta { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--ink-3); font-size: .95rem; font-weight: 600; }

.hero-photo { position: relative; }
.hero-photo::before {
  content: ""; position: absolute; inset: 22px -22px -22px 22px;
  border-radius: 24px; border: 1.5px solid var(--accent); opacity: .35;
}
.hero-photo img {
  position: relative;
  width: 100%; aspect-ratio: 1000 / 941; object-fit: cover;
  border-radius: 24px;
}

.stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  margin: 72px 0 0;
  border-top: 1px solid var(--line);
}
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; padding: 26px 20px 8px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; }
.stat dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2rem, 3.4vw, 2.7rem); line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.stat dt { color: var(--ink-3); font-size: .9rem; line-height: 1.35; }

@media (max-width: 900px) {
  .hero { padding-top: 32px; }
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-photo { max-width: 520px; margin-right: 22px; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 56px; }
  .stat { padding: 22px 16px 18px 0; border-bottom: 1px solid var(--line); }
  .stat + .stat { border-left: 0; }
  .stat:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
  .stat:last-child { grid-column: 1 / -1; border-bottom: 0; }
}

/* ===== Sections ===== */
.section { padding: 104px 0; }
.section-alt { background: var(--alt); }
.section-head { max-width: 760px; margin-bottom: 52px; }
.section-head h2 { margin-bottom: 18px; }
.section-intro { font-size: 1.08rem; margin: 0; }
@media (max-width: 700px) { .section { padding: 72px 0; } .section-head { margin-bottom: 36px; } }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 72px; align-items: start; }
.about-photo { position: sticky; top: calc(var(--header-h) + 32px); }
.about-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 20px; }
.about-text h2 { margin-bottom: 24px; }
.about-lead { font-family: var(--serif); font-size: 1.5rem; line-height: 1.4; color: var(--ink); }
.quote {
  margin: 36px 0;
  padding: 2px 0 2px 24px;
  border-left: 3px solid var(--accent);
}
.quote p { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(1.4rem, 2.4vw, 1.7rem); line-height: 1.35; color: var(--ink); }
.mission { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; }
.mission-label { margin: 0 0 8px; color: var(--ink-3); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.mission p:last-child { margin: 0; color: var(--ink); }
.roles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.roles li { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 600; }

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-photo { position: static; max-width: 380px; }
}

/* ===== Services ===== */
.services {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.service { background: var(--surface); padding: 32px 30px 36px; }
.service-code {
  display: block;
  color: var(--accent);
  font-weight: 800; font-size: 2.3rem; line-height: 1; letter-spacing: -.02em;
}
.service h3 { margin: 18px 0 10px; font-size: 1.12rem; font-weight: 700; }
.service p { margin: 0; font-size: .98rem; }
@media (max-width: 980px) { .services { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .services { grid-template-columns: 1fr; } .service { padding: 26px 22px 28px; } }

/* ===== Experience ===== */
.timeline { border-bottom: 1px solid var(--line); }
.job { display: grid; grid-template-columns: 180px 1fr; gap: 40px; padding: 34px 0; border-top: 1px solid var(--line); }
.job-years {
  margin: 4px 0 0;
  color: var(--ink); font-weight: 700; font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.job-org { margin: 0 0 14px; font-family: var(--serif); font-weight: 600; font-size: 1.45rem; line-height: 1.25; color: var(--ink); }
.job-org span { font-family: var(--sans); font-weight: 500; font-size: .95rem; color: var(--ink-3); }
.job-role h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 700; }
.job-role p { margin: 0; max-width: 70ch; }
.job-role + .job-role { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line); }
@media (max-width: 700px) {
  .job { grid-template-columns: 1fr; gap: 6px; padding: 28px 0; }
  .job-years { color: var(--accent); }
  .job-org { font-size: 1.3rem; }
}

/* ===== Skills ===== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 24px; }
.skill-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.skill-card h3 { margin: 0 0 22px; font-size: 1.05rem; font-weight: 700; }
.skill-card .skill-sub { margin-top: 34px; }
.meters { display: grid; gap: 18px; }
.meter { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 8px; font-size: .95rem; }
.meter-name { color: var(--ink); font-weight: 500; line-height: 1.35; }
.meter-val { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter::before, .meter::after {
  content: ""; grid-row: 2; grid-column: 1 / -1;
  height: 6px; border-radius: 999px;
}
.meter::before { background: var(--chip); }
.meter::after {
  width: calc(var(--v) * 1%);
  background: var(--accent);
  transform-origin: left center;
  transition: transform 1s cubic-bezier(.2, .7, .2, 1);
}
.js .meter:not(.is-in)::after { transform: scaleX(0); }
@media (prefers-reduced-motion: reduce) { .meter::after { transition: none; } .js .meter:not(.is-in)::after { transform: none; } }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { padding: 6px 13px; border-radius: 999px; background: var(--chip); color: var(--ink); font-size: .88rem; font-weight: 600; }
.skill-note { margin: 24px 0 0; color: var(--ink-3); font-size: .9rem; line-height: 1.55; }
.langs li { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.langs li:first-child { padding-top: 0; }
.lang-level { color: var(--accent); font-weight: 800; }

/* ===== Education ===== */
.edu-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: start; }
.col-title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
.edu-list li { padding: 22px 0; border-top: 1px solid var(--line); }
.edu-list li:first-child { border-top: 0; padding-top: 12px; }
.edu-years { margin: 0 0 4px; color: var(--ink-3); font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.edu-list h4 { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 1.28rem; }
.edu-list p:last-child { margin: 0; font-size: .98rem; }
.cert-list li { display: grid; grid-template-columns: 138px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); font-size: .95rem; line-height: 1.5; }
.cert-list li:first-child { border-top: 0; padding-top: 12px; }
.cert-date { color: var(--ink-3); font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 2px; }
.cert-name strong { display: block; color: var(--ink); font-weight: 700; }
@media (max-width: 900px) { .edu-grid { grid-template-columns: 1fr; gap: 48px; } }
@media (max-width: 480px) { .cert-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ===== Events ===== */
.events { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.event { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.event img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.event-body { padding: 22px 24px 26px; }
.event-meta { margin: 0 0 8px; color: var(--ink-3); font-size: .85rem; font-weight: 600; }
.event h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; line-height: 1.25; }
.event p:last-child { margin: 0; font-size: .98rem; }
@media (max-width: 960px) { .events { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .events { grid-template-columns: 1fr; } }

/* ===== Contact ===== */
.section-dark { background: var(--dark); color: var(--on-dark-2); }
.section-dark h2 { color: var(--on-dark); margin-bottom: 18px; }
.section-dark .eyebrow { color: var(--accent-on-dark); }
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 72px; align-items: start; }
.contact-intro { font-size: 1.08rem; margin-bottom: 28px; }
.contact-list li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); color: var(--on-dark); font-weight: 500; }
.contact-list li:first-child { border-top: 1px solid rgba(255, 255, 255, .1); }
.contact-list .icon { width: 20px; height: 20px; color: var(--accent-on-dark); }
.contact-list a { color: var(--on-dark); text-decoration: none; }
.contact-list a:hover { color: #fff; text-decoration: underline; }

.contact-form { background: var(--dark-2); border: 1px solid rgba(255, 255, 255, .08); border-radius: 20px; padding: 32px; }
.field { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { display: block; margin-bottom: 8px; color: var(--on-dark); font-size: .9rem; font-weight: 600; }
.optional { color: var(--on-dark-2); font-weight: 400; }
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px;
  background: #16181d; color: var(--on-dark);
  font: inherit; font-size: 1rem;
  transition: border-color .2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent-on-dark); box-shadow: 0 0 0 3px rgba(242, 125, 116, .2); }
.contact-form .btn { width: 100%; margin-top: 6px; }
.section-dark :focus-visible { outline-color: var(--accent-on-dark); }

@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; gap: 48px; } }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; gap: 0; } .contact-form { padding: 22px; } }

/* ===== Footer ===== */
.site-footer { background: #111317; color: var(--on-dark-2); padding: 28px 0; font-size: .9rem; border-top: 1px solid rgba(255, 255, 255, .06); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-links a { color: var(--on-dark-2); text-decoration: none; }
.footer-links a:hover { color: #fff; }

/* ===== Mobile gutters ===== */
@media (max-width: 520px) {
  :root { --gutter: 16px; }
  body { font-size: 1rem; }
  .hero-photo::before { inset: 14px -14px -14px 14px; }
  .hero-photo { margin-right: 14px; }
  .hero-actions .btn { flex: 1 1 auto; }
}
