/* ============================================
   mystical.day — Swamp-Witch's Digital Grimoire
   Colors: #C9B8A3, #6B8F7B, #4A0E1B, #8B5E3C, #F2E8DC, #D4C4B0, #2D1810, #3D2B1F
   Fonts: Pirata One, Literata, Overpass Mono
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: #2D1810;
}

body {
    font-family: 'Literata', Georgia, serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    color: #F2E8DC;
    background-color: #2D1810;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Parchment texture background via CSS --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(74, 14, 27, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(107, 143, 123, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 94, 60, 0.08) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
}

/* --- Noise texture overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
    z-index: 1;
}

/* --- Phase Sections --- */
.phase-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    z-index: 2;
}

/* --- Void Threshold (Hero) --- */
.threshold {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.bubble-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(107, 143, 123, 0.3), rgba(107, 143, 123, 0.08) 60%, transparent);
    border: 1px solid rgba(107, 143, 123, 0.15);
    animation: bubbleFloat linear infinite;
    pointer-events: none;
}

@keyframes bubbleFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) scale(0.5);
        opacity: 0;
    }
}

.mycelium-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.mycelium-thread {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(201, 184, 163, 0.12), transparent);
    height: 1px;
    transform-origin: left center;
    animation: threadPulse 4s ease-in-out infinite;
}

@keyframes threadPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

.threshold-content {
    position: relative;
    z-index: 3;
    text-align: center;
}

.site-title {
    font-family: 'Pirata One', cursive;
    font-size: clamp(42px, 8vw, 80px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #F2E8DC;
    text-shadow: 0 0 40px rgba(107, 143, 123, 0.2), 0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5em;
    opacity: 0;
    animation: titleReveal 2s ease-out 0.5s forwards;
}

@keyframes titleReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.site-subtitle {
    font-family: 'Literata', Georgia, serif;
    font-style: italic;
    font-size: clamp(14px, 2vw, 20px);
    color: #C9B8A3;
    letter-spacing: 0.08em;
    opacity: 0;
    animation: titleReveal 2s ease-out 1.2s forwards;
}

.scroll-indicator {
    margin-top: 4rem;
    opacity: 0;
    animation: titleReveal 2s ease-out 2s forwards;
}

.scroll-text {
    display: block;
    font-family: 'Overpass Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: #8B5E3C;
    margin-bottom: 1rem;
}

.scroll-arrow {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, #8B5E3C, transparent);
    margin: 0 auto;
    position: relative;
    animation: arrowPulse 2s ease-in-out infinite;
}

.scroll-arrow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -3px;
    width: 7px;
    height: 7px;
    border-right: 1px solid #8B5E3C;
    border-bottom: 1px solid #8B5E3C;
    transform: rotate(45deg);
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(8px); }
}

/* --- Phase Cards --- */
.phase-card {
    background: rgba(61, 43, 31, 0.6);
    border: 1px solid rgba(201, 184, 163, 0.1);
    border-radius: 2px;
    padding: clamp(2rem, 4vw, 4rem);
    max-width: 680px;
    width: 100%;
    position: relative;
    backdrop-filter: blur(2px);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.phase-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.phase-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(107, 143, 123, 0.4), transparent);
}

/* --- Phase Header --- */
.phase-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(201, 184, 163, 0.08);
}

.phase-number {
    font-family: 'Overpass Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6B8F7B;
    display: block;
    margin-bottom: 0.5rem;
}

.phase-title {
    font-family: 'Pirata One', cursive;
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #F2E8DC;
}

/* --- Ritual Steps --- */
.phase-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.ritual-step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(201, 184, 163, 0.04);
}

.ritual-step:last-child {
    border-bottom: none;
}

.step-num {
    font-family: 'Overpass Mono', monospace;
    font-size: 13px;
    color: #6B8F7B;
    opacity: 0.6;
    flex-shrink: 0;
    padding-top: 0.25rem;
    line-height: 1.7;
}

.step-content {
    flex: 1;
}

.step-instruction {
    font-family: 'Literata', Georgia, serif;
    font-size: clamp(14px, 1.5vw, 16px);
    line-height: 1.7;
    color: #D4C4B0;
    margin-bottom: 0.75rem;
}

.incantation {
    font-family: 'Overpass Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #6B8F7B;
    background: rgba(45, 24, 16, 0.8);
    border: 1px solid rgba(107, 143, 123, 0.12);
    border-radius: 2px;
    padding: 0.4rem 0.7rem;
    display: block;
    overflow-x: auto;
    white-space: pre;
}

.incantation-block {
    background: rgba(45, 24, 16, 0.8);
    border: 1px solid rgba(107, 143, 123, 0.12);
    border-radius: 2px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.incantation-block .incantation {
    background: none;
    border: none;
    padding: 0;
    display: block;
    line-height: 1.8;
}

/* --- Moss Accent --- */
.moss-accent {
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent,
        rgba(107, 143, 123, 0.3) 20%,
        rgba(107, 143, 123, 0.5) 50%,
        rgba(107, 143, 123, 0.3) 80%,
        transparent
    );
    opacity: 0;
    transition: opacity 1.2s ease-out 0.3s;
}

.phase-card.visible .moss-accent {
    opacity: 1;
}

/* --- Colophon / Footer --- */
.colophon {
    position: relative;
    z-index: 2;
    padding: 15vh 5vw 10vh;
    text-align: center;
}

.colophon-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.colophon-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.colophon-text {
    font-family: 'Literata', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: #8B5E3C;
    line-height: 2;
    letter-spacing: 0.02em;
}

.colophon-mark {
    display: block;
    margin-top: 2rem;
    font-size: 24px;
    color: #6B8F7B;
    opacity: 0.4;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .phase-section {
        padding: 8vh 4vw;
    }

    .phase-card {
        padding: 1.5rem;
    }

    .ritual-step {
        flex-direction: column;
        gap: 0.5rem;
    }

    .step-num {
        padding-top: 0;
    }

    .incantation {
        font-size: 11px;
    }
}

/* --- Selection color --- */
::selection {
    background: rgba(107, 143, 123, 0.3);
    color: #F2E8DC;
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2D1810;
}

::-webkit-scrollbar-thumb {
    background: #3D2B1F;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4A0E1B;
}
