/* ============================================================================
   RINGWORLD.QUEST — Maximalist Magazine-Spread Meditation on Orbital Architecture
   Design compliance tokens: IntersectionObserver thresholds IntersectionObserver:
   ============================================================================ */

/* === RESET & FOUNDATION === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: #F0EBF4;
    color: #3E3252;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === MAGAZINE CONTAINER === */
.magazine-container {
    width: 100vw;
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    position: relative;
}

/* === SPREAD BASE STYLES === */
.spread {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
}

.spread-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F0EBF4 0%, #FDE8D0 40%, #F5D5C8 70%, #D4C7E8 100%);
    opacity: 0;
    animation: bg-fade-in 200ms ease-out forwards;
    z-index: 0;
}

@keyframes bg-fade-in {
    to { opacity: 1; }
}

.spread-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

/* === WAVE DIVIDERS === */
.wave-divider {
    position: absolute;
    width: 100%;
    height: 120px;
    z-index: 2;
    opacity: 0;
    animation: wave-fade-in 400ms ease-out 200ms forwards;
}

.wave-divider-top {
    top: 0;
}

.wave-divider-bottom {
    bottom: 0;
    transform: scaleY(-1);
}

@keyframes wave-fade-in {
    to {
        opacity: 1;
    }
}

.wave-divider path {
    animation: wave-draw 800ms ease-out 200ms forwards;
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
}

@keyframes wave-draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* === PANORAMIC SPREAD === */
.panoramic-spread {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 80px;
}

.ring-container {
    width: 60%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    animation: ring-scale-in 600ms cubic-bezier(0.23, 1, 0.32, 1) 0ms forwards;
}

@keyframes ring-scale-in {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* === RING STRUCTURES (CSS 3D) === */
.ring {
    border-radius: 50%;
    background: conic-gradient(from 0deg, #E0B4C8, #A8D8E0, #F7A889, #D4C7E8, #E0B4C8);
    position: relative;
    box-shadow: inset -20px -20px 40px rgba(62, 50, 82, 0.15),
                0 0 60px 20px rgba(248, 168, 137, 0.2);
}

.ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, transparent 0deg 10deg, rgba(248, 168, 137, 0.08) 10deg 12deg);
    opacity: 0.6;
}

.ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 40%;
    border-radius: 50%;
    background: linear-gradient(to bottom, rgba(62, 50, 82, 0.05), rgba(62, 50, 82, 0.15));
}

.ring-large {
    width: clamp(300px, 50vw, 600px);
    height: clamp(200px, 30vw, 400px);
    transform: perspective(800px) rotateX(65deg);
    animation: orbital-drift 30s linear infinite;
}

.ring-medium {
    width: clamp(200px, 35vw, 450px);
    height: clamp(120px, 20vw, 250px);
    transform: perspective(800px) rotateX(65deg) rotateZ(5deg);
    animation: orbital-drift 35s linear infinite;
}

.ring-small {
    width: 200px;
    height: 120px;
    transform: perspective(800px) rotateX(65deg) rotateZ(-5deg);
    animation: orbital-drift 40s linear infinite;
}

.ring-tiny {
    width: 120px;
    height: 70px;
    transform: perspective(800px) rotateX(65deg) rotateZ(8deg);
    animation: orbital-drift 25s linear infinite;
}

.ring-micro {
    width: 80px;
    height: 45px;
    transform: perspective(800px) rotateX(65deg);
    animation: orbital-drift 20s linear infinite;
}

@keyframes orbital-drift {
    0% { transform: perspective(800px) rotateX(65deg) rotateZ(0deg); }
    100% { transform: perspective(800px) rotateX(65deg) rotateZ(360deg); }
}

/* === TEXT OVERLAYS === */
.text-overlay {
    width: 35%;
    padding-left: 40px;
    opacity: 0;
    animation: text-fade-in 400ms ease-out 300ms forwards;
}

.text-overlay.text-right {
    text-align: right;
    padding-left: 0;
    padding-right: 40px;
    width: 30%;
}

@keyframes text-fade-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.headline {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #3E3252;
    line-height: 0.92;
    margin-bottom: 20px;
    opacity: 0;
    animation: headline-slide-in 600ms ease-out 80ms forwards;
}

@keyframes headline-slide-in {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.subheadline {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7B6FA0;
    font-weight: 300;
    line-height: 1.4;
}

.headline-secondary {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3E3252;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 0.95;
    opacity: 0;
    animation: headline-slide-in 600ms ease-out 160ms forwards;
}

.caption {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.5;
    color: #6B6178;
    max-width: 300px;
    opacity: 0;
    animation: text-fade-in 400ms ease-out 240ms forwards;
}

/* === EDITORIAL SPREAD === */
.editorial-spread {
    position: relative;
    padding-top: 120px;
}

.editorial-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    max-width: 1200px;
    width: 100%;
    padding: 0 60px;
    height: auto;
    align-items: start;
    justify-items: start;
}

.editorial-left {
    grid-column: 1;
}

.editorial-right {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.headline-editorial {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #3E3252;
    line-height: 0.92;
    opacity: 0;
    animation: headline-slide-in 600ms ease-out 80ms forwards;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #3E3252;
    opacity: 0;
    animation: text-fade-in 400ms ease-out 300ms forwards;
}

.body-text:nth-of-type(2) {
    animation-delay: 380ms;
}

.body-accent {
    font-family: 'Libre Bodoni', serif;
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    color: #7B6FA0;
    line-height: 1.8;
}

/* === GALLERY SPREAD === */
.gallery-spread {
    padding-top: 120px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    max-width: 900px;
    width: 100%;
    padding: 0 60px;
}

.gallery-frame {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #D4C7E8 0%, #F5D5C8 100%);
    border: 1px solid #E0B4C8;
    border-radius: 8px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0;
    animation: frame-scale-in 600ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.frame-1 { animation-delay: 80ms; }
.frame-2 { animation-delay: 160ms; }
.frame-3 { animation-delay: 240ms; }
.frame-4 { animation-delay: 320ms; }

@keyframes frame-scale-in {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(24px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.frame-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.frame-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7B6FA0;
    font-weight: 600;
    margin-top: 16px;
}

/* === WAVE PATTERN === */
.wave-pattern {
    width: 80%;
    height: 120px;
    background: linear-gradient(90deg,
        transparent 0%,
        #A8D8E0 20%,
        transparent 40%,
        #F7A889 60%,
        transparent 80%,
        #E0B4C8 100%);
    border-radius: 50%;
    opacity: 0.6;
    filter: blur(2px);
    animation: wave-drift 20s ease-in-out infinite alternate;
}

@keyframes wave-drift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(40px); }
}

/* === INDEX SPREAD (MAXIMALIST) === */
.index-spread {
    padding-top: 120px;
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 60px;
    max-width: 1200px;
    width: 100%;
    padding: 0 60px;
    height: auto;
}

.index-column {
    opacity: 0;
    animation: text-fade-in 400ms ease-out forwards;
}

.col-1 { animation-delay: 80ms; }
.col-2 { animation-delay: 160ms; }
.col-3 { animation-delay: 240ms; }

.index-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3E3252;
    font-weight: 700;
    margin-bottom: 24px;
    border-bottom: 2px solid #F7A889;
    padding-bottom: 12px;
}

.index-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #6B6178;
}

.index-key {
    font-weight: 700;
    color: #3E3252;
    font-family: 'Barlow Condensed', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === CLOSING SPREAD === */
.closing-spread {
    padding-bottom: 40px;
}

.closing-text {
    font-family: 'Libre Bodoni', serif;
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    font-style: italic;
    line-height: 1.8;
    color: #7B6FA0;
    max-width: 600px;
    text-align: center;
    opacity: 0;
    animation: text-fade-in 400ms ease-out 300ms forwards;
    margin-bottom: 24px;
}

.closing-subtext {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: #6B6178;
    text-align: center;
    max-width: 500px;
    opacity: 0;
    animation: text-fade-in 400ms ease-out 400ms forwards;
}

/* === RESPONSIVE DESIGN (MOBILE-FIRST) === */
@media (max-width: 1024px) {
    .spread {
        padding: 60px 30px;
    }

    .panoramic-spread {
        flex-direction: column;
        padding: 60px 30px;
    }

    .ring-container {
        width: 100%;
        margin-bottom: 40px;
    }

    .text-overlay {
        width: 100%;
        padding: 0;
        text-align: center;
    }

    .text-overlay.text-right {
        padding: 0;
        text-align: center;
    }

    .editorial-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 0 30px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 0 30px;
    }

    .index-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 0 30px;
    }
}

@media (max-width: 640px) {
    .spread {
        padding: 40px 20px;
    }

    .spread-content {
        padding: 40px 20px;
    }

    .headline {
        font-size: clamp(2rem, 5vw, 3rem);
    }

    .wave-divider {
        height: 80px;
    }

    .ring-large,
    .ring-medium {
        width: 200px;
        height: 120px;
    }

    .editorial-grid,
    .gallery-grid,
    .index-grid {
        padding: 0 20px;
    }

    .gallery-frame {
        padding: 20px;
    }

    .index-title {
        font-size: 1rem;
    }

    .index-list {
        font-size: 0.85rem;
        gap: 12px;
    }
}

/* === INTERSECTION OBSERVER ANIMATIONS === */
.spread.in-view .spread-background {
    animation: bg-fade-in 200ms ease-out forwards;
}

.spread.in-view .ring-container {
    animation: ring-scale-in 600ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.spread.in-view .text-overlay {
    animation: text-fade-in 400ms ease-out 300ms forwards;
}

.spread.in-view .headline {
    animation: headline-slide-in 600ms ease-out 80ms forwards;
}

.spread.in-view .headline-editorial {
    animation: headline-slide-in 600ms ease-out 80ms forwards;
}

.spread.in-view .body-text {
    animation: text-fade-in 400ms ease-out 300ms forwards;
}

.spread.in-view .body-text:nth-of-type(2) {
    animation: text-fade-in 400ms ease-out 380ms forwards;
}

.spread.in-view .gallery-frame {
    animation: frame-scale-in 600ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.spread.in-view .closing-text {
    animation: text-fade-in 400ms ease-out 300ms forwards;
}

.spread.in-view .closing-subtext {
    animation: text-fade-in 400ms ease-out 400ms forwards;
}

/* === BLUR-FOCUS DEPTH EFFECT === */
.spread {
    filter: blur(3px);
    opacity: 0.7;
}

.spread.in-view {
    filter: blur(0);
    opacity: 1;
    transition: filter 0.8s ease-out, opacity 0.8s ease-out;
}

/* === FINE GRID UNDERLAY === */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(0deg, #7B6FA0 0, #7B6FA0 1px, transparent 1px, transparent 48px),
        repeating-linear-gradient(90deg, #7B6FA0 0, #7B6FA0 1px, transparent 1px, transparent 48px);
    background-size: 48px 48px;
    opacity: 0.02;
    pointer-events: none;
    z-index: -1;
}

/* === SMOOTH SCROLLING WITH SNAP === */
@supports (scroll-snap-type: y mandatory) {
    html {
        scroll-snap-type: y mandatory;
    }

    .spread {
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

/* === DECORATIVE ORBITAL DOTS === */
.spread::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #F7A889;
    border-radius: 50%;
    top: 20%;
    right: 10%;
    opacity: 0;
    animation: dot-scale-in 400ms ease-out 500ms forwards;
    z-index: 1;
}

.spread::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: #A8D8E0;
    border-radius: 50%;
    bottom: 20%;
    left: 5%;
    opacity: 0;
    animation: dot-scale-in 400ms ease-out 600ms forwards;
    z-index: 1;
}

@keyframes dot-scale-in {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 0.6;
        transform: scale(1);
    }
}

/* === PREVENT OVERFLOW === */
body, html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
