:root {
  --black: #080b0d;
  --black-2: #0d1213;
  --green-black: #101a18;
  --green: #142621;
  --gold: #c6a56a;
  --gold-2: #e1c98b;
  --parchment: #d8c6a3;
  --paper: #efe2c4;
  --red: #7b1e24;
  --red-2: #a53a3d;
  --mist: #9a9a8f;
  --white: #f6efe1;
  --muted: #beb5a2;
  --shadow: 0 22px 70px rgba(0,0,0,.55);
  --max: 1180px;
  --radius: 24px;
  --font-heading: Georgia, 'Times New Roman', serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Bookcase defaults: JS/book JSON can override these per book */
  --book-height: 280px;
  --book-width: 54px;
  --book-tilt: 0deg;
  --book-accent: #142621;
  --text: var(--white);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(198,165,106,.12), transparent 32rem),
    radial-gradient(circle at 85% 5%, rgba(123,30,36,.16), transparent 28rem),
    linear-gradient(180deg, #040607 0%, var(--black) 36%, #030505 100%);
  color: var(--white);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 0, rgba(0,0,0,.95), transparent 80%);
  opacity: .4;
  z-index: -1;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.container { width: min(var(--max), calc(100% - 2rem)); margin-inline: auto; }
.section { padding: 6rem 0; }
.section-xl { padding: 8rem 0 6rem; }
.skip-link {
  position: absolute; top: .75rem; left: .75rem; z-index: 100;
  transform: translateY(-150%); background: var(--gold); color: #060606; padding: .65rem 1rem; border-radius: 999px; font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(8,11,13,.76);
  border-bottom: 1px solid rgba(198,165,106,.18);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 78px; }
.brand { display: inline-flex; align-items: center; gap: .85rem; min-width: 0; }
.brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid rgba(198,165,106,.65); border-radius: 50%; color: var(--gold-2); font: 800 1.7rem var(--font-heading);
  box-shadow: inset 0 0 0 5px rgba(198,165,106,.08);
}
.brand strong { display: block; font: 700 1.15rem var(--font-heading); letter-spacing: .08em; text-transform: uppercase; }
.brand small { display: block; color: var(--muted); margin-top: -.18rem; }
.site-nav { display: flex; align-items: center; gap: .5rem; }
.site-nav a { color: var(--muted); padding: .65rem .85rem; border-radius: 999px; transition: .2s ease; }
.site-nav a:hover, .site-nav a:focus { color: var(--white); background: rgba(255,255,255,.07); }
.site-nav .nav-cta { color: #130f0a; background: linear-gradient(135deg, var(--gold-2), var(--gold)); font-weight: 800; }
.nav-toggle { display: none; width: 46px; height: 46px; border: 1px solid rgba(198,165,106,.25); border-radius: 50%; background: transparent; color: var(--white); }
.nav-toggle span:not(.sr-only), .nav-toggle::before, .nav-toggle::after { content: ""; display:block; width: 20px; height: 2px; background: var(--gold); margin: 5px auto; }
.hero { position: relative; overflow: hidden; }
.hero::before {
  content:""; position:absolute; inset:0; opacity:.27; pointer-events:none;
  background: radial-gradient(circle at 50% 28%, transparent 0 13rem, rgba(198,165,106,.18) 13.1rem 13.2rem, transparent 13.3rem 19rem, rgba(198,165,106,.12) 19.1rem 19.2rem, transparent 19.3rem);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .75fr); gap: 4rem; align-items: center; position: relative; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .22em; font-weight: 800; font-size: .78rem; margin: 0 0 .75rem; }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.05; margin: 0; }
h1 { font-size: clamp(3rem, 8vw, 6.7rem); letter-spacing: -.055em; max-width: 11ch; }
h2 { font-size: clamp(2.1rem, 5vw, 4.6rem); letter-spacing: -.04em; }
h3 { font-size: 1.6rem; }
.lead { font-size: clamp(1.12rem, 2vw, 1.35rem); color: var(--muted); max-width: 58ch; }
.button-row { display: flex; gap: .85rem; flex-wrap: wrap; margin-top: 2rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .8rem 1.1rem; border-radius: 999px; border: 1px solid rgba(198,165,106,.32); cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-2px); }
.button.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #141009; border-color: transparent; font-weight: 900; }
.button.ghost { background: rgba(255,255,255,.055); color: var(--white); }
.button.full { width: 100%; }
.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 3rem 0 0; max-width: 680px; background: rgba(198,165,106,.22); border: 1px solid rgba(198,165,106,.22); border-radius: 18px; overflow: hidden; }
.stat-strip div { padding: 1rem; background: rgba(8,11,13,.8); }
.stat-strip dt { color: var(--mist); font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; }
.stat-strip dd { margin: .15rem 0 0; font-family: var(--font-heading); color: var(--gold-2); }
.hero-art { position: relative; }
.hero-art img, .book-cover-frame img { border-radius: 22px; box-shadow: var(--shadow); border: 1px solid rgba(198,165,106,.22); }
.hero-art::before { content:""; position:absolute; inset: -18px; border: 1px solid rgba(198,165,106,.22); border-radius: 30px; transform: rotate(-2deg); z-index: -1; }
.art-card { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; padding: 1rem; border-radius: 16px; background: rgba(6,8,9,.82); border: 1px solid rgba(198,165,106,.25); backdrop-filter: blur(12px); }
.art-card strong { display:block; font-family: var(--font-heading); color: var(--gold-2); }
.art-card span { display:block; color: var(--muted); font-size:.93rem; }
.feature-book { background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.005)); border-block: 1px solid rgba(198,165,106,.14); }
.feature-grid { display: grid; grid-template-columns: minmax(220px, 420px) minmax(0,1fr); gap: 3.5rem; align-items: center; }
.feature-copy .subtitle { color: var(--gold); margin: .6rem 0 1.2rem; font-style: italic; font-family: var(--font-heading); }
.feature-copy p:not(.eyebrow):not(.subtitle) { color: var(--muted); font-size: 1.08rem; max-width: 68ch; }
.mini-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .5rem; color: var(--muted); }
.mini-list strong { color: var(--gold-2); }
.section-heading { max-width: 760px; margin-bottom: 2.4rem; }
.section-heading p:not(.eyebrow) { color: var(--muted); font-size: 1.05rem; }
.shelf-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 2rem; }
.chip, .tab { border: 1px solid rgba(198,165,106,.25); color: var(--muted); background: rgba(255,255,255,.045); padding: .65rem .95rem; border-radius: 999px; cursor: pointer; }
.chip.active, .tab.active { background: rgba(198,165,106,.16); color: var(--gold-2); border-color: rgba(198,165,106,.55); }
.book-shelves { display: grid; gap: 3rem; }
.shelf-title { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.25rem; color: var(--gold-2); }
.shelf-title::after { content:""; height: 1px; flex:1; background: linear-gradient(90deg, rgba(198,165,106,.45), transparent); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1.25rem; }
.book-card { position: relative; display: grid; grid-template-rows: auto 1fr; gap: .9rem; padding: .75rem; border: 1px solid rgba(198,165,106,.16); border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.025)); box-shadow: 0 12px 40px rgba(0,0,0,.28); transition: .2s ease; }
.book-card:hover { transform: translateY(-4px); border-color: rgba(198,165,106,.45); }
.book-card .cover { aspect-ratio: 2/3; border-radius: 16px; overflow: hidden; background: #030505; border: 1px solid rgba(198,165,106,.18); }
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-body { display: grid; align-content: start; gap: .55rem; padding: .25rem .25rem .5rem; }
.status { justify-self: start; color: #16110b; background: var(--gold); border-radius: 999px; padding: .16rem .55rem; font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.book-body h3 { font-size: 1.28rem; }
.book-meta { color: var(--gold); font-size: .92rem; font-style: italic; }
.book-hook { color: var(--muted); font-size: .94rem; margin: 0; }
.book-link { margin-top: .35rem; color: var(--gold-2); font-weight: 800; }
.order-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(320px, 1fr); gap: 3rem; align-items: start; }
.tabs { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.5rem; }
.order-panel { background: rgba(255,255,255,.045); border: 1px solid rgba(198,165,106,.17); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; counter-reset: order; }
.order-list li { counter-increment: order; display: grid; grid-template-columns: 44px 1fr; gap: .9rem; padding: .85rem; border-radius: 16px; background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.06); }
.order-list li::before { content: counter(order); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(198,165,106,.14); color: var(--gold-2); border: 1px solid rgba(198,165,106,.32); font-family: var(--font-heading); font-weight: 900; }
.order-list h3 { font-size: 1.1rem; }
.order-list p { margin: .2rem 0 0; color: var(--muted); font-size: .93rem; }
.order-note { margin-top: 1rem; padding: 1rem; border-left: 3px solid var(--red-2); background: rgba(123,30,36,.11); border-radius: 14px; color: var(--muted); }
.order-note strong { color: var(--gold-2); }
.archive-section { background: radial-gradient(circle at 80% 30%, rgba(123,30,36,.18), transparent 32rem); }
.archive-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(300px, 440px); gap: 3rem; align-items: start; }
.archive-copy p { color: var(--muted); max-width: 66ch; }
.archive-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; list-style: none; padding: 0; margin: 2rem 0 0; }
.archive-list li { padding: .8rem .9rem; border-radius: 14px; background: rgba(255,255,255,.045); border: 1px solid rgba(198,165,106,.12); }
.archive-list li::before { content: "✦"; color: var(--gold); margin-right: .45rem; }
.archive-form { padding: 1.25rem; border-radius: var(--radius); background: linear-gradient(180deg, rgba(239,226,196,.12), rgba(255,255,255,.045)); border: 1px solid rgba(198,165,106,.28); box-shadow: var(--shadow); }
.archive-form p, .archive-form small { color: var(--muted); }
.archive-form label { display: block; margin: 1rem 0 .3rem; color: var(--gold-2); font-weight: 800; }
.archive-form input { width: 100%; padding: .85rem 1rem; border-radius: 12px; border: 1px solid rgba(198,165,106,.28); background: rgba(0,0,0,.28); color: var(--white); }
.archive-form input:focus { outline: 2px solid rgba(198,165,106,.42); }
.extras-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.3rem; }
.extra-card { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid rgba(198,165,106,.2); min-height: 240px; box-shadow: var(--shadow); background: #050707; }
.extra-card img { width: 100%; height: 100%; object-fit: cover; opacity: .78; transform: scale(1.02); transition: .25s ease; }
.extra-card:hover img { transform: scale(1.06); opacity: .92; }
.extra-card span { position: absolute; left: 1rem; bottom: 1rem; padding: .65rem .85rem; border-radius: 999px; background: rgba(0,0,0,.72); color: var(--gold-2); border: 1px solid rgba(198,165,106,.25); font-weight: 900; }
.about-grid { display:grid; grid-template-columns: minmax(0,1fr) minmax(280px,.7fr); gap: 1.5rem; }
.about-card, .quote-card, .contact-card { border-radius: var(--radius); border: 1px solid rgba(198,165,106,.18); background: rgba(255,255,255,.045); padding: clamp(1.2rem, 4vw, 2.2rem); box-shadow: 0 14px 45px rgba(0,0,0,.25); }
.about-card p, .contact-card p { color: var(--muted); }
.quote-card { display:grid; place-items:center; background: radial-gradient(circle at 50% 50%, rgba(198,165,106,.14), rgba(255,255,255,.035)); }
blockquote { font: italic clamp(1.6rem, 4vw, 3.1rem)/1.15 var(--font-heading); color: var(--gold-2); margin: 0; text-align: center; }
.contact-card { text-align: center; }
.site-footer { padding: 2rem 0; border-top: 1px solid rgba(198,165,106,.14); color: var(--muted); }
.footer-grid { display:flex; align-items:center; justify-content:space-between; gap: 1rem; flex-wrap:wrap; }
.site-footer strong { color: var(--gold-2); font-family: var(--font-heading); }
.site-footer p { margin: .2rem 0 0; }
.site-footer nav { display:flex; gap:.8rem; flex-wrap:wrap; }
.site-footer nav a { color: var(--muted); }
.site-footer nav a:hover { color: var(--gold-2); }
.book-dialog { width: min(940px, calc(100% - 2rem)); border: 1px solid rgba(198,165,106,.32); border-radius: 24px; background: #0b0f10; color: var(--white); padding: 0; box-shadow: var(--shadow); }
.book-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(6px); }
.dialog-close { position: absolute; right: .75rem; top: .75rem; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(198,165,106,.3); background: rgba(0,0,0,.45); color: var(--white); font-size: 1.6rem; cursor: pointer; }
.dialog-book { display:grid; grid-template-columns: 280px 1fr; gap: 1.4rem; padding: 1.2rem; }
.dialog-book img { width:100%; border-radius: 16px; border: 1px solid rgba(198,165,106,.2); }
.dialog-copy { padding: .4rem .4rem .8rem; }
.dialog-copy h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
.dialog-copy .subtitle { color: var(--gold); font-family: var(--font-heading); font-style: italic; }
.dialog-copy p { color: var(--muted); }
.connection-tags { display:flex; flex-wrap:wrap; gap:.45rem; padding:0; margin:1rem 0; list-style:none; }
.connection-tags li { padding:.35rem .55rem; border-radius: 999px; border:1px solid rgba(198,165,106,.24); color: var(--gold-2); background: rgba(198,165,106,.08); font-size:.88rem; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } .reveal { opacity:1; transform:none; } }
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav { position: fixed; inset: 78px 1rem auto 1rem; display: none; padding: 1rem; border-radius: 20px; background: rgba(8,11,13,.96); border: 1px solid rgba(198,165,106,.18); box-shadow: var(--shadow); flex-direction: column; align-items: stretch; }
  .site-nav.open { display: flex; }
  .hero-grid, .feature-grid, .order-grid, .archive-grid, .about-grid { grid-template-columns: 1fr; }
  .hero-copy h1 { max-width: 12ch; }
  .hero-art { max-width: 520px; margin-inline: auto; }
  .book-cover-frame { max-width: 420px; margin-inline:auto; }
  .extras-grid, .archive-list { grid-template-columns: 1fr; }
  .dialog-book { grid-template-columns: 1fr; }
  .dialog-book img { max-width: 280px; margin:auto; }
}
@media (max-width: 560px) {
  .section { padding: 4rem 0; }
  .section-xl { padding: 5.5rem 0 4rem; }
  .stat-strip { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .brand small { display:none; }
  .book-grid { grid-template-columns: 1fr; }
}

/* Actual bookcase bookshelf display */
.book-shelves {
  display: grid;
  gap: 3.5rem;
}
.bookcase-series {
  position: relative;
}
.bookcase-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
}
.bookcase-header span {
  color: var(--mist);
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.bookcase-series .shelf-title {
  margin: 0;
}
.bookcase {
  position: relative;
  min-height: 360px;
  padding: 38px 28px 58px;
  border-radius: 26px;
  border: 1px solid rgba(198,165,106,.26);
  background:
    radial-gradient(circle at 22% 18%, rgba(198,165,106,.12), transparent 18rem),
    linear-gradient(180deg, rgba(22,15,10,.92), rgba(9,7,5,.92));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.035),
    inset 0 36px 80px rgba(0,0,0,.42),
    0 28px 80px rgba(0,0,0,.46);
  overflow: visible;
}
.bookcase::before,
.bookcase::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 18px;
  width: 18px;
  background: linear-gradient(90deg, rgba(94,55,25,.95), rgba(31,19,12,.96));
  box-shadow: inset 0 0 18px rgba(0,0,0,.45);
  z-index: 0;
}
.bookcase::before { left: 0; border-radius: 26px 0 0 20px; }
.bookcase::after { right: 0; border-radius: 0 26px 20px 0; transform: scaleX(-1); }
.bookcase-back {
  position: absolute;
  inset: 20px 18px 56px;
  border-radius: 16px 16px 8px 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0/78px 100%,
    radial-gradient(circle at 45% 20%, rgba(198,165,106,.11), transparent 25rem),
    linear-gradient(180deg, rgba(16,20,19,.55), rgba(4,5,5,.82));
  border: 1px solid rgba(198,165,106,.08);
  box-shadow: inset 0 22px 80px rgba(0,0,0,.7);
  z-index: 0;
}
.book-row {
  position: relative;
  z-index: 2;
  min-height: 292px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 14px 12px 6px;
  scrollbar-color: rgba(198,165,106,.45) rgba(0,0,0,.2);
  scrollbar-width: thin;
}
.book-row::after {
  content: "";
  align-self: stretch;
  width: min(18vw, 190px);
  flex: 0 0 min(18vw, 190px);
}
.shelf-plank {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 24px;
  height: 42px;
  border-radius: 8px 8px 14px 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.045), transparent 18%, rgba(255,255,255,.035) 35%, transparent 58%, rgba(255,255,255,.04)),
    linear-gradient(180deg, #7b4a22 0%, #4e2d15 42%, #1f130d 100%);
  border: 1px solid rgba(198,165,106,.22);
  box-shadow:
    inset 0 6px 10px rgba(255,255,255,.06),
    inset 0 -12px 18px rgba(0,0,0,.48),
    0 18px 34px rgba(0,0,0,.58);
  z-index: 1;
}
.book-on-shelf {
  position: relative;
  flex: 0 0 var(--book-width, 54px);
  width: var(--book-width, 54px);
  height: var(--book-height, 280px);
  display: block;
  transform: rotate(var(--book-tilt, 0deg));
  transform-origin: 50% 100%;
  transition: transform .22s ease, filter .22s ease, z-index 0s linear .22s;
  outline: none;
  z-index: 3;
  isolation: isolate;
}
.book-on-shelf:hover,
.book-on-shelf:focus-visible {
  transform: translateY(-18px) rotate(0deg) scale(1.035);
  filter: drop-shadow(0 26px 30px rgba(0,0,0,.62));
  z-index: 30;
  transition: transform .22s ease, filter .22s ease;
}
.book-spine {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  padding: .75rem .36rem;
  border-radius: 7px 7px 3px 3px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.18), transparent 12%, rgba(0,0,0,.22) 25%, transparent 42%, rgba(255,255,255,.06) 58%, rgba(0,0,0,.35) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--book-accent, #142621) 82%, #ffffff 8%), var(--book-accent, #142621) 48%, color-mix(in srgb, var(--book-accent, #142621) 64%, #000000 36%));
  border: 1px solid rgba(239,226,196,.22);
  box-shadow:
    inset 5px 0 8px rgba(255,255,255,.06),
    inset -6px 0 12px rgba(0,0,0,.38),
    0 10px 24px rgba(0,0,0,.45);
  overflow: hidden;
}
.book-spine::before,
.book-spine::after {
  content: "";
  position: absolute;
  left: .45rem;
  right: .45rem;
  height: 1px;
  background: rgba(225,201,139,.55);
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
}
.book-spine::before { top: 2.2rem; }
.book-spine::after { bottom: 2.4rem; }
.spine-number {
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #19110a;
  background: var(--gold-2);
  border: 1px solid rgba(0,0,0,.25);
  font: 900 .82rem var(--font-heading);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  z-index: 1;
}
.spine-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  color: #f7edd3;
  font: 900 clamp(.72rem, 1.2vw, .86rem)/1.05 var(--font-heading);
  letter-spacing: .045em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  max-height: calc(var(--book-height, 280px) - 6rem);
  overflow: hidden;
}
.spine-author {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: rgba(246,239,225,.72);
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  max-height: 4.3rem;
  overflow: hidden;
}
.book-cover-peek {
  position: absolute;
  left: 82%;
  bottom: 4px;
  width: 168px;
  aspect-ratio: 2/3;
  border-radius: 10px;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-28px) rotateY(-18deg) rotateZ(1deg) scale(.82);
  transform-origin: left bottom;
  transition: .22s ease;
  box-shadow: 0 22px 46px rgba(0,0,0,.7);
  border: 1px solid rgba(198,165,106,.35);
  pointer-events: none;
  z-index: -1;
}
.book-cover-peek img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.book-on-shelf:hover .book-cover-peek,
.book-on-shelf:focus-visible .book-cover-peek {
  opacity: 1;
  transform: translateX(0) rotateY(-8deg) rotateZ(1deg) scale(1);
  z-index: 4;
}
.bookcase-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + .65rem);
  width: max-content;
  max-width: 280px;
  transform: translateX(-50%) translateY(6px);
  padding: .65rem .75rem;
  border-radius: 12px;
  border: 1px solid rgba(198,165,106,.24);
  background: rgba(5,7,7,.94);
  color: var(--white);
  box-shadow: 0 18px 40px rgba(0,0,0,.48);
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
}
.bookcase-tooltip strong,
.bookcase-tooltip small {
  display: block;
}
.bookcase-tooltip small {
  color: var(--muted);
  margin-top: .1rem;
}
.book-on-shelf:hover .bookcase-tooltip,
.book-on-shelf:focus-visible .bookcase-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@supports not (color: color-mix(in srgb, red, black)) {
  .book-spine {
    background:
      linear-gradient(90deg, rgba(255,255,255,.18), transparent 12%, rgba(0,0,0,.22) 25%, transparent 42%, rgba(255,255,255,.06) 58%, rgba(0,0,0,.35) 100%),
      var(--book-accent, #142621);
  }
}

@media (max-width: 900px) {
  .bookcase { padding-inline: 18px; }
  .book-cover-peek { width: 138px; }
}
@media (max-width: 560px) {
  .bookcase-header { align-items: start; flex-direction: column; }
  .bookcase { min-height: 320px; padding: 24px 12px 48px; margin-inline: -1rem; border-radius: 0; border-left: 0; border-right: 0; }
  .book-row { min-height: 255px; padding-inline: 16px; }
  .book-on-shelf { flex-basis: max(44px, calc(var(--book-width, 54px) - 10px)); width: max(44px, calc(var(--book-width, 54px) - 10px)); height: calc(var(--book-height, 280px) - 34px); }
  .book-cover-peek { display: none; }
  .bookcase-tooltip { display: none; }
  .spine-title { font-size: .68rem; }
}

/* Three-image bookcase upgrade: front / back / spine */
.book-on-shelf {
  perspective: 900px;
}
.book-on-shelf:hover,
.book-on-shelf:focus-visible {
  transform: translateY(-22px) translateX(12px) rotate(0deg) scale(1.045);
}
.book-spine.has-spine-art {
  background: #0b0c0c;
  padding: 0;
}
.spine-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  filter: saturate(.95) contrast(1.04);
}
.spine-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  padding: .75rem .36rem;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255,255,255,.11), transparent 18%, rgba(0,0,0,.16) 52%, rgba(0,0,0,.42));
}
.book-cover-peek {
  width: 190px;
  border-radius: 12px;
  transform: translateX(-35px) rotateY(-24deg) rotateZ(1deg) scale(.82);
}
.book-on-shelf:hover .book-cover-peek,
.book-on-shelf:focus-visible .book-cover-peek {
  transform: translateX(10px) rotateY(-4deg) rotateZ(0deg) scale(1.02);
  opacity: 1;
}
.bookcase-tooltip small {
  max-width: 220px;
}
.pulled-book-view {
  grid-template-columns: minmax(240px, 340px) 1fr;
  align-items: start;
}
.book-gallery {
  display: grid;
  gap: .9rem;
}
.pulled-book-stage {
  position: relative;
  padding: .9rem;
  border-radius: 22px;
  border: 1px solid rgba(198,165,106,.24);
  background:
    radial-gradient(circle at 50% 15%, rgba(198,165,106,.18), transparent 14rem),
    rgba(0,0,0,.24);
  box-shadow: inset 0 0 40px rgba(0,0,0,.32);
}
.pulled-book-stage::before {
  content: "";
  position: absolute;
  inset: 10% -8% 3%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.5), transparent 65%);
  z-index: 0;
}
.active-book-image {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 310px);
  max-height: 460px;
  object-fit: contain;
  margin: auto;
  border-radius: 14px;
  border: 1px solid rgba(198,165,106,.25);
  box-shadow: 0 26px 70px rgba(0,0,0,.55);
  background: #080b0d;
}
.cover-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .45rem;
}
.cover-tab {
  border: 1px solid rgba(198,165,106,.26);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--text, var(--white));
  padding: .55rem .75rem;
  cursor: pointer;
  font: 700 .78rem var(--font-body);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cover-tab:hover,
.cover-tab:focus-visible,
.cover-tab.active {
  background: rgba(198,165,106,.16);
  border-color: rgba(198,165,106,.55);
  color: var(--gold-2);
}
@media (max-width: 760px) {
  .pulled-book-view { grid-template-columns: 1fr; }
  .active-book-image { max-height: 380px; }
}

.empty-shelf-note {
  margin: 2rem auto 0;
  max-width: 720px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(198, 165, 106, 0.28);
  border-radius: 18px;
  background: rgba(8, 11, 13, 0.55);
  color: var(--muted);
  text-align: center;
}


/* Blank planned/unreleased spine patch: use the full spine art, no title overlay, no white rails */
.book-on-shelf.blank-book,
.book-on-shelf.blank-placeholder {
  background: transparent;
  cursor: default;
  pointer-events: auto;
}

.book-on-shelf.blank-book .book-spine,
.book-on-shelf.blank-placeholder .book-spine,
.book-spine.blank-spine {
  overflow: hidden;
  padding: 0;
  background: #050807;
  border: 1px solid rgba(198,165,106,.28);
  box-shadow:
    inset 5px 0 10px rgba(255,255,255,.05),
    inset -6px 0 14px rgba(0,0,0,.45),
    0 10px 24px rgba(0,0,0,.45);
}

.book-on-shelf.blank-book .book-spine::before,
.book-on-shelf.blank-book .book-spine::after,
.book-on-shelf.blank-placeholder .book-spine::before,
.book-on-shelf.blank-placeholder .book-spine::after,
.book-spine.blank-spine::before,
.book-spine.blank-spine::after {
  display: none;
}

.book-on-shelf.blank-book .spine-art,
.book-on-shelf.blank-placeholder .spine-art,
.book-spine.blank-spine .spine-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
  filter: saturate(.95) contrast(1.04);
}

.book-on-shelf.blank-book .spine-overlay,
.book-on-shelf.blank-placeholder .spine-overlay,
.book-spine.blank-spine .spine-overlay {
  display: none !important;
}

.book-on-shelf.blank-book .book-cover-peek,
.book-on-shelf.blank-book .bookcase-tooltip,
.book-on-shelf.blank-placeholder .book-cover-peek,
.book-on-shelf.blank-placeholder .bookcase-tooltip {
  display: none !important;
}

.book-on-shelf.blank-book:hover,
.book-on-shelf.blank-book:focus-visible,
.book-on-shelf.blank-placeholder:hover,
.book-on-shelf.blank-placeholder:focus-visible {
  transform: rotate(var(--book-tilt, 0deg));
  filter: none;
  z-index: 3;
}

/* Emergency crop class: add `wide-blank-spine` to a placeholder if an older image still has white margins. */
.book-on-shelf.blank-book.wide-blank-spine .spine-art,
.book-on-shelf.blank-placeholder.wide-blank-spine .spine-art {
  left: -90%;
  width: 280%;
}

/* Responsive bookshelf rows: keep books on the same shelf until the row runs out of room.
   When there is no more horizontal room, the books wrap down to the next shelf row. */
.bookcase {
  min-height: 0;
  padding-bottom: 24px;
  overflow: visible;
}

.bookcase-back {
  bottom: 20px;
}

.book-row {
  --book-row-max-height: 306px;
  --book-row-gap: 58px;
  --shelf-thickness: 42px;
  --shelf-row-period: calc(var(--book-row-max-height) + var(--book-row-gap));
  --shelf-line-y: var(--book-row-max-height);

  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-start;
  column-gap: 5px;
  row-gap: var(--book-row-gap);
  min-height: 0;
  overflow: visible;
  padding: 14px 12px calc(var(--shelf-thickness) + 16px);
  scrollbar-width: none;

  /* Draw a wooden plank under each wrapped row. */
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--shelf-line-y) - 1px),
      rgba(198,165,106,.20) calc(var(--shelf-line-y) - 1px),
      rgba(123,74,34,.96) var(--shelf-line-y),
      rgba(78,45,21,.98) calc(var(--shelf-line-y) + 18px),
      rgba(31,19,13,.98) calc(var(--shelf-line-y) + var(--shelf-thickness)),
      transparent calc(var(--shelf-line-y) + var(--shelf-thickness) + 1px),
      transparent var(--shelf-row-period)
    );
  border-radius: 14px;
}

.book-row::-webkit-scrollbar {
  display: none;
}

.book-row::after {
  content: none;
  display: none;
}

/* The old single bottom plank is hidden because the wrapped rows now draw their own planks. */
.shelf-plank {
  display: none;
}

@media (max-width: 560px) {
  .book-row {
    --book-row-max-height: 272px;
    --book-row-gap: 48px;
    --shelf-thickness: 36px;
    padding-bottom: calc(var(--shelf-thickness) + 12px);
  }
}


/* Edition shelves: paperbacks / hardbacks / entry point / linked editions */
.entry-spine-badge {
  position: absolute;
  left: 50%;
  bottom: .55rem;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center;
  min-width: 78px;
  padding: .16rem .35rem;
  border-radius: 999px;
  background: var(--gold, #c6a56a);
  color: #16110b;
  font: 900 .56rem/1 var(--font-body, system-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 6px 16px rgba(0,0,0,.45);
  z-index: 3;
  pointer-events: none;
}

.book-on-shelf.entry-point-book .book-spine {
  box-shadow:
    0 0 0 2px rgba(198,165,106,.72),
    inset 5px 0 10px rgba(255,255,255,.07),
    inset -8px 0 16px rgba(0,0,0,.42),
    0 10px 24px rgba(0,0,0,.45);
}

.book-on-shelf.hardback-book .book-spine {
  border-color: rgba(123,30,36,.62);
}

.entry-dialog-badge {
  display: inline-flex;
  width: fit-content;
  margin: .2rem 0 .65rem;
  padding: .32rem .65rem;
  border-radius: 999px;
  background: rgba(198,165,106,.16);
  border: 1px solid rgba(198,165,106,.46);
  color: var(--gold-2, #efe2c4) !important;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .76rem !important;
}

.purchase-links,
.linked-editions {
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid rgba(198,165,106,.18);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}

.purchase-links h3,
.linked-editions h3 {
  margin: 0 0 .75rem;
  color: var(--gold-2);
  font-size: 1rem;
}

.purchase-link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.purchase-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: .55rem .75rem;
  border-radius: 999px;
  border: 1px solid rgba(198,165,106,.28);
  background: rgba(198,165,106,.10);
  color: var(--gold-2);
  font-weight: 900;
  text-decoration: none;
}

.purchase-link:hover,
.purchase-link:focus-visible {
  background: rgba(198,165,106,.18);
}

.linked-editions ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .5rem;
}

.linked-editions li a {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: .65rem;
  align-items: center;
  padding: .6rem;
  border-radius: 14px;
  border: 1px solid rgba(198,165,106,.14);
  background: rgba(0,0,0,.18);
  text-decoration: none;
}

.linked-editions li.active a {
  border-color: rgba(198,165,106,.52);
  background: rgba(198,165,106,.12);
}

.edition-order {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(198,165,106,.14);
  color: var(--gold-2);
  font-weight: 900;
}

.linked-editions strong,
.linked-editions small {
  display: block;
}

.linked-editions small {
  color: var(--muted);
}
