/* Sheets & Sin — Anthony Fulton */

:root {
  --ink: #1c1612;
  --ink-soft: #3a322b;
  --paper: #f6efe3;
  --paper-edge: #e8dcc8;
  --gold: #e0c48a;
  --gold-deep: #c9a35a;
  --ivory: #f4ead8;
  --wine: #4a1c28;
  --navy: #0c0d12;
  --dusk: #14131a;
  --muted: #9a8b76;
  --rule: rgba(224, 196, 138, 0.45);
  --ui: "Outfit", system-ui, sans-serif;
  --display: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
  --serif: "EB Garamond", "Palatino Linotype", Palatino, serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5.75rem; }

#book-stage,
#the-book,
#get-the-book,
#bookshelf,
#about { scroll-margin-top: 5.75rem; }

body {
  margin: 0;
  color: var(--ivory);
  font-family: var(--ui);
  font-weight: 400;
  line-height: 1.5;
  background: var(--navy);
  min-height: 100vh;
}

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

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ivory); }

code {
  font-size: 0.9em;
  color: var(--gold);
  background: rgba(224, 196, 138, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
}
.skip-link:focus { top: 1rem; }

/* ---- Atmosphere ---- */

.site-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 8, 12, 0.58) 0%, rgba(8, 8, 12, 0.40) 38%, rgba(8, 8, 12, 0.50) 62%, rgba(8, 8, 12, 0.78) 100%),
    url("../assets/hero.jpg") center 42% / cover no-repeat,
    var(--navy);
}

.shooting-star-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  background: rgba(10, 10, 14, 0.55);
  border-bottom: 1px solid rgba(224, 196, 138, 0.14);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.wordmark {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ivory);
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 1.35rem;
  margin-left: auto;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

.site-nav a { color: var(--ivory); opacity: 0.8; }
.site-nav a:hover { opacity: 1; color: var(--gold); }

.age-badge {
  margin: 0;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* ---- Hero / book ---- */

.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.2rem 1.4rem 3rem;
  text-align: center;
}

.eyebrow,
.cover-kicker,
.excerpt-label,
.kicker {
  font-family: var(--ui);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.7rem;
  font-weight: 500;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 0.95;
  margin: 0 0 0.4rem;
  letter-spacing: 0.02em;
}

.hero-byline {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.35rem;
  margin: 0 0 0.8rem;
  color: var(--gold);
}

.hero-lead,
.section-lead {
  color: var(--muted);
  margin: 0 auto 1.4rem;
  max-width: 36rem;
}

.cover-stack {
  margin: 0 auto 1.9rem;
  width: min(26rem, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cover-stack-frame {
  position: relative;
  width: min(22rem, 78vw);
  padding: 0 0 1.4rem 0;
}

.cover-stack-deck {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  perspective: 1400px;
  outline: none;
  touch-action: pan-y;
}

.cover-stack-deck:focus-visible {
  box-shadow: 0 0 0 2px var(--navy), 0 0 0 4px var(--gold);
  border-radius: 4px;
}

.cover-card {
  position: absolute;
  inset: 0;
  margin: 0;
  border-radius: 3px;
  overflow: hidden;
  background: #0a0b10;
  border: 1px solid rgba(224, 196, 138, 0.32);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.55s cubic-bezier(0.22, 0.8, 0.28, 1),
              opacity 0.4s ease,
              box-shadow 0.45s ease;
  pointer-events: none;
  will-change: transform, opacity;
}

.cover-card img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  background: #0a0b10;
  user-select: none;
  -webkit-user-drag: none;
}

.cover-card.is-active {
  z-index: 3;
  transform: translate(0, 0) rotate(0deg) scale(1);
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.58);
}

.cover-card.is-next {
  z-index: 2;
  transform: translate(0.9rem, 0.7rem) rotate(3.25deg) scale(0.97);
  opacity: 1;
}

.cover-card.is-after {
  z-index: 1;
  transform: translate(1.65rem, 1.25rem) rotate(6.1deg) scale(0.94);
  opacity: 1;
}

.cover-card.is-hidden {
  z-index: 0;
  transform: translate(1.65rem, 1.25rem) rotate(6.1deg) scale(0.9);
  opacity: 0;
}

.cover-card.is-outgoing-next {
  z-index: 5;
  transform: translate(-118%, -4%) rotate(-14deg) scale(0.96);
  opacity: 0;
  pointer-events: none;
}

.cover-card.is-outgoing-prev {
  z-index: 5;
  transform: translate(118%, -4%) rotate(14deg) scale(0.96);
  opacity: 0;
  pointer-events: none;
}

.cover-nav {
  position: absolute;
  top: calc(50% - 0.7rem);
  z-index: 6;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(224, 196, 138, 0.45);
  border-radius: 50%;
  background: rgba(12, 13, 18, 0.72);
  color: var(--gold);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cover-nav svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.cover-nav:hover,
.cover-nav:focus-visible {
  background: rgba(224, 196, 138, 0.16);
  color: var(--ivory);
  border-color: var(--gold);
  outline: none;
}

.cover-nav-prev { left: -0.85rem; }
.cover-nav-next { right: -0.85rem; }

.cover-stack-caption {
  margin: 0.85rem 0 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.cover-stack-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.7rem;
}

.cover-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.cover-dot {
  width: 0.55rem;
  height: 0.55rem;
  padding: 0;
  border: 1px solid rgba(224, 196, 138, 0.55);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.cover-dot:hover,
.cover-dot:focus-visible {
  border-color: var(--gold);
  background: rgba(224, 196, 138, 0.35);
  outline: none;
}

.cover-dot.is-active {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.15);
}

.cover-expand {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.15rem 0.2rem;
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  cursor: pointer;
}

.cover-expand:hover,
.cover-expand:focus-visible {
  color: var(--ivory);
  outline: none;
}

.cover-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 3.5rem 1.25rem 1.5rem;
  background: rgba(8, 8, 12, 0.92);
  backdrop-filter: blur(8px);
}

.cover-lightbox[hidden] { display: none; }

.cover-lightbox img {
  max-width: min(92vw, 1100px);
  max-height: min(82vh, 1100px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  border: 1px solid rgba(224, 196, 138, 0.28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  background: #0a0b10;
}

.cover-lightbox-caption {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ivory);
  text-align: center;
}

.cover-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  appearance: none;
  background: rgba(12, 13, 18, 0.7);
  color: var(--gold);
  border: 1px solid rgba(224, 196, 138, 0.45);
  border-radius: 3px;
  padding: 0.45rem 0.8rem;
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.cover-lightbox-close:hover,
.cover-lightbox-close:focus-visible {
  color: var(--ivory);
  border-color: var(--gold);
  outline: none;
}

.preview-close {
  max-width: 22rem;
  margin: 1rem auto 0.8rem;
  color: var(--ink);
  font-family: var(--display);
  font-style: italic;
  line-height: 1.45;
}

.book-stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1.5rem;
}

.book-stage {
  position: relative;
  width: min(920px, calc(100vw - 2rem));
  margin: 0 auto;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.55));
}

#book { margin: 0 auto; }

/* page-flip internals */
.stf__item {
  overflow: hidden;
  background-color: var(--paper);
  box-shadow: 0 0 0 1px rgba(40, 28, 18, 0.06);
}

.stf__item[data-density="hard"],
.stf__item:has(.page-cover) {
  background: #2a1810;
}

/* ---- Shared page chrome ---- */

.page {
  width: 100%;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  container-type: size;
}

.page-inner {
  height: 100%;
  padding: 8% 10% 13%;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    linear-gradient(90deg, rgba(80, 50, 20, 0.07), transparent 18px),
    var(--paper);
  font-family: var(--serif);
  container-type: size;
}

.page-folio {
  position: absolute;
  bottom: 5%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--ui);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin: 0;
}

/* ---- Hardcover boards ---- */

.page-cover,
.page-cover-front,
.page-cover-back {
  background: #2a1810;
  padding: 0;
}

.cover-art,
.back-cover,
.hardcover {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
  overflow: hidden;
  background: #3a2216;
}

.leather-ground {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    url("../assets/leather.jpg") center / 150px 150px repeat,
    linear-gradient(180deg, #6b4630 0%, #4a2c1c 50%, #30180e 100%);
  background-blend-mode: overlay, normal;
  pointer-events: none;
}

.cover-sheen {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 32% 18%, rgba(255, 220, 170, 0.16), transparent 52%),
    linear-gradient(145deg, rgba(255, 226, 180, 0.13) 0%, transparent 32%, transparent 70%, rgba(0, 0, 0, 0.22) 100%),
    radial-gradient(80% 90% at 80% 100%, rgba(0, 0, 0, 0.28), transparent 55%);
}

.cover-bevel {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 228, 180, 0.28),
    inset 0 -3px 4px rgba(0, 0, 0, 0.45),
    inset 2px 0 3px rgba(255, 210, 150, 0.06),
    inset -3px 0 5px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(20, 10, 6, 0.55);
}

.page-cover-front .hardcover::after,
.page-cover-back .hardcover::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  z-index: 7;
  pointer-events: none;
}

.page-cover-front .hardcover::after {
  right: 0;
  background: linear-gradient(90deg, rgba(255, 210, 150, 0.1), #1a0c08 55%, #0a0604);
}

.page-cover-back .hardcover::after {
  left: 0;
  background: linear-gradient(90deg, #0a0604, #1a0c08 45%, rgba(255, 210, 150, 0.1));
}

/* Spine strip + gold stitching */
.spine-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8.6%;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.38) 0%,
      rgba(0, 0, 0, 0.08) 28%,
      rgba(255, 220, 170, 0.07) 52%,
      rgba(0, 0, 0, 0.12) 78%,
      rgba(0, 0, 0, 0.42) 100%),
    url("../assets/leather.jpg") center / 220px 220px repeat;
  background-blend-mode: multiply;
}

.spine-strip-front {
  left: 0;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.4);
}

.spine-strip-back {
  right: 0;
  box-shadow: -3px 0 8px rgba(0, 0, 0, 0.4);
}

.spine-stitch {
  position: absolute;
  top: 3.5%;
  bottom: 3.5%;
  width: 1.5px;
  background-image: repeating-linear-gradient(
    to bottom,
    #e8cc7a 0 4px,
    transparent 4px 9px
  );
  border-radius: 1px;
  opacity: 0.88;
}

.spine-strip-front .spine-stitch-outer { left: 14%; }
.spine-strip-front .spine-stitch-inner { right: 14%; }
.spine-strip-back .spine-stitch-inner { left: 14%; }
.spine-strip-back .spine-stitch-outer { right: 14%; }

.spine-band {
  position: absolute;
  left: 16%;
  right: 16%;
  height: 1.15%;
  min-height: 5px;
  border-radius: 1px;
  background: linear-gradient(180deg, #f6e4a8 0%, #e0c06a 42%, #9a6e28 58%, #e8cc7a 100%);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 244, 210, 0.65);
}

.spine-band:nth-child(1) { top: 11.5%; }
.spine-band:nth-child(2) { top: 28.5%; }
.spine-band:nth-child(3) { top: 45.5%; }
.spine-band:nth-child(4) { top: 62.5%; }
.spine-band:nth-child(5) { top: 79.5%; }

/* Tipped-in sunset plate */
.cover-plate {
  position: absolute;
  z-index: 3;
  top: 6.2%;
  left: 16.5%;
  right: 7.5%;
  height: 49%;
  overflow: hidden;
  background: #1a120c;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.42),
    0 0 0 1px #d4b56a,
    0 0 0 3px #2a1a10,
    0 0 0 4px #e4c88a;
}

.cover-embroidery {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  clip-path: inset(6.2% 7.5% 44.8% 16.5%);
}

.cover-embroidery img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
}

.spine-mark {
  position: absolute;
  z-index: 2;
  left: 28%;
  right: 28%;
  width: 44%;
  top: 51.2%;
  height: 5.2%;
  overflow: visible;
  pointer-events: none;
  opacity: 0.82;
}

.cover-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.plate-frame {
  position: absolute;
  inset: 2.4%;
  border: 1px solid rgba(228, 200, 138, 0.5);
  pointer-events: none;
  z-index: 1;
}

.cover-content {
  position: absolute;
  z-index: 5;
  left: 16.5%;
  right: 7.5%;
  top: 56.5%;
  bottom: 3.1%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 1.5% 0 2%;
  color: var(--ivory);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.cover-kicker {
  color: var(--gold);
  margin: 0 0 0.28em;
  letter-spacing: 0.32em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
}

.cover-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 12.4cqw;
  line-height: 0.9;
  margin: 0;
  letter-spacing: 0.045em;
  background: linear-gradient(180deg, #fff4c8 0%, #f0d78a 38%, #c9a35a 52%, #f6e4a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 rgba(255, 244, 200, 0.28))
    drop-shadow(0 1px 0 rgba(40, 20, 6, 0.7));
}

.cover-title .amp {
  font-style: italic;
  font-weight: 400;
  display: inline-block;
  padding: 0 0.06em;
}

.cover-rule {
  width: 2.4em;
  height: 1px;
  margin: 0.4em 0 0.38em;
  background: linear-gradient(90deg, transparent, #e0c48a, transparent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.cover-author {
  font-family: var(--ui);
  font-size: 3.85cqw;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin: 0;
  flex-shrink: 0;
  background: linear-gradient(180deg, #f6e4a8 0%, #d4b56a 55%, #f0d78a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 rgba(255, 244, 200, 0.2))
    drop-shadow(0 1px 0 rgba(40, 20, 6, 0.6));
}

.cover-snippet {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 2.2cqh;
  line-height: 1.28;
  margin: 0.55em 0 0;
  max-width: 28em;
  color: #e8d09a;
  text-shadow:
    0 1px 0 rgba(255, 244, 200, 0.18),
    0 1px 0 rgba(20, 10, 4, 0.7);
}

/* ---- Title page ---- */

.page-title {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 14%;
}

.page-title .ornament {
  width: 0.45em;
  height: 0.45em;
  margin: 0 0 1.2em;
  background: var(--gold-deep);
  transform: rotate(45deg);
}

.page-title h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18cqw;
  line-height: 0.95;
  margin: 0.15em 0 0.4em;
  color: var(--ink);
}

.page-title .kicker { color: var(--gold-deep); }

.title-rule {
  width: 3.2em;
  height: 1px;
  background: var(--gold-deep);
  margin: 0.8em 0 1em;
}

.title-author {
  font-family: var(--display);
  font-size: 7.2cqw;
  font-style: italic;
  margin: 0 0 1.4em;
  color: var(--ink-soft);
}

.title-place {
  font-family: var(--ui);
  font-size: 2.8cqw;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* ---- Copyright ---- */

.page-copyright {
  justify-content: flex-start;
  padding-top: 14%;
  font-size: 2.45cqh;
  line-height: 1.45;
  color: var(--ink-soft);
}

.page-copyright p { margin: 0 0 0.75em; }

.copy-title {
  font-family: var(--display);
  font-style: italic;
  color: var(--ink);
  font-size: 1.15em;
}

/* ---- Contents ---- */

.page-contents h2,
.page-excerpt h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 8.5cqw;
  margin: 0 0 0.8em;
  letter-spacing: 0.04em;
}

.contents-cont span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.48em;
  color: var(--ink-soft);
  letter-spacing: 0;
  margin-left: 0.4em;
}

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 2.6cqh;
  line-height: 1.42;
}

.chapter-list li {
  display: flex;
  gap: 0.85em;
  align-items: baseline;
  margin: 0;
  border-bottom: 1px dotted rgba(58, 50, 43, 0.18);
  padding: 0.18em 0;
}

.ch-num {
  flex: 0 0 1.8em;
  font-family: var(--ui);
  font-size: 0.78em;
  letter-spacing: 0.06em;
  color: var(--gold-deep);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- Excerpt ---- */

.page-excerpt {
  font-size: 2.85cqh;
  line-height: 1.5;
}

.page-excerpt p { margin: 0 0 0.55em; }

.page-excerpt h2 {
  font-size: 7cqw;
  margin: 0 0 0.15em;
}

.excerpt-title {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15em;
  margin: 0 0 0.65em !important;
  color: var(--ink-soft);
}

.dropcap::first-letter {
  font-family: var(--display);
  font-size: 2.35em;
  float: left;
  line-height: 0.78;
  padding: 0.08em 0.07em 0 0;
  color: var(--wine);
}

.excerpt-end {
  margin-top: 0.4em !important;
  margin-bottom: 0 !important;
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.92em;
}

/* ---- Back cover ---- */

.back-cover {
  color: var(--ink);
}

.back-panel {
  position: absolute;
  z-index: 3;
  top: 5.5%;
  bottom: 5.5%;
  left: 7%;
  right: 16.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 5.2% 6.5% 4.5%;
  background:
    linear-gradient(180deg, #f7f0e4 0%, #f0e6d4 100%);
  color: var(--ink);
  box-shadow:
    0 3px 14px rgba(0, 0, 0, 0.4),
    0 0 0 1px #c9a35a,
    0 0 0 3px #3a2418,
    0 0 0 4px #e0c48a;
  overflow: hidden;
}

.author-photo-slot {
  position: relative;
  flex: 0 0 auto;
  width: 38%;
  max-width: 10.5em;
  aspect-ratio: 4 / 5;
  max-height: 32%;
  margin: 0 auto 0.55em;
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(18, 12, 10, 0.55), 0 8px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  background: #1a1612;
}

.back-panel .author-photo-slot {
  width: 34%;
  max-height: 24%;
  margin-bottom: 0.35em;
  border-color: #c9a35a;
  box-shadow:
    0 0 0 3px #f0e6d4,
    0 0 0 4px #c9a35a,
    0 6px 16px rgba(40, 24, 10, 0.28);
}

.author-photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.author-photo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-family: var(--ui);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.author-photo-slot.is-placeholder .author-photo-fallback {
  display: flex;
}

.back-author-name {
  font-family: var(--display);
  font-size: 6.2cqw;
  margin: 0 0 0.3em;
  letter-spacing: 0.04em;
  color: #8a6420;
  flex-shrink: 0;
}

.back-author-bio {
  font-family: var(--serif);
  font-size: 1.9cqh;
  font-style: italic;
  line-height: 1.32;
  margin: 0 0 0.4em;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.back-blurb {
  font-family: var(--serif);
  font-size: 2.05cqh;
  line-height: 1.34;
  margin: 0 0 0.4em;
  text-align: left;
  color: var(--ink);
  flex: 1 1 auto;
  overflow: hidden;
}

.back-pub { margin-top: auto; flex-shrink: 0; }

.back-order-link {
  margin: 0.35em 0 0;
  flex-shrink: 0;
  font-family: var(--ui);
  font-size: 0.68em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.back-order-link a {
  color: #8a6420;
}

.back-order-link a:hover {
  color: #5a3c12;
}

.pub-line {
  font-family: var(--ui);
  font-size: 0.82em;
  letter-spacing: 0.04em;
  color: #7a5a20;
  margin: 0.35em 0 0;
}

.page-copyright .pub-line:first-of-type {
  margin-top: 1.1em;
}

.back-panel .pub-line {
  width: 100%;
  font-size: 0.72em;
  letter-spacing: 0.08em;
  line-height: 1.35;
  color: #7a5a20;
  margin: 0.45em 0 0;
}

.footer-pub {
  font-family: var(--ui);
  font-size: 0.82em;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin: 0.4em 0 0;
}

.age-note {
  font-style: italic;
}

/* ---- Controls ---- */

.book-controls {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 1.4rem;
}

.page-btn {
  appearance: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(224, 196, 138, 0.45);
  background: rgba(12, 12, 16, 0.5);
  color: var(--gold);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: rgba(224, 196, 138, 0.15);
  border-color: var(--gold);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.page-status {
  margin: 0;
  min-width: 10rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory);
}

.book-hint {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---- Bookmark pin ---- */

.bookmark-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.05rem;
  min-width: 2.6rem;
}

.bookmark-label {
  font-family: var(--ui);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory);
  line-height: 1.2;
  white-space: nowrap;
}

.bookmark-btn {
  position: relative;
  overflow: visible;
  flex-shrink: 0;
}

.bookmark-btn img {
  display: block;
  width: 1.15rem;
  height: auto;
  margin: 0 auto;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.bookmark-btn.is-saved {
  border-color: var(--gold);
  background: rgba(224, 196, 138, 0.12);
}

.bookmark-btn.is-active {
  border-color: var(--gold);
  background: rgba(224, 196, 138, 0.22);
  box-shadow: 0 0 0 3px rgba(224, 196, 138, 0.18);
}

.bookmark-pin {
  position: absolute;
  z-index: 30;
  width: 34px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5));
  transform-origin: 50% 18%;
  opacity: 0;
  transform: translateY(-26px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.22, 1.35, 0.36, 1);
}

.bookmark-pin img {
  display: block;
  width: 34px;
  height: auto;
  pointer-events: none;
}

.bookmark-pin.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bookmark-pin.is-leaving {
  opacity: 0;
  transform: translateY(-26px);
  pointer-events: none;
}

.bookmark-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 60;
  width: min(36rem, calc(100vw - 1.5rem));
  margin: 0;
  text-align: left;
  transform: translateX(-50%);
}

.bookmark-toast[hidden] {
  display: none;
}

.bookmark-toast-inner {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 2.2rem 0.95rem 0.95rem;
  border: 1px solid rgba(224, 196, 138, 0.4);
  border-radius: 12px;
  background: rgba(12, 12, 16, 0.82);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  color: var(--ivory);
}

.bookmark-toast-icon {
  flex: 0 0 auto;
  width: 26px;
  height: auto;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}

.bookmark-toast-copy {
  min-width: 0;
  flex: 1;
}

.bookmark-toast-title {
  margin: 0 0 0.2rem;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.bookmark-toast-meta {
  margin: 0 0 0.7rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.bookmark-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toast-btn {
  appearance: none;
  font-family: var(--ui);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45em 0.9em;
  border-radius: 999px;
  border: 1px solid rgba(224, 196, 138, 0.45);
  background: transparent;
  color: var(--ivory);
  cursor: pointer;
}

.toast-btn:hover {
  border-color: var(--gold);
  background: rgba(224, 196, 138, 0.12);
}

.toast-btn-primary {
  background: rgba(224, 196, 138, 0.18);
  color: var(--gold);
  border-color: var(--gold);
}

.toast-btn-ghost {
  border-color: transparent;
  letter-spacing: 0.06em;
  text-transform: none;
  padding-left: 0.4em;
  padding-right: 0.4em;
  color: var(--muted);
}

.toast-btn-ghost:hover {
  color: var(--ivory);
  background: transparent;
}

.toast-close {
  appearance: none;
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  color: var(--ivory);
}

@media (prefers-reduced-motion: reduce) {
  .bookmark-pin,
  .bookmark-pin.is-visible,
  .bookmark-pin.is-leaving {
    transition: opacity 0.15s ease;
    transform: none;
  }
}

@media (max-width: 767px) {
  .book-controls {
    gap: 0.75rem;
  }

  .page-status {
    min-width: 0;
  }

  .bookmark-label {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
  }

  .bookmark-pin,
  .bookmark-pin img {
    width: 28px;
  }

  .bookmark-toast-inner {
    gap: 0.65rem;
    padding: 0.85rem 2rem 0.85rem 0.8rem;
  }

  .bookmark-toast-actions {
    gap: 0.4rem;
  }
}

/* ---- Bookshelf ---- */

.bookshelf-section,
.about-section,
.order-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.4rem 4.5rem;
  text-align: center;
}

.bookshelf-section h2,
.about-section h2,
.order-section h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0 0 0.6rem;
}

.shelf-wrap {
  margin: 2.1rem auto 0;
  max-width: 22rem;
  padding: 0;
}

.shelf-books {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.85rem;
  min-height: 0;
}

.spine {
  appearance: none;
  border: 0;
  cursor: pointer;
  position: relative;
  width: 58px;
  height: 264px;
  margin: 0;
  padding: 1.35rem 0.28rem 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: var(--gold);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  border-radius: 2px 2px 0 0;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0%, rgba(255, 255, 255, 0.10) 18%, transparent 40%, transparent 70%, rgba(0, 0, 0, 0.32) 100%),
    url("../assets/leather.jpg");
  background-size: auto, 240px auto;
  background-position: center, center;
  background-blend-mode: soft-light, overlay;
  box-shadow:
    inset -7px 0 10px rgba(0, 0, 0, 0.32),
    inset 4px 0 6px rgba(255, 255, 255, 0.09),
    0 6px 14px rgba(0, 0, 0, 0.38);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  font-family: var(--display);
  overflow: hidden;
}

.spine:nth-child(2),
.spine:nth-child(3),
.spine.is-featured {
  width: 58px;
  height: 264px;
}

.spine:hover,
.spine:focus-visible {
  transform: rotate(180deg) translateX(-6px);
  box-shadow:
    inset -7px 0 10px rgba(0, 0, 0, 0.32),
    inset 4px 0 6px rgba(255, 255, 255, 0.09),
    0 14px 22px rgba(0, 0, 0, 0.48);
  outline: none;
}

.spine-title {
  font-size: 1.02rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  line-height: 1;
  text-wrap: nowrap;
  color: #f0d78a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.spine-author {
  font-family: var(--ui);
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  color: #e0c48a;
  opacity: 0.9;
  z-index: 1;
}

.spine-gold-band {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 3px;
  border-radius: 1px;
  background: linear-gradient(180deg, #f6e4a8 0%, #c9a35a 48%, #8a6a2c 52%, #e8cc7a 100%);
  box-shadow: 0 0 0 1px rgba(80, 50, 16, 0.25);
  pointer-events: none;
  z-index: 2;
}

.spine-gold-band.is-top { top: 7%; }
.spine-gold-band.is-bottom { bottom: 7%; }

.spine-stitch-line {
  position: absolute;
  top: 5%;
  bottom: 5%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(224, 196, 138, 0.45) 12%, rgba(224, 196, 138, 0.45) 88%, transparent);
  pointer-events: none;
  z-index: 2;
}

.spine-stitch-line.is-left { left: 9%; }
.spine-stitch-line.is-right { right: 9%; }

.spine-star {
  position: absolute;
  top: auto;
  bottom: 13.5%;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  color: #f0d78a;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 0 1px rgba(240, 215, 138, 0.5));
}

.shelf-board {
  height: 14px;
  margin-top: 0;
  position: relative;
  background:
    linear-gradient(180deg, #c9a35a 0 1px, transparent 1px),
    linear-gradient(180deg, #8a6a42 0%, #6a4a2a 36%, #3a2414 72%, #2a1810 100%);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(240, 215, 160, 0.28);
  border-radius: 1px;
}

.shelf-board::before,
.shelf-board::after {
  content: "";
  position: absolute;
  top: 0;
  width: 10px;
  height: 26px;
  background: linear-gradient(180deg, #8a6a42, #3a2414);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3);
}

.shelf-board::before { left: 8px; }
.shelf-board::after { right: 8px; }

.shelf-caption {
  margin: 0.85rem 0 0;
  min-height: 0;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}

/* ---- About ---- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 2.4rem;
  text-align: left;
  align-items: start;
  margin-top: 2.2rem;
}

.about-photo { margin: 0; }

.about-photo-slot {
  width: 100%;
  margin: 0;
  max-width: none;
  max-height: none;
}

.about-photo figcaption {
  font-family: var(--display);
  font-style: italic;
  margin-top: 0.7rem;
  color: var(--gold);
  text-align: center;
}

.about-copy {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ivory);
}

.placeholder-banner {
  border: 1px dashed rgba(224, 196, 138, 0.5);
  background: rgba(224, 196, 138, 0.08);
  padding: 0.7rem 0.9rem;
  color: var(--gold);
  font-family: var(--ui);
  font-size: 0.88rem;
}

/* ---- Order / Get the Book ---- */

.order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 840px;
  margin: 2.2rem auto 0;
  text-align: left;
}

.order-card {
  position: relative;
  padding: 0.7rem;
  background:
    linear-gradient(180deg, rgba(20, 10, 6, 0.28), rgba(20, 10, 6, 0.42)),
    url("../assets/leather.jpg") center / 220px 220px repeat;
  background-blend-mode: multiply;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.45),
    0 0 0 1px #d4b56a,
    0 0 0 3px #2a1a10,
    0 0 0 4px #e4c88a;
}

.order-card-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.45rem 1.35rem 1.3rem;
  background: linear-gradient(180deg, #f7f0e4 0%, #f0e6d4 100%);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(201, 163, 90, 0.45);
}

.order-format {
  font-family: var(--ui);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8a6420;
  margin: 0 0 0.35rem;
  font-weight: 500;
}

.order-card h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.85rem;
  line-height: 1;
  margin: 0 0 0.45rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.order-section .section-lead {
  color: var(--ivory);
  text-shadow: 0 1px 10px rgba(8, 8, 12, 0.7);
  max-width: 34rem;
}

.order-availability,
.order-status {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}

.order-status {
  margin: 0 0 0.55rem;
  color: #8a6420;
}

.order-price {
  font-family: var(--display);
  font-weight: 600;
  font-size: 2.15rem;
  letter-spacing: 0.02em;
  color: #8a6420;
  margin: 0 0 0.85rem;
}

.order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.1rem;
  margin-top: 0.35rem;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  background: linear-gradient(180deg, #f0d78a 0%, #c9a35a 100%);
  color: #2a1a10;
  border: 1px solid #a67c2d;
  box-shadow: 0 1px 0 rgba(255, 244, 200, 0.45), 0 2px 6px rgba(40, 20, 6, 0.2);
}

.order-btn:hover {
  color: #1c1008;
  background: linear-gradient(180deg, #f6e4a8 0%, #d4b56a 100%);
}

.order-btn.is-disabled,
.order-btn[aria-disabled="true"] {
  background: transparent;
  color: #8a6420;
  border: 1px solid rgba(138, 100, 32, 0.55);
  box-shadow: none;
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.order-note,
.order-notify {
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

.order-note,
.order-status {
  margin-top: auto;
}

.order-notify a {
  color: #8a6420;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.order-notify a:hover {
  color: #5a3c12;
}

.order-age {
  margin: 1.6rem auto 0;
  max-width: 28rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  color: var(--ivory);
  text-shadow: 0 1px 8px rgba(8, 8, 12, 0.65);
}

/* ---- Footer ---- */

.site-footer {
  border-top: 1px solid rgba(224, 196, 138, 0.14);
  padding: 2rem 1.4rem 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p { margin: 0 0 0.4rem; }

.footer-pub {
  display: inline-block;
  margin-top: 0.8rem !important;
}

/* ---- Responsive ---- */

@media (max-width: 767px) {
  .header-inner {
    padding: 0.65rem 1rem 0.75rem;
    gap: 0.45rem 0.8rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand age"
      "nav nav";
    align-items: center;
  }
  .wordmark {
    grid-area: brand;
    font-size: 0.98rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }
  .age-badge { grid-area: age; margin-left: 0; }
  .site-nav {
    grid-area: nav;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem 0.95rem;
    font-size: 0.66rem;
  }
  .hero { padding: 1.6rem 1rem 2.4rem; }
  .cover-stack { width: min(24rem, 96vw); }
  .cover-stack-frame { width: min(20.5rem, 82vw); }
  .cover-nav-prev { left: -0.45rem; }
  .cover-nav-next { right: -0.45rem; }
  .order-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    gap: 1.15rem;
  }
  .order-section {
    padding: 0.4rem 1rem 3.4rem;
  }
  .order-card-inner {
    padding: 1.25rem 1.15rem 1.15rem;
  }
  .book-stage { width: min(420px, calc(100vw - 1.5rem)); }
  .about-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
  }
  .spine,
  .spine.is-featured,
  .spine:nth-child(2),
  .spine:nth-child(3) {
    width: 50px;
    height: 228px;
  }
  .shelf-wrap { max-width: 18.5rem; }
  .shelf-books { gap: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spine { transition: none; }
  .cover-card {
    transition: none;
    will-change: auto;
  }
}

@media (max-height: 920px) and (min-width: 768px) {
  .hero { padding-top: 1.4rem; padding-bottom: 2rem; }
  .hero-lead { margin-bottom: 1rem; }
}

/* ---- Chapter pages ---- */

.page-chapter {
  font-size: 3.5cqh;
  line-height: 1.42;
  justify-content: flex-start;
}

.page-chapter p { margin: 0 0 0.48em; }

.page-chapter-title,
.page-coming-soon {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 14%;
}

.page-chapter-title h2,
.page-coming-soon h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 14cqw;
  line-height: 0.95;
  margin: 0.15em 0 0.4em;
  color: var(--ink);
}

.page-coming-soon .coming-line {
  font-family: var(--ui);
  font-size: 3.2cqh;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0.6em 0 1em;
}

.page-coming-soon .coming-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 3cqh;
  color: var(--ink-soft);
  margin: 0;
  max-width: 16em;
}

.scene-fade {
  margin-top: 1.1em !important;
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
}

.page-chapter .dropcap::first-letter,
.page-excerpt .dropcap::first-letter {
  font-family: var(--display);
  font-size: 2.35em;
  float: left;
  line-height: 0.78;
  padding: 0.08em 0.07em 0 0;
  color: var(--wine);
}
