/*
Theme Name: SomerScience
Protocol: SOT-CORE ACTIVE | v8.2 OPTIMIZED & FULLY MERGED
Status: GLOBAL STACKING LOCK + SEGMENT-AWARE PHYSICS + RUNOFF REPAIR
Purpose: Defines global layout, animations, and stacking contexts for the SomerScience theme.
Interactions: Applies to carousel blocks, countdown heroes, embed widgets, and UI entities.
*/

/* ============================================================================
   TABLE OF CONTENTS
   ============================================================================
   1. CSS VARIABLES
   2. GLOBAL RESET & LAYOUT
   3. TYPOGRAPHY & WORD BREAKING
   4. HEADER NAVIGATION
   5. CAROUSEL COMPONENTS
   6. HERO & COUNTDOWN BLOCKS
   7. EMBED WIDGETS
   8. ANIMATIONS & ENTITIES
   9. TESTIMONIALS
   10. APB BLOCKS (Quote, Multi-Row, Image Grid)
   11. CONTACT FORM 7 FIXES
   12. NEWSLETTER FORMS
   13. CONTACT SECTION
   14. RESPONSIVE OVERRIDES
   ============================================================================ */

/* ============================================================================
   1. CSS VARIABLES
   ============================================================================ */
:root {
    --ss-nav-bg: var(--wp--preset--color--trust-teal);
    --ss-nav-hover: var(--wp--preset--color--trust-yellow);
    --ss-nav-accent: var(--wp--preset--color--trust-lime);
    --ss-cta-bg: var(--wp--preset--color--trust-orange);
    --ss-white: var(--wp--preset--color--white);
    --ss-black: var(--wp--preset--color--black);
    --ss-gray-dark: #1f2937;
    --ss-rotation: 0deg;
    --scale: 1;
}

/* ============================================================================
   2. GLOBAL RESET & LAYOUT
   ============================================================================ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
    margin: 0;
    padding: 0;
}
/* Apply to everything - prevents horizontal overflow globally */
*, *:before, *:after {
    box-sizing: border-box;
}
/* ============================================================================
   3. TYPOGRAPHY & WORD BREAKING
   ============================================================================ */
.not-prose h1, 
.not-prose h2, 
.not-prose h3 {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto;
}

.ss-description-wrap p {
    margin-bottom: 1.5rem;
    overflow-wrap: break-word; 
}

.ss-description-wrap p:last-child {
    margin-bottom: 0; 
}

/* ============================================================================
   4. HEADER NAVIGATION
   ============================================================================ */

/* --- 4.1 Header Core --- */
.ss-header-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999 !important;
    background-color: var(--ss-nav-bg);
    box-shadow: var(--wp--preset--shadow--medium);
    transition: all 0.5s ease;
}

/* --- 4.2 Desktop Menu --- */
.ss-header-nav .ss-desktop-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
    align-items: center;
}

.ss-header-nav .ss-desktop-menu > li {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ss-header-nav .ss-desktop-menu > li > a {
    color: white;
    font-weight: 500;
    font-size: 1.125rem;
    padding: 0.5rem 0;
    text-decoration: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
}

.ss-header-nav .ss-desktop-menu > li > a:hover {
    color: #e8be23;
}

.ss-header-nav .ss-desktop-menu > li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    margin-left: 0.375rem;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.3s;
}

.ss-header-nav .ss-desktop-menu > li.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

/* --- 4.3 Desktop Dropdown --- */
.ss-header-nav .ss-desktop-menu .sub-menu {
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 14rem;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    list-style: none;
    margin: 0.5rem 0 0 0;
    padding: 0.5rem 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.ss-header-nav .ss-desktop-menu > li.menu-item-has-children:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
}

.ss-header-nav .ss-desktop-menu .sub-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.ss-header-nav .ss-desktop-menu .sub-menu li a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #1f2937;
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.ss-header-nav .ss-desktop-menu .sub-menu li a:hover {
    background-color: rgba(196, 211, 116, 0.2);
    color: #32a198;
}

.ss-header-nav .ss-desktop-menu .sub-menu li.menu-item-has-children > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ss-header-nav .ss-desktop-menu .sub-menu li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    margin-left: auto;
    padding-left: 1rem;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 5px solid currentColor;
}

.ss-header-nav .ss-desktop-menu .sub-menu .sub-menu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-top: 0;
    margin-left: 0.25rem;
}

.ss-header-nav .ss-desktop-menu .sub-menu li.menu-item-has-children:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
}

/* --- 4.4 Mobile Toggle & Desktop Button --- */
.ss-header-nav .ss-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ss-header-nav .ss-desktop-button {
    display: none;
}

/* --- 4.5 Mobile Menu Modal --- */
.ss-header-nav .ss-mobile-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.ss-header-nav .ss-mobile-modal.is-open {
    display: block;
}

.ss-header-nav .ss-mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background-color 0.4s ease-out;
}

.ss-header-nav .ss-mobile-modal.is-animate-in .ss-mobile-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.ss-header-nav .ss-mobile-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    max-width: 85%;
    background: white;
    box-sizing: border-box;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateX(-100%);
    transition: transform 0.4s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ss-header-nav .ss-mobile-modal.is-animate-in .ss-mobile-panel {
    transform: translateX(0);
}

.ss-header-nav .ss-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ss-header-nav .ss-mobile-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-header-nav .ss-mobile-close {
    padding: 0.5rem;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
    margin-left: 1rem;
}

.ss-header-nav .ss-mobile-close:hover {
    color: #1f2937;
}

.ss-header-nav .ss-mobile-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ss-header-nav .ss-mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: white;
    transform: translateX(100%);
    transition: transform 0.5s ease-out, visibility 0.4s;
    visibility: hidden;
}

.ss-header-nav .ss-mobile-menu.is-active {
    transform: translateX(0);
    visibility: visible;
}

.ss-header-nav .ss-mobile-menu.is-exiting-left {
    transform: translateX(-30%);
}

.ss-header-nav .ss-mobile-menu.is-entering-from-left {
    transform: translateX(-100%);
}

.ss-header-nav .ss-mobile-menu li {
    border-bottom: 1px solid #e5e7eb;
}

.ss-header-nav .ss-mobile-menu li:last-child {
    border-bottom: none;
}

.ss-header-nav .ss-mobile-menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: #1f2937;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.ss-header-nav .ss-mobile-menu a:hover,
.ss-header-nav .ss-mobile-menu a:focus {
    background-color: rgba(196, 211, 116, 0.2);
    color: #32a198;
}

.ss-header-nav .ss-mobile-submenu-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.5rem;
    color: #1f2937;
    font-weight: 500;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-family: inherit;
    font-size: inherit;
}

.ss-header-nav .ss-mobile-submenu-btn:hover,
.ss-header-nav .ss-mobile-submenu-btn:focus {
    background-color: rgba(196, 211, 116, 0.2);
    color: #32a198;
}

.ss-header-nav .ss-mobile-submenu-btn svg {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.ss-header-nav .ss-mobile-submenu-btn:hover svg,
.ss-header-nav .ss-mobile-submenu-btn:focus svg {
    transform: translateX(3px);
}

.ss-header-nav .ss-mobile-menu-back {
    background: #f9fafb;
}

.ss-header-nav .ss-mobile-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.5rem;
    color: #6b7280;
    font-weight: 600;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-family: inherit;
    font-size: inherit;
}

.ss-header-nav .ss-mobile-back-btn:hover,
.ss-header-nav .ss-mobile-back-btn:focus {
    background-color: #f3f4f6;
    color: #1f2937;
}

.ss-header-nav .ss-mobile-back-btn svg {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.ss-header-nav .ss-mobile-back-btn:hover svg,
.ss-header-nav .ss-mobile-back-btn:focus svg {
    transform: translateX(-3px);
}

.ss-header-nav .ss-mobile-menu-viewall {
    background: linear-gradient(to right, rgba(196, 211, 116, 0.1), rgba(50, 161, 152, 0.1));
}

.ss-header-nav .ss-mobile-viewall-link {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem !important;
    color: #32a198 !important;
    font-weight: 600 !important;
    text-decoration: none;
    transition: background-color 0.2s;
}

.ss-header-nav .ss-mobile-viewall-link:hover,
.ss-header-nav .ss-mobile-viewall-link:focus {
    background-color: rgba(196, 211, 116, 0.3) !important;
}

.ss-header-nav .ss-mobile-viewall-link svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: transform 0.2s;
}

.ss-header-nav .ss-mobile-viewall-link:hover svg,
.ss-header-nav .ss-mobile-viewall-link:focus svg {
    transform: translateX(3px);
}

.ss-header-nav .ss-mobile-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.ss-header-nav .ss-mobile-cta {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.875rem 1.5rem;
    background: #ef8800;
    color: white;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 9999px;
    transition: background-color 0.2s, transform 0.2s;
}

.ss-header-nav .ss-mobile-cta:hover,
.ss-header-nav .ss-mobile-cta:focus {
    background: #d97706;
    transform: scale(1.02);
}

/* ============================================================================
   5. CAROUSEL COMPONENTS
   ============================================================================ */

/* --- 5.1 Carousel Core --- */
.ss-carousel-root {
    position: relative;
    isolation: isolate;
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.ss-carousel-root > .relative {
    width: 100% !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

.ss-carousel-root .animate-scroll {
    display: flex;
    width: max-content;
    animation: scrollMarquee var(--scroll-speed, 60s) linear infinite;
    will-change: transform;
}

.ss-carousel-root .carousel-track.pause-on-hover:hover {
    animation-play-state: paused;
}

.carousel-track {
    display: flex;
    width: max-content;
}

/* --- 5.2 Carousel Isolation Block --- */
.ss-carousel-isolation-block {
    overflow: hidden !important;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* --- 5.3 Carousel Interaction Physics --- */
.ss-carousel-root.grayscale-enabled .carousel-item,
.ss-carousel-root.mode-sunrise .carousel-item {
    filter: grayscale(100%) opacity(0.6);
    transition: filter 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

.ss-carousel-root.grayscale-enabled:not(.mode-sunrise):hover .carousel-item:hover {
    filter: grayscale(0%) opacity(1);
}

.ss-carousel-root.mode-sunrise .carousel-item.is-spotlight {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.1);
    z-index: 100;
}

/* --- 5.4 Carousel Navigation --- */
.ss-carousel-viewport {
    position: relative;
    display: block;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.js-carousel-prev,
.js-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    pointer-events: auto;
    background: white;
    border: 1px solid #32a198;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.js-carousel-prev { 
    left: 10px; 
}

.js-carousel-next { 
    right: 10px; 
}

.js-carousel-prev:hover,
.js-carousel-next:hover {
    background: #32a198;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

/* --- 5.5 Carousel Heading Container --- */
.ss-carousel-root > div > div:first-of-type {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* --- 5.6 SVG Layer --- */
.ss-svg-layer {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    -webkit-mask-repeat: repeat;
    mask-repeat: repeat;
    -webkit-mask-size: clamp(100px, 20vw, 300px);
    mask-size: clamp(100px, 20vw, 300px);
}

/* --- 5.7 Mobile Carousel Fixes --- */
@media (max-width: 767px) {
    .ss-carousel-root {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* CRITICAL FIX: Remove asymmetric padding */
    .ss-carousel-root > div {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Center the title block and remove any offset */
    .ss-carousel-root > div > div:first-of-type {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        text-align: center !important;
    }

    .ss-carousel-root h2 {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        word-break: break-word; 
    }

    /* BALANCE FIX: Equal button spacing from edges */
    .js-carousel-prev {
        left: 0.75rem !important;
        width: 36px;
        height: 36px;
    }

    .js-carousel-next {
        right: 0.75rem !important;
        width: 36px;
        height: 36px;
    }

    /* Force carousel isolation block to be perfectly centered */
    .ss-carousel-isolation-block {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
    }

    /* Ensure viewport has no phantom padding */
    .ss-carousel-viewport {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Remove any padding from the track itself */
    .carousel-track {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (max-width: 480px) {
    .js-carousel-prev,
    .js-carousel-next {
        width: 32px;
        height: 32px;
    }
}

/* --- 5.5 SVG Layer --- */
.ss-svg-layer {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    -webkit-mask-repeat: repeat;
    mask-repeat: repeat;
    -webkit-mask-size: clamp(100px, 20vw, 300px);
    mask-size: clamp(100px, 20vw, 300px);
}

/* ============================================================================
   6. HERO & COUNTDOWN BLOCKS
   ============================================================================ */
.wp-block-ss-block-theme-countdown-hero {
    background-color: transparent;
}

.ss-countdown-hero h1,
.ss-countdown-hero h2 {
    margin-top: 0;
    margin-bottom: 0;
}

.wp-block-ss-block-theme-countdown-hero h1.font-heading {
    line-height: 1.1;
    font-size: clamp(2.25rem, 8vw + 1rem, 5.5rem);
}

.wp-block-ss-block-theme-countdown-hero h2.font-body {
    line-height: 1.4;
    font-size: clamp(1.25rem, 2.5vw + 1rem, 2.25rem);
}

.wp-block-ss-block-theme-countdown-hero .countdown-value {
    line-height: 1;
    font-size: clamp(2rem, 6vw + 1rem, 4.5rem);
    font-variant-numeric: tabular-nums;
    display: inline-block;
    min-width: 1.2em;
    text-align: center;
}

/* --- Section Title --- */
.wp-block-ss-block-theme-section-title {
    isolation: isolate; 
}

.wp-block-ss-block-theme-section-title h2 {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    font-size: clamp(1.8rem, 8vw, 2.25rem) !important; 
}

.wp-block-ss-block-theme-section-title p {
    font-size: var(--step-0);
    line-height: 1.7;
    margin-bottom: 1.5rem !important; 
    opacity: 0.9;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wp-block-ss-block-theme-section-title p:last-child {
    margin-bottom: 0 !important;
    font-weight: 700;
}

/* --- Block Spacing --- */
.wp-block-ss-block-theme-intro,
.mission-block {
    padding-top: 4em !important;
}

/* ============================================================================
   7. EMBED WIDGETS
   ============================================================================ */
.ss-embed-widget-block {
    position: relative;
    overflow: visible;
}

.ss-embed-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ss-embed-title {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.ss-embed-widget {
    position: relative;
    z-index: 10;
    pointer-events: auto;
    width: 100%;
}

.ss-embed-widget .StripeElement {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.ss-embed-widget .calendly-inline-widget {
    min-height: 600px;
}

.ss-embed-widget .jg-button-container {
    display: flex;
    justify-content: center;
}

.ss-embed-widget iframe {
    max-width: 100%;
    border: none;
    border-radius: 4px;
}

.ss-embed-widget-block.ss-embed-bg-enabled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- JustGiving Brand Alignment --- */
.ss-script-engine-output .jg-button-container,
.ss-script-engine-output [data-widgettype="donateButton"] {
    display: flex !important;
    justify-content: inherit;
    margin: 0 auto;
}

.ss-script-engine-output iframe,
.ss-script-engine-output a {
    font-family: var(--wp--preset--font-family--primary) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.ss-script-engine-output:hover iframe {
    transform: translateY(-2px);
}

/* ============================================================================
   8. ANIMATIONS & ENTITIES
   ============================================================================ */

/* --- Keyframes --- */
@keyframes scrollMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes scroll-loop {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes ss-sparkle-float {
    0%, 100% { transform: scale(0.8) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(20deg); opacity: var(--sparkle-opacity, 1); }
}

@keyframes ss-drift {
    0%   { transform: translate(0,0) scale(var(--scale)); }
    100% { transform: translate(var(--dx), var(--dy)) scale(var(--scale)); }
}

@keyframes ss-pulse {
    0%, 100% { opacity: var(--sparkle-opacity); }
    50%      { opacity: calc(var(--sparkle-opacity) * 0.7); }
}

@keyframes ss-flicker {
    0%, 100% { opacity: var(--sparkle-opacity); }
    40%      { opacity: calc(var(--sparkle-opacity) * 0.5); }
    60%      { opacity: calc(var(--sparkle-opacity) * 0.8); }
}

@keyframes ss-rotate {
    from { transform: rotate(0deg) scale(var(--scale)); }
    to   { transform: rotate(360deg) scale(var(--scale)); }
}

@keyframes ss-glow-pulse {
    0%, 100% { opacity: calc(var(--glow-opacity) * 0.6); }
    50%      { opacity: var(--glow-opacity); }
}

@keyframes ss-glow-wander {
    0%   { transform: translate(0,0); }
    100% { transform: translate(20px, -20px); }
}

@keyframes ss-bounce-right {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

@keyframes ss-bounce-left {
    0%, 100% { transform: scaleX(-1) translateX(0); }
    50% { transform: scaleX(-1) translateX(10px); }
}

@keyframes testimonial-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Sparkle Entities --- */
.ss-sparkle-entity {
    position: absolute;
    font-size: 1.25rem;
    color: var(--sparkle-color);
    opacity: var(--sparkle-opacity);
    pointer-events: none;
    will-change: transform, opacity;
    text-shadow: 0 0 6px var(--sparkle-color);
}

.ss-sparkle-entity[z-index="1"] { filter: blur(1px); }
.ss-sparkle-entity[z-index="2"] { filter: blur(0.5px); }
.ss-sparkle-entity[z-index="3"] { filter: blur(0px); }

/* --- Glow Animations --- */
.ss-glow-anim {
    animation: ss-glow-pulse var(--glow-speed) ease-in-out infinite;
    opacity: var(--glow-opacity, 0.5);
}

.ss-glow-wander {
    animation: ss-glow-wander var(--glow-speed) ease-in-out infinite alternate;
    opacity: var(--glow-opacity, 0.5);
}

/* --- Hand Pointers --- */
.ss-hand-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 20px;
    color: #e8be23;
    width: 60px;
    height: 60px;
    z-index: 70;
}

.ss-hand-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.ss-hand-left {
    animation: ss-bounce-right 1s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.ss-hand-right {
    transform: scaleX(-1);
    animation: ss-bounce-left 1s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Kinetic Physics --- */
.ss-scroll-revolve {
    will-change: transform;
    transform: rotate(var(--ss-rotation, 0deg)) scale(var(--scale, 1)) translateZ(0);
    transition: transform 0.1s linear;
}

/* ============================================================================
   9. TESTIMONIALS
   ============================================================================ */
.animate-testimonial-scroll {
    animation: testimonial-scroll 50s linear infinite;
}

.carousel-container:hover .animate-testimonial-scroll {
    animation-play-state: paused;
}

/* ============================================================================
   10. APB BLOCKS (Quote, Multi-Row, Image Grid)
   ============================================================================ */

/* --- 10.1 APB Container --- */
.apb-container .apb-main-wrapper {
    max-width: 80em;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- 10.2 APB Quote Block (6 Presets) --- */
.apb-quote {
    position: relative;
    margin: 0;
    padding: 1.5em 2em;
    font-style: italic;
    line-height: 1.7;
}

.apb-quote .apb-quote-text {
    margin: 0 0 1em;
    font-size: 1.15em;
}

.apb-quote .apb-quote-footer {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.apb-quote .apb-quote-author {
    font-style: normal;
    font-weight: 600;
    font-size: 0.95em;
}

.apb-quote .apb-quote-author-title {
    font-style: normal;
    font-size: 0.85em;
    opacity: 0.75;
}

/* Preset 1: Classic Border */
.apb-quote.is-preset-classic {
    border-left: 5px solid #32a198;
    background-color: rgba(50, 161, 152, 0.06);
    border-radius: 0 8px 8px 0;
    padding-left: 2em;
}

.apb-quote.is-preset-classic::before {
    content: '\201C';
    position: absolute;
    top: -0.2em;
    left: 0.3em;
    font-size: 4em;
    color: #32a198;
    opacity: 0.3;
    line-height: 1;
    font-style: normal;
}

/* Preset 2: Minimal Line */
.apb-quote.is-preset-minimal {
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    padding: 1.5em 0;
    text-align: center;
}

.apb-quote.is-preset-minimal .apb-quote-footer {
    align-items: center;
    margin-top: 1em;
}

.apb-quote.is-preset-minimal .apb-quote-author::before {
    content: '— ';
}

/* Preset 3: Bold Shadow */
.apb-quote.is-preset-bold {
    background-color: #1e293b;
    color: #f1f5f9;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 2.5em;
}

.apb-quote.is-preset-bold::before {
    content: '\201C';
    position: absolute;
    top: 0.1em;
    left: 0.4em;
    font-size: 5em;
    color: #facc15;
    opacity: 0.4;
    line-height: 1;
    font-style: normal;
}

.apb-quote.is-preset-bold .apb-quote-author {
    color: #facc15;
}

.apb-quote.is-preset-bold .apb-quote-author-title {
    color: #94a3b8;
    opacity: 1;
}

/* Preset 4: Gradient BG */
.apb-quote.is-preset-gradient {
    background: linear-gradient(135deg, #32a198 0%, #a5cbdd 50%, #c4d374 100%);
    color: #fff;
    border-radius: 12px;
    padding: 2.5em;
    box-shadow: 0 8px 32px rgba(50, 161, 152, 0.3);
}

.apb-quote.is-preset-gradient::before {
    content: '\201C';
    position: absolute;
    top: 0.1em;
    left: 0.4em;
    font-size: 5em;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1;
    font-style: normal;
}

.apb-quote.is-preset-gradient .apb-quote-author {
    color: #fff;
}

.apb-quote.is-preset-gradient .apb-quote-author-title {
    color: rgba(255, 255, 255, 0.8);
    opacity: 1;
}

/* Preset 5: Soft Accent */
.apb-quote.is-preset-soft {
    background-color: #fef9ec;
    border-left: 4px solid #facc15;
    border-radius: 0 12px 12px 0;
    padding: 2em 2.5em;
}

.apb-quote.is-preset-soft::before {
    content: '\201C';
    position: absolute;
    top: -0.1em;
    left: 0.4em;
    font-size: 4em;
    color: #facc15;
    opacity: 0.5;
    line-height: 1;
    font-style: normal;
}

.apb-quote.is-preset-soft .apb-quote-author {
    color: #b45309;
}

/* Preset 6: Modern Minimal */
.apb-quote.is-preset-modern {
    text-align: center;
    padding: 2em 3em;
}

.apb-quote.is-preset-modern::before {
    content: '\201C';
    display: block;
    font-size: 6em;
    line-height: 0.8;
    color: #32a198;
    opacity: 0.4;
    margin-bottom: 0.2em;
    font-style: normal;
}

.apb-quote.is-preset-modern .apb-quote-text {
    font-size: 1.3em;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.apb-quote.is-preset-modern .apb-quote-footer {
    align-items: center;
    margin-top: 1.2em;
}

.apb-quote.is-preset-modern .apb-quote-author::before {
    content: '— ';
}

/* --- 10.3 Multi-Row Grid --- */
.ss-multi-row__grid,
.ss-multi-row__media-multi {
    box-sizing: border-box !important;
}

.ss-multi-row__grid {
    width: 100% !important;
    max-width: 100vw !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    margin: 0 auto !important;
}

/* ============================================================================
   11. CONTACT FORM 7 FIXES
   ============================================================================ */
.wpcf7-form-control-wrap {
    display: block !important;
    width: 100% !important;
}

.wpcf7-form-control.wpcf7-text,
.wpcf7-form-control.wpcf7-email {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

.wpcf7-response-output {
    margin: 1em 0 0 0 !important;
}

/* ============================================================================
   12. NEWSLETTER FORMS
   ============================================================================ */
.newsletter-input,
.ss-newsletter-input {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.5rem !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #111827 !important;
    font-size: 1rem !important;
    transition: all 0.3s ease-in-out !important;
}

.newsletter-input:focus,
.ss-newsletter-input:focus {
    outline: none !important;
    border-color: transparent !important;
    box-shadow: 0 0 0 2px #e8be23 !important;
}

.ss-focus-ring:focus {
    --tw-ring-color: #e8be23;
    box-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
}

.ss-nl-wrapper .wpcf7-form-control-wrap {
    display: block !important;
    width: 100% !important;
}

.ss-nl-wrapper input.ss-newsletter-input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.ss-nl-wrapper button[type="submit"] {
    display: block !important;
    width: 100% !important;
}

.newsletter-form-container,
.ss-nl-wrapper {
    max-width: 100% !important;
    overflow: hidden !important;
}

.newsletter-form-container button[type="submit"],
.ss-nl-wrapper button[type="submit"] {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* ============================================================================
   13. CONTACT SECTION
   ============================================================================ */
.wp-block-ss-block-theme-contact-section .grid {
    display: grid !important;
    align-items: stretch !important;
}

.wp-block-ss-block-theme-contact-section a[href^="mailto"] {
    text-decoration-thickness: 2px;
    text-underline-offset: 12px;
    font-size: 1.25rem !important;
}

.wp-block-ss-block-theme-contact-section .flex.space-x-4 a {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wp-block-ss-block-theme-contact-section .flex.space-x-4 a:hover {
    transform: scale(1.1);
    background-color: rgba(232, 190, 35, 0.3) !important;
}

.wp-block-ss-block-theme-contact-section .space-y-10 > div {
    padding-bottom: 0 !important;
    margin-bottom: 0;
}

.wp-block-ss-block-theme-contact-section .space-y-10 {
    margin-top: 0 !important;
    gap: 1.25rem;
    display: flex;
    flex-direction: column;
}

.wp-block-ss-block-theme-contact-section .lg\:grid-cols-2 > div:first-child {
    height: auto !important;
}

.wp-block-ss-block-theme-contact-section .pt-8.mt-10.border-t {
    margin-top: 1.5rem !important;
    padding-top: 1.5rem !important;
    flex-shrink: 0;
}

.wp-block-ss-block-theme-contact-section .grid.grid-cols-1.md\:grid-cols-2 {
    gap: 1.5rem !important;
}

/* ============================================================================
   14. RESPONSIVE OVERRIDES
   ============================================================================ */

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
    .ss-header-nav .ss-desktop-menu {
        display: flex;
    }
    .ss-header-nav .ss-mobile-toggle {
        display: none;
    }
    .ss-header-nav .ss-desktop-button {
        display: block;
    }
}

/* --- Tablet & Mobile (768px and below) --- */
@media (max-width: 768px) {
    /* Global inline style override */
    h1[style], .font-heading[style] { 
        font-size: clamp(2rem, 8vw, 3rem) !important; 
        line-height: 1.1 !important; 
    }
    h2[style] { 
        font-size: clamp(1.75rem, 6vw, 2.25rem) !important; 
        line-height: 1.2 !important; 
    }
    h3[style] { 
        font-size: clamp(1.5rem, 5vw, 1.75rem) !important; 
        line-height: 1.3 !important; 
    }
    p[style*="font-size"] { 
        font-size: var(--step-0) !important; 
        line-height: 1.6 !important;
    }

    .not-prose h1 br,
    .not-prose h2 br,
    .not-prose h3 br,
    .not-prose p br {
        display: inline !important; 
        content: ' ' !important;    
        margin: 0 !important;
    }
    
    .ss-description-wrap br {
        display: block !important;
        margin-top: 0.5rem !important; 
    }

    .wp-block-ss-block-theme-countdown-hero h1.font-heading {
        font-size: clamp(1.5rem, 6vw + 0.5rem, 2.5rem);
    }

    .wp-block-ss-block-theme-countdown-hero h2.font-body {
        font-size: clamp(0.9rem, 2vw + 0.5rem, 1.5rem);
    }

    .js-carousel-prev, .js-carousel-next {
        width: 36px;
        height: 36px;
    }

    .ss-svg-layer {
        -webkit-mask-size: 150px;
        mask-size: 150px;
    }

    .ss-embed-container { 
        padding: 0 12px; 
    }

    .ss-embed-title { 
        font-size: 14px; 
    }

    .ss-embed-widget .calendly-inline-widget { 
        min-height: 400px; 
    }

    .apb-container .apb-main-wrapper {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    /* Mobile Grid Stacking */
    .ss-mobile-stack-grid {
        grid-template-columns: 1fr !important; 
        gap: 2rem !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .ss-mobile-stack-grid[style*="direction:rtl"] {
        direction: ltr !important;
    }

    .ss-mobile-stack-grid figure,
    .ss-mobile-stack-grid .apb-image-block {
        width: 100% !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Carousel Mobile Fixes */
    .ss-carousel-root {
        overflow-x: hidden !important;
        width: 100vw !important;
        position: relative !important;
    }

    .ss-carousel-root .max-w-4xl {
        width: 100% !important;
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center !important;
    }
    
    .ss-carousel-root h2 {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        margin: 0 auto !important;
        word-break: break-word; 
    }
}

/* --- Small Mobile (480px and below) --- */
@media (max-width: 480px) {
    .wp-block-ss-block-theme-countdown-hero h1.font-heading {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
    }

    .wp-block-ss-block-theme-countdown-hero h2.font-body {
        font-size: clamp(0.85rem, 1.5vw, 1.125rem);
    }

    .js-carousel-prev, .js-carousel-next {
        width: 32px;
        height: 32px;
    }

    .ss-svg-layer {
        -webkit-mask-size: 100px;
        mask-size: 100px;
    }

    .ss-carousel-root .carousel-item {
        flex-shrink: 0;
        width: auto;
    }

    .ss-embed-title { 
        font-size: 13px; 
    }

    .ss-embed-widget { 
        font-size: 14px; 
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .ss-header-nav .ss-mobile-panel,
    .ss-header-nav .ss-mobile-menu,
    .ss-header-nav .ss-mobile-backdrop,
    .ss-header-nav .ss-mobile-submenu-btn svg,
    .ss-header-nav .ss-mobile-back-btn svg,
    .ss-header-nav .ss-mobile-viewall-link svg {
        transition: none !important;
    }
}
.ss-scroll-revolve {
    will-change: transform;
    transition: transform 0.1s linear;
}
/* ============================================================================
   15. SOMERSCIENCE: VERTICAL TABS (Accordion-Hybrid Engine)
   ============================================================================ */

/* --- Root Containment --- */
.ss-capabilities-wrapper {
    overflow-x: hidden !important; 
    width: 100%;
    max-width: 100vw;
}

.ss-vtabs-main-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* --- RESPONSIVE IMAGE SCALING --- */
/* Mobile: Force 100% width regardless of slider setting */
.ss-pane-image-wrapper {
    width: 100% !important; 
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure the image itself doesn't overflow its container */
.ss-tab-pane img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* Desktop: Apply the slider percentage from the PHP variable */
@media (min-width: 1024px) {
    .ss-pane-image-wrapper {
        width: var(--pane-img-width, 100%) !important; 
    }
}

/* --- Mobile Content Pane Fix --- */
.ss-tab-pane {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden; 
}

/* --- Desktop Grid Engine --- */
@media (min-width: 1024px) {
    .ss-vtabs-main-grid {
        display: grid;
        grid-template-columns: 320px 1fr;
        grid-auto-rows: min-content;
        align-items: start;
        
        /* CRITICAL FIX: Kill row gap so spanned empty rows collapse to 0 height */
        gap: 0 4rem !important; 
    }

    .ss-tab-item-group {
        display: contents;
    }

    .ss-tab-btn {
        grid-column: 1;
        margin-bottom: 1rem; /* Spacing moved here to prevent grid-row height explosion */
    }

    .ss-tab-pane {
        grid-column: 2;
        /* All active panes sit in row 1 of the second column */
        grid-row: 1 / span 100; 
        margin-top: 0 !important;
        min-height: 500px;
    }

    /* Flipped Layout Support */
    .ss-vtabs-main-grid.is-flipped { grid-template-columns: 1fr 320px; }
    .ss-vtabs-main-grid.is-flipped .ss-tab-btn { grid-column: 2; }
    .ss-vtabs-main-grid.is-flipped .ss-tab-pane { grid-column: 1; }
}

/* --- Smooth Transitions --- */
.ss-tab-pane.hidden {
    display: none !important;
}

.ss-tab-pane:not(.hidden) {
    display: block;
    animation: ssTabEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ssTabEnter {
    0% { opacity: 0; transform: translateY(10px) scale(0.99); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Typography & Centering --- */
.ss-capabilities-wrapper .ss-pane-title {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1 !important;
    align-self: center !important;
    display: flex;
    align-items: center;
}

/* --- Tab Button States --- */
.ss-tab-btn {
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    scroll-margin-top: 140px; /* Buffer for scrolling under sticky headers */
}

.ss-tab-btn.is-active { 
    border-color: transparent !important; 
}

.ss-tab-progress { 
    transition: width 50ms linear; 
}

/* --- Tab Button Hover State Fix --- */
.ss-capabilities-wrapper .ss-tab-btn:hover:not(.is-active) {
    background-color: #ffffff !important; 
    border-color: #f3f4f6 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

/* --- Mobile Spacing Tightener (Aggressive) --- */
@media (max-width: 1023px) {
    /* 1. Shrink the white box padding and kill the top margin */
    .ss-capabilities-wrapper .ss-tab-pane {
        margin-top: 0 !important;
        padding: 1rem !important; /* Reduces 24px padding to 16px */
    }

    /* 2. Crush the massive 32px flex gap between the empty text div and the image */
    .ss-capabilities-wrapper .ss-tab-pane > .flex-col {
        gap: 0.5rem !important; /* Reduces 32px gap to 8px on mobile */
    }

    /* 3. Pull the button text/icon closer to the expanding pane */
    .ss-capabilities-wrapper .ss-tab-btn {
        padding-bottom: 0.5rem !important; 
    }
    
    /* 4. Completely hide the text container if it renders empty so it stops creating a gap */
    .ss-capabilities-wrapper .ss-tab-pane .flex-grow:empty {
        display: none !important;
    }
}