html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    background-color: #1E191F;
    color: #F9EFF0;
}

.glass-nav {
    background: rgba(5, 15, 36, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.text-glow {
    text-shadow: 0 0 30px rgba(0, 163, 255, 0.3);
}

.mobile-menu-overlay {
    background: rgba(5, 15, 36, 0.95);
    backdrop-filter: blur(16px);
}

.tracking-ultra-tight {
    letter-spacing: 0.02em;
}

.outline-text {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.3);
    color: transparent;
}

video {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0) scale(1.05);
    -webkit-transform: translate3d(0, 0, 0) scale(1.05);
    will-change: transform;
}

@media (max-width: 767px) {
    video#hero-video {
        height: 80vh !important;
        width: 100vw !important;
        top: 5vh !important;
        transform: none !important;
        -webkit-transform: none !important;
        object-fit: cover;
        opacity: 0.75 !important;
        /* Mobile Edge Blending */
        mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
        -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
    }
}

/* LENIS REQUIRED CSS */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-scrolling iframe {
    pointer-events: none;
}

.hero-title-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    will-change: transform;
}

.hero-title {
    font-size: 16vw;
    line-height: 0.85;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 95vw;
}

@media (max-width: 767px) and (max-height: 700px) {
    .hero-title {
        font-size: 14vw;
        line-height: 0.8;
    }
}

.hero-line {
    display: block;
    width: 100%;
    text-align: center;
    white-space: normal;
}

@media (min-width: 768px) {
    .hero-title {
        line-height: 0.9;
        max-width: 90vw;
    }

    .hero-line {
        white-space: nowrap;
    }

    .hero-line-1 {
        font-size: 9.8vw;
        letter-spacing: -0.01em;
    }

    .hero-line-2 {
        font-size: 11.2vw;
        /* Larger font to match character count difference */
        letter-spacing: -0.01em;
    }
}

/* Essential for perfect overlap with object-cover video */
.mask-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    mask-image: url('../assets/images/HeroPersonNoBG.webp');
    -webkit-mask-image: url('../assets/images/HeroPersonNoBG.webp');
    mask-size: cover;
    -webkit-mask-size: cover;
    mask-position: center;
    -webkit-mask-position: center;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    /* GPU promotion for compositing performance */
    transform: translateZ(0) scale(1.05);
    -webkit-transform: translateZ(0) scale(1.05);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
}

@media (max-width: 767px) {
    .mask-layer {
        height: 80vh !important;
        width: 100vw !important;
        top: 5vh !important;
        left: 0 !important;
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
        mask-size: cover;
        -webkit-mask-size: cover;
        /* Double mask to combine person transparency + vertical fade */
        -webkit-mask-image: url('../assets/images/HeroPersonNoBG.webp'), linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
        mask-image: url('../assets/images/HeroPersonNoBG.webp'), linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
        -webkit-mask-composite: source-in;
        mask-composite: intersect;
    }
}

/* Solid title: Subtracted mask (Shows text everywhere EXCEPT the person) */
.layer-solid {
    mask-image: url('../assets/images/HeroPersonNoBG.webp'), linear-gradient(black, black);
    -webkit-mask-image: url('../assets/images/HeroPersonNoBG.webp'), linear-gradient(black, black);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 1;
}

/* Outlined title: Standard mask (Shows outline ONLY inside the person) */
.layer-outline {
    mask-image: url('../assets/images/HeroPersonNoBG.webp');
    -webkit-mask-image: url('../assets/images/HeroPersonNoBG.webp');
    z-index: 2;
}

/* Hero performance containment */
#home {
    contain: layout style paint;
}

.outline-text-effect {
    -webkit-text-stroke: 1px #F9EFF0;
    -webkit-text-stroke-width: 2.2px !important;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    font-weight: 400;
    /* Ensure we use the font's natural weight */
}

.badge-pill {
    background: #2E62FD;
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 15px rgba(46, 98, 253, 0.4);
}

.bg-dots {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4000 4000' fill='rgba(255, 255, 255, 0.05)'%3E%3Cg transform='translate(1600, 1600)'%3E%3Cpolygon points='400 136.97 209.84 246.76 209.84 351.43 400 241.64 499.51 299.09 499.51 414.01 209.84 581.25 209.84 663.03 400 663.03 400 576.12 590.16 466.34 590.16 246.76 400 136.97'/%3E%3Cpolygon points='400 257.35 209.84 367.14 209.84 466.34 209.84 565.54 400 455.75 400 257.35'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 150px 150px;
    background-repeat: repeat;
}

.bg-dots-dark {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4000 4000' fill='rgba(30, 25, 31, 0.04)'%3E%3Cg transform='translate(1600, 1600)'%3E%3Cpolygon points='400 136.97 209.84 246.76 209.84 351.43 400 241.64 499.51 299.09 499.51 414.01 209.84 581.25 209.84 663.03 400 663.03 400 576.12 590.16 466.34 590.16 246.76 400 136.97'/%3E%3Cpolygon points='400 257.35 209.84 367.14 209.84 466.34 209.84 565.54 400 455.75 400 257.35'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 150px 150px;
    background-repeat: repeat;
}

.clip-corner {
    clip-path: polygon(0 0, calc(100% - 40px) 0, 100% 40px, 100% 100%, 40px 100%, 0 calc(100% - 40px));
    border-radius: 0 !important;
}

.clip-corner-sm {
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
    border-radius: 0 !important;
}

.clip-all-corners {
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
    border-radius: 0 !important;
}

/* Sinistre button - drop-shadow border that follows clip-path */
.sinistre-btn {
    filter: drop-shadow(0 0 0.5px rgba(255, 255, 255, 0.15)) drop-shadow(0 0 0.5px rgba(255, 255, 255, 0.15));
    transition: filter 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

.sinistre-btn:hover {
    filter: drop-shadow(0 0 1px rgba(239, 68, 68, 0.6)) drop-shadow(0 0 1px rgba(239, 68, 68, 0.6));
}

@media (max-width: 767px) {
    .sinistre-btn {
        filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.4)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.4));
        background-color: rgba(30, 25, 31, 0.8) !important;
    }
}

.clip-tr-corner {
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    border-radius: 0 !important;
}

.clip-tr-corner-nav {
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    border-radius: 0 !important;
}

/* Fix for 1px sub-pixel line between sections */
#contact {
    margin-top: -1px;
}

.jules-link:hover {
    color: #FED653;
    /* pauze-yellow */
    transition: color 0.3s ease;
}

/* Performance Optimizations */
.service-card,
.project-card,
.reveal-text,
.manifesto-line,
.char {
    will-change: transform, opacity;
}

/* Ensure stacking context for glass elements */
.glass-nav,
.mobile-menu-overlay {
    z-index: 50;
    transform: translateZ(0);
}

/* Mobile Menu Animations */
#menu-btn.active {
    transform: scale(0.9);
}

#menu-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

#menu-btn.active span:nth-child(2) {
    opacity: 0;
}

#menu-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.mobile-link.show {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Navigation Theme System (Attribute Driven) */

/* Transition everything smoothly */
#navbar .nav-theme-container,
#navbar #menu-btn,
#navbar #menu-btn span,
#navbar img,
#navbar .nav-link {
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

/* 1. DARK SECTION THEME (Light elements needed) */
#navbar[data-current-theme="dark"] #menu-btn {
    background-color: white !important;
    border-color: rgba(30, 25, 31, 0.1) !important;
}

#navbar[data-current-theme="dark"] #menu-btn span {
    background-color: #1E191F !important;
}

#navbar[data-current-theme="dark"] .nav-theme-container {
    background-color: rgba(30, 25, 31, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

#navbar[data-current-theme="dark"] .nav-link {
    color: rgba(255, 255, 255, 0.5) !important;
}

#navbar[data-current-theme="dark"] img {
    filter: brightness(0) invert(1) !important;
}

/* 2. LIGHT SECTION THEME (Dark elements needed) */
#navbar[data-current-theme="light"] #menu-btn {
    background-color: #1E191F !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

#navbar[data-current-theme="light"] #menu-btn span {
    background-color: white !important;
}

#navbar[data-current-theme="light"] .nav-theme-container {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
}

#navbar[data-current-theme="light"] .nav-link {
    color: rgba(30, 25, 31, 0.4) !important;
}

#navbar[data-current-theme="light"] img {
    filter: brightness(0) invert(0) !important;
}

/* 3. OPEN MENU OVERRIDE (Must stay light on dark overlay) */
#navbar.menu-open #menu-btn {
    background-color: white !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

#navbar.menu-open #menu-btn span {
    background-color: #1E191F !important;
}

#navbar.menu-open img {
    filter: brightness(0) invert(1) !important;
}

/* Forced override for active links to ensure readability on the yellow pill */
#navbar .nav-link.active {
    color: #1E191F !important;
    opacity: 1 !important;
}

#navbar[data-current-theme="light"] .nav-link.active {
    color: #1E191F !important;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Custom Breathe Animation */
@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.6);
        opacity: 1;
        box-shadow: 0 0 10px rgba(254, 214, 83, 0.4);
    }
}

.animate-breathe {
    animation: breathe 2.5s infinite ease-in-out;
}

/* Mobile Tab Content Transition */
#services-tab-content {
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform, opacity;
}

/* Mobile subservice tap feedback */
.mobile-sub-item:active {
    transition-duration: 0.1s !important;
}

/* Thank You Popup & Success Animation */
#thank-you-popup {
    z-index: 99999 !important;
    position: fixed !important;
}

#thank-you-popup.active {
    pointer-events: auto;
    opacity: 1;
}

#thank-you-popup.active #thank-you-bg {
    opacity: 1;
}

#thank-you-popup.active #thank-you-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

@keyframes success-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-success-pop {
    opacity: 0;
}

#thank-you-popup.active .animate-success-pop {
    animation: success-pop 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    animation-delay: 0.3s;
}

#thank-you-bg {
    will-change: opacity;
}

#thank-you-content {
    will-change: transform, opacity;
    background-color: white !important;
    padding: 80px !important;
    /* Force large padding for breathing room */
}

#thank-you-content h3,
#thank-you-content p {
    color: #1E191F !important;
    /* Force dark text regardless of global styles */
}

#thank-you-content p {
    opacity: 0.8;
}

/* Small mobile overrides */
@media (max-width: 375px) {
    #contact h2 {
        font-size: 2.5rem !important;
        /* Slightly smaller than text-5xl (3rem) */
        line-height: 1;
    }
}

/* Button Loading State */
#submit-btn.loading {
    pointer-events: none;
    opacity: 0.7;
    filter: grayscale(0.5);
}

#submit-btn.loading span {
    display: none;
}

#submit-btn.loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Character spacing for breakout manifesto section */
#pauze-manifesto .char {
    margin-right: 0.02em;
}
#pauze-manifesto .char:last-child {
    margin-right: 0;
}