  :root {
    /* —— ruby (default) —— warm near-black with ruby/rails red accent */
    --bg:        #140a0c;
    --bg-2:      #1d0e11;
    --bg-3:      #2b1419;
    --ink:       #f1e4e2;
    --ink-dim:   #a98e8d;
    --ink-faint: #5c4449;
    --line:      rgba(241, 228, 226, 0.09);
    --line-2:    rgba(241, 228, 226, 0.20);
    --accent:    #e0245e;
    --accent-2:  #d8a657;

    --serif: 'Instrument Serif', 'Times New Roman', serif;
    --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --pad-x: clamp(22px, 6vw, 110px);
    --size-body: 14px;
  }

  [data-theme="terminal"] {
    --bg:#080808; --bg-2:#101010; --bg-3:#191919;
    --ink:#ececec; --ink-dim:#8a8a8a; --ink-faint:#454545;
    --line:rgba(255,255,255,.07); --line-2:rgba(255,255,255,.2);
    --accent:#d4ff3a; --accent-2:#ff8c4a;
  }
  [data-theme="rails"] {
    --bg:#120808; --bg-2:#1b0c0c; --bg-3:#281111;
    --ink:#f3e3e1; --ink-dim:#ad8d8a; --ink-faint:#5e4140;
    --line:rgba(243,227,225,.08); --line-2:rgba(243,227,225,.2);
    --accent:#d30001; --accent-2:#e8b04b;
  }
  [data-theme="midnight"] {
    --bg:#080d18; --bg-2:#101728; --bg-3:#1a2436;
    --ink:#e6edf3; --ink-dim:#8b96a5; --ink-faint:#465060;
    --line:rgba(230,237,243,.07); --line-2:rgba(230,237,243,.2);
    --accent:#6cb6ff; --accent-2:#d2a8ff;
  }
  [data-theme="amber"] {
    --bg:#0f0c08; --bg-2:#171109; --bg-3:#221910;
    --ink:#f0e6d2; --ink-dim:#a3927a; --ink-faint:#5c4e3b;
    --line:rgba(240,230,210,.08); --line-2:rgba(240,230,210,.2);
    --accent:#ffb347; --accent-2:#7fd4c1;
  }

  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    height: 100%; width: 100%;
    background: var(--bg); color: var(--ink);
    overflow: hidden;                 /* no scrollbar */
    overscroll-behavior: none;
  }
  body {
    font-family: var(--mono);
    font-size: var(--size-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
  }
  ::selection { background: var(--accent); color: var(--bg); }
  a { color: inherit; text-decoration: none; }
  a.link { border-bottom: 1px solid var(--line-2); transition: color .2s, border-color .2s; }
  a.link:hover { color: var(--accent); border-bottom-color: var(--accent); }
  a.social-link:hover { color: var(--accent); }
  a.proj-row:hover .wt { color: var(--accent); }
  a.proj-row:hover .proj-arr { color: var(--accent); transform: translate(2px, -2px); }

  button { cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  .serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 0.9; }
  .serif-it { font-style: italic; }
  .label { font-size: 11px; text-transform: uppercase; letter-spacing: .2em; color: var(--ink-dim); }
  .faint { color: var(--ink-faint); }
  .dim { color: var(--ink-dim); }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }

  /* faint grid + scanline ambience */
  .ambience {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
      linear-gradient(var(--line) 1px, transparent 1px),
      linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 95%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 95%);
  }

  .dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--accent); margin-right:8px; vertical-align:middle; }
  .dot.pulse { animation: pulse 2.4s infinite; }
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
    70%{ box-shadow: 0 0 0 11px transparent; }
    100%{ box-shadow: 0 0 0 0 transparent; }
  }
  .caret { display:inline-block; width:.55ch; height:1em; background:var(--accent); vertical-align:-.12em; margin-left:2px; animation: blink 1.05s steps(1,end) infinite; }
  @keyframes blink { 50% { opacity: 0; } }

  [data-motion="off"] .dot.pulse, [data-motion="off"] .caret, [data-motion="off"] .tw-caret { animation: none; }
  [data-motion="off"] * { transition: none !important; }

  /* marquee */
  .marquee { overflow: hidden; white-space: nowrap; width: 100%; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
  .marquee-inner { display: inline-block; animation: scroll-x 26s linear infinite; }
  @keyframes scroll-x { from { transform: translateX(0); } to { transform: translateX(-50%); } }
  [data-motion="off"] .marquee-inner { animation: none; }

  ::-webkit-scrollbar { width: 0; height: 0; display: none; }
  * { scrollbar-width: none; }

  /* ── shell ───────────────────────────────────────────────────── */
  .stage { position: relative; z-index: 1; height: 100dvh; width: 100vw; overflow: hidden; }
  .track {
    display: flex; height: 100%; width: 100%;
    transition: transform .65s cubic-bezier(.7,0,.2,1);
    will-change: transform;
  }
  [data-motion="off"] .track { transition: none; }

  .panel {
    position: relative; flex: 0 0 100vw; width: 100vw; height: 100dvh;
    display: flex; flex-direction: column;
    padding: 108px var(--pad-x) 88px;
    overflow-y: auto; overflow-x: hidden;
  }
  .panel-head {
    position: absolute; top: 78px; left: var(--pad-x); right: var(--pad-x);
    display: flex; justify-content: space-between; align-items: baseline;
    border-bottom: 1px solid var(--line); padding-bottom: 12px;
  }
  .panel-inner { width: 100%; max-width: 1280px; margin: auto; }

  .topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: 56px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--pad-x); border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .brand { background: none; border: 0; color: inherit; font: inherit; display: flex; gap: 8px; align-items: baseline; padding: 0; }
  .top-nav { display: flex; gap: clamp(14px, 2vw, 26px); font-size: 12px; color: var(--ink-dim); }
  .top-nav button { background: none; border: 0; font: inherit; color: var(--ink-dim); transition: color .2s; padding: 0; }
  .top-nav button[aria-current="true"] { color: var(--accent); }
  .avail { font-size: 11px; color: var(--ink-dim); }

  .side-rail {
    position: fixed; right: clamp(14px, 3vw, 40px); top: 50%; transform: translateY(-50%);
    z-index: 40; display: flex; flex-direction: column; gap: 14px; align-items: center;
  }
  .side-rail button { background: none; border: 0; padding: 6px; display: block; }
  .side-rail i {
    display: block; width: 9px; height: 3px; border-radius: 3px; background: var(--line-2);
    transition: width .3s ease, background .3s ease;
  }
  .side-rail button[aria-current="true"] i { width: 26px; background: var(--accent); }

  .bottombar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--pad-x); border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    font-size: 12px; color: var(--ink-dim);
  }
  .bb-count { display: flex; gap: 10px; align-items: baseline; }
  .bb-nav { display: flex; gap: 10px; }
  .nav-btn {
    background: none; border: 1px solid var(--line-2); border-radius: 3px;
    color: var(--ink); font: inherit; font-size: 12px; padding: 6px 14px;
    transition: opacity .2s;
  }
  .nav-btn:disabled { color: var(--ink-faint); opacity: .4; cursor: default; }

  /* ── panel content ───────────────────────────────────────────── */
  .prompt { color: var(--ink-dim); font-size: 13px; margin-bottom: 28px; }
  .hero { margin: 0; font-size: clamp(40px, 11vw, 184px); }
  .tw-line { display: block; word-break: break-word; }
  .tw-text { color: var(--accent); }
  .tw-text[data-mono="0"] { font-family: var(--serif); font-style: italic; font-size: 1em; letter-spacing: -0.02em; }
  .tw-text[data-mono="1"] { font-family: var(--mono); font-size: 0.42em; letter-spacing: -0.01em; vertical-align: 0.18em; }
  .tw-caret {
    display: inline-block; width: .5ch; background: var(--accent); margin-left: 4px;
    animation: blink 1.05s steps(1,end) infinite;
  }
  .tw-caret[data-mono="0"] { height: .8em; vertical-align: -.06em; }
  .tw-caret[data-mono="1"] { height: .42em; vertical-align: .1em; }

  .intro-grid {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
    gap: clamp(28px, 5vw, 80px); align-items: end; margin-top: 40px;
  }
  .role { font-size: 15px; margin-bottom: 22px; min-height: 1.7em; }
  .intro-copy { margin: 0; max-width: 54ch; color: var(--ink-dim); }
  .intro-meta {
    display: flex; flex-direction: column; gap: 9px; font-size: 12px; color: var(--ink-dim);
    border-left: 1px solid var(--line-2); padding-left: 22px;
  }
  .intro-meta .go-projects {
    align-self: flex-start; margin-top: 8px; background: none; border: 0;
    border-bottom: 1px solid var(--line-2); color: var(--ink); font: inherit; padding: 0 0 1px;
    transition: color .2s, border-color .2s;
  }
  .intro-meta .go-projects:hover { color: var(--accent); border-bottom-color: var(--accent); }

  .stats { display: flex; gap: clamp(20px, 4vw, 56px); margin-top: clamp(28px, 5vh, 56px); flex-wrap: wrap; }
  .stat-n { font-size: clamp(30px, 4vw, 52px); }
  .stat-u { color: var(--accent); font-size: .55em; }
  .stat-k { color: var(--ink-dim); font-size: 11px; }

  .about-grid {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 80px); align-items: start;
  }
  .about-main { display: flex; flex-direction: column; gap: 24px; }
  .about-main h2 { margin: 0; font-size: clamp(40px, 6vw, 88px); }
  .about-main p { margin: 0; max-width: 58ch; font-size: 16px; line-height: 1.8; }
  .cv-btn {
    display: inline-flex; align-items: center; gap: 10px;
    border: 1px solid var(--accent); border-radius: 3px;
    padding: 11px 18px; color: var(--accent); font-size: 13px;
    transition: background .2s, color .2s;
  }
  .cv-btn:hover { background: var(--accent); color: var(--bg); }
  .cv-btn .meta { opacity: .6; font-size: 11px; }
  .about-side {
    display: flex; flex-direction: column; gap: 22px;
    border-left: 1px solid var(--line); padding-left: clamp(24px, 3vw, 44px);
  }
  .mail {
    display: inline-block; font-size: clamp(28px, 3.4vw, 52px); color: var(--ink);
    line-height: 1.05; transition: color .25s;
  }
  .mail:hover { color: var(--accent); }
  .socials { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; color: var(--ink-dim); font-size: 13px; }
  .social-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; transition: color .2s; }
  .social-link svg { flex-shrink: 0; }
  .meta-list { margin: 8px 0 0; display: flex; flex-direction: column; gap: 14px; font-size: 12px; }
  .meta-list > div { border-bottom: 1px solid var(--line); padding-bottom: 11px; }
  .meta-list dt { margin-bottom: 4px; }
  .meta-list dd { margin: 0; }

  .oss-head { margin: 0 0 24px; font-size: clamp(36px, 5vw, 72px); }
  .heatmap {
    display: grid; grid-template-columns: repeat(52, 1fr); grid-auto-flow: column;
    grid-template-rows: repeat(7, 1fr); gap: 3px; aspect-ratio: 52/7; width: 100%; max-width: 760px;
  }
  .heatmap i { border-radius: 2px; }
  .heat-axis {
    display: flex; justify-content: space-between; max-width: 760px;
    color: var(--ink-faint); font-size: 11px; margin: 10px 0 28px;
  }
  .oss-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
  .oss-row {
    display: grid; grid-template-columns: minmax(170px, 1.2fr) minmax(0, 2.6fr) 80px;
    gap: clamp(14px, 2vw, 32px); align-items: baseline;
    padding: 11px 0; border-bottom: 1px solid var(--line);
  }
  .oss-handle { color: var(--ink-faint); font-size: 11px; margin-top: 2px; }
  .oss-desc { color: var(--ink-dim); font-size: 13px; }
  .oss-stat { color: var(--accent-2); font-size: 12px; text-align: right; }

  .work-head { margin: 0 0 22px; font-size: clamp(36px, 5vw, 72px); }
  .proj-list { border-top: 1px solid var(--line-2); }
  .proj-row {
    display: grid; grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: clamp(14px, 2vw, 32px); align-items: baseline; width: 100%;
    color: inherit; border-bottom: 1px solid var(--line); padding: 15px 0;
  }
  .proj-n { color: var(--ink-faint); font-size: 12px; }
  .proj-row .wt { font-size: clamp(24px, 3vw, 40px); transition: color .2s; }
  .proj-arr { color: var(--ink-faint); display: inline-flex; align-items: center; transition: color .2s, transform .2s; }

  /* ── responsive ──────────────────────────────────────────────── */
  /* tablet & down: collapse two-column grids, drop side rail + top nav */
  @media (max-width: 860px) {
    :root { --pad-x: clamp(18px, 5vw, 44px); --size-body: 13px; }
    .panel { padding: 92px var(--pad-x) 84px !important; }
    .panel-head { top: 64px !important; }
    .intro-grid, .about-grid { grid-template-columns: 1fr !important; align-items: start !important; }
    .intro-meta {
      border-left: 0 !important; padding-left: 0 !important;
      border-top: 1px solid var(--line-2); padding-top: 20px;
    }
    .about-side {
      border-left: 0 !important; padding-left: 0 !important;
      border-top: 1px solid var(--line); padding-top: 26px;
    }
    .side-rail { display: none !important; }
    .top-nav { display: none !important; }
    .oss-row { grid-template-columns: 1fr auto !important; row-gap: 4px !important; }
    .oss-row .oss-stat { text-align: left !important; grid-column: 2; grid-row: 1; }
  }
  /* phone: tighten chrome, single-column project rows */
  @media (max-width: 560px) {
    :root { --pad-x: 16px; }
    .panel { padding: 80px var(--pad-x) 76px !important; }
    .panel-head { display: none !important; }
    .proj-row { grid-template-columns: 30px 1fr auto !important; gap: 14px !important; }
    .oss-row { grid-template-columns: 1fr !important; }
    .oss-row .oss-stat { grid-column: 1; grid-row: auto; }
    .avail { display: none !important; }
    .bb-name { display: none !important; }
  }
  /* short landscape: never center-clip, allow scroll */
  @media (max-height: 620px) {
    .panel { padding-top: 76px !important; padding-bottom: 72px !important; }
    .panel-inner { margin: 0 auto !important; }
  }
