  /* ---------- design tokens (Terminal · Mono · Compact · accent #33312c) ---------- */
  :root {
    --bg:        #e7e6e1;
    --paper:     #fbfaf6;
    --fill:      #eceae3;
    --fill-2:    #e2e0d7;
    --ink:       #33312c;
    --ink-soft:  #6f6c64;
    --line:      #34322d;
    --line-soft: #c8c6bc;
    --accent:    #33312c;
    --accent-ink:#fbfaf6;

    --mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --maxw: 1180px;
    --nav-w: 212px;

    /* compact density */
    --pad-y: 38px;
    --pad-x: 42px;
    --gap:   20px;
    --radius: 6px;

    /* terminal traffic lights */
    --dot-r: #e8634a;
    --dot-y: #e8b84a;
    --dot-g: #5bbf7a;
  }

  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    margin: 0;
    background:
      radial-gradient(120% 80% at 50% -10%, #efeee9 0%, var(--bg) 60%) fixed;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding: 26px 18px 56px;
  }

  ::selection { background: var(--ink); color: var(--paper); }

  a { color: inherit; text-decoration: none; }

  .skip {
    position: absolute; left: -9999px; top: 0;
    background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 200;
    border-radius: 0 0 8px 0;
  }
  .skip:focus { left: 0; }

  /* ---------- the terminal "window" ---------- */
  .terminal {
    max-width: var(--maxw);
    margin: 0 auto;
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: 9px;
    box-shadow: 10px 12px 0 rgba(31,30,27,0.13);
    /* NB: no `overflow: hidden` here — it would disable position:sticky for
       the title bar and file tree. Corners are rounded on those children. */
  }

  /* window title bar */
  .titlebar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px;
    background: var(--paper);
    border-bottom: 2px solid var(--line);
    border-radius: 7px 7px 0 0;   /* matches the window's rounded top */
  }
  .dots { display: flex; gap: 7px; flex: none; }
  .dots i {
    width: 13px; height: 13px; border-radius: 50%;
    border: 2px solid var(--line); display: block;
  }
  .dots i:nth-child(1){ background: var(--dot-r); }
  .dots i:nth-child(2){ background: var(--dot-y); }
  .dots i:nth-child(3){ background: var(--dot-g); }
  .titlebar .path {
    color: var(--ink-soft); font-size: 0.86rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .menu-btn {
    margin-left: auto; flex: none;
    display: none;
    font-family: var(--mono); font-size: 0.85rem; font-weight: 700;
    background: var(--fill); color: var(--ink);
    border: 2px solid var(--line); border-radius: 7px;
    padding: 5px 11px; cursor: pointer;
  }
  .menu-btn:hover { background: var(--fill-2); }
  /* title-bar back button (used on the /portfolio page, which has no sidebar) */
  .titlebar .back {
    margin-left: auto; flex: none;
    font-family: var(--mono); font-size: 0.85rem; font-weight: 700;
    background: var(--fill); color: var(--ink);
    border: 2px solid var(--line); border-radius: 7px;
    padding: 5px 11px; cursor: pointer; white-space: nowrap;
    transition: background .14s, transform .12s;
  }
  .titlebar .back:hover { background: var(--fill-2); transform: translateX(-1px); }

  /* ---------- body grid: file-tree nav + content ---------- */
  .shell {
    display: grid; grid-template-columns: var(--nav-w) 1fr;
    /* Full-height left rail painted on the grid itself — fill colour plus the
       2px divider — so it spans the whole column even though the sticky nav is
       only as tall as its content. */
    background: linear-gradient(to right,
      var(--fill) 0, var(--fill) calc(var(--nav-w) - 2px),
      var(--line) calc(var(--nav-w) - 2px), var(--line) var(--nav-w),
      var(--paper) var(--nav-w));
  }

  /* file-tree sidebar (background/divider come from .shell so they fill height) */
  .filetree {
    position: sticky; top: 49px; align-self: start;
    max-height: calc(100vh - 49px); overflow: auto;
    background: transparent;
    padding: 22px 16px;
    display: flex; flex-direction: column; gap: 7px;
  }
  .filetree .comment { color: var(--ink-soft); font-size: 0.84rem; margin-bottom: 4px; }
  .filetree a {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.94rem; color: var(--ink);
    padding: 5px 8px; border-radius: 6px;
    border: 1.5px solid transparent;
    transition: background .14s, border-color .14s;
  }
  .filetree a .caret { color: var(--accent); opacity: 0; font-weight: 700; }
  .filetree a:hover { background: var(--fill-2); }
  .filetree a.active {
    background: var(--paper); border-color: var(--line); font-weight: 700;
  }
  .filetree a.active .caret { opacity: 1; }
  .filetree .resume {
    margin-top: 14px;
    justify-content: center;
    background: var(--accent); color: var(--accent-ink);
    border: 2px solid var(--line); font-weight: 700;
  }
  .filetree .resume:hover { filter: brightness(1.25); background: var(--accent); }

  /* ---------- content column ---------- */
  .content { min-width: 0; background: var(--paper); }
  section { padding: var(--pad-y) var(--pad-x); border-bottom: 2px solid var(--line); }
  section:last-of-type { border-bottom: none; }

  .comment { color: var(--ink-soft); }
  .kw { color: var(--accent); font-weight: 700; }
  .str { color: var(--ink-soft); }
  .prompt { display: flex; gap: 9px; align-items: baseline; margin: 14px 0 0; }
  .prompt .sym { color: var(--accent); font-weight: 700; }
  .cursor {
    display: inline-block; width: 9px; height: 1.05em; transform: translateY(2px);
    background: var(--accent); margin-left: 3px;
    animation: blink 1.1s steps(1) infinite;
  }
  @keyframes blink { 50% { opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

  /* section heading: "## about.md" */
  .head {
    display: flex; align-items: baseline; gap: 10px;
    font-size: 1.55rem; font-weight: 700; margin: 0 0 18px; line-height: 1.1;
  }
  .head .hash { color: var(--accent); }

  /* ---------- hero ---------- */
  .hero h1 {
    font-size: clamp(1.9rem, 4.6vw, 3.2rem);
    line-height: 1.08; margin: 12px 0; font-weight: 700; letter-spacing: -0.01em;
  }
  .hero .lede { color: var(--ink-soft); max-width: 56ch; margin: 0; font-size: 1.02rem; }
  .btnrow { display: flex; gap: 13px; flex-wrap: wrap; margin-top: 22px; }

  .btn {
    font-family: var(--mono); font-size: 0.96rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: 0.5em;
    padding: 11px 18px; cursor: pointer;
    border: 2px solid var(--line); border-radius: 8px;
    background: var(--paper); color: var(--ink);
    transition: transform .12s, background .14s, box-shadow .14s;
  }
  .btn:hover { transform: translateY(-2px); box-shadow: 3px 4px 0 rgba(31,30,27,0.18); }
  .btn:active { transform: translateY(0); box-shadow: none; }
  .btn.solid { background: var(--accent); color: var(--accent-ink); }
  .btn.ghost { background: transparent; }
  .btn .arr { font-size: 1.05em; }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

  /* ---------- about ---------- */
  .about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; align-items: center; }
  .about-grid p { margin: 0 0 12px; }
  .about-grid p:last-child { margin-bottom: 0; }
  .about-grid .ink-soft { color: var(--ink-soft); }
  .figure {
    border: 2px solid var(--line); border-radius: 10px; overflow: hidden;
    background: var(--fill);
  }
  .figure .topbar {
    display: flex; gap: 6px; padding: 9px 12px; border-bottom: 2px solid var(--line);
    background: var(--paper);
  }
  .figure .topbar i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line); }
  .figure .topbar i:nth-child(1){ background: var(--dot-r); }
  .figure .topbar i:nth-child(2){ background: var(--dot-y); }
  .figure .topbar i:nth-child(3){ background: var(--dot-g); }
  .figure .body {
    aspect-ratio: 16/11;
    background:
      repeating-linear-gradient(135deg, transparent 0 11px, rgba(52,50,45,0.05) 11px 12px),
      linear-gradient(160deg, var(--fill-2), var(--fill));
    display: grid; place-items: center;
    font-size: 0.9rem; color: var(--ink-soft);
  }

  /* ---------- skills (json block) ---------- */
  .codeblock {
    border: 2px solid var(--line); border-radius: 10px; background: var(--fill);
    padding: 20px; overflow-x: auto;
  }
  .codeblock .brace { color: var(--ink-soft); }
  .codeblock .group { padding: 6px 0 6px 22px; }
  .codeblock .key { color: var(--accent); font-weight: 700; }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 8px 22px; }
  .chip {
    font-size: 0.88rem; padding: 5px 12px;
    border: 1.5px solid var(--line); border-radius: 7px; background: var(--paper);
    white-space: nowrap;
  }

  /* ---------- experience ---------- */
  .exp { display: flex; flex-direction: column; gap: 6px; }
  .exp .item {
    display: grid; grid-template-columns: 18px 1fr; gap: 12px;
    padding: 15px 0; border-top: 1.5px solid var(--line-soft); align-items: start;
  }
  .exp .item:first-child { border-top: none; padding-top: 0; }
  .exp .gt { color: var(--accent); font-weight: 700; }
  .exp .role { font-weight: 700; font-size: 1.06rem; }
  .exp .meta { color: var(--ink-soft); font-size: 0.86rem; margin-left: 8px; font-weight: 400; }
  .exp .desc { color: var(--ink-soft); margin: 6px 0 0; }

  /* ---------- projects (4-up grid) ---------- */
  .proj-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
  .grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px;
  }
  /* opt-in 2-up grid (used on /portfolio). Single class so the mobile
     breakpoints below still win and collapse it to 2→1 columns. */
  .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card {
    display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
    border: 2px solid var(--line); border-radius: 10px; background: var(--paper);
    transition: transform .14s, box-shadow .14s;
  }
  .card:hover { transform: translateY(-3px); box-shadow: 4px 6px 0 rgba(31,30,27,0.16); }
  .card .shot {
    position: relative; aspect-ratio: 16/10; border-bottom: 2px solid var(--line);
    display: grid; place-items: center; overflow: hidden;
  }
  .card .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .card:nth-child(6n+1) .shot { background: linear-gradient(150deg, #e3e1d8, #d6d4ca); }
  .card:nth-child(6n+2) .shot { background: linear-gradient(150deg, #e7e0d4, #dcd3c2); }
  .card:nth-child(6n+3) .shot { background: linear-gradient(150deg, #dde2dd, #cdd6cd); }
  .card:nth-child(6n+4) .shot { background: linear-gradient(150deg, #e4ddda, #d6cbc6); }
  .card:nth-child(6n+5) .shot { background: linear-gradient(150deg, #dfe1e6, #ccd0da); }
  .card:nth-child(6n+6) .shot { background: linear-gradient(150deg, #e6e3da, #d8d2c2); }
  .card .shot::after {
    content: "open project ↗";
    position: absolute; inset: 0; display: grid; place-items: center;
    background: var(--accent); color: var(--accent-ink);
    font-weight: 700; font-size: 0.95rem;
    opacity: 0; transition: opacity .16s;
  }
  .card:hover .shot::after, .card:focus-within .shot::after { opacity: 0.97; }
  .card .meta { padding: 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
  .card .title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .card .title { font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card .ext { color: var(--accent); font-size: 1rem; flex: none; }
  .card .blurb {
    color: var(--ink-soft); font-size: 0.88rem; margin: 0;
    max-height: 6em; overflow-y: auto;   /* ~4 lines (≈20–25 words) then scrolls */
    scrollbar-width: thin; scrollbar-color: var(--line-soft) transparent;
  }
  .card .blurb::-webkit-scrollbar { width: 6px; }
  .card .blurb::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 3px; }
  .card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
  .card .tag { font-size: 0.74rem; padding: 3px 8px; border: 1px solid var(--line-soft); border-radius: 20px; color: var(--ink-soft); }

  .center-cta { text-align: center; margin-top: 26px; }

  /* ---------- reviews ---------- */
  .reviews { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .review {
    border: 2px solid var(--line); border-radius: 10px; background: var(--fill);
    padding: 18px; display: flex; flex-direction: column; gap: 10px;
  }
  .review .stars { color: var(--ink-soft); font-size: 0.85rem; }
  .review blockquote { margin: 0; font-size: 0.98rem; }
  .review .who { color: var(--ink-soft); font-size: 0.85rem; }

  /* ---------- contact ---------- */
  .contact-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 30px; }
  form.contact {
    border: 2px solid var(--line); border-radius: 10px; background: var(--fill);
    padding: 22px; display: flex; flex-direction: column; gap: 14px;
  }
  form.contact label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
  form.contact .lbl .flag { color: var(--accent); font-weight: 700; }
  form.contact input, form.contact textarea {
    font-family: var(--mono); font-size: 0.95rem; color: var(--ink);
    background: var(--paper); border: 2px solid var(--line); border-radius: 7px;
    padding: 10px 12px; width: 100%;
  }
  form.contact input { resize: none; }
  form.contact textarea { min-height: 96px; resize: vertical; }
  /* honeypot — kept in the DOM for bots but hidden from people & AT */
  .hp { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px;
        overflow: hidden; opacity: 0; }
  form.contact input:focus, form.contact textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(51,49,44,0.12); }
  .form-status { font-size: 0.85rem; color: var(--ink-soft); min-height: 1.1em; }
  .info { display: flex; flex-direction: column; gap: 16px; justify-content: center; }
  .info .row { display: flex; gap: 10px; align-items: baseline; }
  .info .row .k { color: var(--accent); font-weight: 700; min-width: 64px; }
  .info .row a:hover, .info .row span.v:hover { text-decoration: underline; }

  /* ---------- footer ---------- */
  .foot {
    padding: 18px var(--pad-x); color: var(--ink-soft); font-size: 0.85rem;
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: var(--fill);
    border-radius: 0 0 7px 7px;   /* matches the window's rounded bottom */
  }
  .foot a:hover { color: var(--ink); text-decoration: underline; }

  /* ---------- responsive ---------- */
  @media (max-width: 880px) {
    :root { --pad-x: 26px; --pad-y: 32px; }
    body { padding: 14px 10px 40px; }
    .menu-btn { display: inline-block; }
    .shell { grid-template-columns: 1fr; background: var(--paper); }
    .filetree {
      position: static; max-height: none; border-right: none;
      border-bottom: 2px solid var(--line);
      background: var(--fill);
      display: none;
    }
    .filetree.open { display: flex; }
    .about-grid, .contact-grid, .reviews { grid-template-columns: 1fr; }
    .grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  }
  @media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; }
    .exp .meta { display: block; margin-left: 0; }
  }
