/* ============================================
   scriptgrapher.com - Styles
   Colors: #f5f0e8, #1a1a2e, #6c757d, #4a90d9, #e8b84b
   Fonts: Space Grotesk (display), Inter (body)
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #1a1a2e;
    color: #f5f0e8;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
    background: linear-gradient(180deg, rgba(26, 26, 46, 0.9) 0%, rgba(26, 26, 46, 0) 100%);
}

.nav-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    color: #e8b84b;
}

.nav-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    cursor: pointer;
    transition: all 0.4s ease;
}

.nav-dot.active {
    background: #e8b84b;
    width: 24px;
    border-radius: 4px;
}

.nav-scroll-hint {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #6c757d;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-scroll-hint .arrow {
    display: inline-block;
    animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(6px); opacity: 0.5; }
}

/* --- Scroll Container --- */
#scroll-container {
    display: flex;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* --- Panels --- */
.panel {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Panel Blobs --- */
.panel-blob {
    position: absolute;
    width: 70vmin;
    height: 70vmin;
    border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
    opacity: 0.25;
    filter: blur(40px);
    transition: transform 2s ease;
    animation: blobMorph 15s ease-in-out infinite;
}

@keyframes blobMorph {
    0%, 100% { border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%; }
    25% { border-radius: 55% 45% 35% 65% / 58% 42% 58% 42%; }
    50% { border-radius: 30% 70% 50% 50% / 65% 35% 65% 35%; }
    75% { border-radius: 65% 35% 58% 42% / 35% 65% 42% 58%; }
}

.blob-hero {
    background: radial-gradient(circle, #4a90d9, #1a1a2e);
    top: 10%;
    right: -10%;
}

.blob-sapphire {
    background: radial-gradient(circle, #4a90d9, #1a1a2e);
    top: 15%;
    left: -5%;
}

.blob-gold {
    background: radial-gradient(circle, #e8b84b, #1a1a2e);
    bottom: 5%;
    right: -10%;
}

.blob-emerald {
    background: radial-gradient(circle, #2d8a56, #1a1a2e);
    top: 5%;
    right: 5%;
}

.blob-amethyst {
    background: radial-gradient(circle, #8b5cf6, #1a1a2e);
    bottom: 10%;
    left: -5%;
}

.blob-finale {
    background: radial-gradient(circle, #e8b84b, #4a90d9, #1a1a2e);
    width: 90vmin;
    height: 90vmin;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- Parallax Layers --- */
.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-glyph {
    position: absolute;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    opacity: 0.08;
    color: #f5f0e8;
    user-select: none;
}

.parallax-back .floating-glyph {
    font-size: 20rem;
}

.parallax-front .floating-glyph {
    font-size: 12rem;
    opacity: 0.05;
}

.glyph-1 { top: 5%; left: 10%; }
.glyph-2 { bottom: 10%; right: 15%; }
.glyph-3 { top: 60%; right: 8%; }
.glyph-4 { top: 10%; right: 20%; }
.glyph-5 { bottom: 15%; left: 10%; }
.glyph-6 { top: 8%; left: 15%; }
.glyph-7 { bottom: 20%; right: 10%; }
.glyph-8 { top: 12%; left: 8%; }
.glyph-9 { bottom: 8%; right: 15%; }
.glyph-10 { top: 15%; left: 12%; }
.glyph-11 { top: 20%; left: 10%; }
.glyph-12 { bottom: 20%; right: 10%; }

/* --- Panel Content --- */
.panel-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
    padding: 0 40px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.panel.in-view .panel-content {
    opacity: 1;
    transform: translateY(0);
}

/* --- Typography --- */
.display-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 10rem;
    line-height: 0.9;
    letter-spacing: -0.03em;
    color: #f5f0e8;
    margin-bottom: 24px;
}

.subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.6;
    color: #6c757d;
    letter-spacing: 0.02em;
}

.act-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #e8b84b;
    margin-bottom: 16px;
}

.scene-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 5rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #f5f0e8;
    margin-bottom: 32px;
}

/* --- Script Block --- */
.script-block {
    font-family: 'Inter', sans-serif;
    border-left: 2px solid #4a90d9;
    padding-left: 24px;
}

.script-line {
    padding: 8px 0;
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.panel.in-view .script-line {
    opacity: 1;
    transform: translateX(0);
}

.panel.in-view .script-line:nth-child(1) { transition-delay: 0.2s; }
.panel.in-view .script-line:nth-child(2) { transition-delay: 0.4s; }
.panel.in-view .script-line:nth-child(3) { transition-delay: 0.6s; }
.panel.in-view .script-line:nth-child(4) { transition-delay: 0.8s; }

.line-num {
    color: #6c757d;
    font-size: 0.75rem;
    margin-right: 12px;
    font-variant-numeric: tabular-nums;
}

.character {
    color: #e8b84b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.direction {
    color: #6c757d;
    font-style: italic;
}

.dialogue {
    color: #f5f0e8;
    font-weight: 500;
}

/* --- Graph Visual --- */
.graph-visual {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 250px;
    margin-bottom: 32px;
}

.graph-bar {
    flex: 1;
    background: linear-gradient(180deg, #4a90d9 0%, rgba(74, 144, 217, 0.3) 100%);
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #f5f0e8;
    height: 0;
    transition: height 1s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.panel.in-view .graph-bar {
    height: calc(var(--bar-h) * 1%);
}

.panel-description {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #6c757d;
    max-width: 500px;
}

/* --- Feature Grid --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 8px;
}

.feature-card {
    background: rgba(245, 240, 232, 0.04);
    border: 1px solid rgba(245, 240, 232, 0.08);
    border-radius: 16px;
    padding: 28px;
    transition: transform 0.4s ease, background 0.4s ease;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease, background 0.4s ease;
}

.panel.in-view .feature-card {
    opacity: 1;
    transform: translateY(0);
}

.panel.in-view .feature-card:nth-child(1) { transition-delay: 0.2s; }
.panel.in-view .feature-card:nth-child(2) { transition-delay: 0.4s; }
.panel.in-view .feature-card:nth-child(3) { transition-delay: 0.6s; }

.feature-card:hover {
    background: rgba(245, 240, 232, 0.08);
    transform: translateY(-4px);
}

.feature-icon {
    margin-bottom: 16px;
}

.feature-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #f5f0e8;
    margin-bottom: 8px;
}

.feature-card p {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #6c757d;
}

/* --- Timeline Visual --- */
.timeline-visual {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 40px;
}

.timeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.node-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #6c757d;
    background: transparent;
    transition: all 0.6s ease;
    position: relative;
}

.timeline-node.active .node-marker {
    border-color: #e8b84b;
    background: #e8b84b;
    box-shadow: 0 0 20px rgba(232, 184, 75, 0.4);
}

.node-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6c757d;
    transition: color 0.6s ease;
}

.timeline-node.active .node-label {
    color: #e8b84b;
}

.timeline-connector {
    flex: 1;
    height: 2px;
    background: #6c757d;
    min-width: 60px;
    opacity: 0.3;
    position: relative;
    top: -14px;
}

/* --- CTA Button --- */
.cta-button {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    color: #1a1a2e;
    background: #e8b84b;
    border: none;
    padding: 16px 48px;
    border-radius: 60px;
    cursor: pointer;
    margin-top: 32px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(232, 184, 75, 0.3);
    background: #f0c75e;
}

.cta-button:active {
    transform: translateY(0);
}

/* --- Finale Panel --- */
.finale-title {
    font-size: 8rem;
    text-align: center;
}

.panel-finale .subtitle {
    text-align: center;
}

.panel-finale .panel-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Panel Backgrounds --- */
.panel-hero {
    background: #1a1a2e;
}

.panel-act-one {
    background: linear-gradient(135deg, #1a1a2e 0%, #1e2444 100%);
}

.panel-act-two {
    background: linear-gradient(135deg, #1a1a2e 0%, #2e1a1a 100%);
}

.panel-act-three {
    background: linear-gradient(135deg, #1a1a2e 0%, #1a2e22 100%);
}

.panel-showcase {
    background: linear-gradient(135deg, #1a1a2e 0%, #251a2e 100%);
}

.panel-finale {
    background: radial-gradient(ellipse at center, #252040 0%, #1a1a2e 70%);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .display-title {
        font-size: 5rem;
    }
    
    .scene-title {
        font-size: 3rem;
    }
    
    .finale-title {
        font-size: 4.5rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .graph-visual {
        height: 160px;
    }
    
    #main-nav {
        padding: 0 20px;
    }
    
    .nav-scroll-hint {
        display: none;
    }
    
    .panel-content {
        padding: 0 24px;
    }
    
    .parallax-back .floating-glyph {
        font-size: 12rem;
    }
    
    .parallax-front .floating-glyph {
        font-size: 6rem;
    }
}