/* ============================================================
   SocialDebug.Org - Styles
   Palette: Sea Fog #EDF2F4, Driftwood #D5C9B1, Ink Depths #2B2D42,
            Kelp Gray #8D99AE, Tidal Teal #4ECDC4, Coral Blush #E07A5F,
            Sea Glass #81B29A, Midnight Jetty #1A1A2E
   ============================================================ */

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

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

body {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    color: #2B2D42;
    background-color: #EDF2F4;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* Paper texture noise overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    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-repeat: repeat;
    background-size: 256px 256px;
}

/* === Typography === */
h1, h2 {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #2B2D42;
}

h3 {
    font-family: 'DM Sans', 'Helvetica Neue', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: #2B2D42;
}

.annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 15px;
    color: #8D99AE;
}

/* === Vine Navigation === */
#vine-nav {
    position: fixed;
    right: 0;
    top: 0;
    width: 80px;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
}

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

#vine-track {
    stroke: #D5C9B1;
    stroke-width: 2;
    stroke-linecap: round;
    opacity: 0.4;
}

#vine-progress {
    stroke: #4ECDC4;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 580;
    stroke-dashoffset: 580;
    will-change: stroke-dashoffset;
}

.vine-leaf {
    pointer-events: all;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vine-leaf path {
    fill: #D5C9B1;
    stroke: #8D99AE;
    stroke-width: 0.8;
    transition: fill 0.3s ease;
}

.vine-leaf.active path {
    fill: #4ECDC4;
    stroke: #4ECDC4;
}

.vine-leaf.active {
    transform: scale(1.4);
}

.vine-label {
    font-family: 'Caveat', cursive;
    font-size: 11px;
    fill: #8D99AE;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vine-leaf:hover .vine-label,
.vine-leaf.active .vine-label {
    opacity: 1;
}

/* Adjust vine-leaf transforms for active state with their base translate */
.vine-leaf[data-target="canopy"] { transform-origin: 20px 10px; }
.vine-leaf[data-target="root-map"] { transform-origin: 20px 200px; }
.vine-leaf[data-target="street-level"] { transform-origin: 20px 390px; }
.vine-leaf[data-target="tidepool"] { transform-origin: 20px 580px; }

/* === Zone Base === */
.zone {
    position: relative;
    width: 100%;
    contain: content;
}

/* === ZONE 1: THE CANOPY === */
.zone-canopy {
    min-height: 150vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #EDF2F4 0%, #81B29A 40%, #4ECDC4 100%);
    overflow: hidden;
}

.skyline-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 1;
}

.skyline {
    position: absolute;
    bottom: 0;
    height: 60%;
    width: 50%;
    opacity: 0.25;
    transition: transform 1.2s ease-out;
}

.skyline-left {
    left: 0;
}

.skyline-right {
    right: 0;
}

/* Skyline split on scroll */
.skyline-left.split {
    transform: translateX(-30%);
    opacity: 0.1;
}

.skyline-right.split {
    transform: translateX(30%);
    opacity: 0.1;
}

.canopy-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2rem;
    max-width: 700px;
}

.canopy-border-frame {
    position: absolute;
    top: -30px;
    left: -40px;
    right: -40px;
    bottom: -30px;
    pointer-events: none;
}

.canopy-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.1;
    margin-bottom: 0.5rem;
    color: #2B2D42;
}

.canopy-title .dot {
    color: #4ECDC4;
}

.canopy-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: #2B2D42;
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

.canopy-annotation {
    font-size: 16px;
    margin-top: 0.5rem;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 6vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.7;
}

.scroll-arrow {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* === Border Animation System === */
.border-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.border-rect {
    fill: none;
    stroke: #4ECDC4;
    stroke-width: 1.5;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    will-change: stroke-dashoffset;
    transition: stroke 0.5s ease;
}

.border-animate.animated .border-rect {
    stroke-dashoffset: 0;
    animation: drawBorder 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.border-animate.settled .border-rect {
    stroke: #8D99AE;
    stroke-dashoffset: 0;
}

.border-inner .border-rect {
    stroke-width: 1;
    opacity: 0.6;
}

.border-sharp {
    rx: 0;
    ry: 0;
}

.border-wavy {
    stroke-width: 1.5;
}

@keyframes drawBorder {
    from { stroke-dashoffset: 2000; }
    to { stroke-dashoffset: 0; }
}

/* === ZONE 2: THE ROOT MAP === */
.zone-root-map {
    min-height: 250vh;
    position: relative;
    background: linear-gradient(180deg, #4ECDC4 0%, #EDF2F4 8%, #EDF2F4 92%, #D5C9B1 100%);
    padding: 8vh 5vw;
}

.zone-title-container {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 5;
}

.zone-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    margin-bottom: 0.5rem;
}

.zone-annotation {
    font-size: 16px;
}

/* Root network SVG */
.root-network {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
}

.root-line {
    fill: none;
    stroke: #8D99AE;
    stroke-width: 1.2;
    stroke-linecap: round;
}

.root-trunk {
    stroke-width: 2;
    stroke: #2B2D42;
    opacity: 0.4;
}

.root-branch {
    stroke-width: 1;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.root-branch.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.root-sub {
    stroke-width: 0.6;
    stroke: #81B29A;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.root-sub.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
}

/* Root map cards */
.root-card {
    position: absolute;
    width: min(380px, 80vw);
    padding: 2rem 2rem 1.5rem;
    background: rgba(237, 242, 244, 0.85);
    z-index: 5;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.card-left {
    left: 8%;
}

.card-right {
    right: 8%;
}

.card-border-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.card-annotation {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 14px;
}

.card-title {
    margin-bottom: 0.75rem;
    color: #2B2D42;
}

.card-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #2B2D42;
    opacity: 0.9;
}

/* Fern illustration */
.fern-illustration {
    position: absolute;
    right: 3%;
    top: 10%;
    width: 80px;
    height: 60%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.35;
}

/* Plant grow animations */
.grow-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    will-change: stroke-dashoffset;
}

.plant-grow.growing .grow-path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.plant-grow.growing .grow-path:nth-child(2) { transition-delay: 0.3s; }
.plant-grow.growing .grow-path:nth-child(3) { transition-delay: 0.6s; }
.plant-grow.growing .grow-path:nth-child(4) { transition-delay: 0.9s; }
.plant-grow.growing .grow-path:nth-child(5) { transition-delay: 1.2s; }
.plant-grow.growing .grow-path:nth-child(6) { transition-delay: 1.5s; }
.plant-grow.growing .grow-path:nth-child(7) { transition-delay: 1.8s; }
.plant-grow.growing .grow-path:nth-child(8) { transition-delay: 2.1s; }
.plant-grow.growing .grow-path:nth-child(9) { transition-delay: 2.4s; }
.plant-grow.growing .grow-path:nth-child(10) { transition-delay: 2.7s; }
.plant-grow.growing .grow-path:nth-child(11) { transition-delay: 3.0s; }
.plant-grow.growing .grow-path:nth-child(12) { transition-delay: 3.3s; }
.plant-grow.growing .grow-path:nth-child(13) { transition-delay: 3.6s; }

/* === ZONE 3: STREET LEVEL === */
.zone-street {
    min-height: 200vh;
    position: relative;
    background: radial-gradient(ellipse at center bottom, #D5C9B1 0%, #2B2D42 100%);
    padding: 8vh 5vw 4vh;
}

.zone-street .zone-title {
    color: #EDF2F4;
}

.zone-street .zone-annotation {
    color: #8D99AE;
}

.street-columns-container {
    display: flex;
    gap: 3vw;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    z-index: 5;
    padding-top: 4vh;
    flex-wrap: wrap;
}

.street-column {
    position: relative;
    flex: 1 1 280px;
    max-width: 360px;
    min-height: 500px;
    padding: 2.5rem 2rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.street-column.visible {
    opacity: 1;
    transform: translateY(0);
}

.column-border-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.column-title {
    color: #EDF2F4;
    margin-bottom: 1rem;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

.column-body {
    color: #EDF2F4;
    font-size: 0.9rem;
    line-height: 1.75;
    opacity: 0.88;
    margin-bottom: 1rem;
}

.column-annotation {
    color: #81B29A;
    display: block;
    margin-top: 0.5rem;
}

.column-ivy {
    position: absolute;
    top: 0;
    left: -15px;
    width: 30px;
    height: 100%;
    pointer-events: none;
    opacity: 0.5;
}

.street-column:nth-child(2) .column-ivy {
    left: auto;
    right: -15px;
}

.street-column:nth-child(3) .column-ivy {
    left: -15px;
}

/* Root divider */
.root-divider {
    position: relative;
    z-index: 5;
    width: 80%;
    margin: 6vh auto 0;
    opacity: 0.4;
}

.divider-svg {
    width: 100%;
    height: 40px;
}

/* === ZONE 4: THE TIDEPOOL === */
.zone-tidepool {
    min-height: 150vh;
    position: relative;
    background: radial-gradient(ellipse at center, #4ECDC4 0%, #1A1A2E 70%);
    padding: 8vh 5vw 4vh;
    overflow: hidden;
}

.zone-tidepool .zone-title {
    color: #EDF2F4;
}

.zone-tidepool .zone-annotation {
    color: #81B29A;
}

.tidepool-container {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 4vh;
}

.tidepool-center {
    display: flex;
    justify-content: center;
    margin-bottom: 6vh;
}

.tidepool-card {
    position: relative;
    padding: 2.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.tidepool-card-main {
    max-width: 600px;
    text-align: center;
}

.tidepool-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tidepool-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #EDF2F4;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.tidepool-body {
    color: #EDF2F4;
    font-size: 0.95rem;
    line-height: 1.7;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.tidepool-satellites {
    display: flex;
    gap: 3vw;
    justify-content: center;
    flex-wrap: wrap;
}

.tidepool-card-small {
    max-width: 260px;
    text-align: center;
    padding: 1.5rem;
}

.tidepool-small-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    color: #4ECDC4;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.tidepool-small-body {
    color: #EDF2F4;
    font-size: 0.85rem;
    line-height: 1.65;
    opacity: 0.85;
}

/* Tidepool decorations */
.tidepool-decoration {
    position: absolute;
    bottom: 10%;
    width: 80px;
    height: 300px;
    pointer-events: none;
    opacity: 0.4;
}

.tidepool-seaweed-left {
    left: 5%;
}

.tidepool-seaweed-right {
    right: 5%;
}

/* Bioluminescent pulse for tidepool borders */
.zone-tidepool .border-animate.animated .border-rect {
    animation: drawBorder 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.zone-tidepool .border-animate.settled .border-rect {
    stroke: #4ECDC4;
    opacity: 0.6;
    animation: bioluminPulse 4s ease-in-out infinite;
}

@keyframes bioluminPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Tidepool closing */
.tidepool-closing {
    max-width: 700px;
    margin: 8vh auto 0;
    text-align: center;
    position: relative;
    z-index: 5;
}

.closing-text {
    font-family: 'Libre Baskerville', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #EDF2F4;
    opacity: 0.85;
    margin-bottom: 1.5rem;
}

.closing-annotation {
    color: #81B29A;
    font-size: 16px;
}

/* === Footer === */
.zone-footer {
    background-color: #1A1A2E;
    padding: 4vh 5vw;
    text-align: center;
}

.footer-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #EDF2F4;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}

.footer-sub {
    color: #8D99AE;
    font-size: 14px;
}

/* === Hover states with Coral Blush === */
.root-card:hover .card-title,
.street-column:hover .column-title {
    color: #E07A5F;
    transition: color 0.3s ease;
}

.tidepool-card-small:hover .tidepool-small-title {
    color: #E07A5F;
    transition: color 0.3s ease;
}

.vine-leaf:hover path {
    fill: #E07A5F;
}

/* === Leaf bullet points === */
.root-card ul,
.street-column ul {
    list-style: none;
    padding-left: 1.2rem;
}

.root-card ul li::before,
.street-column ul li::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 0.5rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5,0 C7,2 8,5 5,8 C3,5 2,2 5,0Z' fill='%2381B29A'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    vertical-align: middle;
}

/* === Responsive (below 768px) === */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    #vine-nav {
        width: 50px;
    }

    .vine-label {
        display: none;
    }

    .skyline {
        opacity: 0.15;
    }

    .canopy-border-frame {
        left: -20px;
        right: -20px;
        top: -20px;
        bottom: -20px;
    }

    /* Root map: linearize to single column */
    .root-card {
        position: relative;
        left: auto !important;
        right: auto !important;
        width: 90vw;
        margin: 2rem auto;
        top: auto !important;
    }

    .zone-root-map {
        min-height: auto;
        padding: 6vh 4vw;
    }

    .root-network {
        display: none;
    }

    .fern-illustration {
        display: none;
    }

    /* Street columns: stack */
    .street-columns-container {
        flex-direction: column;
        align-items: center;
    }

    .street-column {
        max-width: 90vw;
        min-height: auto;
    }

    .column-ivy {
        display: none;
    }

    /* Tidepool satellites: stack */
    .tidepool-satellites {
        flex-direction: column;
        align-items: center;
    }

    .tidepool-decoration {
        display: none;
    }
}

/* === Transitions for zone backgrounds === */
.zone-canopy,
.zone-root-map,
.zone-street,
.zone-tidepool {
    transition: background 0.5s ease;
}
