/* --- DESIGN SYSTEM & CSS CUSTOM PROPERTIES --- */
:root {
    /* Palette: Editorial Warm Terracotta & Sage */
    --color-bg-base: #FAF7F4;       /* Soft warm gallery cream */
    --color-bg-card: #F3ECE6;       /* Slightly deeper clay-tinted beige */
    --color-text-primary: #1C1C1C;  /* Charcoal ink */
    --color-text-secondary: #5A5A5A;/* Muted ink */
    --color-accent-terracotta: #C2593F; /* Earthy rust/terracotta */
    --color-accent-sage: #5C7A68;   /* Soft sage green */
    --color-accent-light: rgba(194, 89, 63, 0.08); /* Terracotta highlight */
    
    /* Fonts */
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Transitions */
    --transition-slow: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-medium: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-fast: all 0.2s ease;
}

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

html, body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--color-bg-base);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- CANVAS BACKDROP --- */
#art-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.85;
    transition: opacity 1.5s ease;
}

/* --- SCREEN STATES --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    z-index: 2;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.2s cubic-bezier(0.25, 1, 0.5, 1), 
                visibility 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.screen.active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

/* --- ENTRY / LANDING SCREEN --- */
#entry-screen {
    justify-content: center;
    align-items: center;
    background-color: var(--color-bg-base);
    z-index: 10; /* Above everything at start */
}

.entry-card {
    text-align: center;
    max-width: 500px;
    padding: 3rem;
    background: rgba(250, 247, 244, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(28, 28, 28, 0.05);
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.03);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards 0.3s;
}

.art-frame {
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid rgba(28, 28, 28, 0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border-radius: 2px;
    background-color: #ffffff;
    padding: 8px;
    display: inline-block;
    transition: var(--transition-medium);
}

.art-frame:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.entry-art-card {
    display: block;
    max-height: 180px;
    width: auto;
    object-fit: contain;
    border-radius: 1px;
}

.entry-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.entry-subtitle {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    font-weight: 300;
    letter-spacing: 0.02em;
}

.entry-divider {
    width: 40px;
    height: 1px;
    background-color: var(--color-accent-terracotta);
    margin: 2rem auto;
}

.entry-dedication {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--color-accent-sage);
    margin-bottom: 2rem;
}

.btn-primary {
    background-color: var(--color-text-primary);
    color: var(--color-bg-base);
    border: none;
    padding: 0.9rem 2.2rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: var(--transition-medium);
}

.btn-primary:hover {
    background-color: var(--color-accent-terracotta);
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(194, 89, 63, 0.25);
}

/* --- APP HEADER --- */
.app-header {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-style: italic;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--color-text-primary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background-color: rgba(28, 28, 28, 0.02);
    border: 1px solid rgba(28, 28, 28, 0.05);
    transition: var(--transition-medium);
}

.btn-icon:hover {
    color: var(--color-accent-terracotta);
    border-color: var(--color-accent-terracotta);
    background-color: rgba(194, 89, 63, 0.04);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Music Pulsing Visualizer Indicator */
.ambient-indicator {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 14px;
    width: 20px;
}

.ambient-indicator span {
    display: inline-block;
    width: 3px;
    background-color: var(--color-accent-sage);
    height: 3px;
    border-radius: 1px;
    transition: height 0.3s ease;
}

.ambient-indicator.playing span {
    animation: soundWaves 1.2s ease-in-out infinite alternate;
}

.ambient-indicator.playing span:nth-child(1) { animation-delay: 0.1s; }
.ambient-indicator.playing span:nth-child(2) { animation-delay: 0.4s; }
.ambient-indicator.playing span:nth-child(3) { animation-delay: 0.2s; }

/* --- MAIN CONTAINER & EDITORIAL GRID --- */
.gallery-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 3rem;
    position: relative;
    z-index: 4;
}

/* --- POETRY COLUMN --- */
.poetry-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    width: 100%;
    max-width: 600px;
}

.poem-wrapper {
    position: relative;
    height: auto;
    min-height: 380px;
}

.poem-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.8s cubic-bezier(0.25, 1, 0.5, 1),
                visibility 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.poem-content.active {
    position: relative;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.poem-number {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-accent-sage);
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;
}

.poem-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 400;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

.poem-body {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--color-text-primary);
}

.poem-line {
    margin-bottom: 0.5rem;
    white-space: pre-line;
    display: block;
}

/* Let the letters flow elegantly */
.poem-line span.char {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.poem-line.prose {
    line-height: 1.8;
    max-width: 500px;
}

.mt-line {
    margin-top: 1.5rem;
}

.sig {
    font-style: italic;
    color: var(--color-accent-terracotta);
    font-size: 1.15rem;
    margin-top: 1.5rem;
}

/* Interactive Words */
.interactive-word {
    position: relative;
    font-weight: 600;
    color: var(--color-accent-terracotta);
    cursor: pointer;
    padding: 0 4px;
    background-image: linear-gradient(120deg, var(--color-accent-light) 0%, var(--color-accent-light) 100%);
    background-repeat: no-repeat;
    background-size: 100% 0.3em;
    background-position: 0 88%;
    transition: background-size 0.25s ease-in-out;
}

.interactive-word:hover {
    background-size: 100% 100%;
}

/* --- REVEAL OVERLAY PANEL --- */
.reveal-panel {
    position: absolute;
    top: 50%;
    left: 0;
    width: 85%;
    max-width: 420px;
    background: rgba(243, 236, 230, 0.95);
    border-left: 2px solid var(--color-accent-terracotta);
    padding: 2rem;
    transform: translateY(-50%) translateX(-20px);
    opacity: 0;
    visibility: hidden;
    box-shadow: 10px 15px 30px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition-medium);
    z-index: 10;
}

.reveal-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.close-reveal {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-secondary);
}

.close-reveal:hover {
    color: var(--color-accent-terracotta);
}

.reveal-title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent-sage);
    margin-bottom: 0.8rem;
}

.reveal-text {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--color-text-primary);
    line-height: 1.7;
}

/* --- GALLERY INFO COLUMN (Right) --- */
.gallery-info-column {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-left: 2rem;
}

.info-card {
    background: rgba(243, 236, 230, 0.7);
    border: 1px solid rgba(28, 28, 28, 0.05);
    border-radius: 2px;
    padding: 2.5rem;
    max-width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 1.8s ease-out forwards;
}

.info-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent-terracotta);
    font-weight: 500;
    margin-bottom: 1rem;
    display: block;
}

.info-text {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

.font-serif-italic {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    border-top: 1px solid rgba(28, 28, 28, 0.08);
    padding-top: 1.2rem;
    margin-bottom: 0;
}

/* --- APP FOOTER & BOTTOM NAV --- */
.app-footer {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    border-top: 1px solid rgba(28, 28, 28, 0.04);
}

.poem-nav {
    display: flex;
    gap: 2rem;
}

.nav-item {
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding-bottom: 6px;
    border-bottom: 1px solid transparent;
    transition: var(--transition-medium);
}

.nav-item:hover, .nav-item.active {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-accent-terracotta);
}

.footer-credit {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

/* --- KEYFRAMES & ANIMATIONS --- */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes soundWaves {
    0% { height: 3px; }
    100% { height: 14px; }
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 900px) {
    .gallery-container {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding: 1rem 1.5rem;
        overflow-y: auto;
    }
    
    .poetry-column {
        padding-right: 0;
        min-height: auto;
        width: 100%;
    }
    
    .app-header {
        padding: 1.5rem 1.5rem;
    }
    
    .app-footer {
        padding: 1.5rem;
        flex-direction: column;
        gap: 1.2rem;
        align-items: center;
    }
    
    .poem-nav {
        width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        gap: 1.2rem;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        scrollbar-width: none; /* Firefox */
    }
    
    .poem-nav::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .nav-item {
        flex: 0 0 auto;
    }
}

@media (max-width: 600px) {
    .entry-card {
        padding: 2rem 1.5rem;
        max-width: 90%;
        margin: 0 1rem;
    }
    
    .entry-title {
        font-size: 2.2rem;
    }
    
    .poem-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .poem-body {
        font-size: 1.1rem;
    }
    
    .reveal-panel {
        width: 95%;
        left: 2.5%;
        padding: 1.5rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    }
    
    .reveal-text {
        font-size: 1.05rem;
    }
    
    .nav-item {
        font-size: 0.75rem;
    }
}
