:root {
    --near-black: #0c0c10;
    --dark-charcoal: #16161c;
    --silver-fog: #c8c8d0;
    --ghost-gray: #5a5a68;
    --chrome: #e0e0e8;
    --mirror-flash: #ffffff;
    --phantom-blush: #a0606c;
    --whisper-line: rgba(255, 255, 255, 0.02);
    --chrome-silver: #c0c0c8;
}

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

body {
    background: var(--near-black);
    color: var(--silver-fog);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ============================================
   Ghost Grid Overlay
   ============================================ */
.ghost-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.02) 0px,
            rgba(255, 255, 255, 0.02) 1px,
            transparent 1px,
            transparent 60px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.02) 0px,
            rgba(255, 255, 255, 0.02) 1px,
            transparent 1px,
            transparent 60px
        );
    pointer-events: none;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* ============================================
   Observer's Margin
   ============================================ */
.observer-margin {
    position: fixed;
    top: 0;
    right: 0;
    width: 15%;
    height: 100%;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.margin-eye {
    opacity: 0.15;
    animation: eye-blink 8s ease-in-out infinite;
}

.iris {
    transform-origin: center;
    animation: iris-blink 8s ease-in-out infinite;
}

@keyframes iris-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0); }
}

@keyframes eye-blink {
    0%, 88%, 100% { opacity: 0.15; }
    92%, 96% { opacity: 0.25; }
}

/* ============================================
   Magazine Container
   ============================================ */
.magazine {
    position: relative;
    z-index: 1;
    padding-right: 15%;
}

/* ============================================
   Chrome Bars & Strips
   ============================================ */
.chrome-bar {
    width: 100%;
    height: 4px;
    background: linear-gradient(
        90deg,
        #888888, #ffffff, #888888, #bbbbbb, #ffffff, #888888
    );
    background-size: 300% 100%;
    animation: chrome-slide 2.5s ease-in-out infinite alternate;
    margin-bottom: 40px;
}

.chrome-strip {
    width: 60%;
    height: 4px;
    margin: 0 auto;
    background: linear-gradient(
        90deg,
        #888888, #ffffff, #888888, #bbbbbb, #ffffff, #888888
    );
    background-size: 300% 100%;
    animation: chrome-slide 3s ease-in-out infinite alternate;
}

@keyframes chrome-slide {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* ============================================
   Eye Separators
   ============================================ */
.eye-separator {
    text-align: center;
    padding: 40px 0;
    opacity: 0.3;
}

.iris-blink {
    transform-origin: 20px 10px;
    animation: iris-blink-small 8s ease-in-out infinite;
}

@keyframes iris-blink-small {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0); }
}

/* ============================================
   Cover Spread
   ============================================ */
.spread-cover {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--near-black);
    position: relative;
}

.spread-cover .chrome-bar {
    position: absolute;
    top: 0;
    left: 0;
    margin-bottom: 0;
}

.cover-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    color: var(--chrome-silver);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: cover-fade 2s ease 0.5s forwards;
}

.cover-sub {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--ghost-gray);
    letter-spacing: 0.08em;
    margin-top: 16px;
    opacity: 0;
    animation: cover-fade 1.5s ease 1.5s forwards;
}

@keyframes cover-fade {
    to { opacity: 1; }
}

/* ============================================
   Margin Notes (Handwritten Ghost Annotations)
   ============================================ */
.margin-note {
    position: absolute;
    right: -12%;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Homemade Apple', cursive;
    font-size: 0.85rem;
    color: var(--phantom-blush);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    white-space: nowrap;
}

.cover-note {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 18%;
    transform: translateX(-50%);
    opacity: 0;
    animation: note-fade 1s ease 3.5s forwards;
}

@keyframes note-fade {
    to { opacity: 0.7; }
}

.spread:hover .margin-note {
    opacity: 0.7;
}

.end-note {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 12%;
    transform: translateX(-50%);
}

/* ============================================
   Spread Layout (Z-Pattern)
   ============================================ */
.spread {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 80px 60px;
    position: relative;
    gap: 60px;
}

.spread .chrome-bar {
    position: absolute;
    top: 0;
    left: 0;
    margin-bottom: 0;
    grid-column: 1 / -1;
}

/* Magazine gutter hairline */
.spread::before {
    content: '';
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.03);
}

.spread-left {
    padding-right: 40px;
}

.spread-right {
    padding-left: 40px;
}

/* ============================================
   Pull Quotes
   ============================================ */
.pull-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--chrome-silver);
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.pull-quote em {
    font-style: normal;
    color: var(--phantom-blush);
}

/* ============================================
   Spread Labels
   ============================================ */
.spread-label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ghost-gray);
    margin-bottom: 24px;
}

/* ============================================
   Body Text
   ============================================ */
.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    line-height: 1.7;
    color: var(--silver-fog);
    margin-bottom: 16px;
    opacity: 0.85;
}

/* ============================================
   Inset Details
   ============================================ */
.inset-detail {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid rgba(192, 192, 200, 0.1);
}

.detail-key {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ghost-gray);
}

.detail-val {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--chrome);
}

/* ============================================
   Absent Images
   ============================================ */
.absent-image {
    position: relative;
    width: 100%;
    height: 180px;
    margin: 24px 0;
    border: 1px solid rgba(224, 224, 232, 0.15);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.absent-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(192, 192, 200, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(192, 192, 200, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(160, 96, 108, 0.02) 0%, transparent 60%);
    animation: noise-drift 12s ease-in-out infinite alternate;
}

.absent-image::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 1px solid rgba(224, 224, 232, 0.08);
    pointer-events: none;
}

@keyframes noise-drift {
    0% {
        background-position: 0% 0%;
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        background-position: 100% 100%;
        opacity: 0.6;
    }
}

.noise-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(192, 192, 200, 0.015) 2px,
            rgba(192, 192, 200, 0.015) 4px
        );
}

.absent-label {
    position: relative;
    z-index: 1;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--ghost-gray);
    text-transform: lowercase;
}

/* ============================================
   Centerfold Spread
   ============================================ */
.spread-centerfold {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--dark-charcoal);
    padding: 80px 60px;
    position: relative;
}

.spread-centerfold .centerfold-eye {
    opacity: 0.04;
    margin-bottom: 60px;
}

.spread-centerfold .centerfold-eye svg {
    width: 40vw;
    height: auto;
}

.centerfold-content {
    max-width: 60ch;
    text-align: center;
}

.centerfold-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    color: var(--chrome-silver);
    margin-bottom: 32px;
    line-height: 1.2;
}

.centerfold-text {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    opacity: 0.9;
}

/* Centerfold: observer's margin collapses */
.spread-centerfold.in-view ~ .observer-margin {
    /* handled by JS */
}

/* ============================================
   End / Back Cover
   ============================================ */
.spread-end {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
}

.spread-end .chrome-bar {
    position: absolute;
    top: 0;
    left: 0;
    margin-bottom: 0;
    animation-duration: 6s;
}

.closing-eye {
    margin-bottom: 32px;
    opacity: 0.5;
}

.closing-iris {
    transform-origin: 30px 15px;
}

.closing-eye.closed .closing-iris {
    animation: close-eye 3s ease forwards;
}

@keyframes close-eye {
    to { transform: scaleY(0); }
}

.end-domain {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    color: var(--chrome-silver);
    margin-bottom: 8px;
}

.end-caption {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--ghost-gray);
}

/* ============================================
   Scroll-Reveal
   ============================================ */
[data-spread] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 1s ease, transform 1s ease;
}

[data-spread].in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Magnetic Text Lean
   ============================================ */
.magnetic-lean {
    transition: transform 0.3s ease;
    will-change: transform;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .observer-margin {
        width: 8%;
    }

    .magazine {
        padding-right: 8%;
    }

    .spread {
        grid-template-columns: 1fr;
        padding: 60px 24px;
        gap: 32px;
    }

    .spread::before {
        display: none;
    }

    .spread-left {
        padding-right: 0;
    }

    .spread-right {
        padding-left: 0;
    }

    .pull-quote {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    .margin-note {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        display: block;
        margin-top: 16px;
        opacity: 0.5;
        font-size: 0.8rem;
    }

    .cover-note {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;
        margin-top: 24px;
    }

    .centerfold-heading {
        font-size: clamp(2rem, 7vw, 3rem);
    }

    .spread-centerfold .centerfold-eye svg {
        width: 70vw;
    }
}
