/* =====================================================================
   Mystic Book House — "Midnight Oracle" theme
   ===================================================================== */
:root {
  --night: #07061a;
  --night-2: #0d0b26;
  --glass: rgba(24, 20, 64, .42);
  --glass-strong: rgba(28, 23, 72, .62);
  --glass-line: rgba(196, 182, 255, .14);
  --glass-line-2: rgba(232, 217, 168, .28);
  --text: #eeeaff;
  --muted: #a9a3cf;
  --dim: #7d77a8;
  --violet: #8f7cff;
  --violet-2: #b9a9ff;
  --star: #e8d9a8;
  --star-2: #fff4d0;
  --amazon: #ffb347;
  --radius: 20px;
  --display: "Cormorant Garamond", Georgia, serif;
  --caps: "Cinzel", "Cormorant Garamond", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 78% -6%, rgba(143, 124, 255, .22), transparent 62%),
    radial-gradient(700px 480px at 8% 18%, rgba(70, 48, 170, .20), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(110, 60, 160, .16), transparent 60%),
    linear-gradient(180deg, #07061a 0%, #0a0822 45%, #07061a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: rgba(143, 124, 255, .45); color: #fff; }

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-radius: var(--radius);
}

/* ----- Type helpers ----- */
.eyebrow {
  font-family: var(--caps); color: var(--star); text-transform: uppercase;
  letter-spacing: .32em; font-size: .74rem; font-weight: 500; margin: 0 0 18px;
}
.ornament { display: flex; align-items: center; gap: 14px; color: var(--star); }
.ornament::before, .ornament::after {
  content: ""; height: 1px; flex: 1; max-width: 90px;
  background: linear-gradient(90deg, transparent, rgba(232, 217, 168, .7));
}
.ornament::after { transform: scaleX(-1); }
.section-title { font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.05; margin: 0; }
.section-title em { color: var(--star); font-style: italic; }

/* ----- Header ----- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(9, 8, 30, .55);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; color: var(--star); flex: none; filter: drop-shadow(0 0 10px rgba(232, 217, 168, .45)); }
.brand-name { font-family: var(--caps); font-size: 1.08rem; letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.brand-name span { color: var(--star); }
.nav { display: flex; gap: 30px; }
.nav a { text-decoration: none; color: var(--muted); font-size: .82rem; letter-spacing: .18em; text-transform: uppercase; transition: color .2s; }
.nav a:hover { color: var(--star-2); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 26px; border-radius: 999px; font: 600 .9rem var(--sans); letter-spacing: .04em;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, border-color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-star, .btn-gold {
  color: #1a1430;
  background: linear-gradient(180deg, #fff4d0 0%, #e8d9a8 55%, #cdb77a 100%);
  box-shadow: 0 0 0 1px rgba(255, 244, 208, .35), 0 10px 30px -8px rgba(232, 217, 168, .55);
}
.btn-star:hover, .btn-gold:hover { box-shadow: 0 0 0 1px rgba(255, 244, 208, .6), 0 14px 40px -6px rgba(232, 217, 168, .75); }
.btn-ghost { color: var(--text); background: rgba(255, 255, 255, .04); border-color: var(--glass-line-2); }
.btn-ghost:hover { border-color: var(--star); color: var(--star-2); background: rgba(232, 217, 168, .06); }
.btn-amazon { color: #1a1208; background: linear-gradient(180deg, #ffd08a, var(--amazon)); box-shadow: 0 10px 30px -10px rgba(255, 179, 71, .6); }
.btn[aria-disabled="true"] { background: rgba(255, 255, 255, .05); color: var(--dim); border-color: var(--glass-line); pointer-events: none; box-shadow: none; }

/* ----- Hero ----- */
.hero { position: relative; padding: 70px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 {
  font-family: var(--display); font-weight: 500; font-size: clamp(3rem, 7.2vw, 5.6rem);
  line-height: .98; letter-spacing: -.01em; margin: 0 0 26px;
}
.hero h1 em {
  font-style: italic; display: block;
  background: linear-gradient(100deg, #fff4d0 10%, #e8d9a8 40%, #b9a9ff 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { color: var(--muted); font-size: 1.12rem; max-width: 540px; margin: 0 0 22px; }
.hero-meta { color: var(--star); font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 34px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.stats { display: flex; gap: 40px; margin-top: 46px; padding-top: 26px; border-top: 1px solid var(--glass-line); max-width: 520px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-family: var(--display); font-size: 2.3rem; font-weight: 500; line-height: 1; color: var(--star-2); }
.stats span { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin-top: 6px; }

/* Oracle eye + floating books */
.oracle { position: relative; height: 560px; perspective: 1400px; }
.oracle-eye { position: absolute; inset: 50% auto auto 50%; width: 520px; height: 520px; transform: translate(-50%, -50%); pointer-events: none; }
.oracle-eye .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(232, 217, 168, .18); }
.oracle-eye .ring:nth-child(2) { inset: 50px; border-color: rgba(185, 169, 255, .22); border-style: dashed; animation: spin 80s linear infinite; }
.oracle-eye .ring:nth-child(3) { inset: 110px; border-color: rgba(232, 217, 168, .25); animation: spin 120s linear infinite reverse; }
.oracle-eye .glow {
  position: absolute; inset: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 217, 168, .55) 0%, rgba(143, 124, 255, .35) 35%, transparent 70%);
  filter: blur(18px); animation: breathe 7s ease-in-out infinite;
}
.oracle-eye svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 200s linear infinite; opacity: .55; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .65; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.05); } }

.float-book {
  position: absolute; width: 210px; aspect-ratio: 2 / 3; border-radius: 4px 10px 10px 4px; overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .8), 0 0 60px -10px rgba(143, 124, 255, .45), inset 3px 0 0 rgba(255, 255, 255, .12);
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
  animation: bob 9s ease-in-out infinite;
}
.float-book img { width: 100%; height: 100%; object-fit: cover; }
.float-book.b1 { left: 4%; top: 120px; --r: -14deg; animation-delay: -2s; z-index: 1; }
.float-book.b2 { left: 50%; top: 50px; margin-left: -125px; width: 250px; --r: 0deg; z-index: 3; }
.float-book.b3 { right: 4%; top: 140px; --r: 13deg; animation-delay: -5s; z-index: 2; }
.float-book { transform: rotateY(calc(var(--r) * -1.4)) rotateZ(var(--r)); }
@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -14px; }
}
.oracle a:hover .float-book, .float-book:hover { transform: rotateY(0) rotateZ(0) scale(1.04); }

/* ----- Shelf / books ----- */
.shelf { padding: 70px 0 30px; }
.shelf-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 26px; }
.shelf-head small { font-family: var(--sans); font-size: .85rem; color: var(--dim); letter-spacing: .1em; margin-left: 10px; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; }
.controls .select { width: 230px; }
.controls .search { width: 300px; }
.search {
  background: rgba(255, 255, 255, .04); border: 1px solid var(--glass-line); color: var(--text);
  border-radius: 999px; padding: 12px 20px 12px 44px; font: inherit; font-size: .92rem; width: min(320px, 100%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23a9a3cf' stroke-width='1.8'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 16px center;
}
.search:focus { outline: none; border-color: var(--star); box-shadow: 0 0 0 4px rgba(232, 217, 168, .1); }
.search::placeholder { color: var(--dim); }
.select {
  appearance: none; -webkit-appearance: none; background: rgba(255, 255, 255, .04); color: var(--text);
  border: 1px solid var(--glass-line); border-radius: 999px; padding: 12px 40px 12px 18px; font: inherit; font-size: .9rem; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23e8d9a8' stroke-width='1.6'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.select option { background: #120f33; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; }
.chip {
  border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .03); color: var(--muted);
  padding: 9px 18px; border-radius: 999px; font: 500 .85rem var(--sans); letter-spacing: .04em; cursor: pointer; transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--violet); }
.chip.active { color: #1a1430; background: linear-gradient(180deg, #fff4d0, #e8d9a8); border-color: transparent; font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 46px 28px; padding-bottom: 40px; }
.card { text-decoration: none; display: block; perspective: 900px; }
.card .cover-wrap { position: relative; transform-style: preserve-3d; transition: transform .25s ease-out; will-change: transform; }
.card .cover { transition: box-shadow .35s ease; }
.card .cover-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 4px 10px 10px 4px; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .28), transparent 50%);
  opacity: 0; transition: opacity .3s;
}
.card:hover .cover-wrap::after, .card:focus-visible .cover-wrap::after { opacity: 1; }
.card:hover .cover, .card:focus-visible .cover { box-shadow: 0 34px 60px -18px rgba(0, 0, 0, .85), 0 0 50px -6px rgba(143, 124, 255, .55); }
.card h3 { font-family: var(--display); font-size: 1.32rem; font-weight: 600; margin: 20px 0 4px; line-height: 1.15; transition: color .2s; }
.card:hover h3 { color: var(--star-2); }
.card .meta { color: var(--dim); font-size: .8rem; line-height: 1.45; }
.card .meta.author { color: var(--violet-2); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 4px; }
.card .price { color: var(--star); font-weight: 600; font-size: .88rem; margin-top: 6px; }
.empty { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 40px 0; }

/* ----- Covers ----- */
.cover {
  aspect-ratio: 2 / 3; border-radius: 4px 10px 10px 4px; overflow: hidden; position: relative;
  box-shadow: 0 24px 44px -16px rgba(0, 0, 0, .8), inset 3px 0 0 rgba(255, 255, 255, .1);
  background: var(--night-2);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.generated {
  display: flex; flex-direction: column; justify-content: space-between; text-align: center; padding: 18% 12% 12%;
  background: linear-gradient(160deg, var(--c1, #2b1f4a), var(--c2, #0f0b1c));
}
.cover.generated::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(232, 217, 168, .35); border-radius: 4px; }
.cover.generated .g-title { font-family: var(--display); font-size: clamp(1.1rem, 2.4vw, 1.7rem); font-weight: 600; line-height: 1.1; color: var(--star-2); }
.cover.generated .g-sym { font-size: 2.2rem; color: var(--star); }
.cover.generated .g-author { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

/* ----- Authors ----- */
.authors-section { padding: 90px 0 40px; }
.authors-section .center { text-align: center; margin-bottom: 40px; }
.authors-section .ornament { justify-content: center; }
.authors { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 26px; }
.author-card { padding: 34px; position: relative; overflow: hidden; }
.author-card::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 124, 255, .35), transparent 70%);
}
.monogram {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 20px;
  font-family: var(--caps); font-size: 1.25rem; color: var(--star-2);
  border: 1px solid var(--glass-line-2); background: radial-gradient(circle, rgba(232, 217, 168, .15), transparent 70%);
  box-shadow: 0 0 30px -6px rgba(232, 217, 168, .35);
}
.author-card h3 { font-family: var(--display); font-size: 2.1rem; font-weight: 500; margin: 0; line-height: 1.1; }
.author-card .meta { color: var(--star); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; margin: 6px 0 16px; }
.author-card p { color: var(--muted); margin: 0 0 24px; position: relative; }
.author-actions { display: flex; flex-wrap: wrap; gap: 10px; position: relative; }
.author-actions .btn { padding: 11px 20px; font-size: .84rem; }

/* ----- About ----- */
.about { padding: 70px 0 100px; }
.about .glass { padding: 56px clamp(24px, 6vw, 80px); text-align: center; }
.about .ornament { justify-content: center; }
.about h2 { font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 14px; }
.about p { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 1.05rem; }

/* ----- Footer ----- */
.site-footer { border-top: 1px solid var(--glass-line); padding: 34px 0; color: var(--dim); font-size: .85rem; background: rgba(7, 6, 26, .6); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--muted); }

/* ----- Book page ----- */
.book-hero { position: relative; isolation: isolate; }
.backdrop {
  position: absolute; inset: -40px 0 auto 0; height: 760px; z-index: -1; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 100%); mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
}
.backdrop::before {
  content: ""; position: absolute; inset: -60px; background: var(--bg) center / cover no-repeat;
  filter: blur(70px) saturate(140%); opacity: .35; transform: scale(1.2);
}
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; margin: 34px 0 0; font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; }
.back:hover { color: var(--star-2); }
.detail { display: grid; grid-template-columns: minmax(250px, 380px) 1fr; gap: 64px; padding: 34px 0 70px; align-items: start; }
.detail-cover { position: sticky; top: 100px; perspective: 1200px; }
.detail-cover .cover-wrap { transform: rotateY(-12deg) rotateX(2deg); transition: transform .6s ease; transform-style: preserve-3d; }
.detail-cover:hover .cover-wrap { transform: rotateY(0) rotateX(0); }
.detail-cover .cover { box-shadow: 30px 40px 80px -20px rgba(0, 0, 0, .9), 0 0 90px -10px rgba(143, 124, 255, .55), inset 4px 0 0 rgba(255, 255, 255, .14); }
.detail h1 { font-family: var(--display); font-size: clamp(2.6rem, 5.5vw, 4.2rem); font-weight: 500; line-height: 1; margin: 4px 0 12px; }
.detail .subtitle { font-family: var(--display); font-style: italic; font-size: 1.45rem; line-height: 1.35; color: var(--violet-2); margin: 0 0 18px; }
.detail .by { color: var(--muted); margin-bottom: 26px; font-size: .95rem; }
.detail .by strong { color: var(--star-2); font-weight: 600; }

.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 30px; padding: 0; list-style: none; }
.facts li { background: rgba(255, 255, 255, .035); border: 1px solid var(--glass-line); border-radius: 14px; padding: 10px 16px; font-size: .88rem; }
.facts li span { display: block; color: var(--dim); font-size: .66rem; text-transform: uppercase; letter-spacing: .18em; margin-bottom: 2px; }

.buy { padding: 28px; margin: 0 0 40px; }
.buy h2 { font-family: var(--caps); font-size: .82rem; letter-spacing: .3em; text-transform: uppercase; color: var(--star); margin: 0 0 18px; font-weight: 500; }
.buy-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.buy-option { border: 1px solid var(--glass-line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: rgba(7, 6, 26, .35); }
.buy-option .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.buy-option .amount { font-family: var(--display); font-size: 2rem; font-weight: 600; color: var(--star-2); line-height: 1; }
.buy-option small { color: var(--dim); font-size: .8rem; line-height: 1.5; }

.prose h2 { font-family: var(--display); font-size: 1.9rem; font-weight: 500; margin: 36px 0 12px; }
.prose p { color: #d6d1f2; margin: 0 0 16px; font-size: 1.04rem; }
.prose ul { padding-left: 0; list-style: none; color: #d6d1f2; }
.prose li { margin-bottom: 10px; padding-left: 26px; position: relative; }
.prose li::before { content: "✦"; position: absolute; left: 0; color: var(--star); font-size: .8rem; top: 3px; }
.prose blockquote {
  margin: 26px 0; padding: 22px 26px; border-left: 2px solid var(--star); border-radius: 0 16px 16px 0;
  background: rgba(232, 217, 168, .05); font-family: var(--display); font-size: 1.45rem; font-style: italic; color: var(--star-2);
}
.prose a { color: var(--star); }
.muted { color: var(--dim) !important; }

.related { border-top: 1px solid var(--glass-line); padding: 60px 0 90px; }
.related .section-title { margin-bottom: 34px; }
.notfound { text-align: center; padding: 140px 0; }
.notfound h1 { font-family: var(--display); font-weight: 500; font-size: 3rem; }

/* ----- Reveal on scroll ----- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ----- Responsive ----- */
@media (max-width: 980px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; text-align: center; }
  .hero .lead, .stats { margin-inline: auto; }
  .hero-actions, .stats { justify-content: center; }
  .oracle { height: 420px; order: -1; width: min(560px, 100% + 32px); margin: 0 auto; justify-self: center; }
  .oracle-eye { width: 400px; height: 400px; }
  .float-book { width: 150px; }
  .float-book.b2 { width: 180px; margin-left: -90px; top: 40px; }
  .float-book.b1 { top: 100px; } .float-book.b3 { top: 110px; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .brand-name { font-size: .92rem; letter-spacing: .14em; }
  .stats { gap: 26px; }
  .stats b { font-size: 1.9rem; }
  .detail { grid-template-columns: 1fr; gap: 30px; }
  .detail-cover { position: static; width: min(260px, 72%); margin-inline: auto; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 34px 16px; }
  .controls .search, .controls .select { width: 100%; }
  .controls { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
