/* ============================================================================
   mystical.day - Stylesheet
   Japanese-minimal contemplative digital temple
   ============================================================================ */

/* Root & Global Styles */
:root {
    /* Color Palette */
    --color-bg-warm: #f5ece0;        /* Kiln Cream */
    --color-bg-dawn: #faf6f0;        /* Pale Dawn */
    --color-text-primary: #3d2b1f;   /* Fired Earth */
    --color-text-secondary: #7a6352; /* Clay Shadow */
    --color-accent: #c4a882;         /* Terracotta Gold */
    --color-botanical: #a08870;      /* Faded Umber */
    --color-hover: #b85c38;          /* Burnt Terracotta */
    --color-stone: #8a7060;          /* Warm Stone */
    --color-negative: #f9f4ed;       /* Pure Warmth */

    /* Typography Scales */
    --font-serif: 'Cormorant Garamond', serif;
    --font-mono: 'Space Mono', monospace;

    /* Spacing & Layout */
    --spacing-block-gap: 45vh;       /* Vertical breathing room */
    --max-width-block: 38rem;        /* Content block max-width */
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    color: var(--color-text-primary);
    background: linear-gradient(to top, var(--color-bg-warm), var(--color-bg-dawn));
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Grain Texture Overlay */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    mix-blend-mode: overlay;
}

#noiseFilter {
    /* Uses feTurbulence for organic texture */
}

/* ============================================================================
   Opening Void Section
   ============================================================================ */

#opening-void {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.void-content {
    text-align: center;
}

.site-title {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    color: var(--color-text-primary);
    opacity: 0;
    animation: fadeIn 3s ease-out forwards;
    margin-bottom: 2rem;
}

.title-line {
    width: 40vw;
    max-width: 500px;
    height: 1px;
    background-color: var(--color-accent);
    margin: 0 auto;
    opacity: 0;
    animation: fadeIn 1.5s ease-out forwards 2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   Thought Blocks
   ============================================================================ */

.thought-block {
    max-width: var(--max-width-block);
    margin: var(--spacing-block-gap) auto;
    padding: 3rem 2rem;
    text-align: center;
    opacity: 0;
    animation: revealBlock 1.5s ease-out forwards;
}

@keyframes revealBlock {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.block-label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.block-heading {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    font-weight: 300;
    font-style: italic;
    line-height: 1.5;
    color: var(--color-text-primary);
    margin-bottom: 2rem;
}

.block-body {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    line-height: 1.9;
    color: var(--color-text-secondary);
    letter-spacing: 0.01em;
}

/* ============================================================================
   Botanical Interruptions
   ============================================================================ */

.botanical-interruption {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: var(--spacing-block-gap) 0;
    opacity: 0;
    animation: revealBlock 1.5s ease-out forwards;
}

.botanical-left {
    justify-content: 30%;
    padding-left: 10%;
}

.botanical-right {
    justify-content: 70%;
    padding-right: 10%;
}

.botanical-svg {
    width: clamp(150px, 60vw, 400px);
    height: auto;
    opacity: 0.4;
    filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.05));
    transition: transform 0.6s ease-out;
}

.botanical-interruption.in-view .botanical-svg {
    transform: scale(1.02);
}

/* ============================================================================
   Wave Dividers
   ============================================================================ */

.wave-divider {
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: calc(var(--spacing-block-gap) / 2) 0;
    opacity: 0;
    animation: revealBlock 1.5s ease-out forwards;
}

.wave-divider svg {
    width: 100%;
    height: auto;
}

.wave-divider path {
    animation: waveFlow 8s ease-in-out infinite;
}

@keyframes waveFlow {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(20px);
    }
}

/* ============================================================================
   Closing Stone
   ============================================================================ */

#closing-stone {
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stone {
    width: 15vw;
    height: 15vw;
    min-width: 120px;
    max-width: 250px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #9d8070, var(--color-stone) 50%, #6d5c4d);
    box-shadow: inset -2px -2px 8px rgba(0, 0, 0, 0.2),
                inset 2px 2px 8px rgba(255, 255, 255, 0.3),
                0 10px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    animation: revealBlock 1.5s ease-out forwards;
}

/* ============================================================================
   Final Void
   ============================================================================ */

.final-void {
    height: 50vh;
    background: linear-gradient(to top, var(--color-bg-warm), transparent);
}

/* ============================================================================
   Shake-Error Interaction
   ============================================================================ */

@keyframes shake {
    0% { transform: translateX(-4px); }
    20% { transform: translateX(4px); }
    40% { transform: translateX(-2px); }
    60% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

.shake-trigger {
    animation: shake 0.3s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    :root {
        --max-width-block: 90vw;
    }

    .thought-block {
        padding: 2rem 1.5rem;
        margin: 35vh auto;
    }

    .botanical-left {
        padding-left: 5%;
    }

    .botanical-right {
        padding-right: 5%;
    }

    .botanical-svg {
        width: clamp(100px, 85vw, 350px);
    }

    .block-heading {
        font-size: clamp(1.3rem, 2.2vw, 1.7rem);
    }

    .block-body {
        font-size: clamp(0.8rem, 1.1vw, 0.9rem);
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-block-gap: 30vh;
    }

    #opening-void {
        height: 80vh;
    }

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

    .title-line {
        width: 80vw;
        max-width: 100%;
    }

    .thought-block {
        padding: 1.5rem 1rem;
        margin: 25vh auto;
    }

    .block-label {
        font-size: 0.65rem;
    }

    .block-heading {
        font-size: clamp(1.2rem, 2vw, 1.5rem);
        margin-bottom: 1.5rem;
    }

    .block-body {
        font-size: clamp(0.75rem, 1vw, 0.85rem);
        line-height: 1.8;
    }

    .stone {
        width: 20vw;
        height: 20vw;
    }

    .final-void {
        height: 40vh;
    }
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.no-scroll {
    overflow: hidden;
}

/* Prevent text selection on botanical illustrations */
[data-botanical] {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
