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

:root {
  --cream: #e8e0d4;
  --ink: #111008;
  --warm-mid: #9a8f7e;
  --accent: #c4a882;
  /* RGB triplets of the palette, for rgba(var(--x-rgb), a) alpha use.
     Keep in sync with the hex values above. */
  --cream-rgb: 232, 224, 212;
  --ink-rgb: 17, 16, 8;
  --accent-rgb: 196, 168, 130;
  /* image-frame roles: shadow is the house lift, edge is the tan outline.
     Used together as the site-wide framed-object treatment — a deliberate
     house style (revisited + kept during the 2026-06 design-deslop pass). */
  --frame-shadow: 0 8px 40px rgba(0,0,0,0.7);
  --frame-edge: 0 0 0 1.5px rgba(var(--accent-rgb),0.35);
  /* type roles: prose = long-form copy (bios, excerpts, case-study body).
     IBM Plex Sans — engineered grotesque, sibling of a mono family; cooler
     and more technical than DM Sans, which stays for display titles. */
  --font-prose: 'IBM Plex Sans', 'DM Sans', sans-serif;
  /* andrewander mark, filled-polygon lockup glyph (mirrors landing .site-mark
     geometry + viewBox). Used as a mask-image so it recolors via background.
     Fill is opaque (#000) because masks read alpha, not color. */
  --mark-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='127 6 422 312'%3E%3Cpolygon points='167.5,46.6 509.3,174.7 449.3,278.6' fill='%23000'/%3E%3Cpolygon points='167.5,46.6 176.8,190.5 287.1,219.6' fill='%23000'/%3E%3C/svg%3E");
}

/* warm-terminal selection — picks up --cs-accent-rgb inside case-study pages */
::selection {
  background: rgba(var(--cs-accent-rgb, 196, 168, 130), 0.85);
  color: var(--ink);
  text-shadow: none;
}

/* Visually-hidden: present for screen readers / document outline, removed from
   sight. Used for the per-subpage <h1> where the breadcrumb is the visual title. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Global keyboard-focus ring. Fallback for every focusable element without a
   custom :focus-visible (breadcrumbs, post titles, filters, transport, footer
   icons…). Elements with their own ring (.nav-item, .beat-tile) keep theirs via
   higher specificity; .subpage keeps outline:none (focused programmatically). */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html, body {
  height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: 'DM Mono', monospace;
  font-size: 18px;
}

body.page-loading {
  visibility: hidden;
}

/* ── SCROLLBARS — thin, accent-tinted; case-study pages pick up --cs-accent-rgb.
   Standard properties cover Firefox + Chrome 121+; ::-webkit-* covers Safari
   (Chrome ignores the webkit pseudos once scrollbar-color is set). ── */
html, .subpage, .bc-page {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--cs-accent-rgb, 196, 168, 130), 0.3) transparent;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(var(--cs-accent-rgb, 196, 168, 130), 0.28);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--cs-accent-rgb, 196, 168, 130), 0.5);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ── CURSOR TRAIL — phosphor-decay canvas (cursor-trail.js). Above lightbox
   (100), below the grain overlay (9999); screen blend = glow only brightens. ── */
.cursor-trail-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
  mix-blend-mode: screen;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── BAD-HASH READOUT — transient terminal note for an unknown #hash on load
   (js/mini-player.js _badHashReadout). Fades in/out, self-removes. ── */
.hash-error {
  position: fixed;
  top: 1.6rem;
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 160;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 1.1rem;
  background: rgba(18, 16, 14, 0.92);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.35;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.hash-error--in {
  opacity: 1;
  transform: translate(-50%, 0);
}
.hash-error-cmd { color: var(--cream); }
.hash-error-msg { color: var(--accent); opacity: 0.85; }
