* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00d4ff;
    --secondary-color: #0066cc;
    --bg-dark: #0a0e27;
    --bg-darker: #050810;
    --text-light: #e0e0e0;
    --terminal-green: #00ff41;
    --terminal-bg: #0d1117;
    --wopr-green: #39ff14;
    --wopr-bg: #000000;
    /* Flotilla brand colors for terminal */
    --flotilla-primary: #7F7EFF;
    --flotilla-secondary: #0066cc;
    --flotilla-bg-dark: #0a0e27;
    --flotilla-bg-darker: #091519;
    --flotilla-text: #e0e0e0;
}

body {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    overflow-x: hidden;
    overflow-y: hidden; /* Prevent page scroll during animation */
    background: var(--bg-darker);
    color: var(--text-light);
}

/* Allow overflow when animation is active */
html.animating,
body.animating {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Mobile: Prevent viewport resize twitches */
@media (max-width: 768px) {
    html {
        /* Lock viewport height to prevent address bar show/hide causing resize */
        height: 100vh;
        height: -webkit-fill-available; /* iOS Safari */
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
        overflow: hidden;
    }
    
    body {
        /* Lock body to prevent resize twitches */
        height: 100vh;
        height: -webkit-fill-available; /* iOS Safari */
        width: 100%;
        overflow: hidden;
        position: relative;
    }
    
    html.animating,
    body.animating {
        /* Keep locked during animation to prevent twitches */
        position: fixed !important;
        height: 100vh !important;
        height: -webkit-fill-available !important;
        width: 100% !important;
        /* Allow overflow during animation so zoom doesn't clip */
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    
    /* Prevent hero section from resizing */
    .hero-section {
        position: fixed !important;
        height: 100vh !important;
        height: -webkit-fill-available !important;
        width: 100vw !important;
        width: 100% !important;
    }
}

/* Hero Section */
.hero-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
}

/* Allow overflow during animation so zoom doesn't clip */
.hero-section.animating {
    overflow: visible;
}

body.animating {
    overflow: visible;
}

.hero-section.hidden {
    display: none;
}

/* Static Hero Image Background - Base layer showing trees and static elements */
/* This is a STATIC IMAGE (cinemagraph style) - not a video */
.hero-image-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/hero-image.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Prevent resize twitches */
    z-index: 1; /* Base layer - always visible */
    /* Prevent layout shifts */
    will-change: auto;
    transform: translateZ(0); /* Force GPU layer */
    /* Ensure background loads immediately and is visible */
    content-visibility: auto;
    contain-intrinsic-size: 100vw 100vh;
    /* Ensure image quality - no compression artifacts */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent video-like artifacts */
    background-color: var(--flotilla-bg-darker); /* Fallback color */
    /* Isolation prevents video blend modes from affecting this layer */
    isolation: isolate;
}

/* Ocean Waves Video Wrapper - Masked to show only water area */
.ocean-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
    /* Enhanced mask: white areas show video (water), black areas are transparent (show static image) */
    mask-image: url('assets/ocean-mask.png');
    mask-size: cover;
    mask-position: center center;
    mask-repeat: no-repeat;
    -webkit-mask-image: url('assets/ocean-mask.png');
    -webkit-mask-size: cover;
    -webkit-mask-position: center center;
    -webkit-mask-repeat: no-repeat;
    /* Improve mask rendering */
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
    /* Smooth mask transitions */
    transition: mask-position 0.3s ease, -webkit-mask-position 0.3s ease;
}

.ocean-video {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center; /* Match background anchor point */
}

/* Satellite Video Wrapper - Masked to show only sky area, behind trees */
.satellite-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Same as ocean, but masked differently - behind trees */
    overflow: hidden;
    /* CRITICAL: Mask - white areas show video (sky), black areas are transparent (trees/beach stay visible) */
    mask-image: url('assets/sky-mask.png');
    mask-size: cover;
    mask-position: center center;
    mask-repeat: no-repeat;
    -webkit-mask-image: url('assets/sky-mask.png');
    -webkit-mask-size: cover;
    -webkit-mask-position: center center;
    -webkit-mask-repeat: no-repeat;
    /* Mask mode: luminance - white shows, black hides */
    mask-mode: luminance;
    /* Use intersect composite to create harder edges - cuts out gray/soft areas */
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
    /* Smooth mask transitions */
    transition: mask-position 0.3s ease, -webkit-mask-position 0.3s ease;
    /* Ensure wrapper doesn't block background */
    background: transparent;
    pointer-events: none;
    /* Isolation prevents blend modes from affecting the background image */
    isolation: isolate;
}


.satellite-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center; /* Match background anchor point */
    /* Opacity - balance between satellite visibility and star visibility */
    opacity: 0.3;
    /* Screen blend mode: only adds light, never darkens */
    /* Screen makes black transparent, so very bright video ensures dark areas don't show */
    mix-blend-mode: screen;
    /* Ensure video is visible and playing */
    display: block;
    /* Force hardware acceleration */
    transform: translateZ(0);
    will-change: opacity;
    /* Very bright video - pushes dark areas toward white */
    /* Screen blend then makes black transparent, only bright satellites show */
    /* This prevents any darkening of the sky */
    filter: brightness(3) contrast(1.5);
}

/* Sky Mask Overlay - Ensures trees stay clear and visible */
/* Note: Trees are actually part of the static background image, so they're already on z-index 1 */
/* This overlay is just a safety layer */
.sky-mask-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3; /* Above all videos, ensures nothing covers trees */
    pointer-events: none;
    background: transparent;
}

/* Black overlay for fade transition */
.hero-black-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--flotilla-bg-darker); /* Use gunmetal instead of black for smooth transition */
    z-index: 4;
    opacity: 0;
    transition: opacity 1.5s ease-in;
    pointer-events: none;
}

.hero-black-overlay.active {
    opacity: 1;
}

/* Logo Container - Full Screen for 4K Animation */
.logo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: none; /* Logo itself doesn't block clicks */
    transform-origin: center center;
    overflow: visible !important; /* Allow zoom to extend beyond viewport */
    overflow-x: visible !important;
    overflow-y: visible !important;
    clip: unset !important;
    clip-path: none !important;
    will-change: transform;
    /* Hide initially until Lottie is fully loaded and positioned to prevent pop */
    opacity: 0 !important;
    visibility: hidden !important;
}

.logo-container.loaded {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 1s ease-in;
}

.logo-container.animating {
    transition: none; /* Controlled by JavaScript for smooth scroll */
}

/* Enhanced logo animation transitions */
.logo-container.loaded {
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-lottie-wrapper {
    transition: opacity 0.8s ease-in-out, 
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-lottie-wrapper.positioned {
    animation: logoFadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.logo-lottie-wrapper {
    position: absolute;
    /* Position and size will be set by JavaScript immediately on load */
    /* Hide until JS calculates correct position to prevent visual jump */
    opacity: 0 !important;
    visibility: hidden !important;
    top: 0;
    left: 0;
    transform: none;
    transform-origin: top center;
    width: 0 !important;
    height: 0 !important;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 3840 / 2160; /* Lottie animation is 2x scale (3840x2160) */
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.6));
    will-change: transform, opacity;
    overflow: visible !important;
    clip: unset !important;
    clip-path: none !important;
    max-width: none !important;
    max-height: none !important;
    /* Performance optimizations */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    /* The wrapper is set to correct size and position by JS before showing */
    /* Positioned so top edge is just above viewport to allow elements to fly away properly */
}

/* .logo-lottie-wrapper.positioned - visibility controlled via inline styles in JS */

/* Optimize Lottie SVG rendering (desktop) */
.logo-lottie-wrapper svg {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Mobile-specific SVG optimizations */
@media (max-width: 768px) {
    .logo-lottie-wrapper {
        /* Use GPU acceleration for transforms on mobile */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
    
    .logo-lottie-wrapper svg {
        /* SVG optimizations for mobile - prevent rendering glitches at large scales */
        shape-rendering: auto;
        text-rendering: auto;
        /* Allow overflow for large animations */
        overflow: visible;
    }
}

/* Wrapper size is set by JavaScript on load - no dynamic changes during animation */

/* Mute Button - Minimal, subtle, lower right */
.mute-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s ease;
    padding: 0;
    margin: 0;
}

.mute-button:hover {
    opacity: 0.8;
}

.mute-button:active {
    opacity: 0.6;
}

.mute-button.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.mute-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s ease;
}

.mute-button:hover .mute-icon {
    color: rgba(255, 255, 255, 0.8);
}

.mute-button.muted .icon-unmuted {
    display: none;
}

.mute-button.muted .icon-muted {
    display: block !important;
}

.mute-button:not(.muted) .icon-muted {
    display: none;
}

.mute-button:not(.muted) .icon-unmuted {
    display: block;
}

/* During animation, remove all size constraints */
.logo-container.animating .logo-lottie-wrapper {
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    clip: unset !important;
    clip-path: none !important;
}

.logo-lottie-wrapper svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible !important;
}

.logo-lottie-wrapper svg * {
    overflow: visible !important;
}

.logo-image {
    height: min(52.5vh, 600px);
    width: auto;
    aspect-ratio: 1920 / 1080;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.6));
    display: block;
    object-fit: contain;
}

/* Logo mark styles removed - now handled by Lottie animation */

/* Logo scaling animation - CSS fallback */
.logo.scaling {
    animation: logoScale 7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    will-change: transform;
}

@keyframes logoScale {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(80);
    }
}

/* Click indicator removed */

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Full Screen CRT Terminal Section - Flotilla Brand Colors */
.terminal-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--flotilla-bg-darker); /* Flotilla brand dark background */
    display: none;
    z-index: 9; /* Above overlay (z-index 8) and hero (z-index 1) */
    overflow: hidden;
    opacity: 0;
    flex-direction: column;
}

.terminal-section.active {
    display: flex;
    /* No fade animation - terminal is already at full opacity when shown */
    opacity: 1;
}

@keyframes terminalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.crt-terminal {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--flotilla-bg-darker); /* Flotilla brand dark background */
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace; /* Modern monospace with SF Mono */
    /* Enhanced CRT screen effect with brand colors */
    box-shadow: 
        inset 0 0 100px rgba(127, 126, 255, 0.15),
        inset 0 0 200px rgba(127, 126, 255, 0.05),
        0 0 50px rgba(127, 126, 255, 0.1); /* Flotilla primary color glow */
    position: relative;
    overflow: hidden;
}

/* Enhanced CRT scanline effect with brand colors and animation */
.crt-terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(127, 126, 255, 0.06) 2px,
        rgba(127, 126, 255, 0.06) 4px
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
    animation: scanlineMove 8s linear infinite;
    opacity: 0.8;
}

/* Enhanced CRT phosphor glow effect with brand colors */
.crt-terminal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(
            ellipse at 20% 30%,
            rgba(127, 126, 255, 0.12) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at 80% 70%,
            rgba(127, 126, 255, 0.08) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at center,
            transparent 0%,
            rgba(127, 126, 255, 0.1) 100%
        );
    pointer-events: none;
    z-index: 1;
    animation: phosphorFlicker 3s ease-in-out infinite;
}

/* CRT scanline animation */
@keyframes scanlineMove {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(4px);
    }
}

/* Subtle phosphor flicker animation */
@keyframes phosphorFlicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.95;
    }
}

/* Additional CRT screen curvature effect */
.crt-terminal {
    position: relative;
}

.crt-terminal::before {
    /* Add subtle screen curvature distortion */
    transform: perspective(1000px) rotateX(0.5deg);
    transform-origin: center center;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px;
    background: var(--flotilla-bg-darker); /* Flotilla brand dark background */
    color: var(--flotilla-primary); /* Flotilla primary cyan color */
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace; /* Brand-appropriate monospace */
    -webkit-font-smoothing: none;
    font-smooth: never;
    position: relative;
    z-index: 2;
    /* Text glow with brand primary color */
    text-shadow: 0 0 3px rgba(127, 126, 255, 0.6), 0 0 6px rgba(127, 126, 255, 0.3); /* Flotilla primary glow */
    display: flex;
    flex-direction: column;
}

.terminal-output::-webkit-scrollbar {
    width: 16px;
}

.terminal-output::-webkit-scrollbar-track {
    background: var(--flotilla-bg-darker); /* Flotilla brand dark background */
}

.terminal-output::-webkit-scrollbar-thumb {
    background: rgba(127, 126, 255, 0.3); /* Flotilla primary color */
    border: 1px solid rgba(127, 126, 255, 0.2);
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: rgba(127, 126, 255, 0.5); /* Flotilla primary color hover */
}

.terminal-line {
    margin-bottom: 2px;
    word-wrap: break-word;
    color: #c8dcff; /* White/bluish CRT color */
    font-family: 'Monaco', 'Courier New', monospace;
    text-shadow: 0 0 3px rgba(200, 220, 255, 0.5);
}

.terminal-image-line {
    margin: 15px 0;
    display: block;
}

.terminal-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border: 1px solid rgba(127, 126, 255, 0.3);
    /* Duotone filter: black and Flotilla blue (#7F7EFF) */
    /* Use SVG filter for true duotone effect - black shadows, blue highlights */
    filter: url(#duotone-black-blue);
    /* Fallback for browsers that don't support SVG filters */
    filter: grayscale(100%) contrast(1.3) brightness(0.85);
}

.prompt {
    color: #c8dcff;
    margin-right: 4px;
    text-shadow: 0 0 3px rgba(200, 220, 255, 0.5);
}

.command {
    color: #c8dcff;
    text-shadow: 0 0 3px rgba(200, 220, 255, 0.5);
}

.output {
    color: var(--flotilla-primary); /* Flotilla primary color */
    display: block;
    text-shadow: 0 0 3px rgba(127, 126, 255, 0.6), 0 0 6px rgba(127, 126, 255, 0.3); /* Brand glow */
}

.terminal-link {
    color: #FF8C42 !important; /* Flotilla brand orange */
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
    text-shadow: 0 0 3px rgba(255, 140, 66, 0.6), 0 0 6px rgba(255, 140, 66, 0.3);
}

.terminal-link:hover {
    color: #FF6B35 !important; /* Slightly darker orange on hover */
    text-shadow: 0 0 5px rgba(255, 140, 66, 0.8), 0 0 10px rgba(255, 140, 66, 0.5);
}

.terminal-input-line {
    display: flex;
    align-items: center;
    padding: 0;
    background: transparent;
    font-size: 14px;
    min-height: auto;
    margin-top: 8px;
    position: relative;
    z-index: 2;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--flotilla-primary); /* Flotilla primary color */
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace; /* Brand-appropriate monospace */
    font-size: 14px;
    margin-left: 4px;
    padding: 0;
    width: auto;
    min-width: 1ch;
    -webkit-font-smoothing: none;
    font-smooth: never;
    text-shadow: 0 0 3px rgba(127, 126, 255, 0.6), 0 0 6px rgba(127, 126, 255, 0.3); /* Brand glow */
}

.terminal-input::placeholder {
    color: rgba(127, 126, 255, 0.4); /* Flotilla primary color with reduced opacity */
}

.cursor {
    color: var(--flotilla-primary); /* Flotilla primary color */
    animation: blink 1s infinite;
    margin-left: 2px;
    font-weight: normal;
    text-shadow: 0 0 5px rgba(127, 126, 255, 0.9), 0 0 10px rgba(127, 126, 255, 0.5); /* Strong brand glow */
    flex-shrink: 0;
}

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

/* Mobile options buttons - only visible on mobile */
.terminal-mobile-options {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 15px 20px;
    margin-top: 10px;
}

.mobile-option-btn {
    background: rgba(127, 126, 255, 0.1);
    border: 1px solid rgba(127, 126, 255, 0.3);
    color: var(--flotilla-primary);
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 14px;
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-shadow: 0 0 3px rgba(127, 126, 255, 0.6);
    white-space: nowrap;
    user-select: none;
}

.mobile-option-btn:hover {
    background: rgba(127, 126, 255, 0.2);
    border-color: rgba(127, 126, 255, 0.5);
    box-shadow: 0 0 10px rgba(127, 126, 255, 0.3);
}

.mobile-option-btn:active {
    background: rgba(127, 126, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo-svg {
        width: 350px;
    }
    
    .terminal-output {
        font-size: 12px;
        padding: 15px;
        /* Improve touch scrolling on mobile */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .terminal-input {
        font-size: 12px;
        /* Prevent zoom on focus (iOS) */
        font-size: 16px;
    }
    
    .terminal-input-line {
        padding: 6px 15px;
    }
    
    .terminal-mobile-options {
        display: flex;
    }
    
    .mobile-option-btn {
        font-size: 12px;
        padding: 10px 16px;
        /* Improve touch targets */
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve hero section on mobile */
    .hero-image-bg {
        background-attachment: scroll; /* Better performance on mobile */
    }
    
    .ocean-video-wrapper,
    .sky-video-wrapper {
        /* Optimize video rendering on mobile */
        transform: translateZ(0);
        will-change: transform;
    }
    
    /* Reduce CRT effects on mobile for performance */
    .crt-terminal::before {
        animation: none;
        opacity: 0.5;
    }
    
    .crt-terminal::after {
        animation: none;
        opacity: 0.7;
    }
}

@media (max-width: 480px) {
    .logo-svg {
        width: 280px;
    }
    
    .click-indicator p {
        font-size: 12px;
    }
}
