/* ==========================================================================
   HOME PAGE (index.html) — loads after css/global.css
   Date/search bar, hero carousel, live badges, quick nav, highlights,
   latest news header, featured schedules, newsletter.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HERO: DATE BADGE & SITE SEARCH
   -------------------------------------------------------------------------- */
.search-date-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.live-date-badge {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.live-date-badge i {
  color: var(--accent-yellow);
}

.search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-dark);
}

.search-box button {
  background: var(--primary-navy);
  border: none;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.search-box button:hover {
  background: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   2. HERO CAROUSEL
   -------------------------------------------------------------------------- */
.carousel-container {
  position: relative;
  overflow: hidden;
  padding-bottom: 20px;
}

.carousel-slide {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.carousel-slide.active {
  display: block;
  opacity: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 40px;
}

.about-card-hero {
  background: #0056b3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  padding: 32px 30px;
  color: #ffffff;
  box-shadow: var(--shadow-xl);
}

.about-hero-title {
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.about-hero-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #e2e8f0;
  margin-bottom: 20px;
}

.learn-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  transition: var(--transition);
  margin-bottom: 24px;
}

.learn-more-btn:hover {
  background-color: #ffffff;
  color: #0056b3;
}

/* Call-to-action row under slide text (replaces the old inline margin-top) */
.hero-cta {
  margin-top: 20px;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pillar-box {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 14px 12px;
}

.pillar-box h4 {
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: #ffffff;
}

.pillar-box p {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.hero-image-frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 3px solid rgba(255, 255, 255, 0.2);
  height: 380px;
}

.hero-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.hero-image-frame:hover img {
  transform: scale(1.03);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 25px;
}

.carousel-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.carousel-dots .dot.active {
  background: #ffffff;
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

/* --------------------------------------------------------------------------
   3. LIVE BADGES & QUICK NAV CARDS
   -------------------------------------------------------------------------- */
.live-badges-section {
  margin-top: -30px;
  position: relative;
  z-index: 20;
}

.badges-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  flex-wrap: wrap;
}

.stream-badge-card {
  display: block;
}

.badge-inner {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  border: 2px solid #ffffff;
}

.badge-inner i {
  font-size: 2.2rem;
}

.badge-inner:hover {
  transform: translateY(-4px) scale(1.02);
}

.live-tv-bg {
  background: linear-gradient(135deg, #e11d48, #b91c1c);
}

.online-radio-bg {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.badge-text {
  display: flex;
  flex-direction: column;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.badge-title {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.quick-nav-section {
  padding: 40px 0 20px 0;
}

.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.quick-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.quick-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light-blue);
}

.q-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.q-tv { background-color: var(--accent-light-blue); }
.q-radio { background-color: var(--accent-red); }
.q-prog { background-color: var(--accent-yellow); }
.q-ent { background-color: var(--accent-green); }
.q-news { background-color: var(--accent-purple); }
.q-gallery { background-color: var(--accent-teal); }

.q-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin-bottom: 2px;
}

.q-info p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   4. PROGRAMMING HIGHLIGHTS & LATEST NEWS HEADER
   -------------------------------------------------------------------------- */
.highlights-section {
  padding: 20px 0 35px 0;
}

.panel-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-navy);
  margin-bottom: 16px;
}

.highlights-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.highlight-pill {
  padding: 14px;
  border-radius: var(--radius-md);
  color: #ffffff;
  transition: var(--transition);
}

.highlight-pill:hover {
  transform: translateY(-2px);
}

.highlight-pill h5 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.highlight-pill span {
  font-size: 0.72rem;
  opacity: 0.92;
}

.pill-green  { background-color: #16a34a; }
.pill-cyan   { background-color: #0284c7; }
.pill-orange { background-color: #ea580c; }
.pill-red    { background-color: #dc2626; }
.pill-blue   { background-color: #1e40af; }

.latest-news-section {
  padding: 30px 0 50px 0;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 26px;
}

/* --------------------------------------------------------------------------
   5. FEATURED BROADCAST SCHEDULES
   -------------------------------------------------------------------------- */
.schedule-section {
  background-color: #031735;
  color: #ffffff;
  padding: 55px 0;
}

.schedule-heading {
  margin-bottom: 30px;
}

.schedule-heading h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.schedule-heading p {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-top: 4px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.schedule-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  transition: var(--transition);
}

.schedule-box:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}

.sch-time {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  display: block;
  margin-bottom: 8px;
}

.sch-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 12px;
}

.sch-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   6. NEWSLETTER SUBSCRIPTION
   -------------------------------------------------------------------------- */
.newsletter-section {
  padding: 20px 0 55px 0;
}

.newsletter-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.newsletter-text h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-navy);
}

.newsletter-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.newsletter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 480px;
}

.newsletter-form input {
  flex-grow: 1;
  padding: 11px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  font-size: 0.86rem;
  outline: none;
  background-color: #f8fafc;
}

.newsletter-form button {
  background-color: var(--primary-navy);
  color: #ffffff;
  border: none;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.newsletter-form button:hover {
  background-color: var(--accent-blue);
}

.feedback-banner {
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
  padding-top: 6px;
}

/* Newsletter result states (set by home.js). Colours pass WCAG AA (4.5:1+)
   on the light page background. The icon is decorative; the text says it all. */
.feedback-banner.is-success { color: #15803d; }
.feedback-banner.is-error   { color: #b91c1c; }

.feedback-banner.is-success::before,
.feedback-banner.is-error::before {
  display: inline-block;
  margin-right: 6px;
  font-weight: 800;
}
.feedback-banner.is-success::before { content: "\2713"; } /* ✓ */
.feedback-banner.is-error::before   { content: "\26A0"; } /* ⚠ */

/* Empty banner (e.g. while sending) takes no space and shows no icon */
.feedback-banner:empty { padding-top: 0; }
.feedback-banner:empty::before { content: none; }

/* --------------------------------------------------------------------------
   7. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .quick-nav-grid { grid-template-columns: repeat(3, 1fr); }
  .highlights-track { grid-template-columns: repeat(3, 1fr); }
  .schedule-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .pillars-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   8. TABLET & MOBILE LAYOUT (≤ 991px) — desktop (≥ 992px) is untouched
   ========================================================================== */

/* Desktop keeps its original 3-card Latest News row. The 4th card exists
   only to complete the 2×2 grid on tablet/phone (spec 6). */
@media (min-width: 992px) {
  .latest-news-section .news-grid > .news-card:nth-child(n + 4) { display: none; }
}

@media (max-width: 991px) {

  /* ---- Spec 3: Date + search on ONE line; search fills remaining width ---- */
  .search-date-wrapper {
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 20px;
  }
  .live-date-badge {
    flex: 0 0 auto;           /* date keeps its natural width */
    white-space: nowrap;
    padding: 8px 12px;
    gap: 6px;
    font-size: 0.78rem;
  }
  .search-box {
    flex: 1 1 auto;           /* search stretches / shrinks to fit */
    min-width: 0;             /* allow shrinking below its content size */
    max-width: none;
    padding: 3px 4px 3px 14px;
  }
  .search-box input {
    min-width: 0;
    font-size: 16px;          /* stops iPhone Safari zooming in on focus */
    text-overflow: ellipsis;
  }
  .search-box button {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
  }

  /* ---- Spec 4: Hero carousel — photo on top, text underneath ---- */
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .hero-image-col { order: -1; }          /* photo first */
  .hero-image-frame {
    width: 100%;
    height: clamp(190px, 42vw, 320px);    /* defined height: never fills the screen */
    border-width: 2px;
  }
  .hero-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;                    /* crop, never stretch */
  }

  .carousel-slide .hero-title {
    font-size: clamp(1.75rem, 5.5vw, 2.4rem);
    margin-bottom: 12px;
  }
  .carousel-slide .hero-subtext { font-size: 0.92rem; }

  .about-card-hero { padding: 24px 20px; }
  .about-hero-title { font-size: 1.35rem; }

  /* Spec 4: "LIVE" badges scale down proportionally */
  .carousel-slide .live-pill {
    font-size: 0.64rem;
    padding: 5px 11px;
    gap: 6px;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
  }
  .carousel-slide .pulsing-dot { width: 7px; height: 7px; }

  .badge-inner {
    padding: 10px 20px;
    gap: 10px;
  }
  .badge-inner i { font-size: 1.7rem; }
  .badge-tag { font-size: 0.64rem; }
  .badge-title { font-size: 1rem; }

  /* ---- Spec 5: Quick-nav — balanced 3-column grid, no overflow ---- */
  .quick-nav-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));   /* minmax(0) prevents overflow */
    gap: 12px;
  }
  .quick-card,
  .q-info { min-width: 0; }
  .q-info h4,
  .q-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---- Spec 6: Latest News — locked 2×2 grid, equal cards ---- */
  .section-header-row {
    gap: 12px;
  }
  .section-header-row > div { flex: 1 1 0; min-width: 0; }  /* heading shrinks, button keeps its size */
  .section-header-row .view-more-btn { flex: 0 0 auto; }

  /* Programming highlights: equal columns that can't push past the screen */
  .highlights-track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .latest-news-section .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;                  /* both rows share the same height */
    gap: 16px;
  }
  .latest-news-section .news-card { min-width: 0; }
  .latest-news-section .news-img-box {
    height: auto;
    aspect-ratio: 16 / 10;                /* same image shape on every card */
  }
  .latest-news-section .news-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;                /* long headlines can't stretch a card */
    line-clamp: 3;
    overflow: hidden;
  }
}

/* ---------- Phones (≤ 768px) ---------- */
@media (max-width: 768px) {

  /* Spec 4: LIVE TV / ONLINE RADIO pills sit side by side, scaled down */
  .badges-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .badge-inner {
    justify-content: center;
    padding: 9px 12px;
    gap: 8px;
    border-width: 1.5px;
  }
  .badge-inner i { font-size: 1.4rem; }
  .badge-tag { font-size: 0.58rem; }
  .badge-title { font-size: 0.88rem; }

  /* Spec 5: cards stack icon over text so labels fit 3 across */
  .quick-card {
    flex-direction: column;
    text-align: center;
    gap: 8px;
    padding: 14px 8px;
  }
  .q-icon { width: 38px; height: 38px; font-size: 1rem; }
  .q-info { width: 100%; }
  .q-info h4 { font-size: 0.82rem; }
  .q-info p { font-size: 0.68rem; }

  /* Spec 6: tighter type so 2 columns never squish */
  .latest-news-section .section-title { font-size: 1.45rem; }
  .latest-news-section .news-grid { gap: 12px; }
  .latest-news-section .news-body { padding: 12px; }
  .latest-news-section .news-category {
    font-size: 0.58rem;
    padding: 3px 8px;
    margin-bottom: 8px;
  }
  .latest-news-section .news-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }
  .latest-news-section .news-meta { font-size: 0.7rem; }

  /* Newsletter: input shrinks so "Subscribe" never pushes off-screen */
  .newsletter-box { padding: 20px 18px; }
  .newsletter-form input {
    min-width: 0;
    font-size: 16px;          /* stops iPhone Safari zooming in on focus */
  }
  .newsletter-form button { flex: 0 0 auto; padding: 11px 18px; }
}

/* ---------- Small phones (≤ 480px) ---------- */
@media (max-width: 480px) {
  .live-date-badge { padding: 8px 10px; font-size: 0.74rem; }

  /* Spec 5: 6 cards → balanced 2 × 3 */
  .quick-nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

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

  .latest-news-section .news-title { font-size: 0.84rem; }
}

@media (max-width: 360px) {
  .live-date-badge i { display: none; }   /* give the search box more room */
}

/* ==========================================================================
   9. HERO CAROUSEL — UNIFORM SLIDES (≤ 991px)
   All 4 slides sit side by side in .carousel-track and share ONE locked
   height, so the page no longer jumps when slides change.
   Desktop (≥ 992px) keeps its original show/hide carousel.
   ========================================================================== */
@media (max-width: 991px) {

  /* Caption area minimum height — every slide's text block is at least this
     tall, and the flex track stretches all slides to the same height. */
  .carousel-container { --hero-caption-h: 300px; }

  /* ---- Spec 4: Container guard ---- */
  .carousel-container { overflow: hidden; }

  /* ---- Spec 1: Uniform slide dimensions (flex track) ---- */
  .carousel-track {
    display: flex;
    align-items: stretch;      /* every slide takes the tallest slide's height */
  }

  .carousel-slide,
  .carousel-slide.active {
    display: flex;             /* all slides rendered, side by side */
    flex-direction: column;
    flex: 0 0 100%;            /* exactly 100% of the container… */
    flex-shrink: 0;            /* …and never compressed */
    width: 100%;
    min-width: 0;
    opacity: 1;
    /* --slide-index is set on .carousel-track by js/pages/home.js */
    transform: translateX(calc(var(--slide-index, 0) * -100%));
    visibility: hidden;        /* off-screen slides: not focusable or read aloud */
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.5s;
  }
  .carousel-slide.active {
    visibility: visible;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Photo row + caption row; the caption row absorbs any spare height */
  .carousel-slide .hero-grid {
    flex: 1 1 auto;
    grid-template-rows: auto 1fr;
    align-items: stretch;
  }

  /* ---- Spec 2: Standardized image area (photo on top) ---- */
  .carousel-slide .hero-image-frame {
    width: 100%;
    height: clamp(190px, 42vw, 320px);   /* same frame on every slide */
  }
  .carousel-slide .hero-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;                   /* fill the frame, never distort */
  }

  /* ---- Spec 3: Standardized caption area (wording below) ---- */
  .carousel-slide .hero-text-col,
  .carousel-slide .about-card-hero {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: var(--hero-caption-h);
  }
  .carousel-slide .live-pill { align-self: flex-start; }   /* keep pill its natural width */

  /* Titles: max 2 lines, then "…" */
  .carousel-slide .hero-title,
  .carousel-slide .about-hero-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Body text: max 3 lines, then "…" */
  .carousel-slide .hero-subtext,
  .carousel-slide .about-hero-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Buttons sit on the same baseline at the bottom of every caption */
  .carousel-slide .hero-cta {
    margin-top: auto;
    padding-top: 14px;
  }
  .carousel-slide .learn-more-btn { margin-bottom: 0; }
  .carousel-slide .about-card-hero .learn-more-btn {
    align-self: flex-start;
    margin-top: auto;
  }
  .carousel-slide .about-card-hero .pillars-grid { margin-top: 16px; }

  .carousel-dots { margin-top: 18px; }
}

/* Phones: Mission / Vision / Values boxes would make slide 1 roughly twice
   as tall as the others, so they are hidden inside the carousel. */
@media (max-width: 768px) {
  .carousel-container { --hero-caption-h: 250px; }
  .carousel-slide .about-card-hero .pillars-grid { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-slide,
  .carousel-slide.active { transition: none; }
}
