/*
 * EnergyFit landing page  (Phia Energy Survey 1.3.0)
 *
 * Plugin-owned. Visual design follows the supplied index.html. Everything is
 * scoped to .energy-fit-landing, except the small body.pes-landing-page rule
 * (the body class is only ever added on the landing page).
 *
 * Primary target: touch tablets (e.g. Amazon Fire / Silk) in portrait and
 * landscape. Nothing here depends on :hover; hover styling is limited to
 * devices that can actually hover. Older-browser fallbacks are deliberate
 * (vh before dvh, no `inset`, no :is(), no aspect-ratio).
 */

/* ---------- Font (local, no external request) ---------- */
@font-face {
    font-family: "Raleway";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/raleway-latin-400-normal.woff2") format("woff2");
}

/* ---------- Page ---------- */
body.pes-landing-page {
    margin: 0 !important;
    padding: 0 !important;
    background: #000 !important;
    overflow-x: hidden;
}

/* The admin bar is switched off in PHP on this page; this is a safety net. */
body.pes-landing-page #wpadminbar {
    display: none !important;
}

/* ---------- Root: full viewport, poster is the base layer ---------- */
.energy-fit-landing {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    background-image: url("../images/landing-poster-landscape.jpg");
    background-repeat: no-repeat;
    background-position: 45% 50%;
    background-size: cover;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (orientation: portrait) {
    .energy-fit-landing {
        background-image: url("../images/landing-poster-portrait.jpg");
        background-position: center center;
    }
}

.energy-fit-landing *,
.energy-fit-landing *::before,
.energy-fit-landing *::after {
    box-sizing: border-box;
}

/* ---------- Background video (plays over the poster) ---------- */
.energy-fit-landing__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 45% 50%;
    border: 0;
    outline: none;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

/* Hide any native control chrome, incl. iOS */
.energy-fit-landing__video::-webkit-media-controls,
.energy-fit-landing__video::-webkit-media-controls-panel,
.energy-fit-landing__video::-webkit-media-controls-start-playback-button,
.energy-fit-landing__video::-webkit-media-controls-overlay-play-button {
    display: none !important;
    -webkit-appearance: none;
}

/* Fallback states: poster (the root background) is shown instead. */
.energy-fit-landing[data-video-state="reduced"] .energy-fit-landing__video,
.energy-fit-landing[data-video-state="error"] .energy-fit-landing__video,
.energy-fit-landing[data-video-state="unsupported"] .energy-fit-landing__video {
    display: none;
}

/* ---------- Readability overlay ---------- */
.energy-fit-landing__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0.46) 100%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.10) 45%, rgba(0, 0, 0, 0.34) 100%);
}

/* ---------- Content block (stays at the intended 1200px composition) ---------- */
.energy-fit-landing__inner {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: center;
    gap: 34px;
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 24px));
    padding-left: max(24px, env(safe-area-inset-left));
}

.energy-fit-landing__product {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    display: block;
    width: min(350px, 30vw);
    height: auto;
    max-height: 62vh;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    object-fit: contain;
}

.energy-fit-landing__content {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    flex-basis: 50%;
    min-width: 0;
    align-items: flex-start;
    margin: 0;
    padding: 0;
}

.energy-fit-landing__title {
    position: relative;
    z-index: 3;
    margin: 0 0 25px;
    padding: 0;
    font-family: "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: clamp(1.375rem, 3.33vw, 2.5rem);
    font-weight: 400;
    font-style: normal;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    text-align: inherit;
    color: #fff;
    text-wrap: balance;
}

/* ---------- Call to action: large, touch-first, no hover dependence ---------- */
.energy-fit-landing .energy-fit-landing__cta {
    position: relative;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    min-width: min(100%, 280px);
    max-width: 100%;
    margin: 0;
    padding: 20px 36px;
    color: #fff;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.2em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    /* Opaque enough to read without backdrop blur (older Silk / low-end GPUs). */
    background-color: rgba(0, 0, 0, 0.32);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

@supports ((-webkit-backdrop-filter: blur(6px)) or (backdrop-filter: blur(6px))) {
    .energy-fit-landing .energy-fit-landing__cta {
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }
}

/* Pressed feedback works for touch and mouse alike. */
.energy-fit-landing .energy-fit-landing__cta:active {
    background-color: rgba(255, 255, 255, 0.28);
    border-color: #fff;
    transform: scale(0.98);
}

.energy-fit-landing .energy-fit-landing__cta:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}

/* Hover only where a pointer can really hover (never on touch tablets). */
@media (hover: hover) and (pointer: fine) {
    .energy-fit-landing .energy-fit-landing__cta:hover {
        background-color: rgba(255, 255, 255, 0.16);
        border-color: #fff;
        color: #fff;
        transform: translateY(-2px);
    }
    .energy-fit-landing .energy-fit-landing__cta:active {
        transform: scale(0.98);
    }
}

/* Touch devices: bigger again. */
@media (pointer: coarse) {
    .energy-fit-landing .energy-fit-landing__cta {
        min-height: 64px;
        padding: 22px 44px;
        font-size: clamp(1rem, 2vw, 1.25rem);
    }
}

.energy-fit-landing__notice {
    position: relative;
    z-index: 3;
    margin: 0;
    padding: 12px 16px;
    color: #fff;
    font: 400 0.95rem/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 6px;
}
.energy-fit-landing__notice a {
    color: #fff;
    text-decoration: underline;
}

/* =====================================================================
   RESPONSIVE LAYOUTS
   ===================================================================== */

/* ---- Tablet landscape / small desktop (<= 1199px): stays a row ---- */
@media (max-width: 1199px) {
    .energy-fit-landing__inner {
        gap: clamp(20px, 3vw, 34px);
    }
}

/* ---- Portrait phones and tablets (<= 991px wide): stacked ---- */
@media (max-width: 991px) and (orientation: portrait) {
    .energy-fit-landing__inner {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: clamp(18px, 3.5vh, 32px);
    }

    .energy-fit-landing__product {
        width: min(300px, 62vw);
        max-height: 40vh;
    }

    .energy-fit-landing__content {
        flex: 0 0 auto;
        width: 100%;
        align-items: center;
        text-align: center;
    }

    .energy-fit-landing__title {
        margin: 0 0 clamp(20px, 3vh, 30px);
        text-align: center;
    }
}

/* ---- Tablet portrait (Fire / iPad / Android tablets): larger type + image ---- */
@media (min-width: 601px) and (max-width: 991px) and (orientation: portrait) {
    .energy-fit-landing__product {
        width: min(380px, 52vw);
        max-height: 40vh;
    }

    .energy-fit-landing__title {
        font-size: clamp(1.75rem, 4.8vw, 2.5rem);
    }
}

/* ---- Phones, portrait ---- */
@media (max-width: 600px) and (orientation: portrait) {
    .energy-fit-landing__inner {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .energy-fit-landing__product {
        width: min(260px, 58vw);
        max-height: 36vh;
    }

    .energy-fit-landing__title {
        line-height: 1.25;
    }

    .energy-fit-landing .energy-fit-landing__cta {
        letter-spacing: 0.16em;
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ---- Short landscape (phones on their side, small tablets with bars) ---- */
@media (orientation: landscape) and (max-height: 500px) {
    .energy-fit-landing__inner {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: clamp(16px, 3vw, 28px);
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .energy-fit-landing__product {
        width: auto;
        max-width: 34vw;
        max-height: 74vh;
    }

    .energy-fit-landing__content {
        flex: 1 1 0;
        width: auto;
        align-items: flex-start;
        text-align: left;
    }

    .energy-fit-landing__title {
        font-size: clamp(1.1rem, 3.6vh, 1.75rem);
        margin: 0 0 14px;
        text-align: left;
    }

    .energy-fit-landing .energy-fit-landing__cta {
        min-height: 52px;
        padding: 14px 28px;
    }
}

/* ---- Very short screens ---- */
@media (max-height: 380px) {
    .energy-fit-landing__product {
        max-height: 68vh;
    }

    .energy-fit-landing__title {
        font-size: clamp(1rem, 3.4vh, 1.4rem);
        margin: 0 0 10px;
    }

    .energy-fit-landing .energy-fit-landing__cta {
        min-height: 48px;
        padding: 12px 24px;
    }
}

/* =====================================================================
   ACCESSIBILITY
   ===================================================================== */

/* Reduced motion: no video, poster only; no transitions. */
@media (prefers-reduced-motion: reduce) {
    .energy-fit-landing__video {
        display: none;
    }
    .energy-fit-landing .energy-fit-landing__cta {
        transition: none;
    }
    .energy-fit-landing .energy-fit-landing__cta:active,
    .energy-fit-landing .energy-fit-landing__cta:hover {
        transform: none;
    }
}
