/* ============================================================
   AUDIOBOOKS PAGE
   Load AFTER styles.css:
   <link rel="stylesheet" href="css/audiobooks.css">
   Uses the colour tokens defined in styles.css (:root).
   ============================================================ */

.ab-page {
  overflow: hidden;
}

/* ---------- SHARED BITS ---------- */

.ab-kicker,
.ab-eyebrow,
.ab-band-label {
  display: block;
  font-family: 'Alfa Slab One', serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.ab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: 'Alfa Slab One', serif;
  font-size: 0.9rem;
  line-height: 1.2;
  letter-spacing: 0.025em;
  text-decoration: none;
  padding: 0.85rem 1.25rem;
  border: 3px solid var(--black);
  border-radius: 4px;
  box-shadow: 4px 4px 0 var(--black);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ab-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--black);
}

.ab-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--black);
}

.ab-btn--amber { background: var(--amber); color: var(--black); }
.ab-btn--dark  { background: var(--black); color: var(--amber); }
.ab-btn--cream { background: var(--cream); color: var(--black); }

.ab-btn--dark:hover { background: var(--ink); }

.ab-btn--ghost {
  background: transparent;
  color: var(--amber);
  border-color: var(--amber);
  box-shadow: none;
}

.ab-btn--ghost:hover {
  background: var(--amber);
  color: var(--black);
  box-shadow: 5px 5px 0 var(--amber-dark);
}

.ab-btn:focus-visible,
.ab-chapters summary:focus-visible {
  outline: 4px solid var(--blue-accent);
  outline-offset: 4px;
}

/* ---------- HERO ---------- */

.ab-hero {
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  min-height: min(720px, calc(100vh - 70px));
  border-bottom: 5px solid var(--black);
}

.ab-hero-copy {
  background: var(--black);
  padding: clamp(4rem, 8vw, 7rem) clamp(2rem, 6vw, 6rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  isolation: isolate;
}

/* Faint "track" lines behind the headline */
.ab-hero-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 46px,
    rgba(245, 166, 35, 0.05) 46px 48px
  );
  pointer-events: none;
  z-index: -1;
}

.ab-kicker {
  color: var(--amber);
  font-size: 0.76rem;
  margin-bottom: 1.25rem;
}

.ab-hero h1 {
  text-wrap: balance;
  color: var(--cream);
  font-size: clamp(2.6rem, 4.6vw, 4.9rem);
  max-width: 760px;
  margin: 0;
}

.ab-hero h1 em {
  color: var(--amber);
  font-style: normal;
}

.ab-hero-lead {
  color: var(--amber-pale);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.75;
  max-width: 640px;
  margin: 2rem 0 0;
}

.ab-hero-lead strong {
  color: var(--amber-light);
}

.ab-hero-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.ab-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2.25rem;
  margin-top: 3rem;
}

.ab-stats dt {
  color: var(--amber);
  font-family: 'Alfa Slab One', serif;
  font-size: 1.6rem;
  line-height: 1;
  white-space: nowrap;
}

.ab-stats dd {
  color: var(--amber-pale);
  font-size: 0.73rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 0.4rem;
  opacity: 0.8;
}

/* Hero art: the cover wearing headphones, with sound rings behind it */

.ab-hero-art {
  background-color: var(--amber);
  background-image: repeating-radial-gradient(
    circle at 50% 46%,
    transparent 0 38px,
    rgba(26, 16, 8, 0.07) 38px 42px
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.75rem;
  padding: clamp(4rem, 7vw, 6rem) clamp(3rem, 7vw, 6rem) clamp(3rem, 5vw, 4.5rem);
  position: relative;
  min-height: 620px;
}

.ab-rig {
  position: relative;
  width: min(330px, 66%);
  aspect-ratio: 1 / 1;
  transform: rotate(-3deg);
  z-index: 2;
}

.ab-rig-cover {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--cream);
  border: 4px solid var(--black);
  box-shadow: 10px 10px 0 var(--black);
  position: relative;
  z-index: 2;
}

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

.ab-headband {
  position: absolute;
  left: -10%;
  right: -10%;
  top: -17%;
  height: 72%;
  border: 16px solid var(--black);
  border-bottom: 0;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  z-index: 1;
}

.ab-earcup {
  position: absolute;
  top: 36%;
  width: 17%;
  height: 34%;
  background: var(--black);
  border-radius: 16px;
  z-index: 3;
  box-shadow: 5px 5px 0 rgba(26, 16, 8, 0.35);
}

.ab-earcup::after {
  content: "";
  position: absolute;
  inset: 18% 22%;
  border-radius: 10px;
  background: var(--amber-dark);
}

.ab-earcup--left  { left: -14%; }
.ab-earcup--right { right: -14%; }

.ab-earcup--left::after  { right: auto; left: 44%; width: 30%; }
.ab-earcup--right::after { left: auto; right: 44%; width: 30%; }

/* Equalizer bars */
.ab-eq {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 46px;
  position: relative;
  z-index: 2;
}

.ab-eq span {
  display: block;
  width: 9px;
  height: 40%;
  background: var(--black);
  border-radius: 2px 2px 0 0;
  transform-origin: bottom;
  animation: ab-eq 1.1s ease-in-out infinite alternate;
}

.ab-eq span:nth-child(3n)   { background: var(--blue-accent); }
.ab-eq span:nth-child(4n+1) { background: var(--green-accent); }

.ab-eq span:nth-child(1)  { height: 35%; animation-delay: -0.2s; }
.ab-eq span:nth-child(2)  { height: 70%; animation-delay: -0.9s; }
.ab-eq span:nth-child(3)  { height: 50%; animation-delay: -0.4s; }
.ab-eq span:nth-child(4)  { height: 90%; animation-delay: -0.7s; }
.ab-eq span:nth-child(5)  { height: 60%; animation-delay: -0.1s; }
.ab-eq span:nth-child(6)  { height: 100%; animation-delay: -0.6s; }
.ab-eq span:nth-child(7)  { height: 45%; animation-delay: -1s; }
.ab-eq span:nth-child(8)  { height: 80%; animation-delay: -0.3s; }
.ab-eq span:nth-child(9)  { height: 55%; animation-delay: -0.8s; }
.ab-eq span:nth-child(10) { height: 95%; animation-delay: -0.5s; }
.ab-eq span:nth-child(11) { height: 40%; animation-delay: -0.15s; }
.ab-eq span:nth-child(12) { height: 75%; animation-delay: -0.65s; }
.ab-eq span:nth-child(13) { height: 50%; animation-delay: -0.35s; }
.ab-eq span:nth-child(14) { height: 30%; animation-delay: -0.85s; }

@keyframes ab-eq {
  from { transform: scaleY(0.35); }
  to   { transform: scaleY(1); }
}

.ab-note {
  position: absolute;
  z-index: 4;
  background: var(--cream);
  color: var(--black);
  border: 2px solid var(--black);
  box-shadow: 3px 3px 0 var(--black);
  padding: 0.45rem 0.65rem;
  font-family: 'Alfa Slab One', serif;
  font-size: 0.7rem;
  line-height: 1.2;
}

.ab-note--top {
  top: 2rem;
  right: 2rem;
  transform: rotate(3deg);
}

.ab-note--bottom {
  left: 2rem;
  bottom: 2rem;
  transform: rotate(-2deg);
}

.ab-cover-empty {
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: grid;
  place-items: center;
  background: var(--amber-pale);
  font-size: 3rem;
}

/* ---------- SHELF INTRO ---------- */

.ab-intro {
  max-width: 1180px;
  margin: 4.5rem auto 2rem;
  padding: 0 1.5rem;
}

.ab-intro h2 {
  margin-bottom: 0.75rem;
}

.ab-intro p {
  max-width: 700px;
  color: var(--ink);
}

/* ---------- AUDIOBOOK CARD ---------- */

.ab-shelf {
  max-width: 1180px;
  margin: 0 auto 5rem;
  padding: 0 1.5rem;
  display: grid;
  gap: 2.5rem;
}

.ab-card {
  background: var(--cream);
  border: 3px solid var(--black);
  box-shadow: 8px 8px 0 var(--black);
}

.ab-card-main {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "cover  copy"
    "sample copy";
}

/* No sample player: let the cover column run the full height */
.ab-card-main--no-sample {
  grid-template-rows: 1fr;
  grid-template-areas: "cover copy";
}

.ab-card-cover {
  grid-area: cover;
  background: var(--amber-light);
  border-right: 3px solid var(--black);
  padding: 2.5rem 2rem 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.ab-card-cover::after {
  content: "";
  width: 170%;
  height: 60px;
  background: var(--black);
  opacity: 0.055;
  position: absolute;
  top: 40%;
  transform: rotate(-18deg);
}

.ab-card-cover img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  position: relative;
  z-index: 2;
  border: 3px solid var(--black);
  box-shadow: 7px 7px 0 var(--black);
  transform: rotate(-1.5deg);
}

.ab-card-cover .ab-cover-empty {
  max-width: 260px;
  aspect-ratio: 1 / 1;
  border: 3px dashed var(--black);
  position: relative;
  z-index: 2;
}

.ab-card-badge {
  position: absolute;
  z-index: 3;
  left: 1rem;
  top: 1rem;
  background: var(--black);
  color: var(--amber);
  font-family: 'Alfa Slab One', serif;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  border-radius: 3px;
  transform: rotate(-3deg);
}

.ab-card-copy {
  grid-area: copy;
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

.ab-eyebrow {
  color: var(--amber-dark);
  font-size: 0.66rem;
  margin-bottom: 0.5rem;
}

.ab-card h3 {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  margin: 0;
}

.ab-tagline {
  font-weight: 900;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--black);
  margin: 0.4rem 0 1rem;
}

.ab-description {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.72;
  max-width: 760px;
}

.ab-quote {
  margin: 1.4rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--amber-pale);
  border-left: 5px solid var(--blue-accent);
  max-width: 760px;
}

.ab-quote p {
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
}

.ab-quote cite {
  display: block;
  margin-top: 0.4rem;
  font-style: normal;
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--black);
}

.ab-facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.ab-facts li {
  background: #fff;
  border: 2px solid var(--black);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  box-shadow: 3px 3px 0 var(--black);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.35;
}

.ab-facts strong {
  display: block;
  font-family: 'Alfa Slab One', serif;
  font-weight: 400;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber-dark);
  margin-bottom: 0.2rem;
}

.ab-buy {
  border-top: 2px dashed rgba(26, 16, 8, 0.3);
  margin-top: 1.6rem;
  padding-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

.ab-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.ab-price-amount {
  font-family: 'Alfa Slab One', serif;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--black);
}

.ab-price-where {
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  opacity: 0.75;
}

.ab-buy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.ab-fineprint {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--ink);
  opacity: 0.7;
}

.ab-unavailable {
  font-size: 0.9rem;
  font-style: italic;
  opacity: 0.7;
}

/* Sample player, under the cover */

.ab-sample {
  grid-area: sample;
  background: var(--amber-light);
  border-right: 3px solid var(--black);
  padding: 0.5rem 2rem 2rem;
}

.ab-band-label {
  color: var(--amber-dark);
  font-size: 0.64rem;
  margin-bottom: 0.35rem;
}

.ab-sample .ab-band-label { color: var(--ink); opacity: 0.75; }

.ab-sample h4 {
  font-family: 'Alfa Slab One', serif;
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.15;
  color: var(--black);
  margin-bottom: 0.75rem;
}

.ab-player {
  border: 3px solid var(--black);
  border-radius: 15px;
  box-shadow: 5px 5px 0 var(--black);
  overflow: hidden;
  background: var(--ink);
}

.ab-player iframe {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
}

/* Chapter list band */

.ab-chapters {
  background: var(--cream);
  border-top: 3px solid var(--black);
  padding: 1.5rem clamp(1.5rem, 4vw, 2.75rem);
}

.ab-chapters summary {
  list-style: none;
  cursor: pointer;
  display: block;
  position: relative;
  padding-right: 2.5rem;
}

.ab-chapters summary::-webkit-details-marker { display: none; }

.ab-chapters summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  font-family: 'Alfa Slab One', serif;
  font-size: 1.1rem;
  line-height: 1;
  background: var(--amber);
  border: 2px solid var(--black);
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--black);
}

.ab-chapters[open] summary::after { content: "–"; }

.ab-chapters-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.15;
  color: var(--black);
}

.ab-chapters-title small {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.7;
}

.ab-chapter-list {
  list-style: none;
  margin-top: 1.25rem;
  columns: 3 230px;
  column-gap: 2.25rem;
}

.ab-chapter-list li {
  break-inside: avoid;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.38rem 0;
  border-bottom: 1px dashed rgba(26, 16, 8, 0.22);
  font-size: 0.93rem;
  line-height: 1.35;
}

.ab-ch-num {
  font-family: 'Alfa Slab One', serif;
  font-size: 0.75rem;
  color: var(--amber-dark);
}

.ab-ch-title {
  font-weight: 700;
  color: var(--black);
}

.ab-ch-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.65;
}

.ab-chapter-list li.is-credit .ab-ch-title {
  font-weight: 400;
  font-style: italic;
  opacity: 0.75;
}

/* ---------- LISTENING CONDITIONS ---------- */

.ab-uses {
  max-width: 1180px;
  margin: 5rem auto;
  padding: 0 1.5rem;
}

.ab-uses h2 {
  margin-bottom: 1.75rem;
}

.ab-uses-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

.ab-uses-grid li {
  background: var(--cream);
  border: 3px solid var(--black);
  box-shadow: 5px 5px 0 var(--black);
  padding: 1.4rem 1.25rem 1.5rem;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ab-uses-grid li:nth-child(even) {
  background: var(--amber-light);
}

.ab-uses-grid li:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--black);
}

.ab-uses-num {
  display: block;
  font-family: 'Alfa Slab One', serif;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--black);
  opacity: 0.15;
  margin-bottom: 0.6rem;
}

.ab-uses-grid h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.ab-uses-grid p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}

/* ---------- BOTTOM CTA ---------- */

.ab-cta {
  width: min(1180px, calc(100% - 3rem));
  max-width: none;
  margin: 5rem auto;
  padding: 2.2rem;
  background: var(--black);
  color: var(--amber-pale);
  border: 3px solid var(--amber);
  box-shadow: 8px 8px 0 var(--amber-dark);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
}

.ab-cta-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  background: var(--amber);
  color: var(--black);
  border: 3px solid var(--amber);
  font-size: 2rem;
  transform: rotate(-5deg);
}

.ab-cta h2 {
  text-wrap: balance;
  color: var(--amber);
  font-size: clamp(1.35rem, 3vw, 2rem);
  margin-bottom: 0.35rem;
}

.ab-cta p {
  color: var(--amber-pale);
  font-size: 0.95rem;
  line-height: 1.55;
}

.ab-cta .ab-band-label {
  color: var(--amber-light);
}

.ab-load-error {
  max-width: 900px;
  margin: 4rem auto;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1100px) {
  .ab-uses-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .ab-hero {
    grid-template-columns: 1fr;
  }

  .ab-hero-art {
    min-height: 540px;
  }

  .ab-card-main {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }

  .ab-cta {
    grid-template-columns: auto 1fr;
  }

  .ab-cta .ab-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .ab-hero-copy {
    padding: 3.5rem 1.25rem;
  }

  .ab-hero h1 {
    font-size: clamp(2.5rem, 12vw, 4.2rem);
  }

  .ab-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ab-btn {
    width: 100%;
    text-align: center;
  }

  .ab-stats {
    gap: 1.25rem 1.75rem;
  }

  .ab-stats dt {
    font-size: 1.35rem;
  }

  .ab-hero-art {
    min-height: 0;
    padding: 4.5rem 1.25rem 4.75rem;
    gap: 2.25rem;
  }

  .ab-rig {
    width: min(240px, 58vw);
  }

  .ab-headband {
    border-width: 12px;
  }

  .ab-note {
    font-size: 0.6rem;
  }

  .ab-note--top {
    top: 1rem;
    right: 1rem;
  }

  .ab-note--bottom {
    left: 1rem;
    bottom: 1rem;
  }

  .ab-eq {
    height: 34px;
    gap: 5px;
  }

  .ab-eq span {
    width: 7px;
  }

  .ab-intro {
    margin-top: 3rem;
    padding: 0 1.25rem;
  }

  .ab-shelf {
    padding: 0 1.25rem;
  }

  .ab-card {
    box-shadow: 6px 6px 0 var(--black);
  }

  .ab-card-main,
  .ab-card-main--no-sample {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "cover"
      "copy"
      "sample";
  }

  .ab-card-cover {
    border-right: 0;
    border-bottom: 3px solid var(--black);
    padding: 2.5rem 1.5rem 2.25rem;
  }

  .ab-sample {
    border-right: 0;
    border-top: 3px solid var(--black);
    padding: 1.25rem;
  }

  .ab-card-cover img,
  .ab-card-cover .ab-cover-empty {
    max-width: min(220px, 62vw);
  }

  .ab-card-copy {
    padding: 1.5rem 1.25rem;
  }

  .ab-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ab-buy {
    flex-direction: column;
    align-items: stretch;
  }

  .ab-buy-links {
    flex-direction: column;
  }

  .ab-chapters {
    padding: 1.25rem;
  }

  .ab-chapter-list {
    columns: 1;
  }

  .ab-uses {
    margin: 3.5rem auto;
    padding: 0 1.25rem;
  }

  .ab-uses-grid {
    grid-template-columns: 1fr;
  }

  .ab-cta {
    width: calc(100% - 2.5rem);
    margin: 3.5rem auto;
    padding: 1.5rem;
    grid-template-columns: 1fr;
  }

  .ab-cta-mark {
    width: 54px;
    height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ab-eq span {
    animation: none;
  }

  .ab-btn,
  .ab-uses-grid li {
    transition: none !important;
  }
}
