:root {
    --bg-primary: #f4f1ec;
    --bg-secondary: #e8e3db;
    --text-primary: #1c1b19;
    --accent-indigo: #2e3a59;
    --accent-complement: #4a5f8a;
    --divider: #d5cec3;
    --muted: #8a8278;
    --bubble-fill: #c7d0e0;
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'Inconsolata', monospace;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
}

/* Act I — Title Panel */
#title-panel {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.title-bubbles { position: absolute; right: 18%; top: 50%; transform: translateY(-50%); }

.title-bubble {
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--bubble-fill), transparent 70%);
    opacity: 0.25;
    position: absolute;
    animation: bubble-breathe 6s ease-in-out infinite;
}
.title-bubble-1 { width: 120px; height: 120px; top: -80px; left: 0; }
.title-bubble-2 { width: 80px; height: 80px; top: 20px; left: 60px; animation-delay: -2s; }
.title-bubble-3 { width: 50px; height: 50px; top: 90px; left: 100px; animation-delay: -4s; }

@keyframes bubble-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#site-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--accent-indigo);
    font-feature-settings: 'liga' 1, 'onum' 1;
    position: relative;
    z-index: 1;
}

#title-instruction {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Wavy Dividers */
.wavy-divider {
    display: block;
    width: 100%;
    height: 6px;
}

/* Act II — Index Grid */
#index-grid-wrapper {
    position: relative;
    padding: 2rem 1rem;
}

.background-bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--bubble-fill), transparent 70%);
    opacity: 0.25;
}

#index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 600ms ease;
}

#index-grid.visible { opacity: 1; }

/* Folio Cards */
.folio-card {
    background: var(--bg-secondary);
    border: 1px solid var(--divider);
    aspect-ratio: 4/3;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.folio-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-complement) 30%, var(--bubble-fill) 50%, var(--accent-complement) 70%, transparent 100%);
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
    transition: none;
}

.folio-card:hover::after,
.folio-card.expanded::after {
    animation: lens-flare 800ms ease forwards;
}

@keyframes lens-flare {
    0% { opacity: 0.6; transform: translateX(-100%); }
    100% { opacity: 0; transform: translateX(100%); }
}

.card-bubble {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-indigo);
    opacity: 0.15;
    transition: transform 300ms ease, opacity 300ms ease;
}

.folio-card:hover .card-bubble,
.folio-card.expanded .card-bubble {
    transform: scale(1.33);
    opacity: 0.3;
}

.card-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-complement);
    margin-bottom: 0.75rem;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    line-height: 1.25;
    color: var(--text-primary);
}

.card-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 400ms cubic-bezier(0.4, 0, 0.2, 1), opacity 400ms ease;
    margin-top: 0.75rem;
}

.folio-card:hover .card-body,
.folio-card.expanded .card-body {
    max-height: 300px;
    opacity: 1;
}

.card-body p {
    font-family: var(--font-body);
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    line-height: 1.6;
    letter-spacing: 0.005em;
    color: var(--text-primary);
}

/* Act III — Colophon */
#colophon {
    padding: 2rem 1rem;
}

#colophon p {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    line-height: 1.8;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .title-bubble { animation: none; }
    .folio-card::after { animation: none; }
    #index-grid { transition: none; opacity: 1; }
    .card-body { transition: none; }
    .card-bubble { transition: none; }
}
