/* Stable shell stylesheet: self-hosted font faces shared by every page in
   the offline shell, plus the shared quiet-room layer for the non-instrument
   pages (blog, press, privacy, 404). Never load fonts from Google Fonts —
   both families are served first-party and precached by the service worker.
   The URL /site-shell.css is part of the service worker's required stable
   assets — do not rename or move this file. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/fraunces.woff2') format('woff2');
}

@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/quicksand-latin-500-normal.woff2') format('woff2');
}

/* ---------------------------------------------------------------------------
   Quiet-room layer — shared shell for every reading page (body.site-shell).
   Approved foundation tokens only: #0a0a0a background, #e8e6e1 primary text,
   #9b9892 secondary text, surfaces #1a1a1a / #2a2522.
--------------------------------------------------------------------------- */

body.site-shell {
  --bg: #0a0a0a;
  --fg: #e8e6e1;
  --muted: #9b9892;
  --surface: #1a1a1a;
  --surface-warm: #2a2522;
  --accent: #c8d8ff;
  --accent-soft-dim: #8592c2; /* measured 4.5:1+ on #0a0a0a (Task 23) */
  --border: #1f1f1f;
}

html { background: #0a0a0a; }

body.site-shell {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  /* Local Quicksand for reading text — never a system-first stack. */
  font-family: 'Quicksand', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 500;
  line-height: 1.65;
  padding: env(safe-area-inset-top) 1.5rem env(safe-area-inset-bottom);
}

/* Readable column that never clips: works from 320px up. */
body.site-shell main {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  margin: 3rem auto 5rem;
}

/* Article text stays selectable — a reading page never disables selection. */
body.site-shell main,
body.site-shell article {
  -webkit-user-select: text;
  user-select: text;
}

body.site-shell h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.7rem, 5.5vw, 2.4rem);
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  overflow-wrap: break-word;
}

body.site-shell h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 400;
  margin: 2.2rem 0 0.6rem;
  color: var(--fg);
}

body.site-shell p { margin: 0.4rem 0 1rem; }

body.site-shell a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 216, 255, 0.35);
}
body.site-shell a:hover { border-bottom-color: var(--accent); }

/* Visible focus everywhere in the quiet room. */
body.site-shell :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Breadcrumbs + the lowercase Fraunces wordmark. */
body.site-shell .crumbs {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}
body.site-shell .crumbs a {
  color: var(--muted);
  border-bottom: none;
}
body.site-shell .crumbs a:hover { color: var(--fg); }
.wordmark-link {
  font-family: 'Fraunces', Georgia, serif;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}

/* Media never forces a horizontal scroll. */
body.site-shell img,
body.site-shell svg {
  max-width: 100%;
}

/* Wide content (tables) scrolls inside its own container — the page body
   never scrolls horizontally. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0 1.5rem;
}
.table-scroll table { margin: 0; }

/* Listen-now containers: the stable path back to the instrument. Placed as
   dedicated blocks near the beginning and end of long content — never
   injected into arbitrary paragraphs. */
.listen-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 2rem 0;
  padding: 0.9rem 1.1rem;
  background: linear-gradient(180deg, #2a2522 0%, #1a1a1a 100%);
  border: 1px solid var(--border, #1f1f1f);
  border-radius: 14px;
}
.listen-now-action {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border-radius: 20px;
  background: #1a1a1a;
  color: var(--accent, #c8d8ff);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(200, 216, 255, 0.25);
  border-bottom: 1px solid rgba(200, 216, 255, 0.25);
}
.listen-now-action:hover {
  border-color: var(--accent, #c8d8ff);
}
.listen-now-install {
  font-size: 0.88rem;
  color: var(--muted, #9b9892);
  border-bottom: 1px solid rgba(155, 152, 146, 0.4);
  text-decoration: none;
}
.listen-now-install:hover { color: var(--fg, #e8e6e1); }

/* Quiet footer: home + blog + privacy primary-ish, press deliberately
   subordinate (same row, muted, last). */
body.site-shell .shell-footer {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  margin: 0 auto 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}
body.site-shell .shell-footer a {
  color: var(--muted);
  border-bottom: none;
}
body.site-shell .shell-footer a:hover { color: var(--fg); }

/* Sparse cosmos decoration: purely visual, aria-hidden in markup, inert to
   the pointer, low-density (a handful of dim star specks), and pinned behind
   the z-index:1 reading column so it can never overlay text. */
.shell-cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(232, 230, 225, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 9%, rgba(200, 216, 255, 0.45) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 88% 62%, rgba(232, 230, 225, 0.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 74%, rgba(200, 216, 255, 0.35) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 46% 92%, rgba(232, 230, 225, 0.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 38%, rgba(232, 230, 225, 0.22) 50%, transparent 51%);
  background-repeat: no-repeat;
}
