
/* ---- Theme tokens (safe defaults; won't override your root vars) ---- */
:root {
  --card-gold: #d4af37;
  --card-gold-soft: rgba(212, 175, 55, 0.92);
  --card-bg: #0b1120;
  --card-shadow: rgba(0, 0, 0, 0.60);
}

/* =========================================
   SECTION WRAPPERS
   ========================================= */
.why-books,
.what-to-expect {
  max-width: 980px;
  margin: 70px auto;
  padding: 0 20px;
  text-align: center;

  font-family: "Garamond", "EB Garamond", "Cormorant Garamond", Georgia, serif;
}

/* Headings */
.why-books > h2,
.what-to-expect > h2 {
  margin: 0 0 18px 0;
  color: var(--card-gold);
  letter-spacing: 3px;
  font-size: clamp(1.6rem, 2.4vw, 2.05rem);
}

/* Intro / closing lines */
.why-books .why-intro,
.why-books .why-tagline,
.what-to-expect .expect-closing {
  max-width: 780px;
  margin: 0 auto 28px;
  color: var(--black);
  font-size: 1rem;
  line-height: 1.75;
}

/* Tagline emphasis */
.why-books .why-tagline,
.what-to-expect .expect-closing {
  margin-top: 26px;
  font-style: italic;
  letter-spacing: 0.8px;
  color: 000;
}

/* =========================================
   WHY LIST GRID (KEY FIX: orphan centering)
   ========================================= */

/*
  The root cause of "3rd card drops lower-left":
  - using 1fr tracks means the last row starts at the left edge.
  Fix:
  - Use fixed-width columns and center the track group with justify-content:center.
  - Cards will wrap into centered rows naturally.
*/

.why-books .why-list {
  list-style: none;
  padding: 0;
  margin: 0;

  display: grid;
  gap: 26px;

  /* Fixed card width (prevents title wrapping + centers orphans) */
  grid-template-columns: repeat(auto-fit, 340px);

  /* This centers the entire set of columns (including last row/orphans) */
  justify-content: center;
}

/* =========================================
   EXPECT GRID (same centering approach)
   ========================================= */
.what-to-expect .expect-grid {
  display: grid;
  gap: 26px;

  grid-template-columns: repeat(auto-fit, 340px);
  justify-content: center;
}

/* =========================================
   CARD BASE (applies to why-list li + expect-card)
   ========================================= */
.why-books .why-list > li,
.what-to-expect .expect-grid > .expect-card {
  width: 340px; /* match track width */
  max-width: 100%;

  background: var(--card-bg);
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 16px;

  padding: 26px 22px;
  text-align: center;

  color: var(--card-gold);
  box-shadow: 0 18px 45px var(--card-shadow);

  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

/* Hover lift (subtle) */
.why-books .why-list > li:hover,
.what-to-expect .expect-grid > .expect-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.72);
  border-color: rgba(212, 175, 55, 0.9);
}

/* =========================================
   CARD TYPOGRAPHY
   ========================================= */

/* Why-list title uses <strong> */
.why-books .why-list > li strong {
  display: block;
  margin: 0 0 10px 0;
  font-size: 1.08rem;
  letter-spacing: 1.4px;
  color: var(--card-gold);

  /* keeps the title on one line at 340px */
  white-space: nowrap;
}

/* Expect-card title uses <h3> */
.what-to-expect .expect-grid > .expect-card > h3 {
  margin: 0 0 10px 0;
  font-size: 1.08rem;
  letter-spacing: 1.4px;
  color: var(--card-gold);

  white-space: nowrap;
}

/* Paragraph text inside cards */
.why-books .why-list > li,
.what-to-expect .expect-grid > .expect-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--card-gold-soft);
}

/* Remove unexpected default margins (helps consistency) */
.what-to-expect .expect-grid > .expect-card p {
  margin: 0;
}

/* =========================================
   RESPONSIVE
   ========================================= */

/* Tablet: slightly narrower cards so 2-up fits more often */
@media (max-width: 900px) {
  .why-books .why-list,
  .what-to-expect .expect-grid {
    grid-template-columns: repeat(auto-fit, 320px);
  }

  .why-books .why-list > li,
  .what-to-expect .expect-grid > .expect-card {
    width: 320px;
    padding: 22px 18px;
    border-radius: 14px;
  }

  .why-books .why-list > li strong,
  .what-to-expect .expect-grid > .expect-card > h3 {
    font-size: 1.05rem;
  }
}

/* Mobile: single column, full width */
@media (max-width: 540px) {
  .why-books,
  .what-to-expect {
    margin: 50px auto;
    padding: 0 16px;
  }

  .why-books .why-list,
  .what-to-expect .expect-grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .why-books .why-list > li,
  .what-to-expect .expect-grid > .expect-card {
    width: 100%;
  }

  /* Allow titles to wrap on very small screens if needed */
  .why-books .why-list > li strong,
  .what-to-expect .expect-grid > .expect-card > h3 {
    white-space: normal;
  }
}


/* =========================================
   CREDIBILITY / AUTHORITY BADGES 
   ========================================= */

.cred-badges{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:12px;

  max-width:1000px;
  margin:24px auto 40px;
  padding:0 20px;
}

/* Badge */
.cred-badge{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:10px;

  background:#000;
  border:1px solid rgba(212,175,55,0.65);
  border-radius:999px;

  padding:8px 16px;

  color:#d4af37;
  font-family:"Garamond","EB Garamond","Cormorant Garamond",Georgia,serif;
  font-size:0.92rem;
  letter-spacing:1px;
  white-space:nowrap;

  box-shadow:0 10px 25px rgba(0,0,0,0.55);

  cursor:default;
  outline:none;

  /* Scroll-in (initial state) */
  opacity:0;
  transform:translateY(10px);
  transition:opacity .45s ease, transform .45s ease, border-color .25s ease;
}

.cred-badge.in-view{
  opacity:1;
  transform:translateY(0);
}

.cred-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:inherit;
}

/* Hover/Focus polish */
.cred-badge:hover{
  border-color:rgba(212,175,55,0.95);
}

.cred-badge:focus{
  box-shadow:0 0 0 2px rgba(212,175,55,0.45), 0 10px 25px rgba(0,0,0,0.55);
}

/* ---------- Tooltip (solid black, wraps text) ---------- */
.cred-badge::after{
  content:attr(data-tooltip);
  position:absolute;
  left:50%;
  bottom:calc(100% + 12px);
  transform:translateX(-50%);

  width:max-content;
  max-width:260px;

  background:#000; /* solid black */
  border:1px solid rgba(212,175,55,0.70);
  border-radius:12px;
  padding:10px 12px;

  color:#d4af37;
  font-family:"Garamond","EB Garamond",Georgia,serif;
  font-size:0.9rem;
  line-height:1.45;
  letter-spacing:0.3px;
  text-align:center;

  white-space:normal;
  word-wrap:break-word;
  overflow-wrap:break-word;

  box-shadow:0 18px 45px rgba(0,0,0,0.75);

  opacity:0;
  visibility:hidden;
  pointer-events:none;

  transition:opacity .18s ease, transform .18s ease;
}

/* Tooltip arrow */
.cred-badge::before{
  content:"";
  position:absolute;
  left:50%;
  bottom:calc(100% + 6px);
  transform:translateX(-50%) rotate(225deg);

  width:10px;
  height:10px;

  background:#000;
  border-left:1px solid rgba(212,175,55,0.70);
  border-top:1px solid rgba(212,175,55,0.70);

  opacity:0;
  visibility:hidden;
  pointer-events:none;

  transition:opacity .18s ease;
}

/* Show tooltip on hover or keyboard focus */
.cred-badge:hover::after,
.cred-badge:focus::after{
  opacity:1;
  visibility:visible;
  transform:translateX(-50%) translateY(-2px);
}

.cred-badge:hover::before,
.cred-badge:focus::before{
  opacity:1;
  visibility:visible;
}

/* Mobile tweaks */
@media (max-width:600px){
  .cred-badges{
    margin:20px auto 32px;
  }

  .cred-badge{
    font-size:0.86rem;
    padding:7px 14px;
  }

  .cred-badge::after{
    max-width:220px;
  }
}
/* Force credibility badges into a single row on desktop */
.cred-badges{
  max-width: 1400px;   /* wider container */
  flex-wrap: nowrap;  /* prevent wrapping */
}

/* Allow wrapping again on smaller screens */
@media (max-width: 900px){
  .cred-badges{
    flex-wrap: wrap;
    max-width: 100%;
  }
}

/* REVIEWS CSS */

/* =========================
   REVIEWS OVERLAY
   ========================= */

.reviews-btn{
  background: transparent;
  border: 1px solid rgba(212,175,55,.7);
  color: #d4af37;
  font-family: "Garamond", "Georgia", serif;
  font-size: 18px; /* ⬅️ increase this value as needed */
  letter-spacing: 1px;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.reviews-btn:hover{
  background: rgba(212,175,55,.12);
  border-color: #d4af37;
  transform: translateY(-1px);
}

.reviews-overlay{
  position: fixed;
  inset: 0;
  display: none;                 /* hidden until opened */
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.86);
  z-index: 999999;
}

.reviews-overlay.is-open{
  display: flex;
}

.reviews-card{
  width: min(980px, 94vw);
  max-height: min(82vh, 760px);
  overflow: auto;
  background: #0b1120;
  border: 1px solid rgba(212,175,55,.35);
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(0,0,0,.55);
  padding: 18px 18px 16px;
  color: #d4af37;
  font-family: "Garamond", "Georgia", serif;
  position: relative;
}

/* Close button (top right) */
.reviews-close{
  position: absolute;
  top: 10px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(212,175,55,.35);
  background: rgba(2,6,23,.4);
  color: #d4af37;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}

.reviews-close:hover{
  background: rgba(212,175,55,.12);
  border-color: rgba(212,175,55,.75);
  transform: translateY(-1px);
}

.reviews-title{
  margin: 4px 44px 6px 4px;
  letter-spacing: 1.5px;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.reviews-subtitle{
  margin: 0 4px 14px;
  color: rgba(212,175,55,.85);
  font-size: 1rem;
  line-height: 1.5;
}

.reviews-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 6px 4px 10px;
}

@media (max-width: 760px){
  .reviews-grid{ grid-template-columns: 1fr; }
}

.review-box{
  background: rgba(2,6,23,.55);
  border: 1px solid rgba(212,175,55,.28);
  border-radius: 14px;
  padding: 14px 14px 12px;
}

.review-stars{
  letter-spacing: 2px;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.review-text{
  margin: 0 0 10px;
  color: #d4af37;
  font-size: 1.02rem;
  line-height: 1.55;
}

.review-meta{
  margin: 0;
  color: rgba(212,175,55,.78);
  font-size: 0.95rem;
  font-style: italic;
}

.reviews-footer{
  border-top: 1px solid rgba(212,175,55,.22);
  margin-top: 10px;
  padding: 12px 4px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.reviews-note{
  margin: 0;
  color: rgba(212,175,55,.85);
  font-size: 0.98rem;
  line-height: 1.45;
}

.reviews-cta{
  background: rgba(212,175,55,.12);
  border: 1px solid rgba(212,175,55,.7);
  color: #d4af37;
  font-family: "Garamond", "Georgia", serif;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}

.reviews-cta:hover{
  background: rgba(212,175,55,.18);
  transform: translateY(-1px);
}

/* Prevent layout shift when locking scroll */
html.scroll-lock{
  overflow: hidden;
}
.why-actions{
  display: flex;
  justify-content: center;
  margin: 20px 0 0;
  gap: 16px;
}

.why-actions .reviews-btn {
  display: inline-block;
  font-size: 24px !important;
  padding: 16px 30px !important;
}

html.scroll-lock{ overflow:hidden; }
.footer-actions{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
}
.why-actions * {
  font-size: 24px !important;
}
.footer-action-btn{
  background: rgba(212,175,55,.12);
  border: 1px solid rgba(212,175,55,.7);
  color: #d4af37;
  font-family: Garamond, Georgia, serif;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2,6,23,.86);
  z-index: 99999;
}

.overlay.is-open{ display:flex; }

.overlay-card{
  background:#0b1120;
  border:1px solid rgba(212,175,55,.35);
  border-radius:16px;
  padding:20px;
  width:min(300px,94vw);
  max-height:82vh;
  overflow:auto;
  color:#d4af37;
  position:relative;
  font-family:Garamond, Georgia, serif;
}

.overlay-close{
  position:absolute;
  top:10px;
  right:12px;
  font-size:26px;
  background:none;
  border:none;
  color:#d4af37;
  cursor:pointer;
}

html.scroll-lock{ overflow:hidden; }

.book-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 16px 24px;
  border: 1px solid #d7b56d;
  border-radius: 999px;
  background: linear-gradient(180deg, #ecd39a 0%, #d9b56d 100%);
  color: #6b5734;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(120, 97, 54, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.book-pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(120, 97, 54, 0.22);
  filter: brightness(1.02);
}

.book-pill-btn:active {
  transform: translateY(0);
}

.ai-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.ai-overlay.is-open {
  display: block;
}

.ai-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 24, 12, 0.34);
  backdrop-filter: blur(3px);
}

.ai-overlay-dialog {
  position: absolute;
  left: 50%;
  top: 8vh;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px));
  max-height: 84vh;
  overflow: hidden;
  border-radius: 24px;
  background: #f7f4ee;
  border: 1px solid rgba(214, 181, 109, 0.55);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.ai-overlay-inner {
  padding: 28px 24px 24px;
  overflow-y: auto;
  max-height: 84vh;
}

.ai-overlay-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #efe7d7;
  color: #6b5734;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.ai-form label {
  display: block;
  margin: 10px 0 8px;
  color: #6b5734;
  font-weight: 700;
}

.ai-form textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #d8c5a0;
  background: #fffdfa;
  color: #4a3c25;
  font: inherit;
  box-sizing: border-box;
}

.ai-form-actions {
  margin-top: 16px;
}

.ai-response-wrap {
  margin-top: 18px;
}

.ai-response {
  padding: 18px;
  border-radius: 18px;
  background: #fffdfa;
  border: 1px solid #e2d2b1;
  color: #4c402d;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}