/* ============================================================
   alfrednaayem.com — Ace deck system
   Design tokens lifted from the Alcanah Ace deck +
   ace.alcanah.co + ace-access admin dashboard.
   ============================================================ */

:root {
  /* palette */
  --paper: #f7f2e8;
  --paper-deep: #f1eadc;
  --ink: #151515;
  --ink-soft: #2d2b28;
  /* primary accent (warm amber to match the paper deck) */
  --blue: #b45309;
  --blue-soft: #cfe2ff;
  --blue-deep: #92400e;
  --muted: #5e574e;
  --muted-deep: #4d4740;
  --amber: #d97706;
  --amber-deep: #b45309;
  --green: #059669;
  --green-soft: #bde7a4;
  --yellow: #ffe28a;
  --pink: #ffc6da;
  /*
   * --live: the reserved "live ink" token.
   * Permitted ONLY on elements that are live or responsive right now:
   * agent-pulse dots, reader-stream arrivals, "now" indicators.
   * FORBIDDEN in static decoration, headings, borders, illustrations,
   * and anywhere inside the article prose column.
   * Hue: electric cobalt #1d3fd8 (contrast 6.83:1 on --paper, WCAG AA pass).
   * Coral ember #e8836b was evaluated and failed WCAG AA at 2.39:1.
   */
  --live: #1d3fd8;
  --grid-line: rgba(21, 21, 21, 0.045);
  --line: rgba(21, 21, 21, 0.15);
  --card: rgba(255, 255, 255, 0.62);
  --card-strong: rgba(255, 255, 255, 0.78);
  --logo-filter: none;

  /* offset shadows — never blurred */
  --shadow-xs: 3px 4px 0 rgba(0, 0, 0, 0.08);
  --shadow-sm: 4px 5px 0 rgba(0, 0, 0, 0.08);
  --shadow: 6px 7px 0 rgba(0, 0, 0, 0.10);
  --shadow-lg: 10px 12px 0 rgba(0, 0, 0, 0.12);

  /* radii — varied to avoid templated feel */
  --r-pill: 999px;
  --r-card: 18px 22px 16px 24px;
  --r-card-tight: 16px;
  --r-card-loose: 28px 22px 34px 24px;

  /* spacing */
  --space-xs: 0.4rem;
  --space-sm: 0.8rem;
  --space-md: 1.4rem;
  --space-lg: 2.4rem;
  --space-xl: 4.2rem;
  --space-2xl: 6.4rem;

  /* type */
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Courier New", ui-monospace, Menlo, Monaco, monospace;
}

/* ============================================================
   dark mode — same structure, inverted surfaces, dimmed tiles
   ============================================================ */
[data-theme="dark"] {
  --paper: #1a1816;
  --paper-deep: #262320;
  --ink: #ece6dc;
  --ink-soft: #c8c2b8;
  --blue: #f59e0b;        /* warm amber pops on dark */
  --blue-soft: #2a2316;   /* tile background */
  --blue-deep: #fbbf24;
  --muted: #9b9285;
  --muted-deep: #b5ad9f;
  --amber: #f59e0b;
  --amber-deep: #fbbf24;
  --green: #4ade80;
  --green-soft: #1f3a25;
  --yellow: #4a3a14;
  --pink: #3a1f2a;
  --grid-line: rgba(255, 250, 240, 0.04);
  --line: rgba(255, 250, 240, 0.14);
  --card: rgba(255, 250, 240, 0.04);
  --card-strong: rgba(255, 250, 240, 0.08);
  /* invert dark logos (Alcanah SVG, GPGV) so they read on dark bg */
  --logo-filter: invert(1) hue-rotate(180deg);
  /* live ink in dark mode: a slightly lighter cobalt so the dot reads
     against the dark paper surface (contrast 5.82:1, WCAG AA pass) */
  --live: #5b82f5;
  color-scheme: dark;
}

/* ============================================================
   reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
html { scroll-behavior: smooth; font-size: 17.5px; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  position: relative;
}

/* paper grid overlay — the deck's "graph paper" feel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 0%, #000 70%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, #000 70%, transparent 100%);
}

main { position: relative; z-index: 1; }
img, svg { max-width: 100%; display: block; }


/* ============================================================
   layout
   ============================================================ */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1.2rem, 4vw, 2.4rem);
  position: relative;
}
.wrap-narrow { max-width: 760px; }
.wrap-prose { max-width: 680px; }

.section { padding: clamp(2.4rem, 5vw, 4.2rem) 0; }
.section-tight { padding: clamp(1.6rem, 3vw, 2.4rem) 0; }

/* ============================================================
   header / nav
   ============================================================ */
.site-header {
  position: relative;
  z-index: 5;
  padding: 1.6rem 0 1.2rem;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
}
.site-header .header-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-soft);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
  display: inline-block;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-dot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand:hover { color: var(--blue); }

.theme-toggle {
  background: var(--card-strong);
  border: 1.5px solid var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
.theme-toggle:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.nav a {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
}
.nav a:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}
.nav a.active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

/* ============================================================
   typography
   ============================================================ */
.kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-deep);
  display: inline-block;
}
.kicker-blue { color: var(--blue); }

h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.05; }

.h-display {
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.06;
  max-width: 18ch;
}
.h-display .accent {
  color: var(--blue);
  font-style: italic;
  font-weight: 850;
}

h1.page-title {
  font-size: clamp(1.8rem, 3.6vw, 2.8rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.08;
  max-width: 22ch;
}
h1.page-title .accent { color: var(--blue); font-style: italic; }

h2.section-title {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 850;
  letter-spacing: -0.035em;
}

h3 {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

p { color: var(--ink-soft); }
.lede {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 56ch;
  letter-spacing: -0.012em;
}
.muted { color: var(--muted); }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* ============================================================
   pills / chips / badges
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 2px solid var(--ink);
  background: var(--card-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.pill-blue { background: rgba(23, 105, 255, 0.12); border-color: var(--blue); color: var(--blue-deep); }
.pill-amber { background: rgba(217, 119, 6, 0.14); border-color: var(--amber); color: var(--amber-deep); }
.pill-green { background: rgba(5, 150, 105, 0.14); border-color: var(--green); color: var(--green); }
.pill-soft { border-width: 1.5px; padding: 4px 10px; font-size: 11.5px; }

/* ============================================================
   buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--r-pill);
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.012em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 9px 0 rgba(0, 0, 0, 0.14);
  text-decoration: none;
  color: var(--paper);
}
.btn-secondary {
  background: var(--paper);
  color: var(--ink);
}
.btn-secondary:hover {
  background: #fff;
  color: var(--ink);
}
.btn-blue {
  background: var(--blue);
  border-color: var(--ink);
  color: #fff;
}
.btn-blue:hover { color: #fff; }

/* ============================================================
   cards (the workhorse element — every list uses these)
   ============================================================ */
.card {
  position: relative;
  display: block;
  padding: clamp(1.2rem, 2vw, 1.6rem);
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 9px 0 rgba(0, 0, 0, 0.14);
  text-decoration: none;
}
.card.tilt-l { transform: rotate(-0.5deg); }
.card.tilt-r { transform: rotate(0.5deg); }
.card.tilt-l:hover { transform: rotate(-0.5deg) translate(-2px, -2px); }
.card.tilt-r:hover { transform: rotate(0.5deg) translate(-2px, -2px); }

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.card-meta time,
.card-meta .read-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-deep);
}
.card-title {
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 0.55rem;
}
.card-excerpt {
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 62ch;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  color: var(--blue);
  font-weight: 700;
  font-size: 0.92rem;
}
.card:hover .card-link { text-decoration: underline; text-underline-offset: 3px; }

/* big featured card (rotated, larger) */
.card-feature {
  padding: clamp(1.8rem, 3.2vw, 2.6rem);
  border-radius: var(--r-card-loose);
  border-width: 3px;
  box-shadow: var(--shadow-lg);
  background: var(--card-strong);
}
.card-feature .card-title {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.card-feature .card-excerpt {
  font-size: 1.08rem;
}

/* ============================================================
   grids
   ============================================================ */
.grid {
  display: grid;
  gap: clamp(1rem, 1.8vw, 1.4rem);
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-stack { grid-template-columns: 1fr; }

@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   repo / GitHub treatments
   ============================================================ */

/* dark strip on top of repo-linked cards */
.card--repo {
  padding: 0;
  overflow: hidden;
}
.card--repo .card-body,
.card--repo .nb-body {
  padding: clamp(1.1rem, 2vw, 1.6rem);
}

.repo-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.55rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 2.5px solid var(--ink);
  font-family: var(--font-mono);
  position: relative;
  overflow: hidden;
}
.repo-strip::before {
  /* faint terminal grain — micro-detail that signals "code" */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 5px 5px;
  pointer-events: none;
  opacity: 0.7;
}
.repo-strip > * { position: relative; z-index: 1; }
.repo-strip .repo-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.repo-strip .repo-mark svg {
  width: 15px;
  height: 15px;
  color: var(--paper);
  flex-shrink: 0;
}
.repo-strip .repo-name {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--blue-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.repo-strip .repo-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--paper);
  background: rgba(255, 226, 138, 0.16);
  border: 1px solid rgba(255, 226, 138, 0.45);
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.repo-strip .repo-stars svg {
  width: 11px;
  height: 11px;
  color: var(--yellow);
  flex-shrink: 0;
}
.repo-strip .repo-stars[data-loading="true"] {
  opacity: 0.5;
}

/* notebook entry repo variant */
.nb-entry.nb-entry-repo {
  display: block;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card-strong);
  box-shadow: var(--shadow-sm);
  margin: 0.5rem 0;
  overflow: hidden;
}
.nb-entry.nb-entry-repo:hover {
  padding-left: 0;
  background: var(--card-strong);
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.10);
}
.nb-entry.nb-entry-repo::before { display: none; }
.nb-entry.nb-entry-repo .nb-body {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 1rem;
  padding: 0.85rem 1rem;
  align-items: baseline;
}
@media (max-width: 760px) {
  .nb-entry.nb-entry-repo .nb-body {
    grid-template-columns: 1fr;
    gap: 0.3rem;
    padding: 0.85rem 0.9rem;
  }
}

/* ============================================================
   GH badge — header pill linking to GitHub
   ============================================================ */
.gh-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 7px 14px 7px 11px;
  /* Fixed dark "terminal" chip in BOTH themes. It must not ride --ink/--paper,
     which invert in dark mode and flip the pill to washed-out grey, stranding
     its light divider + grain. Pinned hex == the light-mode token values, so
     light mode is unchanged and dark mode keeps the intended dark chip. */
  border: 1.5px solid #151515;
  border-radius: 999px;
  background: #151515;
  color: #f7f2e8;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}
.gh-badge::before {
  /* same terminal grain as repo-strip — visual tie */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 5px 5px;
  pointer-events: none;
  opacity: 0.6;
}
.gh-badge > * { position: relative; z-index: 1; }
.gh-badge:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
  text-decoration: none;
  color: #f7f2e8;
}
.gh-badge svg {
  width: 15px;
  height: 15px;
  color: #f7f2e8;
}
.gh-badge .gh-handle {
  color: #cfe2ff;
}
.gh-badge .gh-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding-left: 0.45rem;
  margin-left: 0.1rem;
  border-left: 1px solid rgba(247, 242, 232, 0.25);
  color: #ffe28a;
}
.gh-badge .gh-stars svg {
  width: 13px;
  height: 13px;
  color: #ffe28a;
}
.gh-badge .gh-stars[data-loading="true"] {
  opacity: 0.5;
}

@media (max-width: 760px) {
  .gh-badge { font-size: 11.5px; padding: 6px 11px 6px 9px; }
  .gh-badge svg { width: 13px; height: 13px; }
}

/* the footer copy of the badge (where the chip lives on phones):
   .site-footer .foot-links a outguns .gh-badge on specificity, so
   re-assert the dark pill treatment */
.site-footer .foot-links a.gh-badge {
  background: #151515;
  color: #f7f2e8;
  border: 1.5px solid #151515;
  padding: 7px 14px 7px 11px;
}
.site-footer .foot-links a.gh-badge:hover {
  background: #151515;
  color: #f7f2e8;
}

/* ============================================================
   site footer
   ============================================================ */
.site-footer {
  margin-top: clamp(3rem, 6vw, 5rem);
  border-top: 2px solid var(--ink);
  padding: 2rem 0 2.4rem;
  background: var(--paper-deep);
  position: relative;
  z-index: 1;
}
.site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  flex-wrap: wrap;
}
.site-footer .foot-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-deep);
}
.site-footer .foot-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.site-footer .foot-links a {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 8px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  text-decoration: none;
  background: var(--card);
}
.site-footer .foot-links a:hover { background: var(--ink); color: var(--paper); }

/* ============================================================
   utility
   ============================================================ */
.row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.stack-sm > * + * { margin-top: 0.6rem; }
.stack-md > * + * { margin-top: 1.2rem; }
.stack-lg > * + * { margin-top: 2rem; }

.dot-divider {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.eyebrow-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

/* simple SVG signature flourish — used as decoration */
.flourish {
  display: inline-block;
  width: 64px;
  height: 14px;
  background: var(--blue);
  border-radius: 999px;
  transform: rotate(-1.5deg);
  margin-top: 0.6rem;
}

@media (max-width: 760px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .nav { gap: 0.2rem; }
  .nav a { padding: 5px 10px; font-size: 11px; }
}

/* ------------------------------------------------------------
   phone header (≤480px) — compact two-row header:
   row 1: avatar + name, theme toggle pinned to the right edge;
   row 2: the full nav on ONE line (labels untouched — they're
   Alfred's ownership-clear labels). The GitHub/star chips move
   to the footer at this width; the agent strip stays.
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .site-header { padding: 0.9rem 0 0.7rem; }
  .site-header .wrap { gap: 0.55rem; align-items: stretch; }
  /* identity row: the toggle rides inline with the brand instead of
     owning a third row (the wrap is already position: relative) */
  .site-header .theme-toggle {
    position: absolute;
    top: 0;
    right: clamp(1.2rem, 4vw, 2.4rem);
    width: 32px;
    height: 32px;
  }
  /* GitHub + star chips live in the footer on phones */
  .site-header .gh-badge { display: none; }
  .site-header .header-right { width: 100%; gap: 0; }
  /* one-line nav: tighter type + gaps; if a future label pushes past
     the edge it scrolls quietly instead of wrapping (no scrollbar) */
  .nav {
    flex-wrap: nowrap;
    width: 100%;
    gap: 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-left: -6px; /* optically align the first label with the avatar */
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a {
    flex: none;
    white-space: nowrap;
    padding: 6px 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }
}
@media (max-width: 374px) {
  .nav a { font-size: 10px; padding: 6px 7px; }
}

/* ============================================================
   MOTION BASELINE — PB-087 wave 1 (site-experience)
   Additive section only. Nothing above this line was touched.
   Everything here is progressive enhancement: pages render
   identically with this section deleted, minus the motion.
   ============================================================ */

/* ------------------------------------------------------------
   (a) .reveal — fade-up on scroll entry, wired by
   /assets/motion.js (IntersectionObserver at 12% visibility).

   P0 contract (stranger audit, 2026-06-11): CONTENT IS NEVER
   HIDDEN WHILE WAITING. There is no standing opacity:0 state —
   every element renders fully visible in every browser, with or
   without JS, observer or no observer. The entrance exists only
   as a finite animation that motion.js triggers when the
   observer ACTUALLY FIRES for an element that was below the
   viewport at scan time. Headless browsers, readers, and
   JS-degraded clients simply see a complete, still page.

   The animation drives the `translate` property (not transform)
   so it composes with tilt transforms on .card.tilt-l/.tilt-r
   and never fights the hover-lift transitions. Sibling stagger
   comes from --reveal-index, capped at 5 (max 6-item stagger).
   ------------------------------------------------------------ */
@keyframes reveal-up {
  from { opacity: 0; translate: 0 14px; }
}
html.js-motion .reveal.is-revealed {
  animation: reveal-up 450ms cubic-bezier(0.16, 0.84, 0.28, 1) backwards;
  animation-delay: calc(min(var(--reveal-index, 0), 5) * 70ms);
}

/* ------------------------------------------------------------
   (b) richer hover physics — later-cascade additions only.
   .card and .pill keep their original rule blocks untouched;
   these rules win by source order and give the lift a clearer
   arc: bigger travel, shadow that grows with it, ease-out feel,
   transform-origin biased low so the lift reads as "up off the
   desk" rather than a scale from center.
   ------------------------------------------------------------ */
.card {
  transform-origin: 50% 85%;
  transition:
    transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1),
    box-shadow 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 9px 11px 0 rgba(0, 0, 0, 0.16);
}
.card.tilt-l:hover { transform: rotate(-0.5deg) translate(-3px, -3px); }
.card.tilt-r:hover { transform: rotate(0.5deg) translate(-3px, -3px); }

.pill {
  transform-origin: 50% 100%;
  transition:
    transform 0.15s cubic-bezier(0.2, 0.7, 0.3, 1),
    box-shadow 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* every pill gets a tiny lift; interactive pills travel further */
.pill:hover {
  transform: translateY(-1px);
}
a.pill:hover,
button.pill:hover {
  transform: translate(-1px, -2px);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.14);
  text-decoration: none;
}

/* ------------------------------------------------------------
   (b2) press states — buttons compress under the finger.
   Scale + shadow collapse, fast (sub-100ms feels mechanical).
   ------------------------------------------------------------ */
.btn:active {
  transform: translate(1px, 1px) scale(0.98);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.08);
  transition-duration: 0.07s;
}
.theme-toggle:active {
  transform: scale(0.94);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}
a.pill:active,
button.pill:active {
  transform: translate(0, 0) scale(0.98);
  box-shadow: none;
}

/* ------------------------------------------------------------
   (c) .pulse-dot — continuous slow breathe for live indicators.
   Halo expands while the dot itself swells slightly (scale
   property, so nothing else is disturbed). 2.4s loop.
   Color themeable per context via --pulse-color.
   ------------------------------------------------------------ */
@keyframes pulse-soft {
  0%   { box-shadow: 0 0 0 0 var(--pulse-halo, rgba(29, 63, 216, 0.38)); scale: 1; }
  45%  { scale: 1.18; }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; scale: 1; }
}
.pulse-dot {
  /* live-ink token: the only accent permitted on live/responsive elements */
  --pulse-color: var(--live);
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pulse-color);
  flex-shrink: 0;
  animation: pulse-soft 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ------------------------------------------------------------
   (d) .stream-in — arrival animation for stream entries.
   Slide-up + fade, 300ms. Stagger by setting --stream-index
   (0, 1, 2, …) inline on each entry.
   ------------------------------------------------------------ */
@keyframes stream-arrive {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.stream-in {
  animation: stream-arrive 300ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--stream-index, 0) * 90ms);
}

/* ------------------------------------------------------------
   (e) reduced motion kills all of the above.
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .stream-in,
  .pulse-dot {
    animation: none;
    opacity: 1;
    transform: none;
    translate: none;
  }
  /* belt-and-suspenders: the boot script never adds js-motion under
     reduced motion, but if the preference flips mid-session the
     entrance animation must not play (content is never hidden either
     way — there is no standing pre-reveal state) */
  html.js-motion .reveal.is-revealed {
    opacity: 1;
    animation: none;
  }
  .card,
  .pill {
    transition: none;
  }
  .card:hover,
  .pill:hover,
  a.pill:hover,
  button.pill:hover {
    transform: none;
  }
  .btn:active,
  .theme-toggle:active,
  a.pill:active,
  button.pill:active {
    transform: none;
  }
  .card.tilt-l:hover { transform: rotate(-0.5deg); }
  .card.tilt-r:hover { transform: rotate(0.5deg); }
}

/* ============================================================
   END MOTION BASELINE
   ============================================================ */

/* ============================================================
   WIRE SKELETON — PB-087 instant-paint pass (site-experience)
   Additive section only. First-visit placeholder rows for the
   pulse feed (homepage wire + /wire/): the section shell paints
   immediately, these breathe quietly until the feed lands.
   ============================================================ */
.wire-skel { pointer-events: none; }
.skel {
  display: inline-block;
  height: 0.85em;
  border-radius: 6px;
  background: var(--line);
  animation: skel-breathe 1.4s ease-in-out infinite;
}
.skel-time { width: 52px; }
.skel-agent { width: 96px; animation-delay: 0.15s; }
.skel-line { width: min(420px, 70%); animation-delay: 0.3s; }
@keyframes skel-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; opacity: 0.7; }
}
