/* Fenix CMS public-render component styles
 * CSS-VARS-MIGRATION sub-plan
 *
 * Every component renderer emits a stable BEM hook on its outermost wrapper
 * (BEM-HOOKS rule). This file styles those hooks using CSS variables emitted
 * by the active theme adapter (THEME-TOKENS rule).
 *
 * Rules followed:
 *   - No hardcoded hex colors — all colour comes from var(--fenix-color-*)
 *   - No hardcoded font names — typography uses var(--fenix-font-*)
 *   - Bounded utility vocabulary (TAILWIND-VOCAB rule); replaces forbidden
 *     text-slate-{N} / bg-slate-{N} / etc. emitted by legacy renderers.
 */

/* ── Fallback theme tokens (used when no adapter sets them) ────
   Defaults are emitted on :root so they're inherited by every element.

   2026-05-15 — these are wrapped in `:where(:root)` (ZERO specificity) on
   purpose. The theme override block `<style id="fenix-theme-vars">:root{…}`
   is emitted in <head>, but this stylesheet is injected later in <body> —
   so a plain `:root{…}` here would WIN the cascade by source order and
   silently override the admin's per-page theme pick (e.g. an Ocean page
   rendered Rose). `:where(:root)` has zero specificity, so the theme
   block's normal-specificity `:root` rule always beats it regardless of
   load order; these values only apply when nothing else sets the token.

   NEVER write `--x: var(--x, default)` here — that's a circular reference
   (CSS spec: invalid → IACVT → empty), so `var(--x)` at the use site
   falls through to nothing instead of the default. */
:where(:root) {
    --fenix-color-primary: #db2777;
    --fenix-color-primary-hover: #be185d;
    --fenix-color-text: #1e293b;
    --fenix-color-text-muted: #64748b;
    --fenix-color-text-subtle: #94a3b8;
    --fenix-color-surface: #ffffff;
    --fenix-color-surface-alt: #f8fafc;
    --fenix-color-surface-dark: #1e293b;
    --fenix-color-border: #e2e8f0;
    --fenix-color-border-soft: #f1f5f9;
    --fenix-color-accent: #9d174d;

    --fenix-color-success-bg: #ecfdf5;
    --fenix-color-success-border: #6ee7b7;
    --fenix-color-success-text: #065f46;
    --fenix-color-warn-bg: #fffbeb;
    --fenix-color-warn-border: #fcd34d;
    --fenix-color-warn-text: #92400e;
    --fenix-color-danger-bg: #fef2f2;
    --fenix-color-danger-border: #fca5a5;
    --fenix-color-danger-text: #991b1b;
    --fenix-color-info-bg: #eff6ff;
    --fenix-color-info-border: #93c5fd;
    --fenix-color-info-text: #1e3a8a;

    --fenix-radius-button: 8px;
    --fenix-radius-card: 12px;
    --fenix-radius-lg: 20px;
}

/* ── Generic BEM-text classes that replace text-slate-* utilities ── */
.fenix-text-muted { color: var(--fenix-color-text-muted); }
.fenix-text-subtle { color: var(--fenix-color-text-subtle); }
.fenix-text-default { color: var(--fenix-color-text); }
.fenix-bg-surface { background: var(--fenix-color-surface); }
.fenix-bg-surface-alt { background: var(--fenix-color-surface-alt); }
.fenix-bg-surface-dark { background: var(--fenix-color-surface-dark); color: var(--fenix-color-surface); }
.fenix-border-default { border-color: var(--fenix-color-border); }
.fenix-hover-surface-alt:hover { background: var(--fenix-color-surface-alt); }

/* ── Backwards-compat overrides (CSS-VARS-MIGRATION) ──────────
 * Snapshots persisted before the renderer migration may still contain
 * forbidden Tailwind utilities (text-slate-{N}, bg-slate-{N}, etc.).
 * Map them to CSS-var equivalents so theme swap still works on legacy data.
 * Once a page is re-saved, the renderer emits the BEM-hook classes above
 * and these overrides become inactive. */
.fenix-page-body .text-slate-800,
.fenix-page-body .text-slate-700 { color: var(--fenix-color-text); }
.fenix-page-body .text-slate-600,
.fenix-page-body .text-slate-500 { color: var(--fenix-color-text-muted); }
.fenix-page-body .text-slate-400,
.fenix-page-body .text-slate-300 { color: var(--fenix-color-text-subtle); }
/* !important required: a globally-loaded GVTheme bundle (/css/gpo35_*.styles.css)
   ships an `!important`-stamped `.bg-slate-50 { background-color:#253347 !important }`
   admin-area override that bleeds into the public Fenix render. Without !important
   here, our scoped override loses to it regardless of specificity. */
.fenix-page-body .bg-slate-50,
.fenix-page-body .bg-slate-100,
.fenix-page-body .bg-slate-200 { background-color: var(--fenix-color-surface-alt) !important; }
.fenix-page-body .bg-slate-900 { background-color: var(--fenix-color-surface-dark); color: var(--fenix-color-surface); }
.fenix-page-body .border-slate-200,
.fenix-page-body .border-slate-300 { border-color: var(--fenix-color-border); }

/* ── BEM hooks for individual components ─────────────────────── */

.fenix-section--muted { background: var(--fenix-color-surface-alt); }
.fenix-section--dark { background: var(--fenix-color-surface-dark); color: var(--fenix-color-surface); }

.fenix-icon-card p,
.fenix-icon-card-numbered p {
    color: var(--fenix-color-text-muted);
}

.fenix-faq summary { cursor: pointer; }
.fenix-faq summary:hover { background: var(--fenix-color-surface-alt); }
.fenix-faq__answer { color: var(--fenix-color-text-muted); }

.fenix-breadcrumb { color: var(--fenix-color-text-muted); font-size: 0.875rem; }
.fenix-breadcrumb__sep { color: var(--fenix-color-text-subtle); }
.fenix-breadcrumb__current { color: var(--fenix-color-text); font-weight: 500; }

/* 2026-07-01 — Align the breadcrumb rail to the HEADER rail so the breadcrumb
   starts at the same left X as the logo (and body content). The partials hardcode
   `max-w-6xl px-8` (1152px + 32px), but the header row (.fenix-header__row) is
   1280px + 24px — so the breadcrumb sat ~72px too far right. Force the inner
   container to the header's exact rail. Theme-agnostic: every header profile uses
   the same 1280/24 row, so this one rule fixes all of them. !important beats the
   Tailwind utility classes on the same element. */
.fenix-breadcrumb > .max-w-6xl,
.fenix-breadcrumb > div {
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    box-sizing: border-box;
}

.fenix-video__shell { background: var(--fenix-color-surface-alt); }

.fenix-image__caption { color: var(--fenix-color-text-subtle); }

.fenix-features__item p { color: var(--fenix-color-text-muted); }

.fenix-quote__text { color: var(--fenix-color-text); font-style: italic; }
.fenix-quote__attribution { color: var(--fenix-color-text-subtle); }

.fenix-testimonial__avatar-placeholder { background: var(--fenix-color-border-soft); }
.fenix-testimonial__quote { color: var(--fenix-color-text); font-style: italic; }
.fenix-testimonial__role { color: var(--fenix-color-text-subtle); }

.fenix-placeholder {
    border: 2px dashed var(--fenix-color-border);
    background: var(--fenix-color-surface-alt);
    border-radius: var(--fenix-radius-card);
    padding: 1.5rem;
    margin: 1rem 0;
}
.fenix-placeholder__label { color: var(--fenix-color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.75rem; }
.fenix-placeholder__note { color: var(--fenix-color-text-muted); font-size: 0.875rem; }
.fenix-placeholder__data { color: var(--fenix-color-text); }

.fenix-alert {
    border-radius: var(--fenix-radius-card);
    border: 1px solid;
    padding: 12px 16px;
    margin: 1rem 0;
}
.fenix-alert--info { background: var(--fenix-color-info-bg); border-color: var(--fenix-color-info-border); color: var(--fenix-color-info-text); }
.fenix-alert--success { background: var(--fenix-color-success-bg); border-color: var(--fenix-color-success-border); color: var(--fenix-color-success-text); }
.fenix-alert--warning { background: var(--fenix-color-warn-bg); border-color: var(--fenix-color-warn-border); color: var(--fenix-color-warn-text); }
.fenix-alert--error { background: var(--fenix-color-danger-bg); border-color: var(--fenix-color-danger-border); color: var(--fenix-color-danger-text); }

/* ────────────────────────────────────────────────────────────────────
   Hero slider (Swiper) — PUBLIC render.
   The builder (page-builder.html) carries these rules inline; the public
   page never loaded them, so a saved hero-slider section had no height
   and stayed blank. Ported here (builder-only bits — edit panel, slider
   tabs — intentionally dropped). Pair with the lazy Swiper loader in
   fenix-page.js.
   ──────────────────────────────────────────────────────────────────── */
.hero-slider-section {
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}
/* Section wrapper must not add space around the slider */
.builder-section:has(.hero-slider-section),
[data-section-id]:has(.hero-slider-section),
.component-wrapper:has(.hero-slider-section) {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}
.hero-slider-section .swiper {
    position: relative;
    width: 100%;
    height: 90vh !important;
    min-height: 600px;
    max-height: 900px;
    overflow: hidden;
}
.hero-slider-section .swiper-wrapper { height: 100% !important; }
.hero-slider-section .swiper-slide   { height: 100% !important; overflow: hidden; }
.hero-slider-section .swiper-slide .slide-media-container,
.hero-slider-section .swiper-slide .slide-image,
.hero-slider-section .swiper-slide .slide-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Fade effect */
.hero-slider-section .swiper-fade .swiper-slide {
    pointer-events: none;
    transition-property: opacity;
}
.hero-slider-section .swiper-fade .swiper-slide-active { pointer-events: auto; }
.hero-slider-section .swiper-fade .swiper-slide:not(.swiper-slide-active) { visibility: hidden !important; }
.hero-slider-section .swiper-fade .swiper-slide-active { visibility: visible !important; }
/* Pagination */
.hero-slider-section .swiper-pagination,
.heroSwiper .swiper-pagination {
    position: absolute !important;
    bottom: 30px !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 10;
    text-align: center;
}
.hero-slider-section .swiper-pagination-bullet,
.heroSwiper .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
}
.hero-slider-section .swiper-pagination-bullet-active,
.heroSwiper .swiper-pagination-bullet-active {
    background: #ec4899 !important;
}
/* Navigation arrows */
.hero-slider-section .swiper-button-next,
.hero-slider-section .swiper-button-prev { color: #fff !important; }
/* Media-type toggle (image vs video) */
.hero-slider-section .swiper-slide[data-slide-media-type="video"] .slide-image { display: none !important; }
.hero-slider-section .swiper-slide[data-slide-media-type="video"] .slide-video { display: block !important; }
.hero-slider-section .swiper-slide[data-slide-media-type="image"] .slide-image { display: block !important; }
.hero-slider-section .swiper-slide[data-slide-media-type="image"] .slide-video { display: none !important; }
/* Before Swiper inits: show the first slide so the section is never blank
   even if the CDN is slow/blocked. Swiper overrides opacity once active. */
.hero-slider-section .swiper:not(.swiper-initialized) .swiper-slide { opacity: 0; }
.hero-slider-section .swiper:not(.swiper-initialized) .swiper-slide:first-child { opacity: 1; }
