/* ============================================
   xanadu.quest — Coastal Swiss Organic Styles
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #EDF5F0;
    color: #2C4F5B;
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- SVG Defs (hidden) --- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Grain Texture Overlay --- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    mix-blend-mode: overlay;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Sections Base --- */
.section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.section-light {
    background-color: #EDF5F0;
}

.section-dark {
    background-color: #0F2B38;
}

.section-arrival {
    padding: 8vh 0 12vh;
    margin-bottom: -60px;
    z-index: 5;
}

.section-descent {
    padding: 14vh 0 12vh;
    margin-top: -40px;
    margin-bottom: -60px;
    z-index: 4;
}

.section-garden {
    padding: 14vh 0 16vh;
    margin-top: -40px;
    margin-bottom: -60px;
    z-index: 3;
}

.section-dissolution {
    padding: 14vh 0 12vh;
    margin-top: -40px;
    margin-bottom: -60px;
    z-index: 2;
}

.section-silence {
    padding: 16vh 0 20vh;
    margin-top: -40px;
    z-index: 1;
    min-height: 60vh;
}

.section-inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.section-inner-silence {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

/* --- 12-Column Swiss Grid --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 24px;
    position: relative;
    z-index: 2;
}

/* --- Drift Blocks --- */
.drift-block {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.drift-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.drift-block-left {
    grid-column: 2 / 8;
}

.drift-block-right {
    grid-column: 5 / 11;
}

/* --- Domain Label --- */
.domain-label {
    display: block;
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #5D8A6E;
    opacity: 0.7;
    margin-bottom: 3rem;
}

/* --- Section Markers --- */
.section-marker {
    display: block;
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #5D8A6E;
    opacity: 0.7;
    margin-bottom: 1.5rem;
}

.section-marker-dark {
    color: #8ABEAA;
}

/* --- Headlines --- */
.headline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #1B3A4B;
    margin-bottom: 1.5rem;
    position: relative;
    cursor: default;
}

.headline-dark {
    color: #D4E4DC;
}

/* --- Body Text --- */
.body-text {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: #2C4F5B;
    max-width: 38em;
}

.body-text-dark {
    color: #B4D4C4;
}

/* --- Tidal Pairs --- */
.tidal-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 24px;
    position: relative;
}

.tidal-block {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.tidal-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.tidal-block-high {
    grid-column: 2 / 8;
    position: relative;
}

.tidal-block-low {
    grid-column: 5 / 11;
    margin-top: 60px;
    position: relative;
}

.tidal-block-sparse {
    margin-top: 40px;
}

.tidal-connector {
    position: absolute;
    width: 40px;
    height: 160px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Shore Clusters --- */
.shore-cluster {
    grid-column: 3 / 10;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem 3rem;
    padding: 4rem 0;
    justify-content: flex-start;
}

.shore-fragment {
    max-width: 22em;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.shore-fragment.visible {
    opacity: 1;
}

.shore-fragment .body-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1B3A4B;
    font-style: italic;
}

/* --- Leaf Vein Dividers --- */
/* Vein color reference: #3D6B5E (Mangrove Dark) */
.vein-divider {
    position: relative;
    height: 120px;
    width: 100%;
    overflow: hidden;
    z-index: 6;
}

.vein-svg path {
    stroke: #3D6B5E;
}

.vein-divider-faint {
    opacity: 0.5;
}

.vein-svg {
    width: 100%;
    height: 100%;
}

.vein-midrib,
.vein-secondary,
.vein-tertiary {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.vein-divider.animate .vein-midrib {
    stroke-dashoffset: 0;
}

.vein-divider.animate .vein-secondary {
    stroke-dashoffset: 0;
    transition-delay: 0.2s;
}

.vein-divider.animate .vein-tertiary {
    stroke-dashoffset: 0;
    transition-delay: 0.5s;
}

/* --- Floating Abstract Shapes --- */
.drift-shape {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.drift-circle {
    border-radius: 50%;
    background-color: #8ABEAA;
    opacity: 0.12;
    animation: drift-vertical linear infinite alternate;
}

.drift-ellipse {
    border-radius: 50%;
    background-color: #B4D4C4;
    opacity: 0.08;
    animation: drift-rotate linear infinite alternate;
}

.drift-leaf {
    border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
    background-color: #8ABEAA;
    opacity: 0.14;
    animation: drift-leaf linear infinite alternate;
}

.drift-shape-dark.drift-circle {
    background-color: #8ABEAA;
    opacity: 0.08;
}

.drift-shape-dark.drift-ellipse {
    background-color: #B4D4C4;
    opacity: 0.06;
}

.drift-shape-dark.drift-leaf {
    background-color: #8ABEAA;
    opacity: 0.10;
}

.drift-shape-sparse {
    opacity: 0.05;
}

.drift-shape-faintest {
    border-radius: 50%;
    background-color: #8ABEAA;
    opacity: 0.06;
    animation: drift-vertical linear infinite alternate;
}

@keyframes drift-vertical {
    0% { transform: translateY(-30px); }
    100% { transform: translateY(30px); }
}

@keyframes drift-rotate {
    0% { transform: translateY(-20px) rotate(0deg); }
    100% { transform: translateY(20px) rotate(15deg); }
}

@keyframes drift-leaf {
    0% { transform: translateY(-25px) rotate(-3deg); }
    100% { transform: translateY(25px) rotate(8deg); }
}

/* --- Garden Background Vein --- */
.garden-vein-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- Silence Section --- */
.silence-content {
    grid-column: 4 / 10;
    text-align: center;
}

.silence-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: #2C4F5B;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
    letter-spacing: -0.01em;
}

.silence-text.visible {
    opacity: 0.6;
    transform: translateY(0);
}

.silence-vein {
    position: absolute;
    width: 50%;
    height: 40%;
    top: 30%;
    left: 25%;
    pointer-events: none;
    z-index: 0;
}

/* --- Fog Gradient Bands --- */
.section-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to right, transparent, #EDF5F0 30%, #EDF5F0 70%, transparent);
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

.section-dark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to right, transparent, #0F2B38 30%, #0F2B38 70%, transparent);
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

.fog-bottom {
    height: 120px;
    background: linear-gradient(to bottom, #EDF5F0, #EDF5F0 60%, transparent);
    position: relative;
    z-index: 0;
}

/* --- Ripple Interaction --- */
.ripple-target {
    position: relative;
    overflow: hidden;
    cursor: default;
}

.ripple-ring {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    transform: scale(0);
    animation: ripple-expand 800ms ease-out forwards;
}

.ripple-ring:nth-child(1) {
    box-shadow: 0 0 0 1px rgba(138, 190, 170, 0.3);
}

.ripple-ring:nth-child(2) {
    box-shadow: 0 0 0 1px rgba(138, 190, 170, 0.15);
    animation-delay: 100ms;
}

.ripple-ring:nth-child(3) {
    box-shadow: 0 0 0 1px rgba(138, 190, 170, 0.07);
    animation-delay: 200ms;
}

@keyframes ripple-expand {
    0% {
        width: 0px;
        height: 0px;
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        width: 160px;
        height: 160px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* --- Warm Accent (Driftwood Amber) for interactive states --- */
a, .interactive {
    color: #C4956A;
    text-decoration: none;
    transition: color 300ms ease;
}

a:hover, .interactive:hover {
    color: #C4956A;
    opacity: 0.8;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(6, 1fr);
        gap: 0 16px;
    }

    .drift-block-left,
    .drift-block-right {
        grid-column: 1 / -1;
        padding: 0 8px;
    }

    .tidal-block-high,
    .tidal-block-low {
        grid-column: 1 / -1;
    }

    .tidal-block-low {
        margin-top: 2rem;
    }

    .shore-cluster {
        grid-column: 1 / -1;
        padding: 2rem 0;
    }

    .silence-content {
        grid-column: 1 / -1;
    }

    .section-arrival {
        padding: 6vh 0 8vh;
    }

    .section-descent,
    .section-garden,
    .section-dissolution {
        padding: 8vh 0;
    }

    .headline {
        font-size: clamp(2rem, 6vw, 3rem);
    }

    .tidal-connector {
        display: none;
    }

    .drift-shape {
        display: none;
    }
}

@media (max-width: 480px) {
    .section-inner {
        padding: 0 16px;
    }

    .domain-label {
        margin-bottom: 2rem;
    }
}
