/* The pack-opening demo (/open/). Same faces and palette as the landing page and the gallery. */
@font-face { font-family: "Grenze Gotisch"; src: url("/fonts/GrenzeGotisch.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/fonts/Cinzel.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/EBGaramond.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --char: #16110c; --char-soft: #221a12; --char-line: #3a2e21;
  --parchment: #e7d9bb; --parchment-soft: #cdbb97;
  --ink: #211a12; --ember: #b3491a; --gold: #e2b45a;
  --theme: 106, 79, 142;       /* the chosen product's colour, r, g, b */
  --display: "Grenze Gotisch", "Cinzel", serif;
  --eyebrow: "Cinzel", serif;
  --body: "EB Garamond", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--char); }
body { min-height: 100vh; color: var(--parchment); font-family: var(--body); font-size: 1.125rem; line-height: 1.5; -webkit-font-smoothing: antialiased; background: var(--char); }
a { color: inherit; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 clamp(0.75rem, 3vw, 2rem); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { display: flex; align-items: center; gap: 1.2rem; padding: 1rem 0; border-bottom: 1px solid var(--char-line); position: relative; z-index: 3; }
.wordmark { font-family: var(--display); font-weight: 600; font-size: 1.6rem; text-decoration: none; }
.top nav { display: flex; gap: 1.1rem; margin-left: auto; font-family: var(--ui); font-size: 0.9rem; align-items: center; }
.top nav a { text-decoration: none; color: var(--parchment-soft); }
.top nav a:hover { color: var(--parchment); }
.top nav a[aria-current] { color: var(--parchment); font-weight: 600; pointer-events: none; box-shadow: inset 0 -2px 0 var(--ember); padding-bottom: 0.15rem; }
.top nav a.play { color: #fff; background: var(--ember); border-radius: 999px; padding: 0.15rem 0.8rem; }
@media (max-width: 520px) { .top nav a:not(.play):not([aria-current]) { display: none; } }

/* ---------- the stage ---------- */
.stage {
  position: relative; height: max(620px, calc(100vh - 62px)); height: max(620px, calc(100svh - 62px));
  overflow: hidden; isolation: isolate;
  background:
    radial-gradient(ellipse 46% 52% at 50% 46%, rgba(var(--theme), 0.30), transparent 70%),
    radial-gradient(ellipse 90% 70% at 50% 110%, rgba(var(--theme), 0.16), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, #241a11 0%, #120d09 60%, #080605 100%);
  transition: background 0.8s ease;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.stage::after { /* a soft vignette over everything but the HUD */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 75% 70% at 50% 48%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; outline: none; }
.hud { position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; padding: 0 clamp(0.75rem, 3vw, 2rem); }
.hud > * { pointer-events: auto; }
.hud-top { top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding-top: 1.2rem; }
.titles { max-width: 34rem; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); pointer-events: none; }
.eyebrow { font-family: var(--eyebrow); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.titles h1 { font-family: var(--eyebrow); font-weight: 700; font-size: clamp(1.6rem, 3.6vw, 2.5rem); line-height: 1.05; letter-spacing: 0.03em; margin-top: 0.15rem; }
.sub { color: var(--parchment-soft); font-size: 1rem; margin-top: 0.3rem; }
.toggles { display: flex; gap: 0.4rem; }
.icon { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid rgba(231, 217, 187, 0.25); background: rgba(22, 17, 12, 0.6); color: var(--parchment); cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px); }
.icon svg { width: 1.25rem; height: 1.25rem; }
.icon[aria-pressed="false"] .on, .icon[aria-pressed="true"] .off { display: none; }
.icon:hover { border-color: var(--gold); }

.hint {
  position: absolute; left: 50%; bottom: 9.6rem; transform: translateX(-50%); z-index: 2; pointer-events: none;
  font-family: var(--eyebrow); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--parchment);
  text-shadow: 0 2px 10px #000; opacity: 0; transition: opacity 0.5s ease; width: max-content; max-width: 92vw; text-align: center; line-height: 1.5;
}
.hint.on { opacity: 0.9; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.5; } }

.hud-bottom { bottom: 0; padding-bottom: 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; min-height: 2.8rem; }
.btn {
  font-family: var(--eyebrow); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--parchment); background: rgba(22, 17, 12, 0.72); border: 1px solid rgba(226, 180, 90, 0.45);
  border-radius: 999px; padding: 0.75rem 1.4rem; cursor: pointer; backdrop-filter: blur(6px);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
}
.btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.btn:focus-visible, .icon:focus-visible, .pick:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn.primary {
  color: #1a120a; border-color: #f2d28a;
  background: linear-gradient(180deg, #f6dc98 0%, #e2b45a 45%, #b9832f 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 6px 24px rgba(226, 180, 90, 0.25);
}
.btn.primary:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 6px 30px rgba(226, 180, 90, 0.45); }
.btn.small { padding: 0.45rem 0.9rem; font-size: 0.75rem; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

.picker { display: flex; gap: 0.5rem; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding: 0.3rem; scrollbar-width: none; }
.picker > :first-child { margin-left: auto; } .picker > :last-child { margin-right: auto; } /* centred, but scrollable from the first when it overflows */
.pick {
  flex: none; display: flex; align-items: center; gap: 0.55rem; cursor: pointer;
  padding: 0.35rem 0.9rem 0.35rem 0.4rem; border-radius: 12px;
  background: rgba(22, 17, 12, 0.6); border: 1px solid rgba(231, 217, 187, 0.14); color: var(--parchment-soft);
  font-family: var(--ui); font-size: 0.8rem; text-align: left; backdrop-filter: blur(6px);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.pick img { width: 34px; height: 45px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
.pick b { display: block; font-family: var(--eyebrow); font-size: 0.82rem; letter-spacing: 0.04em; color: var(--parchment); }
.pick:hover { border-color: rgba(226, 180, 90, 0.5); }
.pick[aria-checked="true"] { border-color: rgb(var(--c)); background: rgba(var(--c), 0.22); color: var(--parchment); }
@media (max-width: 640px) { .pick span.kind { display: none; } .pick { padding-right: 0.6rem; } .hint { bottom: 8.8rem; font-size: 0.72rem; } }

.stage.inspecting .actions, .stage.inspecting .hint { visibility: hidden; }
.inspect { position: absolute; z-index: 2; left: 50%; bottom: 6.2rem; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 10px #000; }
.inspect-name { font-family: var(--eyebrow); font-weight: 700; font-size: 1.3rem; letter-spacing: 0.04em; }
.inspect-meta { font-family: var(--ui); font-size: 0.8rem; color: var(--parchment-soft); margin: 0.1rem 0 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; }
.inspect-meta .r { font-weight: 600; }

/* ---------- no WebGL: plain images ---------- */
.fallback[hidden] { display: none; } /* the author display would override [hidden] and cover the canvas */
.fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 8rem 1rem 11rem; z-index: 1; }
.fallback .product { max-height: 100%; max-width: min(420px, 80vw); filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.7)); }
.fallback .cards { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; max-width: 900px; max-height: 100%; overflow: auto; }
.fallback .cards img { width: clamp(90px, 15vw, 150px); border-radius: 6px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6); animation: deal 0.4s ease both; }
@keyframes deal { from { opacity: 0; transform: translateY(20px) scale(0.95); } }

/* ---------- below the stage ---------- */
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem 2.5rem; padding: 3rem 0 1rem; }
.about h2 { font-family: var(--eyebrow); font-size: 1rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.4rem; }
.about p { color: var(--parchment-soft); }
footer { padding: 2.5rem 0 2rem; color: #8d7c62; font-family: var(--ui); font-size: 0.8rem; text-align: center; }

/* ---------- the deck list ---------- */
dialog { margin: auto; border: 1px solid var(--char-line); border-radius: 14px; padding: 1.2rem 1.3rem 1.4rem; background: #1b140e; color: var(--parchment); width: min(1080px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(8, 6, 4, 0.82); backdrop-filter: blur(3px); }
.dl-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dl-head h2 { font-family: var(--eyebrow); font-size: 1.4rem; letter-spacing: 0.04em; }
.dl-theme { color: var(--parchment-soft); font-size: 1rem; margin: 0.3rem 0 0.8rem; max-width: 70ch; }
.dl-body h3 { font-family: var(--eyebrow); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin: 1rem 0 0.5rem; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.7rem; }
.dl-card { position: relative; }
.dl-card img { width: 100%; display: block; border-radius: 6px; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); aspect-ratio: 63 / 88; background: #2a2118; }
.dl-card .n { position: absolute; right: 6px; top: 6px; font-family: var(--ui); font-weight: 600; font-size: 0.75rem; background: rgba(0, 0, 0, 0.75); border-radius: 999px; padding: 0.05rem 0.45rem; }
