/*
 * Hero module — real slider stylesheet.
 *
 * Served through the `module.asset` route, never published to public/. Every
 * selector is namespaced `.cms-module-hero-*` so the module cannot leak
 * styles into Core, the Admin shell, a theme or another module.
 *
 * A single slide (no `data-cms-hero-slider` on the root) renders identically
 * to before — this file only adds slide-stacking/transition rules that
 * activate once 2+ slides exist, so nothing here can break an existing
 * single-slide install.
 */

.cms-module-hero-root {
    position: relative;
    display: block;
    overflow: hidden;
}

.cms-module-hero-height-small { min-height: 22rem; }
.cms-module-hero-height-medium { min-height: 32rem; }
.cms-module-hero-height-large { min-height: 42rem; }
.cms-module-hero-height-fullscreen { min-height: 100vh; }

.cms-module-hero-inner {
    position: relative;
    height: 100%;
    min-height: inherit;
}

.cms-module-hero-track {
    position: relative;
    height: 100%;
    min-height: inherit;
}

.cms-module-hero-slide {
    position: relative;
    display: flex;
    align-items: center;
    min-height: inherit;
    padding-block: 4rem;
    padding-inline: 1.5rem;
}

/* Slides only stack absolutely once the JS carousel is actually driving
   them (`[data-slide-index]` is only rendered when 2+ slides exist) — a
   single-slide hero keeps normal document flow, exactly as before.
   Real-Chrome QA found a genuine specificity bug: a theme's own cosmetic
   `.cms-theme-corporateNN .cms-module-hero-slide { position: relative }`
   rule (Phase 37) has the SAME specificity as the plain rule below, so
   whichever stylesheet loaded last silently won the carousel's actual
   stacking behaviour — on some themes leaving every inactive slide in
   normal document flow (invisible via opacity/visibility, but still
   taking up its own full slide-height of vertical space, and a scaled
   background image inside it still able to overflow horizontally). The
   `[data-cms-hero-slider]` ancestor-scoped selector below is deliberately
   MORE specific than any plausible per-theme override, so the carousel's
   structural mechanics can never lose that tie regardless of CSS load
   order — a theme may still restyle colour/spacing/typography freely. */
[data-cms-hero-slider] .cms-module-hero-slide[data-slide-index] {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 700ms ease, visibility 0s linear 700ms;
}

[data-cms-hero-slider] .cms-module-hero-slide[data-slide-index][data-active='true'] {
    position: relative;
    opacity: 1;
    visibility: visible;
    transition: opacity 700ms ease;
}

.cms-module-hero-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    transform: scale(1.04);
    transition: transform 6000ms linear;
}

.cms-module-hero-slide[data-active='true'] .cms-module-hero-background {
    transform: scale(1.12);
}

.cms-module-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0.35) 45%, rgba(15, 23, 42, 0.7) 100%);
}

.cms-module-hero-content {
    position: relative;
    z-index: 2;
    max-width: 42rem;
    color: #fff;
}

.cms-module-hero-slide[data-align='center'] .cms-module-hero-content {
    margin-inline: auto;
    text-align: center;
}

.cms-module-hero-slide[data-align='right'] .cms-module-hero-content {
    margin-inline-start: auto;
    text-align: right;
}

.cms-module-hero-eyebrow {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.9;
}

.cms-module-hero-title {
    margin: 0 0 1rem;
    font-size: clamp(1.9rem, 4vw, 3.25rem);
    line-height: 1.1;
    font-weight: 700;
}

.cms-module-hero-subtitle {
    margin: 0 0 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
    opacity: 0.92;
    max-width: 36rem;
}

.cms-module-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cms-module-hero-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border: 1px solid currentColor;
    border-radius: var(--cms-fe-radius-sm, 0.4rem);
    font-weight: 600;
}

.cms-module-hero-button-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--cms-fe-radius-sm, 0.4rem);
    color: #fff;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
}

.cms-module-hero-empty {
    opacity: 0.6;
    font-style: italic;
    padding-block: 4rem;
    text-align: center;
}

/* ---------------------------------------------------------------- */
/* Arrows / dots / progress — only rendered with 2+ slides            */
/* ---------------------------------------------------------------- */
.cms-module-hero-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.3);
    color: #fff;
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease;
}

.cms-module-hero-arrow:hover,
.cms-module-hero-arrow:focus-visible {
    background: rgba(15, 23, 42, 0.6);
}

.cms-module-hero-arrow-prev { inset-inline-start: 1.25rem; }
.cms-module-hero-arrow-next { inset-inline-end: 1.25rem; }

.cms-module-hero-arrow-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.cms-module-hero-arrow-icon-prev {
    transform: rotate(180deg);
}

.cms-module-hero-dots {
    position: absolute;
    inset-inline: 0;
    bottom: 1.5rem;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.cms-module-hero-dot {
    width: 0.55rem;
    height: 0.55rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    transition: background 200ms ease, width 200ms ease;
}

.cms-module-hero-dot[data-active='true'] {
    background: #fff;
    width: 1.5rem;
    border-radius: 999px;
}

.cms-module-hero-progress {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    z-index: 3;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
}

.cms-module-hero-progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    background: #fff;
}

.cms-module-hero-progress-bar[data-running='true'] {
    transition: width linear;
}

@media (max-width: 640px) {
    .cms-module-hero-arrow {
        width: 2.25rem;
        height: 2.25rem;
    }

    .cms-module-hero-arrow-prev { inset-inline-start: 0.5rem; }
    .cms-module-hero-arrow-next { inset-inline-end: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cms-module-hero-background,
    .cms-module-hero-slide[data-active='true'] .cms-module-hero-background {
        transition: none;
        transform: none;
    }

    .cms-module-hero-slide[data-slide-index] {
        transition: opacity 1ms linear, visibility 0s linear 1ms;
    }

    .cms-module-hero-progress-bar[data-running='true'] {
        transition: none;
    }
}
