/* ============================================================
   bcd.day — Styles
   Cottagecore + Generative Art | Deep Burgundy Palette
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --burgundy: #4A0E1B;
    --blackberry: #2D0A12;
    --elderberry: #6B1D31;
    --dusty-rose: #B76E79;
    --warm-blush: #F0D9D0;
    --cream: #F5ECD7;
    --parchment: #EDE0C8;
    --sage: #7D9B76;
    --twilight-sage: #4A5D4F;
    --barn-wood: #6B4226;
    --honey: #C9882B;
    --grid-gap: clamp(12px, 2vw, 24px);
    --section-padding: clamp(3rem, 8vh, 6rem);
    --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.005em;
    color: var(--cream);
    background-color: var(--burgundy);
    overflow-x: hidden;
}

/* Linen texture overlay on light surfaces */
.linen-texture {
    background-image: repeating-conic-gradient(var(--parchment) 0% 25%, transparent 0% 50%) 0 0 / 2px 2px;
    opacity: 0.03;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Fraunces', 'Georgia', serif;
    font-variation-settings: 'WONK' 1, 'opsz' 144;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.8rem, 8vw, 5.5rem);
}

h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h3 {
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    font-weight: 400;
    font-variation-settings: 'WONK' 1, 'opsz' 48;
}

/* Accent / label typeface */
.heading-annotation,
.plot__label,
.cellar__jar-year,
.cellar__colophon,
.cellar__copyright {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
}

/* --- Vine Progress Indicator --- */
#vine-progress {
    position: fixed;
    right: 12px;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 1000;
    pointer-events: none;
}

#vine-progress svg {
    width: 100%;
    height: 100%;
}

.vine-leaf {
    transition: opacity 0.6s ease;
}

.vine-leaf.active {
    opacity: 1;
}

/* ============================================================
   SECTION 1: THE THRESHOLD (Spring)
   ============================================================ */
.zone--threshold {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--burgundy);
    overflow: hidden;
}

#canvas-reaction-diffusion {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

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

.threshold__sign {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sign-bracket {
    width: 40px;
    height: 160px;
    flex-shrink: 0;
}

.threshold__text {
    text-align: center;
}

.threshold__title {
    color: var(--cream);
    text-shadow: 0 2px 20px rgba(74, 14, 27, 0.5);
    margin-bottom: 0.3em;
}

.threshold__subtitle {
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--dusty-rose);
    letter-spacing: 0.02em;
}

.threshold__scroll-prompt {
    animation: gentleBob 2.5s ease-in-out infinite;
}

.lavender-sprig {
    width: 24px;
    height: 80px;
    display: block;
}

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

/* ============================================================
   PHYLLOTAXIS TRANSITION STRIPS
   ============================================================ */
.phyllotaxis-strip {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.canvas-phyllotaxis {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Embroidery borders */
.embroidery-border {
    position: absolute;
    left: 0;
    width: 100%;
    height: 24px;
    z-index: 2;
}

.embroidery-border--top {
    top: 0;
}

.embroidery-border--bottom {
    bottom: 0;
}

.embroidery-stitches line,
.embroidery-stitches path {
    stroke: var(--dusty-rose);
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* ============================================================
   SECTION 2: THE GARDEN GRID (Summer)
   ============================================================ */
.zone--garden {
    position: relative;
    padding: var(--section-padding) clamp(1rem, 4vw, 3rem);
    background-color: var(--cream);
    color: var(--burgundy);
    min-height: 100vh;
    overflow: hidden;
}

/* Linen texture on garden */
.zone--garden::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-conic-gradient(var(--barn-wood) 0% 25%, transparent 0% 50%);
    background-size: 2px 2px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

#canvas-voronoi {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
}

.zone__heading {
    position: relative;
    z-index: 2;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.zone__heading--garden .heading-text {
    color: var(--burgundy);
    display: block;
}

.zone__heading--garden .heading-annotation {
    color: var(--dusty-rose);
    display: block;
    margin-top: 0.2em;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
}

/* Garden Grid */
.garden__grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--grid-gap);
}

/* Plot base styles */
.garden__plot {
    position: relative;
    border: 1px solid var(--dusty-rose);
    background-color: var(--cream);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition:
        border-color 200ms ease,
        border-width 200ms ease,
        background-color 300ms ease,
        transform 500ms var(--ease-out-expo);
    opacity: 0;
    transform: translateY(20px);
}

.garden__plot.visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 600ms var(--bounce),
        transform 600ms var(--bounce),
        border-color 200ms ease,
        background-color 300ms ease;
}

/* Plot size variations */
.garden__plot--featured {
    grid-column: span 2;
    grid-row: span 2;
}

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

.garden__plot--tall {
    grid-row: span 2;
}

.garden__plot--pot {
    /* default 1x1 */
}

/* Overgrown effect - subtle overflow */
.garden__plot:nth-child(3n) {
    margin-top: -4px;
}

.garden__plot:nth-child(5n) {
    margin-left: -4px;
}

.garden__plot:nth-child(7n+2) {
    margin-right: -4px;
    margin-bottom: -4px;
}

/* Plot inner */
.plot__inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
}

.garden__plot--featured .plot__inner {
    min-height: 400px;
}

.garden__plot--tall .plot__inner {
    min-height: 400px;
}

/* Plot visual area */
.plot__visual {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--cream) 0%, var(--parchment) 100%);
}

.garden__plot:nth-child(even) .plot__visual {
    background: linear-gradient(135deg, var(--parchment) 0%, var(--cream) 100%);
}

.plot__canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.plot__flower-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    pointer-events: none;
}

.plot__flower-corner--tl {
    top: 0;
    left: 0;
}

.plot__flower-corner--br {
    bottom: 0;
    right: 0;
}

/* Plot label (revealed on hover) */
.plot__label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(74, 14, 27, 0.85), transparent);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.plot__title {
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    color: var(--cream);
}

.plot__date {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: var(--dusty-rose);
}

/* Hover states */
.garden__plot:hover {
    border-color: var(--elderberry);
    border-width: 2px;
    background-color: var(--warm-blush);
}

.garden__plot:hover .plot__label {
    opacity: 1;
    transform: translateY(0);
}

/* Expanded state */
.garden__plot.expanded {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    border: none;
    border-radius: 0;
    margin: 0;
    grid-column: unset;
    grid-row: unset;
    overflow-y: auto;
}

.plot__expanded {
    display: none;
    padding: clamp(2rem, 5vw, 4rem);
    background-color: var(--cream);
    color: var(--burgundy);
    min-height: 100vh;
}

.garden__plot.expanded .plot__inner {
    display: none;
}

.garden__plot.expanded .plot__expanded {
    display: block;
}

.plot__expanded h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'WONK' 1, 'opsz' 72;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--burgundy);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.plot__expanded p {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    color: var(--burgundy);
    max-width: 65ch;
    margin-bottom: 1rem;
}

/* Close button */
.plot__close {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: var(--cream);
    border: 2px solid var(--dusty-rose);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: border-color 200ms ease, transform 200ms ease;
}

.plot__close:hover {
    border-color: var(--elderberry);
    transform: scale(1.1);
}

.plot__close svg {
    width: 24px;
    height: 24px;
}

/* ============================================================
   SECTION 3: THE POTTING SHED (Autumn)
   ============================================================ */
.zone--shed {
    position: relative;
    padding: var(--section-padding) clamp(1rem, 4vw, 3rem);
    min-height: 100vh;
    overflow: hidden;
}

/* Wood grain background */
.shed__woodgrain {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            87deg,
            #6B4226 0px,
            #6B4226 1px,
            transparent 1px,
            transparent 6px
        ),
        repeating-linear-gradient(
            90deg,
            #8B6914 0px,
            transparent 2px,
            transparent 12px
        ),
        repeating-linear-gradient(
            85deg,
            rgba(107, 66, 38, 0.3) 0px,
            rgba(107, 66, 38, 0.3) 1px,
            transparent 1px,
            transparent 8px
        ),
        linear-gradient(
            180deg,
            #5a3820 0%,
            #6B4226 30%,
            #7a4e30 50%,
            #6B4226 70%,
            #5a3820 100%
        );
    z-index: 0;
}

/* Woodgrain knot accents */
.shed__woodgrain::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 15%;
    width: 80px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(ellipse, #5a3820, transparent 70%);
    opacity: 0.4;
}

.shed__woodgrain::after {
    content: '';
    position: absolute;
    top: 65%;
    right: 20%;
    width: 60px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(ellipse, #4a2c18, transparent 70%);
    opacity: 0.35;
}

.zone__heading--shed {
    position: relative;
    z-index: 2;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.zone__heading--shed .heading-text {
    color: var(--cream);
    display: block;
}

.zone__heading--shed .heading-annotation {
    color: var(--honey);
    display: block;
    margin-top: 0.2em;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
}

/* Notes on workbench */
.shed__content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: clamp(1.5rem, 3vw, 2.5rem);
    max-width: 1200px;
    margin: 0 auto;
}

.shed__note {
    position: relative;
    background-color: var(--cream);
    color: var(--burgundy);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    padding-top: clamp(2rem, 3.5vw, 3rem);
    border-radius: 2px;
    box-shadow:
        2px 3px 8px rgba(45, 10, 18, 0.3),
        0 1px 2px rgba(45, 10, 18, 0.2);
    transform-origin: top center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms var(--bounce), transform 600ms var(--bounce);
}

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

.shed__note--pinned {
    /* straight */
}

.shed__note--tilted.visible {
    transform: rotate(-1.5deg);
}

.shed__note--straight.visible {
    transform: rotate(0.8deg);
}

/* Linen texture on notes */
.shed__note::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-conic-gradient(var(--parchment) 0% 25%, transparent 0% 50%);
    background-size: 2px 2px;
    opacity: 0.04;
    pointer-events: none;
    border-radius: 2px;
}

/* Pin */
.shed__pin {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, var(--elderberry), var(--burgundy));
    box-shadow: 0 2px 4px rgba(45, 10, 18, 0.4);
}

.shed__pin::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(245, 236, 215, 0.4);
}

.shed__note-title {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'WONK' 1, 'opsz' 48;
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: var(--burgundy);
    margin-bottom: 0.8em;
}

.shed__note p {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.6;
    color: var(--burgundy);
    margin-bottom: 0.8em;
}

.shed__note p:last-child {
    margin-bottom: 0;
}

/* Mason Jar Pull Quote */
.shed__mason-jar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms var(--bounce), transform 600ms var(--bounce);
}

.shed__mason-jar.visible {
    opacity: 1;
    transform: translateY(0);
}

.mason-jar__outline {
    position: absolute;
    width: 200px;
    height: 280px;
}

.mason-jar__path {
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    transition: stroke-dashoffset 800ms ease;
}

.shed__mason-jar.visible .mason-jar__path {
    stroke-dashoffset: 0;
}

.mason-jar__band1,
.mason-jar__band2 {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 600ms ease 200ms;
}

.shed__mason-jar.visible .mason-jar__band1,
.shed__mason-jar.visible .mason-jar__band2 {
    stroke-dashoffset: 0;
}

.mason-jar__quote {
    position: relative;
    max-width: 140px;
    text-align: center;
    z-index: 1;
    opacity: 0;
    transition: opacity 500ms ease 1000ms;
}

.shed__mason-jar.visible .mason-jar__quote {
    opacity: 1;
}

.mason-jar__quote p {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--cream);
    line-height: 1.4;
}

/* ============================================================
   SECTION 4: THE ROOT CELLAR (Winter)
   ============================================================ */
.zone--cellar {
    position: relative;
    padding: var(--section-padding) clamp(1rem, 4vw, 3rem);
    background-color: var(--blackberry);
    min-height: 80vh;
    overflow: hidden;
}

#canvas-lsystem {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.zone__heading--cellar {
    position: relative;
    z-index: 2;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.zone__heading--cellar .heading-text {
    color: var(--cream);
    display: block;
}

.zone__heading--cellar .heading-annotation {
    color: var(--twilight-sage);
    display: block;
    margin-top: 0.2em;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
}

/* Cellar Grid — dense archive */
.cellar__grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: clamp(8px, 1.5vw, 16px);
    margin-bottom: var(--section-padding);
}

.cellar__jar {
    position: relative;
    background-color: rgba(74, 14, 27, 0.4);
    border: 1px solid var(--twilight-sage);
    border-radius: 3px;
    padding: clamp(1rem, 2vw, 1.5rem) clamp(0.8rem, 1.5vw, 1.2rem);
    text-align: center;
    cursor: pointer;
    transition:
        background-color 300ms ease,
        border-color 300ms ease,
        transform 300ms ease;
    opacity: 0;
    transform: translateY(12px);
}

.cellar__jar.visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 600ms var(--bounce),
        transform 600ms var(--bounce),
        background-color 300ms ease,
        border-color 300ms ease;
}

.cellar__jar:hover {
    background-color: rgba(107, 29, 49, 0.5);
    border-color: var(--elderberry);
    transform: translateY(-2px);
}

.cellar__jar-title {
    display: block;
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--cream);
    margin-bottom: 0.3em;
}

.cellar__jar-year {
    display: block;
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 0.9vw, 0.9rem);
    color: var(--twilight-sage);
}

/* Footer */
.cellar__footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: clamp(2rem, 4vw, 3rem);
    border-top: 1px solid var(--twilight-sage);
}

.cellar__colophon {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--dusty-rose);
    margin-bottom: 0.5em;
}

.cellar__copyright {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 0.9vw, 0.9rem);
    color: var(--twilight-sage);
}

/* ============================================================
   POLLEN CURSOR TRAIL
   ============================================================ */
#pollen-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.pollen-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--sage);
    opacity: 0.6;
    pointer-events: none;
    animation: pollenFade 300ms ease-out forwards;
}

@keyframes pollenFade {
    0% {
        opacity: 0.6;
        transform: scale(1) translate(0, 0);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) translate(var(--dx, 5px), var(--dy, -8px));
    }
}

/* ============================================================
   SCROLL ANIMATION BASE STATES
   ============================================================ */
.embroidery-stitches line,
.embroidery-stitches path {
    stroke-dasharray: 10;
    stroke-dashoffset: 10;
    transition: stroke-dashoffset 1200ms ease;
}

.phyllotaxis-strip.visible .embroidery-stitches line,
.phyllotaxis-strip.visible .embroidery-stitches path {
    stroke-dashoffset: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .garden__plot--featured {
        grid-column: span 1;
        grid-row: span 1;
    }

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

    .garden__plot--tall {
        grid-row: span 1;
    }

    .garden__plot:nth-child(3n) {
        margin-top: 0;
    }

    .garden__plot:nth-child(5n) {
        margin-left: 0;
    }

    .garden__plot:nth-child(7n+2) {
        margin-right: 0;
        margin-bottom: 0;
    }

    .threshold__sign {
        flex-direction: column;
        gap: 0.5rem;
    }

    .sign-bracket {
        display: none;
    }

    .shed__content {
        grid-template-columns: 1fr;
    }

    #vine-progress {
        display: none;
    }

    .cellar__grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

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

    .cellar__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
