/* =================================
   STORY-TELLING ENGINE - MAIN STYLES
   The Twilight Garden Aesthetic
   ================================= */

/* CSS Variables - Twilight Garden Palette */
:root {
    /* Colors */
    --bg-primary: #1a1b3c;
    --bg-secondary: #252647;
    --bg-tertiary: #2f3159;
    --text-primary: #f4f1e8;
    --text-secondary: #c4c1b8;
    --text-dim: #8a8780;
    --accent-lavender: #a78bcc;
    --accent-sage: #8fbc8f;
    --accent-amber: #f4a261;
    --border-subtle: #3a3b5c;
    
    /* Typography */
    --font-display: 'Inter', sans-serif;
    --font-body: 'Crimson Text', serif;
    --font-hand: 'Indie Flower', cursive;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 6rem;
    
    /* Transitions */
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-quick: all 0.2s ease;
}

/* =================================
   RESET & BASE
   ================================= */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0f1028 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* =================================
   TYPOGRAPHY
   ================================= */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-sm);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }

p {
    margin-bottom: var(--space-sm);
}

strong {
    font-weight: 600;
    color: var(--accent-lavender);
}

em {
    font-style: italic;
    color: var(--accent-sage);
}

a {
    color: var(--accent-lavender);
    text-decoration: none;
    transition: var(--transition-quick);
}

a:hover {
    color: var(--accent-amber);
    text-decoration: underline;
}

/* =================================
   PROGRESS NAVIGATION
   ================================= */

#progress-nav {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    background: rgba(26, 27, 60, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: 2rem;
    padding: 0.75rem 1.25rem;
}

.progress-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.phase-indicator {
    width: 12px;
    height: 12px;
    border: none;
    background: var(--border-subtle);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 0;
}

.phase-indicator:hover {
    background: var(--accent-sage);
    transform: scale(1.3);
}

.phase-indicator.active {
    background: var(--accent-lavender);
    box-shadow: 0 0 20px rgba(167, 139, 204, 0.5);
}

.phase-indicator.completed {
    background: var(--accent-sage);
}

/* =================================
   MAIN CONTAINER
   ================================= */

#story-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
}

.story-section {
    min-height: 100vh;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition-smooth);
    padding: var(--space-lg) 0;
}

.story-section.active {
    opacity: 1;
    transform: translateY(0);
}

.content-wrapper {
    max-width: 700px;
    margin: 0 auto;
}

/* =================================
   OPENING SECTION
   ================================= */

#opening {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.opening-content {
    max-width: 600px;
}

.symbol {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    animation: gentle-pulse 3s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sage));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-family: var(--font-display);
    margin-bottom: var(--space-lg);
}

.intro-text {
    font-size: 1.25rem;
    line-height: 2;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.intro-text.emphasis {
    color: var(--accent-lavender);
    font-weight: 600;
    font-size: 1.4rem;
}

/* =================================
   PHASE SECTIONS
   ================================= */

.phase-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    border-bottom: 2px solid var(--border-subtle);
    padding-bottom: var(--space-md);
}

.phase-number {
    font-family: var(--font-display);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-sage);
    display: block;
    margin-bottom: var(--space-xs);
}

.phase-title {
    font-size: 3rem;
    margin-bottom: var(--space-xs);
}

.phase-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.25rem;
}

/* =================================
   NARRATIVE BLOCKS
   ================================= */

.narrative-block {
    margin-bottom: var(--space-lg);
}

.narrative-block.highlighted {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-lavender);
    padding: var(--space-md);
    border-radius: 0 8px 8px 0;
    margin: var(--space-lg) 0;
}

.narrative-block h3 {
    color: var(--accent-lavender);
    margin-bottom: var(--space-md);
}

/* =================================
   BLOCKQUOTES
   ================================= */

blockquote {
    margin: var(--space-md) 0;
    padding: var(--space-md);
    border-left: 4px solid var(--accent-sage);
    background: rgba(143, 188, 143, 0.05);
    border-radius: 0 8px 8px 0;
}

blockquote.human-voice {
    border-left-color: var(--accent-amber);
    background: rgba(244, 162, 97, 0.05);
}

blockquote.human-voice p {
    color: var(--text-primary);
    font-style: italic;
}

blockquote.major {
    padding: var(--space-lg);
    font-size: 1.35rem;
    text-align: center;
    border: 2px solid var(--accent-amber);
    border-radius: 12px;
    background: rgba(244, 162, 97, 0.1);
    margin: var(--space-xl) 0;
}

/* =================================
   EXPANDABLE SECTIONS
   ================================= */

.expandable-section {
    margin: var(--space-md) 0;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.expandable-section:hover {
    border-color: var(--accent-lavender);
}

.expand-btn {
    width: 100%;
    background: var(--bg-secondary);
    border: none;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent-lavender);
    transition: var(--transition-quick);
}

.expand-btn:hover {
    background: var(--bg-tertiary);
}

.expand-icon {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.expand-btn[aria-expanded="true"] .expand-icon {
    transform: rotate(90deg);
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.expandable-section.expanded .expandable-content {
    max-height: 5000px;
}

.document-content {
    padding: var(--space-md);
    background: var(--bg-primary);
}

/* =================================
   ANNOTATIONS
   ================================= */

.annotation {
    font-size: 0.95rem;
    color: var(--text-dim);
    font-style: italic;
    margin: var(--space-sm) 0;
    padding-left: var(--space-md);
    border-left: 2px solid var(--border-subtle);
}

.annotation.margin-note {
    font-family: var(--font-hand);
    color: var(--accent-sage);
    border-left-color: var(--accent-sage);
    font-size: 1rem;
}

/* =================================
   LISTS
   ================================= */

ul, ol {
    margin: var(--space-md) 0;
    padding-left: var(--space-lg);
}

li {
    margin-bottom: var(--space-xs);
}

.document-list {
    list-style: none;
    padding: 0;
}

.document-list li {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--accent-lavender);
}

/* =================================
   BUTTONS
   ================================= */

.continue-btn,
.read-more-btn,
.contact-btn {
    display: inline-block;
    padding: var(--space-sm) var(--space-md);
    background: var(--accent-lavender);
    color: var(--bg-primary);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.continue-btn:hover,
.read-more-btn:hover,
.contact-btn:hover {
    background: var(--accent-sage);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(167, 139, 204, 0.3);
    text-decoration: none;
}

.continue-btn {
    margin-top: var(--space-lg);
    font-size: 1.1rem;
    padding: var(--space-md) var(--space-lg);
}

.contact-btn.secondary {
    background: transparent;
    border: 2px solid var(--accent-lavender);
    color: var(--accent-lavender);
}

.contact-btn.secondary:hover {
    background: var(--accent-lavender);
    color: var(--bg-primary);
}

/* =================================
   REVELATION BOX
   ================================= */

.revelation-box {
    background: linear-gradient(135deg, rgba(167, 139, 204, 0.1), rgba(143, 188, 143, 0.1));
    border: 2px solid var(--accent-lavender);
    border-radius: 12px;
    padding: var(--space-lg);
    margin: var(--space-xl) 0;
    text-align: center;
}

.revelation-box h3 {
    color: var(--accent-lavender);
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

/* =================================
   DOCUMENT LIBRARY
   ================================= */

.document-library {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.doc-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-sm);
    transition: var(--transition-smooth);
    text-decoration: none;
}

.doc-card:hover {
    border-color: var(--accent-lavender);
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(167, 139, 204, 0.2);
    text-decoration: none;
}

.doc-icon {
    font-size: 2rem;
}

.doc-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* =================================
   NEXT STEPS & CONTACT
   ================================= */

.next-steps {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 4px solid var(--accent-sage);
}

.contact-links {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

/* =================================
   CLOSING THOUGHT
   ================================= */

.closing-thought {
    text-align: center;
    margin: var(--space-xl) 0;
    padding: var(--space-lg) 0;
    border-top: 2px solid var(--border-subtle);
}

.closing-thought .symbol {
    font-size: 3rem;
}

.closing-thought p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* =================================
   RESPONSIVE
   ================================= */

@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    #progress-nav {
        top: 1rem;
        right: 1rem;
        padding: 0.5rem 0.75rem;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .phase-title {
        font-size: 2rem;
    }
    
    #story-container {
        padding: var(--space-md) var(--space-sm);
    }
    
    .doc-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-links {
        flex-direction: column;
    }
}

/* =================================
   ACCESSIBILITY
   ================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 2px solid var(--accent-lavender);
    outline-offset: 4px;
}

/* =================================
   LOADING STATE
   ================================= */

body.loading {
    overflow: hidden;
}

body.loading #story-container {
    opacity: 0;
}
