/*
 * GHG Site Core responsive layer
 * Version 1.4.0
 * Loaded after every page stylesheet to provide a deliberate mobile/tablet layout.
 */

html,
body.ghg-wordpress-page {
    max-width: 100%;
    overflow-x: clip;
}

body.ghg-wordpress-page {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.ghg-wordpress-page img,
body.ghg-wordpress-page svg,
body.ghg-wordpress-page video,
body.ghg-wordpress-page canvas {
    max-width: 100%;
}

/* Mobile navigation is injected by mobile-navigation.js. */
.ghg-mobile-menu-toggle,
.ghg-mobile-menu,
.ghg-mobile-menu-backdrop {
    display: none;
}

body.admin-bar .navbar {
    top: 32px;
}

@media (max-width: 980px) {
    :root {
        --ghg-mobile-gutter: clamp(18px, 5vw, 28px);
        --ghg-mobile-radius: 26px;
    }

    body.ghg-wordpress-page {
        overflow-x: hidden;
    }

    body.ghg-wordpress-page main {
        overflow: hidden;
    }

    body.ghg-wordpress-page .navbar {
        top: 0;
        height: 68px !important;
        padding: 0 var(--ghg-mobile-gutter) !important;
        gap: 10px !important;
        background: rgba(255, 255, 255, 0.94) !important;
        border-bottom: 1px solid rgba(23, 32, 22, 0.08) !important;
        backdrop-filter: blur(18px) saturate(1.1) !important;
        -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
    }

    body.admin-bar .navbar {
        top: 32px;
    }

    body.ghg-wordpress-page .brand {
        min-width: 0;
        gap: 9px;
        flex: 1 1 auto;
    }

    body.ghg-wordpress-page .brand-icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        border-radius: 13px;
    }

    body.ghg-wordpress-page .brand-text {
        min-width: 0;
    }

    body.ghg-wordpress-page .brand-text strong {
        overflow: hidden;
        max-width: 44vw;
        font-size: .76rem !important;
        letter-spacing: .18em !important;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    body.ghg-wordpress-page .brand-text small,
    body.ghg-wordpress-page .navbar > .nav-links,
    body.ghg-wordpress-page .navbar > .portal-button {
        display: none !important;
    }

    .ghg-mobile-menu-toggle {
        position: relative;
        z-index: 1002;
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        display: inline-grid;
        place-items: center;
        padding: 0;
        border: 1px solid rgba(23, 32, 22, .11);
        border-radius: 15px;
        background: rgba(247, 250, 239, .92);
        color: #172016;
        cursor: pointer;
        box-shadow: 0 10px 30px rgba(23, 32, 22, .07);
        -webkit-tap-highlight-color: transparent;
    }

    .ghg-mobile-menu-toggle span,
    .ghg-mobile-menu-toggle::before,
    .ghg-mobile-menu-toggle::after {
        content: "";
        position: absolute;
        left: 12px;
        width: 20px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s ease, top .28s ease;
    }

    .ghg-mobile-menu-toggle::before { top: 14px; }
    .ghg-mobile-menu-toggle span { top: 21px; }
    .ghg-mobile-menu-toggle::after { top: 28px; }

    body.ghg-mobile-menu-open .ghg-mobile-menu-toggle::before {
        top: 21px;
        transform: rotate(45deg);
    }

    body.ghg-mobile-menu-open .ghg-mobile-menu-toggle span {
        opacity: 0;
        transform: scaleX(.35);
    }

    body.ghg-mobile-menu-open .ghg-mobile-menu-toggle::after {
        top: 21px;
        transform: rotate(-45deg);
    }

    .ghg-mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 998;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: rgba(4, 11, 7, .52);
        backdrop-filter: blur(7px);
        -webkit-backdrop-filter: blur(7px);
        transition: opacity .3s ease, visibility .3s ease;
    }

    .ghg-mobile-menu {
        position: fixed;
        top: 78px;
        left: var(--ghg-mobile-gutter);
        right: var(--ghg-mobile-gutter);
        z-index: 1001;
        display: flex;
        visibility: hidden;
        flex-direction: column;
        gap: 7px;
        max-height: calc(100svh - 100px);
        padding: 18px;
        overflow-y: auto;
        border: 1px solid rgba(169, 198, 79, .22);
        border-radius: 26px;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 34px 100px rgba(5, 16, 10, .24);
        opacity: 0;
        transform: translateY(-14px) scale(.975);
        transform-origin: top center;
        transition: opacity .3s ease, transform .3s cubic-bezier(.2, .8, .2, 1), visibility .3s ease;
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
    }

    body.admin-bar .ghg-mobile-menu {
        top: 110px;
    }

    .ghg-mobile-menu a {
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        border: 1px solid transparent;
        border-radius: 17px;
        color: #172016;
        text-decoration: none;
        font-size: .98rem;
        font-weight: 850;
        letter-spacing: -.01em;
        transition: transform .2s ease, color .2s ease, background .2s ease, border-color .2s ease;
    }

    .ghg-mobile-menu a::after {
        content: "→";
        width: 30px;
        height: 30px;
        display: grid;
        place-items: center;
        border-radius: 999px;
        background: rgba(169, 198, 79, .12);
        color: #6c842e;
    }

    .ghg-mobile-menu a.active,
    .ghg-mobile-menu a:hover,
    .ghg-mobile-menu a:focus-visible {
        border-color: rgba(169, 198, 79, .26);
        background: #f5f8ea;
        color: #657d2c;
        transform: translateX(2px);
    }

    .ghg-mobile-menu .ghg-mobile-portal {
        margin-top: 8px;
        justify-content: center;
        color: #fff;
        background: linear-gradient(135deg, #2a9f4a, #8da83e);
        border-color: transparent;
        box-shadow: 0 18px 48px rgba(42, 159, 74, .22);
    }

    .ghg-mobile-menu .ghg-mobile-portal::after {
        background: rgba(255, 255, 255, .17);
        color: #fff;
    }

    body.ghg-mobile-menu-open {
        overflow: hidden;
        touch-action: none;
    }

    body.ghg-mobile-menu-open .ghg-mobile-menu-backdrop {
        visibility: visible;
        opacity: 1;
    }

    body.ghg-mobile-menu-open .ghg-mobile-menu {
        visibility: visible;
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    /* Shared typography and spacing. */
    body.ghg-wordpress-page .section,
    body.ghg-wordpress-page .about-story-section,
    body.ghg-wordpress-page .about-goal-section,
    body.ghg-wordpress-page .about-team-section,
    body.ghg-wordpress-page .about-partners-section,
    body.ghg-wordpress-page .contact-form-section,
    body.ghg-wordpress-page .how-help-section,
    body.ghg-wordpress-page .portal-showcase-section {
        padding-left: var(--ghg-mobile-gutter) !important;
        padding-right: var(--ghg-mobile-gutter) !important;
    }

    body.ghg-wordpress-page h1,
    body.ghg-wordpress-page h2,
    body.ghg-wordpress-page h3,
    body.ghg-wordpress-page p {
        overflow-wrap: anywhere;
    }

    body.ghg-wordpress-page h1 {
        font-size: clamp(3rem, 14.5vw, 5.25rem) !important;
        line-height: .92 !important;
        letter-spacing: -.068em !important;
    }

    body.ghg-wordpress-page h2 {
        font-size: clamp(2.15rem, 10.5vw, 4rem) !important;
        line-height: .98 !important;
        letter-spacing: -.055em !important;
    }

    body.ghg-wordpress-page p {
        font-size: clamp(.96rem, 3.8vw, 1.04rem);
        line-height: 1.72;
    }

    body.ghg-wordpress-page .button,
    body.ghg-wordpress-page button,
    body.ghg-wordpress-page input,
    body.ghg-wordpress-page textarea,
    body.ghg-wordpress-page select {
        min-height: 46px;
    }

    /* Home: preserve 3D, but give text and model separate visual zones. */
    body.ghg-home-page .hero-section {
        min-height: 100svh !important;
        align-items: flex-start !important;
        padding-top: 116px !important;
        padding-bottom: 40svh !important;
        background:
            linear-gradient(180deg, rgba(5, 16, 10, .98) 0%, rgba(5, 16, 10, .89) 45%, rgba(5, 16, 10, .42) 76%, rgba(5, 16, 10, .86) 100%),
            radial-gradient(circle at 50% 72%, rgba(169, 198, 79, .24), transparent 18rem),
            linear-gradient(135deg, #07100c, #162818) !important;
    }

    body.ghg-home-page .hero-content {
        width: 100% !important;
        max-width: 650px;
    }

    body.ghg-home-page .hero-content h1 {
        max-width: 8.2em;
        margin-bottom: 20px !important;
    }

    body.ghg-home-page .hero-content p {
        max-width: 42rem;
        margin-bottom: 0;
    }

    body.ghg-home-page .hero-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
        margin-top: 24px !important;
    }

    body.ghg-home-page .hero-buttons .button {
        width: 100%;
        min-height: 50px;
        padding: 0 14px;
        font-size: .88rem;
    }

    body.ghg-home-page .wave-divider {
        height: 68px;
    }

    body.ghg-home-page .canvas-holder,
    body.ghg-home-page .model-glow {
        pointer-events: none;
    }

    body.ghg-home-page .model-glow {
        top: auto !important;
        bottom: 2svh !important;
        width: 92vw !important;
        height: 92vw !important;
        opacity: .64;
    }

    body.ghg-home-page .intro-section,
    body.ghg-home-page .products-section,
    body.ghg-home-page .why-section,
    body.ghg-home-page .features-section {
        align-items: flex-start !important;
        padding-top: 92px !important;
        padding-bottom: 92px !important;
    }

    body.ghg-home-page .white-card,
    body.ghg-home-page .info-card,
    body.ghg-home-page .why-card,
    body.ghg-home-page .device-space-note {
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.ghg-home-page .white-card {
        padding: 28px 22px !important;
    }

    body.ghg-home-page .products-section h2,
    body.ghg-home-page .feature-copy h2,
    body.ghg-home-page .why-section h2 {
        font-size: clamp(2.15rem, 10.5vw, 4rem) !important;
    }

    body.ghg-home-page .dynamic-product-title {
        min-height: 0 !important;
    }

    body.ghg-home-page .info-card {
        grid-template-columns: 44px 1fr !important;
        gap: 14px !important;
        padding: 20px !important;
    }

    body.ghg-home-page .why-grid {
        display: flex !important;
        gap: 14px !important;
        margin: 34px calc(var(--ghg-mobile-gutter) * -1) 0 !important;
        padding: 0 var(--ghg-mobile-gutter) 14px !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    body.ghg-home-page .why-grid::-webkit-scrollbar { display: none; }

    body.ghg-home-page .why-card {
        flex: 0 0 min(82vw, 330px);
        min-height: 330px;
        scroll-snap-align: center;
    }

    body.ghg-home-page .video-band {
        min-height: 310px !important;
        padding: 50px var(--ghg-mobile-gutter);
    }

    body.ghg-home-page .video-overlay h3 {
        font-size: clamp(1.45rem, 7vw, 2rem) !important;
    }

    body.ghg-home-page .features-layout {
        display: flex !important;
        flex-direction: column-reverse;
        gap: 28px !important;
    }

    body.ghg-home-page .device-space-note {
        width: 100%;
        min-height: 260px !important;
        padding: 22px !important;
    }

    body.ghg-home-page .feature-columns {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* About page: mobile-first cards with horizontal snapping where useful. */
    body.about-page .about-hero {
        min-height: 84svh !important;
        padding: 118px var(--ghg-mobile-gutter) 84px !important;
    }

    body.about-page .about-hero h1 {
        max-width: 10em;
    }

    body.about-page .about-hero-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
    }

    body.about-page .about-hero-actions .button {
        width: 100%;
        padding: 0 12px;
        font-size: .86rem;
    }

    body.about-page .story-shell {
        display: block !important;
    }

    body.about-page .story-copy {
        padding: 28px 22px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.about-page .story-metrics,
    body.about-page .goal-card-grid,
    body.about-page .team-grid {
        display: flex !important;
        gap: 14px !important;
        margin-top: 18px !important;
        margin-left: calc(var(--ghg-mobile-gutter) * -1) !important;
        margin-right: calc(var(--ghg-mobile-gutter) * -1) !important;
        padding: 0 var(--ghg-mobile-gutter) 16px !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    body.about-page .story-metrics::-webkit-scrollbar,
    body.about-page .goal-card-grid::-webkit-scrollbar,
    body.about-page .team-grid::-webkit-scrollbar { display: none; }

    body.about-page .story-metrics article,
    body.about-page .goal-card,
    body.about-page .team-card {
        flex: 0 0 min(84vw, 350px) !important;
        width: min(84vw, 350px) !important;
        scroll-snap-align: center;
    }

    body.about-page .story-metrics article {
        min-height: 330px !important;
    }

    body.about-page .metric-visual {
        height: 128px !important;
    }

    body.about-page .goal-card {
        min-height: 340px !important;
    }

    body.about-page .team-card {
        min-height: 520px !important;
    }

    body.about-page .team-portrait {
        height: 310px !important;
    }

    body.about-page .team-socials {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        justify-content: flex-start !important;
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    body.about-page .partners-carousel {
        border-radius: var(--ghg-mobile-radius) !important;
    }

    /* Contact page. */
    body.contact-page .contact-hero {
        min-height: 72svh !important;
        padding: 118px var(--ghg-mobile-gutter) 82px !important;
    }

    body.contact-page .contact-hero h1 {
        font-size: clamp(3.2rem, 17vw, 5.3rem) !important;
    }

    body.contact-page .contact-shell {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
    }

    body.contact-page .contact-intro,
    body.contact-page .contact-form {
        width: 100%;
        padding: 28px 22px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.contact-page .contact-intro {
        min-height: 0 !important;
    }

    body.contact-page .contact-intro h2 {
        white-space: normal !important;
        font-size: clamp(2.05rem, 10vw, 3.4rem) !important;
    }

    body.contact-page .typing-word {
        width: auto !important;
        min-width: 0 !important;
    }

    body.contact-page .form-row {
        grid-template-columns: 1fr !important;
    }

    body.contact-page .form-field input {
        height: 62px !important;
    }

    body.contact-page .form-field textarea {
        min-height: 165px !important;
    }

    body.contact-page .contact-submit {
        width: 100%;
        justify-content: space-between;
    }

    /* Markets: override dynamically injected desktop-heavy declarations. */
    body.markets-page .markets-hero {
        min-height: auto !important;
        padding: 118px var(--ghg-mobile-gutter) 84px !important;
    }

    body.markets-page .markets-hero-grid,
    body.markets-page .researchers-minimal-shell,
    body.markets-page .policymakers-shell,
    body.markets-page .consultants-shell,
    body.markets-page .ngos-shell,
    body.markets-page .portal-showcase-shell {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }

    body.markets-page .markets-hero-copy h1 {
        font-size: clamp(3rem, 13.5vw, 5rem) !important;
    }

    body.markets-page .markets-hero-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
    }

    body.markets-page .markets-hero-actions .button {
        width: 100%;
        padding: 0 12px;
        font-size: .86rem;
    }

    body.markets-page .markets-orbit {
        width: min(86vw, 430px) !important;
        height: min(86vw, 430px) !important;
        margin: 10px auto 0 !important;
        transform: scale(.88);
    }

    body.markets-page .livestock-photo-grid,
    body.markets-page .livestock-card-grid {
        display: flex !important;
        gap: 14px !important;
        margin-left: calc(var(--ghg-mobile-gutter) * -1) !important;
        margin-right: calc(var(--ghg-mobile-gutter) * -1) !important;
        padding: 0 var(--ghg-mobile-gutter) 16px !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    body.markets-page .livestock-photo-grid::-webkit-scrollbar,
    body.markets-page .livestock-card-grid::-webkit-scrollbar { display: none; }

    body.markets-page .livestock-photo-card,
    body.markets-page .livestock-card {
        flex: 0 0 min(84vw, 350px) !important;
        width: min(84vw, 350px) !important;
        scroll-snap-align: center;
        transform: none !important;
    }

    body.markets-page .researchers-minimal-copy,
    body.markets-page .policymakers-copy,
    body.markets-page .consultants-copy,
    body.markets-page .ngos-copy,
    body.markets-page .portal-showcase-copy {
        padding: 28px 22px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.markets-page .researchers-composition,
    body.markets-page .policymakers-visual,
    body.markets-page .consultants-visual,
    body.markets-page .ngos-visual {
        min-height: 390px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.markets-page .how-help-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    body.markets-page .help-experience-card {
        min-height: 490px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.markets-page .help-card-content {
        padding: 24px !important;
        transform: none !important;
    }

    body.markets-page .help-card-content p,
    body.markets-page .help-card-tags {
        opacity: 1 !important;
        transform: none !important;
    }

    body.markets-page .portal-visual-stage {
        min-height: 650px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.markets-page .portal-device-wrap {
        width: 88% !important;
        max-width: 460px !important;
        top: 37% !important;
    }

    body.markets-page .portal-feature-callout {
        max-width: calc(100% - 36px) !important;
    }

    /* Shared newsletter and footer. */
    body.ghg-wordpress-page .final-newsletter-section {
        padding-left: var(--ghg-mobile-gutter) !important;
        padding-right: var(--ghg-mobile-gutter) !important;
        margin-bottom: -44px !important;
    }

    body.ghg-wordpress-page .final-newsletter-card,
    body.ghg-wordpress-page .newsletter-box {
        grid-template-columns: 1fr !important;
        gap: 22px !important;
        padding: 28px 22px !important;
        border-radius: var(--ghg-mobile-radius) !important;
    }

    body.ghg-wordpress-page .premium-newsletter-form,
    body.ghg-wordpress-page .newsletter-box form {
        grid-template-columns: 1fr !important;
    }

    body.ghg-wordpress-page .premium-newsletter-form button,
    body.ghg-wordpress-page .newsletter-box button {
        width: 100%;
        min-height: 50px;
    }

    body.ghg-wordpress-page .premium-footer {
        padding: 112px var(--ghg-mobile-gutter) 42px !important;
    }

    body.ghg-wordpress-page .premium-footer-grid,
    body.ghg-wordpress-page .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    body.ghg-wordpress-page .premium-footer-grid > article,
    body.ghg-wordpress-page .footer-grid > * {
        border-radius: 24px !important;
    }

    /* Reduce decorative density and expensive blur on mobile. */
    body.ghg-wordpress-page .about-hero-particles span:nth-child(n+15),
    body.ghg-wordpress-page .contact-hero-particles span:nth-child(n+13),
    body.ghg-wordpress-page .flow-signal-particles span:nth-child(n+7),
    body.ghg-wordpress-page .help-title-particle:nth-child(n+7) {
        display: none !important;
    }
}

@media (max-width: 782px) {
    body.admin-bar .navbar { top: 46px; }
    body.admin-bar .ghg-mobile-menu { top: 124px; }
}

@media (max-width: 560px) {
    :root {
        --ghg-mobile-gutter: 18px;
        --ghg-mobile-radius: 23px;
    }

    body.ghg-wordpress-page .navbar {
        height: 64px !important;
    }

    body.ghg-wordpress-page .brand-text strong {
        max-width: 48vw;
        font-size: .7rem !important;
        letter-spacing: .14em !important;
    }

    .ghg-mobile-menu {
        top: 72px;
        left: 12px;
        right: 12px;
        border-radius: 22px;
    }

    body.admin-bar .ghg-mobile-menu { top: 118px; }

    body.ghg-home-page .hero-section {
        padding-top: 104px !important;
        padding-bottom: 39svh !important;
    }

    body.ghg-home-page .hero-content h1 {
        font-size: clamp(2.75rem, 15vw, 4.35rem) !important;
    }

    body.ghg-home-page .hero-buttons,
    body.about-page .about-hero-actions,
    body.markets-page .markets-hero-actions {
        grid-template-columns: 1fr !important;
    }

    body.ghg-home-page .model-glow {
        width: 108vw !important;
        height: 108vw !important;
        bottom: -4svh !important;
    }

    body.about-page .story-metrics article,
    body.about-page .goal-card,
    body.about-page .team-card,
    body.markets-page .livestock-photo-card,
    body.markets-page .livestock-card,
    body.ghg-home-page .why-card {
        flex-basis: 86vw !important;
        width: 86vw !important;
    }

    body.about-page .team-portrait {
        height: 290px !important;
    }

    body.markets-page .markets-orbit {
        width: 92vw !important;
        height: 92vw !important;
        transform: scale(.78);
    }

    body.markets-page .portal-visual-stage {
        min-height: 610px !important;
    }

    body.ghg-wordpress-page .loading-screen.flow-loader .flow-loader-shell {
        width: calc(100vw - 24px) !important;
        max-height: calc(100svh - 24px);
        padding: 15px !important;
        overflow-y: auto;
        border-radius: 24px !important;
    }

    body.ghg-wordpress-page .loading-screen.flow-loader .flow-loader-map {
        min-height: 230px !important;
        transform: scale(.86);
        transform-origin: center;
    }

    body.ghg-wordpress-page .loading-screen.flow-loader .flow-loader-top,
    body.ghg-wordpress-page .loading-screen.flow-loader .flow-loader-bottom {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    body.ghg-wordpress-page .button:hover,
    body.ghg-wordpress-page .team-card:hover,
    body.ghg-wordpress-page .partner-logo-card:hover,
    body.ghg-wordpress-page .help-experience-card:hover {
        transform: none !important;
    }
}

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

    body.ghg-wordpress-page *,
    body.ghg-wordpress-page *::before,
    body.ghg-wordpress-page *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
