/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors from Figma */
    --dark-bg: #0C0C0C; /* PRIMARY K */
    --text-white: #FFFFFF; /* PRIMARY WHITE */
    --accent-yellow: #E1FF00;
    --nav-black: #000000;
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-display: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-primary);
    background-color: var(--dark-bg);
    color: var(--text-white);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fixed Navigation Bar */
.navbar-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 1728px;
    margin: 0 auto;
    height: 89px;
    z-index: 1000;
    background-color: transparent;
}

.navbar-fixed .nav-logo {
    position: absolute;
    left: 224px;
    top: 0;
    width: 288px;
    height: 89px;
    z-index: 1001;
}

.navbar-fixed .nav-link {
    position: absolute;
    background: var(--text-white);
    border: none;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    line-height: 24px;
    letter-spacing: -1.68px;
    color: var(--dark-bg);
    padding: 0;
    text-decoration: none;
    transition: opacity 0.2s ease;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.navbar-fixed .nav-what-we-do {
    left: 586px;
    top: 33px;
    width: 119px;
    height: 24px;
}

.navbar-fixed .nav-about-us {
    left: 774px;
    top: 33px;
    width: 93px;
    height: 24px;
}

.navbar-fixed .nav-senior-team {
    left: 936px;
    top: 33px;
    width: 121px;
    height: 24px;
}

.navbar-fixed .nav-clients {
    left: 1126px;
    top: 33px;
    width: 71px;
    height: 24px;
}

.navbar-fixed .nav-email {
    left: 1266px;
    top: 33px;
    width: 58px;
    height: 24px;
}

.navbar-fixed .nav-link:hover {
    opacity: 0.7;
}

.navbar-fixed .toggle-overlay {
    position: absolute;
    left: 1638px;
    top: 26px;
    width: 51px;
    height: 31px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Toggle Button from Figma */
.toggle-button {
    display: flex;
    width: 51px;
    height: 31px;
    padding: 2px 22px 2px 2px;
    align-items: center;
    flex-shrink: 0;
    border-radius: 100px;
    background: rgba(120, 120, 128, 0.16);
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.toggle-overlay:hover .toggle-button {
    background: rgba(120, 120, 128, 0.24);
}

.toggle-icon {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background-color: var(--text-white);
    position: relative;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

/* Diamond icon with circle inside for "Off" state */
.toggle-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border: 2px solid var(--dark-bg);
    border-radius: 2px;
    transition: border-color 0.3s ease;
}

/* "On" state styles */
.toggle-overlay[data-state="on"] .toggle-button {
    background: rgba(0, 0, 0, 0.1);
}

.toggle-overlay[data-state="on"] .toggle-icon {
    transform: translateX(20px);
    background-color: var(--dark-bg);
}

.toggle-overlay[data-state="on"] .toggle-icon::before {
    border-color: var(--text-white);
}

/* Main Container - 1728px wide, matches Figma frame */
.main-container {
    position: relative;
    width: 1728px;
    min-height: 9583px; /* Ticker bottom: 9553px + 30px height = 9583px (was 9939px) */
    margin: 0 auto;
    background-color: var(--dark-bg);
    z-index: 1; /* Above background images */
}

/* Background Images - Positioned absolutely, covering sections with 20% opacity */
.bg-image {
    position: absolute;
    left: 0;
    width: 1728px;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-image .bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    opacity: 0.2; /* 20% opacity as per Figma */
    display: block;
}

/* Specific heights for each background image section */
.bg-1 {
    height: 2000px;
}

.bg-2 {
    height: 1500px;
    /* Positioned at top: 2000px in HTML */
}

.bg-3 {
    height: 1300px;
    /* Positioned at top: 3500px in HTML */
}

.bg-4 {
    height: 1100px;
    /* Positioned at top: 4800px in HTML */
}

/* bg-5: Clients section - Use CSS background with repeat-y to prevent stretching
   Original image: 2000x1545px (aspect ratio: 1.294:1)
   Scaled to 1728px wide = 1334px tall (maintains aspect ratio)
   Container height: 3700px (will repeat vertically) */
.bg-5 {
    height: 3700px;
    /* Positioned at top: 5900px in HTML */
    background-size: 1728px 1334px !important; /* Explicit width and height to maintain aspect ratio */
    background-repeat: repeat-y !important; /* Tile vertically - NO STRETCHING */
    background-position: center top !important;
    opacity: 0.2 !important; /* 20% opacity */
}

.bg-5 .bg-img {
    display: none !important; /* Hide img element, using CSS background instead */
}

.bg-6 {
    height: 30px; /* Cropped to stop exactly at ticker (ticker top: 9553px) */
    /* Positioned at top: 9523px in HTML, ends at 9553px (ticker start) */
}

/* Text Banner - Animated CSS/JS version */
.text-banner-overlay {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

.text-banner-animated {
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-size: 48px;
    line-height: 52px;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.text-banner-static {
    display: inline-block;
    font-weight: 400; /* Helvetica regular */
}

.text-banner-changing {
    display: inline-block;
    color: var(--text-white);
    font-weight: 700; /* Helvetica bold */
    position: relative;
}

.text-banner-changing::after {
    content: '|';
    display: inline-block;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* White theme - change text color */
body.theme-white .text-banner-animated {
    color: var(--dark-bg);
}

body.theme-white .text-banner-changing {
    color: var(--dark-bg);
}

body.theme-white .text-banner-static {
    color: var(--dark-bg);
}

/* Legacy GIF support (fallback) */
.text-banner-gif {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none; /* Hidden, using animated version instead */
}

/* Image Loop GIF */
.gif-banner-work {
    position: absolute;
    z-index: 5;
}

.gif-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Scroll reveal animations */
.reveal-text {
    opacity: 0;
    transform: translateY(35px);
    transition:
        opacity 0.8s ease var(--reveal-delay, 0ms),
        transform 0.8s ease var(--reveal-delay, 0ms);
}

.reveal-text.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Client logo interactions - Optimized for mobile performance */
.client-logo {
    display: block;
    opacity: 0;
    filter: grayscale(100%);
    transform: translateY(25px) scale(1);
    transform-origin: center;
    transition:
        opacity 0.6s ease var(--client-reveal-delay, 0ms),
        transform 0.6s ease,
        filter 0.35s ease;
    will-change: auto; /* Prevent scroll blocking */
    contain: layout style paint; /* Optimize rendering */
}

.client-logo.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.client-logo:hover {
    filter: grayscale(0%);
    transform: translateY(0) scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
    .reveal-text,
    .client-logo,
    .pyramid-tier,
    .text-box {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .pyramid-connector,
    .pyramid-connector .connector-line {
        transition: none !important;
        stroke-dashoffset: 0 !important;
        opacity: 1 !important;
    }
}

/* We won't settle Section */
.wont-settle-section {
    position: absolute;
    font-family: var(--font-display);
    font-size: 68px;
    line-height: 69px;
    font-weight: 400;
    color: var(--text-white);
    z-index: 10;
}

.wont-settle-section p {
    margin-bottom: 0;
}

/* What we do Section */
.what-we-do-section {
    position: absolute;
    z-index: 10;
}

.section-title {
    font-family: var(--font-display);
    font-size: 69px;
    line-height: 69px;
    font-weight: 700;
    letter-spacing: -3.45px;
    color: var(--text-white);
    margin-bottom: 26px;
}

.section-intro {
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 28px;
    font-weight: 700; /* Bold */
    letter-spacing: -0.9px;
    color: var(--text-white);
    width: 680px; /* Extended from 642px to remove widow on last line */
    margin-bottom: 40px; /* Add space between paragraph and pyramid */
}

/* Pyramid */
/* Desktop: Single mobile image hidden, show desktop wrappers */
.pyramid-single-mobile {
    display: none; /* Hidden on desktop */
}

/* Desktop: Pyramid wrappers - transparent containers that pass through positioning */
.pyramid-tier-wrapper {
    position: absolute; /* Desktop: wrappers positioned absolutely (inline styles provide left/top/width/height) */
    display: block; /* Show on desktop */
}

/* Desktop: Tiers inside wrappers - fill wrapper completely */
.pyramid-tier-wrapper > .pyramid-tier {
    position: absolute !important; /* Absolute within wrapper */
    left: 0 !important;
    top: 0 !important;
    width: 100% !important; /* Fill wrapper width */
    height: 100% !important; /* Fill wrapper height */
    margin: 0 !important;
}

/* Desktop: Pyramid tier base styles (before mobile overrides) */
.pyramid-tier {
    position: absolute;
    z-index: 1;
    opacity: 0;
    transform: translateY(-110px) scale(0.94);
    transition:
        transform 0.85s cubic-bezier(0.19, 1, 0.22, 1),
        opacity 0.7s ease;
    transition-delay: var(--layer-delay, 0ms);
}

/* Desktop: Labels inside wrappers - positioned relative to main container, not wrapper */
/* Labels have inline styles (left/top) that are relative to main-container */
/* Wrapper has position: absolute, so labels inside are positioned relative to wrapper */
/* Solution: Adjust label positions to account for wrapper position */
/* Summit wrapper: left: 411px, top: 2399px - label needs: left: 486px (486-411=75px relative to wrapper), top: 2566px (2566-2399=167px) */
/* Mid wrapper: left: 322px, top: 2684px - label needs: left: 523px (523-322=201px), top: 2756px (2756-2684=72px) */
/* Base wrapper: left: 239px, top: 2840px - label needs: left: 530px (530-239=291px), top: 2903px (2903-2840=63px) */
.pyramid-tier-wrapper > .pyramid-label {
    position: absolute !important; /* Desktop: absolute relative to wrapper */
    /* Inline styles override these, but we need to account for wrapper offset */
    z-index: 11 !important; /* Above pyramid images */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Desktop: Adjust label positions to be relative to wrapper instead of main-container */
/* Override inline styles with !important to position labels relative to their wrapper */
/* Desktop only: Override mobile transform and use absolute positioning */
@media screen and (min-width: 1024px) {
    .tier-summit-wrapper > .pyramid-label {
        /* Summit: left: 75px (486-411), top: 167px (2566-2399) - already correct in HTML */
        left: 75px !important;
        top: 167px !important;
        transform: none !important; /* Override mobile translate(-50%, -50%) */
        text-align: left !important; /* Override mobile center */
    }

    .tier-mid-wrapper > .pyramid-label {
        /* Mid: left: 201px (523-322), top: 72px (2756-2684) */
        left: 201px !important;
        top: 72px !important;
        transform: none !important; /* Override mobile translate(-50%, -50%) */
        text-align: left !important; /* Override mobile center */
    }

    .tier-base-wrapper > .pyramid-label {
        /* Base: left: 291px (530-239), top: 63px (2903-2840) */
        left: 291px !important;
        top: 63px !important;
        transform: none !important; /* Override mobile translate(-50%, -50%) */
        text-align: left !important; /* Override mobile center */
    }
}

.pyramid-tier::after {
    content: '';
    position: absolute;
    left: 10%;
    width: 80%;
    height: 12px;
    bottom: -10px;
    background: rgba(0, 0, 0, 0.3);
    filter: blur(14px);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.pyramid-tier.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pyramid-tier.is-visible::after {
    opacity: 1;
}

.pyramid-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    z-index: 1;
}

.pyramid-label {
    position: absolute;
    font-family: var(--font-display);
    font-size: 34.5px;
    line-height: 18px;
    font-weight: 700;
    letter-spacing: -1.725px;
    color: var(--text-white);
    text-align: center;
    white-space: nowrap;
    z-index: 11;
    margin: 0;
    padding: 0;
}

/* Text Boxes */
.text-box {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0;
    box-sizing: border-box;
    z-index: 10;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
    transition:
        transform 0.35s ease,
        background 0.35s ease,
        border-color 0.35s ease;
}

/* Desktop: Make text boxes transparent and text white */
@media screen and (min-width: 1024px) {
    .text-box {
        background: transparent !important; /* Remove white background */
        border: none !important; /* Remove border */
        box-shadow: none !important; /* Remove shadow */
        opacity: 1 !important; /* Ensure fully visible */
    }
    
    .text-box::before {
        display: none !important; /* Hide red dot connector */
    }
    
    .text-box-content {
        color: var(--text-white) !important; /* White text */
    }
    
    .text-box-content p {
        color: var(--text-white) !important; /* White text for paragraphs */
    }
    
    .text-box-content strong {
        color: var(--text-white) !important; /* White text for bold */
    }
    
    .text-box:hover,
    .text-box.is-active {
        transform: none !important; /* Remove hover scale */
        background: transparent !important; /* Keep transparent on hover */
        border: none !important; /* Keep no border on hover */
    }
    
    /* When toggle is on (light theme), text should be black */
    body.theme-white .text-box-content {
        color: var(--dark-bg) !important; /* Black text on light theme */
    }
    
    body.theme-white .text-box-content p {
        color: var(--dark-bg) !important; /* Black text for paragraphs on light theme */
    }
    
    body.theme-white .text-box-content strong {
        color: var(--dark-bg) !important; /* Black text for bold on light theme */
    }
}

.text-box::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dd4420;
    box-shadow: 0 0 0 4px rgba(221, 68, 32, 0.25);
    transform: translate(-50%, -50%);
}

.text-box:hover,
.text-box.is-active {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(255, 255, 255, 0.65);
}

.text-box-1 .text-box-content {
    padding-bottom: 48px;
}

.text-box-line {
    display: none;
}

.text-box-content {
    margin: 0;
    padding: 24px 28px 32px 28px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 22px;
    font-weight: 400;
    letter-spacing: -1px;
    color: var(--dark-bg);
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.text-box-1 .text-box-content {
    justify-content: center;
}

.text-box-content p {
    margin: 0 0 10px 0;
    padding: 0;
}

.text-box-content p:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

.text-box-content strong {
    font-weight: 700;
}

.text-box-title {
    display: none; /* Hidden on desktop, shown on mobile */
}

/* Pyramid Connector Lines */
.pyramid-connector {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    overflow: visible;
    opacity: 0;
    transition: opacity 0.35s ease;
    transition-delay: var(--connector-delay, 0ms);
}

.pyramid-connector .connector-line {
    stroke: #dd4420;
    stroke-width: 3px;
    stroke-linecap: round;
    stroke-dasharray: 0 10;
    stroke-dashoffset: calc(var(--connector-length, 0px) + 10px);
    transition: stroke-dashoffset 0.85s cubic-bezier(0.19, 1, 0.22, 1);
    transition-delay: var(--connector-delay, 0ms);
}

.pyramid-connector.is-visible {
    opacity: 1;
}

.pyramid-connector.is-visible .connector-line {
    stroke-dashoffset: 0;
}

/* About us Section */
.about-us-section {
    position: absolute;
    z-index: 10;
}

.about-us-content {
    font-family: var(--font-display);
    font-size: 69px;
    line-height: 69px;
    font-weight: 400;
    letter-spacing: -3.45px;
    color: var(--text-white);
    margin-top: 92px;
}

.about-us-content p {
    margin-bottom: 69px;
}

.about-us-content p:last-child {
    margin-bottom: 0;
}

/* Senior Team Section */
.senior-team-section {
    position: absolute !important;
    z-index: 10;
}

.section-subtitle {
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 24px;
    font-weight: 400;
    color: var(--text-white);
    margin-top: 34px;
    margin-bottom: 0;
}

.team-member-photo {
    position: absolute;
    z-index: 10;
    transform-origin: center center;
    opacity: 0;
    transform: translateX(-100%) rotate(0deg);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: visible; /* Allow zoom on hover */
}

.team-member-photo.is-dealt {
    opacity: 1;
    transform: translateX(0) rotate(var(--card-angle, 0deg));
    transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .team-member-photo {
        opacity: 1;
        transform: translateX(0) rotate(var(--card-angle, 0deg));
        transition: none;
    }
}

.team-photo {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Show full image without cropping (polaroid frame included) */
    object-position: center center; /* Center the image */
    display: block;
    filter: grayscale(100%); /* Load in black and white */
    transition: filter 0.4s ease, transform 0.4s ease;
    transform-origin: center center;
    transform: scale(1); /* Initial scale */
}

/* Hover effects: reveal color, rotate, and zoom */
.team-member-photo:hover .team-photo {
    filter: grayscale(0%); /* Reveal color on hover */
    transform: scale(1.1) rotate(2deg); /* Zoom 10% and rotate 2deg */
}

.team-role {
    position: absolute;
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 26px;
    font-weight: 700;
    letter-spacing: -1.2px;
    color: var(--text-white);
    z-index: 10;
}

.team-bio {
    position: absolute;
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 20px;
    font-weight: 400;
    letter-spacing: -0.9px;
    color: var(--text-white);
    z-index: 10;
}

.team-quirk {
    position: absolute;
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 20px;
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.9px;
    color: var(--text-white);
    text-transform: uppercase;
    z-index: 10;
}

/* Clients Section */
.clients-section {
    position: absolute;
    z-index: 10;
}

.clients-note,
.clients-subtitle {
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 24px;
    font-weight: 400;
    color: var(--text-white);
    margin-top: 69px;
    width: 1175px;
}

.client-logo {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    z-index: 10;
}

/* Contact Section with Beach GIF */
.gif-banner-contact {
    position: absolute;
    z-index: 10;
}

.beach-gif-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    cursor: pointer;
}

.beach-gif-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #0C0C0C;
    border: 20px solid #0C0C0C;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.beach-gif-image {
    width: 248px;
    height: 248px;
    object-fit: cover;
    display: block;
}

.contact-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
    line-height: 43px;
    color: #E1FF00;
    font-weight: 700;
    font-family: var(--font-display);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    z-index: 5;
    pointer-events: none;
    white-space: pre-line;
}

/* Footer Logo - Always visible, no scroll animation, aligned to same position as top logo */
.footer-logo {
    position: absolute !important;
    left: 224px !important; /* Same as .navbar-fixed .nav-logo for perfect alignment */
    /* top set inline: 9464px (ticker top 9553px - logo height 89px = 9464px) */
    width: 288px !important;
    height: 89px !important;
    z-index: 10 !important;
    opacity: 1 !important; /* Always visible - CRITICAL */
    transform: none !important; /* No transform animations */
    transition: none !important; /* No transitions that could hide it */
    visibility: visible !important; /* Force visible */
}

/* Override reveal-text class if accidentally applied */
.footer-logo.reveal-text,
.reveal-text.footer-logo {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    visibility: visible !important;
}

/* Bottom Ticker GIF */
.gif-banner-ticker {
    position: absolute;
    z-index: 10;
}

/* White Theme Styles - inverts entire page */
body.theme-white {
    background-color: #FFFFFF;
    color: #0C0C0C;
}

body.theme-white .main-container {
    background-color: #FFFFFF;
}

body.theme-white .navbar-fixed .nav-link {
    background: var(--dark-bg);
    color: var(--text-white);
}

body.theme-white .section-title,
body.theme-white .section-intro,
body.theme-white .wont-settle-section,
body.theme-white .about-us-content,
body.theme-white .section-subtitle,
body.theme-white .team-role,
body.theme-white .team-bio,
body.theme-white .team-quirk,
body.theme-white .clients-note,
body.theme-white .clients-subtitle {
    color: var(--dark-bg);
}

body.theme-white .text-banner-overlay .text-banner-gif {
    content: url('../images/gifs/text-banner_k.gif');
}

body.theme-white .toggle-button {
    background: rgba(0, 0, 0, 0.1);
}

body.theme-white .toggle-icon {
    background-color: var(--dark-bg);
}

body.theme-white .toggle-icon::before {
    border-color: var(--text-white);
}

body.theme-white .text-box-content {
    color: var(--dark-bg);
}

body.theme-white .pyramid-label {
    color: var(--dark-bg);
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Mobile: 320px - 767px */
@media screen and (max-width: 767px) {
    /* Base adjustments - CRITICAL: Enable scrolling */
    html {
        margin: 0 !important;
        padding: 0 !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        height: auto !important; /* Allow content to determine height */
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: scroll !important; /* Force scrolling enabled */
        -webkit-overflow-scrolling: touch !important;
    }

    body {
        margin: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
        padding-top: 0 !important;
        font-size: 16px !important; /* WCAG minimum */
        overflow-x: hidden !important;
        overflow-y: auto !important; /* Enable vertical scrolling */
        -webkit-overflow-scrolling: touch !important; /* Smooth scrolling on iOS */
        touch-action: pan-y !important; /* Allow vertical scrolling */
        overscroll-behavior: auto !important; /* Allow normal scrolling */
        height: auto !important;
        min-height: 100vh !important;
        position: relative !important;
    }

    /* Navigation - FIXED to top of browser window - ABSOLUTELY ZERO PADDING */
    .navbar-fixed {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        background: transparent !important;
        backdrop-filter: none !important;
        display: block !important;
        padding: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        z-index: 10000 !important; /* Higher z-index to ensure it's on top */
        border: none !important;
        border-top: none !important;
        box-sizing: border-box !important;
        transform: translateY(0) !important; /* Force to top */
        -webkit-transform: translateY(0) !important;
    }

    .navbar-fixed .nav-logo {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 200px !important;
        height: 80px !important;
        margin: 0 !important;
        margin-left: 15px !important; /* Only left margin for spacing from edge */
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        margin-right: 0 !important;
        padding: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        display: block !important;
        border: none !important;
        border-top: none !important;
        box-sizing: border-box !important;
        transform: translateY(0) !important; /* Force to top */
    }

    .navbar-fixed .nav-logo .logo-image {
        padding: 0 !important;
        padding-top: 0 !important;
        margin: 0 !important;
        margin-top: 0 !important;
        border: none !important;
        border-top: none !important;
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: top left !important;
        vertical-align: top !important;
    }

    .navbar-fixed .nav-link,
    .navbar-fixed .mobile-menu-toggle {
        display: none !important;
    }
    
    /* Toggle button - show on mobile and position top right */
    .navbar-fixed .toggle-overlay {
        display: flex !important; /* Show toggle button on mobile */
        position: fixed !important; /* Fixed positioning */
        right: 15px !important; /* Position from right edge */
        top: 15px !important; /* Position from top edge */
        left: auto !important; /* Override desktop left positioning */
        width: 51px !important;
        height: 31px !important;
        z-index: 10001 !important; /* Above logo and other elements */
        cursor: pointer !important;
        pointer-events: auto !important;
    }
    
    .navbar-fixed .toggle-button {
        width: 51px !important;
        height: 31px !important;
        padding: 2px 22px 2px 2px !important;
    }
    
    .navbar-fixed .toggle-icon {
        width: 27px !important;
        height: 27px !important;
    }

    /* Main Container - Reset all positioning, allow scrolling */
    .main-container {
        width: 100% !important;
        max-width: 100% !important; /* Prevent overflow */
        min-width: 320px;
        padding-top: 0 !important; /* NO PADDING - logo is fixed to top */
        position: relative !important;
        display: block !important;
        min-height: auto !important;
        height: auto !important;
        z-index: 1; /* Above background images */
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        overflow: visible !important; /* Allow content to flow */
        will-change: auto !important; /* Prevent scroll blocking */
        contain: layout style !important; /* Optimize rendering */
    }

    /* Reset ALL absolute positioning to relative/block for natural flow - EXCEPT background images */
    .main-container > *:not(.bg-image):not(.navbar-fixed) {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        /* margin-bottom will be set individually per section - don't override */
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* First content element after navbar needs top margin for logo space */
    .main-container > *:first-of-type:not(.navbar-fixed):not(.bg-image) {
        margin-top: 80px !important; /* Space for fixed logo */
    }

    /* Background Images - Absolute positioning on mobile, scroll with content */
    .bg-image {
        position: absolute !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        z-index: 0 !important;
        pointer-events: none !important;
        overflow: hidden !important;
        /* Heights maintained from desktop, but widths responsive */
    }

    .bg-image .bg-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center top !important;
        opacity: 0.2 !important;
    }

    /* bg-5: Use CSS background with repeat for mobile too */
    .bg-5 {
        background-size: 100vw auto !important; /* Scale to viewport width, maintain aspect ratio */
        background-repeat: repeat-y !important;
        background-position: center top !important;
        opacity: 0.2 !important;
    }

    .bg-5 .bg-img {
        display: none !important;
    }

    /* Ensure all content is above background images */
    .main-container > *:not(.bg-image) {
        position: relative !important;
        z-index: 1 !important;
    }

    /* Text Banner - Animated version, mobile optimized, VERTICALLY CENTERED, LEFT ALIGNED */
    .text-banner-overlay {
        padding: 0 15px !important;
        margin: 0 !important; /* No margin - will use flexbox for vertical centering */
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: calc(100vh - 110px) !important; /* Full viewport minus navbar */
        position: relative !important;
        left: auto !important;
        top: auto !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important; /* Vertically center */
        align-items: flex-start !important; /* Left align */
        text-align: left !important; /* Left align text */
    }

    .text-banner-animated {
        font-size: 32px !important; /* Smaller to prevent overflow */
        line-height: 38px !important;
        white-space: normal !important; /* Allow line breaks */
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        text-align: left !important; /* Left align */
    }

    .text-banner-static {
        display: block !important; /* Stack on separate line */
        margin-bottom: 0 !important; /* No gap - line-height handles spacing */
        line-height: 38px !important; /* Match animated line height */
        text-align: left !important;
    }

    .text-banner-changing {
        display: block !important; /* Stack on separate line */
        min-width: auto !important;
        width: 100% !important;
        line-height: 38px !important; /* Match static line height */
        margin-top: 0 !important; /* No gap - line-height handles spacing */
        text-align: left !important;
    }

    .text-banner-gif {
        display: none; /* Using animated version */
    }

    /* Work GIF - 150px spacing */
    .gif-banner-work {
        padding: 0 15px;
        margin: 0 0 150px 0 !important; /* 150px spacing before next section */
        width: 100% !important;
        height: auto !important;
        min-height: 200px;
    }

    .gif-image {
        width: 100%;
        height: auto;
        display: block;
    }

    /* Sections - All get padding and proper spacing */
    section,
    .wont-settle-section,
    .what-we-do-section,
    .about-us-section,
    .senior-team-section,
    .clients-section {
        padding: 0 15px;
        margin: 0 0 0 0 !important; /* Reset - will set individually */
        width: 100% !important;
    }

    /* Wont Settle section - spacing to What we do */
    .wont-settle-section {
        margin-bottom: 200px !important; /* 200px spacing to What we do */
    }

    /* What we do section - spacing to About us */
    .what-we-do-section {
        margin-top: 0 !important;
        margin-bottom: 200px !important; /* 200px spacing to About us */
    }

    /* About us section - spacing to Senior Partnership */
    .about-us-section {
        margin-top: 0 !important;
        margin-bottom: 200px !important; /* 200px spacing to Senior Partnership */
    }

    /* Senior partnership section - spacing to Clients */
    .senior-team-section {
        margin-top: 0 !important;
        margin-bottom: 200px !important; /* 200px spacing to Clients section */
    }
    
    /* Ensure Clients section has proper spacing from Senior Partnership */
    .clients-section {
        margin-top: 0 !important; /* Reset top margin */
    }
    
    /* Ensure last quirk in Senior Partnership has spacing before Clients */
    .senior-team-section .team-quirk:last-child {
        margin-bottom: 180px !important; /* Add spacing after last quirk before Clients section */
    }

    /* Clients section */
    .clients-section {
        margin-top: 0 !important;
        margin-bottom: 200px !important; /* 200px spacing after */
    }

    /* Section Titles - Match desktop letter-spacing */
    .section-title {
        font-size: 34.5px !important;
        line-height: 34.5px !important;
        margin-bottom: 15px !important;
        width: 100% !important;
        letter-spacing: -3.45px !important; /* Match desktop - close but not tight */
        font-weight: 700;
    }

    .section-intro,
    .section-subtitle {
        font-size: 24px !important;
        line-height: 28px !important;
        font-weight: 700 !important; /* Bold */
        margin-bottom: -35px !important; /* Increased negative margin to close gap between paragraph and pyramid */
        width: 100% !important;
    }

    /* Wont Settle Section - Big USP Statement - 200px spacing to What we do */
    .wont-settle-section {
        padding: 0 15px;
        margin: 0 0 200px 0 !important; /* 200px spacing to What we do section */
    }

    .wont-settle-section p {
        font-size: 32px !important;
        line-height: 38px !important;
        margin-bottom: 20px !important;
        font-weight: 400;
        letter-spacing: -0.5px;
    }

    /* What we do section - make it position relative so labels can position relative to it */
    #section-what-we-do {
        position: relative !important;
    }
    
    /* Create a wrapper container for pyramid elements */
    .what-we-do-section {
        position: relative !important;
        min-height: 400px; /* Ensure enough space for pyramid */
    }

    /* Mobile: Single pyramid image - much simpler! */
    .pyramid-single-mobile {
        display: block !important;
        width: 85% !important;
        max-width: 400px !important;
        margin: -40px auto 40px auto !important; /* Increased negative top margin to close gap, added bottom margin for space to text boxes */
        padding: 0 !important;
    }

    .pyramid-image-mobile {
        width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 0 !important;
    }

    /* Mobile: Hide all the complex desktop wrappers */
    .pyramid-tier-wrapper {
        display: none !important;
    }

    /* Base tier - now inside wrapper */
    .pyramid-tier.tier-base {
        width: 100% !important; /* Full width of wrapper */
        margin: 0 !important;
        height: auto !important;
        display: block !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1 !important;
    }

    /* Mid tier - now inside wrapper */
    .pyramid-tier.tier-mid {
        width: 100% !important; /* Full width of wrapper */
        margin: 0 !important;
        height: auto !important;
        display: block !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1 !important;
    }

    /* Summit tier - now inside wrapper */
    .pyramid-tier.tier-summit {
        width: 100% !important; /* Full width of wrapper */
        margin: 0 !important;
        height: auto !important;
        display: block !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1 !important;
    }

    .pyramid-image {
        width: 100%;
        height: auto;
        display: block;
        position: relative;
        z-index: 1; /* Image behind label */
    }

    /* Pyramid Labels - NOW INSIDE WRAPPER - Positioned ON TOP of their tier, perfectly centered */
    p.pyramid-label,
    .pyramid-label {
        text-align: center !important;
        font-size: 20px !important;
        font-weight: 700 !important;
        letter-spacing: -1px !important; /* Decreased from 1px to -1px */
        color: var(--text-white) !important;
        padding: 0 !important;
        line-height: 24px !important;
        position: absolute !important;
        left: 50% !important;
        top: 50% !important; /* Center vertically in wrapper */
        transform: translate(-50%, -50%) !important; /* Perfect center */
        margin: 0 !important;
        width: auto !important;
        max-width: 90% !important;
        z-index: 10 !important; /* Above pyramid image */
        pointer-events: none !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        text-shadow: none !important; /* No drop shadows */
    }
    
    /* Ensure pyramid images stay behind labels */
    .pyramid-tier img,
    .pyramid-image {
        position: relative;
        z-index: 1 !important; /* Images behind labels */
    }
    
    /* Labels automatically center in their wrapper containers via transform */

    /* Pyramid Connector Lines - Hide on mobile */
    .pyramid-connector {
        display: none !important;
    }

    /* Text Boxes - Stack below entire pyramid stack (not side-by-side) - No white rectangles, just white text */
    .text-box {
        width: 100% !important;
        max-width: 100%;
        margin: 0 auto 40px auto !important; /* Space between boxes, center horizontally */
        height: auto !important;
        min-height: 120px;
        padding: 0 15px !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        display: block !important;
        /* Remove white rectangle styling */
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    
    /* Remove the red dot connector on mobile */
    .text-box::before {
        display: none !important;
    }
    
    /* Hide the connector line on mobile */
    .text-box-line {
        display: none !important;
    }

    /* First text box has spacing from pyramid base */
    .text-box-1 {
        margin-top: 30px !important; /* Add space between pyramid base and first text box title */
    }
    
    /* Last text box has spacing before About Us section */
    .text-box-3 {
        margin-bottom: 200px !important; /* Add spacing after last text box before About Us section */
    }

    .text-box-title {
        font-size: 24px !important;
        font-weight: 700 !important;
        margin-bottom: 15px !important;
        letter-spacing: 1px;
        display: block !important;
        color: var(--text-white) !important; /* White text */
    }

    .text-box-content {
        padding: 0 !important; /* No padding since no rectangle */
        font-size: 16px !important;
        line-height: 22px !important;
        color: var(--text-white) !important; /* White text */
    }
    
    .text-box-content p {
        color: var(--text-white) !important; /* White text for paragraphs */
    }
    
    .text-box-content strong {
        color: var(--text-white) !important; /* White text for bold */
    }

    /* About Us Section */
    .about-us-content {
        margin-top: 20px;
    }

    .about-us-content p {
        font-size: 24px !important;
        line-height: 32px !important;
        margin-bottom: 25px !important;
        letter-spacing: 0.5px;
        font-weight: 400;
    }
    
    /* About Us - add section spacing after last paragraph */
    /* About Us - ensure last paragraph has no extra margin, section spacing handles it */
    .about-us-content p:last-child {
        margin-bottom: 0 !important;
    }
    
    /* About Us section spacing is already set at 1224-1227, but ensure it applies */
    .about-us-section {
        margin-bottom: 200px !important; /* Section spacing after last paragraph */
    }

    /* Senior Team Section */
    .senior-team-section .section-subtitle {
        margin-top: -10px !important; /* Move subheader closer to header */
        margin-bottom: 5px !important; /* Reduced further to close gap between subheader and first image */
        font-weight: 400 !important; /* Not bold */
        font-size: 16px !important; /* Decreased font size */
    }
    
    /* Clients Section - subheader styling */
    .clients-section .section-subtitle {
        font-weight: 400 !important; /* Not bold */
        font-size: 16px !important; /* Decreased font size */
        margin-bottom: 10px !important; /* Close gap between subheader and client images */
    }

    .team-member-photo {
        width: 80% !important;
        max-width: 250px;
        margin: 0 auto !important; /* Reduced from 30px - subheader margin handles spacing */
        height: auto !important;
        display: block;
        position: relative !important;
    }

    .team-member-photo .team-photo {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important; /* Show full polaroid including white border */
        object-position: center center !important;
    }

    .team-role,
    .team-bio,
    .team-quirk {
        width: 100% !important;
        margin: 10px 0 !important;
        font-size: 16px !important;
        line-height: 22px !important;
        padding: 0 15px;
    }
    
    /* Senior Partnership - ensure spacing after last quirk to Clients */
    /* On mobile, team-quirks flow naturally - add spacing to last one */
    .team-quirk {
        margin-bottom: 10px !important; /* Default spacing between quirks */
    }
    
    /* Last team-quirk before Clients section needs 200px spacing */
    /* Since quirks are siblings, target the last quirk that appears before Clients section */
    .senior-team-section ~ .clients-section {
        margin-top: 200px !important; /* Add space before Clients section */
    }
    
    /* Last team-quirk before Clients section - ensure it has 200px spacing */
    /* Use a more specific selector to target the last quirk that comes before Clients */
    .team-quirk:last-of-type {
        margin-bottom: 200px !important; /* Full 200px spacing after last quirk before Clients section */
    }
    
    /* Also add margin-top to Clients section to ensure spacing if quirk margin doesn't apply */
    .senior-team-section ~ .clients-section {
        margin-top: 200px !important; /* Add space before Clients section from Senior Partnership */
    }

    .team-role {
        font-size: 20px !important;
        font-weight: 700;
        margin-top: 15px !important;
    }

    /* Clients Section - 3 column grid, smaller images */
    .clients-section {
        padding: 0 15px;
    }
    
    /* Client logos grid container */
    .clients-grid-mobile {
        display: block !important;
        width: 100% !important;
        margin: 5px 0 0 0 !important; /* Reduced from 20px to close gap between subheader and images */
        padding: 0 !important; /* Remove side padding to fit full width */
        position: relative !important;
        box-sizing: border-box !important;
    }
    
    /* Client logos - 3 columns grid layout (inside grid container) - full screen width */
    .clients-grid-mobile {
        font-size: 0 !important; /* Remove inline-block whitespace gaps */
        line-height: 0 !important;
    }
    
    .clients-grid-mobile .client-logo {
        width: 33.333% !important; /* Exactly 1/3 width for 3 columns */
        max-width: 33.333% !important;
        height: auto !important;
        margin: 0 !important; /* No margin for full-width fit */
        padding: 0 !important;
        display: inline-block !important;
        vertical-align: top !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        right: auto !important;
        float: none !important;
        border: none !important;
        font-size: 0 !important; /* Prevent inline-block spacing */
    }

    /* Contact Section - 150px spacing */
    .gif-banner-contact {
        margin: 150px auto 0 !important; /* 150px spacing before contact section */
        width: 200px !important;
        height: 200px !important;
        display: block;
    }

    .beach-gif-image {
        width: 100%;
        height: 100%;
    }

    .contact-text-overlay {
        font-size: 24px !important;
        line-height: 28px !important;
    }

    /* Footer Logo - Same size as top logo, aligned to same position as top logo */
    .footer-logo {
        margin: 50px 0 0 15px !important; /* Same left margin as top logo (15px) */
        width: 200px !important;
        height: 80px !important;
        display: block;
        padding: 0 !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
    }

    .footer-logo .logo-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    /* Ticker GIF - 30px height, directly below logo with no gap */
    .gif-banner-ticker {
        width: 100% !important;
        height: 30px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block;
        overflow: hidden;
        position: relative !important;
        top: auto !important;
        left: auto !important;
    }

    /* Ensure footer logo and ticker are adjacent - logo top aligns with ticker top */
    .footer-logo {
        margin-bottom: -80px !important; /* Negative margin to pull ticker up */
    }

    .gif-banner-ticker {
        margin-top: 80px !important; /* Push ticker down by logo height to align tops */
    }

    .gif-banner-ticker .gif-image {
        width: 100%;
        height: 30px !important;
        object-fit: cover;
    }
}

/* Tablet: 768px - 1023px */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .navbar-fixed {
        width: 100%;
    }

    .main-container {
        width: 100%;
        max-width: 1024px;
        margin: 0 auto;
    }

    .navbar-fixed .nav-logo {
        left: 0;
        margin-left: 15px;
        width: 200px;
    }
    
    /* Footer Logo - Aligned to same position as top logo on tablet */
    .footer-logo {
        left: 0 !important;
        margin-left: 15px !important;
    }

    .navbar-fixed .nav-link {
        font-size: 16px;
        padding: 8px 12px;
    }

    /* Scale down but maintain layout */
    .section-title {
        font-size: 42px !important;
    }

    .text-box {
        width: 90% !important;
        max-width: 600px;
    }

    .pyramid-tier {
        width: 60% !important;
        max-width: 400px;
    }
}

/* Desktop: 1024px and above - keep existing styles */
@media screen and (min-width: 1024px) {
    /* All existing desktop styles remain unchanged */
}
