/* ============================================================
   base.css — resets, layers, and shared components
   (buttons, the golden plus, chips, scrollbars).
   Module-specific styles live in hud/title/podium/reader/store.css.
   ============================================================ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050505; }
body {
  color: var(--paper); font-family: var(--body); font-size: 18px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; z-index: var(--z-world); }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
#ui > * { pointer-events: auto; }
#ui > .hud, #ui > .prompt, #ui > .toasts { pointer-events: none; }
#ui > .hud > * { pointer-events: auto; }
.layer { position: fixed; inset: 0; }
#loading  { z-index: var(--z-loading); }
#title    { z-index: var(--z-title); }
#hud      { z-index: var(--z-hud); }
#prompt   { z-index: var(--z-prompt); }
#podium   { z-index: var(--z-podium); }
#dialogue { z-index: var(--z-dialogue); }
#store    { z-index: var(--z-store); }
#reader   { z-index: var(--z-reader); }
#cart     { z-index: var(--z-cart); }
#toasts   { z-index: var(--z-toast); }
#yt-host  { position: fixed; width: 1px; height: 1px; left: -10px; top: -10px; overflow: hidden; opacity: 0; pointer-events: none; }

button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sand-lt); outline-offset: 2px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .5em; cursor: pointer;
  font-family: var(--util); font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  padding: .7em 1.2em; border-radius: 999px; border: 1px solid var(--glass-line);
  background: var(--glass); color: var(--sand-lt); backdrop-filter: blur(var(--glass-blur));
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { border-color: var(--glass-line-2); background: var(--glass-strong); }
.btn:active { transform: translateY(1px); }
.btn.solid { background: linear-gradient(180deg, var(--sand-lt), var(--sand)); color: var(--green-deep); border-color: transparent; }

/* ---- The golden “+” bubble ---- */
.gold-plus {
  --s: 38px;
  width: var(--s); height: var(--s); border-radius: 50%; border: 0; cursor: pointer; flex: none;
  display: grid; place-items: center; position: relative;
  font-family: var(--util); font-weight: 400; font-size: calc(var(--s) * .62); line-height: 1; color: var(--gold-4);
  background:
    radial-gradient(circle at 34% 28%, var(--gold-hi) 0 12%, transparent 34%),
    radial-gradient(circle at 50% 60%, var(--gold-1), var(--gold-2) 58%, var(--gold-3) 100%);
  box-shadow: 0 0 0 1px rgba(110,71,16,.55), 0 4px 14px rgba(0,0,0,.35), 0 0 18px var(--gold-glow), inset 0 -3px 6px rgba(110,71,16,.45);
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease);
}
.gold-plus:hover { transform: scale(1.08); box-shadow: 0 0 0 1px rgba(110,71,16,.6), 0 6px 18px rgba(0,0,0,.4), 0 0 28px var(--gold-glow), inset 0 -3px 6px rgba(110,71,16,.45); }
.gold-plus.added { color: var(--green-deep); }
.gold-plus .plus-price {
  position: absolute; top: -6px; right: -10px; font-size: 10px; letter-spacing: .06em;
  padding: 2px 5px; border-radius: 999px; background: var(--green-deep); color: var(--sand-lt); border: 1px solid var(--glass-line);
}

/* ---- Chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: .45em; cursor: pointer; white-space: nowrap;
  font-family: var(--util); font-size: 12px; letter-spacing: .08em;
  padding: .45em .9em; border-radius: 999px; border: 1px solid var(--glass-line);
  background: rgba(5,19,12,.55); color: var(--sand-lt);
}
.chip[aria-pressed="true"], .chip.active { background: var(--sand-lt); color: var(--green-deep); border-color: transparent; }

/* ---- Scrollbars ---- */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--sand-dim) transparent; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Debug: ?hud=0 or ?shot=… hides every overlay so screenshots show only the world */
.no-hud #hud, .no-hud #prompt, .no-hud #toasts { display: none !important; }

/* Portal flash: a breath of the portal's colour over the whole screen when stepping through */
.portal-flash {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--portal, #3F7FD9) 85%, white) 0%, var(--portal, #3F7FD9) 45%, transparent 85%);
  mix-blend-mode: screen; opacity: 0;
  animation: portal-flash 1.4s ease-out forwards;
}
@keyframes portal-flash { 0% { opacity: 0; } 18% { opacity: .85; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .portal-flash { animation-duration: .5s; } }

/* "The basilica is ready": a card over the storefront, in the store's scheme (tan ground, deep-green ink) */
.ready-pop {
  position: fixed; right: 24px; bottom: 24px; z-index: 70; max-width: 430px;
  display: grid; grid-template-columns: 52px 1fr; gap: 10px 14px; align-items: center;
  padding: 18px 20px 16px; border-radius: 16px;
  background: linear-gradient(180deg, #F3E6C6, #E6D3A6); color: #05130C;
  box-shadow: 0 18px 50px rgba(5, 19, 12, .35), 0 0 0 1px rgba(5, 19, 12, .25);
  font-family: Jost, system-ui, sans-serif;
  opacity: 0; transform: translateY(16px); transition: opacity .4s ease, transform .4s ease;
}
.ready-pop.on { opacity: 1; transform: none; }
.ready-pop .rp-mark { width: 52px; height: 52px; }
.ready-pop .rp-text b { display: block; font: 600 20px/1.2 'Cormorant Garamond', Georgia, serif; letter-spacing: .01em; }
.ready-pop .rp-text span { display: block; margin-top: 3px; font-size: 14px; line-height: 1.4; color: #24372A; }
.ready-pop .rp-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.ready-pop button { cursor: pointer; font: 500 12px/1 Jost, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; padding: 11px 16px; border-radius: 999px; border: 1px solid #05130C; }
.ready-pop .rp-go { background: linear-gradient(180deg, #164029, #06170E); color: #F3E3BD; }
.ready-pop .rp-stay { background: transparent; color: #05130C; border-color: rgba(5, 19, 12, .45); }
.ready-pop button:focus-visible { outline: 2px solid #A9721C; outline-offset: 2px; }
@media (max-width: 520px) { .ready-pop { left: 12px; right: 12px; bottom: 12px; max-width: none; } }

/* ---------- the data-use scale (js/core/data.js) ---------- */
html[data-data="text"] .jk img, html[data-data="text"] .st-plate img { display: none; }
.st-data { display: flex; justify-content: center; padding: 10px 16px 0; position: relative; z-index: 2; }
.dscale { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; color: var(--store-ink, #0A2416); font-family: var(--util, system-ui, sans-serif); max-width: 760px; }
.dscale-k { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; opacity: .8; }
.dscale-track { display: inline-flex; border: 1px solid currentColor; border-radius: 999px; padding: 2px; gap: 2px; background: rgba(255,255,255,.35); }
.dscale-step { appearance: none; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; border-radius: 999px; padding: 5px 12px; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 64px; }
.dscale-l { font-size: 13px; font-weight: 600; }
.dscale-e { font-size: 10px; opacity: .7; letter-spacing: .02em; }
.dscale-step:hover { background: rgba(10,36,22,.08); }
.dscale-step.on { background: var(--store-ink, #0A2416); color: #F3E9D2; }
.dscale-step:focus-visible { outline: 2px solid var(--gold-2, #E6B653); outline-offset: 2px; }
.dscale-note { flex-basis: 100%; text-align: center; font-size: 12px; opacity: .75; font-style: italic; }
/* in the HUD's dark settings popover */
.dscale--compact { color: var(--hud-ink, #EDE3CE); justify-content: flex-start; gap: 6px 10px; }
.dscale--compact .dscale-track { background: rgba(0,0,0,.25); }
.dscale--compact .dscale-step { min-width: 0; padding: 4px 9px; }
.dscale--compact .dscale-step:hover { background: rgba(255,255,255,.08); }
.dscale--compact .dscale-step.on { background: var(--gold-2, #E6B653); color: #0A2416; }
.dscale--compact .dscale-note { text-align: left; }
@media (max-width: 480px) {
  .dscale { gap: 6px; }
  .dscale-k { flex-basis: 100%; text-align: center; }
  .dscale-step { min-width: 0; padding: 5px 9px; }
}
/* Lean and Text use the device's own serif, which runs wider than Cinzel: keep the store's title on one screen */
@media (max-width: 600px) { .st .st-word { font-size: 9.2vw; letter-spacing: .18em; padding-left: .18em; } }
html[data-data="lean"] .st .st-word, html[data-data="text"] .st .st-word { letter-spacing: .14em; }
@media (max-width: 600px) { html[data-data="lean"] .st .st-word, html[data-data="text"] .st .st-word { font-size: 8.4vw; } }
