:root {
    --bg: #0a0a0a;
    --bg-soft: #101010;
    --text-hi: #f5f5f3;
    --text: #c9c9c4;
    --text-lo: #8a8a85;
    --text-faint: #5c5c58;
    --line: rgba(255,255,255,.08);
    --line-strong: rgba(255,255,255,.16);
    --accent: #6ee7a0;
    --accent-ink: #052e16;
    --glow: rgba(110,231,160,.07);
    --spot: rgba(110,231,160,.05);
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --serif: 'Newsreader', Georgia, serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --col: 720px;
    --col-wide: 980px;
    --ease: cubic-bezier(.22,1,.36,1);
    --ease-out: cubic-bezier(.16,1,.3,1);
  }
  [data-theme="light"] {
    --bg: #fcfcfa;
    --bg-soft: #f4f4f1;
    --text-hi: #16161a;
    --text: #3c3c41;
    --text-lo: #6f6f74;
    --text-faint: #9c9ca1;
    --line: rgba(20,20,24,.09);
    --line-strong: rgba(20,20,24,.2);
    --accent: #0f8a4d;
    --accent-ink: #ffffff;
    --glow: rgba(15,138,77,.05);
    --spot: rgba(15,138,77,.04);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  ::selection { background: var(--accent); color: var(--accent-ink); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

  body {
    background: var(--bg); color: var(--text);
    font-family: var(--sans); font-size: 16px; line-height: 1.65;
    font-feature-settings: 'cv11','ss01';
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-x: hidden;
  }
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }
  body.locked { overflow: hidden; }
  body::after {
    content: ''; position: fixed; inset: 0; z-index: 999; pointer-events: none;
    opacity: .035; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  /* theme wipe via view transitions */
  ::view-transition-old(root) { animation: none; }
  ::view-transition-new(root) { animation: wipe .55s var(--ease-out); clip-path: circle(0% at var(--wipe-x, 95%) var(--wipe-y, 5%)); }
  @keyframes wipe { to { clip-path: circle(150% at var(--wipe-x, 95%) var(--wipe-y, 5%)); } }

  .wrap { max-width: var(--col); margin: 0 auto; padding: 0 24px; }
  a { color: inherit; }
  .u {
    color: var(--text-hi); text-decoration: none;
    background-image: linear-gradient(var(--line-strong), var(--line-strong));
    background-size: 100% 1px; background-position: 0 100%; background-repeat: no-repeat;
    transition: color .2s;
  }
  .u:hover { color: var(--accent); background-image: linear-gradient(var(--accent), var(--accent)); }
  .serif-i { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: .01em; }

  /* ============ preloader ============ */
  #boot {
    position: fixed; inset: 0; z-index: 2000; background: #0a0a0a;
    display: flex; align-items: center; justify-content: center;
    transition: transform .65s var(--ease-out);
  }
  #boot.done { transform: translateY(-100%); }
  #boot pre {
    font-family: var(--mono); font-size: 13px; line-height: 2; color: #8a8a85;
    min-width: 300px;
  }
  #boot pre .ok { color: #6ee7a0; }
  #boot pre .p { color: #6ee7a0; }

  /* ============ custom cursor ============ */
  #cursor-dot, #cursor-ring {
    position: fixed; top: 0; left: 0; pointer-events: none; z-index: 1500;
    border-radius: 50%; transform: translate(-50%,-50%); display: none;
  }
  body.has-cursor #cursor-dot, body.has-cursor #cursor-ring { display: block; }
  #cursor-dot { width: 6px; height: 6px; background: var(--accent); }
  #cursor-ring {
    width: 34px; height: 34px; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
    transition: width .25s var(--ease), height .25s var(--ease), border-color .25s, background .25s;
  }
  #cursor-ring.hot { width: 56px; height: 56px; background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }

  /* ============ reveals ============ */
  .reveal { opacity: 0; transform: translateY(16px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
  .reveal.in { opacity: 1; transform: none; }
  .line-mask { display: block; overflow: hidden; }
  .line-mask > span { display: block; transform: translateY(112%) rotate(1.5deg); transform-origin: 0 100%; transition: transform 1.1s var(--ease-out); }
  .loaded .line-mask > span { transform: none; }
  .line-mask:nth-child(2) > span { transition-delay: .1s; }
  @media (prefers-reduced-motion: reduce) {
    .reveal, .line-mask > span { opacity: 1; transform: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
    .logo .cursor, .status .dot { animation: none !important; }
    .marquee-track, .name-track { animation: none !important; }
    #boot { display: none; }
    ::view-transition-new(root) { animation: none; clip-path: none; }
  }

  /* ============ nav ============ */
  nav { position: sticky; top: 0; z-index: 50; }
  nav::before {
    content: ''; position: absolute; inset: 0;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--line);
  }
  #scroll-progress { position: absolute; bottom: -1px; left: 0; height: 1px; width: 0; background: var(--accent); z-index: 1; }
  .nav-inner { position: relative; max-width: var(--col-wide); margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 26px; }
  .logo { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--accent); text-decoration: none; }
  .logo .cursor { animation: blink 1.2s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }
  .nav-links { margin-left: auto; display: flex; align-items: center; gap: 22px; }
  .nav-links > a {
    font-size: 13.5px; font-weight: 500; color: var(--text-lo); text-decoration: none;
    position: relative; transition: color .2s;
  }
  .nav-links > a::after {
    content: ''; position: absolute; left: 0; right: 100%; bottom: -4px; height: 1.5px;
    background: var(--accent); transition: right .25s var(--ease);
  }
  .nav-links > a:hover { color: var(--text-hi); }
  .nav-links > a.active { color: var(--text-hi); }
  .nav-links > a.active::after, .nav-links > a:hover::after { right: 0; }
  .kbd-hint {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--mono); font-size: 11px; color: var(--text-faint);
    border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
    cursor: pointer; background: none; transition: all .2s;
  }
  .kbd-hint:hover { color: var(--text-lo); border-color: var(--line-strong); }
  #theme-toggle {
    width: 30px; height: 30px; display: grid; place-items: center;
    background: none; border: 1px solid var(--line); border-radius: 50%;
    color: var(--text-lo); cursor: pointer; font-size: 13px; transition: all .2s;
  }
  #theme-toggle:hover { color: var(--text-hi); border-color: var(--line-strong); transform: rotate(40deg); }
  .nav-resume {
    font-size: 13px; font-weight: 600; color: var(--accent-ink) !important;
    background: var(--accent); padding: 7px 15px; border-radius: 999px;
    text-decoration: none; display: inline-block; transition: filter .2s;
  }
  .nav-resume:hover { filter: brightness(1.08); }

  /* ============ hero ============ */
  .hero { position: relative; padding: 130px 0 64px; }
  #graph-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none; opacity: .85;
    -webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 35%, black 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 75% 85% at 50% 35%, black 30%, transparent 75%);
  }
  .hero-glow {
    position: absolute; top: -220px; left: 50%; transform: translateX(-50%);
    width: 940px; height: 560px; pointer-events: none;
    background: radial-gradient(ellipse at center, var(--glow), transparent 65%);
    will-change: transform;
  }
  .hero .wrap { position: relative; }
  .status {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-lo); font-weight: 500;
    border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 10px;
    margin-bottom: 36px; background: color-mix(in srgb, var(--bg) 70%, transparent);
    backdrop-filter: blur(4px); font-family: var(--mono); font-size: 12px;
  }
  .status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2.4s var(--ease) infinite; }
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
  }
  h1 { font-size: clamp(42px, 7.2vw, 68px); font-weight: 700; letter-spacing: -.04em; line-height: 1.03; color: var(--text-hi); text-wrap: balance; }
  h1 .serif-i { font-size: 1.04em; font-weight: 500; }
  h1 .grad { background: linear-gradient(100deg, var(--text-hi) 30%, var(--accent) 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .hero-sub { margin-top: 28px; font-size: 17.5px; line-height: 1.7; color: var(--text-lo); max-width: 600px; text-wrap: pretty; }
  .hero-sub strong { color: var(--text); font-weight: 550; }
  .hero-cta { margin-top: 40px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
  .btn-main {
    display: inline-flex; align-items: center; gap: 9px;
    background: var(--text-hi); color: var(--bg);
    font-size: 14px; font-weight: 600; text-decoration: none;
    padding: 13px 26px; border-radius: 999px;
    transition: box-shadow .25s; will-change: transform;
  }
  .btn-main:hover { box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--text-hi) 45%, transparent); }
  .btn-main svg { transition: transform .2s var(--ease); }
  .btn-main:hover svg { transform: translateX(3px); }
  .hero-links { display: flex; gap: 18px; font-size: 14px; }

  /* ============ stats ============ */
  .stats {
    margin: 92px auto 0; max-width: var(--col-wide);
    display: grid; grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    position: relative; background: color-mix(in srgb, var(--bg) 55%, transparent);
    backdrop-filter: blur(3px);
  }
  .stat { padding: 34px 28px; position: relative; }
  .stat + .stat::before { content: ''; position: absolute; left: 0; top: 24px; bottom: 24px; width: 1px; background: var(--line); }
  .stat b { display: block; font-family: var(--mono); font-weight: 500; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.03em; color: var(--text-hi); }
  .stat b .unit { color: var(--accent); font-size: .72em; margin-left: 2px; }
  .stat span { display: block; margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--text-faint); }

  /* ============ marquee ============ */
  .marquee {
    padding: 18px 0; overflow: hidden; white-space: nowrap;
    border-bottom: 1px solid var(--line); user-select: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
  }
  .marquee-track { display: inline-flex; animation: scroll 36s linear infinite; }
  .marquee:hover .marquee-track { animation-play-state: paused; }
  @keyframes scroll { to { transform: translateX(-50%); } }
  .marquee span { font-family: var(--mono); font-size: 12.5px; color: var(--text-faint); padding: 0 22px; letter-spacing: .04em; }
  .marquee span::after { content: '·'; margin-left: 44px; color: var(--accent); }

  /* ============ sections ============ */
  section { padding: 110px 0 0; }
  .sec-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 52px; position: relative; }
  .sec-head h2 { font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); font-family: var(--mono); }
  .sec-head .ghost {
    position: absolute; right: 0; top: -42px;
    font-size: 110px; font-weight: 800; letter-spacing: -.05em; line-height: 1;
    color: transparent; -webkit-text-stroke: 1px var(--line); pointer-events: none;
    font-variant-numeric: tabular-nums;
  }
  .sec-head::after { content: ''; flex: 1; height: 1px; background: var(--line); transform: translateY(-4px); }

  /* ============ experience ============ */
  .xp { display: grid; grid-template-columns: 148px 1fr; gap: 24px; padding: 28px 0; border-top: 1px solid var(--line); }
  .xp:last-of-type { border-bottom: 1px solid var(--line); }
  .xp .when { font-family: var(--mono); font-size: 12.5px; color: var(--text-faint); padding-top: 4px; }
  .xp h3 { font-size: 17px; font-weight: 600; color: var(--text-hi); letter-spacing: -.01em; }
  .xp .role { font-size: 14.5px; color: var(--text-lo); margin-top: 1px; }
  .xp .sum { margin-top: 12px; font-size: 15px; color: var(--text-lo); line-height: 1.7; text-wrap: pretty; }
  .xp .sum b, .xp li b { color: var(--text); font-weight: 550; }
  .xp ul { margin-top: 12px; list-style: none; }
  .xp li { position: relative; padding-left: 20px; margin-bottom: 8px; font-size: 14.5px; color: var(--text-lo); line-height: 1.65; }
  .xp li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); font-size: 12px; top: 3px; }

  /* ============ stacking + tilting case cards ============ */
  .case-stack { display: grid; gap: 28px; perspective: 1200px; }
  .case-card {
    --mx: 50%; --my: 50%; --angle: 0deg;
    position: sticky; top: 96px;
    background: color-mix(in srgb, var(--bg-soft) 92%, var(--accent));
    border: 1px solid var(--line); border-radius: 20px;
    padding: 36px 40px; text-decoration: none; color: inherit;
    box-shadow: 0 -12px 40px -20px rgba(0,0,0,.6);
    overflow: hidden; will-change: transform;
  }
  /* animated conic border on hover */
  .case-card::after {
    content: ''; position: absolute; inset: 0; border-radius: 20px; padding: 1px;
    background: conic-gradient(from var(--angle), transparent 0%, var(--accent) 12%, transparent 28%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .4s; pointer-events: none;
  }
  @property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
  .case-card:hover::after { opacity: .8; animation: spin-border 3.2s linear infinite; }
  @keyframes spin-border { to { --angle: 360deg; } }
  .case-card::before {
    content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .4s;
    background: radial-gradient(480px circle at var(--mx) var(--my), var(--spot), transparent 70%);
    pointer-events: none;
  }
  .case-card:hover::before { opacity: 1; }
  .case-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  .case-card .num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
  .case-card h3 { font-size: clamp(22px, 3.4vw, 30px); font-weight: 650; letter-spacing: -.025em; color: var(--text-hi); display: flex; align-items: center; gap: 14px; }
  .case-card h3 .arrow { font-size: .75em; color: var(--text-faint); transition: transform .3s var(--ease), color .3s; }
  .case-card:hover h3 .arrow { transform: translate(4px,-4px); color: var(--accent); }
  .case-card .metric {
    margin-left: auto; font-family: var(--mono); font-size: 12.5px; font-weight: 500;
    color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    padding: 5px 14px; border-radius: 999px; white-space: nowrap;
  }
  .case-card .tags { display: flex; gap: 8px; margin-top: 14px; }
  .case-card .tags span { font-family: var(--mono); font-size: 11px; color: var(--text-faint); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
  .case-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 26px; margin-top: 26px; }
  .case-cols h4 { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 7px; }
  .case-cols p { font-size: 13.5px; line-height: 1.65; color: var(--text-lo); text-wrap: pretty; }
  .case-cols b { color: var(--text); font-weight: 550; }

  /* ============ writing ============ */
  .note-row { display: flex; align-items: baseline; gap: 20px; padding: 22px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
  .note-row:last-of-type { border-bottom: 1px solid var(--line); }
  .note-row h3 { font-size: clamp(17px, 2.4vw, 21px); font-weight: 550; color: var(--text-hi); letter-spacing: -.015em; transition: transform .3s var(--ease), color .2s; }
  .note-row:hover h3 { color: var(--accent); transform: translateX(8px); }
  .note-row p { font-size: 13.5px; color: var(--text-faint); margin-top: 4px; transition: transform .3s var(--ease) .03s; }
  .note-row:hover p { transform: translateX(8px); }
  .note-row .meta { margin-left: auto; display: flex; gap: 16px; font-family: var(--mono); font-size: 12px; color: var(--text-faint); white-space: nowrap; }
  .more-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; font-size: 14px; font-weight: 550; color: var(--text-lo); text-decoration: none; transition: color .2s, gap .2s var(--ease); }
  .more-link:hover { color: var(--accent); gap: 12px; }

  /* ============ skills / background ============ */
  .meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
  .meta-grid h4 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; font-weight: 500; }
  .skill-line { display: flex; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
  .skill-line:last-child { border-bottom: 1px solid var(--line); }
  .skill-line dt { font-family: var(--mono); font-size: 12px; color: var(--text-faint); min-width: 92px; padding-top: 2px; }
  .skill-line dd { color: var(--text-lo); }
  .edu-line { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
  .edu-line:last-child { border-bottom: 1px solid var(--line); }
  .edu-line b { color: var(--text-hi); font-weight: 550; display: block; }
  .edu-line span { color: var(--text-faint); font-size: 13px; }
  .edu-line a { color: var(--text-lo); }
  .edu-line a:hover { color: var(--accent); }

  /* ============ big CTA with letter wave ============ */
  .cta-big { padding: 150px 0 90px; text-align: center; position: relative; }
  .cta-big .small { font-family: var(--mono); font-size: 12.5px; color: var(--text-faint); letter-spacing: .14em; text-transform: uppercase; }
  .cta-big a.huge {
    display: inline-block; margin-top: 18px; text-decoration: none;
    font-size: clamp(44px, 9vw, 96px); font-weight: 750; letter-spacing: -.045em; line-height: 1.04;
    color: var(--text-hi);
    background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 0% 4px;
    transition: background-size .5s var(--ease), color .3s;
    padding-bottom: 10px;
  }
  .cta-big a.huge:hover { background-size: 100% 4px; color: var(--accent); }
  .cta-big a.huge .ch { display: inline-block; transition: transform .35s var(--ease); }
  .cta-big a.huge:hover .ch { transform: translateY(-10px); }
  .cta-big a.huge:hover .ch:nth-child(2n) { transition-delay: .03s; }
  .cta-big a.huge:hover .ch:nth-child(3n) { transition-delay: .06s; }
  .cta-big a.huge:hover .ch:nth-child(5n) { transition-delay: .09s; }
  .cta-big .sub { margin-top: 22px; font-size: 15px; color: var(--text-lo); }
  .cta-big .sub a { color: var(--text); }

  /* ============ giant name marquee ============ */
  .name-marquee {
    overflow: hidden; white-space: nowrap; user-select: none; padding: 20px 0 0;
    border-top: 1px solid var(--line);
  }
  .name-track { display: inline-flex; animation: scroll 30s linear infinite; }
  .name-track span {
    font-size: clamp(80px, 14vw, 160px); font-weight: 800; letter-spacing: -.04em; line-height: 1;
    color: transparent; -webkit-text-stroke: 1px var(--line-strong);
    padding-right: 60px;
  }
  .name-track span i { font-style: normal; -webkit-text-stroke: 0; color: var(--accent); }

  /* ============ footer ============ */
  footer { border-top: 1px solid var(--line); margin-top: -30px; }
  .foot-inner {
    max-width: var(--col-wide); margin: 0 auto; padding: 36px 24px 52px;
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    font-size: 13.5px; color: var(--text-faint);
  }
  .foot-inner .right { margin-left: auto; display: flex; gap: 20px; align-items: center; }
  .foot-inner a { color: var(--text-lo); text-decoration: none; transition: color .2s; }
  .foot-inner a:hover { color: var(--text-hi); }
  #local-time { font-family: var(--mono); font-size: 12.5px; }

  /* ============ command palette ============ */
  #palette-overlay { position: fixed; inset: 0; z-index: 200; display: none; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(6px); }
  #palette-overlay.open { display: block; }
  #palette {
    position: absolute; top: 18vh; left: 50%; transform: translateX(-50%);
    width: min(560px, calc(100vw - 32px));
    background: color-mix(in srgb, var(--bg-soft) 96%, var(--accent));
    border: 1px solid var(--line-strong); border-radius: 14px;
    box-shadow: 0 32px 80px -24px rgba(0,0,0,.6);
    overflow: hidden; font-family: var(--mono); animation: pop .18s var(--ease);
  }
  @keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.98); } }
  .pal-input-row { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
  .pal-input-row .prompt-c { color: var(--accent); font-size: 14px; }
  #pal-input { flex: 1; background: none; border: none; outline: none; color: var(--text-hi); font-family: var(--mono); font-size: 14px; }
  #pal-input::placeholder { color: var(--text-faint); }
  #pal-list { max-height: 320px; overflow-y: auto; padding: 8px; }
  .pal-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; color: var(--text-lo); }
  .pal-item .ic { width: 18px; text-align: center; color: var(--text-faint); }
  .pal-item .kbd { margin-left: auto; font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
  .pal-item.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text-hi); }
  .pal-item.sel .ic { color: var(--accent); }
  .pal-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 13px; }
  .pal-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--text-faint); }

  @media (max-width: 760px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .stat { padding: 24px 20px; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
    .xp { grid-template-columns: 1fr; gap: 6px; }
    .case-card { position: static; padding: 26px 22px; }
    .case-card .metric { display: none; }
    .case-cols { grid-template-columns: 1fr; gap: 16px; }
    .meta-grid { grid-template-columns: 1fr; gap: 48px; }
    .hero { padding-top: 80px; }
    section { padding-top: 84px; }
    .sec-head .ghost { display: none; }
    .note-row { flex-wrap: wrap; }
    .note-row .meta { margin-left: 0; width: 100%; order: -1; }
    .kbd-hint { display: none; }
  }

/* ============ article / case-study pages ============ */
.page-grid { max-width: 1020px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: minmax(0, 680px) 200px; gap: 64px; justify-content: center; }
article.post-body { padding: 64px 0 96px; }
.crumb { font-family: var(--mono); font-size: 12.5px; color: var(--text-faint); }
.crumb a { color: var(--text-faint); text-decoration: none; transition: color .2s; }
.crumb a:hover { color: var(--accent); }
.post-title { margin-top: 16px; font-size: clamp(30px, 5vw, 44px); font-weight: 700; letter-spacing: -.03em; line-height: 1.12; color: var(--text-hi); text-wrap: balance; }
.post-meta { margin-top: 16px; display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 12.5px; color: var(--text-faint); flex-wrap: wrap; }
.post-tags { margin-top: 14px; display: flex; gap: 8px; }
.post-tags span { font-family: var(--mono); font-size: 11px; color: var(--text-faint); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

.prose { margin-top: 44px; font-size: 17px; line-height: 1.78; color: var(--text); }
.prose > * + * { margin-top: 1.2em; }
.prose p { text-wrap: pretty; }
.prose h2 { font-size: 23px; font-weight: 650; letter-spacing: -.02em; color: var(--text-hi); margin-top: 2.1em; scroll-margin-top: 90px; }
.prose h3 { font-size: 18px; font-weight: 600; color: var(--text-hi); margin-top: 1.6em; scroll-margin-top: 90px; }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.prose a:hover { border-bottom-color: var(--accent); }
.prose strong { color: var(--text-hi); font-weight: 600; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { border-left: 2px solid var(--accent); padding: 4px 0 4px 20px; color: var(--text-lo); font-family: var(--serif); font-style: italic; font-size: 18.5px; }
.prose code { font-family: var(--mono); font-size: .82em; background: var(--bg-soft); border: 1px solid var(--line); padding: 2px 6px; border-radius: 5px; color: var(--accent); }
.prose pre { background: #0c0e10; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; overflow-x: auto; font-size: 13px; line-height: 1.7; }
[data-theme="light"] .prose pre { background: #14181f; }
.prose pre code { background: none; border: none; padding: 0; color: #c9c9c4; }
.prose pre .c { color: #5c5c58; } .prose pre .k { color: #c792ea; } .prose pre .s { color: #6ee7a0; } .prose pre .f { color: #7dd3fc; }
.prose .callout { display: flex; gap: 12px; background: color-mix(in srgb, var(--accent) 7%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 12px; padding: 16px 18px; font-size: 15px; line-height: 1.65; color: var(--text); }
.prose .callout .ic { color: var(--accent); font-family: var(--mono); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th { text-align: left; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--line-strong); padding: 8px 12px; }
.prose td { border-bottom: 1px solid var(--line); padding: 9px 12px; color: var(--text-lo); }
.prose td:first-child { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose figure { margin: 1.8em 0; }
.prose figcaption { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--text-faint); font-family: var(--mono); }
.diagram { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 24px; overflow-x: auto; }
.diagram pre { background: none; border: none; padding: 0; color: var(--text-lo); font-size: 12.5px; line-height: 1.6; }

aside.toc-rail { padding-top: 76px; }
.toc { position: sticky; top: 90px; font-size: 12.5px; font-family: var(--mono); }
.toc h4 { font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px; }
.toc a { display: block; color: var(--text-faint); text-decoration: none; padding: 4px 0 4px 12px; border-left: 1px solid var(--line); transition: color .15s, border-color .15s; line-height: 1.5; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

.post-footer { margin-top: 64px; border-top: 1px solid var(--line); padding-top: 32px; }
.author-card { display: flex; gap: 16px; align-items: center; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.author-card .av { width: 48px; height: 48px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); display: grid; place-items: center; font-family: var(--mono); font-size: 13px; color: var(--accent); flex-shrink: 0; }
.author-card h4 { font-size: 15px; font-weight: 600; color: var(--text-hi); }
.author-card p { font-size: 13.5px; color: var(--text-lo); margin-top: 2px; line-height: 1.5; }
.author-card a { color: var(--accent); text-decoration: none; }
.author-card a:hover { text-decoration: underline; }
.next-prev { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.np { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color .2s, transform .2s var(--ease); }
.np:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.np span { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.np b { display: block; font-size: 14.5px; font-weight: 600; color: var(--text-hi); margin-top: 4px; }
.np.next { text-align: right; }

/* notes index */
.list-hero { padding: 88px 0 16px; }
.list-hero h1 { font-size: clamp(32px, 5.4vw, 48px); }
.list-hero p { margin-top: 14px; color: var(--text-lo); font-size: 16px; max-width: 560px; }

@media (max-width: 920px) { .page-grid { grid-template-columns: minmax(0, 680px); } aside.toc-rail { display: none; } }
@media (max-width: 640px) { .prose { font-size: 16px; } article.post-body { padding-top: 40px; } .next-prev { grid-template-columns: 1fr; } }

/* ============ company chips (experience) ============ */
.xp-head { display: flex; align-items: center; gap: 14px; }
.co-chip {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text-faint);
  transition: color .25s, border-color .25s;
}
.co-chip img { width: 19px; height: 19px; display: block; filter: grayscale(1) opacity(.55); transition: filter .25s; }
[data-theme="dark"] .co-chip img, :root:not([data-theme="light"]) .co-chip img { filter: grayscale(1) invert(.7) opacity(.7); }
.xp:hover .co-chip { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.xp:hover .co-chip img { filter: none; }

/* ===== PORT-ADDENDUM: ported-note support ===== */
.post-dek{font-size:19px;color:var(--text-lo);line-height:1.6;margin:16px 0 0;text-wrap:pretty;}
.prose .takeaways{background:var(--bg-soft);border:1px solid var(--line);border-radius:12px;padding:18px 22px;margin-top:2.2em;}
.prose .takeaways h3{margin-top:0;font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-faint);font-weight:500;}
.prose .takeaways ul{padding-left:20px;margin-top:.6em;} .prose .takeaways li{color:var(--text-lo);}
.diagram{background:#f6f5f1 !important;}
