/*
Theme Name: Flamingo Marine
Theme URI: https://flamingo-marine.local
Description: Custom block theme for Flamingo Marine.
Version: 0.1.0
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 8.1
Author: Flamingo Marine
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: flamingo-marine
*/

/* WordPress loads font faces declared in theme.json — no @font-face here. */

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    color-scheme: dark;
}

/* Placeholder logo wordmark — replace .flm-logo__mark with the Figma SVG once available. */
.flm-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--wp--preset--color--text-primary);
    text-decoration: none;
    font-family: var(--wp--preset--font-family--plex);
    font-weight: 600;
    font-size: var(--wp--preset--font-size--body);
    letter-spacing: 0.04em;
}
.flm-logo__mark {
    color: var(--wp--preset--color--accent-pink);
    font-size: 1.4em;
    line-height: 1;
}
.flm-logo:hover { color: var(--wp--preset--color--text-secondary); }

/* Welcome to the Flamingo 5 — 3-line two-tone headline (V4 strip-2) */
.flm-welcome-headline {
    margin: 0;
    font-family: var(--wp--preset--font-family--plex);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    color: var(--wp--preset--color--text-primary);
}
/* Lines 2-3 — same weight/size, muted gray. */
.flm-welcome-headline .flm-welcome-headline__muted {
    color: var(--wp--preset--color--text-muted);
}

/* Inline ROVE wordmark for CTAs/labels. background-color: currentColor over the
   wordmark's alpha mask, so it inherits the surrounding text color and flips with
   button hover states. Use: BUILD YOUR <span class="flm-rove-logo" role="img"
   aria-label="ROVE"></span>. */
.flm-rove-logo {
    display: inline-block;
    aspect-ratio: 576 / 148;
    height: 0.72em;
    margin-inline-start: 0.16em;
    vertical-align: -0.02em;
    background-color: currentColor;
    -webkit-mask: url(assets/images/rove-wordmark-white.png) center / contain no-repeat;
    mask: url(assets/images/rove-wordmark-white.png) center / contain no-repeat;
}
/* Tray "Build Your ROVE" CTA — a bit more space + a more prominent wordmark. */
.flm-drawer__btn .flm-rove-logo { height: 1em; margin-inline-start: 0.34em; vertical-align: middle; }
/* Sticky header CTA — slightly more prominent, and vertically centred in the
   button via flex (the uppercase label has no descenders, so vertical-align
   alone sat the wordmark low). */
.flm-header .is-style-filled-white .wp-block-button__link { display: inline-flex; align-items: center; }
/* Optical lift: flex-centering leaves the logotype's bottom ~2.7px below the
   label's baseline; a 1px rise splits the overshoot between cap line and
   baseline so it reads seated with the text (BugHerd #146). */
.flm-header .flm-rove-logo { height: 0.88em; transform: translateY(-1px); }

/* Cinematic Carousel — active-slide-scaled variant */
.flm-cinematic-carousel {
    position: relative;
    width: 100%;
    background: var(--wp--preset--color--surface-deep);
    padding-block: clamp(3rem, 8vw, 7rem);
    overflow: hidden;
}
.flm-cinematic-carousel__swiper {
    width: 100%;
    overflow: visible;
}
/* Auto-width slides: neighbours sit at rest size, the centred slide scales up. */
.flm-cinematic-carousel__slide {
    position: relative;
    width: clamp(175px, 20vw, 275px);
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    border-radius: 4px;
    overflow: hidden;
    transform: scale(0.86);
    transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
.flm-cinematic-carousel__slide.swiper-slide-active {
    transform: scale(1.4);
    z-index: 2;
}
.flm-cinematic-carousel__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.flm-cinematic-carousel__caption {
    position: relative;
    z-index: 2;
    color: var(--wp--preset--color--text-primary);
    font-family: var(--wp--preset--font-family--plex);
    font-size: var(--wp--preset--font-size--body);
    font-weight: 600;
    line-height: 1.2;
    padding: var(--wp--preset--spacing--md);
    opacity: 0;
    transition: opacity 700ms ease;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
.flm-cinematic-carousel__slide.swiper-slide-active .flm-cinematic-carousel__caption {
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .flm-cinematic-carousel__slide,
    .flm-cinematic-carousel__caption {
        transition: none;
    }
}
/* Time bar — fills over the autoplay delay, reset on slide change (driven in JS). */
.flm-cinematic-carousel__time-bar {
    position: relative;
    width: clamp(180px, 28vw, 360px);
    height: 2px;
    margin: clamp(3rem, 7vw, 5.5rem) auto 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
}
.flm-cinematic-carousel__time-bar-fill {
    display: block;
    width: 100%;
    height: 100%;
    /* Pink like the Flamingo 5 tab timer, so every carousel loads the same
       way (corporate feedback #19). */
    background: var(--wp--preset--color--accent-pink);
    transform: scaleX(0);
    transform-origin: left center;
}
/* Prev/next arrows (BugHerd #3) — same chevron glyphs + pink-fill hover as the
   news filmstrip nav, with a translucent disc so they stay legible over the
   slide imagery. Vertically centred on the slide row, pinned to each edge. */
.flm-cinematic-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(10, 12, 16, 0.35);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: var(--wp--preset--color--text-primary);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.flm-cinematic-carousel__arrow--prev { left: clamp(0.75rem, 3vw, 2.5rem); }
.flm-cinematic-carousel__arrow--next { right: clamp(0.75rem, 3vw, 2.5rem); }
.flm-cinematic-carousel__arrow:hover,
.flm-cinematic-carousel__arrow:focus-visible {
    border-color: var(--wp--preset--color--accent-pink);
    background-color: var(--wp--preset--color--accent-pink);
    color: #fff;
    outline: none;
}
.flm-cinematic-carousel__arrow:focus-visible {
    box-shadow: 0 0 0 2px var(--wp--preset--color--focus);
}
.flm-cinematic-carousel__arrow.swiper-button-disabled {
    opacity: 0.35;
    pointer-events: none;
}
/* Center arrow link (Header + Body + Arrow Center) */
.flm-arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--wp--preset--color--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--wp--preset--font-size--body);
    padding: 0.5rem 0;
    margin: 0 auto;
    justify-content: center;
    transition: color 150ms ease, gap 150ms ease;
}
.flm-arrow-link:hover {
    color: var(--wp--preset--color--accent-pink);
    gap: 0.75rem;
}
.flm-arrow-link__icon {
    font-size: 1.2em;
    line-height: 1;
}

/* FAQ accordion */
.flm-faq .wp-block-details {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--wp--preset--spacing--lg) 0;
}
.flm-faq .wp-block-details:last-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.flm-faq .wp-block-details summary {
    cursor: pointer;
    font-family: var(--wp--preset--font-family--plex);
    font-size: var(--wp--preset--font-size--body-lg);
    font-weight: 500;
    color: var(--wp--preset--color--text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--wp--preset--spacing--md);
}
.flm-faq .wp-block-details summary::-webkit-details-marker { display: none; }
.flm-faq .wp-block-details summary::after {
    content: "+";
    font-size: 1.5em;
    font-weight: 300;
    transition: transform 200ms ease;
}
.flm-faq .wp-block-details[open] summary::after {
    transform: rotate(45deg);
}
.flm-faq .wp-block-details p {
    color: var(--wp--preset--color--text-secondary);
    margin-top: var(--wp--preset--spacing--md);
    font-weight: 300;
    line-height: 1.5;
}

/* MSRP Disclaimer */
.flm-disclaimer__list {
    padding-left: 1.5em;
}
.flm-disclaimer__list li {
    margin-bottom: 0.5em;
}
.flm-disclaimer__list strong {
    color: var(--wp--preset--color--text-secondary);
    font-weight: 600;
}

/* Footer */
.flm-footer .flm-logo {
    font-size: 1.375rem;
}
.flm-footer .flm-footer__links {
    list-style: none;
    padding-left: 0;
    margin: var(--wp--preset--spacing--md) 0 0 0;
}
.flm-footer .flm-footer__links li {
    margin-bottom: var(--wp--preset--spacing--xs);
}
.flm-footer .flm-footer__links a {
    color: var(--wp--preset--color--text-secondary);
    text-decoration: none;
    font-weight: 300;
    transition: color 150ms ease;
}
.flm-footer .flm-footer__links a:hover {
    color: var(--wp--preset--color--text-primary);
}

/* Footer social icons (CSS mask for color control) */
.flm-social {
    list-style: none;
    padding: 0;
    margin: var(--wp--preset--spacing--md) 0 0 0;
    display: flex;
    gap: var(--wp--preset--spacing--md);
    align-items: center;
}
.flm-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}
.flm-social__icon {
    display: block;
    width: 20px;
    height: 20px;
}
/* Legacy mask icons (<span> glyphs, patterns/footer-band.php) paint the glyph
   via background-color + mask. Scoped to span so the inline-SVG icons in the
   main footer/drawer never inherit the background fill — unscoped, the hover
   rule painted a white box behind the SVGs (BugHerd #172). */
span.flm-social__icon {
    background-color: var(--wp--preset--color--text-secondary);
    transition: background-color 150ms ease;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}
.flm-social a:hover span.flm-social__icon {
    background-color: var(--wp--preset--color--text-primary);
}
.flm-social__icon--instagram { -webkit-mask-image: url(./assets/icons/instagram.svg); mask-image: url(./assets/icons/instagram.svg); }
.flm-social__icon--facebook  { -webkit-mask-image: url(./assets/icons/facebook.svg);  mask-image: url(./assets/icons/facebook.svg); }
.flm-social__icon--linkedin  { -webkit-mask-image: url(./assets/icons/linkedin.svg);  mask-image: url(./assets/icons/linkedin.svg); }
.flm-social__icon--x         { -webkit-mask-image: url(./assets/icons/x.svg);         mask-image: url(./assets/icons/x.svg); }

/* Performance Stats */
.flm-stats__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--wp--preset--spacing--giant);
    width: 100%;
}
.flm-stats__item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: var(--wp--preset--spacing--md);
}
.flm-stats__number {
    font-family: var(--wp--preset--font-family--plex);
    font-size: var(--wp--preset--font-size--display);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--wp--preset--color--text-primary);
    font-variant-numeric: tabular-nums;
}
.flm-stats__unit {
    font-family: var(--wp--preset--font-family--plex);
    font-size: clamp(1.75rem, 1.25rem + 2vw, 3rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--wp--preset--color--text-primary);
    padding-bottom: 0.5em;
}

/* 3D Configurator */
.flm-configurator {
    overflow: hidden;
}
.flm-configurator__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    background: var(--wp--preset--color--surface-base);
}
.flm-configurator__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hotspots */
.flm-hotspot {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    z-index: 2;
}
.flm-hotspot__dot {
    position: absolute;
    inset: 8px;
    border-radius: 999px;
    background: var(--wp--preset--color--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.flm-hotspot__pulse {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px solid var(--wp--preset--color--text-primary);
    opacity: 0.6;
    animation: flm-hotspot-pulse 2s ease-out infinite;
}
@keyframes flm-hotspot-pulse {
    0%   { transform: scale(0.6); opacity: 0.7; }
    100% { transform: scale(1.6); opacity: 0; }
}
.flm-hotspot__popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 280px;
    background: rgba(3, 9, 16, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    color: var(--wp--preset--color--text-primary);
    padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--md);
    border-radius: 8px;
    text-align: left;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    pointer-events: none;
}
.flm-hotspot__label {
    font-size: var(--wp--preset--font-size--caption);
    font-weight: 600;
    color: var(--wp--preset--color--text-primary);
}
.flm-hotspot__desc {
    font-size: var(--wp--preset--font-size--caption);
    font-weight: 300;
    color: var(--wp--preset--color--text-secondary);
}
.flm-hotspot[aria-expanded="true"] .flm-hotspot__popover {
    display: flex;
}
.flm-hotspot[aria-expanded="true"] .flm-hotspot__pulse {
    animation: none;
    opacity: 0;
}
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================================
   Mobile responsive (≤ 767px)
   Defensive overrides for patterns that don't auto-adapt well to small screens.
   ========================================================================= */

@media (max-width: 767px) {

    /* Section padding — reduce mega/giant vertical pads */
    .wp-block-cover.flm-hero {
        min-height: 520px;
    }
    .wp-block-cover.flm-hero .wp-block-buttons {
        flex-wrap: wrap;
        gap: var(--wp--preset--spacing--sm);
    }
    .wp-block-cover.flm-hero .wp-block-button {
        flex: 1 1 auto;
    }
    .wp-block-cover.flm-hero .wp-block-button__link {
        width: 100%;
        text-align: center;
    }

    /* Cinematic Carousel — tighten slide size + scale on phone. A 1.4x active
       scale clips the centred slide against the viewport edges on small
       screens, so ease it back to ~1.15x and widen the rest size so the active
       slide still reads as the focal point without overflowing. */
    .flm-cinematic-carousel__slide {
        width: clamp(188px, 57.5vw, 250px);
    }
    .flm-cinematic-carousel__slide.swiper-slide-active {
        transform: scale(1.15);
    }
    .flm-cinematic-carousel__caption {
        font-size: var(--wp--preset--font-size--body);
        padding: var(--wp--preset--spacing--sm);
    }

    /* 3D Configurator — 16:7 is too narrow at phone widths */
    .flm-configurator__stage {
        aspect-ratio: 4 / 3;
    }
    .flm-hotspot {
        width: 28px;
        height: 28px;
    }
    .flm-hotspot__popover {
        max-width: 220px;
    }

    /* Performance Stats — stack number + unit vertically */
    .flm-stats__grid {
        gap: var(--wp--preset--spacing--xxl);
    }
    .flm-stats__item {
        grid-template-columns: 1fr;
        gap: 0;
        align-items: start;
    }
    .flm-stats__number {
        font-size: clamp(4.25rem, 18vw, 7.25rem);
    }
    .flm-stats__unit {
        font-size: clamp(1.5rem, 5vw, 2rem);
        padding-bottom: 0;
    }

    /* FAQ — keep summary readable on small screens */
    .flm-faq .wp-block-details summary {
        font-size: var(--wp--preset--font-size--body);
    }

    /* Footer — ensure social row wraps if needed */
    .flm-social {
        flex-wrap: wrap;
    }
    .flm-footer .flm-logo {
        font-size: 1.25rem;
    }

    /* MSRP disclaimer — give a touch more side breathing room */
    .flm-disclaimer__list {
        padding-left: 1.25em;
    }

    /* Pattern groups using mega/giant padding — pull in to keep content density right */
    .wp-block-group[style*="--wp--preset--spacing--mega"] {
        padding-top: var(--wp--preset--spacing--giant) !important;
        padding-bottom: var(--wp--preset--spacing--giant) !important;
    }
    .wp-block-cover.flm-footer {
        min-height: auto;
    }
    .wp-block-cover.flm-footer [style*="--wp--preset--spacing--giant"] {
        padding-top: var(--wp--preset--spacing--xxl) !important;
        padding-bottom: var(--wp--preset--spacing--xxl) !important;
    }
}

/* Smaller phone tweak (≤ 400px) */
@media (max-width: 400px) {
    .flm-cinematic-carousel__caption {
        font-size: var(--wp--preset--font-size--body);
        padding: var(--wp--preset--spacing--lg);
    }
    .flm-hotspot__popover {
        max-width: 180px;
    }
}
