  :root {
    --bg: #F5F6F4;
    --surface: #FFFFFF;
    --ink: #171A18;
    --muted: #646B67;
    --line: #DADFDC;
    --accent: #1F6B62;
    --accent-soft: rgba(31, 107, 98, 0.1);

    --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --font-body: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;

    --col: 44rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light dark;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #101311;
      --surface: #171B19;
      --ink: #E6EAE7;
      --muted: #9AA39E;
      --line: #2A302D;
      --accent: #72C4B7;
      --accent-soft: rgba(114, 196, 183, 0.12);
    }
  }
  :root[data-theme="dark"] {
    --bg: #101311;
    --surface: #171B19;
    --ink: #E6EAE7;
    --muted: #9AA39E;
    --line: #2A302D;
    --accent: #72C4B7;
    --accent-soft: rgba(114, 196, 183, 0.12);
  }

  *, *::before, *::after { box-sizing: inherit; }
  html { scroll-behavior: smooth; scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 5rem); }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  img { max-width: 100%; }
  a { color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

  .wrap { width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 1.5rem; }

  /* Header */
  .site-header {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s var(--ease);
  }
  .site-header.is-scrolled { border-bottom-color: var(--line); }
  .site-header .wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; height: 4rem;
  }
  .mark {
    font-family: var(--font-display); font-weight: 650; font-size: 1.05rem;
    text-decoration: none; letter-spacing: -0.01em;
  }
  .nav { display: flex; gap: 1.5rem; }
  .nav a {
    text-decoration: none; color: var(--muted); font-size: .95rem;
    transition: color .2s;
  }
  .nav a:hover, .nav a.is-active { color: var(--ink); }

  /* Language switch */
  .lang {
    position: relative; display: inline-flex;
    padding: 3px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface);
  }
  .actions { display: flex; align-items: center; gap: .5rem; }
  .lang button {
    position: relative; z-index: 1;
    display: grid; place-items: center;
    border: 0; background: none; cursor: pointer;
    padding: .4rem .55rem; border-radius: 999px;
  }
  .flag {
    display: block; width: 22px; height: 16px; border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
    filter: saturate(.35); opacity: .6;
    transition: filter .3s, opacity .3s, transform .3s var(--ease);
  }
  .lang button:hover .flag { opacity: .9; }
  .lang button[aria-pressed="true"] .flag { filter: none; opacity: 1; transform: scale(1.05); }
  .lang .pill {
    position: absolute; top: 3px; bottom: 3px; left: 3px;
    border-radius: 999px; background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
    transition: transform .35s var(--ease), width .35s var(--ease);
  }

  /* Theme toggle */
  .theme-toggle {
    display: grid; place-items: center;
    width: 2.35rem; height: 2.35rem; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--ink); cursor: pointer;
    transition: border-color .2s;
  }
  .theme-toggle:hover { border-color: var(--ink); }
  .theme-toggle svg { width: 18px; height: 18px; transition: transform .5s var(--ease), opacity .3s; }
  .theme-toggle .moon { position: absolute; }
  .theme-toggle { position: relative; }
  .theme-toggle .sun { transform: rotate(0) scale(1); }
  .theme-toggle .moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
  [data-mode="dark"] .theme-toggle .sun { opacity: 0; transform: rotate(90deg) scale(.5); }
  [data-mode="dark"] .theme-toggle .moon { opacity: 1; transform: rotate(0) scale(1); }
  body, .lang, .theme-toggle { transition: background-color .35s ease, color .35s ease, border-color .35s ease; }
  .lang[aria-busy="true"] .pill { opacity: .7; }

  /* Hero */
  .hero { padding: 6rem 0 4.5rem; }
  .identity { display: flex; align-items: center; gap: 1rem; margin: 0 0 2.25rem; }
  .avatar {
    width: 72px; height: 72px; flex: none;
    border-radius: 50%; object-fit: cover;
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--line), 0 0 0 5px var(--bg), 0 0 0 6px var(--accent);
  }
  .identity .name { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
  .identity .role { margin: .15rem 0 0; color: var(--muted); font-size: .95rem; }
  .status {
    display: inline-flex; align-items: center; gap: .55rem;
    font-size: .9rem; color: var(--muted); margin: 0 0 2rem;
  }
  .status::before {
    content: ""; width: .5rem; height: .5rem; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
  }
  .hero h1 {
    font-family: var(--font-display);
    font-size: clamp(3rem, 11vw, 5.75rem);
    font-weight: 600; line-height: .95; letter-spacing: -0.045em;
    margin: 0 0 1.75rem;
  }
  .hero h1 .line { display: block; overflow: hidden; }
  .hero h1 .line span {
    display: inline-block; transform: translateY(105%);
    animation: rise 1s var(--ease) forwards;
  }
  .hero h1 .line:nth-child(2) span { animation-delay: .12s; color: var(--muted); }
  @keyframes rise { to { transform: translateY(0); } }

  .lede { font-size: 1.2rem; max-width: 34rem; margin: 0 0 2rem; }
  .links { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; padding: 0; list-style: none; }
  .btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.1rem; border-radius: 10px;
    text-decoration: none; font-weight: 500; font-size: .95rem;
    border: 1px solid var(--line); background: var(--surface);
    transition: border-color .2s, transform .2s var(--ease);
  }
  .btn:hover { border-color: var(--ink); transform: translateY(-1px); }
  .btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }

  /* Sections */
  section { padding: 4rem 0; }
  h2 {
    font-family: var(--font-display); font-weight: 600;
    font-size: 1.75rem; letter-spacing: -0.02em; line-height: 1.15;
    margin: 0 0 .5rem;
  }
  .intro { color: var(--muted); margin: 0 0 2.25rem; max-width: 32rem; }

  /* Projects: rows, not cards */
  .projects { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
  .project a {
    display: grid; grid-template-columns: 1fr auto; gap: .25rem 1.5rem;
    padding: 1.35rem .25rem; text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: padding .35s var(--ease), background .35s var(--ease);
  }
  .project a:hover { padding-left: .9rem; background: var(--accent-soft); }
  .project h3 {
    font-family: var(--font-display); font-weight: 600; font-size: 1.2rem;
    margin: 0; letter-spacing: -0.01em;
  }
  .project .year { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .95rem; }
  .project p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .98rem; }
  .project .stack { grid-column: 1 / -1; font-size: .85rem; color: var(--accent); margin-top: .35rem; }

  /* Timeline: drawn by scroll */
  .timeline { position: relative; list-style: none; margin: 0; padding: 0 0 0 2rem; }
  .timeline::before, .timeline::after {
    content: ""; position: absolute; left: .35rem; top: .5rem; bottom: .5rem; width: 2px;
  }
  .timeline::before { background: var(--line); }
  .timeline::after {
    background: var(--accent); transform-origin: top;
    transform: scaleY(var(--p, 0));
  }
  .step { position: relative; padding-bottom: 2.25rem; }
  .step:last-child { padding-bottom: 0; }
  .step::before {
    content: ""; position: absolute; left: calc(-2rem + .35rem - 5px); top: .45rem;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--line);
    transition: border-color .4s, background .4s;
  }
  .step.is-reached::before { border-color: var(--accent); background: var(--accent); }
  .step .when { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
  .step h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: .15rem 0 .35rem; }
  .step p { margin: 0; color: var(--muted); }

  /* Contact */
  .contact h2 { font-size: clamp(2rem, 6vw, 2.75rem); letter-spacing: -0.03em; max-width: 30rem; }
  .contact .mail {
    display: inline-block; margin-top: 1.25rem;
    font-family: var(--font-display); font-size: clamp(1.25rem, 4vw, 1.6rem); font-weight: 500;
    text-decoration-color: var(--accent); text-underline-offset: 6px; text-decoration-thickness: 2px;
    word-break: break-word;
  }

  footer { padding: 3rem 0 3.5rem; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); margin-top: 3rem; }

  /* Scroll reveal */
  .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
  .reveal.is-visible { opacity: 1; transform: none; }

  /* Language swap */
  [data-i18n] { transition: opacity .18s ease, filter .18s ease; }
  .is-swapping [data-i18n] { opacity: 0; filter: blur(3px); }

  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  @media (max-width: 640px) {
    .nav { display: none; }
    .avatar { width: 60px; height: 60px; }
    .hero { padding: 4rem 0 3rem; }
    section { padding: 3rem 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .hero h1 .line span { animation: none; transform: none; }
    .timeline::after { transform: scaleY(1); }
    [data-i18n] { transition: none; }
  }
