/* ── Cozy Café — espresso ground, steamed-cream text, caramel crema ──
   Built-in page theme (spec §5.3), applied by front matter `page.theme:
   "cafe"` on /cafe-clicker/ and /cafe-clicker-leaderboard/ (all locales).
   build/shell/head.mjs sets html[data-theme="cafe"][data-page-theme] before
   first paint, so an equipped shop theme never replaces it on these pages.
   Theme contract (spec §5.1): tokens, then a signature block (body
   background, header surface, logo, one decorative layer). The illustrated
   café scene (#cafe-bg-img, z -3) and the drifting petals (canvas#cafe-bg,
   z -1) are page markup driven by /cafe-clicker/cafe-bg.js; the scrim
   between them (z -2) is this theme's decorative layer.
   Contrast (WCAG): text/bg 16.6, text/surface-3 12.0, muted/surface-3 9.4,
   faint/surface-2 6.5, faint/surface-3 5.7, primary/bg 9.1, ink/primary 8.4,
   accents/surface-2 >= 7.0, ink/accents >= 8.0, control/bg-raised 5.0,
   focus/surface-2 11.2 (full list in the Task 9 report). */

/* ── Tokens ── */
[data-theme="cafe"] {
  --bg: #1a110a;
  --bg-raised: #21160d;
  --surface-1: #2a1c11;
  --surface-2: #332315;
  --surface-3: #3e2b1a;
  --border: #4d3622;
  --border-strong: #6e5033;
  --border-control: #a5815a;
  --text: #fbf1e1;
  --text-muted: #e8d6b8;
  --text-faint: #bfa682;
  --primary: #e3ab6b;
  --primary-hover: #efc08a;
  --primary-ink: #2a1708;
  --focus: #ffd99a;
  --cyan: #8fd6c9;
  --pink: #f4a6bf;
  --amber: #f2c66d;
  --coral: #f39a80;
  --lime: #bcdc8e;
  --violet: #cfb0ec;
  --success: #9fd47a;
  --danger: #f08a7a;
  --accent: var(--primary);
  --accent-ink: var(--primary-ink);
  --scrim: rgb(14 8 4 / 0.74);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(12 7 3 / 0.35);
  --shadow-2: 0 4px 12px rgb(12 7 3 / 0.5), 0 12px 32px rgb(12 7 3 / 0.42);
  --shadow-3: 0 12px 28px rgb(12 7 3 / 0.6), 0 28px 64px rgb(12 7 3 / 0.5);

  /* legacy names (style.css-era variables still read by page scripts/CSS) */
  --bg-deep: #1a110a;
  --bg-card: #2a1c11;
  --text-bright: #fbf1e1;
  --text-main: #e8d6b8;
  --primary-color: #e3ab6b;
  --primary-glow: color-mix(in srgb, #e3ab6b 40%, transparent);
  --accent-cyan: #8fd6c9;
  --accent-pink: #f4a6bf;
  --accent-amber: #f2c66d;
  --accent-coral: #f39a80;
  --accent-lime: #bcdc8e;
  --glass: #2a1c11;
  --glass-border: #4d3622;
}

/* ── Signature ── */
/* Ground: a roasted gradient, shown until (or instead of) the scene image. */
[data-theme="cafe"] body {
  background-color: #1a110a;
  background-image:
    radial-gradient(120% 80% at 50% 0%, #4a2f19 0%, transparent 60%),
    linear-gradient(180deg, #2b1b0f 0%, #1a110a 55%, #120b06 100%);
  background-attachment: fixed;
}
[data-theme="cafe"] #star-canvas { display: none; }
/* Warm scrim over the illustrated scene: keeps every text pair at its token
   contrast while the café art reads through at the edges. */
[data-theme="cafe"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(135% 125% at 50% 26%, rgb(26 16 8 / 0.34), rgb(12 7 3 / 0.66));
}
[data-theme="cafe"] .site-header {
  background: linear-gradient(180deg, #2e1d10, #22160c);
  border-block-end: 1px solid #6e5033;
  box-shadow: inset 0 -1px 0 rgb(227 171 107 / 0.32), 0 8px 20px -10px rgb(0 0 0 / 0.7);
}
[data-theme="cafe"] .logo {
  background: linear-gradient(100deg, #fbe8c8 0%, #e3ab6b 55%, #c98a4b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 1px 0 rgb(12 7 3 / 0.6));
}
/* Decorative layer: the illustrated café scene and its drifting petals.
   Markup lives in the page's `before` section; /cafe-clicker/cafe-bg.js?v=b6d956d4
   loads the art after window load (the roasted ground shows until then),
   adds a slight scroll parallax and animates the petals. */
[data-theme="cafe"] #cafe-bg-img {
  position: fixed;
  inset-inline: 0;
  inset-block-start: -6%;
  block-size: 112%;
  z-index: -3;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  will-change: transform;
}
[data-theme="cafe"] #cafe-bg {
  position: fixed;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  z-index: -1;
  display: block;
  pointer-events: none;
}

/* The current shared heading needs its own backing over the illustrated roof. */
body.cc-theme main > .page-head { position: relative; isolation: isolate; }
body.cc-theme main > .page-head::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  inset: -12px 0;
  background: linear-gradient(180deg, transparent, rgb(22 13 6 / .9) 12px, rgb(22 13 6 / .9) calc(100% - 12px), transparent);
}
