/* ============================
   lower.quest - Styles
   ============================ */

/* CSS @property for depth counter animation */
@property --depth {
    syntax: '<number>';
    initial-value: 0;
    inherits: false;
}

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

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

body {
    background-color: #0D0D0D;
    color: #F5F0E8;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* ---- Depth Column (Sidebar) ---- */
#depth-column {
    position: fixed;
    top: 0;
    left: 0;
    width: 38%;
    height: 100vh;
    background: linear-gradient(to bottom, #0D0D0D 0%, #1A0A2E 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Strata lines (thin horizontal decorative lines) */
#depth-column::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 47px,
            rgba(122, 117, 104, 0.08) 47px,
            rgba(122, 117, 104, 0.08) 48px
        );
    pointer-events: none;
    z-index: 1;
}

/* Extra irregular strata lines */
#depth-column::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(to right, transparent 20%, rgba(122,117,104,0.06) 20%, rgba(122,117,104,0.06) 20.5%, transparent 20.5%) no-repeat 0 18%,
        linear-gradient(to right, transparent 40%, rgba(122,117,104,0.06) 40%, rgba(122,117,104,0.06) 40.5%, transparent 40.5%) no-repeat 0 33%,
        linear-gradient(to right, transparent 10%, rgba(122,117,104,0.06) 10%, rgba(122,117,104,0.06) 10.5%, transparent 10.5%) no-repeat 0 55%,
        linear-gradient(to right, transparent 55%, rgba(122,117,104,0.06) 55%, rgba(122,117,104,0.06) 55.5%, transparent 55.5%) no-repeat 0 72%;
    pointer-events: none;
    z-index: 1;
}

/* Progress line - right edge of sidebar */
#progress-line {
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 0%;
    background-color: #00F0A0;
    z-index: 10;
    transition: height 0.4s ease-out;
}

/* ---- Skyline ---- */
#skyline {
    width: 100%;
    height: 120px;
    flex-shrink: 0;
    padding: 0 10px;
    z-index: 2;
    opacity: 0.8;
}

#skyline svg {
    width: 100%;
    height: 100%;
}

/* ---- Depth Counter ---- */
#depth-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 10px;
    z-index: 5;
    flex-shrink: 0;
}

.depth-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: #7A7568;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.depth-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 48px;
    color: #00F0A0;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    --depth: 0;
    transition: --depth 1.2s ease-out;
}

.depth-unit {
    font-size: 24px;
    font-weight: 500;
    color: #7A7568;
    margin-left: 2px;
}

/* Depth counter states */
.depth-value[data-target-depth="0"] { --depth: 0; }
.depth-value[data-target-depth="3.2"] { --depth: 3.2; }
.depth-value[data-target-depth="8.5"] { --depth: 8.5; }
.depth-value[data-target-depth="22"] { --depth: 22; }
.depth-value[data-target-depth="45"] { --depth: 45; }
.depth-value[data-target-depth="78"] { --depth: 78; }

/* ---- Strata Navigation ---- */
#strata-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 20px 0;
    z-index: 5;
}

.stratum-marker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.stratum-line {
    display: block;
    width: 40px;
    height: 1px;
    background-color: #7A7568;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.stratum-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: #7A7568;
    text-transform: uppercase;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.stratum-marker:hover .stratum-line,
.stratum-marker.active .stratum-line {
    width: 60px;
    background-color: #00F0A0;
}

.stratum-marker:hover .stratum-label,
.stratum-marker.active .stratum-label {
    color: #00F0A0;
}

.stratum-marker.active .stratum-label {
    font-weight: 700;
}

/* ---- Crystal Clusters ---- */
.crystal-cluster {
    position: absolute;
    left: 15px;
    z-index: 3;
    opacity: 0.6;
    transition: opacity 0.6s ease;
}

.crystal-cluster:hover {
    opacity: 1;
}

.crystal-cluster:hover polygon {
    stroke: rgba(201, 168, 76, 1);
}

/* ---- Aquifer Bubbles ---- */
#aquifer-bubbles {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

#bubbles-svg {
    width: 100%;
    height: 100%;
}

.bubble {
    animation: bubble-rise linear infinite;
    transform-origin: center center;
}

.bubble:nth-child(1) { animation-duration: 10s; animation-delay: 0s; }
.bubble:nth-child(2) { animation-duration: 12s; animation-delay: 1.2s; }
.bubble:nth-child(3) { animation-duration: 8s; animation-delay: 0.5s; }
.bubble:nth-child(4) { animation-duration: 14s; animation-delay: 2.1s; }
.bubble:nth-child(5) { animation-duration: 9s; animation-delay: 0.8s; }
.bubble:nth-child(6) { animation-duration: 11s; animation-delay: 3.5s; }
.bubble:nth-child(7) { animation-duration: 13s; animation-delay: 1.7s; }
.bubble:nth-child(8) { animation-duration: 10s; animation-delay: 4.2s; }
.bubble:nth-child(9) { animation-duration: 15s; animation-delay: 0.3s; }
.bubble:nth-child(10) { animation-duration: 8.5s; animation-delay: 2.8s; }
.bubble:nth-child(11) { animation-duration: 12s; animation-delay: 5.1s; }
.bubble:nth-child(12) { animation-duration: 9.5s; animation-delay: 1.0s; }
.bubble:nth-child(13) { animation-duration: 11s; animation-delay: 3.3s; }
.bubble:nth-child(14) { animation-duration: 14s; animation-delay: 0.7s; }
.bubble:nth-child(15) { animation-duration: 10s; animation-delay: 4.8s; }
.bubble:nth-child(16) { animation-duration: 13s; animation-delay: 2.4s; }
.bubble:nth-child(17) { animation-duration: 8s; animation-delay: 5.5s; }
.bubble:nth-child(18) { animation-duration: 11s; animation-delay: 1.5s; }

@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(1, 1);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-50px) scale(1.1, 0.9);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-100px) scale(1, 1);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-150px) scale(1.1, 0.9);
        opacity: 0.4;
    }
    100% {
        transform: translateY(-210px) scale(1, 1);
        opacity: 0;
    }
}

/* ---- Main Content Area ---- */
#editorial-content {
    margin-left: 38%;
    width: 62%;
    min-height: 100vh;
    position: relative;
}

/* ---- Content Sections ---- */
.content-section {
    min-height: 100vh;
    position: relative;
    padding: 100px 80px 100px 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-boundary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, #8B5E3C 0%, rgba(139, 94, 60, 0) 100%);
}

.section-inner {
    position: relative;
    z-index: 2;
    max-width: 680px;
}

/* ---- Blobs ---- */
.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 42% 58% 62% 38% / 45% 55% 52% 48%;
    pointer-events: none;
    z-index: 0;
    transition: transform 0.5s ease-out;
}

.blob-gold {
    background-color: rgba(201, 168, 76, 0.04);
}

.blob-aquifer {
    background-color: rgba(0, 240, 160, 0.06);
}

/* ---- Typography ---- */
.hero-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 5.2rem);
    letter-spacing: -0.03em;
    color: #F5F0E8;
    margin-bottom: 30px;
    line-height: 1.1;
}

.accent-dot {
    color: #00F0A0;
}

.hero-sub {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.7;
    color: #7A7568;
    max-width: 540px;
    margin-bottom: 40px;
}

.hero-instruction {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #00F0A0;
    opacity: 0.7;
    animation: pulse-instruction 2s ease-in-out infinite;
}

@keyframes pulse-instruction {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.9; }
}

.section-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 5.2rem);
    letter-spacing: -0.03em;
    color: #C9A84C;
    margin-bottom: 12px;
    line-height: 1.1;
}

.depth-reading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #00F0A0;
    letter-spacing: 0.1em;
    margin-bottom: 40px;
    text-transform: uppercase;
}

.section-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    color: #F5F0E8;
    margin-bottom: 24px;
    max-width: 600px;
}

/* ---- Card Flip ---- */
.card-flip {
    perspective: 1000px;
    width: 100%;
    max-width: 520px;
    height: 240px;
    margin: 40px 0;
    cursor: pointer;
    outline: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card-flip.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.card-front {
    background-color: #0D0D0D;
    border: 1px solid #8B5E3C;
}

.card-front h3 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 22px;
    color: #C9A84C;
    margin-bottom: 12px;
}

.card-front p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 15px;
    color: #7A7568;
    line-height: 1.5;
}

.card-prompt {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 11px;
    color: #FF2D7B;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: auto;
    opacity: 0.7;
}

.card-back {
    background-color: #F5F0E8;
    border: 1px solid #8B5E3C;
    transform: rotateY(180deg);
}

.card-back h3 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 20px;
    color: #0D0D0D;
    margin-bottom: 12px;
}

.card-back p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #0D0D0D;
    line-height: 1.5;
    margin-bottom: 6px;
}

/* ---- Diagram Panel ---- */
.diagram-panel {
    width: calc(100% + 80px);
    margin-left: -20px;
    margin-right: -60px;
    margin-top: 30px;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.utility-diagram {
    width: 100%;
    height: auto;
    background-color: rgba(13, 13, 13, 0.8);
    border: 1px solid #8B5E3C;
    border-radius: 4px;
    padding: 10px;
}

/* ---- Coda (ending) ---- */
.section-coda {
    margin-top: 80px;
    padding-top: 40px;
    border-top: 1px solid #8B5E3C;
}

.coda-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 20px;
    font-style: italic;
    color: #7A7568;
    line-height: 1.7;
    max-width: 500px;
    margin-bottom: 30px;
}

.coda-sign {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #C9A84C;
}

/* ---- Responsive (< 768px) ---- */
@media (max-width: 768px) {
    #depth-column {
        width: 48px;
    }

    #skyline,
    .crystal-cluster,
    #strata-nav .stratum-label,
    .stratum-line,
    .depth-label {
        display: none;
    }

    #depth-counter {
        position: absolute;
        bottom: 50%;
        left: 50%;
        transform: rotate(-90deg) translateX(50%);
        transform-origin: center center;
        padding: 0;
    }

    .depth-value {
        font-size: 24px;
    }

    .depth-unit {
        font-size: 14px;
    }

    #strata-nav {
        padding: 10px 0;
    }

    .stratum-marker {
        padding: 6px;
        justify-content: center;
    }

    #aquifer-bubbles .bubble:nth-child(n+9) {
        display: none;
    }

    #editorial-content {
        margin-left: 48px;
        width: calc(100% - 48px);
    }

    .content-section {
        padding: 60px 24px 60px 24px;
    }

    .card-flip {
        max-width: 100%;
        height: 280px;
    }

    .diagram-panel {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .blob {
        width: 250px;
        height: 250px;
    }
}

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

::-webkit-scrollbar-track {
    background: #0D0D0D;
}

::-webkit-scrollbar-thumb {
    background: #7A7568;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #C9A84C;
}

/* ---- Selection ---- */
::selection {
    background-color: rgba(0, 240, 160, 0.2);
    color: #F5F0E8;
}
