/* ============================================
   CHATBOT 2.0 WRAPPED - MAIN STYLES
   Main layout, grid, and structure
   ============================================ */

/* ====== RESET & BASE ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --white: #FFFFFF;
    --black: #000000;
    --overlay-dark: rgba(0, 0, 0, 0.6);
    --overlay-light: rgba(0, 0, 0, 0.4);
    --progress-inactive: rgba(255, 255, 255, 0.3);
    --hover-highlight: rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-weight-normal: 400;
    --font-weight-bold: 600;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    
    /* Story Container */
    --story-width: 600px;
    --story-height: 900px;
    --story-aspect-ratio: 2 / 3;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.4s ease;
    --transition-slow: 0.6s ease;
}

body {
    font-family: var(--font-family);
    background: transparent; /* Changed from var(--white) */
    color: var(--white); /* Keep all text white */
    min-height: 100vh;
    overflow-x: hidden;
}

/* ====== LANDING PAGE ====== */
.landing-page {
    min-height: 100vh;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ====== STORIES GRID ====== */
.stories-grid {
    display: grid;
    gap: 16px; /* Closer together - reduced from 24px */
    width: 100%;
    max-width: 1200px;
    margin: 0 auto; /* Center the grid */
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Desktop: 4x2 grid */
@media (min-width: 1000px) {
    .stories-grid {
        grid-template-columns: repeat(4, 1fr);
        justify-items: center; /* Center items within grid cells */
    }
}

/* Tablet: 3x3 grid */
@media (min-width: 600px) and (max-width: 999px) {
    .stories-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 900px;
        justify-items: center; /* Center items within grid cells */
    }
}

/* Mobile: 2 columns */
@media (max-width: 599px) {
    .stories-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 500px;
        justify-items: center; /* Center items within grid cells */
    }
}

/* ====== STORY CARD ====== */
.story-card {
    width: 160px; /* Fixed width for 60% smaller cards */
    height: 240px; /* Fixed height (2:3 aspect ratio) */
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform var(--transition-medium),
                box-shadow var(--transition-medium);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.story-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.story-card:active {
    transform: translateY(-4px) scale(1.01);
}

.story-card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
    transition: filter var(--transition-medium),
                transform var(--transition-medium);
}

.story-card:hover .story-card-background {
    filter: brightness(0.9);
    transform: scale(1.05);
}

.story-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
                                rgba(0, 0, 0, 0.3) 0%, 
                                rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    transition: background var(--transition-medium);
    text-align: center;
}

.story-card:hover .story-card-overlay {
    background: linear-gradient(to bottom, 
                                rgba(0, 0, 0, 0.2) 0%, 
                                rgba(0, 0, 0, 0.6) 100%);
}

.story-card-title {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: var(--font-weight-bold);
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    z-index: 1;
    color: var(--white);
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    width: 100%;
    padding: 0 var(--spacing-xs);
}

/* ====== UTILITY CLASSES ====== */
.hidden {
    display: none !important;
}

.blur-background {
    filter: blur(10px);
    transition: filter var(--transition-medium);
}

/* ====== ACCESSIBILITY ====== */
.skip-button:focus,
.story-card:focus {
    outline: 3px solid var(--white);
    outline-offset: 4px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====== LOADING STATE ====== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--progress-inactive);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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