/* ===================================
 * HERO SECTION STYLES
 * Data-attribute architecture
 *
 * All visual values come from the schema via the template.
 * The template sets CSS custom properties on elements:
 * - --section-bg: Section background color
 * - --heading-color: Heading text color
 * - --body-color: Body text color
 * - --accent-color: Accent color for buttons/links
 * - --card-bg: Card/placeholder background color
 * - --card-border: Border color for cards/placeholders
 * - --spacing-*: Spacing values
 * - --corner-*: Border radius values
 * - --elevation-*: Box shadow values
 * - --anim-*: Animation duration values
 * =================================== */

/* ==========================================================================
   BASE HERO SECTION
   ========================================================================== */

[data-section="hero"] {
    position: relative;
    overflow: hidden;
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    width: 100%;
    background-color: var(--section-bg);
    color: var(--body-color);
}

/* Height variants
   Schema uses: auto, fullscreen, half, custom
   Also support legacy: viewport
   ------------------------------------------ */
/* Fullscreen height (schema: fullscreen, legacy: viewport) */
[data-section="hero"][data-height="fullscreen"],
[data-section="hero"][data-height="viewport"] {
    min-height: 100vh;
}

/* Half viewport height */
[data-section="hero"][data-height="half"] {
    min-height: 50vh;
}

/* Auto height - content determines size */
[data-section="hero"][data-height="auto"] {
    min-height: auto;
}

/* Custom height - uses CSS variable set via inline style */
[data-section="hero"][data-height="custom"] {
    min-height: var(--hero-custom-height);
}

/* Parallax-enabled section — JS handles translate3d on the background */

/* Hero video fallback image sits alongside the <video> element. Hidden by
   default so the <video> drives the visual; the reduced-motion @media
   block below swaps which element is shown. */
[data-section="hero"] .hero-video-fallback {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   PARALLAX BACKGROUND — performance hints
   Base styles for [data-bg-image] / [data-bg-video] come from base.css.
   ========================================================================== */

[data-section="hero"][data-parallax="true"] [data-bg-image],
[data-section="hero"][data-parallax="true"] [data-bg-video] {
    will-change: transform, height;
    backface-visibility: hidden;
}

/* ==========================================================================
   CONTENT LAYER
   ========================================================================== */

[data-section="hero"] [data-content-wrapper] {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: var(--spacing-lg);
}

/* Alignment variants */
[data-section="hero"] [data-content-wrapper][data-text-align="left"][data-justify="left"] {
    align-items: flex-start;
    text-align: left;
}

[data-section="hero"] [data-content-wrapper][data-text-align="center"][data-justify="center"] {
    align-items: center;
    text-align: center;
}

[data-section="hero"] [data-content-wrapper][data-text-align="right"][data-justify="right"] {
    align-items: flex-end;
    text-align: right;
}

[data-section="hero"] [data-content] {
    max-width: 800px;
    width: 100%;
}

/* ==========================================================================
   TEXT ITEMS
   ========================================================================== */

[data-section="hero"] [data-text-item] {
    margin-bottom: var(--spacing-lg);
}

[data-section="hero"] [data-text-item] h1 {
    font-size: var(--h1-font-size);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: var(--text-item-color, var(--heading-color));
}

[data-section="hero"] [data-text-item] p {
    font-size: var(--text-2xl);
    line-height: var(--line-height-normal);
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: var(--text-item-color, var(--body-color));
}

/* ==========================================================================
   TEXT ROTATOR
   ========================================================================== */

[data-section="hero"] [data-text-rotator] {
    position: relative;
}

/* Pause rotation on hover/focus for accessibility */
[data-section="hero"] [data-text-rotator]:hover,
[data-section="hero"] [data-text-rotator]:focus-within {
    animation-play-state: paused;
}

[data-section="hero"] [data-text-rotator] [data-text-item] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(var(--spacing-sm));
    transition: opacity var(--anim-normal) ease-in-out,
                transform var(--anim-normal) ease-in-out;
}

[data-section="hero"] [data-text-rotator] [data-text-item]:first-child {
    position: relative;
    opacity: 1;
    transform: translateY(0);
}

/* Active state classes for JavaScript-controlled rotation */
[data-section="hero"] [data-text-rotator] [data-text-item][data-active="true"] {
    opacity: 1;
    transform: translateY(0);
}

[data-section="hero"] [data-text-rotator] [data-text-item][data-active="false"] {
    opacity: 0;
    transform: translateY(var(--spacing-sm));
}

/* ==========================================================================
   CTA BUTTON
   ========================================================================== */

[data-section="hero"] [data-content] a {
    display: inline-block;
    margin-top: var(--spacing-sm);
    min-height: 44px;
    padding: var(--spacing-sm) var(--spacing-md);
    text-decoration: none;
}

[data-section="hero"] [data-content] a:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

/* ==========================================================================
   SPLIT LAYOUT
   ========================================================================== */

[data-section="hero"][data-layout="split"] {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

[data-section="hero"] [data-split-container] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    max-width: 1200px;
    width: 100%;
    align-items: center;
}

[data-section="hero"] [data-split-media] {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-section="hero"] [data-split-media] img,
[data-section="hero"] [data-split-media] video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--corner-default);
}

[data-section="hero"] [data-media-placeholder] {
    width: 100%;
    height: 400px;
    background-color: var(--card-bg);
    border: 2px dashed var(--card-border);
    border-radius: var(--corner-default);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

[data-section="hero"] [data-media-placeholder] span {
    color: var(--body-color);
    opacity: 0.6;
}

[data-section="hero"] [data-split-content] {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--spacing-lg);
}

[data-section="hero"] [data-split-content] [data-content] {
    max-width: none;
}

[data-section="hero"] [data-split-content] [data-text-item] h1 {
    color: var(--text-item-color, var(--heading-color));
    font-size: var(--h2-font-size);
    text-shadow: none;
}

[data-section="hero"] [data-split-content] [data-text-item] p {
    color: var(--text-item-color, var(--body-color));
    font-size: var(--text-xl);
    text-shadow: none;
}

/* ==========================================================================
   ACCESSIBILITY - HIGH CONTRAST MODE
   ========================================================================== */

@media (prefers-contrast: high) {
    [data-section="hero"] [data-content] a {
        border: 2px solid currentColor;
    }

    [data-section="hero"] [data-text-item] h1,
    [data-section="hero"] [data-text-item] p {
        text-shadow: none !important;
    }
}

/* ==========================================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    [data-section="hero"] [data-text-rotator] [data-text-item] {
        transition: none !important;
        animation: none !important;
    }

    [data-section="hero"] [data-text-rotator] [data-text-item]:not(:first-child) {
        display: none;
    }

    [data-section="hero"] [data-bg-image],
    [data-section="hero"] [data-bg-video] {
        will-change: auto;
    }

    [data-section="hero"][data-parallax="true"] {
        perspective: none;
        transform-style: flat;
    }

    /* Reduced-motion users see the operator-supplied poster instead of the
       hero video. The <img.hero-video-fallback> sibling sits underneath
       every hero <video> element; here we hide the video and reveal the
       still image so the section keeps its visual intent without motion. */
    [data-section="hero"][data-auto-animate="true"] video {
        display: none;
    }
    [data-section="hero"][data-auto-animate="true"] .hero-video-fallback {
        display: block;
    }
}

/* ==========================================================================
   RESPONSIVE - 992px (Tablet Landscape)
   ========================================================================== */

@media (max-width: 1023px) {
    [data-section="hero"] [data-split-container] {
        gap: var(--spacing-lg);
    }

    [data-section="hero"] [data-split-media] {
        min-height: 350px;
    }

    [data-section="hero"] [data-text-item] h1 {
        font-size: var(--h1-font-size);
    }

    [data-section="hero"] [data-split-content] [data-text-item] h1 {
        font-size: var(--h2-font-size);
    }
}

/* ==========================================================================
   RESPONSIVE - 768px (Tablet Portrait)
   ========================================================================== */

@media (max-width: 599px) {
    [data-section="hero"] {
        min-height: 400px;
    }

    [data-section="hero"] [data-content-wrapper] {
        padding: var(--spacing-md);
    }

    [data-section="hero"] [data-text-item] h1 {
        font-size: var(--h2-font-size);
    }

    [data-section="hero"] [data-text-item] p {
        font-size: var(--text-lg);
    }

    /* Split layout stacks vertically */
    [data-section="hero"] [data-split-container] {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    [data-section="hero"] [data-split-media] {
        min-height: 300px;
    }

    [data-section="hero"] [data-split-content] {
        padding: var(--spacing-sm);
    }

    [data-section="hero"] [data-split-content] [data-text-item] h1 {
        font-size: var(--h3-font-size);
    }

    [data-section="hero"] [data-split-content] [data-text-item] p {
        font-size: var(--text-lg);
    }
}

/* ==========================================================================
   RESPONSIVE - 480px (Mobile)
   ========================================================================== */

@media (max-width: 480px) {
    [data-section="hero"] {
        min-height: 350px;
    }

    [data-section="hero"] [data-content-wrapper] {
        padding: var(--spacing-sm);
    }

    [data-section="hero"] [data-text-item] h1 {
        font-size: var(--h3-font-size);
    }

    [data-section="hero"] [data-text-item] p {
        font-size: var(--text-base);
    }

    [data-section="hero"][data-layout="split"] {
        padding: var(--spacing-sm);
    }

    [data-section="hero"] [data-split-media] {
        min-height: 250px;
    }

    [data-section="hero"] [data-media-placeholder] {
        height: 250px;
    }

    [data-section="hero"] [data-split-content] [data-text-item] h1 {
        font-size: var(--h4-font-size);
    }

    [data-section="hero"] [data-split-content] [data-text-item] p {
        font-size: var(--text-base);
    }
}
