/* ================================================
   MMIDDL.com - Coastal Botany Under Neon Moonlight
   ================================================ */

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

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

body {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 18px;
    line-height: 1.8;
    color: #d4e4e0;
    background: linear-gradient(180deg, #0b1e1e 0%, #132e2e 30%, #1a4040 50%, #132e2e 70%, #0b1e1e 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Sections ---- */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 120px 8vw;
    overflow: hidden;
}

.section--dark {
    background-color: transparent;
}

.section--warm {
    background-color: #e8dcc8;
}

.section--deepdark {
    background-color: #0b1e1e;
}

/* Tidal Asymmetry - content alignment */
.section--left .section__content {
    max-width: 58.33%;
    margin-right: auto;
}

.section--right .section__content {
    max-width: 58.33%;
    margin-left: auto;
}

.section--center .section__content {
    max-width: 50%;
    margin: 0 auto;
    text-align: center;
}

/* ---- Typography ---- */
.section__heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(42px, 6vw, 72px);
    letter-spacing: 0.04em;
    color: #e8c8a0;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease, transform 800ms ease;
}

.section__heading--dark {
    color: #1a3a4a;
}

.section__heading--closing {
    font-size: clamp(28px, 4vw, 48px);
    color: #5bcfb5;
    max-width: 600px;
    margin: 0 auto 48px;
}

.section__text {
    color: #d4e4e0;
    margin-bottom: 32px;
    max-width: 640px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease, transform 800ms ease;
}

.section__text--dark {
    color: #2a3d3a;
}

.section__text--closing {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 32px;
    letter-spacing: 0.12em;
    color: #e8c8a0;
    opacity: 0.6;
}

/* Tidal reveal - active state */
.section__heading.revealed,
.section__text.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Opening Sequence ---- */
#opening {
    background-color: #0b1e1e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100vh;
    padding: 0;
}

.opening__darkness {
    position: absolute;
    inset: 0;
    background-color: #0b1e1e;
    z-index: 10;
    pointer-events: none;
    opacity: 1;
    transition: opacity 600ms ease;
}

.opening__darkness.faded {
    opacity: 0;
}

.opening__horizon-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #5bcfb5;
    opacity: 0.2;
    z-index: 5;
    transition: none;
}

.opening__kelp {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 40vh;
    z-index: 5;
    opacity: 0;
}

.opening__kelp.visible {
    opacity: 1;
}

.kelp-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
}

.kelp-path.animate {
    animation: drawKelp 3s ease-in-out forwards;
}

.kelp-glow-1 {
    filter: blur(8px);
    opacity: 0;
    transition: opacity 600ms ease;
}

.kelp-glow-1.active {
    opacity: 0.6;
}

.kelp-glow-2 {
    filter: blur(24px);
    opacity: 0;
    transition: opacity 600ms ease;
}

.kelp-glow-2.active {
    opacity: 0.25;
}

@keyframes drawKelp {
    to {
        stroke-dashoffset: 0;
    }
}

.opening__title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(56px, 10vw, 96px);
    letter-spacing: 0.12em;
    color: #e8c8a0;
    z-index: 5;
    opacity: 0;
    position: relative;
    margin-top: 45vh;
    transition: opacity 1500ms ease;
}

.opening__title.visible {
    opacity: 1;
}

.opening__scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 5;
    opacity: 0;
    transition: opacity 1000ms ease;
}

.opening__scroll-hint.visible {
    opacity: 0.5;
}

.scroll-hint-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5bcfb5;
}

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

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

/* ---- Botanical Drawings ---- */
.section__botanical {
    position: absolute;
    right: 5vw;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 400px;
    opacity: 0;
    transition: opacity 800ms ease;
    pointer-events: none;
}

.section--right .section__botanical {
    right: auto;
    left: 5vw;
}

.section__botanical.revealed {
    opacity: 1;
}

.botanical-drawing {
    width: 100%;
    height: 100%;
}

.botanical-line {
    opacity: 0.5;
}

.botanical-line--warm {
    opacity: 0.7;
}

/* Neon glow for botanical drawings */
.botanical-glow-group {
    filter: drop-shadow(0 0 8px rgba(91, 207, 181, 0.4)) drop-shadow(0 0 24px rgba(91, 207, 181, 0.15));
}

.botanical-glow-group--warm {
    filter: none;
}

.section__botanical--warm {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    margin: 48px auto 0;
    width: 300px;
    height: 250px;
}

/* ---- Wave Dividers ---- */
.wave-divider {
    position: relative;
    height: 60px;
    margin: 0;
    overflow: hidden;
}

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

.wave-path {
    transition: d 600ms ease;
}

/* ---- Specimen Cards ---- */
.specimen-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    margin-top: 60px;
    position: relative;
}

.specimen-cluster--1 {
    justify-content: flex-end;
    padding-right: 5vw;
}

.specimen-cluster--2 {
    justify-content: flex-start;
    padding-left: 2vw;
}

.specimen-cluster--3 {
    justify-content: flex-start;
    padding-left: 2vw;
}

.specimen-card {
    perspective: 1200px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease, transform 800ms ease;
}

.specimen-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.specimen-card--large {
    width: 380px;
    height: 480px;
}

.specimen-card--medium {
    width: 280px;
    height: 360px;
}

.specimen-card--small {
    width: 200px;
    height: 260px;
}

.specimen-card__inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 600ms ease-in-out;
}

.specimen-card.flipped .specimen-card__inner {
    transform: rotateY(180deg);
}

/* Card Front */
.specimen-card__front {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    background-color: #132e2e;
    border: 1px solid rgba(91, 207, 181, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: border-color 600ms ease, box-shadow 600ms ease;
}

.specimen-card__front--warm {
    background-color: #f0e6d0;
    border-color: rgba(212, 165, 116, 0.4);
}

.specimen-card.flipping .specimen-card__front {
    border-color: rgba(91, 207, 181, 0.8);
    box-shadow: 0 0 20px rgba(91, 207, 181, 0.3), 0 0 40px rgba(91, 207, 181, 0.1);
}

.specimen-card--warm.flipping .specimen-card__front--warm {
    border-color: rgba(212, 165, 116, 0.8);
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
}

.specimen-svg {
    flex: 1;
    width: 80%;
    max-height: 70%;
}

.specimen-card__label {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5bcfb5;
    margin-top: 16px;
}

.specimen-card__label--warm {
    color: #d4a574;
}

/* Card Back */
.specimen-card__back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    background-color: #e8dcc8;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Grain texture via pseudo-element */
}

.specimen-card__back::after {
    content: '';
    position: absolute;
    inset: 0;
    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)' opacity='0.08'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
    opacity: 0.4;
}

.specimen-card__back-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: 22px;
    color: #1a3a4a;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.specimen-card__back-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 16px;
    line-height: 1.7;
    color: #2a3d3a;
    position: relative;
    z-index: 1;
}

/* Typewriter effect: text hidden until card is flipped */
.specimen-card__back-text[data-typewriter] {
    visibility: hidden;
}

.specimen-card.flipped .specimen-card__back-text[data-typewriter] {
    visibility: visible;
}

.typewriter-char {
    opacity: 0;
    transition: opacity 0ms;
}

.typewriter-char.visible {
    opacity: 1;
}

/* ---- Dot Navigation ---- */
.dot-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 100;
}

.dot-nav__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(91, 207, 181, 0.3);
    cursor: pointer;
    position: relative;
    transition: background-color 400ms ease, box-shadow 400ms ease;
}

.dot-nav__dot.active {
    background-color: #5bcfb5;
    box-shadow: 0 0 8px rgba(91, 207, 181, 0.6), 0 0 16px rgba(91, 207, 181, 0.3);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(91, 207, 181, 0.6), 0 0 16px rgba(91, 207, 181, 0.3); }
    50% { box-shadow: 0 0 12px rgba(91, 207, 181, 0.8), 0 0 24px rgba(91, 207, 181, 0.5); }
}

.dot-nav__tooltip {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5bcfb5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease, right 300ms ease;
}

.dot-nav__dot:hover .dot-nav__tooltip {
    opacity: 1;
    right: 24px;
}

/* ---- Floating Botanical Particles ---- */
.particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    opacity: 0;
    transition: opacity 1000ms ease;
}

.particle.active {
    opacity: 1;
}

.particle--leaf {
    width: 12px;
    height: 8px;
}

.particle--seed {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.particle--petal {
    width: 10px;
    height: 14px;
}

/* ---- Closing Section ---- */
.section__content--closing {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.closing__botanical {
    width: 120px;
    height: 200px;
    margin-bottom: 48px;
    opacity: 0;
    transition: opacity 1200ms ease;
}

.closing__botanical.revealed {
    opacity: 1;
}

.botanical-drawing--closing {
    width: 100%;
    height: 100%;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .section--left .section__content,
    .section--right .section__content {
        max-width: 75%;
    }

    .section__botanical {
        display: none;
    }

    .specimen-card--large {
        width: 320px;
        height: 420px;
    }

    .specimen-card--medium {
        width: 240px;
        height: 320px;
    }

    .specimen-card--small {
        width: 180px;
        height: 240px;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 80px 6vw;
    }

    .section--left .section__content,
    .section--right .section__content,
    .section--center .section__content {
        max-width: 100%;
    }

    .specimen-cluster {
        flex-direction: column;
        align-items: center;
    }

    .specimen-card--large {
        width: 100%;
        max-width: 360px;
        height: 460px;
    }

    .specimen-card--medium {
        width: 100%;
        max-width: 280px;
        height: 360px;
    }

    .specimen-card--small {
        width: 100%;
        max-width: 220px;
        height: 280px;
    }

    .dot-nav {
        right: 12px;
        gap: 28px;
    }

    .dot-nav__tooltip {
        display: none;
    }

    .opening__title {
        letter-spacing: 0.08em;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .section__heading {
        font-size: clamp(32px, 8vw, 48px);
        margin-bottom: 32px;
    }

    .section {
        padding: 60px 5vw;
    }

    .specimen-cluster {
        gap: 16px;
    }
}

/* ---- Warm Section Transitions ---- */
.section--warm + .wave-divider {
    background: linear-gradient(180deg, #e8dcc8, transparent);
}

.wave-divider + .section--warm {
    /* handled by section bg */
}

/* ---- Neon Glow SVGs in dark sections ---- */
.section--dark .specimen-card__front svg,
.section--deepdark .specimen-card__front svg {
    filter: drop-shadow(0 0 8px rgba(91, 207, 181, 0.4)) drop-shadow(0 0 24px rgba(91, 207, 181, 0.15));
}

/* Warm card SVGs should not glow neon */
.specimen-card--warm .specimen-card__front svg {
    filter: none;
}

/* ---- Scroll-triggered glow for botanicals ---- */
.botanical-glow-group {
    opacity: 0.5;
    transition: opacity 600ms ease, filter 600ms ease;
}

.section__botanical.revealed .botanical-glow-group {
    opacity: 0.7;
}

/* ---- Wave divider animation on scroll ---- */
.wave-divider.wave-active .wave-svg {
    animation: waveDisturb 1200ms ease-out;
}

@keyframes waveDisturb {
    0% { transform: scaleY(1); }
    30% { transform: scaleY(2); }
    100% { transform: scaleY(1); }
}

/* ---- Accent Color Classes ---- */
/* Phosphor Aqua #3ae8d4 - Brighter bioluminescent flash */
.neon-accent-aqua {
    color: #3ae8d4;
}

/* Coral Neon #ff7b6b - Sea anemone under UV */
.neon-accent-coral {
    color: #ff7b6b;
}

/* Neon accent glow variants */
.specimen-card__front:hover {
    border-color: rgba(58, 232, 212, 0.4);
}

.section--deepdark .specimen-card__front:hover {
    box-shadow: 0 0 16px rgba(255, 123, 107, 0.15), 0 0 32px rgba(58, 232, 212, 0.1);
}

/* ---- Selection styling ---- */
::selection {
    background: rgba(91, 207, 181, 0.3);
    color: #d4e4e0;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(91, 207, 181, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(91, 207, 181, 0.5);
}
