:root {
    --canvas: #f5f5f7;
    --fog:    #ececee;
    --surface:#ffffff;
    --ink:    #16161a;
    --ink-soft:#5f5f66;
    --ink-mute:#8e8e96;
    --hairline: rgba(0,0,0,0.10);
    --btn-bg: #16161a;
    --btn-fg: #ffffff;

    --black: #000000;
    --on-black: #ffffff;
    --on-black-soft: #9a9a9e;
    --on-black-hairline: rgba(255,255,255,0.14);

    --font: "SF Pro Display", "Inter", "Helvetica Neue", ui-sans-serif, system-ui, -apple-system, sans-serif;

    --max: 1120px;
    --gap: 120px;
    --r-card: 16px;
    --r-small: 6px;
    --r-pill: 999px;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --canvas: #0a0a0b; --fog: #101012; --surface: #1a1a1d;
      --ink: #f2f2f4; --ink-soft: #a1a1a8; --ink-mute: #6e6e76;
      --hairline: rgba(255,255,255,0.12); --btn-bg: #f2f2f4; --btn-fg: #0a0a0b;
    }
  }
  :root[data-theme="light"] {
    --canvas: #f5f5f7; --fog: #ececee; --surface: #ffffff;
    --ink: #16161a; --ink-soft: #5f5f66; --ink-mute: #8e8e96;
    --hairline: rgba(0,0,0,0.10); --btn-bg: #16161a; --btn-fg: #ffffff;
  }
  :root[data-theme="dark"] {
    --canvas: #0a0a0b; --fog: #101012; --surface: #1a1a1d;
    --ink: #f2f2f4; --ink-soft: #a1a1a8; --ink-mute: #6e6e76;
    --hairline: rgba(255,255,255,0.12); --btn-bg: #f2f2f4; --btn-fg: #0a0a0b;
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink-soft);
    font-family: var(--font);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
  }

  /* ── Matrix rain backdrop ── */
  #rain { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; background: var(--canvas); pointer-events: none; opacity: 0.9; }
  main, .footer { position: relative; z-index: 1; }

  .inner { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 28px; }

  .kicker { display: inline-block; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute); }
  .kicker::before { content: "[ "; }
  .kicker::after  { content: " ]"; }
  .kicker--on-black { color: var(--on-black-soft); }

  /* ── Sticky navigation ── */
  .nav {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--canvas) 78%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--hairline);
  }
  .nav__inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .nav__brand { font-size: 15px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
  .nav__links { display: flex; gap: 26px; align-items: center; list-style: none; margin: 0; padding: 0; }
  .nav__link {
    font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--ink-mute); text-decoration: none; transition: color 0.25s ease;
  }
  .nav__link:hover, .nav__link:focus-visible { color: var(--ink); }

  /* ── Hero ── */
  .hero { padding: 104px 0 var(--gap); text-align: center; }
  .badge {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.10em; color: var(--ink-soft);
    padding: 8px 16px; border: 1px solid var(--hairline); border-radius: var(--r-pill);
  }
  .badge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); position: relative; }
  .badge__dot::after {
    content: ""; position: absolute; inset: -4px; border-radius: 50%;
    border: 1px solid var(--ink); opacity: 0.5; animation: ping 2.4s ease-out infinite;
  }
  @keyframes ping { 0% { transform: scale(0.6); opacity: 0.6; } 100% { transform: scale(1.8); opacity: 0; } }

  .hero__greet { margin: 34px 0 0; font-size: 18px; color: var(--ink-soft); }
  .hero__greet strong { color: var(--ink); font-weight: 500; }
  .hero__title {
    font-weight: 500;
    font-size: clamp(2.8rem, 9vw, 6.2rem);
    line-height: 1.0;
    letter-spacing: -0.045em;
    color: var(--ink);
    margin: 12px 0 0;
    text-wrap: balance;
  }
  .hero__role { margin: 16px 0 0; font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.22em; color: var(--ink-mute); }
  .hero__sub { max-width: 52ch; margin: 30px auto 0; font-size: 19px; line-height: 1.5; color: var(--ink-soft); }
  .hero__social { display: flex; justify-content: center; gap: 12px; margin-top: 38px; }
  .icon-link {
    width: 46px; height: 46px; border-radius: var(--r-pill); border: 1px solid var(--hairline);
    display: grid; place-items: center; color: var(--ink); transition: transform 0.25s ease, border-color 0.25s ease;
  }
  .icon-link:hover, .icon-link:focus-visible { transform: translateY(-3px); border-color: var(--ink); }
  .icon-link svg { width: 20px; height: 20px; }

  /* ── Section heads ── */
  section { scroll-margin-top: 80px; }
  section + section { margin-top: var(--gap); }
  .head { margin: 0 0 44px; }
  .head--center { text-align: center; }
  .head__title {
    font-weight: 500; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -0.03em;
    color: var(--ink); margin: 14px 0 0; text-wrap: balance;
  }
  .head__sub { font-size: 18px; color: var(--ink-soft); margin: 16px 0 0; max-width: 56ch; }
  .head--center .head__sub { margin-left: auto; margin-right: auto; }

  /* ── Skills ── */
  .skills { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
  .chip {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 11px 18px; border: 1px solid var(--hairline); border-radius: var(--r-pill);
    font-size: 14px; color: var(--ink); background: var(--surface);
    transition: border-color 0.25s ease, transform 0.25s ease;
  }
  .chip:hover { border-color: var(--ink-mute); transform: translateY(-2px); }
  .chip__glyph { width: 10px; height: 10px; transform: rotate(45deg); border: 1.5px solid var(--ink); }

  /* ── Services ── */
  .services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .service {
    background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card);
    padding: 32px 28px; display: flex; flex-direction: column; gap: 16px;
    transition: border-color 0.3s ease, transform 0.3s ease;
  }
  .service:hover { border-color: var(--ink-mute); transform: translateY(-3px); }
  .service__no { font-size: 12px; letter-spacing: 0.14em; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
  .service__title { font-weight: 500; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
  .service__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .service__list li { position: relative; padding-left: 20px; font-size: 15px; color: var(--ink-soft); }
  .service__list li::before { content: "—"; position: absolute; left: 0; color: var(--ink-mute); }

  /* ── Projects ── */
  .work { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .project {
    background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card);
    padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 16px;
    transition: border-color 0.3s ease, transform 0.3s ease;
  }
  .project:hover { border-color: var(--ink-mute); transform: translateY(-3px); }
  .project__top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
  .status {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em; color: var(--ink-soft);
    padding: 6px 12px; border: 1px solid var(--hairline); border-radius: var(--r-pill); white-space: nowrap;
  }
  .status__dot { width: 7px; height: 7px; border-radius: 50%; }
  .status--live .status__dot { background: var(--ink); }
  .status--dev .status__dot { background: transparent; border: 1.5px solid var(--ink); animation: pulse 2.2s ease-in-out infinite; }
  .project__title { font-weight: 500; font-size: 26px; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
  .project__body { font-size: 15px; color: var(--ink-soft); margin: 0; }
  .project__note { font-size: 13px; line-height: 1.55; color: var(--ink-mute); margin: 0; padding-top: 14px; border-top: 1px solid var(--hairline); flex: 1; }
  .project__note em { color: var(--ink-soft); font-style: italic; }
  .tags { display: flex; flex-wrap: wrap; gap: 8px; }
  .tag { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); padding: 5px 10px; border: 1px solid var(--hairline); border-radius: var(--r-small); }
  .project__links { display: flex; gap: 10px; margin-top: 2px; }
  .mini-link {
    display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); text-decoration: none;
    padding: 8px 14px; border: 1px solid var(--hairline); border-radius: var(--r-small); transition: border-color 0.25s ease;
  }
  .mini-link:hover, .mini-link:focus-visible { border-color: var(--ink); }
  .mini-link svg { width: 14px; height: 14px; }
  .mini-link[aria-disabled="true"] { color: var(--ink-mute); pointer-events: none; border-style: dashed; }

  /* ── Contact ── */
  .contact { text-align: center; }
  .contact__loc { font-size: 14px; color: var(--ink-mute); margin: 18px 0 0; letter-spacing: 0.04em; }
  .btn {
    display: inline-flex; align-items: center; gap: 10px; margin-top: 30px;
    font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
    background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--r-small); text-decoration: none;
    padding: 17px 26px; transition: opacity 0.25s ease;
  }
  .btn:hover, .btn:focus-visible { opacity: 0.85; }
  .btn svg { width: 16px; height: 16px; }
  .btn--line { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
  .btn--line:hover, .btn--line:focus-visible { border-color: var(--ink); opacity: 1; }
  .contact__actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 30px; }
  .contact__actions .btn { margin-top: 0; }

  /* ── Footer ── */
  .footer { background: var(--fog); margin-top: var(--gap); padding: 64px 0; }
  .footer__inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
  .footer__icons { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; }
  .footer__icons a { color: var(--ink-mute); transition: color 0.25s ease; display: grid; place-items: center; }
  .footer__icons a:hover { color: var(--ink); }
  .footer__icons svg { width: 20px; height: 20px; }
  .footer__copy { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-mute); margin: 0; text-align: center; }
  .footer__copy a { color: var(--ink-soft); text-decoration: none; }
  .footer__copy a:hover { color: var(--ink); }

  /* ── Reveal ── */
  .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
  .reveal.is-visible { opacity: 1; transform: none; }

  :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

  @keyframes pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

  @media (max-width: 720px) {
    .nav__links { display: none; }
    .services { grid-template-columns: 1fr; }
    .work { grid-template-columns: 1fr; }
  }
  @media (prefers-reduced-motion: reduce) {
    .status--dev .status__dot, .badge__dot::after { animation: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
  }
