/* ============================================================
   KIDS BOOK DAY — Section Component
   Dependency: Swiper.js (swiper-bundle.min.css)
   Root.css overrides noted inline where applicable
   ============================================================ */

/* ------------------------------------------------------------
   1. SECTION CONTAINER
   ------------------------------------------------------------ */
.kids-book-day {
  --purple-color: #7d3d95;
  --green-color: #047e97;

  background-image:
    linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
    url(./bg-pattern-lighter.jpg);
  background-repeat: repeat;
  background-attachment: fixed; /* iOS override in §6 */
  padding-block: 4rem;
  margin-block: 2rem;
}

/* ------------------------------------------------------------
   2. HEADER — logo, heading, intro paragraph
   ------------------------------------------------------------ */
.kids-book-day .book-day-logo {
  width: 200px;
  margin-inline: auto;
  margin-bottom: 2rem;
}

.kids-book-day h2 {
  /* fluid: 1.8rem (29px) @ 320px → 5.5rem (88px) @ 1440px */
  font-size: clamp(1.8rem, 4.3vw + 0.94rem, 5.5rem);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  max-width: 20ch;
  margin-inline: auto;
  margin-bottom: 1rem;
  color: var(--purple-color);
  font-family: var(--main-font-family);
}

.kids-book-day p {
  /* fluid: 1rem (16px) → 1.4rem (22px) @ 1440px */
  font-size: clamp(1rem, 0.5vw + 0.9rem, 1.4rem);
  font-family: var(--accent-font-family);
  font-weight: 500;
  text-align: center;
  max-width: 75ch;
  margin-inline: auto;
  margin-bottom: 2rem;
  color: var(--green-color);
  /* white glow lifts text off the busy background pattern */
  text-shadow:
    0 0 8px rgba(255, 255, 255, 1),
    0 0 16px rgba(255, 255, 255, 0.95),
    0 0 28px rgba(255, 255, 255, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.12);
}

/* ------------------------------------------------------------
   3. SWIPER LAYOUT — equal-height slides
   ------------------------------------------------------------ */
.kids-book-day .swiper-wrapper {
  align-items: stretch;
}

.kids-book-day .swiper-slide {
  display: flex;
  height: auto;
}

/* ------------------------------------------------------------
   4. CARD ANATOMY
   .card-item → .card-link → .card-image / h3 / .cta
   ------------------------------------------------------------ */
.kids-book-day .card-item {
  display: flex;
  width: 100%;
}

.kids-book-day .card-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 1rem;
  padding-bottom: 1rem;
  overflow: hidden;
  background: #fff;
  border-radius: 2rem;
  text-decoration: none;
  color: inherit;
}

.kids-book-day .card-image {
  aspect-ratio: 3 / 3.5;
  overflow: hidden;
  border-radius: 2rem;
  /* revealed on hover — creates green tint via img opacity */
  background-color: var(--green-color);
}

.kids-book-day .card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.kids-book-day .card-item h3 {
  /* fluid: 0.875rem (14px) → 1.2rem (19px) @ 1440px */
  font-size: clamp(0.875rem, 0.45vw + 0.73rem, 1.2rem);
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  padding-inline: 0.75rem;
  color: var(--green-color);
}

.kids-book-day .card-item .cta {
  /* fluid: 0.875rem (14px) → 1.2rem (19px) @ 1440px */
  font-size: clamp(0.875rem, 0.4vw + 0.77rem, 1.2rem);
  width: -webkit-fit-content; /* Safari < 15 */
  width: fit-content;
  padding: 0.5rem 2rem;
  border-radius: 2rem;
  margin-top: auto;
  margin-inline: auto;
  background-color: var(--purple-color);
  color: white;
  transition: background-color 0.3s ease;
}

/* ------------------------------------------------------------
   5. NAVIGATION BUTTONS
   Desktop: absolute left/right of swiper, vertically centered
   Mobile:  static row, centered below the slides
   ------------------------------------------------------------ */

/* wrapper gives buttons a positioning context outside the swiper clip */
.kids-book-swiper-nav {
  position: relative;
}

/* swiper keeps overflow: hidden — slides stay clipped */

.kids-books-button--next,
.kids-books-button--prev {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  border: none;
  background-color: var(--purple-color);
  box-shadow: 0 2px 12px rgba(125, 61, 149, 0.35);
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

/*
  Fluid positioning: fully outside at 1280px → flush inside at 768px
  right/left: clamp(-4.5rem, -14vw + 7.25rem, 0.5rem)
  At 1280px → -4rem (button fully outside + gap)
  At  768px →  0.5rem (just inside the edge)
  Below 768px → clamped to 0.5rem (then mobile overrides kick in)
*/
.kids-books-button--next {
  right: clamp(-4.5rem, -14vw + 7.25rem, 0.5rem);
}
.kids-books-button--prev {
  left: clamp(-4.5rem, -14vw + 7.25rem, 0.5rem);
}

/* SVG arrow via mask-image — color controlled with background-color */
.kids-books-button--next::after,
.kids-books-button--prev::after {
  content: "";
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  background-color: white;
  -webkit-mask-image: url("../Assets/arrow-right-solid.svg");
  mask-image: url("../Assets/arrow-right-solid.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  transition: background-color 0.25s ease;
}

/* flip horizontally for the left/prev arrow */
.kids-books-button--prev::after {
  transform: scaleX(-1);
}

/* disabled state — Swiper adds this class automatically */
.kids-books-button--next.swiper-button-disabled,
.kids-books-button--prev.swiper-button-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ------------------------------------------------------------
   7. INTERACTIONS — pointer devices only (not touch)
   Overrides global a:hover { opacity: 0.7 } from Root.css
   ------------------------------------------------------------ */
@media (hover: hover) {
  .kids-book-day .card-link:hover {
    opacity: 1; /* cancel Root.css global a:hover opacity */
  }

  .kids-book-day .card-link:hover .card-image img {
    opacity: 0.82; /* green background bleeds through for tint */
  }

  .kids-book-day .card-link:hover .cta {
    background-color: var(--green-color);
  }

  .kids-books-button--next:hover,
  .kids-books-button--prev:hover {
    background-color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }

  .kids-books-button--next:hover::after,
  .kids-books-button--prev:hover::after {
    background-color: var(--purple-color);
  }
}

/* ------------------------------------------------------------
   8. RESPONSIVE
   ------------------------------------------------------------ */

/* background-attachment: fixed is broken on iOS Safari — reset */
@media (hover: none) and (pointer: coarse) {
  .kids-book-day {
    background-attachment: scroll;
  }
}

@media (max-width: 767px) {
  .kids-book-day .swiper-wrapper {
    align-items: flex-start;
  }

  /* collapse flex to block for single-column layout */
  .kids-book-day .swiper-slide,
  .kids-book-day .card-item {
    display: block;
    height: auto;
  }

  .kids-book-day .card-link {
    height: auto;
  }

  /* buttons move below the slides — add bottom padding to wrapper */
  .kids-book-swiper-nav {
    padding-bottom: 4.5rem;
  }

  .kids-books-button--next,
  .kids-books-button--prev {
    top: auto;
    bottom: 0.75rem;
    transform: none;
  }

  /* center both buttons: total width = 3.5rem + 1rem gap + 3.5rem = 8rem */
  .kids-books-button--prev {
    left: calc(50% - 4rem);
    right: auto;
  }
  .kids-books-button--next {
    left: calc(50% + 0.5rem);
    right: auto;
  }
}
