/* ========================================
   haru.club - Botanical Nocturnal Herbarium
   ======================================== */

:root {
    --midnight-pond: #0B1626;
    --twilight-glass: #162338;
    --glacier-blue: #A8C4D8;
    --frost-white: #E8EFF5;
    --misted-silver: #8B9DB5;
    --pressed-rose: #C4707A;
    --phantom-indigo: #4A5E8C;
    --moonlit-pollen: #D4C97A;
    --deep-shift: #1A2D4A;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    background: linear-gradient(175deg, var(--midnight-pond) 0%, var(--twilight-glass) 40%, var(--deep-shift) 70%, var(--midnight-pond) 100%);
    color: var(--frost-white);
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Bokeh Background System --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 15% 12%, rgba(168, 196, 216, 0.07) 0%, transparent 70%),
        radial-gradient(circle at 72% 8%, rgba(168, 196, 216, 0.05) 0%, transparent 65%),
        radial-gradient(circle at 85% 25%, rgba(196, 112, 122, 0.04) 0%, transparent 70%),
        radial-gradient(circle at 8% 40%, rgba(168, 196, 216, 0.06) 0%, transparent 60%),
        radial-gradient(circle at 45% 30%, rgba(212, 201, 122, 0.03) 0%, transparent 70%),
        radial-gradient(circle at 65% 55%, rgba(168, 196, 216, 0.07) 0%, transparent 65%),
        radial-gradient(circle at 25% 65%, rgba(196, 112, 122, 0.04) 0%, transparent 70%),
        radial-gradient(circle at 90% 60%, rgba(168, 196, 216, 0.05) 0%, transparent 60%),
        radial-gradient(circle at 40% 80%, rgba(168, 196, 216, 0.06) 0%, transparent 70%),
        radial-gradient(circle at 75% 85%, rgba(212, 201, 122, 0.03) 0%, transparent 65%),
        radial-gradient(circle at 10% 90%, rgba(168, 196, 216, 0.05) 0%, transparent 70%),
        radial-gradient(circle at 55% 95%, rgba(196, 112, 122, 0.04) 0%, transparent 60%);
    background-size:
        25vw 25vw,
        18vw 18vw,
        15vw 15vw,
        20vw 20vw,
        12vw 12vw,
        22vw 22vw,
        14vw 14vw,
        16vw 16vw,
        19vw 19vw,
        10vw 10vw,
        21vw 21vw,
        8vw 8vw;
    will-change: transform;
}

/* --- Rain Texture --- */
.rain-texture {
    position: fixed;
    top: -50%;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    background: repeating-linear-gradient(
        85deg,
        transparent 0px,
        transparent 3px,
        rgba(168, 196, 216, 0.03) 3px,
        rgba(168, 196, 216, 0.03) 3.5px
    );
    animation: rainFadeIn 2s ease 0.5s forwards, rain 8s linear 2.5s infinite;
}

@keyframes rainFadeIn {
    to { opacity: 1; }
}

@keyframes rain {
    0% { transform: translateY(0); }
    100% { transform: translateY(25%); }
}

/* --- Grid-Line Ornament --- */
.grid-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(168, 196, 216, 0.06) 0px,
            rgba(168, 196, 216, 0.06) 1px,
            transparent 1px,
            transparent calc(100% / 12)
        ),
        repeating-linear-gradient(
            0deg,
            rgba(168, 196, 216, 0.04) 0px,
            rgba(168, 196, 216, 0.04) 1px,
            transparent 1px,
            transparent 80px
        );
}

.grid-node {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--glacier-blue);
    opacity: 0.3;
    animation: nodePulse 4s ease-in-out infinite alternate;
}

.grid-node:nth-child(2) { animation-delay: 0.5s; }
.grid-node:nth-child(3) { animation-delay: 1.0s; }
.grid-node:nth-child(4) { animation-delay: 1.5s; }
.grid-node:nth-child(5) { animation-delay: 2.0s; }
.grid-node:nth-child(6) { animation-delay: 0.3s; }
.grid-node:nth-child(7) { animation-delay: 0.8s; }
.grid-node:nth-child(8) { animation-delay: 1.3s; }
.grid-node:nth-child(9) { animation-delay: 1.8s; }
.grid-node:nth-child(10) { animation-delay: 2.3s; }
.grid-node:nth-child(11) { animation-delay: 0.6s; }
.grid-node:nth-child(12) { animation-delay: 1.1s; }

@keyframes nodePulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.5; }
}

/* --- Vine Navigation --- */
.vine-nav {
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 40px;
    height: 400px;
}

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

.vine-stem {
    stroke-dasharray: 700;
    stroke-dashoffset: 700;
    opacity: 0.5;
    transition: stroke-dashoffset 0.1s linear;
}

.vine-leaf {
    opacity: 0.4;
    transform-origin: center;
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease;
    cursor: pointer;
}

.vine-leaf.active {
    transform: scale(1);
    opacity: 0.8;
}

.vine-leaf:hover {
    fill: var(--pressed-rose);
    filter: drop-shadow(0 0 6px rgba(196, 112, 122, 0.4));
}

/* --- Typography --- */
h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    letter-spacing: 0.15em;
    line-height: 1.15;
    color: var(--frost-white);
}

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: var(--frost-white);
    margin-bottom: 0.75rem;
}

p {
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.015em;
    margin-bottom: 1.5rem;
    color: var(--frost-white);
}

/* --- Scene: Header --- */
.scene-header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.header-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.char {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    animation: charReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.char:nth-child(1) { animation-delay: 2.0s; }
.char:nth-child(2) { animation-delay: 2.08s; }
.char:nth-child(3) { animation-delay: 2.16s; }
.char:nth-child(4) { animation-delay: 2.24s; }
.char:nth-child(5) { animation-delay: 2.32s; }
.char:nth-child(6) { animation-delay: 2.40s; }
.char:nth-child(7) { animation-delay: 2.48s; }
.char:nth-child(8) { animation-delay: 2.56s; }
.char:nth-child(9) { animation-delay: 2.64s; }

.char.dot {
    color: var(--pressed-rose);
}

@keyframes charReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--misted-silver);
    letter-spacing: 0.2em;
    opacity: 0;
    animation: fadeIn 0.8s ease 3.4s forwards;
    margin-top: 1rem;
}

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

.scroll-chevron {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: chevronPulse 3s ease-in-out 4s infinite, fadeIn 1s ease 4s forwards;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* --- Specimen Grid --- */
.scene-specimens,
.scene-deep {
    position: relative;
    z-index: 2;
    padding: 4rem clamp(2rem, 6vw, 6rem);
}

.specimen-grid {
    display: grid;
    grid-template-columns: 38fr 32fr 30fr;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    max-width: 1440px;
    margin: 0 auto;
}

/* --- Specimen Cards --- */
.specimen-card {
    background: rgba(22, 35, 56, 0.65);
    backdrop-filter: blur(8px) saturate(1.2);
    border: 1px solid rgba(168, 196, 216, 0.2);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    min-height: 280px;
    position: relative;
    overflow: hidden;
    transition: border-color 500ms ease, background 500ms ease;
}

.specimen-card.awakened {
    border-color: rgba(168, 196, 216, 0.5);
}

.specimen-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--pressed-rose);
    opacity: 0;
    transition: opacity 300ms ease;
}

.specimen-card:hover::before {
    opacity: 1;
}

.specimen-card:hover {
    background: rgba(22, 35, 56, 0.8);
}

.card-wide {
    grid-column: span 2;
}

/* --- Botanical Silhouette --- */
.specimen-silhouette {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    opacity: 0.15;
    transition: opacity 600ms cubic-bezier(0.22, 1, 0.36, 1), transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

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

.specimen-card.awakened .specimen-silhouette {
    opacity: 0.4;
    animation: pressingAnim 600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes pressingAnim {
    0% { transform: translate(-50%, -50%) scaleY(0.6); }
    100% { transform: translate(-50%, -50%) scaleY(1); }
}

/* --- Specimen Content --- */
.specimen-content {
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 400ms ease;
}

.specimen-card.awakened .specimen-content {
    opacity: 1;
}

.specimen-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--glacier-blue);
    display: block;
    margin-bottom: 1rem;
    overflow: hidden;
}

.specimen-label.typing {
    width: 0;
    white-space: nowrap;
    animation: typeLabel 0.8s steps(30, end) forwards;
}

@keyframes typeLabel {
    to { width: 100%; }
}

.specimen-content h2 {
    color: var(--frost-white);
}

.specimen-content p {
    color: var(--misted-silver);
    font-style: italic;
}

/* --- Coda Zone --- */
.scene-coda {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    padding: 4rem 2rem;
}

.coda-content {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease, transform 800ms ease;
}

.coda-content.awakened {
    opacity: 1;
    transform: translateY(0);
}

.coda-haiku {
    margin-bottom: 3rem;
}

.haiku-line {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--frost-white);
    letter-spacing: 0.08em;
    line-height: 2;
    margin-bottom: 0;
}

.coda-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.coda-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--glacier-blue);
    opacity: 0.5;
}

.coda-copy {
    font-family: 'Source Serif 4', serif;
    font-size: 0.85rem;
    color: var(--misted-silver);
    opacity: 0.4;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .char {
        opacity: 1;
        transform: none;
    }

    .site-subtitle,
    .scroll-chevron {
        opacity: 1;
    }

    .rain-texture {
        opacity: 1;
        animation: none;
    }

    .specimen-content {
        opacity: 1;
    }

    .specimen-silhouette {
        opacity: 0.4;
    }

    .coda-content {
        opacity: 1;
        transform: none;
    }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .specimen-grid {
        grid-template-columns: 1fr 1fr;
    }

    .card-wide {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .specimen-grid {
        grid-template-columns: 1fr;
    }

    .card-wide {
        grid-column: span 1;
    }

    .vine-nav {
        display: none;
    }

    .grid-lines {
        display: none;
    }
}
