:root {
    --deep-earth: #1a1612;
    --forest-floor: #2d2820;
    --moss: #7aab6f;
    --lichen: #c9e4a6;
    --aurora-violet: #9b7ecf;
    --aurora-teal: #5eb8a9;
    --aurora-rose: #d4748a;
    --parchment: #e8dcc8;
    --warm-body: #d4cab8;
    --earth-gray: #6b6358;
    --aurora: linear-gradient(135deg, #9b7ecf 0%, #5eb8a9 40%, #c9e4a6 65%, #d4748a 100%);
    --space-unit: clamp(1rem, 2vw, 1.5rem);
}

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

body {
    background: var(--deep-earth);
    color: var(--warm-body);
    font-family: 'Crimson Pro', serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 400;
    line-height: 1.72;
    overflow-x: hidden;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ===== CANOPY ===== */
.canopy {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.canopy-shapes {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.geo-shape {
    position: absolute;
    background: var(--aurora);
    background-size: 200% 200%;
}

.hex {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.diamond {
    transform: rotate(45deg);
}

.trapezoid {
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

.shape-1 { width: 180px; height: 180px; top: 10%; left: 8%; opacity: 0.35; animation: drift 22s linear infinite; }
.shape-2 { width: 80px; height: 80px; top: 25%; right: 15%; opacity: 0.5; animation: drift 18s linear infinite reverse; }
.shape-3 { width: 120px; height: 120px; bottom: 20%; left: 20%; opacity: 0.4; animation: drift 28s linear infinite; }
.shape-4 { width: 100px; height: 70px; top: 60%; right: 10%; opacity: 0.45; animation: drift 25s linear infinite reverse; }
.shape-5 { width: 60px; height: 60px; bottom: 30%; right: 30%; opacity: 0.55; animation: drift 15s linear infinite; }
.shape-6 { width: 140px; height: 140px; top: 5%; right: 5%; opacity: 0.3; animation: drift 30s linear infinite reverse; }

@keyframes drift {
    0% { transform: rotate(0deg); background-position: 0% 0%; }
    100% { transform: rotate(360deg); background-position: 100% 100%; }
}

.diamond.shape-2 {
    animation: driftDiamond 18s linear infinite reverse;
}
.diamond.shape-5 {
    animation: driftDiamond 15s linear infinite;
}

@keyframes driftDiamond {
    0% { transform: rotate(45deg); background-position: 0% 0%; }
    100% { transform: rotate(405deg); background-position: 100% 100%; }
}

.canopy-title {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(3rem, 10vw, 9rem);
    color: var(--parchment);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    z-index: 1;
    position: relative;
}

.letter {
    display: inline-block;
    transform: rotate(var(--r, 0deg));
}

.canopy-subtitle {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--moss);
    z-index: 1;
    margin-top: var(--space-unit);
    transform: rotate(-1deg);
}

.moth {
    position: absolute;
    bottom: 15%;
    right: 10%;
    z-index: 1;
    animation: mothBreath 6s ease-in-out infinite;
}

@keyframes mothBreath {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    50% { transform: scale(1.03) rotate(0.5deg); opacity: 1; }
}

/* ===== CABINET (Masonry) ===== */
.cabinet {
    padding: calc(var(--space-unit) * 4) calc(var(--space-unit) * 2);
    position: relative;
}

.section-heading {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: calc(var(--space-unit) * 3);
}

.aurora-text {
    background: var(--aurora);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.masonry {
    columns: 4;
    column-gap: calc(var(--space-unit) * 1.5);
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .masonry { columns: 2; }
}

@media (max-width: 600px) {
    .masonry { columns: 1; }
}

.card {
    break-inside: avoid;
    background: var(--forest-floor);
    padding: calc(var(--space-unit) * 1.5);
    margin-bottom: calc(var(--space-unit) * 1.5);
    position: relative;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

.card:nth-child(odd) {
    border-radius: 0 0 0 24px;
}

.card:nth-child(3n) {
    border-radius: 0 16px 0 0;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(122, 171, 111, 0.15);
}

.card:not(:hover) {
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.card-wide {
    column-span: all;
}

.card-parchment {
    background: linear-gradient(145deg, #3a3228, #2d2820);
}

.card-moss {
    background: linear-gradient(145deg, #2d3228, #2d2820);
}

.card-label {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: var(--moss);
    display: block;
    margin-bottom: 0.5rem;
    transform: rotate(-1deg);
    transition: letter-spacing 0.3s ease;
}

.card:hover .card-label {
    letter-spacing: 0.04em;
}

.card h3 {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--parchment);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.card p {
    color: var(--warm-body);
    margin-bottom: 0.75rem;
}

.card-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--earth-gray);
    letter-spacing: 0.05em;
    display: block;
}

.card-creature {
    position: absolute;
    top: -8px;
    right: 10px;
    opacity: 0.6;
    transform: rotate(12deg);
}

.card:nth-child(even) .card-creature {
    top: auto;
    bottom: -5px;
    right: auto;
    left: 8px;
    transform: rotate(-8deg);
}

/* Reveal animation */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--delay, 0ms);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== TREATY SCROLL ===== */
.treaty-scroll {
    position: relative;
    padding: calc(var(--space-unit) * 6) calc(var(--space-unit) * 2);
    display: flex;
    justify-content: center;
    min-height: 80vh;
}

.trellis {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 16px,
        var(--aurora-violet) 16px,
        var(--aurora-violet) 17px,
        transparent 17px,
        transparent 33px
    ),
    repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 16px,
        var(--aurora-teal) 16px,
        var(--aurora-teal) 17px,
        transparent 17px,
        transparent 33px
    );
    opacity: 0.3;
    transform: rotate(45deg) scaleY(1.5);
}

.trellis-left { left: 5%; }
.trellis-right { right: 5%; }

.fern {
    position: absolute;
    bottom: 0;
    left: 8%;
    z-index: 0;
    opacity: 0.6;
}

.fern-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fern.drawn .fern-path {
    stroke-dashoffset: 0;
}

.scroll-content {
    max-width: 38ch;
    position: relative;
    z-index: 1;
}

.scroll-title {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--lichen);
    letter-spacing: 0.08em;
    margin-bottom: calc(var(--space-unit) * 2);
}

.scroll-text {
    margin-bottom: calc(var(--space-unit) * 1.5);
    color: var(--warm-body);
}

.scroll-annotation {
    font-family: 'Caveat', cursive;
    color: var(--moss);
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    transform: rotate(-1deg);
    display: block;
    margin-top: calc(var(--space-unit) * 2);
}

/* ===== THE HOLLOW ===== */
.hollow {
    background: var(--deep-earth);
    padding: calc(var(--space-unit) * 6) var(--space-unit);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.seal {
    opacity: 0.4;
    margin-bottom: calc(var(--space-unit) * 2);
}

.hollow-name {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--moss);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.5;
}

.hollow-sigil {
    font-family: 'Caveat', cursive;
    color: var(--earth-gray);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    opacity: 0.5;
}
