/* =========================================================
   Theme — Books (books.php)
   Purpose: Full catalog page — series sections, book cards,
            reading order, buy CTAs, newsletter strip.
   Tokens inherited from base.css :root.
   Series colours:
     Relicrunners  → --teal  (#46f0ff)
     The Balam     → --ember (#ff9a3c)
     Standalones   → --gold  (#c9a84c)
========================================================= */

/* ---------- Local tokens ---------- */
:root {
  --ember:      #ff9a3c;
  --ember-soft: rgba(255, 154, 60, 0.12);
  --gold:       #c9a84c;
  --gold-soft:  rgba(201, 168, 76, 0.10);

  --card-bg:    rgba(10, 18, 28, 0.85);
  --border-mid: rgba(255, 255, 255, 0.16);
  --shadow-lg:  0 24px 72px rgba(0, 0, 0, 0.65);
}

/* =========================================================
   Background (matches gateway cinematic split)
========================================================= */
body.theme--books .wrap {
  min-height: 100vh;
  position: relative;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.38), rgba(0,0,0,0.48)),
    url("../img/backgrounds/gateway-bg.png") center / cover no-repeat;
}

body.theme--books .wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 560px at 12% 18%, rgba(70,240,255,0.13), transparent 60%),
    radial-gradient(900px 560px at 88% 18%, rgba(255,154,60,0.11), transparent 60%),
    radial-gradient(600px 400px at 50% 85%, rgba(70,240,255,0.05), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.58));
}

body.has-site-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("../img/backgrounds/gateway-bg.png") center / cover no-repeat;
}

body.has-site-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 25% 18%, rgba(70,240,255,0.10), transparent 60%),
    radial-gradient(900px 520px at 75% 18%, rgba(255,154,60,0.09), transparent 60%),
    linear-gradient(180deg, rgba(7,11,16,0.76), rgba(7,11,16,0.92));
}

/* =========================================================
   Page Hero
========================================================= */
.books-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 28px;
  padding: 80px 0 52px;
  animation: bkFadeUp .7s ease both;
}

.books-eyebrow {
  display: block;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.78;
  margin-bottom: 14px;
}

.books-hero__title {
  font-family: var(--serif-deco);
  font-size: clamp(38px, 5.5vw, 68px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: rgba(231,246,248,0.95);
  text-shadow: 0 10px 36px rgba(0,0,0,0.55);
  margin: 0 0 14px;
}

.books-hero__sub {
  font-family: var(--sans);
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.6;
  margin: 0;
}

/* Stats column */
.books-hero__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  animation: bkFadeUp .7s .12s ease both;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.stat-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-pill--rr    .stat-pill__dot { background: var(--accent); box-shadow: 0 0 5px var(--accent); }
.stat-pill--balam .stat-pill__dot { background: var(--ember);  box-shadow: 0 0 5px var(--ember); }
.stat-pill--solo  .stat-pill__dot { background: var(--gold);   box-shadow: 0 0 5px var(--gold); }

/* =========================================================
   Dividers
========================================================= */
.books-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(70,240,255,0.16), rgba(255,154,60,0.12), transparent);
  margin: 0;
}

/* =========================================================
   Filter Bar
========================================================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 32px 0 0;
  animation: bkFadeUp .7s .18s ease both;
}

.filter-label {
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(231,246,248,0.32);
  margin-right: 4px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: background .2s, color .2s, border-color .2s;
}

.filter-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.filter-btn.active                 { background: rgba(255,255,255,0.06); border-color: var(--border-mid); color: var(--text); }
.filter-btn--rr.active             { background: rgba(70,240,255,0.10);  border-color: rgba(70,240,255,0.38); color: var(--accent); }
.filter-btn--balam.active          { background: var(--ember-soft);       border-color: rgba(255,154,60,0.38); color: var(--ember); }
.filter-btn--solo.active           { background: var(--gold-soft);        border-color: rgba(201,168,76,0.38); color: var(--gold); }

.filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.filter-btn--rr    .filter-dot { background: var(--accent); }
.filter-btn--balam .filter-dot { background: var(--ember); }
.filter-btn--solo  .filter-dot { background: var(--gold); }

/* =========================================================
   Catalog Wrapper
========================================================= */
.catalog {
  padding: 44px 0 80px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.series-block { transition: opacity .2s; }
.series-block.hidden { display: none; }

/* =========================================================
   Series Header
========================================================= */
.series-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.series-header__left { display: flex; flex-direction: column; gap: 5px; }

.series-header__accent {
  height: 2px;
  width: 34px;
  border-radius: 1px;
  margin-bottom: 8px;
}
.series--rr   .series-header__accent                { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.series--balam .series-header__accent               { background: var(--ember);  box-shadow: 0 0 7px var(--ember); }
.series--solo  .series-header__accent,
.series-header__accent--solo                        { background: var(--gold);   box-shadow: 0 0 7px var(--gold); }

.series-header__label {
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(231,246,248,0.32);
}

.series-header__title {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(231,246,248,0.92);
  margin: 0;
}

.series-header__desc {
  font-family: var(--sans);
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  max-width: 440px;
  line-height: 1.55;
  margin: 0;
}

.series-header__cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: gap .2s;
}
.series-header__cta:hover         { gap: 11px; text-decoration: none; }
.series-header__cta--balam        { color: var(--ember); }

/* =========================================================
   Reading Order Callout
========================================================= */
.roc {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 26px;
  margin-bottom: 22px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.38);
  position: relative;
  overflow: hidden;
}

.roc::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.roc--rr::before   { background: radial-gradient(500px 200px at 0% 50%, rgba(70,240,255,0.05), transparent 60%); }
.roc--balam::before { background: radial-gradient(500px 200px at 0% 50%, rgba(255,154,60,0.05), transparent 60%); }

.roc__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.roc__icon--rr    { background: rgba(70,240,255,0.08); border: 1px solid rgba(70,240,255,0.18); color: var(--accent); }
.roc__icon--balam { background: rgba(255,154,60,0.08);  border: 1px solid rgba(255,154,60,0.18); color: var(--ember); }

.roc__text { flex: 1; }

.roc__title {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
}

.roc__desc {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* Reading order trail */
.roc__trail {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.trail-node {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.trail-node--rr-current    { background: rgba(70,240,255,0.20); border: 2px solid var(--accent); color: var(--accent); box-shadow: 0 0 10px rgba(70,240,255,0.22); }
.trail-node--balam-current { background: rgba(255,154,60,0.18);  border: 2px solid var(--ember);  color: var(--ember);  box-shadow: 0 0 10px rgba(255,154,60,0.20); }
.trail-node--future        { background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: rgba(231,246,248,0.3); }

.trail-line {
  width: 18px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.trail-label {
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(231,246,248,0.28);
  margin-left: 10px;
}

/* =========================================================
   Book Cards — Landscape
========================================================= */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.book-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  transition: transform .25s ease, box-shadow .25s ease;
}

.book-card:hover                { transform: translateY(-4px); }
.book-card--rr:hover            { box-shadow: 0 28px 80px rgba(0,0,0,0.6), 0 0 28px rgba(70,240,255,0.08); }
.book-card--balam:hover         { box-shadow: 0 28px 80px rgba(0,0,0,0.6), 0 0 28px rgba(255,154,60,0.08); }
.book-card--upcoming            { opacity: 0.75; }

/* Cover column — stretches to match body height via grid */
.book-card__cover {
  position: relative;
  overflow: hidden;
}

/* Cover image fills the full column height */
.book-card__cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}


.book-card__cover-placeholder {
  width: 100%;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
  gap: 6px;
}

.book-card--rr    .book-card__cover-placeholder { background: linear-gradient(160deg, rgba(70,240,255,0.10), rgba(7,11,16,0.96)); }
.book-card--balam .book-card__cover-placeholder { background: linear-gradient(160deg, rgba(255,154,60,0.12),  rgba(7,11,16,0.96)); }

.book-card__cover-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.035), transparent 65%);
  pointer-events: none;
}

.placeholder-series {
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  position: relative;
  display: block;
}
.book-card--rr    .placeholder-series { color: var(--accent); }
.book-card--balam .placeholder-series { color: var(--ember); }

.placeholder-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(231,246,248,0.72);
  line-height: 1.2;
  position: relative;
  display: block;
}

.placeholder-hint {
  font-family: var(--sans);
  font-size: 10px;
  color: rgba(231,246,248,0.28);
  font-style: italic;
  position: relative;
  display: block;
}

/* Badges */
.order-badge {
  position: absolute;
  top: 11px;
  left: 11px;
  background: rgba(7,11,16,0.88);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 2;
}

.status-badge {
  position: absolute;
  top: 11px;
  right: 11px;
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 2;
}

.status-badge--available { background: rgba(70,240,255,0.14);  color: var(--accent); border: 1px solid rgba(70,240,255,0.28); }
.status-badge--preorder  { background: rgba(255,154,60,0.12);   color: var(--ember);  border: 1px solid rgba(255,154,60,0.26); }
.status-badge--soon      { background: rgba(201,168,76,0.10);   color: var(--gold);   border: 1px solid rgba(201,168,76,0.24); }

/* Body column */
.book-card__body {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.book-card__top { display: flex; flex-direction: column; gap: 9px; }

.book-card__series-tag {
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
}

.book-card__series-tag--balam { color: var(--ember); }

.book-card__title {
  font-family: var(--serif);
  font-size: clamp(19px, 2.2vw, 26px);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  line-height: 1.15;
  margin: 0;
}

.book-card__tagline {
  font-family: var(--sans);
  font-size: 14px;
  font-style: italic;
  color: rgba(231,246,248,0.6);
  line-height: 1.5;
  margin: 0;
}

.book-card__synopsis {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

/* Actions */
.book-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

/* Buy buttons */
.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 9px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform .2s, filter .2s;
}
.btn-buy:hover { transform: translateY(-2px); filter: brightness(1.1); text-decoration: none; }

.btn-buy--amazon   { background: #FF9900; color: #111111; }
.btn-buy--preorder { background: var(--ember-soft); color: var(--ember); border: 1px solid rgba(255,154,60,0.28); }
.btn-buy--notify   { background: var(--gold-soft);  color: var(--gold);  border: 1px solid rgba(201,168,76,0.26); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 9px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: background .2s, color .2s, transform .2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.09); color: var(--text); transform: translateY(-1px); text-decoration: none; }

/* Meta row */
.book-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(231,246,248,0.32);
}

/* =========================================================
   Standalone Grid — Portrait cards
========================================================= */
.solo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.solo-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 55px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .25s ease, box-shadow .25s ease;
}

.solo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 28px 75px rgba(0,0,0,0.65), 0 0 22px rgba(201,168,76,0.07);
}

.solo-card__cover {
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(201,168,76,0.09), rgba(7,11,16,0.96));
  gap: 8px;
}

.solo-card__cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(201,168,76,0.10), transparent 65%);
  pointer-events: none;
}

.solo-status {
  position: absolute;
  top: 11px;
  right: 11px;
}

.solo-cover-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(231,246,248,0.72);
  line-height: 1.2;
  position: relative;
  display: block;
}

.solo-cover-hint {
  font-family: var(--sans);
  font-size: 10px;
  color: rgba(231,246,248,0.26);
  font-style: italic;
  position: relative;
  display: block;
}

.solo-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.solo-card__title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0;
}

.solo-card__desc {
  font-family: var(--sans);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  margin: 0;
}

.solo-card__actions { margin-top: 4px; }

/* =========================================================
   Newsletter Strip
========================================================= */
.nl-strip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 42px 52px;
  margin-bottom: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.nl-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 500px 250px at 0% 50%,   rgba(70,240,255,0.05), transparent 60%),
    radial-gradient(ellipse 400px 200px at 100% 50%, rgba(255,154,60,0.04), transparent 60%);
  pointer-events: none;
}

.nl-strip__left { position: relative; }

.nl-strip__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(70,240,255,0.07);
  border: 1px solid rgba(70,240,255,0.18);
  border-radius: 6px;
  padding: 5px 12px;
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.nl-strip__title {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--text);
}

.nl-strip__title span { color: var(--accent); }

.nl-strip__sub {
  font-family: var(--sans);
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  max-width: 440px;
  line-height: 1.6;
  margin: 0;
}

.nl-strip__cta { flex-shrink: 0; position: relative; }

/* Re-use the site's PNG newsletter button class if available,
   otherwise falls back to this styled anchor */
.btn-newsletter-nl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(70,240,255,0.18), rgba(70,240,255,0.08));
  border: 1px solid rgba(70,240,255,0.32);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
}

.btn-newsletter-nl:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(70,240,255,0.18);
  background: linear-gradient(135deg, rgba(70,240,255,0.24), rgba(70,240,255,0.12));
  text-decoration: none;
  color: var(--accent);
}

/* =========================================================
   Animations
========================================================= */
@keyframes bkFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Responsive
========================================================= */
@media (max-width: 1100px) {
  .solo-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .books-hero        { grid-template-columns: 1fr; }
  .books-hero__stats { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .series-header     { flex-direction: column; align-items: flex-start; }
  .roc               { flex-wrap: wrap; }
  .roc__trail        { width: 100%; }
  .nl-strip          { flex-direction: column; padding: 32px 26px; }
  .nl-strip__sub     { max-width: none; }
}

@media (max-width: 680px) {
  .book-card                    { grid-template-columns: 1fr; }
  .book-card__cover             { height: 340px; }
  .book-card__cover-placeholder { min-height: 180px; }
  .solo-grid                    { grid-template-columns: 1fr; }
  .filter-bar                   { gap: 6px; }
}