:root {
      --bg: #f6f1e7;
      --surface: #efe7d8;
      --text: #1f1f1f;
      --muted: #5b5b5b;
      --border: #d9d1c6;
      --accent: #c27c4b;
      --photo-shadow: 0 10px 30px -16px rgba(80, 50, 25, 0.45);
    }

    :root[data-theme="dark"] {
      --bg: #16130f;
      --surface: #1f1a14;
      --text: #ece4d4;
      --muted: #8f8475;
      --border: #2e271f;
      --accent: #d99465;
      --photo-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.6);
    }

    html {
      scroll-behavior: smooth;
      -webkit-text-size-adjust: 100%;
      background: var(--bg);
    }

    @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

    *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

    body {
      font-family: "Inter", system-ui, -apple-system, sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.6;
      font-size: 16px;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
      min-height: 100dvh;
      transition: background-color 0.25s ease, color 0.25s ease;
    }

    a { color: var(--text); text-decoration: none; }

    /* ---- Top bar ---- */
    .topbar { border-bottom: 1px solid var(--border); background: var(--bg); }
    .topbar-inner {
      max-width: 1180px; margin: 0 auto;
      padding: 14px 32px;
      display: flex; align-items: center; justify-content: flex-end;
      min-height: 60px;
    }
    .theme-toggle {
      appearance: none; background: transparent;
      border: 1px solid var(--border); border-radius: 999px;
      width: 36px; height: 36px;
      display: inline-flex; align-items: center; justify-content: center;
      color: var(--muted); cursor: pointer; padding: 0; font: inherit;
      transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    }
    .theme-toggle svg { display: block; }
    .theme-toggle .icon-sun { display: none; }
    .theme-toggle .icon-moon { display: block; }
    :root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
    :root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
    @media (hover: hover) {
      .theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
    }
    .theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


    /* ---- Top bar: brand left (off-home only), nav right ---- */
    .topbar-inner { gap: 22px; }
    .brand {
      margin-right: auto;
      font-family: "Fraunces", Georgia, serif; font-weight: 600;
      font-size: 1.02rem; letter-spacing: -0.01em;
      border-bottom: 1px solid transparent;
      transition: color .15s ease, border-color .15s ease;
    }
    .brand:hover { color: var(--accent); border-bottom-color: var(--accent); }
    .nav { display: flex; align-items: center; gap: 20px; font-size: 0.92rem; }
    .nav a {
      color: var(--muted); padding-bottom: 2px;
      border-bottom: 1px solid transparent;
      transition: color .15s ease, border-color .15s ease;
    }
    .nav a:hover { color: var(--text); }
    .nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

    .page-title {
      font-family: "Fraunces", Georgia, serif; font-weight: 600;
      font-size: 1.9rem; letter-spacing: -0.02em; margin-bottom: 28px;
    }

    /* ---- Two-column shell ---- */
    .shell {
      display: grid; grid-template-columns: 340px 1fr;
      max-width: 1180px; margin: 0 auto; padding: 0 32px;
    }
    .rail { border-right: 1px solid var(--border); }
    .rail-inner {
      position: sticky; top: 0; min-height: 100dvh;
      padding: 40px 48px 48px 0;
      display: flex; flex-direction: column;
    }
    .photo {
      width: 100%; max-width: 248px; aspect-ratio: 4 / 5;
      border-radius: 20px; object-fit: cover; object-position: center;
      background: var(--surface); box-shadow: var(--photo-shadow);
      margin-bottom: 28px;
    }
    .rail-name {
      font-family: "Fraunces", Georgia, serif; font-weight: 600;
      font-size: clamp(2rem, 2.6vw, 2.5rem); line-height: 1.1;
      letter-spacing: -0.02em; margin-bottom: 10px;
    }
    .rail-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; font-size: 0.9rem; }
    .rail-links a { border-bottom: 1px solid var(--border); padding-bottom: 1px; transition: color 0.15s ease, border-color 0.15s ease; }
    @media (hover: hover) { .rail-links a:hover { color: var(--accent); border-bottom-color: var(--accent); } }
    .rail-links .sep { color: var(--border); padding: 0 6px; user-select: none; }
    .rail-foot { margin-top: auto; padding-top: 32px; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }


    /* ---- Full-width shell (projects + notes: no rail) ---- */
    .wide {
      max-width: 1060px;
      margin: 0 auto;
      padding: 52px 32px 110px;
    }
    .wide .page-title { margin-bottom: 32px; }

    /* ---- Content column ---- */
    .content { padding: 40px 0 96px 56px; }
    section { margin-bottom: 64px; }
    section:last-child { margin-bottom: 0; }

    .eyebrow {
      display: block; font-weight: 600; font-size: 0.78rem;
      letter-spacing: 0.1em; text-transform: uppercase;
      color: var(--muted); margin-bottom: 22px;
    }
    .eyebrow-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
    .eyebrow-row .eyebrow { margin-bottom: 0; }
    .eyebrow-link {
      font-size: 0.8rem; color: var(--muted); white-space: nowrap;
      border-bottom: 1px solid transparent;
      transition: color 0.15s ease, border-color 0.15s ease;
    }
    @media (hover: hover) { .eyebrow-link:hover { color: var(--accent); border-bottom-color: var(--accent); } }

    .excerpt { font-size: 1.08rem; line-height: 1.75; color: var(--text); max-width: 60ch; }
    .excerpt p + p { margin-top: 1em; }
    .excerpt a { border-bottom: 1px solid var(--border); transition: color 0.15s ease, border-color 0.15s ease; }
    @media (hover: hover) { .excerpt a:hover { color: var(--accent); border-bottom-color: var(--accent); } }


    /* ---- Notes list ---- */
    .note-list { display: flex; flex-direction: column; }
    .note-row {
      display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
      padding: 13px 0;
      border-bottom: 1px solid transparent;
      transition: border-color .18s ease;
    }
    .note-row + .note-row { border-top: 1px solid var(--border); }
    .note-title {
      font-family: "Fraunces", Georgia, serif; font-weight: 400;
      font-size: 1.16rem; line-height: 1.3; letter-spacing: -0.005em;
      transition: color .15s ease;
    }
    .note-date {
      font-size: .82rem; color: var(--muted); white-space: nowrap;
      font-variant-numeric: tabular-nums; flex: 0 0 auto;
    }
    @media (hover: hover) {
      .note-row:hover .note-title { color: var(--accent); }
    }

    /* ============================================================
       PROJECTS — 2-up grid with hover-to-play previews
       ============================================================ */
    .work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 26px; }

    .work-card {
      position: relative; display: block;
      color: inherit; text-decoration: none;
    }

    .thumb {
      position: relative; display: block;
      aspect-ratio: 16 / 10;
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      background: var(--surface);
      transition: border-color .2s ease, box-shadow .28s ease, transform .28s cubic-bezier(.2,.7,.3,1);
    }
    .thumb video, .thumb img {
      display: block; width: 100%; height: 100%; object-fit: cover;
      transform: scale(1.001);
      transition: transform .5s cubic-bezier(.2,.7,.3,1), filter .3s ease;
      filter: saturate(.92);
    }

    /* warm veil until it plays, so every still sits in the page palette */
    .thumb::before {
      content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
      background: var(--accent); opacity: .10; mix-blend-mode: multiply;
      transition: opacity .3s ease;
    }
    :root[data-theme="dark"] .thumb::before { mix-blend-mode: screen; opacity: .07; }

    .cue {
      position: absolute; z-index: 2; left: 9px; bottom: 9px;
      display: inline-flex; align-items: center; gap: 5px;
      padding: 3px 8px 3px 7px; border-radius: 999px;
      background: color-mix(in srgb, var(--bg) 80%, transparent);
      border: 1px solid var(--border); color: var(--muted);
      font-size: .56rem; letter-spacing: .1em; text-transform: uppercase;
      backdrop-filter: blur(6px);
      opacity: 0; transform: translateY(4px);
      transition: opacity .2s ease, transform .2s ease;
    }

    .empty {
      position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
      background:
        radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 7px 7px,
        var(--surface);
    }
    .empty span { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 0 14px; }

    .work-text { display: block; margin-top: 12px; }
    .work-title {
      display: block;
      font-family: "Fraunces", Georgia, serif; font-weight: 600;
      font-size: 1.06rem; line-height: 1.25; letter-spacing: -0.01em;
      transition: color .15s ease;
    }
    .work-desc { display: block; font-size: .88rem; margin-top: 3px; }
    .work-tags { font-size: .74rem; color: var(--muted); margin-top: 5px; }

    /* hover: card lifts, tile warms to accent, clip plays */
    .work-card.live .thumb {
      border-color: var(--accent);
      box-shadow: 0 18px 36px -24px rgba(80, 50, 25, .55);
      transform: translateY(-3px);
    }
    :root[data-theme="dark"] .work-card.live .thumb { box-shadow: 0 18px 36px -22px rgba(0,0,0,.75); }
    .work-card.live .thumb video, .work-card.live .thumb img { transform: scale(1.05); filter: saturate(1); }
    .work-card.live .thumb::before { opacity: 0; }
    .work-card.live .cue { opacity: 1; transform: none; }
    .work-card.live .work-title { color: var(--accent); }

    @media (prefers-reduced-motion: reduce) {
      .thumb, .thumb video, .thumb img, .cue { transition: none; }
      .work-card.live .thumb { transform: none; }
      .work-card.live .thumb video, .work-card.live .thumb img { transform: none; }
    }

    /* ---- Mobile ---- */
    @media (max-width: 768px) {
      .topbar-inner { padding: 10px 20px; min-height: 52px; }
      .shell { grid-template-columns: 1fr; padding: 0 20px; }
      .rail { border-right: none; border-bottom: 1px solid var(--border); }
      .rail-inner { position: static; min-height: 0; padding: 24px 0 28px; }
      .photo { max-width: 150px; margin-bottom: 20px; }
      .rail-foot { display: none; }
      .content { padding: 36px 0 72px; }
      .work-grid { grid-template-columns: 1fr; gap: 30px; }
    }

    .labnote { max-width: 1180px; margin: 0 auto; padding: 10px 32px 0; font-size: .72rem; color: var(--muted); }
    .labnote b { color: var(--accent); font-weight: 600; }

    /* ---- Mobile ---- */
    @media (max-width: 900px) {
      .work-grid { grid-template-columns: 1fr; gap: 30px; }
    }

    @media (max-width: 768px) {
      .topbar-inner { padding: 10px 20px; min-height: 52px; gap: 14px; }
      .brand { font-size: 0.94rem; }
      .nav { gap: 14px; font-size: 0.86rem; }

      .shell { grid-template-columns: 1fr; padding: 0 20px; }
      .rail { border-right: none; border-bottom: 1px solid var(--border); }
      .rail-inner { position: static; min-height: 0; padding: 24px 0 28px; }
      .photo { max-width: 148px; margin-bottom: 20px; }
      .rail-name { font-size: 2rem; }
      .rail-foot { display: none; }
      .content { padding: 32px 0 72px; }

      .wide { padding: 30px 20px 76px; }
      .page-title { font-size: 1.6rem; margin-bottom: 22px; }

      .excerpt { font-size: 1rem; line-height: 1.7; }

      .work-title { font-size: 1.02rem; }
      .work-desc { font-size: 0.9rem; }

      .note-row { padding: 14px 0; gap: 14px; }
      .note-title { font-size: 1.02rem; }
      .note-date { font-size: 0.76rem; }
    }

    @media (max-width: 420px) {
      .note-row { flex-direction: column; align-items: flex-start; gap: 3px; }
    }
