/* Critical above-the-fold styles */
* {
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000000;
    background-attachment: fixed;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    /* Fix background texture stretching */
    background-image: url('../../assets/images/bg_v1.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
}

/* Specificity Boost: Use ID if possible, otherwise rely on order + specificity */
#home .nav-container,
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.hero-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 120px 80px 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-name {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-size: clamp(41px, 5.75vw, 83px);
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.15;
    background: linear-gradient(135deg, #ffffff 0%, #d4d4d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 40px;
    word-spacing: 0.02em;
    white-space: nowrap;
    text-transform: uppercase;
    transition: filter 0.4s ease-out;
    cursor: default;
    position: relative;
}

.hero-specialties {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    justify-content: flex-start;
}

/* PREVENT TEXT BREAKING MID-WORD - MOVE WHOLE WORDS TO NEXT LINE */
.section-title,
.section-subtitle,
.hero-title,
.hero-subtitle,
.hero-description,
.about-intro,
.about-paragraph,
.press-title,
.press-excerpt,
.project-title,
.project-description,
.expertise-title,
.contact-label,
.contact-value,
.stat-label,
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div {
    word-break: keep-all;
    word-wrap: normal;
    hyphens: none;
    -webkit-hyphens: none;
    -ms-hyphens: none;
    overflow-wrap: normal;
    white-space: normal;
    line-break: strict;
}

/* ==============================================
   RESPONSIVE BREAKPOINTS
   ============================================== */

/* Large Tablets (1024px) */
@media (max-width: 1024px) {
    .hero-container {
        padding: 100px 40px 60px;
    }

    /* Increased specificity to override default styles without !important */
    #home .hero-content,
    .hero-content {
        gap: 60px;
        justify-content: center;
        align-items: center;
    }

    .photo-container {
        width: 400px;
        height: 400px;
    }

    .hero-name {
        font-size: clamp(48px, 6vw, 72px);
    }

    .clients-section {
        padding: 80px 40px 60px;
    }

    .projects-section {
        padding: 60px 40px;
    }

    .stats-container {
        padding: 60px 40px;
    }
}

/* Tablets & Large Mobile (768px) */
@media (max-width: 768px) {

    .nav-container {
        padding: 15px 20px;
    }
    
    /* Logo - Keep same size on mobile - NO SCALING */
    .logo {
        height: 64px !important;
        padding: 0 !important;
        width: auto !important;
        max-width: none !important;
        min-width: auto !important;
        transform: none !important;
        scale: 1 !important;
    }
    
    .logo img {
        height: 64px !important;
        max-height: 64px !important;
        min-height: 64px !important;
        max-width: none !important;
        width: auto !important;
        min-width: auto !important;
        transform: none !important;
        scale: 1 !important;
    }

    /* --- Body Background Fix - Static/Fixed on Mobile & Tablet --- */
    body {
        background: #0a0a0a; /* Fallback solid color */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimizeQuality;
    }
    
    /* Use pseudo-element for fixed background on mobile (iOS compatible) */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-image: url('../../assets/images/bg_v1.webp');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        z-index: -2;
        pointer-events: none;
    }

    /* --- Main Responsive Block --- */
    /* Using #home ID to boost specificity */
    #home .hero-container,
    .hero-container {
        padding: 100px 20px 60px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #home .hero-content,
    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 0 20px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
    }

    #home .hero-name,
    .hero-name {
        font-size: clamp(60px, 12vw, 90px);
        text-align: center;
        margin-bottom: 30px;
        white-space: normal;
        width: 100%;
    }

    #home .hero-titles,
    .hero-titles {
        font-size: clamp(13px, 2.5vw, 16px);
        text-align: center;
        margin-bottom: 20px;
        width: 100%;
    }

    #home .hero-description,
    .hero-description {
        font-size: clamp(15px, 2.8vw, 18px);
        max-width: 100%;
        text-align: center;
        margin: 0 auto 25px;
        line-height: 1.6;
        width: 100%;
    }

    #home .hero-specialties,
    .hero-specialties {
        justify-content: center;
        align-items: center;
        gap: 10px;
        margin-top: 0;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        text-align: center;
    }

    #home .hero-specialty-pill,
    .hero-specialty-pill {
        font-size: clamp(11px, 2vw, 14px);
        padding: 6px 12px;
    }

    #home .photo-container,
    .photo-container {
        width: 350px;
        height: 350px;
        margin: 0 auto;
    }

    /* Stats Section - Full width to match other sections */
    .stats-container {
        padding: 40px 20px;
        max-width: 100%;
        width: 100%;
        margin: 0;
        overflow: hidden;
        box-sizing: border-box;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    .stat-number {
        font-size: clamp(48px, 10vw, 64px);
    }

    .stat-label {
        font-size: clamp(14px, 3vw, 16px);
    }

    /* Clients Section */
    .clients-section {
        padding: 60px 20px 40px;
    }

    .clients-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .client-logo {
        height: 180px;
        width: 180px;
        padding: 20px;
    }

    .client-logo img {
        max-width: 70%;
        max-height: 70%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Hide Top Golf on mobile */
    .client-logo[data-client="topgolf"] {
        display: none;
    }

    /* Override specific client logo sizes */
    .client-logo[data-client="immersive"] img {
        max-width: 70%;
        max-height: 70%;
    }

    .client-logo[data-client="cape-town"] img {
        max-width: 70%;
        max-height: 70%;
    }

    /* Universal override for ALL client logos */
    .clients-grid .client-logo img {
        max-width: 60%;
        max-height: 60%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Projects Section */
    .projects-section {
        padding: 40px 20px;
    }

    .projects-grid-new {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .project-card {
        overflow: hidden;
    }

    .project-thumbnail {
        height: 200px;
        overflow: hidden;
    }

    .project-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .project-content {
        padding: 20px;
    }

    /* Showreel Section */
    .showreel-section {
        padding: 60px 20px;
        overflow: hidden;
        max-width: 100%;
    }

    .showreel-container {
        max-width: 100%;
        overflow: hidden;
    }

    .showreel-video-container {
        max-width: 100%;
        overflow: hidden;
    }

    /* About, Expertise, Press, Contact Sections */
    .about-section,
    .expertise-section,
    .press-section {
        padding: 60px 20px;
    }

    .press-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .contact-section {
        padding: 60px 20px;
        text-align: center;
    }

    .contact-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .contact-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        text-align: center;
    }

    /* Carousel Overflow Fix */
    #other-works {
        overflow: visible;
        max-width: 100%;
        width: 100%;
        display: block;
    }

    #other-works .highlights-wrapper {
        width: 100%;
        left: 0;
        transform: none;
        overflow: visible;
        max-width: 100%;
        display: block;
    }

    .slick-highlights {
        overflow: visible;
        max-width: 100%;
        display: block;
    }

    .slick-list {
        overflow: visible;
        max-width: 100%;
        display: block;
    }

    .slick-track {
        overflow: visible;
        max-width: 100%;
        display: block;
    }

    /* Modal Mobile Fixes */
    .project-modal {
        display: block;
        z-index: 9999;
    }

    .modal-container {
        padding: 16px 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        width: 95vw;
        height: 95vh;
        grid-template-rows: 1fr 45%;
        grid-template-areas: "text" "images";
        display: grid;
        overflow: auto;
    }

    .modal-text {
        padding: 32px 32px 40px;
        overflow-y: auto;
    }

    .modal-images {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr 1fr;
        display: grid;
        gap: 3px;
    }

    .modal-close {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* --- Nuclear Container Width Fix (Refactored) --- */
    /* Using ID specificity to override any generic container styles */
    #about.projects-section,
    #about .about-container {
        padding-left: 20px;
        padding-right: 20px;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    #about .about-content {
        padding: 28px 24px;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Testimonial mobile fixes */
    .testimonial-carousel {
        margin: 24px auto 0;
    }
    
    /* Testimonial grid-based fixed height */
    .testimonial-carousel {
        display: grid;
        grid-template-columns: 1fr;
    }
    
    .about-testimonial {
        grid-row: 1;
        grid-column: 1;
        padding: 24px 20px;
    }
    
    .about-testimonial p {
        font-size: 19px;
        line-height: 1.6;
    }
    
    .about-testimonial .cite-name {
        font-size: 15px;
    }
    
    .about-testimonial .cite-title {
        font-size: 13px;
    }

    #contact.projects-section,
    #contact .contact-container {
        padding-left: 20px;
        padding-right: 20px;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    #contact .contact-content {
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;
    }

    #press.projects-section,
    #press .press-grid,
    #press .press-item,
    #expertise.projects-section,
    #expertise .expertise-grid {
        padding-left: 20px;
        padding-right: 20px;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    /* --- Word Break Fix --- */
    .section-title,
    .section-subtitle,
    .hero-titles,
    .about-intro,
    .about-paragraph,
    .press-title,
    .project-title {
        word-break: keep-all;
        hyphens: none;
        overflow-wrap: anywhere;
        word-wrap: normal;
        line-height: 1.4;
        white-space: pre-wrap;
    }
}

/* Mobile (767px) */
@media (max-width: 767px) {
    .modal-content {
        width: 98vw;
        height: 98vh;
        grid-template-rows: 1fr 50%;
    }

    .modal-text {
        padding: 24px 24px 32px;
    }

    .modal-images {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(8, 1fr);
        gap: 4px;
        overflow-y: auto;
        padding: 8px;
    }

    .modal-grid-item {
        aspect-ratio: 16/9;
        min-height: 120px;
    }
}

/* Small Tablets / Large Mobile (500px) */
@media (max-width: 500px) {

    section#about .about-container,
    section#contact .contact-container {
        padding-left: 20px;
        padding-right: 20px;
        margin: 0;
    }
    
    section#about .about-content {
        padding: 28px 24px;
        margin: 0;
    }
    
    section#contact .contact-content {
        padding-left: 20px;
        padding-right: 20px;
        margin: 0;
        box-sizing: border-box;
    }
}

/* Mobile (480px) */
@media (max-width: 480px) {
    
    /* Hero section - raise by 15px */
    #home .hero-container,
    .hero-container {
        padding-top: 85px;
    }
    
    /* Logo - Keep same size on small mobile */
    .logo {
        height: 64px !important;
    }
    
    .logo img {
        height: 64px !important;
        max-width: none !important;
        width: auto !important;
    }

    #home .hero-content,
    .hero-content {
        padding: 0 15px;
        gap: 40px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    #home .photo-container,
    .photo-container {
        width: 280px;
        height: 280px;
        margin: 0 auto;
    }

    #home .hero-name,
    .hero-name {
        font-size: clamp(70px, 18vw, 100px);
        margin-bottom: 25px;
        text-align: center;
        white-space: normal;
        display: block;
        width: 100%;
    }

    #home .hero-titles,
    .hero-titles {
        font-size: clamp(14px, 3.5vw, 16px);
        margin-bottom: 20px;
        text-align: center;
        display: block;
        width: 100%;
    }

    #home .hero-description,
    .hero-description {
        font-size: clamp(16px, 3.8vw, 18px);
        line-height: 1.6;
        margin-bottom: 30px;
        text-align: center;
        display: block;
        width: 100%;
    }

    #home .hero-specialties,
    .hero-specialties {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        margin-top: 0;
        flex-wrap: nowrap;
        width: 100%;
    }

    #home .hero-specialty-pill,
    .hero-specialty-pill {
        font-size: clamp(12px, 3vw, 14px);
        padding: 10px 16px;
        width: fit-content;
        text-align: center;
        display: inline-block;
    }

    /* Stats Section - Full width to match other sections */
    .stats-container {
        padding: 30px 20px;
        max-width: 100%;
        width: 100%;
        margin: 0;
        box-sizing: border-box;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    .stat-number {
        font-size: clamp(56px, 12vw, 72px);
    }

    .stat-label {
        font-size: clamp(16px, 4vw, 18px);
    }

    /* Clients Section */
    .clients-section {
        padding: 40px 15px 30px;
    }

    .clients-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .client-logo {
        height: 200px;
        width: 200px;
        padding: 25px;
    }

    .client-logo img {
        max-width: 70%;
        max-height: 70%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Hide Top Golf on mobile */
    .client-logo[data-client="topgolf"] {
        display: none;
    }

    /* Override specific client logo sizes */
    .client-logo[data-client="immersive"] img {
        max-width: 70%;
        max-height: 70%;
    }

    .client-logo[data-client="cape-town"] img {
        max-width: 70%;
        max-height: 70%;
    }

    /* Universal override for ALL client logos */
    .clients-grid .client-logo img {
        max-width: 60%;
        max-height: 60%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Projects Section */
    .projects-section {
        padding: 30px 15px;
    }

    .project-card {
        margin-bottom: 20px;
        overflow: hidden;
    }

    .project-thumbnail {
        height: 180px;
    }

    .project-content {
        padding: 15px;
    }

    /* Section Titles */
    .section-title {
        font-size: clamp(36px, 8vw, 48px);
    }

    .section-subtitle {
        font-size: clamp(14px, 3.5vw, 16px);
    }

    /* Press Section Mobile */
    .press-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .press-item {
        padding: 20px;
    }

    .press-title {
        font-size: clamp(20px, 5vw, 24px);
    }

    /* Contact Section */
    .contact-section {
        padding: 40px 15px;
    }

    .contact-info {
        gap: 15px;
    }

    /* Modal Mobile Fixes */
    .modal-content {
        grid-template-areas: "text" "images";
        width: 98vw;
        height: 98vh;
    }

    .modal-text {
        padding: 20px 20px 28px;
    }

    .modal-stats {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: left;
    }

    .modal-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .modal-images {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr 1fr;
    }

    /* --- Senior Dev Fix (Refactored) --- */
    /* CRITICAL FIX 1: Normalize About section left margin 40px → 20px */
    section#about,
    section#about .about-container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    section#about .about-content {
        padding: 24px 20px;
    }
    
    /* Testimonial small mobile */
    .about-testimonial {
        padding: 22px 18px;
    }
    
    .about-testimonial p {
        font-size: 18px;
    }

    /* CRITICAL FIX 2: Normalize Contact section left margin 40px → 20px */
    section#contact,
    section#contact .contact-container,
    section#contact .contact-content {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* CRITICAL FIX 3: Eliminate anomalous 40px gap between Global Highlights and About */
    section#about {
        margin-top: 0px;
        padding-top: 60px;
    }

    /* MEDIUM FIX: Hero section margin consistency */
    #home .hero-container,
    .hero-container {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Smallest Mobile (320px) */
@media (max-width: 320px) {
    
    /* Logo - Keep same size on smallest mobile */
    .logo {
        height: 64px !important;
    }
    
    .logo img {
        height: 64px !important;
        max-width: none !important;
        width: auto !important;
    }

    #home .hero-content,
    .hero-content {
        padding: 0 10px;
        gap: 30px;
    }

    #home .photo-container,
    .photo-container {
        width: 250px;
        height: 250px;
    }

    #home .hero-name,
    .hero-name {
        font-size: clamp(60px, 20vw, 80px);
    }

    #home .hero-specialty-pill,
    .hero-specialty-pill {
        font-size: clamp(11px, 3.5vw, 13px);
    }

    .stat-number {
        font-size: clamp(48px, 14vw, 64px);
    }

    .client-logo {
        height: 160px;
        width: 160px;
        padding: 20px;
    }

    .client-logo img {
        max-width: 70%;
        max-height: 70%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* Hide Top Golf on mobile */
    .client-logo[data-client="topgolf"] {
        display: none;
    }

    /* Override specific client logo sizes */
    .client-logo[data-client="immersive"] img {
        max-width: 70%;
        max-height: 70%;
    }

    .client-logo[data-client="cape-town"] img {
        max-width: 70%;
        max-height: 70%;
    }

    /* Universal override for ALL client logos */
    .clients-grid .client-logo img {
        max-width: 60%;
        max-height: 60%;
        width: auto;
        height: auto;
        object-fit: contain;
    }
}
/* ============================================== 
   STATS SECTION - CRITICAL FIXES
   ============================================== */

/* Small caps for M and BN */
.stats-container .stat-number .stat-unit {
    font-size: 0.65em !important;
    letter-spacing: 0.02em !important;
}

/* Vertical dividers between stats */
.stats-container .stat-item:not(:last-child)::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 1px !important;
    height: 60% !important;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    ) !important;
}

/* Luxury fade-in animation for stats */
.stats-container .stat-item {
    opacity: 0 !important;
    transform: translateY(20px) !important;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.stats-container .stat-item.animate {
    opacity: 1 !important;
    transform: translateY(0) !important;
}
