/* Font Face Declaration */
@font-face {
    font-family: 'Sarla-Apparat-Regular';
    src: url('./Sarla-Apparat-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Add smooth scrolling behavior */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    background: #000;
    font-family: 'Sarla-Apparat-Regular', Arial, sans-serif;
    overflow: auto;
    height: auto;
}

#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0f0f 0%, #1d1d1d 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #2c5530;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#loadingScreen.slide-up {
    transform: translateY(-100%);
}

#loadingScreen.hidden {
    display: none;
}

/* Big number on bottom left */
.big-number {
    position: absolute;
    bottom: 40px;
    left: 40px;
    font-size: 8rem;
    font-weight: bold;
    color: #737474;
    font-family: 'Sarla-Apparat-Regular', Arial, sans-serif;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Story container */
.story-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    width: 600px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    padding: 0 20px;
}

.story-container.visible {
    opacity: 1;
}

.story-text {
    font-size: clamp(1rem, 4vw, 1.3rem);
    line-height: 1.6;
    color: #f4f4f4;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    position: relative;
    overflow: visible;
    word-wrap: break-word;
    hyphens: none;
    white-space: pre-wrap;
}

/* Typewriter effect with proper cursor positioning */
.story-text.typing {
    overflow: visible;
    white-space: pre-wrap;
    position: relative;
}

.story-text.typing::after {
    content: '|';
    color: #747474;
    font-weight: bold;
    animation: blink-caret 0.75s step-end infinite;
    position: relative;
    display: inline-block;
}

/* Skip button styles - small light text like counter */
.skip-button {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #737474;
    font-family: 'Sarla-Apparat-Regular', Arial, sans-serif;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 0;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.skip-button:hover {
    color: #b2b4b4;
    transform: scale(1.1);
}

.skip-button.visible {
    opacity: 1;
}

/* Scroll hint animation */
.scroll-hint {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    color: #000000;
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 1;
    pointer-events: none;
    z-index: 100;
    text-align: center;
    transition: opacity 0.5s ease;
}

.scroll-hint.fade-out {
    opacity: 0;
}

.scroll-hint .arrow {
    display: block;
    font-size: 1.5rem;
    margin-top: 8px;
    animation: bounce 2s infinite;
}

/* Altitude counter for sky descent */
.altitude-counter {
    position: fixed;
    top: 40px;
    right: 40px;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    font-family: 'Sarla-Apparat-Regular', Arial, sans-serif;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.altitude-counter.visible {
    opacity: 1;
    visibility: visible;
}

.altitude-counter.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
}

/* Shop fade indicator */
.shop-fade-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f4f4f4;
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    z-index: 1500;
    text-align: center;
    transition: opacity 0.5s ease;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.shop-fade-indicator.visible {
    opacity: 1;
}

@keyframes scrollHintFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes blink-caret {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* Independent progress bar container at bottom */
.progress-container-independent {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: #1d1d1d;
    overflow: hidden;
    z-index: 1000;
    pointer-events: none;
}

.progress-bar-independent {
    height: 100%;
    background: linear-gradient(90deg, #f4f4f4, #f4f4f4);
    width: 0%;
    transition: width 0.1s linear;
    will-change: width;
    position: relative;
    z-index: 1001;
    transform: translateZ(0);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .story-container {
        max-width: 95%;
        width: auto;
        padding: 0 15px;
    }
    
    .story-text {
        font-size: clamp(0.9rem, 5vw, 1.1rem);
        line-height: 1.5;
    }
    
    .big-number {
        font-size: clamp(4rem, 15vw, 6rem);
        bottom: 20px;
        left: 20px;
    }
    
    .skip-button {
        font-size: clamp(1rem, 4vw, 1.3rem);
        bottom: 20px;
        right: 20px;
    }
    
    .altitude-counter {
        top: 20px;
        right: 20px;
        font-size: clamp(1rem, 4vw, 1.2rem);
        padding: 6px 10px;
    }
    
    .progress-container-independent {
        height: 6px;
    }
}

@media (max-width: 480px) {
    .story-container {
        max-width: 98%;
        padding: 0 10px;
    }
    
    .story-text {
        font-size: clamp(0.8rem, 6vw, 1rem);
        line-height: 1.4;
    }
    
    .big-number {
        font-size: clamp(3rem, 12vw, 5rem);
        bottom: 15px;
        left: 15px;
    }
    
    .skip-button {
        font-size: clamp(0.8rem, 3vw, 1rem);
        bottom: 15px;
        right: 15px;
    }
    
    .altitude-counter {
        top: 15px;
        right: 15px;
        font-size: clamp(0.9rem, 3vw, 1.1rem);
        padding: 5px 8px;
    }
}

#canvas {
    display: block;
    cursor: grab;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
}

#canvas:active {
    cursor: grabbing;
}

.controls {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0,0,0,0.7);
    padding: 15px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    z-index: 100;
    display: none; /* Hide controls */
}

.control-group {
    margin-bottom: 10px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.control-group input {
    width: 100%;
    margin-bottom: 5px;
}

.control-group button {
    background: #737474;
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 5px;
    margin-bottom: 5px;
}

.control-group button:hover {
    background: #737474;
}

.info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    padding: 15px;
    border-radius: 10px;
    color: white;
    font-size: 12px;
    z-index: 100;
    display: none; /* Hide info panel */
}

/* Final Video Container Styles */
.final-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
    display: none;
}

.final-video-container.visible {
    opacity: 1;
    display: block;
}

#finalVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Website Overlay Styles */
.website-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow scroll events to pass through */
    z-index: 2000;
    font-family: 'Sarla-Apparat-Regular', Arial, sans-serif;
    transition: opacity 0.3s ease;
    display: none; /* Initially hidden until animation starts */
}

.website-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Navigation Bar */
.overlay-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2001;
    pointer-events: auto; /* Enable clicks on navigation */
}

.nav-brand {
    color: #f4f4f4;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-menu {
    display: flex;
    gap: 15px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #f4f4f4;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.overlay-toggle {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Content Panels */
.overlay-panel {
    position: absolute;
    top: 80px;
    right: 30px;
    width: 350px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: #f4f4f4;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2002;
    overflow: hidden;
    pointer-events: auto; /* Enable clicks on panels */
}

/* Special styling for shop panel - full screen on desktop */
#shopPanel {
    top: 70px !important;
    right: 20px !important;
    left: 20px !important;
    bottom: auto !important;
    width: calc(100% - 40px) !important;
    height: auto !important;
    max-height: 80vh !important;
    border-radius: 12px !important;
    transform: none;
    opacity: 0;
    background: rgba(0, 0, 0, 0.6);
    position: absolute !important;
    z-index: 2002 !important;
    display: flex !important;
    flex-direction: column !important;
    transition: opacity 1.5s ease-in-out;
    pointer-events: none;
}

#shopPanel.active {
    opacity: 1;
    pointer-events: auto;
}

#shopPanel.active {
    opacity: 1;
}

#shopPanel.active {
    transform: translateY(0) !important;
}

#shopPanel.active {
    transform: translateY(0);
}

.overlay-panel.active {
    opacity: 1;
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #f4f4f4;
}

.panel-close {
    background: none;
    border: none;
    color: #f4f4f4;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.panel-content {
    padding: 20px 25px;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

.panel-content p {
    margin: 0 0 15px 0;
    font-size: 0.95rem;
}

.panel-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.panel-content li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.panel-content li:last-child {
    border-bottom: none;
}

.contact-info p {
    margin: 8px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Promo Text Styles */
.promo-text {
    text-align: center;
    padding: 15px 30px;
    margin: 20px 30px 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Product Grid Styles */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

/* Special grid for shop panel */
#shopPanel .product-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px;
    margin: 15px 0 !important;
    padding: 0 30px;
    display: grid !important;
    align-content: start;
    height: auto !important;
    min-height: auto !important;
    box-sizing: border-box;
}

.product-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Override for shop panel items */
#shopPanel .product-item {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Special styling for shop panel content */
#shopPanel .panel-header {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    height: auto !important;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 204;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px 15px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#shopPanel .panel-content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    z-index: 203;
    box-sizing: border-box;
}

/* Special styling for shop panel items */
#shopPanel .product-item {
    padding: 8px !important;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.product-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.product-image {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

.product-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    margin-bottom: 0;
    transition: transform 0.3s ease;
    display: block;
}

/* Special styling for shop panel images */
#shopPanel .product-image img {
    height: auto;
    border-radius: 0;
    margin-bottom: 0;
}

.product-item:hover .product-image img {
    transform: scale(1.05);
}

.product-name {
    font-size: 0.85rem;
    color: #f4f4f4;
    font-weight: 500;
    line-height: 1.3;
}

.shop-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.shop-btn {
    background: linear-gradient(135deg, #2c5530, #1a3d1e);
    color: #f4f4f4;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.shop-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #3a6b3e, #2c5530);
}

/* Floating Action Button */
.floating-action {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2001;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: auto; /* Enable clicks on floating action button */
}

.floating-action:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.fab-icon {
    color: #f4f4f4;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Status Bar */
.status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2001;
    pointer-events: auto; /* Enable clicks on status bar */
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f4f4f4;
    font-size: 0.85rem;
}

.status-icon {
    font-size: 1rem;
}

.status-text {
    opacity: 0.9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .overlay-nav {
        padding: 12px 20px;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .nav-menu {
        gap: 10px;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .overlay-panel {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        top: 70px;
    }
    
    /* Mobile-specific adjustments for shop panel */
    #shopPanel .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        margin: 15px 0;
        padding: 0 15px;
        height: auto !important;
        min-height: auto !important;
    }
    
    #shopPanel .product-item {
        padding: 6px;
        background: transparent;
        border: none;
    }
    
    #shopPanel .product-image img {
        height: auto;
        border-radius: 0;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-item {
        padding: 12px;
    }
    
    .product-image {
        font-size: 2rem;
    }
    
    .product-image img {
        height: auto;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
    
    .floating-action {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .fab-icon {
        font-size: 1.2rem;
    }
    
    .status-bar {
        padding: 10px 20px !important;
        flex-direction: row !important; /* Keep in one line on mobile */
        gap: 0 !important; /* Remove gap to use space-evenly properly */
        justify-content: space-evenly !important; /* Evenly distribute items */
    }
    
    .status-item {
        font-size: 0.6rem !important; /* Reduced to 0.6rem to ensure one line */
        flex: 1 !important; /* Equal spacing on mobile */
        text-align: center !important; /* Center text on mobile */
        justify-content: center !important; /* Center the flex content */
    }
    
    .status-icon {
        font-size: 0.7rem; /* Reduced icon size for mobile */
    }
}

@media (max-width: 480px) {
    .overlay-nav {
        padding: 10px 15px;
    }
    
    .nav-brand {
        font-size: 1rem;
    }
    
    .nav-menu {
        gap: 8px;
    }
    
    .nav-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    .overlay-panel {
        width: calc(100% - 30px);
        right: 15px;
        left: 15px;
        top: 60px;
    }
    
    .panel-header {
        padding: 15px 20px 10px;
    }
    
    .panel-header h3 {
        font-size: 1.1rem;
    }
    
    .panel-content {
        padding: 15px 20px;
    }
    
    .floating-action {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .fab-icon {
        font-size: 1.1rem;
    }
    
    .status-bar {
        padding: 8px 15px !important;
        gap: 0 !important; /* Remove gap to use space-evenly properly */
        justify-content: space-evenly !important; /* Evenly distribute items */
    }
    
    .status-item {
        font-size: 0.55rem !important; /* Even smaller for very small screens */
        flex: 1 !important; /* Equal spacing on mobile */
        text-align: center !important; /* Center text on mobile */
        justify-content: center !important; /* Center the flex content */
    }
    
    .status-icon {
        font-size: 0.65rem; /* Smaller icon for very small screens */
    }
}
