  :root {
    --accent: #E4445A;
    --bg: #100e0f;
    --bg2: #171316;
    --ink: #f2edee;
    --muted: #948a8f;
    --faint: #5c5458;
    --line: rgba(242, 237, 238, 0.13);
    --card: rgba(242, 237, 238, 0.035);
    --display: "Space Grotesk", "Helvetica Neue", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
  }
  html[data-theme="light"] {
    --bg: #f6f2ef;
    --bg2: #efe9e5;
    --ink: #1a1316;
    --muted: #75696e;
    --faint: #a59ba0;
    --line: rgba(26, 19, 22, 0.14);
    --card: rgba(26, 19, 22, 0.035);
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--display);
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background 0.35s ease, color 0.35s ease;
  }
  ::selection { background: var(--accent); color: #fff; }
  a { color: inherit; }
  .accent { color: var(--accent); }
  .portrait-slot {
    display: block;
    width: 300px;
    height: 360px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 4px;
  }
  .xp-last { border-bottom: 0; }

  /* ---------- shared ---------- */
  .wrap { max-width: 1240px; margin: 0 auto; padding: 0 48px; }
  .mono { font-family: var(--mono); }
  .section-head {
    display: flex;
    align-items: baseline;
    gap: 20px;
    padding: 28px 0 22px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0;
  }
  .section-head .idx {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 0.08em;
  }
  .section-head h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
  }
  .section-head .fill { flex: 1 1 auto; }
  .section-head .note {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--faint);
  }

  .reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
  .reveal.in { opacity: 1; transform: translateY(0); }
  @media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
  }

  /* ---------- top bar ---------- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topbar-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 58px;
    font-family: var(--mono);
    font-size: 12.5px;
  }
  .topbar .sig { font-weight: 700; letter-spacing: 0.05em; }
  .topbar .sig em { color: var(--accent); font-style: normal; }
  .topbar nav { display: flex; gap: 22px; margin-left: auto; }
  .topbar nav a { text-decoration: none; color: var(--muted); transition: color 0.2s; }
  .topbar nav a:hover { color: var(--accent); }
  .topbar .loc { color: var(--faint); white-space: nowrap; }
  @media (max-width: 980px) { .topbar .loc { display: none; } }

  /* ---------- hero ---------- */
  .hero { position: relative; padding: 88px 0 0 0; }
  .hero-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 56px;
    align-items: end;
  }
  .hero-kicker {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 30px;
  }
  .hero-kicker .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
    animation: pulse 2.4s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent); }
    50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 8%, transparent); }
  }
  @media (prefers-reduced-motion: reduce) { .hero-kicker .dot { animation: none; } }
  h1.name {
    font-size: clamp(64px, 10.5vw, 148px);
    line-height: 0.92;
    font-weight: 700;
    letter-spacing: -0.035em;
    text-transform: uppercase;
  }
  h1.name .outline {
    display: block;
    color: transparent;
    -webkit-text-stroke: 2px var(--ink);
  }
  h1.name .solid { display: block; }
  h1.name .solid .ruby { color: var(--accent); }
  .hero-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 36px;
    margin-top: 34px;
    padding-bottom: 56px;
    font-size: 19px;
  }
  .hero-sub .role { font-weight: 600; }
  .hero-sub .meta { color: var(--muted); }
  .hero-sub .meta b { color: var(--ink); font-weight: 600; }

  .hero-portrait {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 56px;
  }
  .hero-portrait .caption {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--faint);
    letter-spacing: 0.06em;
  }
  @media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-portrait { display: none; }
  }

  /* ---------- marquee ---------- */
  .marquee {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    white-space: nowrap;
    padding: 16px 0;
    background: var(--bg2);
  }
  .marquee-track {
    display: inline-flex;
    gap: 0;
    animation: scroll 38s linear infinite;
  }
  @media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }
  .marquee-track span {
    font-family: var(--mono);
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 26px;
    display: inline-flex;
    align-items: center;
    gap: 52px;
  }
  .marquee-track span::after { content: "◆"; color: var(--accent); font-size: 9px; }
  @keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

  /* ---------- stats ---------- */
  .stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-left: 1px solid var(--line);
  }
  .stat {
    padding: 44px 36px 40px 36px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background 0.25s;
  }
  .stat:hover { background: var(--card); }
  .stat .num {
    font-size: clamp(40px, 4.6vw, 62px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
  }
  .stat .num sup { font-size: 0.45em; color: var(--accent); font-weight: 600; }
  .stat .label {
    margin-top: 14px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
  }
  @media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
  @media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }

  /* ---------- experience (git log) ---------- */
  .xp-list { display: flex; flex-direction: column; }
  .xp {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    padding: 44px 0;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  .xp-meta { display: flex; flex-direction: column; gap: 8px; }
  .xp-meta .hash {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--faint);
    transition: color 0.25s;
  }
  .xp:hover .xp-meta .hash { color: var(--accent); }
  .xp-meta .hash::before { content: "* "; color: var(--accent); }
  .xp-meta .dates { font-family: var(--mono); font-size: 13px; color: var(--muted); }
  .xp-meta .place { font-family: var(--mono); font-size: 12px; color: var(--faint); }
  .xp-body h3 {
    font-size: 27px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.2;
  }
  .xp-body .co {
    margin-top: 4px;
    font-size: 16px;
    color: var(--muted);
  }
  .xp-body .co b { color: var(--accent); font-weight: 600; }
  .xp-body .co a { color: inherit; text-decoration: none; transition: color 0.2s; }
  .xp-body .co a:hover { color: var(--ink); }
  .xp-body .co .ext { font-family: var(--mono); font-size: 0.78em; }
  .xp-body li a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
  .xp-body li a:hover { color: var(--accent); }
  .xp-body ul {
    margin: 20px 0 0 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .xp-body ul li {
    padding-left: 24px;
    position: relative;
    color: color-mix(in srgb, var(--ink) 84%, var(--muted));
    max-width: 760px;
    text-wrap: pretty;
  }
  .xp-body ul li::before {
    content: "+";
    position: absolute;
    left: 0;
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 700;
  }
  .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
  }
  .tag {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.04em;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
  }
  .xp:hover .tag, .proj:hover .tag { color: var(--ink); }
  @media (max-width: 820px) {
    .xp { grid-template-columns: 1fr; gap: 16px; }
    .xp-meta { flex-direction: row; flex-wrap: wrap; gap: 16px; }
  }

  /* ---------- projects ---------- */
  .projects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-left: 1px solid var(--line);
  }
  .proj {
    display: block;
    text-decoration: none;
    padding: 40px 34px 44px 34px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background 0.25s;
    position: relative;
  }
  .proj:hover { background: var(--card); }
  .proj .pidx {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--faint);
    display: block;
    margin-bottom: 42px;
  }
  .proj h3 {
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .proj h3 .arrow {
    font-family: var(--mono);
    font-size: 18px;
    color: var(--accent);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .proj:hover h3 .arrow { transform: translate(4px, -4px); }
  .proj p { margin-top: 10px; color: var(--muted); font-size: 15.5px; max-width: 30ch; text-wrap: pretty; }
  .proj .url {
    margin-top: 26px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--accent);
    display: block;
  }
  @media (max-width: 820px) { .projects { grid-template-columns: 1fr; } }

  /* ---------- contact ---------- */
  .contact { padding: 110px 0 60px 0; }
  .contact .prompt {
    font-family: var(--mono);
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 24px;
  }
  .contact .prompt .ok { color: var(--accent); }
  .contact a.big {
    display: block;
    font-size: clamp(36px, 6.5vw, 88px);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-decoration: none;
    line-height: 1.05;
    width: fit-content;
    position: relative;
  }
  .contact a.big::after {
    content: "";
    position: absolute;
    left: 0; bottom: -6px;
    width: 100%; height: 4px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .contact a.big:hover::after { transform: scaleX(1); }
  .footer {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 36px;
    align-items: center;
    margin-top: 80px;
    padding: 26px 0 40px 0;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--faint);
  }
  .footer a { color: var(--muted); text-decoration: none; transition: color 0.2s; white-space: nowrap; }
  .footer a:hover { color: var(--accent); }
  .footer .spacer { flex: 1 1 auto; }

  section { scroll-margin-top: 70px; }
  .gap-lg { height: 110px; }
  .gap-md { height: 70px; }
  @media (max-width: 720px) {
    .wrap { padding: 0 24px; }
    .gap-lg { height: 70px; }
  }
  @media (max-width: 600px) {
    .topbar-inner { gap: 16px; }
    .topbar nav { gap: 16px; }
    .topbar nav a:nth-child(-n+2) { display: none; }
  }
