/* CSS Custom Properties */
:root {
    --heisei-mist: #F0EBE3;
    --phantom-linen: #E8E0D5;
    --dusk-umber: #6B6157;
    --ash-silk: #B8AFA6;
    --ochre-ghost: #C4A882;
    --heisei-indigo: #7B8FA1;
    --bauhaus-graphite: #9A9189;
    --twilight-charcoal: #4A433D;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--heisei-mist);
    color: var(--dusk-umber);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

p {
    font-weight: 400;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    letter-spacing: 0.08em;
    text-transform: lowercase;
}

/* Persistent Header */
.persistent-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    padding: clamp(1rem, 3vw, 2rem);
    width: 100%;
}

.domain-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--dusk-umber);
}

/* Main content container */
.main-content {
    width: 100%;
    position: relative;
}

/* Scene base styles */
.scene {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.scene-container {
    width: 100%;
    max-width: 1200px;
    padding: clamp(1.5rem, 4vw, 3rem);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Scene 1: Portal */
.scene-1 {
    background-color: var(--heisei-mist);
}

.circle-hero {
    width: clamp(200px, 70vh, 70vh);
    height: clamp(200px, 70vh, 70vh);
    position: relative;
    margin-bottom: 2rem;
    transform-origin: center;
    transform: translateZ(0);
    box-shadow: 0 20px 60px rgba(107, 97, 87, 0.06);
}

.circle-frame {
    width: 100%;
    height: 100%;
    display: block;
}

.duotone-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--heisei-indigo);
    mix-blend-mode: multiply;
    opacity: 0.3;
    border-radius: 50%;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.5rem, 8vw, 7rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--twilight-charcoal);
    text-align: center;
    margin-top: 1rem;
}

/* Breathing animation */
@keyframes breathe {
    0%, 100% { transform: scale(0.98); }
    50% { transform: scale(1.02); }
}

.breathing {
    animation: breathe 6s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

/* Scene 2: Triangle Triptych */
.scene-2 {
    background-color: var(--heisei-mist);
}

.triptych-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 3rem);
    flex-wrap: wrap;
    width: 100%;
    max-width: 900px;
}

.triangle-frame {
    width: clamp(120px, 20vw, 200px);
    height: clamp(120px, 20vw, 200px);
    position: relative;
    flex-shrink: 0;
}

.triangle-frame svg {
    width: 100%;
    height: 100%;
    display: block;
}

.triangle-caption {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--ash-silk);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Scene 3: Grid Memory */
.scene-3 {
    background-color: var(--heisei-mist);
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 15vw, 160px), 1fr));
    gap: 2px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.grid-cell {
    aspect-ratio: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--phantom-linen);
}

.grid-cell svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Scene 4: Typography Field */
.scene-4 {
    background-color: var(--heisei-mist);
    padding: clamp(2rem, 8vw, 4rem);
}

.poetry-field {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.poetic-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 300;
    letter-spacing: 0.02em;
    line-height: 1.4;
    color: var(--dusk-umber);
    background: linear-gradient(90deg, var(--dusk-umber), var(--ash-silk));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.poetic-text-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeInWord 0.5s ease forwards;
}

@keyframes fadeInWord {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scene 5: Final Circle */
.scene-5 {
    background-color: var(--heisei-mist);
}

.circle-final {
    width: clamp(200px, 70vh, 70vh);
    height: clamp(200px, 70vh, 70vh);
    position: relative;
    transform-origin: center;
    transform: translateZ(0);
    box-shadow: 0 20px 60px rgba(107, 97, 87, 0.06);
}

/* Zoom-focus animation pattern */
.zoom-focus-element {
    transform: scale(1.08);
    filter: blur(8px);
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.8s ease;
}

.zoom-focus-element.in-view {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
}

/* Scroll Progress Indicator */
.scroll-indicator {
    position: fixed;
    bottom: clamp(1rem, 3vw, 2rem);
    right: clamp(1rem, 3vw, 2rem);
    width: 50px;
    height: 50px;
    z-index: 100;
    pointer-events: none;
}

.progress-circle {
    width: 100%;
    height: 100%;
}

.progress-track {
    stroke-dasharray: 126;
    stroke-linecap: round;
}

.progress-fill {
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* Scene dividers */
.scene::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 33%;
    height: 0.5px;
    background-color: var(--ash-silk);
}

.scene:last-child::before {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .triptych-grid {
        flex-direction: column;
        gap: clamp(1rem, 3vw, 2rem);
    }

    .triangle-frame {
        width: clamp(100px, 25vw, 150px);
        height: clamp(100px, 25vw, 150px);
    }

    .triangle-caption {
        bottom: -1.5rem;
    }

    .memory-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
        gap: 1px;
    }

    .circle-hero,
    .circle-final {
        width: 85vw;
        height: 85vw;
    }

    .hero-title {
        font-size: clamp(1.5rem, 6vw, 4rem);
    }
}

/* Decorative patterns background (subtle dot grid) */
@supports (background-image: radial-gradient(circle, rgba(232, 224, 213, 0.5) 1px, transparent 1px)) {
    .scene-3 {
        background-image: 
            radial-gradient(circle, var(--phantom-linen) 1px, transparent 1px);
        background-size: 40px 40px;
        background-position: 0 0;
        background-attachment: scroll;
    }
}

/* Print styles */
@media print {
    .scroll-indicator {
        display: none;
    }
}
