/* ============================================
   archetype.boo — Styles
   Triadic palette on dark ground
   Serif-revival typography
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --fools-violet: #7B2D8E;
    --herald-gold: #D4A017;
    --sage-teal: #1A8F7D;
    --curtain-black: #0E0E12;
    --parchment-white: #F2EDE4;
    --whisper-mauve: #3D2A45;
    --phantom-gray: #6B6575;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Nunito Sans', 'Helvetica Neue', sans-serif;
    --font-accent: 'Space Mono', 'Courier New', monospace;

    --scroll-y: 0;
}

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

html {
    font-size: 16px;
    scroll-behavior: auto;
    overflow: hidden;
    height: 100%;
}

body {
    background-color: var(--curtain-black);
    color: var(--parchment-white);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.72;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    overflow: hidden;
    height: 100%;
}

/* --- Hidden SVG Noise Filter --- */
.noise-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* --- Noise Overlay --- */
.noise-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.03;
    filter: url(#noiseFilter);
    --hue-shift: 0deg;
}

.noise-overlay::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-conic-gradient(
        var(--whisper-mauve) 0%,
        transparent 0.5%
    );
    filter: url(#noiseFilter) hue-rotate(var(--hue-shift));
}

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

/* --- Section Base --- */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--curtain-black);
}

.section-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 48px;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 24px;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: 7vw;
    color: var(--parchment-white);
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow: hidden;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: letterReveal 0.6s ease-out forwards;
    animation-delay: calc(0.3s + var(--delay) * 0.08s);
}

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

.hero-sigil {
    opacity: 0;
    animation: sigilFadeIn 1.4s ease-out 0.3s forwards;
}

@keyframes sigilFadeIn {
    to {
        opacity: 1;
    }
}

.hero-sigil svg {
    width: clamp(180px, 25vw, 300px);
    height: clamp(180px, 25vw, 300px);
}

.hero-boo {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    color: var(--phantom-gray);
}

.hero-boo .boo-char {
    display: inline-block;
    opacity: 0;
    animation: typeIn 0.1s steps(1) forwards;
    animation-delay: calc(1.2s + var(--boo-delay) * 0.15s);
}

@keyframes typeIn {
    to {
        opacity: 1;
    }
}

.hero-rule {
    width: 0;
    height: 1px;
    background-color: var(--herald-gold);
    animation: ruleExpand 0.6s ease-in-out 1.8s forwards;
}

@keyframes ruleExpand {
    to {
        width: 60vw;
    }
}

/* ============================================
   ARCHETYPE SECTIONS
   ============================================ */

/* --- Grid Layout --- */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 48px;
    align-items: center;
    width: 100%;
}

/* --- Composition A: Icon left, text right --- */
.comp-a .icon-left {
    grid-column: 1 / 8;
    display: flex;
    justify-content: center;
    align-items: center;
}

.comp-a .text-right {
    grid-column: 8 / 13;
}

/* --- Composition B: Text center, flanked icons --- */
.comp-b .icon-flank-left {
    grid-column: 1 / 4;
    display: flex;
    justify-content: center;
    align-items: center;
}

.comp-b .text-center {
    grid-column: 4 / 10;
    text-align: center;
}

.comp-b .icon-flank-right {
    grid-column: 10 / 13;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Archetype Icon SVGs --- */
.archetype-svg {
    width: clamp(200px, 40vw, 500px);
    height: clamp(200px, 40vw, 500px);
    will-change: transform;
}

.archetype-svg-small {
    width: clamp(80px, 15vw, 180px);
    height: clamp(80px, 15vw, 180px);
    will-change: transform;
}

/* --- Archetype Text --- */
.archetype-label {
    display: block;
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--phantom-gray);
    margin-bottom: 12px;
}

.archetype-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(3rem, 7vw, 6.5rem);
    color: var(--parchment-white);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 24px;
    position: relative;
    display: inline-block;
}

/* --- Underline-Draw --- */
.underline-draw::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--herald-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.underline-draw.is-visible::after {
    transform: scaleX(1);
}

.underline-draw.hover-retract::after {
    transform-origin: right;
    transform: scaleX(0);
}

.underline-draw.hover-redraw::after {
    transform-origin: left;
    transform: scaleX(1);
}

/* --- Decorative Rule --- */
.decorative-rule {
    width: 60px;
    height: 1px;
    background: var(--phantom-gray);
    margin-bottom: 20px;
    opacity: 0;
    transition: opacity 0.6s ease;
    position: relative;
}

.decorative-rule::before,
.decorative-rule::after {
    content: '';
    position: absolute;
    top: -2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--phantom-gray);
}

.decorative-rule::before {
    left: -3px;
}

.decorative-rule::after {
    right: -3px;
}

.comp-b .decorative-rule {
    margin-left: auto;
    margin-right: auto;
}

.section.is-active .decorative-rule {
    opacity: 0.8;
}

.archetype-description {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.72;
    color: var(--parchment-white);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease 0.7s, transform 0.6s ease 0.7s;
}

.section.is-active .archetype-description {
    opacity: 1;
    transform: translateY(0);
}

/* --- Section Entry/Exit Animation --- */
.section-archetype .archetype-icon {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.section-archetype.is-active .archetype-icon {
    opacity: 1;
    transform: scale(1);
}

.section-archetype.is-exiting .archetype-icon {
    opacity: 0.3;
    transform: scale(0.85);
}

/* ============================================
   CLOSING SECTION
   ============================================ */

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 40px;
}

.closing-sigil {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1s ease, transform 1s ease;
}

.section-closing.is-active .closing-sigil {
    opacity: 1;
    transform: scale(1);
}

.closing-sigil svg {
    width: clamp(200px, 25vw, 300px);
    height: clamp(200px, 25vw, 300px);
}

.closing-question {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--herald-gold);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.5s, transform 0.8s ease 0.5s;
}

.section-closing.is-active .closing-question {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   GHOST ICONS (fixed, for convergence)
   ============================================ */

.ghost-icons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.ghost-icons.is-converging {
    opacity: 1;
}

.ghost-icon {
    position: absolute;
    opacity: 0;
    will-change: transform, opacity;
    transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ghost-trickster {
    top: 15%;
    left: 10%;
}

.ghost-shadow {
    top: 30%;
    right: 12%;
}

.ghost-herald {
    top: 50%;
    left: 15%;
}

.ghost-sage {
    top: 65%;
    right: 15%;
}

.ghost-innocent {
    top: 80%;
    left: 50%;
    transform: translateX(-50%);
}

.ghost-icons.is-converging .ghost-icon {
    opacity: 0.7;
}

.ghost-icons.is-converging .ghost-trickster {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    transition-delay: 0s;
}

.ghost-icons.is-converging .ghost-shadow {
    top: 50%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    transition-delay: 0.15s;
}

.ghost-icons.is-converging .ghost-herald {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    transition-delay: 0.3s;
}

.ghost-icons.is-converging .ghost-sage {
    top: 50%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    transition-delay: 0.45s;
}

.ghost-icons.is-converging .ghost-innocent {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    transition-delay: 0.6s;
}

/* ============================================
   PARALLAX UTILITY
   ============================================ */

.parallax-bg {
    will-change: transform;
}

.parallax-mid {
    will-change: transform;
}

.parallax-fg {
    will-change: transform;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .section-content {
        padding: 0 32px;
    }

    .grid-layout {
        gap: 24px;
    }

    .archetype-svg {
        width: clamp(160px, 50vw, 350px);
        height: clamp(160px, 50vw, 350px);
    }

    .archetype-svg-small {
        width: clamp(60px, 12vw, 120px);
        height: clamp(60px, 12vw, 120px);
    }

    .archetype-name {
        font-size: clamp(2.2rem, 5vw, 4rem);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .section-content {
        padding: 0 24px;
    }

    .grid-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }

    .comp-a .icon-left,
    .comp-a .text-right,
    .comp-b .icon-flank-left,
    .comp-b .text-center,
    .comp-b .icon-flank-right {
        grid-column: 1 / -1;
    }

    .comp-b .icon-flank-left,
    .comp-b .icon-flank-right {
        display: none;
    }

    .archetype-svg {
        width: 70vw;
        height: 70vw;
        max-width: 300px;
        max-height: 300px;
    }

    .archetype-name {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .hero-title {
        font-size: 12vw;
    }

    .hero-sigil svg {
        width: 50vw;
        height: 50vw;
        max-width: 200px;
        max-height: 200px;
    }

    .decorative-rule {
        margin-left: auto;
        margin-right: auto;
    }

    .archetype-description {
        font-size: 0.95rem;
    }
}
