/**
 *  Front-end styles for NCBC blocks.
 *
 *  Since render functions output original design class names (.page-hero,
 *  .closer, .sec-head, .pillar, .belief, .learn-card, etc.), the existing
 *  page-XXX.css files style everything. This file only adds:
 *    – Block-specific tweaks that aren't in the original design
 *    – Consistent block layout wrapper rules
 *    – New blocks that have no original design counterpart (numbered-list, verse-card)
 */

/* ─────────────────────────────────────────────
 *   Container width for block-built pages
 *   ───────────────────────────────────────────
 *   page.php wraps block-built pages in <main class="ncbc-page-blocks">.
 *   Every direct child block gets a 1400px max-width + horizontal padding
 *   so it sits in the design's standard column — except `alignfull` blocks
 *   (page-hero, closer-cta, group-band) which deliberately break out.
 */
.ncbc-page-blocks .entry-content > * {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* The video popup is a position:fixed full-screen overlay. When the
 * latest-sermons block renders it inside .entry-content, the container rule
 * above would otherwise squeeze the backdrop to 1400px + 48px padding. Reset
 * the width/margin so the overlay truly covers the viewport (the inner frame
 * keeps its own 1400px cap; padding is handled by the .ncbc-video-modal rules). */
.ncbc-page-blocks .entry-content > .ncbc-video-modal {
    max-width: none;
    margin: 0;
    padding-left: 24px;
    padding-right: 24px;
}

/* Block-level vertical rhythm */
.ncbc-page-blocks .entry-content > .wp-block-ncbc-section-header,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-numbered-list,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-verse-quote,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-icon-card-grid,
.ncbc-page-blocks .entry-content > .learn-grid,
.ncbc-page-blocks .entry-content > .learn-card,
.ncbc-page-blocks .entry-content > .belief,
.ncbc-page-blocks .entry-content > .pillar,
.ncbc-page-blocks .entry-content > .value-row,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-stat-row,
.ncbc-page-blocks .entry-content > .scope-card {
    padding-top: 32px;
    padding-bottom: 32px;
}

/* Full-bleed blocks override the container — width, margin, AND padding —
 * so each section's own CSS controls its internal padding. Each section's
 * desktop + mobile padding rules in page-*.css set the horizontal gutter. */
.ncbc-page-blocks .entry-content > .alignfull,
.ncbc-page-blocks .entry-content > .page-hero,
.ncbc-page-blocks .entry-content > .closer,
.ncbc-page-blocks .entry-content > .group-band,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-page-hero,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-closer-cta,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-group-band {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}
.ncbc-page-blocks .entry-content > .alignfull > .container,
.ncbc-page-blocks .entry-content > .page-herol > .container,
.ncbc-page-blocks .entry-content > .closerl > .container,
.ncbc-page-blocks .entry-content > .group-bandl > .container,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-page-herol > .container,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-closer-ctal > .container,
.ncbc-page-blocks .entry-content > .wp-block-ncbc-group-bandl > .container {
    padding-left: 24px;
    padding-right: 24px;
}

/* wp:group wrappers in WXR — give them the same container constraint */
.ncbc-page-blocks .entry-content > .wp-block-group {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    /* Inline padding from WXR is preserved */
}
.ncbc-page-blocks .entry-content > .wp-block-group.alignfull {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* ─────────────────────────────────────────────
 *   New blocks with no original design counterpart
 *   ─────────────────────────────────────────── */

/* Numbered list */
.ncbc-numbered-list {
    list-style: none;
    padding: 0;
    margin: 24px 0;
    display: grid;
    gap: 28px;
}
.ncbc-numbered-item {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 24px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(11, 23, 38, 0.08);
}
.ncbc-numbered-item:last-child { border-bottom: none; }
.ncbc-numbered-item .num {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 36px;
    line-height: 1;
    color: var(--gold, #b88a52);
}
.ncbc-numbered-item h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--ink, #0b1726);
}
.ncbc-numbered-item .en {
    font-size: 12px;
    letter-spacing: 0.08em;
    color: rgba(11, 23, 38, 0.55);
    margin-bottom: 10px;
}
.ncbc-numbered-item p {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    color: rgba(11, 23, 38, 0.72);
}

/* Verse Quote */
.verse-card.wp-block-ncbc-verse-quote {
    margin: 32px 0;
    padding: 0 0 0 28px;
    border-left: 3px solid var(--gold, #b88a52);
    background: transparent;
}
.verse-card.wp-block-ncbc-verse-quote.ncbc-align-center {
    border-left: none;
    padding-left: 0;
    text-align: center;
    max-width: 720px;
    margin: 32px auto;
}
.verse-card.wp-block-ncbc-verse-quote .quote {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(22px, 2.5vw, 30px);
    line-height: 1.45;
    color: var(--ink, #0b1726);
    margin: 0 0 10px;
}
.verse-card.wp-block-ncbc-verse-quote .ref {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold, #b88a52);
    font-style: normal;
}

/* Icon Card link overlay (for clickable icon cards) */
.learn-card.wp-block-ncbc-icon-card {
    position: relative;
}
.ncbc-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    text-indent: -9999px;
    overflow: hidden;
}
.ncbc-card-link[href=""] { pointer-events: none; }

/* Icon Card Grid responsive columns */
.learn-grid.ncbc-cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.learn-grid.ncbc-cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.learn-grid.ncbc-cols-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Aside Card — three colour variants */
.scope-card.wp-block-ncbc-aside-card.ncbc-aside-navy  { background: var(--navy, #1e3a5f); color: #fff; }
.scope-card.wp-block-ncbc-aside-card.ncbc-aside-light { background: #fff; color: var(--ink, #0b1726); border: 1px solid rgba(11,23,38,0.08); }
.scope-card.wp-block-ncbc-aside-card.ncbc-aside-gold  { background: var(--gold, #b88a52); color: #fff; }

/* Raw Design HTML — defaults to 1400px container; alignfull breaks out */
.ncbc-page-blocks .entry-content > .wp-block-ncbc-raw-design-html {
    max-width: 1400px;
}
.ncbc-page-blocks .entry-content > .wp-block-ncbc-raw-design-html.alignfull {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}
.ncbc-page-blocks .entry-content > .wp-block-ncbc-raw-design-html.alignwide {
    max-width: 1600px;
}

/* Dynamic blocks that render their OWN full-bleed sections (with .featured-wrap,
 * .archive, .groups, etc. that have their own internal containers) must NOT be
 * constrained by the .entry-content > * container. */
.ncbc-page-blocks .entry-content > .ncbc-block-bulletin-archive,
.ncbc-page-blocks .entry-content > .ncbc-block-bs-grid,
.ncbc-page-blocks .entry-content > .ncbc-block-latest-sermons,
.ncbc-page-blocks .entry-content > .ncbc-block-sermon-archive,
.ncbc-page-blocks .entry-content > .ncbc-block-upcoming-events,
.ncbc-page-blocks .entry-content > .sermons,
.ncbc-page-blocks .entry-content > .events,
.ncbc-page-blocks .entry-content > .groups {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.ncbc-page-blocks .entry-content > .ncbc-block-bulletin-archive > .container,
.ncbc-page-blocks .entry-content > .ncbc-block-bs-grid > .container,
.ncbc-page-blocks .entry-content > .ncbc-block-latest-sermons > .container,
.ncbc-page-blocks .entry-content > .ncbc-block-sermon-archive > .container,
.ncbc-page-blocks .entry-content > .ncbc-block-upcoming-events > .container,
.ncbc-page-blocks .entry-content > .sermons > .container,
.ncbc-page-blocks .entry-content > .events > .container,
.ncbc-page-blocks .entry-content > .groups > .container {
    padding-left: 24px;
    padding-right: 24px;
}

/* ─────────────────────────────────────────────
 *   Fullscreen video popup (sermon preview)
 *   ─────────────────────────────────────────── */
.ncbc-video-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 24px;
}
.ncbc-video-modal.is-open { display: flex; }
.ncbc-video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 23, 38, 0.92);
    backdrop-filter: blur(8px);
    cursor: zoom-out;
}
.ncbc-video-modal-frame {
    position: relative;
    width: 100%;
    max-width: 1400px;
    /* Never taller than the viewport. Account for the close button (~48px)
     * above the frame plus the modal's own 24px top/bottom padding. */
    max-height: calc(100vh - 96px);
    z-index: 1;
}
.ncbc-video-modal-iframe-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    /* When 16:9 height would exceed the frame, cap height and let width
     * shrink to match (keeps the whole video on screen, no overflow). */
    max-height: calc(100vh - 96px);
    max-width: calc((100vh - 96px) * 16 / 9);
    margin: 0 auto;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.ncbc-video-modal-iframe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.ncbc-video-modal-close {
    position: absolute;
    top: -48px;
    right: 0;
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    line-height: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.ncbc-video-modal-close:hover { opacity: 1; }
@media (max-width: 768px) {
    .ncbc-video-modal { padding: 60px 12px 12px; }
    .ncbc-video-modal-close { top: -44px; }
}

/* Make the .play-btn inside .sermon-video reliably clickable as a real <button> */
.sermon-video .play-btn.ncbc-video-trigger {
    background: rgba(255, 255, 255, 0.95);
    border: 0;
    cursor: pointer;
    color: var(--navy, #1e3a5f);
}

/* ===========================================================
 *  Featured sermon block (latest-sermons-by-language §01)
 *  Shared so it works on BOTH home and sermons pages.
 *  (Mirrors the rules in page-home.css.)
 * =========================================================== */
  .sermon-feature {
    display: grid; grid-template-columns: 1.1fr 1fr;
    gap: 48px;
    margin-bottom: 40px;
  }
  .sermon-video {
    position: relative; aspect-ratio: 16/10; border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-2);
    background-color: var(--navy);
    background-size: cover;
    background-position: center;
    cursor: pointer;
  }
  .sermon-video::before {
    /* Dark overlay so white text on top of the photo stays readable. */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(11,23,38,0.35), rgba(11,23,38,0.65));
    z-index: 1;
  }
  .sermon-video .play-btn,
  .sermon-video .meta { position: absolute; z-index: 2; }
  .play-btn {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 84px; height: 84px; border-radius: 50%;
    background: rgba(255,255,255,0.95);
    display: grid; place-items: center;
    color: var(--navy);
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    transition: transform 0.3s, background 0.3s;
  }
  .sermon-video:hover .play-btn { transform: translate(-50%, -50%) scale(1.08); background: var(--gold); color: white; }
  .play-btn::after {
    content: ""; position: absolute; inset: -8px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.4);
    animation: pingRing 2.4s ease-out infinite;
  }
  @keyframes pingRing { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
  .play-btn svg { width: 26px; height: 26px; margin-left: 4px; }
  .sermon-video .meta {
    position: absolute; left: 24px; bottom: 24px; right: 24px;
    color: white; display: flex; justify-content: space-between; align-items: flex-end;
  }
  .sermon-video .meta .date { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; opacity: 0.85; padding: 6px 10px; background: rgba(0,0,0,0.4); backdrop-filter: blur(10px); border-radius: 6px; }
  .sermon-video .duration { font-family: var(--mono); font-size: 11px; padding: 6px 10px; background: rgba(0,0,0,0.4); backdrop-filter: blur(10px); border-radius: 6px; letter-spacing: 0.1em; }

  .sermon-text { padding: 8px 0; display: flex; flex-direction: column; justify-content: center; }
  .sermon-text .series-labels {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px;
  }
  .sermon-text .series-label {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
    background: rgba(212,165,116,0.15); color: var(--gold-deep);
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
    border-radius: 6px; text-transform: uppercase;
    width: max-content;
  }
  .sermon-text h3 {
    font-size: 38px; font-weight: 700; line-height: 1.15;
    letter-spacing: -0.01em; margin-bottom: 16px;
  }
  .sermon-text .verse {
    font-family: var(--serif); font-style: italic;
    font-size: 19px; line-height: 1.6; color: rgba(11,23,38,0.7);
    border-left: 2px solid var(--gold); padding-left: 18px;
    margin-bottom: 24px;
  }
  .sermon-text .speaker { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
  .sermon-text .avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: linear-gradient(135deg, var(--sky), var(--navy));
    display: grid; place-items: center; color: white;
    font-weight: 600; font-size: 14px;
  }
  .sermon-text .speaker-info { font-size: 13.5px; line-height: 1.4; }
  .sermon-text .speaker-info b { font-weight: 600; }
  .sermon-text .speaker-info span { display: block; font-family: var(--mono); font-size: 11px; opacity: 0.6; letter-spacing: 0.1em; margin-top: 2px; }

  .sermon-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .sermon-item {
    background: white; border-radius: 16px;
    border: 1px solid var(--line);
    overflow: hidden;
    box-shadow: var(--shadow-1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: grid; grid-template-columns: 220px 1fr;
  }
  .sermon-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
  .sermon-item-img {
    aspect-ratio: auto; background-size: cover; background-position: center;
    position: relative; min-height: 100%;
  }
  .sermon-item-img::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.5));
  }
  .sermon-item-body { padding: 26px 28px; display: flex; flex-direction: column; justify-content: center; }
  .sermon-item-body .date { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; opacity: 0.6; text-transform: uppercase; margin-bottom: 10px; }
  .sermon-item-body h4 { font-size: 22px; line-height: 1.3; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }
  .sermon-item-body p { font-size: 13px; opacity: 0.65; line-height: 1.55; display: flex; align-items: flex-start; gap: 6px; }
  .sermon-item-body p svg { width: 13px; height: 13px; margin-top: 3px; flex-shrink: 0; opacity: 0.7; }

/* Featured sermon — mobile */
@media (max-width: 768px) {
    .sermon-feature { grid-template-columns: 1fr; gap: 36px; }
    .sermon-text h3 { font-size: 26px; }
    .sermon-text .verse { font-size: 16px; }
    .sermon-text .series-labels { margin-bottom: 18px; }
    .play-btn { width: 64px; height: 64px; }
    .play-btn svg { width: 20px; height: 20px; }
}

/* ===========================================================
 *  Learning §03 — Library imprint popup
 *  The 4 racks (story/life/tract/garden) are hidden inline and
 *  shown inside a modal when an imprint card is clicked.
 * =========================================================== */
.ncbc-rack-hidden { display: none !important; }

.ncbc-lib-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 48px 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-y: auto;
}
.ncbc-lib-modal.is-open { display: flex; }
.ncbc-lib-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 23, 38, 0.92);
    backdrop-filter: blur(8px);
    cursor: zoom-out;
}
.ncbc-lib-modal-frame {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 1;
}
.ncbc-lib-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 2;
}
.ncbc-lib-modal-close:hover { background: rgba(255, 255, 255, 0.24); }
/* Each rack keeps its own background / radius / padding (it was designed as a
 * self-contained card). Just neutralise the full-bleed alignment + outer margin
 * so it sits cleanly inside the modal frame, and guarantee inner padding. */
.ncbc-lib-modal-body > section {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 44px 40px !important;
    border-radius: 18px !important;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .ncbc-lib-modal-body > section { padding: 28px 20px !important; }
}
/* Force any reveal-animation elements visible inside the modal (the originals
 * are display:none on the page so IntersectionObserver never fires for them). */
.ncbc-lib-modal-body .reveal,
.ncbc-lib-modal-body > section.reveal {
    opacity: 1 !important;
    transform: none !important;
}
@media (max-width: 768px) {
    .ncbc-lib-modal { padding: 16px 0; padding-left: 0 !important; padding-right: 0 !important; }
    .ncbc-lib-modal-frame { padding: 52px 18px 28px; border-radius: 14px; }
}
