/* --- CSS Variables & Reset --- */
:root {
    /* Colors extracted from the reference image */
    --bg-color: #F4F1E8; /* Creamy, textured paper look */
    --text-dark: #42332B; /* Deep sepia/dark brown */
    --text-accent: #B34D3E; /* Muted vintage red */
    
    /* Fonts */
    --font-heading: 'Playfair Display', serif; /* For main decorative titles */
    --font-body: 'Playfair Display', serif; /* For navigation and body text */
}

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

body {
    background-color: var(--bg-color);
    /* Paper texture: Layer 1 (Coarse grain), Layer 2 (Vertical Fibrous structure) */
    background-image: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.3' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter2'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.1 0.02' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter2)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 300px 300px, 500px 500px;
    color: var(--text-dark);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip; 
    overflow-y: visible;
}

/* --- Header & Navigation --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 60px;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 120px; /* Adjust height as needed */
    width: auto;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 40px;
}

nav a {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 500;
}

.nav-icons {
    display: flex;
    gap: 25px;
    align-items: center;
}

/* Styling SVG icons to match text color */
.nav-icons svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-dark);
    stroke-width: 1.5;
    fill: none;
    cursor: pointer;
}

/* --- Hero Section --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 40px;
}

h1 {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    line-height: 1.1;
    max-width: 900px;
    margin-bottom: 30px;
    font-weight: 400;
}

main > h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    line-height: 1.2;
    max-width: 900px;
    margin-bottom: 30px;
    font-weight: 400;
    padding: 0 20px;
}

/* The specific red accent styling */
.accent-red {
    color: var(--text-accent);
}

p.subtitle {
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin-bottom: 50px;
    color: var(--text-dark);
}

/* --- The Button --- */
.cta-button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--text-dark);
    color: var(--bg-color);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.2s ease;
    padding: 0;
    margin-bottom: 50px;
}

.cta-button:hover {
    transform: scale(1.05);
}

.button-text {
    margin-right: 0;
    text-align: center;
    font-size: 1.2rem;
    line-height: 1.1;
}

.button-icon-circle {
    background-color: transparent;
    width: auto;
    height: auto;
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-icon-circle svg {
    width: 16px;
    height: 16px;
    stroke: var(--bg-color);
    stroke-width: 2;
}

/* --- The Main Wreath Image --- */
.hero-image-container {
    margin-top: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 50px;
    position: relative;
}

/* NOTE: You must have the 'wreath.png' file in the same folder */
.hero-image-container img {
    max-width: 500px;
    width: 50%;
    height: auto;
    display: block;
}

/* Optional: A little sparkle in the bottom right corner like the reference */
.sparkle {
    position: fixed;
    bottom: 30px;
    right: 40px;
    opacity: 0.6;
}

/* --- Products Section --- */
#produkty {
    padding: 60px 20px;
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#produkty h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-align: center;
    font-style: italic;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
}

.product-item {
    background-color: #fff;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
    position: relative;
    cursor: pointer; /* Enable click events on iOS */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.product-item.ratio-9-16 {
    aspect-ratio: 9/16;
}

.product-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Hover effect styles */
.product-item .hover-img {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 2;
}

/* Desktop hover effects */
@media (hover: hover) {
    .product-item:hover {
        transform: translateY(-5px);
    }
    
    .product-item:hover .hover-img {
        opacity: 1;
    }
}

/* Mobile/Active state effects */
.product-item.active {
    transform: translateY(-5px);
}

.product-item.active .hover-img {
    opacity: 1;
}

/* --- Contact Section --- */
#kontakt {
    padding: 60px 20px 100px;
    width: 100%;
    max-width: 800px;
    text-align: center;
    font-style: italic;
}

#kontakt h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.form-group label {
    font-family: var(--font-body);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
}

.submit-btn {
    background-color: var(--text-dark);
    color: var(--bg-color);
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    align-self: center;
    margin-top: 10px;
    transition: opacity 0.2s;
}

.submit-btn:hover {
    opacity: 0.9;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-btn svg {
    width: 30px;
    height: 30px;
    stroke: var(--text-dark);
    stroke-width: 2;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 900px) {
    header {
        padding: 20px;
        position: relative;
    }

    .mobile-menu-btn {
        display: block;
    }

    nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-color);
        padding: 20px 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        display: none;
        z-index: 1000;
        border-top: 1px solid rgba(66, 51, 43, 0.1);
    }

    nav.active {
        display: block;
    }

    nav ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    h1 {
        font-size: 2.2rem;
        padding: 0 20px;
    }

    main > h2 {
        font-size: 1.3rem;
        padding: 0 20px;
        line-height: 1.4;
    }

    #produkty h2, #kontakt h2 {
        font-size: 1.8rem;
    }

    /* --- THE STACKING LOGIC STARTS HERE --- */
    .product-grid {
        display: flex;
        flex-direction: column;
        gap: 20px; /* Space between cards before they stick */
        padding-bottom: 50px;
    }

    .product-item {
        /* 1. Make it sticky */
        position: -webkit-sticky;
        position: sticky;
        
        /* 2. Visual styling for the stack */
        background: white; /* Important so cards hide what's behind them */
        z-index: 1;
        box-shadow: 0 -10px 20px rgba(0,0,0,0.1); /* Shadow helps define the edge */
        
        /* 3. Ensure they are tall enough to scroll */
        height: auto; 
        
        /* Reset any transform that might conflict */
        transform: none !important; 
    }

    /* 4. INCREMENTAL OFFSETS 
       This makes the previous image peek out by 30px */
    .product-item:nth-child(1) { top: 80px; }
    .product-item:nth-child(2) { top: 110px; }
    .product-item:nth-child(3) { top: 140px; }
    .product-item:nth-child(4) { top: 170px; }
    .product-item:nth-child(5) { top: 200px; }
    .product-item:nth-child(6) { top: 230px; }
    .product-item:nth-child(7) { top: 260px; }
    .product-item:nth-child(8) { top: 290px; }
    .product-item:nth-child(9) { top: 320px; }
    .product-item:nth-child(10) { top: 350px; }

    /* Fix for Cennik vertical images on mobile */
    .product-item.ratio-9-16 {
        height: auto;
        aspect-ratio: 9/16;
    }
}

/* Lightbox Styles */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#lightbox.active {
    opacity: 1;
    pointer-events: all;
}

#lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 2001;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    padding: 20px;
    z-index: 2001;
    user-select: none;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}