/* ============================================
   MasqueradeProtocol.com — Styles
   Colors: #FAF3E8, #4A1526, #1C1018, #F5EDE3, 
           #B8963E, #C4506B, #8A7E76, #0D0A0C, #3E8AA0
   Fonts: Abril Fatface, Libre Baskerville, Space Mono
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --cream: #FAF3E8;
    --burgundy: #4A1526;
    --dark: #1C1018;
    --porcelain: #F5EDE3;
    --gold: #B8963E;
    --rose: #C4506B;
    --ash: #8A7E76;
    --phantom: #0D0A0C;
    --teal: #3E8AA0;

    --font-display: 'Abril Fatface', serif;
    --font-body: 'Libre Baskerville', serif;
    --font-mono: 'Space Mono', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--cream);
    color: var(--dark);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    overflow: hidden;
}

/* --- Scroll Container --- */
.scroll-container {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

/* --- Scan Line Overlay --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(13, 10, 12, 0.03) 2px,
        rgba(13, 10, 12, 0.03) 3px
    );
    opacity: 1;
    transition: opacity 200ms ease;
}

.scanlines.pulse {
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(13, 10, 12, 0.12) 2px,
        rgba(13, 10, 12, 0.12) 3px
    );
}

/* --- Dot Navigation --- */
.dot-nav {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dot-nav__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--gold);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.4s ease, transform 0.3s ease;
    padding: 0;
}

.dot-nav__dot.active {
    background-color: var(--gold);
    transform: scale(1.3);
}

.dot-nav__dot:hover {
    background-color: var(--rose);
    border-color: var(--rose);
}

/* --- Spreads (Sections) --- */
.spread {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

.spread__inner {
    width: 100%;
    min-height: 100vh;
    padding: 48px;
    display: grid;
    position: relative;
}

/* --- Glitch Transition Effect --- */
.spread.glitching .spread__inner {
    animation: glitchShift 100ms ease-in-out;
}

.spread.glitching .headline {
    text-shadow: 2px 0 var(--rose), -2px 0 var(--teal);
    transition: text-shadow 0ms;
}

@keyframes glitchShift {
    0% { transform: translateX(0); }
    30% { transform: translateX(3px); }
    60% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

/* --- Ripple Effect --- */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 21, 38, 0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0.4;
    animation: rippleExpand 800ms ease-out forwards;
    pointer-events: none;
    z-index: 50;
}

@keyframes rippleExpand {
    from {
        transform: scale(0);
        opacity: 0.4;
    }
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --- Typography --- */
.headline {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.headline--display {
    font-size: clamp(64px, 10vw, 128px);
    color: var(--dark);
}

.headline--section {
    font-size: clamp(36px, 5vw, 64px);
    color: var(--porcelain);
    margin-bottom: 32px;
    position: relative;
    z-index: 2;
}

.headline--intimate {
    font-size: clamp(32px, 4.5vw, 56px);
    color: var(--dark);
    margin-bottom: 40px;
    text-align: center;
}

.headline--exit {
    color: var(--porcelain);
}

.headline--glitch {
    font-size: clamp(40px, 6vw, 96px);
    color: var(--porcelain);
    position: relative;
}

.headline--glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    color: var(--porcelain);
    clip-path: inset(10% 0 60% 0);
    text-shadow: 2px 0 var(--rose), -2px 0 var(--teal);
    animation: glitchText 4s infinite linear alternate;
}

@keyframes glitchText {
    0% { clip-path: inset(10% 0 60% 0); transform: translate(0); }
    10% { clip-path: inset(40% 0 20% 0); transform: translate(-2px, 1px); }
    20% { clip-path: inset(70% 0 5% 0); transform: translate(2px, -1px); }
    30% { clip-path: inset(10% 0 60% 0); transform: translate(0); }
    100% { clip-path: inset(10% 0 60% 0); transform: translate(0); }
}

.body-text {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.72;
    color: var(--dark);
    margin-bottom: 24px;
}

.body-text--centered {
    text-align: center;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.body-text--light {
    color: var(--porcelain);
}

.annotation {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ash);
}

.marginal-note {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--porcelain);
    opacity: 0.8;
    margin-top: 8px;
    margin-bottom: 24px;
}

/* --- Pull Quote --- */
.pull-quote {
    position: relative;
    padding: 24px 0;
}

.pull-quote__mark {
    font-family: var(--font-display);
    font-size: 200px;
    color: var(--gold);
    opacity: 0.04;
    position: absolute;
    top: -60px;
    left: -20px;
    line-height: 1;
    pointer-events: none;
}

.pull-quote__text {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.3;
    color: var(--dark);
    letter-spacing: -0.02em;
}

/* --- Gold Rule --- */
.gold-rule {
    border: none;
    height: 0.5px;
    background-color: var(--gold);
    width: 40%;
    margin: 24px 0;
}

.gold-rule--centered {
    margin-left: auto;
    margin-right: auto;
}

/* --- Organic Blob Shapes --- */
.blob {
    position: absolute;
    background: linear-gradient(135deg, var(--burgundy) 0%, var(--phantom) 100%);
    box-shadow: inset 0 0 60px rgba(184, 150, 62, 0.15);
    will-change: border-radius;
}

.blob--morph-a {
    animation: morphA 20s ease-in-out infinite;
}

.blob--morph-b {
    animation: morphB 20s ease-in-out infinite;
}

.blob--morph-c {
    animation: morphC 20s ease-in-out infinite;
}

@keyframes morphA {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25% { border-radius: 58% 42% 55% 45% / 56% 63% 37% 44%; }
    50% { border-radius: 40% 60% 33% 67% / 55% 30% 70% 45%; }
    75% { border-radius: 67% 33% 50% 50% / 33% 67% 33% 67%; }
}

@keyframes morphB {
    0%, 100% { border-radius: 50% 50% 40% 60% / 40% 60% 40% 60%; }
    25% { border-radius: 33% 67% 58% 42% / 63% 37% 56% 44%; }
    50% { border-radius: 60% 40% 70% 30% / 30% 70% 45% 55%; }
    75% { border-radius: 45% 55% 35% 65% / 55% 45% 60% 40%; }
}

@keyframes morphC {
    0%, 100% { border-radius: 70% 30% 30% 70% / 60% 40% 60% 40%; }
    25% { border-radius: 42% 58% 45% 55% / 37% 63% 44% 56%; }
    50% { border-radius: 55% 45% 67% 33% / 70% 30% 55% 45%; }
    75% { border-radius: 35% 65% 50% 50% / 50% 50% 67% 33%; }
}

/* ============================================
   SPREAD 1: THE THRESHOLD
   ============================================ */
.spread--threshold {
    background-color: var(--cream);
}

.spread--threshold__grid {
    place-items: center;
    grid-template-rows: 1fr;
    grid-template-columns: 1fr;
    position: relative;
}

.spread--threshold__title {
    position: relative;
    z-index: 10;
    text-align: center;
    grid-row: 1;
    grid-column: 1;
    align-self: end;
    padding-bottom: 10vh;
}

.spread--threshold__title .headline--display {
    letter-spacing: 0.08em;
}

.spread--threshold__title .annotation {
    margin-top: 16px;
}

.blob--hero {
    width: clamp(280px, 40vw, 500px);
    height: clamp(280px, 40vw, 500px);
    grid-row: 1;
    grid-column: 1;
    z-index: 1;
    align-self: center;
    justify-self: center;
}

.blob--hero-secondary {
    width: clamp(160px, 22vw, 300px);
    height: clamp(160px, 22vw, 300px);
    grid-row: 1;
    grid-column: 1;
    z-index: 2;
    align-self: center;
    justify-self: center;
    margin-top: -80px;
    margin-left: 120px;
    opacity: 0.6;
    animation-delay: -7s;
}

.blob--hero-tertiary {
    width: clamp(100px, 14vw, 180px);
    height: clamp(100px, 14vw, 180px);
    grid-row: 1;
    grid-column: 1;
    z-index: 3;
    align-self: center;
    justify-self: center;
    margin-top: 60px;
    margin-left: -160px;
    opacity: 0.4;
    animation-delay: -13s;
}

/* ============================================
   SPREAD 2: THE UNMASKING
   ============================================ */
.spread--unmasking {
    background-color: var(--burgundy);
}

.spread--unmasking .body-text {
    color: var(--porcelain);
}

.spread--unmasking .pull-quote__text {
    color: var(--porcelain);
}

.spread--unmasking .pull-quote__mark {
    color: var(--gold);
    opacity: 0.08;
}

.spread--unmasking .annotation {
    color: var(--ash);
}

.spread--unmasking__grid {
    grid-template-rows: 40% 60%;
    grid-template-columns: 1fr;
}

.spread--unmasking__top {
    display: grid;
    place-items: center;
    padding: 0 8%;
}

.spread--unmasking__bottom {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: 48px;
    padding: 48px 8%;
    align-content: start;
}

.spread--unmasking__col-left {
    padding-right: 24px;
}

.spread--unmasking__col-right {
    padding-left: 24px;
    border-left: 0.5px solid var(--gold);
}

/* Noise texture on burgundy sections */
.spread--unmasking::after,
.spread--protocol::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#noise);
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: overlay;
}

/* Scan lines darker on burgundy */
.spread--unmasking .scanlines,
.spread--protocol .scanlines {
    opacity: 0.08;
}

/* ============================================
   SPREAD 3: THE PROTOCOL
   ============================================ */
.spread--protocol {
    background-color: var(--burgundy);
}

.spread--protocol .body-text {
    color: var(--porcelain);
}

.spread--protocol__grid {
    grid-template-columns: 3fr 6fr 3fr;
    gap: 32px;
    align-content: center;
}

.spread--protocol__left,
.spread--protocol__right {
    padding-top: 60px;
}

.spread--protocol__left .annotation,
.spread--protocol__right .annotation {
    color: var(--gold);
    margin-bottom: 4px;
}

.spread--protocol__left .gold-rule,
.spread--protocol__right .gold-rule {
    width: 60%;
}

.spread--protocol__center {
    position: relative;
    z-index: 2;
}

.blob--protocol {
    width: 200px;
    height: 200px;
    position: absolute;
    top: -40px;
    right: -40px;
    z-index: -1;
    opacity: 0.3;
    animation-delay: -5s;
}

/* ============================================
   SPREAD 4: THE REVELATION
   ============================================ */
.spread--revelation {
    background-color: var(--cream);
}

.spread--revelation__grid {
    place-items: center;
    grid-template-columns: 1fr;
}

.spread--revelation__content {
    max-width: 680px;
    text-align: center;
    padding: 48px 24px;
}

/* ============================================
   SPREAD 5: THE EXIT
   ============================================ */
.spread--exit {
    background-color: var(--phantom);
}

.spread--exit__grid {
    place-items: center;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    position: relative;
}

.spread--exit__content {
    position: relative;
    z-index: 10;
    text-align: center;
    grid-row: 1;
    grid-column: 1;
}

.spread--exit .annotation {
    color: var(--ash);
    margin-top: 20px;
}

.blob--exit-a {
    width: clamp(120px, 18vw, 220px);
    height: clamp(120px, 18vw, 220px);
    grid-row: 1;
    grid-column: 1;
    z-index: 1;
    align-self: start;
    justify-self: start;
    margin-top: 10vh;
    margin-left: 8vw;
    opacity: 0.5;
    animation-delay: -2s;
}

.blob--exit-b {
    width: clamp(100px, 14vw, 180px);
    height: clamp(100px, 14vw, 180px);
    grid-row: 1;
    grid-column: 1;
    z-index: 1;
    align-self: start;
    justify-self: end;
    margin-top: 15vh;
    margin-right: 12vw;
    opacity: 0.4;
    animation-delay: -8s;
}

.blob--exit-c {
    width: clamp(80px, 12vw, 160px);
    height: clamp(80px, 12vw, 160px);
    grid-row: 1;
    grid-column: 1;
    z-index: 1;
    align-self: end;
    justify-self: start;
    margin-bottom: 12vh;
    margin-left: 20vw;
    opacity: 0.35;
    animation-delay: -14s;
}

.blob--exit-d {
    width: clamp(60px, 10vw, 140px);
    height: clamp(60px, 10vw, 140px);
    grid-row: 1;
    grid-column: 1;
    z-index: 1;
    align-self: end;
    justify-self: end;
    margin-bottom: 18vh;
    margin-right: 8vw;
    opacity: 0.3;
    animation-delay: -18s;
}

/* ============================================
   HOVER & INTERACTION STATES
   ============================================ */
.headline:hover {
    text-shadow: 1px 0 var(--rose), -1px 0 var(--teal);
    transition: text-shadow 150ms ease;
}

.headline:not(:hover) {
    text-shadow: none;
    transition: text-shadow 300ms ease;
}

.pull-quote:hover .pull-quote__mark {
    opacity: 0.12;
    transition: opacity 400ms ease;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .spread__inner {
        padding: 32px 24px;
    }

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

    .spread--unmasking__col-right {
        border-left: none;
        padding-left: 0;
        border-top: 0.5px solid var(--gold);
        padding-top: 24px;
    }

    .spread--protocol__grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .spread--protocol__left,
    .spread--protocol__right {
        padding-top: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .dot-nav {
        right: 14px;
    }

    .blob--hero-secondary {
        margin-left: 60px;
    }

    .blob--hero-tertiary {
        margin-left: -80px;
    }
}

@media (max-width: 600px) {
    .spread__inner {
        padding: 24px 16px;
    }

    .headline--display {
        font-size: 48px;
        letter-spacing: 0.04em;
    }

    .headline--glitch {
        font-size: 32px;
    }

    .spread--protocol__left,
    .spread--protocol__right {
        grid-template-columns: 1fr;
    }

    .spread--unmasking__top {
        padding: 0 4%;
    }
}
