/* ==========================================================
   prototypic.dev — Botanical Rationalism
   Swiss grid + candy-bright palette + leaf-organic motifs
   ========================================================== */

/* --- Color Reference (DESIGN.md palette) ---
   #FAFAFA  - Background Primary (Snow White)
   #1A1A3E  - Background Alternate (Deep Indigo)
   #2A2A3E  - Text Primary on light (Midnight Ink)
   #F5F0FA  - Text Primary on dark (Lavender Mist)
   #FF2D7B  - Accent 1 Hot Magenta (Candy Pink)
   #00E89C  - Accent 2 Electric Mint (Spearmint)
   #FFE020  - Accent 3 Acid Yellow (Lemon Drop)
   #6C7BFF  - Accent 4 Sky Periwinkle (Bubblegum Blue)
   #FF8A3D  - Accent 5 Tangerine (Creamsicle)
   #E8E8F0  - Grid Lines (Light Gray)
   #EDEDF5  - Skeleton Base (Soft Lavender)
   #F8F8FF  - Skeleton Shimmer (White Frost)
   #00E89C  - Leaf Fill Primary (Spearmint)
   #A8FF3E  - Leaf Fill Secondary (Lime Burst)
   #008B5E  - Leaf Vein (Dark Green)
   #F0F0F0  - Grid rule tint
   #FFFFFF  - Nav background
   #E0E0E0  - Nav border
*/

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

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #2A2A3E;
    background: #FAFAFA;
    overflow-x: hidden;
    line-height: 1.65;
}

/* --- Typography --- */
.headline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7.5rem);
    letter-spacing: -0.03em;
    line-height: 0.92;
    text-transform: uppercase;
}

.panel-light .headline {
    color: #2A2A3E;
}

.panel-dark .headline {
    color: #F5F0FA;
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.125rem);
    line-height: 1.65;
    max-width: 38em;
}

.panel-light .body-text {
    color: #2A2A3E;
}

.panel-dark .body-text {
    color: #F5F0FA;
}

.mono-tag {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    opacity: 0.6;
    display: block;
    margin-top: 1.5rem;
}

.panel-light .mono-tag {
    color: #2A2A3E;
}

.panel-dark .mono-tag {
    color: #F5F0FA;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
    height: 56px;
    background: rgba(255, 255, 255, 0.92); /* #FFFFFF at 0.92 opacity */
    border-bottom: 1px solid #E0E0E0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-domain {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2A2A3E;
}

.nav-links {
    display: flex;
    gap: 48px;
}

.nav-links a {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: #2A2A3E;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #FF2D7B;
}

/* --- Leaf & Grid CSS Variables --- */
:root {
    --leaf-primary: #00E89C;
    --leaf-secondary: #A8FF3E;
    --leaf-vein: #008B5E;
    --grid-rule-tint: #F0F0F0;
    --white: #FFFFFF;
}

/* --- Parallax Grid Layer --- */
#grid-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200vh;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    background: linear-gradient(to bottom, var(--grid-rule-tint) 0%, transparent 1%);
}

.grid-columns {
    display: flex;
    justify-content: space-between;
    height: 100%;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
    gap: 24px;
}

.grid-col {
    flex: 1;
    border-right: 1px solid #E8E8F0;
    opacity: 0.15;
}

.grid-col:last-child {
    border-right: none;
}

/* Grid dots at intersections */
.grid-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* --- Leaf Parallax Layer --- */
#leaf-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
}

/* --- Content Layer --- */
#content-layer {
    position: relative;
    z-index: 2;
    padding-top: 56px; /* nav height */
}

/* --- Section Panels --- */
.panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.panel-light {
    background: #FAFAFA;
}

.panel-dark {
    background: #1A1A3E;
}

.panel-inner {
    display: grid;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem clamp(1.5rem, 4vw, 3rem);
    gap: 2rem;
    align-items: center;
}

/* Type-dominant: 8/4 column split */
.type-dominant .panel-inner {
    grid-template-columns: 2fr 1fr;
}

/* Split-reveal: 7/5 column split (reversed) */
.split-reveal .panel-inner {
    grid-template-columns: 5fr 7fr;
}

.col-text {
    position: relative;
    z-index: 2;
}

.col-leaves {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.col-skeleton {
    position: relative;
}

/* --- Leaf SVGs --- */
.leaf {
    opacity: 0;
    transform: scale(0) rotate(-15deg);
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.leaf.grown {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    animation: leafSway 3s ease-in-out infinite alternate;
}

.leaf-monstera {
    width: clamp(120px, 15vw, 200px);
}

.leaf-monstera.leaf-large {
    width: clamp(160px, 20vw, 240px);
}

.leaf-fern {
    width: clamp(60px, 8vw, 100px);
}

.leaf-ginkgo {
    width: clamp(120px, 14vw, 180px);
}

.leaf-ginkgo-small {
    width: clamp(60px, 8vw, 100px);
}

.leaf-palm {
    width: clamp(100px, 12vw, 160px);
}

.leaf-eucalyptus {
    width: clamp(50px, 6vw, 80px);
}

.leaf-fiddle {
    width: clamp(70px, 9vw, 120px);
}

.inline-leaf {
    position: absolute;
    bottom: -2rem;
    right: -2rem;
}

@keyframes leafSway {
    0% { transform: scale(1) rotate(-3deg); }
    100% { transform: scale(1) rotate(3deg); }
}

/* Stagger leaf growth */
.col-leaves .leaf:nth-child(1) { transition-delay: 0.3s; }
.col-leaves .leaf:nth-child(2) { transition-delay: 0.6s; }
.col-text .inline-leaf { transition-delay: 0.9s; }

/* --- Lens Flares --- */
.lens-flare {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--flare-color) 0%, transparent 70%);
    mix-blend-mode: screen;
    opacity: 0;
    pointer-events: none;
    animation: flarePulse 4s ease-in-out infinite alternate;
    top: 30%;
    right: 10%;
}

.lens-flare-2 {
    width: 70px;
    height: 70px;
    top: 60%;
    right: 25%;
    animation-delay: 1.5s;
}

.panel.revealed .lens-flare {
    opacity: 0.12;
}

@keyframes flarePulse {
    0% { opacity: 0.08; transform: scale(0.9); }
    100% { opacity: 0.2; transform: scale(1.1); }
}

/* Glow effect on dark panels */
.panel-dark .headline {
    text-shadow: 0 0 30px rgba(255, 45, 123, 0.15);
}

.panel-dark .col-leaves .leaf {
    filter: drop-shadow(0 0 20px rgba(0, 232, 156, 0.2));
}

/* --- Skeleton Loading --- */
.skeleton-block {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: opacity 0.6s ease;
}

.panel-light .skeleton-block {
    background: #EDEDF5;
}

.panel-dark .skeleton-block {
    background: rgba(237, 237, 245, 0.1);
}

.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #F8F8FF 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.panel-dark .skeleton-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(248, 248, 255, 0.08) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-headline {
    width: 80%;
    height: clamp(3rem, 8vw, 7.5rem);
    margin-bottom: 1.5rem;
}

.skeleton-body {
    width: 90%;
    height: 4.5rem;
    margin-bottom: 1rem;
}

/* Skeleton card shapes */
.skeleton-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    transition: opacity 0.6s ease;
}

.skeleton-rect-lg {
    width: 100%;
    height: 120px;
}

.skeleton-rect-sm {
    width: 80%;
    height: 24px;
}

.skeleton-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
}

/* Revealed state: hide skeletons, show content */
.panel.revealed .skeleton-block {
    opacity: 0;
    pointer-events: none;
}

.reveal-content {
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.panel.revealed .reveal-content {
    opacity: 1;
    transform: scale(1);
}

/* Stagger reveal content */
.panel.revealed .reveal-content:nth-child(2) { transition-delay: 0s; }
.panel.revealed .reveal-content:nth-child(4) { transition-delay: 0.1s; }
.panel.revealed .reveal-content:nth-child(5) { transition-delay: 0.2s; }

/* Reveal card */
.reveal-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 0.5s ease-out 0.2s, transform 0.5s ease-out 0.2s;
}

.panel.revealed .skeleton-card {
    opacity: 0;
}

.panel.revealed .reveal-card {
    opacity: 1;
    transform: scale(1);
}

.card-bar {
    height: 24px;
    border-radius: 6px;
    width: 100%;
}

.card-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
}

/* --- Breathing Zones --- */
.breathing-zone {
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
}

.divider-leaves {
    display: flex;
    gap: 3rem;
    align-items: center;
    justify-content: center;
}

.divider-leaf {
    width: 40px;
    height: 50px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.divider-leaf.visible {
    opacity: 1;
    transform: translateY(0);
}

.divider-leaf:nth-child(2) { transition-delay: 0.15s; }
.divider-leaf:nth-child(3) { transition-delay: 0.3s; }

/* Final zone */
.breathing-zone-final {
    height: 40vh;
    flex-direction: column;
    gap: 1rem;
}

.final-tag .mono-tag {
    font-size: 1rem;
    opacity: 0.4;
    text-align: center;
    color: #2A2A3E;
}

/* --- Section Accent Colors --- */
.panel[data-accent="#FF2D7B"] .headline { color: #2A2A3E; }
.panel[data-accent="#FF2D7B"] .skeleton-headline,
.panel[data-accent="#FF2D7B"] .skeleton-body { background: #EDEDF5; }

.panel[data-accent="#00E89C"] .headline span,
.panel[data-accent="#00E89C"] .reveal-card .card-bar:first-child { background: #00E89C; }

.panel[data-accent="#FFE020"] .headline { color: #2A2A3E; }

.panel[data-accent="#6C7BFF"] .headline {
    text-shadow: 0 0 40px rgba(108, 123, 255, 0.2);
}

/* Accent underline on headlines */
.panel.revealed .headline::after {
    content: '';
    display: block;
    width: clamp(60px, 8vw, 120px);
    height: 5px;
    margin-top: 1rem;
    border-radius: 3px;
    background: var(--section-accent, #FF2D7B);
    transform: scaleX(0);
    transform-origin: left;
    animation: accentGrow 0.6s ease-out 0.3s forwards;
}

@keyframes accentGrow {
    to { transform: scaleX(1); }
}

/* Set accent color as CSS variable on each panel */
.panel[data-accent="#FF2D7B"] { --section-accent: #FF2D7B; }
.panel[data-accent="#00E89C"] { --section-accent: #00E89C; }
.panel[data-accent="#FFE020"] { --section-accent: #FFE020; }
.panel[data-accent="#6C7BFF"] { --section-accent: #6C7BFF; }
.panel[data-accent="#FF8A3D"] { --section-accent: #FF8A3D; }

/* --- Section Transitions (gradient blend zones) --- */
.panel-dark + .breathing-zone {
    background: linear-gradient(to bottom, #1A1A3E 0%, #FAFAFA 100%);
}

.panel-light + .breathing-zone {
    background: linear-gradient(to bottom, #FAFAFA 0%, #1A1A3E 100%);
}

/* Override for last breathing zones that don't precede dark */
.panel[data-index="2"] + .breathing-zone {
    background: linear-gradient(to bottom, #FAFAFA 0%, #1A1A3E 100%);
}

.panel[data-index="3"] + .breathing-zone {
    background: linear-gradient(to bottom, #1A1A3E 0%, #FAFAFA 100%);
}

.breathing-zone-final {
    background: #FAFAFA;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .type-dominant .panel-inner {
        grid-template-columns: 1fr;
    }

    .split-reveal .panel-inner {
        grid-template-columns: 1fr;
    }

    .col-leaves {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links {
        gap: 24px;
    }

    .nav-links a {
        font-size: 0.7rem;
    }

    .inline-leaf {
        position: relative;
        bottom: auto;
        right: auto;
    }

    .skeleton-headline {
        width: 100%;
    }

    .skeleton-body {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .nav-links {
        display: none;
    }

    .panel-inner {
        padding: 3rem 1.25rem;
    }

    .headline {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
}
