/* ============================================
   sbom.day - Cottagecore SBOM Pantry
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-canopy: #2D5016;
    --fern-shadow: #4A7A2E;
    --moss-lichen: #7BA05B;
    --meadow-linen: #F4F1E8;
    --fern-white: #FAFDF7;
    --forest-bark: #3E2C1C;
    --amber-honey: #C8963E;
    --dried-lavender: #8E7BA3;
    --pressed-rose: #B5636A;
    --section2-bg: #EFF3E8;
    --section3-bg: #F4EDE0;
}

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

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

body {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'wght' 400, 'opsz' 14;
    color: var(--forest-bark);
    background: var(--fern-white);
    line-height: 1.7;
    overflow-x: hidden;
}

/* --- Typography --- */
.hero__title {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'wght' 900, 'opsz' 144, 'WONK' 1, 'SOFT' 50;
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: var(--meadow-linen);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero__subtitle {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'wght' 300, 'opsz' 14;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--meadow-linen);
    opacity: 0;
    margin-top: 1.5rem;
    letter-spacing: 0.01em;
}

.section-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'wght' 700, 'opsz' 72, 'WONK' 1, 'SOFT' 25;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    color: var(--deep-canopy);
    margin-bottom: 0.5rem;
}

.content-section p {
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    line-height: 1.7;
    max-width: 38rem;
    margin-bottom: 1.5rem;
}

.content-section em {
    font-variation-settings: 'wght' 600, 'opsz' 14;
    font-style: italic;
    color: var(--deep-canopy);
}

.content-section strong {
    font-variation-settings: 'wght' 700, 'opsz' 14;
}

.callout {
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'wght' 500, 'opsz' 14;
    color: var(--dried-lavender);
    font-size: clamp(1.05rem, 1.9vw, 1.2rem);
    border-left: 3px solid var(--dried-lavender);
    padding-left: 1.25rem;
    margin-top: 1rem;
}

/* Handwriting / label font */
.jar-label,
.shelf-jar__label,
.ledger-text {
    font-family: 'Caveat', cursive;
    color: var(--forest-bark);
}

/* --- Hero Section --- */
.section--hero {
    width: 100%;
    height: 100vh;
    background: var(--deep-canopy);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.hero__content {
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
}

.hero__content.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero__subtitle.visible {
    opacity: 1;
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Hero split animation */
.section--hero.splitting {
    transition: clip-path 0.7s ease-in-out;
}

/* --- Split Container --- */
.split-container {
    display: grid;
    grid-template-columns: 45% 55%;
    min-height: 300vh;
    position: relative;
}

/* --- Left Panel (Pantry) --- */
.left-panel {
    background: var(--meadow-linen);
    position: relative;
    overflow: hidden;
    transition: background-color 0.6s ease;
}

/* Paper noise texture */
.left-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
    z-index: 1;
}

/* Soft gradient boundary between panels */
.left-panel::after {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, var(--meadow-linen), var(--fern-white));
    z-index: 5;
    pointer-events: none;
}

/* --- Right Panel (Ledger) --- */
.right-panel {
    background: var(--fern-white);
    padding: 6rem 3rem 6rem 4rem;
    position: relative;
}

/* --- Content Sections --- */
.content-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 0;
}

.divider {
    width: 100%;
    max-width: 400px;
    height: 6px;
    margin-bottom: 2rem;
}

/* --- Pantry Scenes --- */
.pantry-scene {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 2rem;
}

/* --- Mason Jar (Section 1) --- */
.mason-jar {
    position: relative;
    width: 180px;
    height: 280px;
}

.jar-lid {
    width: 110px;
    height: 28px;
    background: linear-gradient(180deg, #A08060 0%, #8B6E50 50%, #7A5F45 100%);
    border-radius: 4px 4px 0 0;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(62,44,28,0.15);
}

.jar-lid::after {
    content: '';
    display: block;
    width: 120px;
    height: 8px;
    background: linear-gradient(180deg, #9A7A5A 0%, #8B6E50 100%);
    border-radius: 2px;
    margin: 0 auto;
    position: relative;
    top: -2px;
    left: -5px;
}

.jar-body {
    width: 160px;
    height: 220px;
    margin: 0 auto;
    border-radius: 8px 8px 20px 20px;
    background: linear-gradient(135deg,
        rgba(250,253,247,0.3) 0%,
        rgba(200,220,200,0.1) 50%,
        rgba(250,253,247,0.2) 100%);
    border: 2px solid rgba(62,44,28,0.15);
    box-shadow:
        inset 0 0 20px rgba(255,255,255,0.3),
        inset 0 0 60px rgba(200,220,200,0.08),
        0 4px 16px rgba(62,44,28,0.1);
    position: relative;
    overflow: hidden;
}

.jar-float {
    position: absolute;
    font-family: 'Literata', Georgia, serif;
    font-variation-settings: 'wght' 400, 'opsz' 10;
    font-size: 0.75rem;
    color: var(--deep-canopy);
    opacity: 0.6;
    animation: floatUp var(--float-duration, 14s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
    left: var(--float-x, 50%);
    white-space: nowrap;
}

.jar-float:nth-child(1) { --float-duration: 14s; --float-delay: 0s; --float-x: 15%; }
.jar-float:nth-child(2) { --float-duration: 18s; --float-delay: 2s; --float-x: 55%; }
.jar-float:nth-child(3) { --float-duration: 16s; --float-delay: 4s; --float-x: 30%; }
.jar-float:nth-child(4) { --float-duration: 20s; --float-delay: 1s; --float-x: 70%; }
.jar-float:nth-child(5) { --float-duration: 15s; --float-delay: 6s; --float-x: 10%; }
.jar-float:nth-child(6) { --float-duration: 17s; --float-delay: 3s; --float-x: 45%; }
.jar-float:nth-child(7) { --float-duration: 13s; --float-delay: 5s; --float-x: 80%; }
.jar-float:nth-child(8) { --float-duration: 19s; --float-delay: 7s; --float-x: 25%; }

@keyframes floatUp {
    0% {
        transform: translateY(200px) rotate(-3deg);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    50% {
        transform: translateY(80px) rotate(2deg);
        opacity: 0.7;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-20px) rotate(-1deg);
        opacity: 0;
    }
}

.jar-label {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    background: var(--meadow-linen);
    padding: 4px 14px;
    border: 1px dashed var(--forest-bark);
    font-size: clamp(0.875rem, 2vw, 1.25rem);
    white-space: nowrap;
    z-index: 3;
}

/* --- Shelf View (Section 2) --- */
.pantry-scene--shelves {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding: 2rem;
}

.shelf {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5rem;
    padding-bottom: 0;
    margin-bottom: 2rem;
    will-change: transform;
}

.shelf-board {
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 10px;
    background: linear-gradient(180deg, #A08060 0%, #8B6E50 100%);
    border-radius: 2px;
    box-shadow: 0 3px 6px rgba(62,44,28,0.2);
}

.shelf--back {
    opacity: 0.5;
    filter: blur(1.5px);
    transform: scale(0.85);
}

.shelf--mid {
    opacity: 0.75;
    filter: blur(0.5px);
    transform: scale(0.92);
}

.shelf--front {
    opacity: 1;
    transform: scale(1);
}

.shelf-jar {
    position: relative;
    z-index: 2;
}

.shelf-jar__lid {
    background: linear-gradient(180deg, #A08060 0%, #7A5F45 100%);
    border-radius: 3px 3px 0 0;
    margin: 0 auto;
}

.shelf-jar__body {
    background: linear-gradient(135deg,
        rgba(250,253,247,0.35) 0%,
        rgba(200,220,200,0.15) 50%,
        rgba(250,253,247,0.25) 100%);
    border: 1.5px solid rgba(62,44,28,0.12);
    border-radius: 4px 4px 10px 10px;
    box-shadow: inset 0 0 15px rgba(255,255,255,0.25);
    margin: 0 auto;
}

.shelf-jar__label {
    text-align: center;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    margin-top: 2px;
    transform: rotate(-2deg);
    padding: 1px 6px;
    background: var(--meadow-linen);
    border: 1px dashed var(--forest-bark);
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
}

.shelf-jar--lg .shelf-jar__lid { width: 50px; height: 14px; }
.shelf-jar--lg .shelf-jar__body { width: 60px; height: 90px; }

.shelf-jar--md .shelf-jar__lid { width: 38px; height: 12px; }
.shelf-jar--md .shelf-jar__body { width: 46px; height: 70px; }

.shelf-jar--sm .shelf-jar__lid { width: 28px; height: 10px; }
.shelf-jar--sm .shelf-jar__body { width: 34px; height: 52px; }

/* --- Leaf Particle System --- */
.leaf-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    clip-path: polygon(50% 0%, 80% 30%, 100% 60%, 75% 100%, 25% 100%, 0% 60%, 20% 30%);
    background: var(--moss-lichen);
    opacity: 0.25;
    pointer-events: none;
    z-index: 1;
    left: var(--start-x, 50%);
    top: -20px;
    animation:
        leafFall var(--duration, 12s) linear infinite,
        leafDrift var(--duration, 12s) ease-in-out infinite,
        leafSpin var(--duration, 12s) linear infinite;
    animation-delay: var(--delay, 0s);
}

.leaf-particle:nth-child(odd) { opacity: 0.2; width: 10px; height: 10px; }
.leaf-particle:nth-child(3n) { opacity: 0.35; width: 14px; height: 14px; }
.leaf-particle:nth-child(5n) { opacity: 0.15; width: 8px; height: 8px; }

@keyframes leafFall {
    0% { top: -20px; }
    100% { top: calc(100% + 20px); }
}

@keyframes leafDrift {
    0% { transform: translateX(0); }
    25% { transform: translateX(var(--drift, 40px)); }
    50% { transform: translateX(0); }
    75% { transform: translateX(calc(var(--drift, 40px) * -1)); }
    100% { transform: translateX(0); }
}

@keyframes leafSpin {
    0% { rotate: 0deg; }
    100% { rotate: calc(var(--rotation-direction, 1) * 360deg); }
}

/* --- Ledger Book (Section 3) --- */
.ledger-book {
    display: flex;
    align-items: stretch;
    perspective: 800px;
    width: 320px;
    height: 240px;
}

.ledger-page {
    width: 150px;
    height: 100%;
    background: var(--meadow-linen);
    border: 1px solid rgba(62,44,28,0.15);
    position: relative;
    overflow: hidden;
    padding: 16px 12px;
}

.ledger-page--left {
    transform: perspective(800px) rotateY(15deg);
    transform-origin: right center;
    border-radius: 4px 0 0 4px;
    box-shadow: inset -5px 0 15px rgba(62,44,28,0.05);
}

.ledger-page--right {
    transform: perspective(800px) rotateY(-15deg);
    transform-origin: left center;
    border-radius: 0 4px 4px 0;
    box-shadow: inset 5px 0 15px rgba(62,44,28,0.05);
}

.ledger-spine {
    width: 20px;
    background: linear-gradient(90deg, #8B6E50, #A08060, #8B6E50);
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(62,44,28,0.2);
}

.ledger-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        transparent, transparent 28px,
        rgba(62,44,28,0.067) 28px,
        rgba(62,44,28,0.067) 29px
    );
    pointer-events: none;
}

.ledger-text {
    font-size: clamp(0.75rem, 1.6vw, 0.95rem);
    line-height: 29px;
    white-space: pre-wrap;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.ledger-text.typing {
    border-right: 2px solid var(--forest-bark);
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    50% { border-color: transparent; }
}

/* --- Botanical SVGs --- */
.botanical {
    position: absolute;
    pointer-events: none;
    z-index: 2;
    opacity: 0.7;
}

.botanical--fern {
    width: 140px;
    height: auto;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
}

.botanical-path {
    stroke-dasharray: var(--path-length, 300);
    stroke-dashoffset: var(--path-length, 300);
    transition: stroke-dashoffset 1.5s ease-in-out;
}

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

/* --- Bridge Elements --- */
.bridge-element {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    opacity: 0.6;
}

.bridge-element--sprig {
    width: 60px;
    top: 35%;
    right: -15px;
}

.bridge-element--vine {
    width: 80px;
    top: 65%;
    right: -20px;
}

/* --- Closing Section --- */
.section--closing {
    width: 100%;
    height: 100vh;
    background: var(--deep-canopy);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.closing__content {
    text-align: center;
    z-index: 5;
    position: relative;
}

.closing__statement {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'wght' 700, 'opsz' 72, 'WONK' 1, 'SOFT' 50;
    font-size: clamp(1.6rem, 4vw, 3rem);
    color: var(--meadow-linen);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.closing-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.closing-particles .leaf-particle--closing {
    background: var(--moss-lichen);
    opacity: 0.3;
}

/* --- Parallax Support --- */
.parallax-element {
    will-change: transform;
}

/* --- Left Panel Background Transitions --- */
.left-panel[data-active-section="1"] {
    background-color: var(--meadow-linen);
}

.left-panel[data-active-section="2"] {
    background-color: var(--section2-bg);
}

.left-panel[data-active-section="3"] {
    background-color: var(--section3-bg);
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .split-container {
        grid-template-columns: 1fr;
    }

    .left-panel {
        display: contents;
    }

    .left-panel::before,
    .left-panel::after {
        display: none;
    }

    .pantry-scene {
        min-height: 40vh;
        background: var(--meadow-linen);
        order: -1;
    }

    .pantry-scene--jar { order: 1; }
    .content-section--1 { order: 2; }
    .pantry-scene--shelves { order: 3; }
    .content-section--2 { order: 4; }
    .pantry-scene--ledger { order: 5; }
    .content-section--3 { order: 6; }

    .right-panel {
        display: contents;
    }

    .content-section {
        min-height: auto;
        padding: 3rem 1.5rem;
        background: var(--fern-white);
    }

    .mason-jar {
        transform: scale(0.8);
    }

    .ledger-book {
        transform: scale(0.75);
    }

    .botanical {
        display: none;
    }

    .bridge-element {
        display: none;
    }

    /* Reduce particle count on mobile */
    .leaf-particle:nth-child(n+9) {
        display: none;
    }

    .closing-particles .leaf-particle--closing:nth-child(n+15) {
        display: none;
    }

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

    .closing__statement {
        font-size: clamp(1.2rem, 5vw, 2rem);
        padding: 0 1rem;
    }
}

/* --- Medium screens --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .right-panel {
        padding: 4rem 2rem 4rem 3rem;
    }

    .mason-jar {
        transform: scale(0.9);
    }
}
