/* =========================================================
   Penny Jar prototype — design tokens + components
   Brand pulled from pennyjar.com:
     · Redaction for titles (high-contrast didone)
     · Geist for body
     · Copper / cream / oxblood palette
     · grain.gif overlay (multiply, opacity .08)
     · Top-right nav · back button on region pages
   Motion follows Emil Kowalski's design-eng skill.
   ========================================================= */

/* =========================================================
   Fonts — self-hosted from prototype/fonts/
   ========================================================= */

@font-face {
  font-family: "Redaction";
  src: url("fonts/Redaction-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Redaction 35";
  src: url("fonts/Redaction_35-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   Tokens
   ========================================================= */

:root {
  /* Brand swatches from pennyjar.com */
  --brand:    #733b2c;          /* deep penny copper */
  --brand-mid:#925740;           /* hero gradient top */
  --brand-deep: #521b16;          /* hero gradient bottom */
  --light:    #f7f0ed;          /* warm cream */
  --dark:     #2c1d19;          /* oxblood near-black */

  /* Working aliases — cream-on-copper hierarchy */
  --fg:      var(--light);
  --fg-2:    rgba(247, 240, 237, 0.78);
  --muted:   rgba(247, 240, 237, 0.55);
  --muted-2: rgba(247, 240, 237, 0.36);
  --line:    rgba(247, 240, 237, 0.18);
  --line-2:  rgba(247, 240, 237, 0.30);
  --card-bg: rgba(247, 240, 237, 0.06);  /* light-6 */
  --card-bg-strong: rgba(247, 240, 237, 0.10);

  /* The copper IS the bg; on copper pages, the "accent" is cream. */
  --accent:    var(--light);
  --accent-bg: rgba(247, 240, 237, 0.10);

  /* Easing — Emil's strong custom curves */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* Durations */
  --d-fast: 160ms;
  --d-med: 240ms;
  --d-drawer-in: 400ms;
  --d-drawer-out: 250ms;

  /* Type stacks */
  --font-body: "Geist", Inter, sans-serif;
  --font-title: "Redaction", "Times New Roman", serif;

  font-family: var(--font-body);
  font-feature-settings: "ss01" 1, "ss03" 1, "tnum" 0;

  color-scheme: dark;
}

/* =========================================================
   Reset
   ========================================================= */

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

html {
  scroll-behavior: smooth;
  /* Match the bottom of the gradient so rubber-band overscroll never shows
     a lighter band at top/bottom of the viewport. */
  background-color: var(--brand-deep);
  overscroll-behavior-y: none;
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  /* Brand copper gradient on home (default) */
  background-color: var(--brand-mid);
  background-image: linear-gradient(180deg, var(--brand-mid) 0%, var(--brand-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

/* Sort menu stays dark + cream regardless of theme — it's a popover surface */
.sort-menu {
  background: var(--dark);
  border-color: rgba(247, 240, 237, 0.22);
  color: #f7f0ed;
}
.sort-menu .sort-opt { color: rgba(247, 240, 237, 0.78); }

@media (hover: hover) and (pointer: fine) {
  .sort-menu .sort-opt:hover {
    background: rgba(247, 240, 237, 0.10);
    color: #f7f0ed;
  }
}

.sort-menu .sort-opt[aria-selected="true"] {
  color: var(--brand);
  background: #f7f0ed;
}

button, input { font: inherit; color: inherit; }
button { background: transparent; border: 0; padding: 0; cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }

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

::selection { background: var(--light); color: var(--brand); }

/* =========================================================
   Grain overlay — pennyjar.com's grain.gif, identical settings
   ========================================================= */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("grain.gif");
  background-size: 40rem;
  background-position: 0 0;
  background-repeat: repeat;
  opacity: 0.08;
  mix-blend-mode: multiply;
}

/* All actual content sits above the grain */
body > * { position: relative; z-index: 2; }
.backdrop { z-index: 50; }
.drawer { z-index: 60; }
.sort-menu { z-index: 70; }

/* =========================================================
   Brand — top-left logo
   ========================================================= */

.brand {
  position: fixed;
  top: 32px;
  left: 32px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  color: var(--light);
  /* width owned here so compact-on-scroll can clip down to just the J mark */
  width: 145px;
  overflow: hidden;
  transition:
    width 320ms var(--ease-out),
    opacity var(--d-fast) var(--ease-out);
}

.brand-mark {
  display: block;
  width: 145px;
  height: 22px;
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .brand:hover { opacity: 0.78; }
}

/* =========================================================
   Top-right nav
   ========================================================= */

.topbar-right {
  position: fixed;
  top: 32px;
  right: 32px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.4vw, 32px);
  font-family: var(--font-body);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topnav-link {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--fg-2);
  padding: 5px 10px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  transition:
    color var(--d-fast) var(--ease-out),
    background var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    gap var(--d-med) var(--ease-out),
    padding var(--d-med) var(--ease-out);
}

.topnav-label {
  letter-spacing: -0.005em;
  display: inline-block;
  max-width: 80px;
  overflow: hidden;
  transition:
    max-width var(--d-med) var(--ease-out),
    opacity var(--d-fast) var(--ease-out),
    margin var(--d-med) var(--ease-out);
}

.topnav-key {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  transition: color var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .topnav-link:hover {
    color: var(--light);
    border-color: var(--line-2);
  }
  .topnav-link:hover .topnav-key { color: var(--fg-2); }
}

/* Active region — cream fill with brand text, mirroring the greeting toggle */
body[data-route="people"]  .topnav-link[data-region="people"],
body[data-route="magic"]   .topnav-link[data-region="intersection"],
body[data-route="markets"] .topnav-link[data-region="markets"] {
  color: var(--brand);
  background: var(--light);
  border-color: var(--light);
}

body[data-route="people"]  .topnav-link[data-region="people"]       .topnav-key,
body[data-route="magic"]   .topnav-link[data-region="intersection"] .topnav-key,
body[data-route="markets"] .topnav-link[data-region="markets"]      .topnav-key {
  color: var(--brand);
  opacity: 0.6;
}

.topnav-link--button { font: inherit; }

/* Top-right pill nav only on inner pages — home gets the giant typographic
   nav at the bottom of the page instead. */
body[data-route="home"] .topnav { display: none; }

/* =========================================================
   Nav-on-scroll — compact mode. Past ~24px the brand wordmark
   clips off (leaving just the J pennyjar mark), and the topnav
   pills shed their labels — only the keyboard-key chip stays.
   Driven by [data-scrolled="true"] on <body>; the brand and
   topnav-link transitions are declared with their base rules.
   ========================================================= */

body[data-scrolled="true"] .brand {
  width: 22px;
}

body[data-scrolled="true"] .topnav-label {
  max-width: 0;
  opacity: 0;
  margin-left: -4px;
}

body[data-scrolled="true"] .topnav-link {
  gap: 0;
  padding: 5px 8px;
}

/* =========================================================
   Back button — only on region pages
   ========================================================= */

.back {
  position: fixed;
  top: calc(32px + 44px);
  left: 32px;
  z-index: 45;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  transition: color var(--d-fast) var(--ease-out);
}

.back .arrow {
  display: inline-block;
  transition: transform var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .back:hover { color: var(--light); }
  .back:hover .arrow { transform: translateX(-3px); }
}

/* Back link is replaced by topnav active state — kept hidden everywhere now. */
.back { display: none !important; }

/* =========================================================
   Hero — only visible on home
   ========================================================= */

.hero {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 6vh, 80px);
  padding: clamp(120px, 18vh, 200px) 32px clamp(40px, 6vh, 80px);
}

body:not([data-route="home"]) .hero { display: none; }

/* Top-of-home typographic nav — three big serif words laid horizontally
   with a fixed 80px gap between them. */
.hero-trio {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 80px;
  margin: 0;
  flex-wrap: nowrap;
}

.hero-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  position: relative;
  flex: 0 1 auto;
  text-align: left;
  transition: opacity var(--d-fast) var(--ease-out);
}

.hero-label {
  font-family: var(--font-title);
  font-size: clamp(48px, 8vw, 124px);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 0.9;
  color: var(--light);
  white-space: nowrap;
  display: inline-block;
}

.hero-num {
  font-family: var(--font-body);
  font-size: clamp(13px, 1.4vw, 18px);
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  color: var(--fg-2);
  display: inline-block;
}

@media (hover: hover) and (pointer: fine) {
  .hero-trio:hover .hero-row { opacity: 0.45; }
  .hero-trio:hover .hero-row:hover { opacity: 1; }
}

.hero-row:active { transform: scale(0.998); }

/* Word stagger entrance */
.hero-row .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out),
    filter 700ms var(--ease-out);
}

.hero-row .word.in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

@media (max-width: 720px) {
  .hero { padding: 100px 24px 24px; gap: clamp(28px, 5vh, 48px); }
  .hero-label { font-size: clamp(40px, 12vw, 72px); }
  .hero-trio {
    flex-wrap: wrap;
    gap: 8px clamp(20px, 6vw, 36px);
  }
}

/* =========================================================
   Page system — one .page visible at a time
   ========================================================= */

.page { display: block; }
.page[hidden] { display: none !important; }

.page--home {
  padding: 32px 32px clamp(48px, 8vh, 96px);
  max-width: none;
}

/* Constrain the highlights feed so prose lines stay readable while the
   horizontal hero-trio below can stretch full-width. */
.page--home .feed-header,
.page--home .feed-list { max-width: 960px; }

/* Region pages stretch edge-to-edge with a left filter rail */
.page--list {
  padding: clamp(110px, 14vh, 150px) 32px clamp(48px, 8vh, 96px);
  max-width: none;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  column-gap: 72px;
}

.page-sidebar { min-width: 0; }
.page-main    { min-width: 0; }


.page.swapping-out {
  opacity: 0;
  filter: blur(3px);
  transform: translateY(-4px);
  transition:
    opacity 180ms var(--ease-out),
    filter 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.page.swapping-in {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(3px);
}

.page.swapping-in.in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition:
    opacity 320ms var(--ease-out),
    filter 320ms var(--ease-out),
    transform 320ms var(--ease-out);
}

/* =========================================================
   Inner-page entrance — subtle stagger across the sidebar,
   heading, sub, sources, and listing. Each child holds its
   "off" state by default; motion.js adds .in to fire the
   transition (and re-fires on every route entry).
   ========================================================= */

.page--list .page-sidebar,
.page--list .page-heading,
.page--list .page-sub,
.page--list .page-sources,
.page--list .listing {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(3px);
  transition:
    opacity 520ms var(--ease-out),
    transform 520ms var(--ease-out),
    filter 520ms var(--ease-out);
  will-change: opacity, transform, filter;
}

.page--list .page-sidebar.in,
.page--list .page-heading.in,
.page--list .page-sub.in,
.page--list .page-sources.in,
.page--list .listing.in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* When a filter change re-renders the listing, the listing already has .in,
   and .blip overrides opacity to 0 for the brief fade. Compose cleanly: */
.page--list .listing.in.blip { opacity: 0; }

/* Snap-reset — when navigating back to a page whose staggered children
   already carry .in, motion.js sets body[data-snap="true"], removes .in,
   forces a reflow, then clears snap before scheduling the staggered re-add.
   Suppressing transitions during the reset prevents a fade-out flicker that
   throws off the entrance order. */
body[data-snap="true"] .greeting-body,
body[data-snap="true"] .greeting-meta,
body[data-snap="true"] .hero-row .word,
body[data-snap="true"] .feed-row,
body[data-snap="true"] .page--list .page-sidebar,
body[data-snap="true"] .page--list .page-heading,
body[data-snap="true"] .page--list .page-sub,
body[data-snap="true"] .page--list .page-sources,
body[data-snap="true"] .page--list .listing {
  transition: none !important;
}

/* =========================================================
   Today feed (home page)
   ========================================================= */

.feed-header { margin-bottom: 28px; }

.feed-title {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.feed-list { display: flex; flex-direction: column; }

.feed-row {
  text-align: left;
  width: 100%;
  padding: 10px 0;
  cursor: pointer;
  display: block;
  font-size: clamp(15px, 1.3vw, 17px);
  letter-spacing: -0.005em;
  line-height: 1.45;
  transition:
    transform var(--d-fast) var(--ease-out),
    opacity var(--d-fast) var(--ease-out);
}

.feed-row .title {
  font-weight: 600;
  color: var(--light);
  margin-right: 0.5em;
}

.feed-row .desc {
  font-weight: 400;
  color: var(--muted);
  transition: color var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .feed-row:hover .desc { color: var(--fg-2); }
  .feed-row:hover .title { color: var(--light); }
}

.feed-row:active { transform: scale(0.998); }

/* Entrance stagger */
.feed-row { opacity: 0; transform: translateY(6px); }
.feed-row.in {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 500ms var(--ease-out),
    transform 500ms var(--ease-out);
}


/* =========================================================
   Region page heading (Redaction title above the controls)
   ========================================================= */

.page-heading {
  font-family: var(--font-title);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 0.98;
  color: var(--light);
  margin: 0 0 36px;
  /* Cap so long titles ("DoorDash eng 2019–20 in motion") wrap to a second
     line on wide viewports; short titles like "people 12,847" still fit. */
  max-width: 18ch;
}

/* When a sub or sources row follows the heading, tighten the heading→sub
   gap so the whole header reads as one block, then let the sub/sources push
   the listing down with their own breathing room. */
.page-main:has(.page-sub) .page-heading,
.page-main:has(.page-sources) .page-heading {
  margin-bottom: 16px;
}

.page-heading-count {
  font-family: var(--font-body);
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  vertical-align: baseline;
  margin-left: 0.4em;
  white-space: nowrap;
}

/* =========================================================
   Controls bar — search, sort, filter chips
   ========================================================= */

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search {
  background: transparent;
  color: var(--light);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 2px;
  font: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  outline: none;
  transition: border-color var(--d-fast) var(--ease-out);
}

.search::placeholder { color: var(--muted-2); }
.search:focus { border-bottom-color: var(--light); }

.page-sidebar .search {
  display: block;
  width: 100%;
  margin-bottom: 22px;
}

.controls .sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--fg-2);
  background: transparent;
  transition:
    background var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .controls .sort:hover {
    color: var(--light);
    border-color: var(--light);
  }
}

.controls .sort .sort-caret { font-size: 9px; margin-left: 2px; color: var(--muted); }

.chips--filter { display: flex; gap: 6px; flex-wrap: wrap; }

.chip--filter {
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--fg-2);
  font-weight: 500;
  background: transparent;
  transition:
    background var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out),
    transform var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .chip--filter:hover { color: var(--light); border-color: var(--light); }
}

.chip--filter:active { transform: scale(0.97); }

.chip--filter[aria-pressed="true"] {
  color: var(--brand);
  border-color: var(--light);
  background: var(--light);
}

/* Sort menu (popover) */
.sort-menu {
  position: absolute;
  background: var(--brand-deep);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  min-width: 168px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity var(--d-fast) var(--ease-out),
    transform var(--d-fast) var(--ease-out);
  pointer-events: none;
}

.sort-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sort-menu[hidden] { display: none; }

.sort-menu .sort-opt {
  text-align: left;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--fg-2);
  background: transparent;
  transition:
    background var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .sort-menu .sort-opt:hover { background: var(--card-bg); color: var(--light); }
}

.sort-menu .sort-opt[aria-selected="true"] {
  color: var(--brand);
  background: var(--light);
}

/* =========================================================
   Listing rows
   ========================================================= */

.listing { display: flex; flex-direction: column; transition: opacity 120ms var(--ease-out); }
.listing.blip { opacity: 0; }

.listing .feed-row {
  text-align: left;
  width: 100%;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  opacity: 1;
  transform: none;
}

.listing .feed-row:last-child { border-bottom: 0; }
.listing .feed-row .title { font-weight: 600; }

/* Magic rows */
.listing .feed-row.match-row {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  align-items: baseline;
}

.listing .feed-row.match-row .row-main { min-width: 0; }

.listing .feed-row .person-x-market .x {
  color: var(--muted);
  font-weight: 400;
  margin: 0 0.35em;
}

.listing .feed-row .person-x-market .market {
  color: var(--light);
  font-weight: 600;
}

.listing .feed-row .score {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--light);
  white-space: nowrap;
}

.listing .empty {
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
}

@media (max-width: 720px) {
  .controls { gap: 10px; padding-bottom: 14px; margin-bottom: 14px; }
  .controls .search { flex-basis: 100%; }
  .listing .feed-row.match-row { grid-template-columns: 1fr; row-gap: 4px; }
  .listing .feed-row.match-row .score { justify-self: start; }
}

/* =========================================================
   Sidebar — filter rail (lab-notebook label, folder, checkbox tree)
   ========================================================= */

.filters-h {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.filters-h::before {
  content: "/ ";
  color: var(--muted-2);
  letter-spacing: 0;
}

.filter-group { margin-bottom: 18px; }

.filter-group-h {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--light);
  letter-spacing: -0.005em;
  padding: 4px 0;
  margin-bottom: 6px;
}

.filter-group-h .filter-caret {
  color: var(--fg-2);
  transition: transform var(--d-fast) var(--ease-out);
}

.filter-group-h[aria-expanded="false"] .filter-caret {
  transform: rotate(-90deg);
}

.filter-group-h .filter-folder {
  color: var(--fg-2);
  flex-shrink: 0;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding-left: 18px;
  border-left: 1px dotted var(--line-2);
  overflow: hidden;
  transition: max-height var(--d-med) var(--ease-out), opacity var(--d-fast) var(--ease-out);
}

.filter-group[data-collapsed="true"] .filter-list {
  max-height: 0 !important;
  opacity: 0;
  margin-bottom: -8px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: color var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .filter-item:hover { color: var(--light); }
  .filter-item:hover .filter-checkbox { border-color: var(--fg-2); }
}

.filter-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  margin: 0;
  flex-shrink: 0;
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: background var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out);
}

.filter-item input[type="checkbox"]:checked {
  background: var(--light);
  border-color: var(--light);
}

.filter-item input[type="checkbox"]:checked::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 6px;
  height: 3px;
  border-left: 1.5px solid var(--brand);
  border-bottom: 1.5px solid var(--brand);
  transform: rotate(-45deg);
}

.filter-item .filter-label { flex: 1; min-width: 0; }

.filter-item .filter-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 11.5px;
}

/* When checked, label brightens */
.filter-item:has(input:checked) {
  color: var(--light);
}

@media (max-width: 920px) {
  .page--list {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
  .page-sidebar {
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
    margin-bottom: 8px;
  }
}


/* =========================================================
   Drawer — dark interior over the copper page
   ========================================================= */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 8, 0.30);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-out);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.backdrop.open { opacity: 1; pointer-events: auto; }

/* =========================================================
   Drawer — single mode: top/right/bottom margins, flat grey
   chrome (4px on L/B/R + 90px titlebar on top), navy inner
   with 4px radius. No anchoring controls, no section icons —
   just a clean console window.
   ========================================================= */

.drawer {
  --dark:         #0e0e10;             /* off-black interior */

  --line:    rgba(247, 240, 237, 0.10);
  --line-2:  rgba(247, 240, 237, 0.20);
  --card-bg: rgba(247, 240, 237, 0.04);
  --card-bg-strong: rgba(247, 240, 237, 0.08);

  /* Score color coding (cream-on-coloured pill in the hero) */
  --score-strong:    #5ed18b;          /* green ≥ 8 */
  --score-mid:       #e8b86b;          /* amber 6–8 */
  --score-low:       #d96658;          /* red < 6 */

  /* Right-anchored, full-height drawer with 26px breathing room
     on top, right, and bottom. */
  position: fixed;
  top: 26px;
  right: 26px;
  bottom: 26px;
  left: auto;
  width: min(560px, calc(100vw - 52px));
  height: calc(100vh - 52px);
  max-height: calc(100vh - 52px);
  background: var(--dark);
  color: var(--light);
  border: 0;
  border-radius: 12px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.25);
  transform-origin: right center;
  transform: translateX(calc(100% + 52px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 320ms var(--ease-drawer),
    opacity 200ms var(--ease-out);
  overflow: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.drawer.closing {
  transform: translateX(calc(100% + 52px));
  opacity: 0;
  transition:
    transform 220ms var(--ease-in-out),
    opacity 180ms var(--ease-in-out);
}

@media (max-width: 720px) {
  .drawer {
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
}

/* ---------- Drawer body interior ---------- */
/* Hide redundant in-content close — titlebar X is canonical */
.drawer .drawer-head .close-x { display: none; }
.drawer .drawer-actions { display: none; }

/* Header — solid off-black bg, no divider beneath hero */
.drawer .drawer-head {
  background: var(--dark);
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer .drawer-head--hero { border-bottom: 0; }

.drawer .drawer-name { font-size: 32px; }
.drawer .drawer-sub  { font-size: 12.5px; margin-top: 5px; color: var(--fg-2); }
.drawer .drawer-crumb {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  margin-bottom: 8px;
  color: var(--muted);
}

/* ---------- Hero header (person profile) ----------------------------------
   Portrait photo (3:4) + Redaction-serif name + minimal score chip.
   Borderless. Close X floats top-right.
   ------------------------------------------------------------------------ */
.drawer .drawer-head--hero {
  position: relative;
  padding: 32px 36px 16px;
  border-bottom: 0;
}

.drawer .hero-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color var(--d-fast) var(--ease-out),
              background var(--d-fast) var(--ease-out);
}
.drawer .hero-close svg { display: block; }
@media (hover: hover) and (pointer: fine) {
  .drawer .hero-close:hover { color: var(--light); background: rgba(247, 240, 237, 0.06); }
}

.drawer .hero-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: center;
}

.drawer .hero-portrait-wrap {
  position: relative;                  /* anchors the score overlay */
  width: 200px;
  aspect-ratio: 4 / 5;
  background: transparent;             /* no cream halo */
  border: 0;
  border-radius: 6px;
  overflow: visible;                   /* let the score chip sit on top
                                           with its own rounded corners
                                           rather than being clipped */
  flex-shrink: 0;
}
.drawer .hero-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;                  /* round the image directly so we
                                           don't need overflow:hidden on
                                           the wrap */
}

/* Market hero — typography-only: name, sub-line, and Opportunity chip
   stacked left-aligned. No portrait, no copper tile. */
.drawer .drawer-head--stack {
  padding: 32px 36px 24px;
}
.drawer .hero-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.drawer .hero-stack .hero-name { margin: 0; }
.drawer .hero-stack .hero-sub  { margin: 0; }

/* Inline variant of the score chip — when present in a stack rather than
   absolutely positioned over a portrait. */
.drawer .drawer-head .hero-score.hero-score--inline {
  position: static;
  right: auto;
  bottom: auto;
  box-shadow: none;
}

.drawer .hero-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.drawer .hero-name {
  font-family: var(--font-title);
  font-size: 56px;
  line-height: 0.94;
  letter-spacing: -0.012em;
  color: var(--light);
  margin: 0;
}

.drawer .hero-sub {
  font-size: 14px;
  margin-top: 12px;
  color: var(--fg-2);
}

.drawer .drawer-head--hero .signal-pills { margin-top: 16px; }

/* Score overlay — floats inside the avatar, 16px from edges, rounded. */
.drawer .drawer-head .hero-score {
  position: absolute;
  right: 16px;
  bottom: 16px;
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 6px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--dark);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.drawer .drawer-head .hero-score.score--strong { background: var(--score-strong); color: #062c19; }
.drawer .drawer-head .hero-score.score--mid    { background: var(--score-mid);    color: #3a2810; }
.drawer .drawer-head .hero-score.score--low    { background: var(--score-low);    color: #fff;    }
/* Neutral variant — no semantic colour. Used by markets where "low score"
   could be the *good* news (under-deployed = whitespace) and a coloured
   chip would mislead. */
.drawer .drawer-head .hero-score.hero-score--neutral {
  background: var(--light);
  color: var(--dark);
}

/* ---------- Links bar — sits below the hero, wraps as needed ---------- */
.drawer .links-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin: 0;
  padding: 12px 36px 8px;
  border-top: 0;
}
.drawer .link-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--fg-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--d-fast) var(--ease-out);
}
.drawer .link-chip svg {
  display: block;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--d-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .drawer .link-chip:hover { color: var(--light); }
  .drawer .link-chip:hover svg { opacity: 1; }
}

@media (max-width: 720px) {
  .drawer { top: 12px; right: 12px; bottom: 12px; width: calc(100vw - 24px); height: calc(100vh - 24px); max-height: calc(100vh - 24px); }
  .drawer .drawer-head--hero { padding: 24px 22px 22px; }
  .drawer .hero-grid {
    grid-template-columns: 144px 1fr;
    gap: 18px;
  }
  .drawer .hero-portrait-wrap { width: 144px; }
  .drawer .hero-name { font-size: 42px; }
  .drawer .links-bar { padding-left: 22px; padding-right: 22px; gap: 10px 18px; }
}

/* Sections — minimal: one shared horizontal rhythm. Between consecutive
   sections we render a 1px hairline at white-4% as a near-invisible
   scene-break (replaces the editorial dinkus). */
.drawer .section {
  padding: 24px 36px;
  border-bottom: 0;
}
.drawer .section + .section { padding-top: 0; }
.drawer .section + .section::before {
  content: "";
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.04);
  margin: 18px 0 24px;
}
.drawer .section:last-child { padding-bottom: 40px; }

.drawer .section-h {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 14px;
}

/* Profile row in header */
.drawer .profile-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
}
.drawer .profile-row > .profile-main { min-width: 0; padding-top: 2px; }

.drawer .profile-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: rgba(247, 240, 237, 0.06);
  border: 1px solid var(--line-2);
}

/* Signal pills — outline mono, no fill */
.drawer .signal-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.drawer .signal-pill {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--fg-2);
  border: 1px solid var(--line-2);
  padding: 2px 7px;
  border-radius: 0;
  font-weight: 500;
  white-space: nowrap;
}

/* Quick stats — flat 4-up, mono labels, no divider */
.drawer .quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 18px;
  padding: 0 0 4px;
  border-bottom: 0;
  margin-bottom: 18px;
}
.drawer .quick-stats--market { grid-template-columns: repeat(3, 1fr); }

.drawer .qs-lbl {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.drawer .qs-val {
  font-size: 14px;
  font-weight: 500;
  color: var(--light);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  margin-top: 9px;
  letter-spacing: -0.01em;
}

/* Org mark — terminal-flavored cream-bordered square */
.drawer .org-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: rgba(247, 240, 237, 0.10);
  color: var(--light);
  border: 1px solid var(--line-2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* Market mark — copper square pops on navy */
.drawer .market-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: var(--brand);
  color: #f7f0ed;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

.drawer .market-mark--lg {
  width: 56px;
  height: 56px;
  border-radius: 0;
  font-family: var(--font-title);
  font-size: 30px;
  font-weight: 400;
}

/* Timeline — drop dots, two-column with org-mark */
.drawer .timeline { padding-left: 0; gap: 10px; }
.drawer .timeline::before { display: none; }
.drawer .timeline li::before { display: none; }
.drawer .timeline li:first-child::before { display: none; }
.drawer .timeline li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  column-gap: 12px;
  align-items: start;
}
.drawer .timeline--logos li {
  grid-template-columns: 48px 1fr auto;
  column-gap: 18px;
  align-items: center;
  padding: 8px 0;
}
.drawer .timeline--logos .org-logo-wrap,
.drawer .timeline--logos .org-mark {
  width: 48px;
  height: 48px;
}
.drawer .org-logo-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.drawer .org-logo-fallback {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
  letter-spacing: 0;
}
.drawer .org-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.drawer .org-logo--local {
  /* Local SVG/PNG logos are already transparent — let them sit on the
     dark hero without a tile or padding. */
  padding: 0;
  background: transparent;
}
.drawer .timeline .t-body { min-width: 0; padding-top: 1px; }
.drawer .timeline .org { font-weight: 500; font-size: 13.5px; color: var(--light); }
.drawer .timeline .role { font-size: 12.5px; color: var(--fg-2); padding-top: 1px; }
.drawer .timeline .range {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.10em;
  color: var(--muted);
  padding-top: 4px;
  align-self: start;
}

/* Callout — soft surface, italic body */
.drawer .callout {
  border-left: 0;
  background: var(--card-bg);
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 13px;
  font-style: italic;
  color: var(--fg-2);
  line-height: 1.55;
  border-radius: 6px;
}

/* Output cards — borderless typographic rows */
.drawer .cards { display: flex; flex-direction: column; gap: 8px; }
.drawer .card-mini {
  background: transparent;
  border: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 14px;
  align-items: baseline;
  font-size: 13px;
}
.drawer .card-mini .repo {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--light);
}
.drawer .card-mini .meta {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.10em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 0;
}

/* Quotes — italic, with mono attribution */
.drawer .quote {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--fg-2);
  line-height: 1.55;
  margin-top: 4px;
}
.drawer .quote .attrib {
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  margin-top: 4px;
  text-transform: uppercase;
  color: var(--muted);
}

.drawer .linkedin-line { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* Network paths — avatar + body, no dashed dividers */
.drawer .network-list { display: flex; flex-direction: column; gap: 8px; }
.drawer .path {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 18px;
  padding: 6px 0;
  align-items: center;
  border-bottom: 0;
}
.drawer .path-body { min-width: 0; }
.drawer .path .who { font-weight: 500; font-size: 13.5px; color: var(--light); }
.drawer .path .who .ctx { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.drawer .path .edge { font-size: 11.5px; color: var(--fg-2); }
.drawer .network-avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
  background: rgba(247, 240, 237, 0.04);
  border: 0;
  filter: grayscale(100%);
}

/* Clickable path (people-in-market rows render as <button>). Reset native
   button chrome so it reads as a row, not a control. */
.drawer .path--clickable {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform var(--d-fast) var(--ease-out);
}
.drawer .path--clickable .who { color: var(--light); }
@media (hover: hover) and (pointer: fine) {
  .drawer .path--clickable:hover { transform: translateX(2px); }
}

/* Labelled score chip (markets) — number on the left, mono-caps label on
   the right, both inline. */
.drawer .drawer-head .hero-score--labelled {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  text-align: left;
}
.drawer .hero-score-tag {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.75;
  line-height: 1;
}
.drawer .hero-score-num {
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Market chips — inline strength dot, no pills */
.drawer .chips { display: flex; gap: 4px 14px; flex-wrap: wrap; }
.drawer .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--fg);
  letter-spacing: 0;
}
.drawer .chip .strength {
  width: 6px !important;
  height: 6px !important;
  border-radius: 50%;
  background: var(--light);
  opacity: 0.55;
}
.drawer .chip[data-strength="strong"] .strength    { opacity: 1;    }
.drawer .chip[data-strength="medium"] .strength    { opacity: 0.55; }
.drawer .chip[data-strength="historical"] .strength { opacity: 0.25; }
.drawer .chip span:last-child { display: none; }

/* Activity log — mono date column */
.drawer .log { display: flex; flex-direction: column; gap: 8px; }
.drawer .log li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: baseline;
}
.drawer .log .when {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.drawer .log .what { font-size: 12.5px; color: var(--fg-2); }

/* Notes — borderless italic */
.drawer .note {
  background: transparent;
  border: 0;
  padding: 0;
  margin-top: 4px;
}
.drawer .note .author {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.drawer .note .body {
  font-size: 13px;
  font-style: italic;
  color: var(--fg-2);
  margin-top: 4px;
  line-height: 1.55;
}
.drawer .empty { font-size: 11.5px; color: var(--muted); font-style: italic; }

/* Stat tiles — terminal cells with mono labels */
.drawer .stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.drawer .stat-tile {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  background: var(--card-bg);
}
.drawer .stat-tile .lbl {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.drawer .stat-tile .val {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--light);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Sparkline — cream stroke on the off-black hero */
.drawer .spark { width: 100%; height: 64px; margin: 4px 0 12px; }
.drawer .spark-caption {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.55;
  margin-top: 4px;
}
.drawer .spark-caption strong {
  font-weight: 500;
  color: var(--light);
}
.drawer .spark path.line { fill: none; stroke: var(--light); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.drawer .spark path.area { fill: var(--light); opacity: 0.08; }
.drawer .spark .end { fill: var(--light); }

/* Round rows */
.drawer .round {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 0;
}
.drawer .round-main {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.drawer .round .co { font-weight: 500; font-size: 13.5px; color: var(--light); }
.drawer .round .dets { font-size: 11.5px; color: var(--fg-2); margin-top: 2px; }
.drawer .round .lead { color: var(--muted); margin-left: 4px; font-size: 10.5px; }
.drawer .round .when {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* Mini-person rows */
.drawer .mini-person {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: transform var(--d-fast) var(--ease-out);
}
.drawer .mini-person:last-child { border-bottom: 0; }
.drawer .mini-person .bar { display: none; }
.drawer .mini-person .who { font-weight: 500; font-size: 13.5px; color: var(--light); }
.drawer .mini-person .meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.drawer .mini-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: rgba(247, 240, 237, 0.06);
  border: 1px solid var(--line);
}

@media (hover: hover) and (pointer: fine) {
  .drawer .mini-person:hover { transform: translateX(2px); }
  .drawer .mini-person:hover .who { color: var(--light); }
}

/* Match drawer — score chip, marks row */
.drawer .match-marks {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.drawer .match-x {
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px;
  line-height: 1;
}

.drawer .profile-photo--match { width: 56px; height: 56px; }
.drawer .profile-row--match { grid-template-columns: 1fr auto; }

/* Score chip — cream pill with navy text (terminal status pill) */
.drawer .drawer-head .match-score {
  background: var(--light);
  color: var(--dark);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 0;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.drawer .score-arrow {
  font-size: 0.78em;
  margin-left: 2px;
  color: var(--dark);
  vertical-align: 6%;
  opacity: 0.7;
}

.drawer .drawer-name .person-x-market .x { font-size: 0.8em; vertical-align: 6%; }

/* Snapshot rows in match drawer */
.drawer .snapshot-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
}
.drawer .snapshot-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: rgba(247, 240, 237, 0.06);
  border: 1px solid var(--line);
}
.drawer .snapshot-body { min-width: 0; }
.drawer .snapshot-foot { margin-top: 12px; }
.drawer .snapshot-meta { font-size: 12.5px; margin-bottom: 10px; color: var(--fg-2); }

/* Buttons — square terminal-style with cream border */
.drawer .btn,
.drawer .btn--accent {
  border-radius: 0;
  border: 1px solid var(--light);
  color: var(--light);
  background: transparent;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 7px 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (hover: hover) and (pointer: fine) {
  .drawer .btn:hover,
  .drawer .btn--accent:hover {
    background: var(--light);
    color: var(--dark);
    border-color: var(--light);
  }
}

/* Narrow drawer — collapse 4-column quick-stats to 2 */
@media (max-width: 560px) {
  .drawer .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .drawer .profile-photo { width: 48px; height: 48px; }
  .drawer .market-mark--lg { width: 48px; height: 48px; font-size: 26px; }
}

.drawer-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--dark);
  margin: 0;
  border-radius: 0;
  transition:
    opacity 220ms var(--ease-out),
    filter 220ms var(--ease-out),
    transform 350ms var(--ease-out);
}

.drawer-inner.swapping-out { opacity: 0; filter: blur(3px); transform: translateY(-6px); }
.drawer-inner.swapping-in  { opacity: 0; filter: blur(3px); transform: translateY(8px); }

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, var(--dark) 88%, transparent 100%);
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-head .row1 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.drawer-head .row1-end { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.drawer-name {
  font-family: var(--font-title);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.04;
  color: var(--light);
  margin: 0;
}

.drawer-sub { font-size: 13px; color: var(--fg-2); margin-top: 6px; letter-spacing: -0.005em; }

.drawer-crumb {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.close-x {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--fg-2);
  transition:
    background var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out),
    transform var(--d-fast) var(--ease-out);
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .close-x:hover { background: var(--card-bg); color: var(--light); }
}

.close-x:active { transform: scale(0.92); }

.drawer-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.btn {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--fg);
  background: transparent;
  transition:
    background var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out),
    transform var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--card-bg); border-color: var(--light); }
}

.btn:active { transform: scale(0.97); }

.btn--accent { border-color: var(--light); color: var(--light); }

@media (hover: hover) and (pointer: fine) {
  .btn--accent:hover { background: var(--accent-bg); }
}

/* Drawer sections */
.section { padding: 24px 30px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }

.section-h {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 14px;
}

/* Career timeline */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line-2);
}

.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; }

.timeline li::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dark);
  border: 1px solid var(--line-2);
}

.timeline li:first-child::before {
  background: var(--light);
  border-color: var(--light);
  box-shadow: 0 0 12px rgba(247, 240, 237, 0.5);
}

.timeline .org { font-weight: 600; color: var(--light); font-size: 14px; letter-spacing: -0.005em; }
.timeline .role { color: var(--fg-2); font-size: 13px; }

.timeline .range {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Rationale callout */
.callout {
  border-left: 2px solid var(--light);
  background: var(--card-bg);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--fg-2);
  letter-spacing: -0.005em;
  line-height: 1.55;
  margin-top: 16px;
}

.callout--match,
.callout--market { border-left-color: var(--light); }

/* Output cards */
.cards { display: flex; flex-direction: column; gap: 10px; }

.card-mini {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
}

.card-mini .repo {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--light);
}

.card-mini .meta { color: var(--muted); font-size: 11px; margin-top: 4px; letter-spacing: 0.04em; }

.quote {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.55;
}

.quote .attrib {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.linkedin-line { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Network paths */
.path { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.path:last-child { border-bottom: 0; }

.path .who { font-weight: 600; font-size: 14px; color: var(--light); }
.path .who .ctx { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; letter-spacing: 0.04em; }
.path .edge { color: var(--fg-2); font-size: 12px; }

/* Market chips on person */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  letter-spacing: -0.005em;
}

.chip .strength { display: inline-block; background: var(--light); border-radius: 1px; height: 8px; }

.chip[data-strength="strong"] .strength { width: 14px; height: 3px; }
.chip[data-strength="medium"] .strength { width: 10px; height: 2px; }
.chip[data-strength="historical"] .strength { width: 6px; height: 2px; opacity: 0.5; }

/* Activity log */
.log { display: flex; flex-direction: column; gap: 12px; }
.log li { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: baseline; }

.log .when {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log .what { font-size: 13px; color: var(--fg-2); }

.empty { font-size: 12px; color: var(--muted); font-style: italic; }

.note { background: var(--card-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.note .author { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--fg-2); }
.note .body { font-size: 13px; color: var(--fg-2); margin-top: 6px; line-height: 1.55; }

/* Market drawer */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }

.stat-tile { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }

.stat-tile .lbl { font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat-tile .val { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--light); margin-top: 4px; font-variant-numeric: tabular-nums; }

.spark { width: 100%; height: 64px; margin-bottom: 4px; }
.spark path.line { fill: none; stroke: var(--light); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: var(--light); opacity: 0.10; }
.spark .end { fill: var(--light); }

.round { display: grid; grid-template-columns: 1fr auto; align-items: baseline; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.round:last-child { border-bottom: 0; }

.round .co { font-weight: 600; font-size: 14px; color: var(--light); }
.round .dets { font-size: 12px; color: var(--fg-2); margin-top: 2px; }
.round .lead { color: var(--muted); margin-left: 6px; font-size: 11px; letter-spacing: 0.06em; }

.round .when {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.mini-person {
  display: grid;
  grid-template-columns: 2px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition:
    transform var(--d-fast) var(--ease-out),
    background var(--d-fast) var(--ease-out);
  width: 100%;
  text-align: left;
}

.mini-person:last-child { border-bottom: 0; }

.mini-person .bar {
  width: 2px;
  height: 22px;
  background: var(--light);
  border-radius: 1px;
  transition: width var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}

.mini-person .who { font-weight: 600; font-size: 14px; color: var(--light); }
.mini-person .meta { font-size: 12px; color: var(--muted); margin-top: 2px; letter-spacing: -0.005em; }

@media (hover: hover) and (pointer: fine) {
  .mini-person:hover { transform: translateX(2px); }
  .mini-person:hover .bar { width: 3px; box-shadow: 0 0 12px var(--light); }
}

.mini-person:active { transform: translateX(2px) scale(0.997); }
.mini-person[data-disabled="true"] { cursor: default; }
.mini-person[data-disabled="true"] .bar { background: var(--muted); opacity: 0.5; }

/* Match drawer */
.drawer-name .person-x-market .x {
  color: var(--muted);
  font-weight: 400;
  margin: 0 0.3em;
  font-size: 0.85em;
  vertical-align: 4%;
}

.drawer-head .match-score {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--light);
  white-space: nowrap;
}

.snapshot-foot { margin-top: 14px; }
.snapshot-meta { font-size: 13px; color: var(--fg-2); margin-bottom: 12px; }

/* =========================================================
   Greeting block — sits above the hero trio on home.
   Four togglable framings; small monospace toggle strip.
   ========================================================= */

.hero .greeting {
  max-width: 680px;
  margin: 0;
  color: var(--fg-2);
  transition: opacity 180ms var(--ease-out), filter 180ms var(--ease-out);
}

.hero .greeting.blip { opacity: 0; filter: blur(2px); }

.greeting-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
}

.greeting-line {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--muted);
  font-weight: 400;
}

/* Stagger entrance — matches the hero-row .word transition */
.greeting-body,
.greeting-meta {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out),
    filter 700ms var(--ease-out);
}

.greeting-body.in,
.greeting-meta.in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Inline pixelarticons icons — inherit surrounding text colour so dim prose
   icons stay muted while bold-link icons read as bright. */
.greeting-line .ico {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  position: relative;
  top: -1px;
  color: inherit;
}

/* Leading sun before "Good morning" — direct child of the line, no link wrapping */
.greeting-line > .ico {
  color: var(--light);
}

/* Greeting links — bold cream tokens, mirroring the feed-row title style.
   No dotted underline; weight + colour carry the affordance. */
.greeting-body .g-link,
.greeting-line .g-link {
  color: var(--light);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--d-fast) var(--ease-out);
  /* Greeting links may be <a> or <button> — flatten button chrome so the
     two render identically inline. */
  display: inline;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Meta-row links sit a notch quieter — a tertiary surface, not a CTA. */
.greeting-meta .g-link {
  color: var(--fg-2);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--d-fast) var(--ease-out);
}

.greeting .g-link .ico { color: inherit; }

@media (hover: hover) and (pointer: fine) {
  .greeting .g-link:hover { color: var(--light); }
  .greeting .g-link:hover .ico { color: var(--light); }
}

.greeting-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.greeting-stat {
  white-space: nowrap;
  color: var(--fg-2);
}

.greeting-dot {
  margin: 0 8px;
  color: var(--muted-2);
}

.greeting-toggle {
  display: inline-flex;
  gap: 2px;
  margin-top: 16px;
}

.g-toggle {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    color var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    background var(--d-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .g-toggle:hover {
    color: var(--light);
    border-color: var(--line-2);
  }
}

.g-toggle[aria-pressed="true"] {
  color: var(--brand);
  background: var(--light);
  border-color: var(--light);
}

@media (max-width: 720px) {
  .hero .greeting { max-width: none; }
  .greeting-body { font-size: 14px; }
}

/* =========================================================
   Magic page sub-heading + sources chip row
   ========================================================= */

.page-sub {
  margin: 0 0 22px;
  font-size: clamp(13px, 1.1vw, 15px);
  color: var(--fg-2);
  line-height: 1.55;
  max-width: 720px;
  letter-spacing: -0.005em;
}

.page-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 40px;
}

.page-source-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
}

/* =========================================================
   Sidebar — sort group: radio styling matches checkboxes
   ========================================================= */

.filter-item input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  margin: 0;
  flex-shrink: 0;
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: background var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out);
}

.filter-item input[type="radio"]:checked {
  background: var(--light);
  border-color: var(--light);
}

.filter-item input[type="radio"]:checked::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
}

.filter-item:has(input:checked) { color: var(--light); }

/* List radio rows in the Magic sidebar can wrap longer titles cleanly */
.filter-group[data-group="list"] .filter-label {
  white-space: normal;
  line-height: 1.35;
}

/* Narrow viewport — collapse stat-row to two columns */
@media (max-width: 720px) {
  .drawer .stat-row { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Reduced motion
   ========================================================= */

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

  .hero-row .word { transform: none; filter: none; transition: opacity 200ms ease; }
  .feed-row { transform: none !important; transition: opacity 200ms ease !important; }
  .drawer { transition: opacity 120ms ease; }
  .drawer:not(.open),
  .drawer.closing { transform: translateX(100%); }
  .backdrop { transition: opacity 120ms linear; }
  .drawer-inner { transition: opacity 120ms ease; }
  .drawer-inner.swapping-out, .drawer-inner.swapping-in { transform: none; filter: none; }

  .page.swapping-out, .page.swapping-in {
    transform: none !important;
    filter: none !important;
    transition: opacity 120ms ease !important;
  }
  .listing { transition: none; }
  .page--list .page-sidebar,
  .page--list .page-heading,
  .page--list .page-sub,
  .page--list .page-sources,
  .page--list .listing {
    transform: none !important;
    filter: none !important;
    transition: opacity 200ms ease !important;
  }
  .hero .greeting { transition: opacity 120ms ease; filter: none !important; }
  .greeting-body, .greeting-meta {
    transform: none !important;
    filter: none !important;
    transition: opacity 200ms ease !important;
  }
}

/* ---------- Linked output cards (GitHub repos, X quotes) -----------------
   Reveal interactivity on hover; ext-arrow nudges right.
   ------------------------------------------------------------------------ */
.drawer .card-mini--link {
  text-decoration: none;
  color: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 14px;
  align-items: baseline;
  padding: 4px 0;
  transition: transform var(--d-fast) var(--ease-out);
}
.drawer .card-mini--link .repo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.drawer .ext-arrow {
  display: inline-flex;
  color: var(--muted);
  transition: transform var(--d-fast) var(--ease-out),
              color    var(--d-fast) var(--ease-out);
}
.drawer .ext-arrow svg { display: block; }
@media (hover: hover) and (pointer: fine) {
  .drawer .card-mini--link:hover .repo { color: var(--light); }
  .drawer .card-mini--link:hover .ext-arrow,
  .drawer .quote--link:hover .ext-arrow {
    color: var(--light);
    transform: translate(2px, -2px);
  }
}

.drawer .quote--link {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-top: 4px;
}
.drawer .quote--link .quote-body {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: var(--fg-2);
  line-height: 1.55;
}
.drawer .quote--link .attrib {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

/* Punchier quick-stats values */
.drawer .section--stats .qs-val {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

/* =========================================================
   Narrow viewports
   ========================================================= */

@media (max-width: 720px) {
  .brand { top: 14px; left: 16px; }
  .brand img, .brand svg { height: 18px; }
  .topbar-right { top: 14px; right: 16px; gap: 14px; }
  .topnav { gap: 14px; }
  .topnav-link { font-size: 12px; }
  .back { top: 50px; left: 16px; }
  .page--home, .page--list { padding: 24px 16px 80px; }
  body:not([data-route="home"]) .page--list { padding-top: 90px; }
  .drawer { width: 100vw; }
  .stat-row { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 1fr; gap: 4px; }
}
