/* Layout and components shared by all three themes. Colors and fonts come from /theme.css tokens. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.65;
  background-image: var(--bg-texture, none); background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight, 400); line-height: 1.1; margin: 0 0 .5em; letter-spacing: var(--display-tracking, 0); }
h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); }
h2 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--font-label, var(--font-body)); text-transform: uppercase; letter-spacing: .22em; font-size: .78rem; color: var(--accent); }

/* Page-wide fog (themes opt in with --page-fog: 1) */
.page-fog { position: fixed; inset: 0; z-index: -1; opacity: .75; pointer-events: none; }
body { isolation: isolate; }
.card, .scroll, .flavors label, .drop { backdrop-filter: blur(6px); }

/* Header / nav */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg, color-mix(in srgb, var(--bg) 88%, transparent)); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-size: .95rem; opacity: .85; }
.nav a:hover, .nav a[aria-current] { opacity: 1; color: var(--accent); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius); padding: 6px 10px; font: inherit; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; inset: 64px 0 auto 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: 14px 28px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--btn-bg, var(--accent)); color: var(--btn-ink, var(--bg)); font: 600 1rem var(--font-label, var(--font-body)); letter-spacing: .06em; text-transform: var(--btn-case, uppercase); text-decoration: none; cursor: pointer; box-shadow: var(--btn-glow, none); transition: transform .15s, box-shadow .2s, background .2s; }
.btn:hover { transform: translateY(-1px); color: var(--btn-ink, var(--bg)); box-shadow: var(--btn-glow-hover, var(--btn-glow, none)); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: wait; transform: none; }

/* Sections */
section { padding: clamp(56px, 9vw, 110px) 0; }
.hero { position: relative; overflow: hidden; padding-top: clamp(64px, 12vw, 150px); text-align: center; }
.hero p.lead { font-size: clamp(1.1rem, 2.4vw, 1.35rem); color: var(--muted); max-width: 640px; margin: 0 auto 2em; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); border: 0; margin: 0; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--card-shadow, none); }
.card h3 { color: var(--accent); }
.steps { counter-reset: s; display: grid; gap: 18px; }
.steps li { list-style: none; counter-increment: s; position: relative; padding-left: 58px; }
.steps li::before { content: counter(s, upper-roman); position: absolute; left: 0; top: -2px; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 50%; font-family: var(--font-label, var(--font-body)); font-size: .9rem; color: var(--accent); }

/* Forms */
.form { display: grid; gap: 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
input[type=text], textarea, select { width: 100%; padding: 13px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--input-bg, var(--surface)); color: var(--ink); font: inherit; }
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-2 { display: grid; grid-template-columns: 1fr 120px; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { margin-top: 5px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.flavors { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.flavors label { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; background: var(--surface); font-weight: 400; margin: 0; }
.flavors input { position: absolute; opacity: 0; }
.flavors label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.flavors b { display: block; color: var(--accent); font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; }
.drop { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: var(--surface); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); filter: var(--thumb-filter, grayscale(.3)); }
.error { color: var(--danger, #e46a5f); font-weight: 600; min-height: 1.4em; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 12px 16px; background: var(--surface); border-radius: var(--radius); font-size: .92rem; }

/* Result */
.scroll { background: var(--scroll-bg, var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 5vw, 56px); box-shadow: var(--card-shadow, none); position: relative; }
.scroll .curse-text p { font-size: 1.12rem; }
.sigil { width: 150px; height: 150px; margin: 0 auto 18px; color: var(--accent); }
.summoning { text-align: center; padding: 60px 0; }
.summoning .orb { width: 90px; height: 90px; border-radius: 50%; margin: 0 auto 24px; background: radial-gradient(circle, var(--accent) 0%, transparent 70%); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.35); opacity: .45; } }

/* Wall (shared by the wall page and the home-page strip) */
.wall { position: relative; overflow: hidden; background: var(--wall-bg, #050407); color: #efe6d6; isolation: isolate; }
.wall.full { height: calc(100vh - 64px); min-height: 520px; }
.wall.strip { height: 440px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wall .fog, .wall .relics, .wall .names { position: absolute; inset: 0; }
.wall .fog { z-index: 0; }
.wall .relics { z-index: 1; pointer-events: none; }
.wall .relics img, .wall .relics svg { position: absolute; opacity: 0; mix-blend-mode: screen; filter: var(--relic-filter, sepia(.4) brightness(1.1)); }
.wall .names { z-index: 2; pointer-events: none; }
.wall .name { position: absolute; transform: translate(-50%, -50%); text-align: center; opacity: 0; white-space: nowrap; text-shadow: 0 0 18px var(--wall-glow, rgba(255, 170, 90, .6)); }
.wall .name b { display: block; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.3rem, 3vw, 2.3rem); color: var(--wall-name, #f3e2c4); }
.wall .name i { display: block; font-style: italic; font-size: clamp(.8rem, 1.6vw, 1rem); color: var(--wall-title, #c7a37a); }
.wall .overlay { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: 24px 16px; text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.wall .vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .75) 100%); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; font-size: .88rem; color: var(--muted); text-align: center; }
.site-footer nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.site-footer a { color: var(--muted); }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 16px 0; }
summary { cursor: pointer; font-family: var(--font-display); font-size: 1.2rem; }
details p { margin-top: 10px; color: var(--muted); }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }
.theme-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ----- Mobile first: most visitors arrive from a phone ----- */
input[type=text], textarea, select { font-size: 16px; } /* no iOS zoom on focus */
.sticky-cta { display: none; }
@media (max-width: 760px) {
  body { font-size: 16px; }
  section { padding: 44px 0; }
  .hero { padding-top: 48px; }
  .hero .cta-row .btn, .form .btn, .card .btn { width: 100%; }
  .row-2 { grid-template-columns: 1fr 88px; }
  .flavors { grid-template-columns: 1fr 1fr; }
  .wall.strip { height: 360px; }
  .wall.full { height: calc(100svh - 64px); min-height: 460px; }
  .card { padding: 22px; }
  .sticky-cta { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
  .sticky-cta .btn { width: 100%; }
  body.has-sticky-cta { padding-bottom: 76px; }
}

/* Paid add-on */
.check.addon { border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px; background: var(--surface); }

/* Chat with the Spirits */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat { margin-top: 28px; }
.chat-log { display: grid; gap: 10px; margin: 18px 0; }
.bubble { padding: 12px 16px; border-radius: 16px; max-width: 88%; line-height: 1.55; white-space: pre-wrap; }
.bubble.user { justify-self: end; background: var(--accent); color: var(--btn-ink, #fff); border-bottom-right-radius: 4px; }
.bubble.assistant { justify-self: start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.pending { opacity: .7; font-style: italic; }
.bubble.error { border-color: var(--danger); color: var(--danger); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.chat-form textarea { min-height: 52px; }

/* Grimoire */
.grimoire-list { display: grid; gap: 16px; margin-top: 24px; }
.grimoire-item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; text-decoration: none; color: inherit; }
.grimoire-item img, .grimoire-item .ph { width: 96px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; color: var(--accent); }
.grimoire-item h3 { margin: 0 0 4px; font-size: 1.15rem; }
.grimoire-meta { font-size: .88rem; color: var(--muted); }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-row .card { flex: 1 1 140px; padding: 16px 20px; }
@media (max-width: 760px) { .grimoire-item { grid-template-columns: 72px 1fr; } .grimoire-item img, .grimoire-item .ph { width: 72px; height: 90px; } }

/* Casting progress */
.stages { list-style: none; padding: 0; margin: 18px auto 20px; max-width: 320px; text-align: left; display: grid; gap: 8px; }
.stages li { color: var(--muted); opacity: .45; padding-left: 28px; position: relative; transition: opacity .3s, color .3s; }
.stages li::before { content: ''; position: absolute; left: 4px; top: .55em; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--accent); }
.stages li.done { opacity: 1; }
.stages li.done::before { background: var(--accent); }
.stages li.now { color: var(--ink); }
.stages li.now::before { box-shadow: 0 0 12px var(--accent); animation: breathe 1.6s ease-in-out infinite; }

.after-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
[hidden] { display: none !important; }

/* Spirit faces surfacing through the fog on the Wall */
.wall .faces { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.wall .faces img { position: absolute; opacity: 0; mix-blend-mode: screen; filter: blur(1px); -webkit-mask-image: radial-gradient(ellipse at center, #000 45%, transparent 72%); mask-image: radial-gradient(ellipse at center, #000 45%, transparent 72%); }

/* Join the curse */
.wall .names .name { pointer-events: auto; cursor: pointer; }
.wall .name .voices { display: block; font-size: .72em; letter-spacing: .12em; text-transform: uppercase; color: var(--wall-title); opacity: .85; margin-top: 2px; min-height: 1em; }
.wall .name.joined b { text-shadow: 0 0 24px var(--accent), 0 0 8px var(--accent); }
.wall .name:focus-visible { outline: 1px dashed var(--accent); outline-offset: 6px; }
.wall .overlay.spotlight { padding: 40px 16px 22px; background: linear-gradient(transparent, rgba(0, 0, 0, .88) 38%); }
.wall .spotlight .eyebrow { margin: 0 0 6px; }
.wall .spotlight b { display: block; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 6vw, 2.8rem); color: var(--wall-name, #f3e2c4); text-shadow: 0 0 24px var(--wall-glow, rgba(255, 170, 90, .6)); }
.wall .spotlight i { display: block; font-style: italic; color: var(--wall-title, #c7a37a); margin: 2px 0 6px; }
.wall .spotlight .voices { display: block; min-height: 1.2em; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--wall-title); }
.wall .spotlight .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0 12px; }
.wall .spotlight .btn[disabled] { opacity: .75; cursor: default; }
.press-banner { border-left-color: var(--accent-2); }

/* Homepage: trust lines, what you receive, sample curse, testimonials, heritage, FAQ teasers */
.trust { margin: 14px 0 0; font-size: .85rem; letter-spacing: .02em; color: var(--muted); }
.band { background: linear-gradient(180deg, transparent, var(--surface) 30%, var(--surface) 70%, transparent); }
.receive { list-style: none; padding: 0; margin: 24px 0 8px; display: grid; gap: 14px; }
.receive li { padding-left: 26px; position: relative; line-height: 1.55; }
.receive li::before { content: '✦'; position: absolute; left: 0; top: 1px; color: var(--accent); }
.receive b { color: var(--ink); }
.sample { margin: 32px 0; padding: 22px 22px 18px; border-left: 2px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.sample .eyebrow { margin: 0 0 8px; }
.sample blockquote { margin: 0 0 10px; font-size: 1.15rem; line-height: 1.6; font-style: italic; color: var(--ink); }
.sample p { margin: 0; font-size: .85rem; }
.quotes .quote { margin: 0; }
.quotes blockquote { margin: 0 0 12px; font-size: 1.05rem; line-height: 1.6; color: var(--ink); }
.quotes figcaption { font-size: .82rem; }
.pull { margin: 28px 0; font-size: 1.2rem; line-height: 1.6; font-style: italic; color: var(--ink); }
.pull span { display: block; margin-top: 8px; font-size: .9rem; font-style: normal; color: var(--muted); }
.season { margin-top: 28px; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 40px rgba(184, 107, 255, .12); }
.season .eyebrow { margin: 0 0 8px; color: var(--accent-2); }
.teasers details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.teasers summary { cursor: pointer; font-size: 1.05rem; color: var(--ink); list-style: none; }
.teasers summary::-webkit-details-marker { display: none; }
.teasers summary::after { content: '+'; float: right; color: var(--accent); }
.teasers details[open] summary::after { content: '−'; }
.teasers p { margin: 10px 0 0; }
.spoken { margin: 26px auto 0; max-width: 460px; text-align: center; }
.spoken .eyebrow { margin: 0 0 8px; }
.spoken audio { width: 100%; }
