/*
 * Energy Research - Responsive System
 * Loaded AFTER custom.css.
 * Do not move this before custom.css.
 */

:root {
    --content-gutter: clamp(13px, 4vw, 40px);
}

/* =========================================================
   GLOBAL
========================================================= */

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    scroll-padding-top: 82px;
}

body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    min-width: 0;
}

img,
video,
iframe,
svg {
    max-width: 100%;
}

.wrap {
    width: min(calc(100% - (var(--content-gutter) * 2)), var(--max));
    max-width: var(--max);
    margin-inline: auto;
}

main,
section,
article,
.card,
.callout,
.verdict,
.price-card,
.cta {
    max-width: 100%;
}

/* Prevent long URLs / technical strings from blowing out mobile. */
p,
li,
td,
th,
a,
strong,
span {
    overflow-wrap: anywhere;
}

/* =========================================================
   HEADER / NAVIGATION
========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.site-nav {
    position: relative;
    min-width: 0;
}

.brand {
    min-width: 0;
    max-width: 70%;
}

.mobile-menu-toggle {
    display: none;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--green);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    appearance: none;
    -webkit-appearance: none;
    z-index: 10002;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
}

@media (min-width: 901px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .navlinks {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        align-items: center;
        width: auto;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }
}

@media (max-width: 900px) {
    html {
        scroll-padding-top: 70px;
    }

    .site-nav {
        min-height: 64px;
        padding: 11px 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .navlinks {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px;
        background: rgba(255, 253, 247, .99);
        border: 1px solid var(--line);
        border-top: 0;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 20px 50px rgba(20, 36, 30, .16);
        z-index: 10001;
    }

    .navlinks.is-open {
        display: flex !important;
    }

    .navlinks a {
        display: block;
        width: 100%;
        padding: 13px 14px;
        border-radius: 8px;
        font-size: 15px;
        line-height: 1.35;
        text-decoration: none;
    }

    .navlinks a:hover,
    .navlinks a:focus-visible {
        background: rgba(23, 63, 49, .06);
    }

    .navlinks .nav-cta {
        margin-top: 7px;
        text-align: center;
    }

    .mobile-menu-toggle.is-open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-toggle.is-open span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.is-open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1024px) {
    .wrap {
        width: min(calc(100% - 40px), var(--max));
    }

    .hero-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
        gap: 28px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .navlinks {
        gap: 12px;
    }

    .navlinks a {
        font-size: 13px;
    }
}

/* =========================================================
   TABLET / MOBILE CONTENT
========================================================= */

@media (max-width: 900px) {
    .hero {
        min-height: auto;
    }

    .hero-grid,
    .grid-2,
    .price-wrap,
    .footer-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .verdict {
        transform: none;
    }

    .product-stage {
        min-height: 380px;
        width: 100%;
    }

    .product-tilt {
        width: min(390px, 82vw);
    }

    .spin-label {
        right: 0;
    }

    .cta {
        align-items: stretch;
        flex-direction: column;
    }

    .cta .btn {
        width: 100%;
    }

    .toc ol {
        columns: 1;
    }

    /* Wide tables remain readable instead of being crushed. */
    table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table th,
    table td {
        min-width: 130px;
    }
}

/* =========================================================
   PHONE
========================================================= */

@media (max-width: 640px) {
    :root {
        --content-gutter: 13px;
    }

    .wrap {
        width: calc(100% - 26px);
    }

    .topbar .wrap {
        display: block;
    }

    .topbar span:last-child {
        display: none;
    }

    .brand {
        max-width: calc(100% - 56px);
        font-size: 14px;
        line-height: 1.15;
    }

    .mobile-menu-toggle {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .hero {
        padding: 42px 0 30px;
    }

    .hero-grid {
        gap: 24px;
    }

    h1,
    .hero h1 {
        font-size: clamp(36px, 10vw, 42px);
        line-height: 1.06;
    }

    h2 {
        font-size: clamp(30px, 8vw, 38px);
    }

    h3 {
        font-size: 24px;
    }

    .hero-lead {
        font-size: 17px;
        line-height: 1.6;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .product-stage {
        min-height: 315px;
    }

    .product-tilt {
        width: min(310px, 80vw);
    }

    .spin-label {
        font-size: 9px;
        padding: 8px 10px;
    }

    section {
        padding: 46px 0;
    }

    .card,
    .price-card {
        padding: 20px;
        border-radius: 18px;
    }

    .verdict {
        padding: 21px;
        border-radius: 20px;
    }

    .callout {
        padding: 18px;
        border-radius: 18px;
    }

    .claim-grid {
        grid-template-columns: 1fr;
    }

    .toc {
        padding: 17px;
    }

    .toc ol {
        columns: 1;
        padding-left: 20px;
    }

    .cta {
        padding: 24px;
        border-radius: 22px;
    }

    .cta h2 {
        font-size: 29px;
    }

    .price-now {
        font-size: clamp(48px, 15vw, 64px);
    }

    .price-cta {
        width: 100%;
    }

    .formula {
        font-size: 13px;
        padding: 16px;
    }

    .faq details {
        padding-inline: 14px;
    }

    .faq summary {
        padding: 16px 30px 16px 0;
        position: relative;
    }

    th,
    td {
        padding: 11px 12px;
        font-size: 13px;
    }
}

@media (max-width: 390px) {
    .wrap {
        width: calc(100% - 22px);
    }

    .hero {
        padding-top: 34px;
    }

    h1,
    .hero h1 {
        font-size: 34px;
    }

    .product-stage {
        min-height: 285px;
    }

    .product-tilt {
        width: min(270px, 82vw);
    }
}

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

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* =========================================================
   FINAL DECISION SECTION - SAFETY OVERRIDES
========================================================= */

@media (max-width: 950px) {
    .ers-buy-decision .ers-decision-scene {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .ers-buy-decision {
        padding: 70px 0 80px;
    }

    .ers-buy-decision .ers-decision-wrap {
        width: calc(100% - 26px);
    }

    .ers-buy-decision .ers-decision-heading h2 {
        font-size: clamp(34px, 10vw, 43px);
        line-height: 1.05;
    }

    .ers-buy-decision .ers-decision-scene {
        display: flex;
        flex-direction: column;
        gap: 28px;
    }

    .ers-buy-decision .ers-decision-card {
        width: 100%;
        min-height: auto;
        padding: 32px 22px 110px;
    }

    .ers-buy-decision .ers-buy-card,
    .ers-buy-decision .ers-dont-card {
        transform: none;
    }

    .ers-buy-decision .ers-decision-card h3 {
        font-size: clamp(26px, 7vw, 31px);
    }

    .ers-buy-decision .ers-card-bottom {
        left: 22px;
        right: 22px;
        bottom: 22px;
    }

    .ers-buy-decision .ers-decision-object {
        width: 120px;
        height: 120px;
        order: 2;
    }

    .ers-buy-decision .ers-object-core {
        width: 85px;
        height: 85px;
    }

    .ers-buy-decision .ers-object-orbit-dot {
        animation: none;
        transform: translateX(60px);
    }

    .ers-buy-decision .ers-decision-conclusion {
        display: block;
        margin-top: 40px;
        padding: 0 10px;
    }

    .ers-buy-decision .ers-conclusion-line {
        display: none;
    }

    /* Large decorative geometry should not dictate phone width. */
    .ers-buy-decision .ers-decision-orbit {
        opacity: .35;
    }
}

@media (max-width: 420px) {
    .ers-buy-decision .ers-decision-heading p {
        font-size: 15px;
    }

    .ers-buy-decision .ers-decision-card {
        padding-left: 18px;
        padding-right: 18px;
    }

    .ers-buy-decision .ers-card-bottom {
        left: 18px;
        right: 18px;
    }
}

/* Auto-created table wrappers from custom.js */
.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    border-radius: 14px;
}

.table-scroll table {
    min-width: 680px;
    margin: 0;
}

/* =========================================================
   2.0.1 DESKTOP STABILITY OVERRIDES
   Keep the original desktop composition intact while making
   the editable WordPress homepage full-width at the section level.
========================================================= */

@media (min-width: 1025px) {
    .site-nav {
        min-height: 72px;
        gap: 22px;
    }

    .brand {
        flex: 0 0 auto;
        max-width: 330px;
    }

    .navlinks {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        gap: 16px;
    }

    .navlinks a {
        white-space: nowrap;
    }

    .hero-grid {
        grid-template-columns: minmax(0, 1.4fr) minmax(330px, .75fr);
    }

    .ers-editor-content {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .ers-editor-content > .hero,
    .ers-editor-content > section {
        width: 100%;
    }
}

/* The editor content already contains its own .wrap containers.
   Never constrain the entire homepage with a second .wrap. */
.ers-editor-content {
    width: 100%;
    max-width: none;
    padding: 0;
}

/* Prevent long tables and code/formula blocks from expanding the page. */
.ers-editor-content table,
.ers-editor-content .formula,
.ers-editor-content .claim-grid {
    max-width: 100%;
}

@media (min-width: 901px) and (max-width: 1100px) {
    .brand {
        font-size: 16px;
    }

    .navlinks {
        gap: 10px;
    }

    .navlinks a {
        font-size: 12px;
    }

    .navlinks .nav-cta {
        padding: 9px 11px;
    }
}
