/* ————— Tartarian Chronicles — themed landing ————— */

/* Book theme tokens. Only the .themed top zone paints with these;
   everything below uses the static light palette further down. */
body {
  /* base colors sampled from the backdrop artwork so they blend seamlessly */
  --bg: #0284c0;
  --bg-deep: #026da0;
  --gold: #f3c74f;
  --ink: #ffffff;
  --muted: #d9edfa;
  --btn-ink: #2b1d04;
  --hairline: color-mix(in srgb, var(--gold) 45%, transparent);
  --glow: color-mix(in srgb, var(--gold) 55%, transparent);
}
body[data-book="through"] {
  --bg: #1b5891; --bg-deep: #164a7c; --gold: #e9bd4d;
  --ink: #f4f1e6; --muted: #cdd9f0;
}
body[data-book="refuge"] {
  --bg: #77090c; --bg-deep: #5e0709; --gold: #eec257;
  --ink: #f7efe2; --muted: #e5c9bb;
}
body[data-book="darkness"] {
  --bg: #000000; --bg-deep: #000000; --gold: #e9bd4d;
  --ink: #f2ede4; --muted: #bdb4a8;
}
body[data-book="brotherhood"] {
  --bg: #012257; --bg-deep: #011a43; --gold: #eabf55;
  --ink: #f4f1e6; --muted: #c3cfe7;
}

*, *::before, *::after { box-sizing: border-box; }

/* browsers skip the UA [hidden] rule for SVG — enforce it (fixes phantom gap at top) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: #faf7f1; /* paper — the resting background of the site */
  min-height: 100dvh;
}

h1, h2, h3 {
  font-family: Oswald, "Arial Narrow", Impact, sans-serif;
  text-transform: uppercase;
  color: var(--gold);
  transition: color .7s ease;
  margin: 0;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

/* ————— Themed top zone (header + carousel showcase) ————— */
.themed {
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
  transition: background-color .7s ease, color .7s ease, border-color .7s ease;
}
.themed > * { position: relative; z-index: 1; }

.backdrop {
  position: absolute; inset: 0; z-index: 0 !important; overflow: hidden;
  pointer-events: none;
}
.scene { position: absolute; inset: 0; opacity: 0; transition: opacity .55s ease; }
.scene.is-active { opacity: 1; }
.pgroup { position: absolute; }
.piece { position: absolute; opacity: 0; }

/* entrances — re-run every time a scene becomes active */
.scene.is-active .anim-rise  { animation: pieceRise .9s cubic-bezier(.2, .7, .25, 1) var(--d, 0s) both; }
.scene.is-active .anim-bloom { animation: pieceBloom 1.05s cubic-bezier(.2, .7, .25, 1) var(--d, 0s) both; }
.scene.is-active .anim-sweep { animation: pieceSweep .95s cubic-bezier(.2, .7, .25, 1) var(--d, 0s) both; }
.scene.is-active .anim-spin  { animation: pieceSpin 1.1s cubic-bezier(.25, .7, .3, 1) var(--d, 0s) both; }
.scene.is-active .anim-pop   { animation: piecePop .75s cubic-bezier(.2, .7, .3, 1.2) var(--d, 0s) both; }
.scene.is-active .anim-fly   {
  animation: pieceFly .9s cubic-bezier(.2, .7, .25, 1) var(--d, 0s) both,
             pieceBob 5.5s ease-in-out calc(var(--d, 0s) + 1.1s) infinite alternate;
}
.scene.is-active .piece--sparka,
.scene.is-active .piece--sparkb {
  animation: piecePop .75s cubic-bezier(.2, .7, .3, 1.2) var(--d, 0s) both,
             pieceShimmer 3.6s ease-in-out calc(var(--d, 0s) + 1.4s) infinite alternate;
}
@keyframes pieceRise    { from { opacity: 0; transform: translateY(36px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pieceBloom   { from { opacity: 0; transform: translateY(20px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pieceSweep   { from { opacity: 0; transform: translateX(52px) rotate(1.2deg); } to { opacity: 1; transform: translateX(0) rotate(0); } }
@keyframes pieceSpin    { from { opacity: 0; transform: rotate(-8deg) scale(.96); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes piecePop     { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
@keyframes pieceFly     { from { opacity: 0; transform: translate(-44px, 26px) scale(.72); } to { opacity: 1; transform: translate(0, 0) scale(1); } }
@keyframes pieceBob     { from { transform: translateY(0); } to { transform: translateY(-9px); } }
@keyframes pieceShimmer { from { opacity: 1; } to { opacity: .55; } }

/* through — bare tree on the right: trunk rises, canopy blooms after */
.pgroup--tree {
  right: 0; top: 0; height: 100%; aspect-ratio: 1072 / 941;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%);
  mask-image: linear-gradient(90deg, transparent, #000 12%);
}
.piece--trunk {
  bottom: 0; left: 0; width: 100%;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%);
  mask-image: linear-gradient(180deg, transparent, #000 14%);
}
.piece--canopy {
  top: 0; left: 0; width: 100%; transform-origin: 70% 100%;
  -webkit-mask-image: linear-gradient(180deg, #000 84%, transparent);
  mask-image: linear-gradient(180deg, #000 84%, transparent);
}

/* refuge — the tiled emblems pop into their corners */
.piece--emb-tl {
  top: -2%; left: -1%; width: clamp(200px, 24vw, 420px); transform-origin: 15% 15%;
  -webkit-mask-image: radial-gradient(140% 140% at 0% 0%, #000 55%, transparent 82%);
  mask-image: radial-gradient(140% 140% at 0% 0%, #000 55%, transparent 82%);
}
.piece--emb-br {
  bottom: -2%; right: -1%; width: clamp(210px, 25vw, 440px); transform-origin: 85% 85%;
  -webkit-mask-image: radial-gradient(140% 140% at 100% 100%, #000 55%, transparent 82%);
  mask-image: radial-gradient(140% 140% at 100% 100%, #000 55%, transparent 82%);
}

/* darkness — phoenix sweeps in from the right, tail flames rise */
.pgroup--phoenix {
  right: 0; top: 0; height: 100%; aspect-ratio: 701 / 1672;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%);
  mask-image: linear-gradient(90deg, transparent, #000 10%);
}
.piece--wings { top: 0; left: 0; width: 100%; transform-origin: 100% 30%; }
.piece--tail {
  bottom: 0; left: 0; width: 100%;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 9%);
  mask-image: linear-gradient(180deg, transparent, #000 9%);
}

/* brotherhood — the range rises, the dragon flies in and hovers */
.piece--mtn {
  bottom: 0; right: 0; width: clamp(320px, 46vw, 700px);
  -webkit-mask-image: linear-gradient(100deg, transparent 4%, #000 30%);
  mask-image: linear-gradient(100deg, transparent 4%, #000 30%);
}
.piece--dragon { top: 13%; right: clamp(90px, 20vw, 340px); width: clamp(64px, 8vw, 118px); }

/* silver — the light ring turns into place, sparkles pop and shimmer */
.piece--ring {
  right: -5%; top: 2%; height: 94%; width: auto; transform-origin: 56% 50%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%);
  mask-image: linear-gradient(90deg, transparent, #000 10%);
}
.piece--sparka { left: 4vw; top: 9%; width: clamp(80px, 9vw, 170px); }
.piece--sparkb { left: 11vw; bottom: 12%; width: clamp(84px, 9.5vw, 180px); }

/* shade so headline and copy stay readable over the art */
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, .1) 0%, rgba(0, 0, 0, .03) 28%,
    rgba(0, 0, 0, .32) 72%, rgba(0, 0, 0, .44) 100%);
}

/* ————— Header ————— */
.site-header {
  display: flex; align-items: center; gap: 2rem;
  max-width: 76rem; margin: 0 auto;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem) .9rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand__emblem { color: var(--gold); flex-shrink: 0; transition: color .7s ease; }
.brand__name {
  display: block;
  font-family: Oswald, "Arial Narrow", sans-serif;
  font-weight: 600; text-transform: uppercase;
  font-size: 1.2rem; line-height: 1.15; letter-spacing: .22em;
  color: var(--gold); transition: color .7s ease;
}
.brand__orn { color: var(--gold); margin-top: .45rem; transition: color .7s ease; }

.site-nav { display: flex; gap: clamp(1rem, 2.6vw, 2.2rem); margin-inline: auto; }
.site-nav a {
  font-family: Oswald, sans-serif; font-weight: 400;
  font-size: .82rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding: .35rem 0;
  background: linear-gradient(var(--gold), var(--gold)) bottom left / 0 2px no-repeat;
  transition: background-size .25s ease, color .3s ease;
}
.site-nav a:hover { background-size: 100% 2px; color: var(--gold); }

.header-actions { display: flex; align-items: center; gap: .75rem; }
.cart-button {
  position: relative;
  display: grid; place-items: center;
  width: 2.55rem; height: 2.55rem;
  padding: 0; border-radius: 999px; cursor: pointer;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border: 1px solid var(--gold);
  transition: transform .18s ease, background-color .25s ease;
}
.cart-button:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--gold) 20%, transparent); }
.cart-button:active { transform: translateY(0) scale(.96); }
.cart-button__count {
  position: absolute; top: -.35rem; right: -.35rem;
  min-width: 1.25rem; height: 1.25rem; padding: 0 .32rem;
  display: grid; place-items: center;
  border-radius: 999px;
  font-family: Oswald, sans-serif; font-size: .68rem; line-height: 1;
  color: #251806; background: var(--gold);
  border: 1px solid color-mix(in srgb, var(--bg-deep) 55%, transparent);
}

/* ————— Buttons ————— */
.btn {
  display: inline-block; cursor: pointer;
  font-family: Oswald, sans-serif; font-weight: 500;
  font-size: .85rem; letter-spacing: .24em; text-transform: uppercase;
  text-decoration: none; text-align: center;
  padding: .8rem 1.9rem; border-radius: 3px;
  transition: transform .18s ease, box-shadow .25s ease,
              background-color .3s ease, color .3s ease, border-color .3s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn--solid { background: var(--gold); color: var(--btn-ink); border: 1px solid var(--gold); }
.btn--solid:hover { box-shadow: 0 6px 22px var(--glow); }
.btn--outline { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.btn--outline:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.btn--sm { padding: .6rem 1.4rem; font-size: .78rem; }

/* ————— Hero: carousel + copy ————— */
.hero {
  max-width: 72rem; margin: 0 auto;
  padding: .5rem clamp(1rem, 4vw, 2.5rem) clamp(2.5rem, 5vw, 4rem);
  text-align: center;
}

.carousel {
  display: flex; align-items: center; gap: clamp(.25rem, 2vw, 1.5rem);
  max-width: 64rem; margin: 0 auto;
  --cw: clamp(10rem, 20vw, 14.5rem); /* center cover width */
}
.carousel__stage {
  position: relative; flex: 1; min-width: 0;
  height: calc(var(--cw) * 1.72);
}
.car-book {
  position: absolute; left: 50%; top: 50%;
  width: var(--cw);
  padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 4px;
  transition: transform .6s cubic-bezier(.22, .75, .25, 1), opacity .6s ease;
}
.car-book img {
  width: 100%; aspect-ratio: 943 / 1500; object-fit: cover;
  border-radius: 3px 7px 7px 3px;
  box-shadow: 0 22px 44px rgba(0, 0, 0, .45);
}
/* dimming veil — plain compositing, no filters (they raster unreliably) */
.car-book::after {
  content: ""; position: absolute; inset: 0;
  background: #000; opacity: 0; border-radius: 3px 7px 7px 3px;
  transition: opacity .6s ease; pointer-events: none;
}
.car-book[data-pos="0"] {
  transform: translate(-50%, -50%) scale(1);
  z-index: 6; cursor: default;
}
.car-book[data-pos="-1"] {
  transform: translate(-50%, -50%) translateX(-72%) scale(.78) perspective(1100px) rotateY(18deg);
  z-index: 4;
}
.car-book[data-pos="1"] {
  transform: translate(-50%, -50%) translateX(72%) scale(.78) perspective(1100px) rotateY(-18deg);
  z-index: 4;
}
.car-book[data-pos="-1"]::after, .car-book[data-pos="1"]::after { opacity: .34; }
.car-book[data-pos="-2"] {
  transform: translate(-50%, -50%) translateX(-128%) scale(.62) perspective(1100px) rotateY(25deg);
  z-index: 2; opacity: .94;
}
.car-book[data-pos="2"] {
  transform: translate(-50%, -50%) translateX(128%) scale(.62) perspective(1100px) rotateY(-25deg);
  z-index: 2; opacity: .94;
}
.car-book[data-pos="-2"]::after, .car-book[data-pos="2"]::after { opacity: .52; }
.car-book:not([data-pos="0"]):hover::after { opacity: .14; }
.car-book[data-pos="0"] img { animation: float 7s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateY(-4px); } to { transform: translateY(6px); } }

.car-nav {
  flex: 0 0 auto; width: 3rem; height: 3rem;
  display: grid; place-items: center;
  border-radius: 50%; cursor: pointer;
  color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, transparent);
  border: 1px solid var(--gold);
  transition: background-color .25s ease, transform .18s ease, color .3s ease, border-color .3s ease;
  z-index: 7;
}
.car-nav:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); transform: scale(1.06); }
.car-nav:active { transform: scale(.95); }
.car-nav--next svg { transform: scaleX(-1); }

.hero__copy { max-width: 44rem; margin: 1.6rem auto 0; }

.eyebrow {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  font-family: Oswald, sans-serif; font-size: .85rem;
  letter-spacing: .45em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 .7rem; transition: color .7s ease;
}
.eyebrow::before, .eyebrow::after {
  content: ""; width: 3.2rem; height: 1px; background: var(--gold);
  transition: background-color .7s ease;
}

.hero__title {
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  font-weight: 600; line-height: 1.04; letter-spacing: .05em;
  text-wrap: balance;
}

.ornament { color: var(--gold); margin: .9rem auto .7rem; display: block; transition: color .7s ease; }

.tagline {
  font-family: Oswald, sans-serif; font-weight: 400;
  font-size: .95rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 .9rem; transition: color .7s ease;
}

.desc {
  color: var(--muted); font-size: 1.06rem; line-height: 1.75;
  max-width: 52ch; margin: 0 auto 1.6rem; transition: color .7s ease;
}

.hero__cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* hero switch choreography — transform/opacity only */
[data-stagger] { will-change: transform, opacity; }
.is-leaving [data-stagger] {
  animation: sink .22s ease-in both;
  animation-delay: calc(var(--i) * 22ms);
}
.is-entering [data-stagger] {
  animation: rise .5s cubic-bezier(.2, .7, .25, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
@keyframes sink { to { opacity: 0; transform: translateY(10px); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ————— Light zone: everything below the themed top ————— */
main.light, .site-footer {
  --gold: #8a5e14;          /* bronze — readable on paper */
  --ink: #2b2621;
  --muted: #6b6257;
  --btn-ink: #fdfaf3;
  --hairline: #e3dac7;
  --glow: rgba(138, 94, 20, .28);
  color: var(--ink);
}
main.light h1, main.light h2, main.light h3, .site-footer .brand__name { transition: none; }

/* ————— Series rail ————— */
.series {
  text-align: center;
  background: #f5f1e8;
  border-bottom: 1px solid var(--hairline);
  padding: clamp(2.2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2.5rem);
}
.section-title {
  font-size: 1.05rem; font-weight: 500; letter-spacing: .38em;
  margin-bottom: 2rem;
}
.section-title .dot { letter-spacing: 0; }

.rail {
  display: flex; justify-content: center; gap: clamp(.8rem, 2.4vw, 1.8rem);
  max-width: 68rem; margin: 0 auto 2.2rem;
  list-style: none; padding: 0;
}
.rail__book {
  flex: 0 1 11.5rem; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
}
.rail__book img {
  width: 100%; aspect-ratio: 340 / 541; object-fit: cover;
  border-radius: 3px;
  border: 1px solid #dcd2bd;
  box-shadow: 0 8px 20px rgba(52, 42, 22, .18);
}
.rail__caption {
  display: block; margin-top: .7rem;
  font-family: Oswald, sans-serif; font-size: .72rem;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--muted);
}
.rail__title {
  display: block; margin-top: .3rem;
  min-height: 2.8em;
  font-family: Oswald, sans-serif; font-size: .86rem; line-height: 1.35;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink);
}
.rail__price {
  display: block; margin: .35rem 0 .75rem;
  color: var(--gold); font-weight: 700;
}
.rail__cart {
  width: 100%;
  padding-inline: .8rem;
  letter-spacing: .14em;
}

/* ————— Cart drawer ————— */
.cart-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17, 14, 10, .46);
  opacity: 0; transition: opacity .25s ease;
}
body.cart-open .cart-backdrop { opacity: 1; }
.cart-panel {
  --gold: #8a5e14;
  --ink: #2b2621;
  --muted: #6b6257;
  --btn-ink: #fdfaf3;
  --glow: rgba(138, 94, 20, .28);
  position: fixed; top: 0; right: 0; z-index: 60;
  width: min(100vw, 27rem); height: 100dvh;
  display: flex; flex-direction: column;
  color: var(--ink); background: #fbf7ed;
  border-left: 1px solid #ded2bd;
  box-shadow: -22px 0 50px rgba(25, 19, 10, .22);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .28s cubic-bezier(.2, .7, .25, 1), visibility .28s ease;
}
body.cart-open .cart-panel { transform: translateX(0); visibility: visible; }
.cart-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.2rem 1.2rem 1rem;
  border-bottom: 1px solid #e2d7c5;
}
.cart-panel__head h2 {
  font-size: 1.2rem; letter-spacing: .18em; color: var(--gold);
}
.cart-panel__eyebrow {
  margin: 0 0 .15rem;
  font-family: Oswald, sans-serif; font-size: .68rem; letter-spacing: .24em;
  text-transform: uppercase; color: var(--muted);
}
.icon-button {
  display: grid; place-items: center;
  width: 2.4rem; height: 2.4rem; padding: 0;
  border-radius: 999px; border: 1px solid #d7c8ad;
  color: var(--gold); background: #fffaf1; cursor: pointer;
  transition: transform .18s ease, border-color .2s ease, background-color .2s ease;
}
.icon-button:hover { transform: translateY(-1px); border-color: var(--gold); background: #f4ead8; }
.icon-button--plain {
  width: 2rem; height: 2rem;
  border: 0; background: transparent;
}
.cart-items {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: grid; align-content: start; gap: .9rem;
  padding: 1rem 1.2rem;
}
.cart-item {
  display: grid; grid-template-columns: 3.7rem 1fr; gap: .85rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid #eadfcd;
}
.cart-item img {
  width: 3.7rem; aspect-ratio: 340 / 541; object-fit: cover;
  border-radius: 3px; border: 1px solid #d8cbb4;
}
.cart-item h3 {
  color: var(--ink); font-size: .92rem; line-height: 1.25; letter-spacing: .08em;
}
.cart-item p { margin: .15rem 0 .65rem; color: var(--muted); }
.cart-item__controls { display: flex; align-items: center; gap: .45rem; }
.cart-qty {
  display: grid; place-items: center;
  width: 1.8rem; height: 1.8rem;
  border-radius: 999px; border: 1px solid #dacbb3;
  color: var(--ink); background: #fffaf1; cursor: pointer;
  font: 700 .95rem/1 system-ui, sans-serif;
}
.cart-item__qty {
  min-width: 1.6rem; text-align: center;
  font-family: Oswald, sans-serif; color: var(--ink);
}
.cart-empty {
  margin: 1.4rem; color: var(--muted); text-align: center;
}
.cart-summary {
  padding: 1rem 1.2rem 1.2rem;
  border-top: 1px solid #e2d7c5;
  background: #f5efe4;
}
.cart-summary__row {
  display: flex; align-items: center; justify-content: space-between;
  font-family: Oswald, sans-serif; letter-spacing: .12em; text-transform: uppercase;
}
.cart-summary p {
  margin: .65rem 0 1rem;
  font-size: .9rem; line-height: 1.4; color: var(--muted);
}
.cart-checkout { width: 100%; }
.cart-checkout:disabled {
  opacity: .58; cursor: not-allowed; transform: none; box-shadow: none;
}
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; z-index: 80;
  max-width: min(92vw, 28rem);
  padding: .75rem 1rem; border-radius: 3px;
  color: #fdfaf3; background: #2b2621;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* ————— Receipt + owner admin ————— */
.receipt-page,
.admin-page {
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 2.5rem);
  background:
    linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0)),
    #f5f1e8;
}
.receipt-brand {
  display: inline-block;
  margin-bottom: 1.2rem;
  font-family: Oswald, sans-serif; font-size: .88rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
  color: var(--gold);
}
.receipt-card,
.admin-login__box {
  width: min(100%, 42rem);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.2rem);
  background: #fbf7ed;
  border: 1px solid #ded2bd;
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(52, 42, 22, .12);
}
.receipt-card h1,
.admin-login__box h1,
.admin-topbar h1,
.admin-section h2 {
  color: var(--gold);
}
.receipt-lede {
  max-width: 34rem;
  margin: .55rem 0 1.4rem;
  color: var(--muted);
}
.receipt-details {
  display: grid; gap: .65rem;
  padding: 1rem 0;
  border-top: 1px solid #e7dbc7;
  border-bottom: 1px solid #e7dbc7;
}
.receipt-row,
.receipt-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}
.receipt-row span,
.receipt-item span {
  color: var(--muted);
}
.receipt-items {
  display: grid; gap: .45rem;
  padding: .7rem 0;
  border-top: 1px solid #ede2d0;
  border-bottom: 1px solid #ede2d0;
}
.receipt-actions {
  display: flex; gap: .8rem; flex-wrap: wrap;
  margin-top: 1.3rem;
}

.admin-login {
  min-height: calc(100dvh - 5rem);
  display: grid; align-content: center;
}
.admin-login__box {
  display: grid; gap: .8rem;
}
.admin-page label {
  display: grid; gap: .35rem;
  font-family: Oswald, sans-serif; font-size: .76rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.admin-page input,
.admin-page select,
.admin-page textarea {
  width: 100%;
  border: 1px solid #d8cbb4;
  border-radius: 3px;
  padding: .72rem .8rem;
  font: 400 1rem/1.35 "Source Sans 3", system-ui, sans-serif;
  color: #1c2430;
  background: #fffdf8;
}
.admin-page textarea { resize: vertical; }
.admin-message {
  min-height: 1.4em; margin: 0;
  color: #8b251d;
}
.admin-shell {
  max-width: 78rem;
  margin: 0 auto;
}
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #ded2bd;
}
.admin-topbar h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: .12em; }
.admin-section {
  padding: 1.6rem 0;
  border-bottom: 1px solid #ded2bd;
}
.admin-section__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.admin-section h2 { font-size: 1.35rem; letter-spacing: .16em; }
.admin-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.admin-actions select { min-width: 10rem; }
.admin-list {
  display: grid; gap: 1rem;
}
.admin-list--compact {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}
.admin-card {
  background: #fffaf1;
  border: 1px solid #e1d3bd;
  border-radius: 6px;
  padding: 1rem;
}
.admin-empty {
  color: var(--muted);
  margin: 0;
}
.order-card__head,
.order-card__footer,
.book-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.order-card h3,
.book-card h3 {
  color: var(--ink); font-size: .98rem; letter-spacing: .08em;
}
.order-card__head p,
.book-card p {
  margin: .2rem 0 0;
  color: var(--muted);
}
.order-card__badges {
  display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end;
}
.admin-badge {
  display: inline-grid; place-items: center;
  min-height: 1.45rem; padding: .18rem .5rem;
  border-radius: 999px;
  font-family: Oswald, sans-serif; font-size: .67rem; letter-spacing: .14em;
  text-transform: uppercase;
  color: #2b2621; background: #e8dcc9;
}
.admin-badge--paid,
.admin-badge--new,
.admin-badge--active,
.admin-badge--complete {
  background: #dbead2; color: #24451f;
}
.admin-badge--pending,
.admin-badge--packing,
.admin-badge--unpaid {
  background: #f2e0b6; color: #5a3d07;
}
.admin-badge--failed,
.admin-badge--canceled,
.admin-badge--hidden {
  background: #eed1cc; color: #76251c;
}
.admin-badge--shipped {
  background: #d5e3ef; color: #153d5c;
}
.order-card__meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem .9rem;
  margin: 1rem 0;
}
.admin-field {
  display: grid; gap: .12rem; margin: 0;
}
.admin-field span {
  font-family: Oswald, sans-serif; font-size: .67rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.admin-field strong {
  font-weight: 600; color: var(--ink);
}
.order-items {
  margin: 0 0 1rem; padding-left: 1.1rem;
  color: var(--ink);
}
.order-controls,
.book-form {
  display: grid; gap: .85rem;
}
.order-controls {
  grid-template-columns: minmax(9rem, .7fr) minmax(10rem, 1fr);
  margin-bottom: 1rem;
}
.order-controls__wide { grid-column: 1 / -1; }
.book-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 1rem;
  border: 1px solid #e1d3bd;
  border-radius: 6px;
  background: #fbf7ed;
}
.book-form__wide { grid-column: 1 / -1; }
.admin-checkbox {
  grid-column: 1 / -1;
  display: flex !important; align-items: center; flex-direction: row;
  gap: .55rem;
}
.admin-checkbox input {
  width: auto;
}
.book-card {
  align-items: flex-start;
}
.book-card img {
  flex: 0 0 3.7rem;
  width: 3.7rem; aspect-ratio: 340 / 541; object-fit: cover;
  border-radius: 3px; border: 1px solid #d8cbb4;
}

/* ————— Quote ————— */
.quote {
  background: #f3eee2;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem);
}
.quote blockquote { max-width: 44rem; margin: 0 auto; position: relative; text-align: center; padding-top: .5rem; }
.quote__mark {
  position: absolute; top: -1.4rem; left: 50%; transform: translateX(-9.5rem);
  font-family: Georgia, serif; font-size: 4.5rem; line-height: 1;
  color: var(--gold); opacity: .9;
}
.quote p {
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.45rem); line-height: 1.55; margin: 0 0 .9rem;
}
.quote footer {
  font-family: Oswald, sans-serif; font-size: .8rem;
  letter-spacing: .32em; text-transform: uppercase; color: var(--gold);
}

/* ————— Newsletter ————— */
.newsletter {
  max-width: 74rem; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem);
}
.newsletter__intro { display: flex; align-items: center; gap: 1.3rem; flex: 1 1 26rem; min-width: 0; }
.newsletter__icon { color: var(--gold); flex-shrink: 0; }
.newsletter h2 { font-size: 1.15rem; font-weight: 500; letter-spacing: .26em; margin-bottom: .3rem; }
.newsletter p { color: var(--muted); margin: 0; max-width: 34rem; }
.newsletter__form { display: flex; gap: .8rem; flex-wrap: wrap; flex: 0 1 auto; }
.newsletter__form input {
  min-width: 16rem; padding: .8rem 1rem;
  font: inherit; color: #1c2430;
  background: #ffffff; border: 1px solid #d9cfb9; border-radius: 3px;
}
.newsletter__form input::placeholder { color: #6b7280; }
.newsletter__confirm {
  font-family: Oswald, sans-serif; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); margin: 0; padding: .8rem 0;
}

/* ————— Footer ————— */
.site-footer {
  border-top: 1px solid var(--hairline);
  background: #f1ecdf;
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 1.5rem 2.5rem;
  max-width: 100%; padding: 1.6rem clamp(1rem, 4vw, 2.5rem) 1.4rem;
}
.site-footer__brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--gold); }
.site-footer__brand .brand__emblem { flex-shrink: 0; }
.site-footer__brand .brand__name { font-size: .8rem; letter-spacing: .16em; color: var(--gold); }
.site-footer__nav { display: flex; justify-content: center; gap: clamp(1rem, 3vw, 2.4rem); flex-wrap: wrap; }
.site-footer__nav a {
  font-family: Oswald, sans-serif; font-size: .72rem; letter-spacing: .28em;
  text-transform: uppercase; text-decoration: none; color: var(--muted);
  transition: color .25s ease;
}
.site-footer__nav a:hover { color: var(--gold); }
.site-footer__social { display: flex; gap: 1rem; }
.site-footer__social a { color: var(--gold); opacity: .85; transition: opacity .25s ease, transform .2s ease; }
.site-footer__social a:hover { opacity: 1; transform: translateY(-2px); }
.site-footer__legal {
  grid-column: 1 / -1; text-align: center; margin: 0;
  font-size: .78rem; letter-spacing: .12em; color: var(--muted);
}

/* ————— Desktop: the whole top section always fits one screen —————
   Fixed at 100dvh regardless of the selected book; the carousel is
   sized from the leftover height and the description reserves three
   lines so the layout never shifts or pushes the CTAs below the fold. */
@media (min-width: 901px) {
  .themed { height: 100dvh; min-height: 540px; display: flex; flex-direction: column; }
  .site-header { flex: 0 0 auto; width: 100%; }
  .hero {
    flex: 1 1 auto; min-height: 0; width: 100%;
    display: flex; flex-direction: column; justify-content: center;
    padding-top: 0; padding-bottom: clamp(.8rem, 3dvh, 2.6rem);
  }
  /* auto cross-axis margins would cancel flex stretching — size explicitly */
  .hero .carousel, .hero .hero__copy { width: 100%; }
  .carousel { --cw: max(8rem, min(15.5rem, 19vw, calc((100dvh - 33rem) / 1.72))); }
  .hero__copy { margin-top: clamp(.5rem, 2.2dvh, 1.5rem); }
  .hero__title { font-size: clamp(2.4rem, 6dvh, 4.6rem); }
  .ornament { margin: clamp(.4rem, 1.4dvh, .9rem) auto clamp(.3rem, 1.1dvh, .7rem); }
  .desc { min-height: 5.6em; margin-bottom: clamp(.8rem, 2.4dvh, 1.6rem); }
}

/* ————— Responsive ————— */
@media (max-width: 900px) {
  .site-nav { display: none; }
  .site-header { justify-content: space-between; }
  .carousel { --cw: clamp(9rem, 34vw, 12rem); position: relative; gap: 0; }
  .car-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 2.75rem; height: 2.75rem;
    background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
  }
  .car-nav:hover { transform: translateY(-50%) scale(1.06); }
  .car-nav:active { transform: translateY(-50%) scale(.95); }
  .car-nav--prev { left: .25rem; }
  .car-nav--next { right: .25rem; }
  /* scale the scene pieces for narrow screens */
  .pgroup--tree { height: 62%; top: auto; bottom: 0; }
  .pgroup--phoenix { height: 70%; }
  .piece--mtn { width: 115vw; right: -8vw; }
  .piece--dragon { top: 15%; right: 24vw; width: 13vw; }
  .piece--ring { height: auto; width: 135vw; right: -58vw; top: 2%; }
  .piece--sparka { left: 5vw; top: 7%; width: 17vw; }
  .piece--sparkb { left: 10vw; top: 34%; bottom: auto; width: 18vw; }
  .piece--emb-tl { width: 38vw; }
  .piece--emb-br { width: 40vw; }
  .rail { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
          scroll-snap-type: x mandatory; padding: .5rem .25rem 1rem; }
  .rail__book { flex: 0 0 9.5rem; scroll-snap-align: center; }
  .newsletter { justify-content: center; text-align: center; }
  .newsletter__intro { flex-direction: column; }
  .newsletter__form { justify-content: center; }
  .site-footer { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .order-card__meta { grid-template-columns: 1fr 1fr; }
  .book-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .header-actions .btn { display: none; }
  .quote__mark { position: static; display: block; transform: none; margin-bottom: -1.4rem; }
  .newsletter__form input { min-width: 0; width: 100%; }
  .newsletter__form { width: 100%; }
  .newsletter__form .btn { width: 100%; }
  .cart-panel { width: 100vw; }
  .receipt-row,
  .receipt-item,
  .order-card__head,
  .order-card__footer,
  .admin-section__head,
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .order-card__badges { justify-content: flex-start; }
  .order-card__meta,
  .order-controls,
  .book-form {
    grid-template-columns: 1fr;
  }
  .admin-actions,
  .admin-actions select,
  .admin-actions .btn {
    width: 100%;
  }
}

/* ————— Reduced motion ————— */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .car-book[data-pos="0"] img { animation: none; }
  .piece { animation: none !important; }
  .scene.is-active .piece { opacity: 1; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
