  :root {
    --bg: #fbfaf6;
    --fg: #14130f;
    --muted: #5d5b54;
    --line: #1414140f;
    --accent-violet: #d8c8ff;
    --accent-yellow: #fde58a;
    --accent-mint: #b9ecd5;
    --accent-blush: #ffd0c2;
    --accent-sky: #c8e1ff;
    --accent-lime: #e1f0a3;
    --snowflake: #d94a4a;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --sans: 'Inter', -apple-system, system-ui, sans-serif;
    --dot-green: #2bb673;
    --dot-glow-sm: #2bb6731f;
    --dot-glow-lg: #2bb67308;
    --now-bg: #14130f;
    --now-fg: #f5f3ec;
    --now-muted: #9c998c;
    --tag-bg: #f1eee5;
    --tag-fg: #4a4840;
    --stack-muted: #6f6c61;
  }
  * { box-sizing: border-box; }
  html { margin: 0; padding: 0; scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
  body { margin: 0; padding: 0; }
  body {
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.55;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
  }
  a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
  a:hover { opacity: 0.6; }

  /* Decorative snowflakes — falling, scattered through the whole document */
  .snow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
  }
  .flake {
    position: absolute;
    color: var(--snowflake);
    font-family: var(--mono);
    font-variant-emoji: text;
    user-select: none;
    will-change: transform, opacity;
    opacity: 0.35;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
  }
  @keyframes fall {
    0%   { transform: translate3d(-12px, 0, 0)   rotate(0deg);   opacity: 0; }
    10%  { opacity: 0.35; }
    50%  { transform: translate3d( 12px, 50vh, 0) rotate(180deg); }
    90%  { opacity: 0.35; }
    100% { transform: translate3d(-12px, 100vh, 0) rotate(360deg); opacity: 0; }
  }

  .page {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 64px 56px 120px;
    z-index: 1;
  }

  /* ---------- Top bar ---------- */
  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 80px;
  }
  .topbar .right { display: flex; gap: 20px; }
  .topbar a { border-bottom: none; }
  .topbar a:hover { color: var(--fg); opacity: 1; }
  .dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--dot-green); margin-right: 6px; transform: translateY(-1px);
    box-shadow: 0 0 0 3px var(--dot-glow-sm);
    animation: dot-pulse 2.4s ease-in-out infinite;
  }
  @keyframes dot-pulse {
    0%, 100% {
      box-shadow: 0 0 0 3px var(--dot-glow-sm);
      opacity: 1;
    }
    50% {
      box-shadow: 0 0 0 6px var(--dot-glow-lg);
      opacity: 0.55;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .dot { animation: none; }
  }

  /* ---------- HERO ---------- */
  .hero {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 56px;
    align-items: start;
    margin-bottom: 110px;
    position: relative;
  }

  /* photo stack — three identical photo cards offset+rotated, each tilts toward the mouse */
  .photo-stack {
    position: relative;
    width: 240px;
    height: 290px;
    justify-self: end;
    perspective: 1200px;
    margin-right: 60px;
    margin-top: 40px;
  }
  .photo-stack .card {
    position: absolute;
    top: 0; left: 0;
    width: 240px;
    height: 290px;
    border-radius: 20px;
    overflow: hidden;
    background: url('../images/profile-static.webp') center/cover no-repeat;
    box-shadow: 0 18px 40px -22px rgba(20,19,15,0.25);
    transform-style: preserve-3d;
    will-change: transform;
  }
  /* by default, all three cards sit on top of each other — the back ones are
     barely visible. mouse motion is what spreads them apart. */
  .photo-stack .card.back  { top: 0; left: 0; opacity: 0.32; }
  .photo-stack .card.mid   { top: 0; left: 0; opacity: 0.6;  }
  .photo-stack .card.front { top: 0; left: 0; opacity: 1; background-image: none; }
  .profile-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* intro tree */
  .tree { font-family: var(--mono); font-size: 15px; line-height: 1.85; }
  .tree .greet {
    font-size: 18px;
    font-weight: 500;
    margin-top: 0;
    margin-bottom: 6px;
  }
  .tree .role {
    color: var(--muted);
    margin-bottom: 22px;
  }
  .tree .branch { display: flex; align-items: center; gap: 10px; }
  .tree .branch .glyph { color: var(--muted); }
  .tree .group-label { margin-top: 18px; margin-bottom: 4px; }
  .tree .group-label .glyph { color: var(--muted); }

  .pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 12px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--fg);
    line-height: 1.7;
    white-space: nowrap;
  }
  .pill.violet { background: var(--accent-violet); }
  .pill.yellow { background: var(--accent-yellow); }
  .pill.mint   { background: var(--accent-mint); }
  .pill.blush  { background: var(--accent-blush); }
  .pill.sky    { background: var(--accent-sky); }
  .pill.lime   { background: var(--accent-lime); }
  .pill a { border: none; }

  /* ---------- Section heading ---------- */
  .section { margin-top: 96px; position: relative; scroll-margin-top: 32px; }
  .section h2 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 28px;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .section h2::before {
    content: "";
    width: 26px; height: 1px; background: var(--muted);
    display: inline-block;
  }

  /* ---------- About ---------- */
  .about {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.75;
  }
  .about p { margin: 0 0 16px; }
  .about .lead { color: var(--fg); }
  .about .secondary { color: var(--muted); }

  /* ---------- Experience ---------- */
  .xp-list { display: flex; flex-direction: column; }
  .xp-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 32px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
    align-items: baseline;
  }
  .xp-row:last-child { border-bottom: 1px solid var(--line); }
  .xp-row .when { color: var(--muted); font-size: 12px; }
  .xp-row .what { font-family: var(--mono); font-size: 15px; }
  .xp-row .what .role { font-weight: 500; }
  .xp-row .what .org  { color: var(--muted); }
  .xp-row .what .org a { border-color: currentColor; }
  .xp-row .where { color: var(--muted); font-size: 12px; }
  .xp-row .desc { grid-column: 2 / 3; color: var(--muted); font-size: 13px; margin-top: 4px; }

  /* ---------- Selected work ---------- */
  .work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
  .work {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex; flex-direction: column;
  }
  .work:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -28px rgba(0,0,0,0.18); }
  .work .thumb {
    aspect-ratio: 16 / 9;
    background-size: 14px 14px;
    background-image: repeating-linear-gradient(135deg,#eceae3 0 6px,#dcd8cc 6px 12px);
    position: relative;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    color: #6c6a60;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
  }
  .work .thumb.v1 { background-image: linear-gradient(135deg,#1d2030 0%,#3b3050 100%); color: #fff8; }
  .work .thumb.v2 { background-image: linear-gradient(135deg,#fde58a 0%,#ffd0c2 100%); color: #00000080; }
  .work .thumb.v3 { background-image: linear-gradient(135deg,#b9ecd5 0%,#c8e1ff 100%); color: #00000080; }
  .work .thumb.v4 { background-image: linear-gradient(135deg,#14130f 0%,#3a382f 100%); color: #fff8; }
  .work .body { padding: 20px 22px 22px; }
  .work .meta { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
  .work .title { font-family: var(--mono); font-size: 16px; font-weight: 500; margin-bottom: 6px; }
  .work .blurb { font-size: 13px; color: var(--muted); line-height: 1.6; }
  .work .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
  .tag {
    font-size: 11px; padding: 2px 8px; border-radius: 999px;
    background: var(--tag-bg); color: var(--tag-fg); font-family: var(--mono);
  }

  /* ---------- News / Recognition ---------- */
  .twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
  .twocol h3 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg);
    margin: 0 0 18px;
  }
  .stack-list { font-family: var(--mono); font-size: 14px; line-height: 1.9; }
  .stack-list .item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
  .stack-list .item:last-child { border-bottom: 1px solid var(--line); }
  .stack-list .item .yr { color: var(--muted); width: 50px; flex: none; }
  .stack-list .item .body { flex: 1; }
  .stack-list .item .body .sub { color: var(--muted); font-size: 12px; }

  /* ---------- Now ---------- */
  .now-card {
    background: var(--now-bg);
    color: var(--now-fg);
    border-radius: 22px;
    padding: 36px 40px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 36px;
    align-items: start;
    font-family: var(--mono);
  }
  .now-card .nlabel {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--now-muted);
  }
  .now-card .nbig {
    font-family: var(--sans);
    font-size: 38px;
    line-height: 1;
    font-weight: 600;
    margin-top: 8px;
    color: #fff;
  }
  .now-card .ndate { font-size: 11px; color: var(--now-muted); margin-top: 14px; }
  .now-card ul { margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.8; }
  .now-card ul li { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; }
  .now-card ul li .glyph { color: var(--stack-muted); flex: none; }
  .now-card ul li .content { flex: 1; }
  .now-card ul li .pill { color: var(--fg); }

  /* ---------- Footer ---------- */
  .footer {
    margin-top: 96px;
    padding-top: 28px;
    scroll-margin-top: 32px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 32px;
    font-family: var(--mono);
    font-size: 13px;
  }
  .footer h3 {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
  }
  .footer .col p, .footer .col a { display: block; margin: 0 0 4px; color: var(--fg); border-bottom: none; }
  .footer .col a:hover { color: var(--muted); }
  .footer .meta-line {
    grid-column: 1 / -1;
    display: flex; justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
    padding-top: 24px;
    border-top: 1px dashed var(--line);
  }

  /* ---------- Responsive ---------- */
  @media (max-width: 920px) {
    .page { padding: 40px 24px 80px; }
    .hero, .about, .work-grid, .twocol { grid-template-columns: 1fr; }
    .now-card { grid-template-columns: 1fr; }
    .xp-row { grid-template-columns: 1fr; gap: 6px; }
    .xp-row .desc { grid-column: 1 / -1; }
    .footer { grid-template-columns: 1fr 1fr; }
    /* raise all 11px text to the 12px Google mobile minimum */
    .work .meta, .work .thumb, .tag, .now-card .nlabel,
    .now-card .ndate, .footer h3, .footer .meta-line { font-size: 12px; }
    /* improve touch targets in the footer link columns */
    .footer .col a, .footer .col p { padding: 6px 0; margin-bottom: 0; }
    /* release GPU layers for snowflakes on mobile */
    .flake { will-change: auto; }

    /* Fix 1: Topbar — stack status + nav so they don't overlap */
    .topbar { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 48px; }
    .topbar .right { flex-wrap: wrap; gap: 8px 16px; }

    /* Fix 2: Hero — photo above intro text on mobile */
    .hero { gap: 24px; }
    .photo-stack { order: -1; justify-self: center; margin-right: 0; margin-top: 0; }
    .tree { order: 1; }

    /* Fix 3: Now-card — reduce heading size, pills already fixed via align-items: flex-start above */
    .now-card { padding: 28px 24px; }
    .now-card .nbig { font-size: 28px; }
  }
