/* pzz.lu - The Forbidden Herbarium */
/* Swiss masonry + candy-bright botanical insurgency */

:root {
    /* Foundation */
    --swiss-bone: #f7f3ee;
    --ink-black: #1a1a1a;
    
    /* Candy palette */
    --hot-petunia: #ff6b9d;
    --electric-lemon: #ffd93d;
    --fizz-green: #6bcb77;
    --pixel-blue: #4d96ff;
    --grape-fizz: #a855f7;
    
    /* Structural */
    --blush-rule: #f5a3c7;
    --slate: #555555;
    --fog: #bbbbbb;
    --ghost: #888888;
    --muted: #999999;
    
    /* Dynamic */
    --candy-intensity: 1;
    --bg-color: var(--swiss-bone);
    --text-color: var(--ink-black);
    --grid-opacity: 0.3;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    transition: background-color 0.8s ease, color 0.8s ease;
    overflow-x: hidden;
}

body.inverted {
    --bg-color: #1a1a1a;
    --text-color: #f7f3ee;
    --grid-opacity: 0.15;
}

/* Grid Overlay */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.grid-overlay.visible {
    opacity: 1;
}

.grid-overlay .grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--blush-rule);
    opacity: var(--grid-opacity);
    transition: transform 0.6s ease, opacity 0.8s ease;
}

.grid-overlay .registration-mark {
    position: absolute;
    width: 6px;
    height: 6px;
    color: var(--fog);
    font-size: 6px;
    line-height: 6px;
    pointer-events: none;
}

/* Herbarium Main Container */
.herbarium {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    scroll-snap-type: y proximity;
}

/* Chapter Rules */
.chapter-rule {
    grid-column: 1 / -1;
    border-top: 2px solid var(--ink-black);
    padding-top: 8px;
    margin: 24px 0;
    scroll-snap-align: start;
    transition: border-color 0.8s ease;
}

body.inverted .chapter-rule {
    border-color: var(--swiss-bone);
}

.chapter-label {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-variant: small-caps;
    color: var(--fog);
}

/* Masonry Blocks */
.masonry-block {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 1.34),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 1.34);
}

.masonry-block.visible {
    opacity: 1;
    transform: translateY(0) translateX(0) rotate(0deg);
}

.masonry-block[data-entry-dir="left"] {
    transform: translateX(-60px);
}

.masonry-block[data-entry-dir="right"] {
    transform: translateX(60px);
}

.masonry-block[data-entry-dir="top"] {
    transform: translateY(-60px);
}

.masonry-block[data-entry-dir="bottom"] {
    transform: translateY(60px);
}

/* Block Spans */
.block-span-1 { grid-column: span 1; }
.block-span-2 { grid-column: span 2; }
.block-span-3 { grid-column: span 3; }
.block-span-4 { grid-column: span 4; }
.block-span-5 { grid-column: span 5; }
.block-span-6 { grid-column: span 6; }

.row-span-1 { min-height: 120px; }
.row-span-2 { min-height: 240px; }
.row-span-3 { min-height: 360px; }
.row-span-4 { min-height: 480px; }

/* Specimen Plates */
.specimen-plate {
    border: 1px solid var(--ink-black);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.8s ease;
}

body.inverted .specimen-plate {
    border-color: var(--swiss-bone);
}

.specimen-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
}

.domain-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7.5rem);
    letter-spacing: -0.04em;
    color: var(--text-color);
    line-height: 1;
    margin-bottom: 16px;
    transition: color 0.8s ease;
}

.specimen-label {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--slate);
    margin-top: auto;
    padding-top: 12px;
    text-align: center;
    transition: color 0.8s ease;
}

body.inverted .specimen-label {
    color: var(--ghost);
}

/* Botanical SVGs */
.botanical-svg {
    width: 100%;
    max-height: 400px;
    flex: 1;
}

.botanical-svg .fill-layer {
    opacity: 0;
    transition: opacity 0.4s ease 2s;
}

.botanical-svg.revealed .fill-layer {
    opacity: 1;
}

.botanical-svg .draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.botanical-svg.revealed .draw-path {
    stroke-dashoffset: 0;
}

/* Text Bricks */
.text-brick {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.text-brick p {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    color: var(--ink-black);
    text-align: justify;
    hyphens: auto;
}

.text-brick .annotation {
    font-style: italic;
    font-size: 0.85rem;
    color: var(--slate);
}

/* Candy Colors */
.candy-petunia {
    background-color: var(--hot-petunia);
}

.candy-lemon {
    background-color: var(--electric-lemon);
}

.candy-green {
    background-color: var(--fizz-green);
}

.candy-blue {
    background-color: var(--pixel-blue);
}

.candy-grape {
    background-color: var(--grape-fizz);
}

/* Void Cells */
.void-cell {
    background: transparent;
    pointer-events: none;
}

/* Ornament Cells */
.ornament-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ornament {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 1.6rem;
    color: var(--ghost);
    transition: color 0.8s ease;
}

body.inverted .ornament {
    color: var(--fog);
}

/* Double-rule borders on select blocks */
.text-brick:nth-child(5n+3) {
    box-shadow: inset 0 0 0 1px var(--ink-black), inset 0 0 0 4px transparent, inset 0 0 0 5px var(--ink-black);
}

/* Colophon */
.colophon {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px 40px;
    border-top: 1px solid var(--ghost);
}

.colophon-text {
    font-family: 'EB Garamond', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--muted);
    transition: color 0.8s ease;
}

body.inverted .colophon-text {
    color: var(--ghost);
}

body.inverted .colophon {
    border-color: var(--slate);
}

/* Dandelion seed animation */
.seed.floating {
    animation: seedFloat var(--seed-duration, 6s) ease-out var(--seed-delay, 0s) forwards;
}

@keyframes seedFloat {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--seed-drift-x, 20px), -600px);
        opacity: 0;
    }
}

/* Grid dissolution effect */
.dissolving.dissolved {
    transition: transform 1s ease;
}

/* Inverted mode SVG adjustments */
body.inverted .linework-layer {
    stroke: var(--swiss-bone);
}

body.inverted .shadow-layer path,
body.inverted .shadow-layer circle {
    stroke: var(--swiss-bone);
}

body.inverted .dandelion-seeds .seed line,
body.inverted .dandelion-seeds .seed circle {
    stroke: var(--swiss-bone);
    fill: var(--swiss-bone);
}

body.inverted .dandelion-seeds .highlighted-seed line,
body.inverted .dandelion-seeds .highlighted-seed circle {
    stroke: var(--electric-lemon);
    fill: var(--electric-lemon);
}

body.inverted .fill-layer circle[fill="#1a1a1a"] {
    fill: var(--swiss-bone);
}

/* Responsive */
@media (max-width: 1024px) {
    .herbarium {
        grid-template-columns: repeat(6, 1fr);
        padding: 24px 16px;
    }
    
    .block-span-4 { grid-column: span 3; }
    .block-span-5 { grid-column: span 4; }
    .block-span-6 { grid-column: span 6; }
}

@media (max-width: 640px) {
    .herbarium {
        grid-template-columns: repeat(3, 1fr);
        padding: 16px 12px;
    }
    
    .block-span-2,
    .block-span-3,
    .block-span-4,
    .block-span-5,
    .block-span-6 {
        grid-column: span 3;
    }
    
    .block-span-1 { grid-column: span 1; }
    
    .void-cell { display: none; }
    
    .domain-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
    
    .row-span-3 { min-height: 280px; }
    .row-span-4 { min-height: 350px; }
}

/* Section header styles */
.text-brick h2 {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* Navigation hover effect (for ornaments and labels) */
.specimen-label:hover {
    color: var(--hot-petunia);
    transition: color 0.3s ease;
}

/* Print registration marks at grid intersections */
.grid-overlay .cross-mark {
    position: absolute;
    width: 6px;
    height: 6px;
    opacity: 0.4;
}

.grid-overlay .cross-mark::before,
.grid-overlay .cross-mark::after {
    content: '';
    position: absolute;
    background: var(--fog);
}

.grid-overlay .cross-mark::before {
    width: 6px;
    height: 1px;
    top: 2.5px;
    left: 0;
}

.grid-overlay .cross-mark::after {
    width: 1px;
    height: 6px;
    top: 0;
    left: 2.5px;
}
