/* Custom resets and styling variables */
:root {
    --text-primary: #8c6a51;
    --text-muted: #a6846c;
    --bg-page: #fcfbfa;
    --color-apricot: #f5bda6;
    --color-apricot-hover: #e0a58d;
    --card-shadow: 0 15px 45px rgba(140, 106, 81, 0.12);
    --font-handwritten: 'Caveat', cursive;
    --font-rounded: 'Comfortaa', sans-serif;
    --font-sans: 'Quicksand', sans-serif;
}

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

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    /* Soft grid texture for page background */
    background-image: 
        radial-gradient(rgba(245, 189, 166, 0.15) 1.5px, transparent 1.5px), 
        radial-gradient(rgba(245, 189, 166, 0.15) 1.5px, var(--bg-page) 1.5px);
    background-size: 40px 40px;
    background-position: center, center;
}

/* Full screen sticky hero setup */
.scroll-hero-section {
    position: relative;
    width: 100%;
    height: 160vh; /* Shorter scroll distance to bring "Our Story" up faster */
    scroll-snap-align: start; /* Snap point at the top of the page */
}

.sticky-garden-wrapper {
    position: sticky;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- Content Sections (sliding over the hero) --- */
.main-content {
    position: relative;
    z-index: 10;
    background-color: var(--bg-page);
    border-top-left-radius: 40px;
    border-top-right-radius: 40px;
    box-shadow: 0 -20px 50px rgba(0,0,0,0.1);
    margin-top: -40px; /* Slight overlap */
    padding-bottom: 60px;
}

.content-section {
    padding: 80px 20px;
    text-align: center;
}

.section-container {
    max-width: 800px;
    margin: 0 auto;
}

.content-section h2 {
    font-family: var(--font-rounded);
    font-size: 3rem;
    color: var(--text-primary);
    margin-bottom: 30px;
}

.content-section p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* --- Portfolio / Storybook Content --- */
/* --- Portfolio / Horizontal Carousel --- */
#projects {
    padding-top: 120px;
    padding-bottom: 80px;
}

.portfolio-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 20px 5vw 60px 5vw; /* Space for shadow */
    gap: 4vw;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.portfolio-carousel::-webkit-scrollbar {
    display: none;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background-color: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(74, 59, 50, 0.15);
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-arrow:hover {
    background-color: var(--color-apricot);
    color: var(--text-primary);
    transform: translateY(-50%) scale(1.1);
}

.prev-arrow {
    left: 20px;
}

.next-arrow {
    right: 20px;
}

.paper-card {
    flex: 0 0 85vw;
    max-width: 1100px;
    scroll-snap-align: center;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(74, 59, 50, 0.08);
    padding: 60px;
}

.paper-card.bg-alt {
    background-color: #fcf6ef;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.carousel-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #fcf6ef;
    border: 2px solid rgba(74, 59, 50, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-dot:hover {
    background-color: rgba(74, 59, 50, 0.3);
}

.carousel-dot.active {
    background-color: var(--color-apricot);
    border-color: var(--text-primary);
    transform: scale(1.3);
}

.chapter-section {
    padding: 120px 20px;
    border-top: none;
    background-color: var(--bg-page);
    box-shadow: 0 -20px 50px rgba(74, 59, 50, 0.08);
    position: relative;
    z-index: 14; /* Ensure about/contact cast shadow over the last project page */
}

.bg-alt {
    background-color: #f2e8dd; /* Slightly darker paper */
}

.chapter-title {
    font-family: var(--font-handwritten);
    font-size: 3.5rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 80px;
}

/* Zig-zag Project Rows */
.project-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}



.project-row.reverse {
    flex-direction: row-reverse;
}

.project-image-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Paper Cut Frame Style */
.paper-frame {
    background: #fff;
    padding: 20px;
    border-radius: 4px;
    /* Outer drop shadow (lifting the frame off the page) */
    box-shadow: 0 15px 30px rgba(74, 59, 50, 0.15), 0 5px 15px rgba(74, 59, 50, 0.1);
    position: relative;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.paper-frame::after {
    content: '';
    position: absolute;
    top: 20px; left: 20px; right: 20px; bottom: 20px;
    /* Inner shadow to make the image look recessed (cut out hole) */
    box-shadow: inset 0 8px 15px rgba(0,0,0,0.2), inset 0 0 5px rgba(0,0,0,0.1);
    pointer-events: none;
    border-radius: 2px;
}

.paper-frame img {
    display: block;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 2px;
}

.paper-frame:hover {
    transform: scale(1.05) rotate(-2deg) translateY(-10px);
    box-shadow: 0 25px 40px rgba(74, 59, 50, 0.2), 0 10px 20px rgba(74, 59, 50, 0.12);
}

.project-text {
    flex: 1;
}

.project-text h3 {
    font-family: var(--font-rounded);
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.project-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* About Grid */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1000px;
    margin: 0 auto;
}

.about-text p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 20px;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 30px;
    justify-content: center;
}

.stat-box {
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(74, 59, 50, 0.08);
}

.stat-number {
    display: block;
    font-family: var(--font-handwritten);
    font-size: 4rem;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 800px) {
    .project-row, .project-row.reverse, .about-grid {
        flex-direction: column;
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    /* Adjust paper card for mobile */
    .paper-card {
        flex: 0 0 90vw;
        padding: 30px;
    }
    
    .carousel-arrow {
        display: none;
    }
    
    .chapter-title {
        font-size: 2.5rem;
        margin-bottom: 20px;
    }
}

/* --- Header & Navigation --- */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 30px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), transparent);
}

.nav {
    display: flex;
    gap: 30px;
    margin: 0 auto; /* Centered navigation links */
}

.nav-link {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    padding: 6px 4px;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--text-primary);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link.active::after,
.nav-link:hover::after {
    width: 100%;
    left: 0;
}

.nav-link:hover {
    color: #61402a;
}

/* Search button styling */
.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 6px;
    border-radius: 50%;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background-color: rgba(140, 106, 81, 0.08);
    transform: scale(1.08);
}

/* --- Hero Branding Content --- */
.hero-content {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 50; /* Above rabbits (z-index: 4-10), below curtains (z-index: 100) */
    width: 90%;
    max-width: 600px;
    pointer-events: none; /* Let clicks pass through to elements behind */
}

.logo-title {
    font-family: var(--font-handwritten);
    font-size: clamp(42px, 8vw, 78px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.4);
    user-select: none;
}

.subtitle {
    font-family: var(--font-sans);
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    color: var(--text-muted);
    margin: 8px 0 22px 0;
    letter-spacing: 0.5px;
    user-select: none;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-primary);
    opacity: 0.7;
    z-index: 105; /* Above curtains so it's visible */
    animation: bounce 2s infinite;
    pointer-events: none;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) translateX(-50%);
    }
    40% {
        transform: translateY(-15px) translateX(-50%);
    }
    60% {
        transform: translateY(-7px) translateX(-50%);
    }
}

.cta-button {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
    background-color: var(--color-apricot);
    border: none;
    border-radius: 25px;
    padding: 12px 32px;
    cursor: pointer;
    pointer-events: auto; /* Re-enable clicks */
    box-shadow: 0 4px 15px rgba(245, 189, 166, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.cta-button:hover {
    background-color: var(--color-apricot-hover);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(245, 189, 166, 0.6);
}

.cta-button:active {
    transform: translateY(0) scale(0.98);
}

/* --- Interactive Heaven Garden with Paper Craft Background --- */
.garden-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    pointer-events: none; /* Removed auto because clicks shouldn't spawn bunnies anymore */
}

.parallax-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1); /* Ultra-smooth mouse response */
}

/* Layer 1: AI Generated Heavenly Background */
.layer-ai-bg {
    position: absolute;
    width: 100%;
    height: 100vh;
    object-fit: cover;
    object-position: center bottom;
    z-index: 1;
}

/* Layer 3: AI Generated Transparent Foreground (Split Curtains via Clip-Path) */
.fg-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    filter: drop-shadow(0 -5px 15px rgba(0,0,0,0.25));
}

.left-fg {
    object-position: left bottom;
}

.right-fg {
    object-position: right bottom;
}

.layer-ai-fg-left {
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    z-index: 100;
}

.layer-ai-fg-right {
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
    z-index: 100;
}

/* Layer 3: Far Hills */
.layer-hills-far {
    z-index: 3;
}

/* Layer 4: Mid Hills */
.layer-hills-mid {
    z-index: 4;
}

/* Layer 5: Near Hills */
.layer-hills-near {
    z-index: 5;
}

/* Layer 6: Foreground Sway Details */
.layer-foreground {
    z-index: 6;
}

/* Responsive Hill SVG Base */
.hill-svg {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 -8px 12px rgba(0,0,0,0.15));
}

.foreground-elements-svg {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Swaying Flowers / Grass in Foreground */
.swaying-plant {
    transform-box: fill-box;
    transform-origin: bottom center;
    animation: plant-sway 6s ease-in-out infinite alternate;
}

.plant-left-2 { animation-delay: -1.5s; animation-duration: 5s; }
.plant-left-3 { animation-delay: -3s; animation-duration: 7s; }
.plant-right-1 { animation-delay: -0.5s; animation-duration: 6.5s; }
.plant-right-2 { animation-delay: -2s; animation-duration: 5.5s; }
.plant-right-3 { animation-delay: -4s; animation-duration: 7.2s; }

@keyframes plant-sway {
    0% { transform: rotate(-3deg) skewX(-1deg); }
    100% { transform: rotate(3deg) skewX(1deg); }
}

/* --- Rabbit Anatomy & Animations --- */
.rabbit-container {
    position: absolute;
    pointer-events: auto; /* Active for click and hover */
}

/* Rabbit Base Styling & Core Parts */
.rabbit {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.rabbit-group {
    transform-box: fill-box;
    transform-origin: bottom center;
    animation: rabbit-breathe 3s ease-in-out infinite;
}

.ear-left, .ear-right, .leg-front-1, .leg-front-2, .leg-back-1, .leg-back-2, .head-group, .tail {
    transform-box: fill-box;
}

/* Soft breathing animation */
@keyframes rabbit-breathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.02, 0.97) translateY(0.5px); }
}

/* Ear wiggle loops */
@keyframes ear-wiggle-left {
    0%, 92%, 100% { transform: rotate(0deg); }
    94% { transform: rotate(-10deg); }
    96% { transform: rotate(8deg); }
}
@keyframes ear-wiggle-right {
    0%, 90%, 100% { transform: rotate(0deg); }
    92% { transform: rotate(10deg); }
    95% { transform: rotate(-8deg); }
}

/* 1. White Fluffy Bunny (Bottom Right) */
.near-white-bunny {
    right: 14%;
    bottom: 8%;
    width: 110px;
    height: 80px;
    z-index: 10;
}

.near-white-bunny .ear-left {
    transform-origin: 88px 38px;
    animation: ear-wiggle-left 5.2s ease-in-out infinite;
}

.near-white-bunny .ear-right {
    transform-origin: 94px 34px;
    animation: ear-wiggle-right 4.8s ease-in-out infinite;
}

.near-white-bunny:hover .head-group {
    transform: rotate(-3deg) translateY(-1px);
    transition: transform 0.2s ease;
}

/* Trigger Happy Hop on White Bunny */
.near-white-bunny.happy-hop {
    animation: white-happy-hop 0.8s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

.near-white-bunny.happy-hop .leg-front-1,
.near-white-bunny.happy-hop .leg-front-2 {
    animation: paw-stretch 0.8s ease-in-out;
}

.near-white-bunny.happy-hop .leg-back-1,
.near-white-bunny.happy-hop .leg-back-2 {
    animation: kick-back 0.8s ease-in-out;
}

@keyframes white-happy-hop {
    0%, 100% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-38px) scale(0.95, 1.05) rotate(-5deg); }
    50% { transform: translateY(-42px) scale(1) rotate(0deg); }
    70% { transform: translateY(-15px) scale(1) rotate(2deg); }
    85% { transform: translateY(0) scale(1.08, 0.9) rotate(0deg); } /* squish */
}

/* 2. Spotted Bunny (Bottom Left) */
.near-spotted-bunny {
    left: 10%;
    bottom: 12%;
    width: 115px;
    height: 85px;
    z-index: 10;
}

.near-spotted-bunny .ear-left {
    transform-origin: 102px 41px;
    animation: ear-wiggle-left 4.5s ease-in-out infinite;
}

.near-spotted-bunny .ear-right {
    transform-origin: 108px 43px;
    animation: ear-wiggle-right 4.2s ease-in-out infinite;
}

/* Spotted Bunny Run Animation (Leaps forward and back on click) */
.near-spotted-bunny.happy-hop {
    animation: spotted-dash-hop 1s cubic-bezier(0.25, 0.8, 0.25, 1.1);
}

.near-spotted-bunny.happy-hop .leg-front-1 { animation: run-front-leg 0.5s ease-in-out 2; }
.near-spotted-bunny.happy-hop .leg-front-2 { animation: run-front-leg-delay 0.5s ease-in-out 2; }
.near-spotted-bunny.happy-hop .leg-back-1 { animation: run-back-leg 0.5s ease-in-out 2; }
.near-spotted-bunny.happy-hop .leg-back-2 { animation: run-back-leg-delay 0.5s ease-in-out 2; }

@keyframes spotted-dash-hop {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(30px, -30px) rotate(8deg); }
    40% { transform: translate(55px, -35px) rotate(4deg); }
    60% { transform: translate(80px, -20px) rotate(-3deg); }
    80% { transform: translate(35px, 0) scale(1.08, 0.92); } /* squish slide back */
}

/* Paw stretching & leg animations */
@keyframes paw-stretch {
    0%, 100% { transform: rotate(0deg); }
    30%, 60% { transform: rotate(35deg) translate(3px, -2px); }
}

@keyframes kick-back {
    0%, 100% { transform: rotate(0deg); }
    35%, 65% { transform: rotate(-40deg) translate(-4px, 2px); }
}

@keyframes run-front-leg {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(35deg) translate(2px, -3px); }
}
@keyframes run-front-leg-delay {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-25deg) translate(-1px, 2px); }
}
@keyframes run-back-leg {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-40deg) translate(-3px, 1px); }
}
@keyframes run-back-leg-delay {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(20deg) translate(2px, -1px); }
}

/* 3. Orange Bunnies in Mid-ground (Hopping paths) */
.mid-orange-bunny-1 {
    width: 60px;
    height: 48px;
    z-index: 5;
    /* Move along hill shape natively using offset-path */
    offset-path: path("M -50 280 Q 250 330, 600 270 T 1250 300");
    animation: orange-move-1 15s linear infinite;
}

.mid-orange-bunny-2 {
    width: 60px;
    height: 48px;
    z-index: 5;
    offset-path: path("M 1250 300 Q 950 270, 600 290 T -50 280");
    animation: orange-move-2 18s linear infinite;
    animation-delay: -5s;
}

/* Orange bunny running animation cycles */
.mid-orange-bunny-1 .rabbit {
    animation: orange-hop-cycle 0.7s infinite;
}
.mid-orange-bunny-1 .leg-front-1 { animation: run-front-leg 0.35s infinite; }
.mid-orange-bunny-1 .leg-front-2 { animation: run-front-leg-delay 0.35s infinite; }
.mid-orange-bunny-1 .leg-back-1 { animation: run-back-leg 0.35s infinite; }
.mid-orange-bunny-1 .leg-back-2 { animation: run-back-leg-delay 0.35s infinite; }

.mid-orange-bunny-2 .rabbit {
    animation: orange-hop-cycle 0.8s infinite;
}
.mid-orange-bunny-2 .leg-front-1 { animation: run-front-leg 0.4s infinite; }
.mid-orange-bunny-2 .leg-front-2 { animation: run-front-leg-delay 0.4s infinite; }
.mid-orange-bunny-2 .leg-back-1 { animation: run-back-leg 0.4s infinite; }
.mid-orange-bunny-2 .leg-back-2 { animation: run-back-leg-delay 0.4s infinite; }

/* Move along path animations */
@keyframes orange-move-1 {
    0% { offset-distance: 0%; transform: scaleX(1); }
    49% { transform: scaleX(1); }
    50% { offset-distance: 100%; transform: scaleX(-1); }
    99% { transform: scaleX(-1); }
    100% { offset-distance: 0%; transform: scaleX(1); }
}

@keyframes orange-move-2 {
    0% { offset-distance: 0%; transform: scaleX(1); }
    49% { transform: scaleX(1); }
    50% { offset-distance: 100%; transform: scaleX(-1); }
    99% { transform: scaleX(-1); }
    100% { offset-distance: 0%; transform: scaleX(1); }
}

@keyframes orange-hop-cycle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(4deg); }
}

/* Follow-Click Magic Bunny (Created via JS when user clicks hills) */
.click-magic-bunny {
    position: absolute;
    width: 45px;
    height: 36px;
    z-index: 8;
    pointer-events: none;
    transition: left 0.8s cubic-bezier(0.25, 0.8, 0.25, 1), bottom 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.click-magic-bunny .rabbit {
    animation: magic-bunny-hop 0.5s ease-in-out infinite;
}

@keyframes magic-bunny-hop {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(-18px) scaleY(1.08) rotate(3deg); }
}

/* --- Butterflies --- */
.butterfly {
    position: absolute;
    pointer-events: none;
}

.butterfly-blue {
    top: 55%;
    left: 20%;
    animation: float-butterfly-1 12s ease-in-out infinite;
}

.butterfly-orange {
    top: 48%;
    right: 22%;
    animation: float-butterfly-2 15s ease-in-out infinite;
}

/* Butterfly wing-flap animation */
.wing-left {
    transform-origin: 20px 20px;
    animation: wing-flap-left 0.15s linear infinite alternate;
}

.wing-right {
    transform-origin: 20px 20px;
    animation: wing-flap-right 0.15s linear infinite alternate;
}

@keyframes wing-flap-left {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0.1); }
}

@keyframes wing-flap-right {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0.1); }
}

/* Butterfly flight loops */
@keyframes float-butterfly-1 {
    0%, 100% { transform: translate(0, 0) scale(0.9); }
    25% { transform: translate(80px, -30px) scale(1); }
    50% { transform: translate(140px, 10px) scale(0.8); }
    75% { transform: translate(60px, 40px) scale(0.95); }
}

@keyframes float-butterfly-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-90px, 40px) scale(0.85); }
    66% { transform: translate(-40px, -30px) scale(0.95); }
}

/* --- Magical Sparkle overlay --- */
.sparkles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6; /* Floating above hills and rabbits */
}

.sparkle {
    position: absolute;
    background: radial-gradient(circle, #ffffff 0%, rgba(254, 240, 138, 0.95) 45%, rgba(254, 240, 138, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle-float 3.5s ease-out forwards;
}

@keyframes sparkle-float {
    0% {
        transform: translate(0, 0) scale(0.4);
        opacity: 0;
    }
    15% {
        opacity: 0.9;
    }
    100% {
        transform: translate(var(--drift-x), -160px) scale(1.4);
        opacity: 0;
    }
}

/* --- Paper Mario Cutout Rabbits --- */
.paper-rabbit {
    position: absolute;
    width: 100px;
    aspect-ratio: 1 / 1;
    background-size: 300% 200%; /* Perfect 3x2 grid mapping */
    background-position: 0% 0%;
    background-repeat: no-repeat;
    filter: drop-shadow(0 15px 15px rgba(0,0,0,0.35));
    transform-origin: bottom center;
    cursor: pointer;
    z-index: 5;
    --facing: 1;
    --depth-scale: 1;
    transform: scaleX(var(--facing));
    transition: left 3.5s linear, bottom 3.5s linear, width 3.5s linear, filter 0.3s ease;
}

/* Base IDs and Sizes (Scaling responsively with screen width and depth) */
#yamroll { background-image: url('../assets/images/yamroll_sprites.webp'); left: 15%; bottom: 8%; width: calc(clamp(100px, 14vw, 240px) * var(--depth-scale)); }
#snowcone { background-image: url('../assets/images/snowcone_sprites.webp'); left: 60%; bottom: 10%; width: calc(clamp(90px, 12vw, 210px) * var(--depth-scale)); } 
#baby1 { background-image: url('../assets/images/baby1_sprites.webp'); left: 30%; bottom: 5%; width: calc(clamp(80px, 10vw, 180px) * var(--depth-scale)); z-index: 6;}
#baby2 { background-image: url('../assets/images/baby2_sprites.webp'); left: 45%; bottom: 2%; width: calc(clamp(85px, 11vw, 190px) * var(--depth-scale)); }
#baby3 { background-image: url('../assets/images/baby3_sprites.webp'); left: 75%; bottom: 12%; width: calc(clamp(80px, 10vw, 180px) * var(--depth-scale)); z-index: 4;}
#baby4 { background-image: url('../assets/images/baby4_sprites.webp'); left: 5%; bottom: 15%; width: calc(clamp(85px, 11vw, 190px) * var(--depth-scale)); z-index: 4;}

/* State Machine Poses (Percentage Mapping) */
.pose-walk1 { background-position: 0% 0%; }
.pose-walk2 { background-position: 50% 0%; }
.pose-sitting { background-position: 100% 0%; }
.pose-sleeping { background-position: 0% 100%; }
.pose-jumping { background-position: 50% 100%; }
.pose-standing { background-position: 100% 100%; }

/* Paper Mario Animations */
/* Waddle for walking state via sprite flip-book */
.paper-rabbit.pose-walking {
    animation: flip-walk 0.35s steps(1) infinite;
}

/* Sleep breathing */
.paper-rabbit.pose-sleeping {
    animation: sleep-breathe 2.5s ease-in-out infinite alternate;
}

/* Standing sway */
.paper-rabbit.pose-standing {
    animation: paper-sway 2s ease-in-out infinite alternate;
}

/* Sitting is just still */
.paper-rabbit.pose-sitting {
    /* No animation */
}

.paper-jump {
    background-position: 50% 100% !important; /* Force jump pose */
    animation: paper-jump 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes flip-walk {
    0% { background-position: 0% 0%; }
    50% { background-position: 50% 0%; }
    100% { background-position: 0% 0%; }
}

@keyframes sleep-breathe {
    0% { transform: scaleX(var(--facing)) scaleY(0.96) scaleX(1.02) rotateZ(5deg); }
    100% { transform: scaleX(var(--facing)) scaleY(1.02) scaleX(0.98) rotateZ(-5deg); }
}

@keyframes paper-sway {
    0% { transform: scaleX(var(--facing)) rotateZ(-2deg); }
    100% { transform: scaleX(var(--facing)) rotateZ(2deg); }
}

@keyframes paper-jump {
    0%, 100% { transform: scaleX(var(--facing)) translateY(0) scaleY(1); }
    30% { transform: scaleX(var(--facing)) translateY(-60px) scaleY(1.1); }
    70% { transform: scaleX(var(--facing)) translateY(-20px) scaleY(1.05); }
    90% { transform: scaleX(var(--facing)) translateY(0) scaleY(0.85); }
}

/* --- Footer --- */
.full-width-footer {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 40px 20px;
    background-color: var(--bg-page);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border-top: 2px dashed rgba(140, 106, 81, 0.2);
}

.footer-nav {
    display: flex;
    gap: 20px;
}

.footer-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--text-primary);
}

.copyright {
    font-size: 13px;
    color: rgba(166, 132, 108, 0.7);
}

/* --- Responsive Adjustments --- */
@media (max-width: 900px) {
    .card {
        aspect-ratio: auto;
        min-height: 80vh;
    }
    .logo-title {
        font-size: 54px;
    }
    .subtitle {
        font-size: 14px;
    }
    .header {
        padding: 20px 30px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px 5px;
    }
    .card {
        min-height: 85vh;
        border-radius: 20px;
        border-width: 4px;
    }
    
    /* Fix curtain branches getting cut off and blocking too much on mobile */
    .layer-ai-fg-left {
        background-size: cover; /* Maintain perfect aspect ratio */
        left: -30vw; /* Push excess branches off-screen to the left */
        clip-path: none; /* Not needed, image is so wide the right branches are cropped naturally */
    }
    .layer-ai-fg-right {
        background-size: cover; /* Maintain perfect aspect ratio */
        left: 30vw; /* Push excess branches off-screen to the right */
        clip-path: none; 
    }

    .logo-title {
        font-size: 42px;
    }
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    .nav {
        gap: 15px;
    }
    .nav-link {
        font-size: 13px;
    }
    .swaying-plant {
        display: none; /* Hide dense vegetation on tiny screens to improve FPS */
    }
}

/* Accessibility settings for users preferring reduced motion */
@media (prefers-reduced-motion: reduce) {
    .parallax-layer,
    .cloud,
    .swaying-plant,
    .wing-left,
    .wing-right,
    .butterfly,
    .rabbit-group,
    .ear-left,
    .ear-right,
    .mid-orange-bunny-1,
    .mid-orange-bunny-2,
    .rabbit,
    .sparkle {
        animation: none !important;
        transition: none !important;
        offset-path: none !important;
    }
}
