/* ===================================================================
   CMS DYNAMIC BLOCKS — structure layer
   -------------------------------------------------------------------
   Layout skeleton for the faq / testimonials / feature_grid / gallery /
   countdown block types, plus the lightbox overlay and carousel controls
   that assets/js/cms-dynamic.js builds. Follows the app.css / premium.css
   split: this file is STRUCTURE (grid, snap, spacing, hit targets);
   surface, light and motion polish belong to premium.css.

   Colour/border/radius come from whichever theme is live: the dark app
   theme defines --knms-* at :root (app.css), the UnityHub light theme
   defines --nuh-* (includes/nuh-theme.php). Every var() therefore chains
   --nuh-* → --knms-* → literal, so the blocks read correctly under both.
   =================================================================== */

/* ---------------- FAQ accordion ---------------- */
.cms-faq-item {
    border: 1px solid var(--nuh-line, var(--knms-border, rgba(128, 128, 128, 0.25)));
    border-radius: var(--nuh-radius, var(--radius-sm, 8px));
    margin-bottom: 0.6rem;
    overflow: hidden;
}
.cms-faq-item:last-child { margin-bottom: 0; }
.cms-faq-question {
    display: block;
    position: relative;
    min-height: 44px;
    padding: 0.75rem 2.6rem 0.75rem 1rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}
.cms-faq-question::-webkit-details-marker { display: none; }
/* Chevron drawn with borders so no extra markup or icon is needed. */
.cms-faq-question::after {
    content: '';
    position: absolute;
    right: 1.1rem;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.2s ease;
}
.cms-faq-item[open] > .cms-faq-question::after { transform: translateY(-30%) rotate(225deg); }
.cms-faq-answer {
    padding: 0 1rem 0.9rem;
    line-height: 1.6;
    color: var(--nuh-ink-muted, var(--knms-muted, inherit));
}
.cms-faq-answer p { margin: 0; }

/* ---------------- Testimonials carousel ---------------- */
/* The scroll container does the layout; scroll-snap does the motion.
   JS only adds arrows and dots, so the carousel works untouched without it. */
.cms-testimonials {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-bottom: 0.4rem; /* keeps a native scrollbar off the cards */
    scrollbar-width: thin;
}
.cms-testimonial {
    flex: 0 0 min(88%, 30rem);
    scroll-snap-align: center;
    margin: 0;
    padding: 1.2rem 1.3rem;
    border: 1px solid var(--nuh-line, var(--knms-border, rgba(128, 128, 128, 0.25)));
    border-radius: var(--nuh-radius, var(--radius, 12px));
    background: var(--nuh-card, var(--knms-surface, transparent));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.cms-testimonial blockquote {
    margin: 0;
    font-style: italic;
    line-height: 1.6;
}
.cms-testimonial figcaption {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.cms-testimonial-name { font-weight: 700; }
.cms-testimonial-role {
    font-size: 0.8rem;
    color: var(--nuh-ink-muted, var(--knms-muted, inherit));
}

/* Carousel controls — JS wraps the scroller in .cms-carousel-shell and
   appends the buttons/dots. Without JS the shell never exists. */
.cms-carousel-shell { position: relative; }
.cms-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--nuh-line, var(--knms-border, rgba(128, 128, 128, 0.3)));
    background: var(--nuh-card, var(--knms-surface, rgba(0, 0, 0, 0.55)));
    color: inherit;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.2s ease;
}
.cms-carousel-btn--prev { left: -0.4rem; }
.cms-carousel-btn--next { right: -0.4rem; }
.cms-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.2rem;
    margin-top: 0.35rem;
}
.cms-carousel-dot {
    /* 44px hit target around a small visual dot, drawn via a pseudo. */
    width: 44px;
    height: 44px;
    max-width: 2rem; /* dots may sit closer than 44px; height keeps the target */
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
}
.cms-carousel-dot::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nuh-ink-muted, var(--knms-muted, #999));
    opacity: 0.45;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.cms-carousel-dot.is-active::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.35);
    background: var(--nuh-orange, var(--knms-accent, currentColor));
}
/* Everything fits — no motion possible, so no controls. */
.cms-carousel-shell.cms-carousel-static .cms-carousel-btn,
.cms-carousel-shell.cms-carousel-static .cms-carousel-dots { display: none; }

/* ---------------- Feature grid ---------------- */
.cms-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.cms-feature {
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--nuh-line, var(--knms-border, rgba(128, 128, 128, 0.25)));
    border-radius: var(--nuh-radius, var(--radius, 12px));
    background: var(--nuh-card, var(--knms-surface, transparent));
}
.cms-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-bottom: 0.6rem;
    border-radius: var(--nuh-btn-radius, var(--radius-sm, 8px));
    border: 1px solid var(--nuh-line, var(--knms-border, rgba(128, 128, 128, 0.25)));
    color: var(--nuh-orange, var(--knms-accent, currentColor));
}
.cms-feature-icon .icon { width: 22px; height: 22px; }
.cms-feature-title { display: block; margin-bottom: 0.25rem; }
.cms-feature-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--nuh-ink-muted, var(--knms-muted, inherit));
}

/* ---------------- Gallery (grid + strip) ---------------- */
.cms-gallery--grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.7rem;
}
.cms-gallery--strip {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: thin;
}
.cms-gallery--strip .cms-gallery-item {
    flex: 0 0 min(70%, 300px);
    scroll-snap-align: start;
}
.cms-gallery-item {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--nuh-radius, var(--radius-sm, 8px));
    overflow: hidden; /* required: cms_crop_style() zoom scales the img */
    border: 1px solid var(--nuh-line, var(--knms-border, rgba(128, 128, 128, 0.25)));
}
.cms-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------------- Countdown ---------------- */
.cms-countdown-label {
    margin: 0 0 0.4rem;
    font-weight: 600;
}
.cms-countdown-timer {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.55rem;
    font-variant-numeric: tabular-nums;
}
.cms-countdown-unit { display: inline-flex; align-items: baseline; gap: 0.15rem; }
.cms-countdown-num {
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1;
    font-style: normal;
}
.cms-countdown-sfx {
    font-size: 0.8rem;
    color: var(--nuh-ink-muted, var(--knms-muted, inherit));
}
.cms-countdown-note {
    margin: 0;
    color: var(--nuh-ink-muted, var(--knms-muted, inherit));
}

/* ---------------- Lightbox overlay (built by cms-dynamic.js) ---------------- */
.cms-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cms-lightbox[hidden] { display: none; }
.cms-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 4, 20, 0.86);
    cursor: pointer;
}
.cms-lightbox-dialog {
    position: relative;
    max-width: min(92vw, 1000px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    z-index: 1;
}
.cms-lightbox-img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: var(--nuh-radius, var(--radius-sm, 8px));
    display: block;
}
.cms-lightbox-caption {
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    min-height: 1.2em;
}
.cms-lightbox-close,
.cms-lightbox-nav {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s ease;
}
.cms-lightbox-close { top: 0.5rem; right: 0.5rem; position: fixed; }
.cms-lightbox-nav--prev { left: 0.5rem; top: 50%; transform: translateY(-50%); position: fixed; }
.cms-lightbox-nav--next { right: 0.5rem; top: 50%; transform: translateY(-50%); position: fixed; }
.cms-lightbox-close:hover,
.cms-lightbox-nav:hover { background: rgba(0, 0, 0, 0.75); }
.cms-lightbox.cms-lightbox--single .cms-lightbox-nav { display: none; }

/* ---------------- Reduced motion ----------------
   Kill every transition and smooth-scroll this sheet introduces. */
@media (prefers-reduced-motion: reduce) {
    .cms-faq-question::after,
    .cms-carousel-btn,
    .cms-carousel-dot::after,
    .cms-lightbox-close,
    .cms-lightbox-nav { transition: none; }
    .cms-testimonials { scroll-behavior: auto; }
}
