/* ============================================
   completengine.net — Scandinavian Botanical Atelier
   Horizontal-scroll narrative
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --midnight-canvas: #0b1a3d;
    --linen-ground: #f5f1ea;
    --sage-stem: #7a9e7e;
    --ink-shadow: #1d2847;
    --petal-blush: #c4918a;
    --lichen-gray: #a8a49c;
    --bone-white: #f0ece4;
    --frost-blue: #d4dde8;
    --charcoal: #3a3d4a;
    --gray-warm: #c8c4be;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    background: var(--midnight-canvas);
    color: var(--bone-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Horizontal Container --- */
.horizontal-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: fit-content;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.horizontal-container::-webkit-scrollbar {
    display: none;
}

/* --- Panel Base --- */
.panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
}

/* ============================================
   PANEL 1 — The Threshold
   ============================================ */
.panel-1 {
    background: var(--midnight-canvas);
    display: flex;
    flex-direction: row;
}

.panel-1-left {
    width: 40%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.queen-annes-lace {
    width: 55%;
    max-width: 260px;
    height: auto;
}

.panel-1-right {
    width: 60%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 4vw;
}

.title-threshold {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(3rem, 10vw, 9rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    animation: titleBreathe 8s ease-in-out infinite;
}

.title-line {
    display: block;
}

.title-complet {
    color: var(--linen-ground);
}

.title-engine {
    color: var(--sage-stem);
}

@keyframes titleBreathe {
    0%, 100% { letter-spacing: -0.02em; }
    50% { letter-spacing: -0.015em; }
}

/* ============================================
   PANEL 2 — The Collage Wall
   ============================================ */
.panel-2 {
    background: var(--midnight-canvas);
    position: relative;
}

.collage-element {
    position: absolute;
    opacity: 0;
    transition: opacity 0.4s ease-out, transform 0.5s ease-out;
}

.panel-2.in-view .collage-element {
    opacity: 1;
}

/* Individual collage positions */
.collage-1 {
    top: 12%;
    left: 8%;
    transform: translateX(40px) rotate(-2deg);
    transition-delay: 0.2s;
}
.panel-2.in-view .collage-1 {
    transform: translateX(0) rotate(-2deg);
}

.collage-2 {
    top: 20%;
    left: 35%;
    transform: translateY(30px) rotate(1deg);
    transition-delay: 0.4s;
}
.panel-2.in-view .collage-2 {
    transform: translateY(0) rotate(1deg);
}

.collage-3 {
    top: 55%;
    left: 15%;
    transform: translateX(-30px) rotate(3deg);
    transition-delay: 0.5s;
}
.panel-2.in-view .collage-3 {
    transform: translateX(0) rotate(3deg);
}

.collage-4 {
    top: 60%;
    left: 50%;
    transform: translateY(25px) rotate(-1deg);
    transition-delay: 0.6s;
}
.panel-2.in-view .collage-4 {
    transform: translateY(0) rotate(-1deg);
}

.collage-5 {
    top: 30%;
    left: 62%;
    transform: translateX(30px) rotate(2deg);
    transition-delay: 0.7s;
}
.panel-2.in-view .collage-5 {
    transform: translateX(0) rotate(2deg);
}

.collage-6 {
    top: 10%;
    left: 70%;
    transform: translateY(-30px) rotate(-1deg);
    transition-delay: 0.8s;
}
.panel-2.in-view .collage-6 {
    transform: translateY(0) rotate(-1deg);
}

.collage-7 {
    top: 72%;
    left: 30%;
    transform: translateX(20px) rotate(4deg);
    transition-delay: 0.9s;
}
.panel-2.in-view .collage-7 {
    transform: translateX(0) rotate(4deg);
}

.collage-8 {
    top: 45%;
    left: 80%;
    transform: translateY(20px);
    transition-delay: 1.0s;
}
.panel-2.in-view .collage-8 {
    transform: translateY(0);
}

/* Torn paper elements */
.torn-paper {
    padding: 20px 28px;
    position: relative;
}

.paper-sage {
    background: var(--sage-stem);
    clip-path: polygon(2% 5%, 8% 1%, 15% 4%, 25% 0%, 35% 3%, 45% 1%, 55% 4%, 65% 0%, 75% 3%, 85% 1%, 92% 4%, 98% 2%, 100% 8%, 99% 20%, 100% 35%, 98% 50%, 100% 65%, 99% 80%, 100% 92%, 97% 98%, 90% 100%, 80% 97%, 70% 100%, 60% 98%, 50% 100%, 40% 97%, 30% 100%, 20% 98%, 10% 100%, 3% 97%, 0% 92%, 1% 80%, 0% 65%, 2% 50%, 0% 35%, 1% 20%, 0% 8%);
    box-shadow: 3px 4px 12px rgba(11, 26, 61, 0.3);
}

.paper-linen {
    background: var(--linen-ground);
    clip-path: polygon(0% 3%, 5% 0%, 15% 3%, 25% 1%, 35% 4%, 45% 0%, 55% 3%, 65% 1%, 75% 4%, 85% 0%, 95% 3%, 100% 0%, 100% 10%, 98% 25%, 100% 40%, 99% 55%, 100% 70%, 98% 85%, 100% 95%, 97% 100%, 85% 98%, 75% 100%, 65% 97%, 55% 100%, 45% 98%, 35% 100%, 25% 97%, 15% 100%, 5% 98%, 0% 100%, 1% 85%, 0% 70%, 2% 55%, 0% 40%, 1% 25%, 0% 10%);
    box-shadow: 2px 3px 10px rgba(11, 26, 61, 0.25);
}

.paper-midnight {
    background: var(--ink-shadow);
    clip-path: polygon(3% 0%, 12% 3%, 22% 0%, 32% 2%, 42% 0%, 52% 3%, 62% 0%, 72% 2%, 82% 0%, 92% 3%, 100% 0%, 98% 12%, 100% 28%, 98% 42%, 100% 58%, 99% 72%, 100% 88%, 97% 100%, 88% 97%, 78% 100%, 68% 98%, 58% 100%, 48% 97%, 38% 100%, 28% 98%, 18% 100%, 8% 97%, 0% 100%, 2% 85%, 0% 68%, 1% 52%, 0% 38%, 2% 22%, 0% 8%);
    box-shadow: 3px 5px 14px rgba(11, 26, 61, 0.4);
}

.collage-text-fragment {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 1.4rem;
    color: var(--midnight-canvas);
    letter-spacing: 0.02em;
}

.collage-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    font-variant: small-caps;
    color: var(--charcoal);
    letter-spacing: 0.06em;
}

.collage-mono {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--sage-stem);
    letter-spacing: 0.06em;
}

/* Collage botanicals */
.collage-botanical {
    width: 160px;
    height: auto;
}

.collage-fern {
    width: 120px;
    height: auto;
}

.collage-seed {
    width: 70px;
    height: auto;
}

/* Color swatches */
.color-swatch {
    width: 100%;
    height: 100%;
    min-width: 90px;
    min-height: 70px;
}

.swatch-blush {
    background: var(--petal-blush);
    width: 120px;
    height: 90px;
    clip-path: polygon(0% 2%, 100% 0%, 98% 100%, 2% 97%);
    box-shadow: 2px 3px 8px rgba(11, 26, 61, 0.2);
}

.swatch-sage {
    background: var(--sage-stem);
    width: 80px;
    height: 110px;
    clip-path: polygon(2% 0%, 100% 3%, 97% 100%, 0% 98%);
    box-shadow: 2px 3px 8px rgba(11, 26, 61, 0.2);
}

/* SVG draw-path animation */
.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.panel-2.in-view .draw-path {
    stroke-dashoffset: 0;
}

/* Seed pod breathing animation */
.collage-seed {
    animation: seedBreathe 4s ease-in-out infinite;
}

@keyframes seedBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* ============================================
   PANEL 3 — The Specimen
   ============================================ */
.panel-3 {
    background: var(--linen-ground);
}

.specimen-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.specimen-illustration {
    width: 38%;
    max-width: 420px;
    height: auto;
}

/* Specimen path animation */
.specimen-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1s ease-out;
}

.panel-3.in-view .specimen-path.stem-main {
    stroke-dashoffset: 0;
    transition-delay: 0s;
    transition-duration: 0.8s;
}

.panel-3.in-view .specimen-path.branch-l1,
.panel-3.in-view .specimen-path.branch-r1 {
    stroke-dashoffset: 0;
    transition-delay: 0.5s;
    transition-duration: 0.6s;
}

.panel-3.in-view .specimen-path.branch-l2,
.panel-3.in-view .specimen-path.branch-r2 {
    stroke-dashoffset: 0;
    transition-delay: 0.7s;
    transition-duration: 0.6s;
}

.panel-3.in-view .specimen-path.branch-l3 {
    stroke-dashoffset: 0;
    transition-delay: 0.9s;
    transition-duration: 0.6s;
}

.panel-3.in-view .specimen-path.leaf-l1,
.panel-3.in-view .specimen-path.leaf-l2,
.panel-3.in-view .specimen-path.leaf-l3,
.panel-3.in-view .specimen-path.leaf-r1,
.panel-3.in-view .specimen-path.leaf-r2 {
    stroke-dashoffset: 0;
    transition-delay: 1s;
    transition-duration: 0.5s;
}

.panel-3.in-view .specimen-path.flower-1,
.panel-3.in-view .specimen-path.flower-2,
.panel-3.in-view .specimen-path.flower-3,
.panel-3.in-view .specimen-path.flower-4,
.panel-3.in-view .specimen-path.flower-5 {
    stroke-dashoffset: 0;
    transition-delay: 1.2s;
    transition-duration: 0.5s;
}

/* Specimen dots */
.specimen-dot {
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

.panel-3.in-view .specimen-dot {
    opacity: 1;
    transition-delay: 1.5s;
}

/* Leader lines */
.leader-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.6s ease-out;
}

.panel-3.in-view .leader-line {
    stroke-dashoffset: 0;
}

.panel-3.in-view .ll-1 { transition-delay: 1.6s; }
.panel-3.in-view .ll-2 { transition-delay: 1.7s; }
.panel-3.in-view .ll-3 { transition-delay: 1.8s; }
.panel-3.in-view .ll-4 { transition-delay: 1.9s; }
.panel-3.in-view .ll-5 { transition-delay: 2.0s; }

/* Annotation labels */
.specimen-label {
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.panel-3.in-view .specimen-label {
    opacity: 1;
}

.panel-3.in-view .label-1 { transition-delay: 1.8s; }
.panel-3.in-view .label-2 { transition-delay: 1.9s; }
.panel-3.in-view .label-3 { transition-delay: 2.0s; }
.panel-3.in-view .label-4 { transition-delay: 2.1s; }
.panel-3.in-view .label-5 { transition-delay: 2.2s; }

.label-name {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-variant: small-caps;
    font-size: 0.8rem;
    color: var(--charcoal);
    letter-spacing: 0.04em;
}

.label-detail {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--lichen-gray);
    letter-spacing: 0.06em;
}

/* Label positions — calculated relative to SVG layout */
.label-1 {
    bottom: 27%;
    left: 8%;
}

.label-2 {
    bottom: 37%;
    right: 10%;
}

.label-3 {
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.label-4 {
    top: 42%;
    left: 6%;
}

.label-5 {
    top: 38%;
    right: 6%;
}

/* ============================================
   PANEL 4 — The Grid Fragment
   ============================================ */
.panel-4 {
    background: var(--midnight-canvas);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-fragment {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    width: 70%;
    max-width: 900px;
    height: 60vh;
}

.grid-cell {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.panel-4.in-view .grid-cell {
    opacity: 1;
    transform: translateY(0);
}

.panel-4.in-view .cell-1 { transition-delay: 0.1s; }
.panel-4.in-view .cell-2 { transition-delay: 0.2s; }
.panel-4.in-view .cell-3 { transition-delay: 0.3s; }
.panel-4.in-view .cell-4 { transition-delay: 0.4s; }
.panel-4.in-view .cell-5 { transition-delay: 0.5s; }
.panel-4.in-view .cell-6 { transition-delay: 0.6s; }

.grid-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(0.875rem, 1.2vw, 1.125rem);
    line-height: 1.65;
    color: var(--gray-warm);
    padding: 16px;
}

.grid-swatch {
    width: 100%;
    height: 75%;
    border-radius: 2px;
}

.grid-swatch-label {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--sage-stem);
    letter-spacing: 0.06em;
    display: block;
    margin-top: 8px;
    padding-left: 4px;
}

.grid-motif {
    width: 80%;
    height: auto;
    display: block;
    margin: 10% auto;
}

.cell-empty {
    opacity: 0 !important;
}

.cell-bleed {
    margin-bottom: -40px;
    padding-bottom: 40px;
}

/* ============================================
   PANEL 5 — The Statement
   ============================================ */
.panel-5 {
    background: var(--linen-ground);
    display: flex;
    align-items: center;
    justify-content: center;
}

.statement-container {
    width: 85%;
    max-width: 1200px;
    text-align: center;
}

.statement-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--midnight-canvas);
}

.statement-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    margin: 0 0.15em;
}

.panel-5.in-view .statement-word {
    opacity: 1;
    transform: translateY(0);
}

.panel-5.in-view .statement-word:nth-child(1) { transition-delay: 0.1s; }
.panel-5.in-view .statement-word:nth-child(2) { transition-delay: 0.18s; }
.panel-5.in-view .statement-word:nth-child(3) { transition-delay: 0.26s; }
.panel-5.in-view .statement-word:nth-child(4) { transition-delay: 0.34s; }

.statement-highlight {
    color: var(--sage-stem);
}

.statement-line {
    height: 2px;
    background: var(--midnight-canvas);
    margin-top: 40px;
    width: 0%;
    transition: width 1.2s ease-out 0.5s;
}

.panel-5.in-view .statement-line {
    width: 100%;
}

/* ============================================
   PANEL 6 — The Garden
   ============================================ */
.panel-6 {
    background: var(--midnight-canvas);
    position: relative;
}

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

.garden-bg {
    z-index: 1;
}

.garden-mid {
    z-index: 2;
}

.garden-fg {
    z-index: 3;
}

/* Background botanicals */
.gb-1 {
    position: absolute;
    width: 22%;
    height: auto;
    top: 10%;
    left: 5%;
}

.gb-2 {
    position: absolute;
    width: 16%;
    height: auto;
    top: 30%;
    right: 15%;
}

/* Mid-layer */
.gb-3 {
    position: absolute;
    width: 28%;
    height: auto;
    top: 5%;
    left: 35%;
}

.garden-swatch {
    position: absolute;
    width: 100px;
    height: 130px;
}

.gs-1 {
    background: var(--petal-blush);
    opacity: 0.35;
    top: 55%;
    left: 20%;
    transform: rotate(3deg);
    clip-path: polygon(0% 2%, 100% 0%, 98% 100%, 2% 97%);
}

.gs-2 {
    background: var(--sage-stem);
    opacity: 0.25;
    top: 15%;
    right: 25%;
    transform: rotate(-2deg);
    clip-path: polygon(2% 0%, 100% 3%, 97% 100%, 0% 98%);
}

.gb-4 {
    position: absolute;
    width: 8%;
    min-width: 60px;
    height: auto;
    top: 60%;
    right: 10%;
}

/* Foreground */
.gb-5 {
    position: absolute;
    width: 24%;
    height: auto;
    bottom: 5%;
    left: 55%;
}

.gb-6 {
    position: absolute;
    width: 12%;
    height: auto;
    bottom: 10%;
    left: 10%;
}

/* Drifting petals */
.drifting-petal {
    position: absolute;
    width: 12px;
    height: 18px;
    background: var(--petal-blush);
    border-radius: 50% 50% 50% 0;
    opacity: 0.5;
}

.petal-1 {
    top: 25%;
    left: 40%;
    animation: drift1 12s ease-in-out infinite;
}

.petal-2 {
    top: 50%;
    left: 65%;
    animation: drift2 15s ease-in-out infinite;
    width: 9px;
    height: 14px;
    opacity: 0.4;
}

.petal-3 {
    top: 70%;
    left: 30%;
    animation: drift3 18s ease-in-out infinite;
    width: 10px;
    height: 16px;
    opacity: 0.35;
}

@keyframes drift1 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -15px) rotate(20deg); }
    50% { transform: translate(60px, 5px) rotate(-10deg); }
    75% { transform: translate(20px, 20px) rotate(15deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift2 {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-25px, -20px) rotate(-15deg); }
    66% { transform: translate(15px, 10px) rotate(25deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes drift3 {
    0% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(20px, -10px) rotate(12deg); }
    40% { transform: translate(-10px, -25px) rotate(-8deg); }
    60% { transform: translate(35px, 5px) rotate(20deg); }
    80% { transform: translate(10px, 15px) rotate(-5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* Garden navigation dots */
.garden-nav {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.garden-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bone-white);
    opacity: 0.5;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    position: fixed;
    bottom: 16px;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 100;
    pointer-events: none;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--sage-stem);
    transition: width 0.1s linear;
}

.progress-icons {
    position: absolute;
    top: -22px;
    left: 0;
    width: 100%;
    height: 16px;
    pointer-events: none;
}

.progress-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.progress-icon.active {
    opacity: 1;
}

/* Position each icon at panel percentage points (6 panels) */
.pi-1 { left: calc(100% / 12 - 8px); }
.pi-2 { left: calc(3 * 100% / 12 - 8px); }
.pi-3 { left: calc(5 * 100% / 12 - 8px); }
.pi-4 { left: calc(7 * 100% / 12 - 8px); }
.pi-5 { left: calc(9 * 100% / 12 - 8px); }
.pi-6 { left: calc(11 * 100% / 12 - 8px); }

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .panel-1 {
        flex-direction: column;
    }
    
    .panel-1-left {
        width: 100%;
        height: 40%;
    }
    
    .panel-1-right {
        width: 100%;
        height: 60%;
        padding-left: 8vw;
        align-items: flex-start;
        padding-top: 2vh;
    }
    
    .queen-annes-lace {
        width: 35%;
    }
    
    .grid-fragment {
        width: 85%;
        gap: 12px;
    }
    
    .collage-botanical {
        width: 120px;
    }
    
    .collage-fern {
        width: 90px;
    }
    
    .specimen-illustration {
        width: 55%;
    }
    
    .specimen-label {
        font-size: 0.7rem;
    }

    .label-name {
        font-size: 0.7rem;
    }

    .label-detail {
        font-size: 0.6rem;
    }
}
