:root {
    --primary: #f2d6d2;            /* Das exakte Rosa aus dem Logo */
    --primary-light: #fdf5f4;      /* Sehr helles, zartes Rosa für Akzente */
    --primary-dark: #b88b85;       /* Komplementärer, dunklerer Rosaton */
    --accent: #d4af37;             /* Edles Gold für Schmuck-Akzente */
    --bg-dark: #1f181a;            /* Sehr dunkles, warmes Braun-Schwarz */
    --bg-card: #ffffff;            /* Weiße Karten */
    --bg-light: #faf7f5;           /* Weiches Alabaster-Weiß */
    --text-light: #ffffff;
    --text-dark: #2a2022;          /* Dunkelbraun-Grau statt hartem Schwarz */
    --text-muted: #8c7b7f;
    --text-muted-light: #dfd5d7;
    --border-dark: #3a2e31;
    --border-light: #ede6e7;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', system-ui, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header & Typography */
h1, h2, h3, h4, .brand-font {
    font-family: var(--font-serif);
    font-weight: 400;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Navigation Layout */
header {
    background-color: var(--primary); /* Muted rosenholz pink */
    color: #1f181a;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--primary-dark);
    height: 75px; /* Festgelegte Höhe des Balkens auf 75px reduziert */
    transition: var(--transition);
}

header.scrolled {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); /* Schlagschatten beim Scrollen */
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%; /* Füllt die 75px komplett aus */
    padding: 0 3.5rem 0 2rem;
}

.logo-link {
    display: flex;
    align-items: center;
    position: relative;
    height: 75px; /* Füllt die Headerhöhe voll aus */
}

.logo-link img {
    position: absolute;
    left: 0;
    z-index: 110;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.logo-large {
    height: auto;
    width: auto;
    max-height: 112px;
    opacity: 1;
    visibility: visible;
    top: -1px; /* 1 Pixel nach unten verschoben (von -2px) */
}

.logo-small {
    height: 76px; /* 76 Pixel hoch, um den 75px Balken um genau 1px zu überlappen */
    width: auto;
    opacity: 0;
    visibility: hidden;
    top: -1px; /* 1 Pixel nach oben verschoben (von 0px) */
}

/* Scroll-Effekt für die Logos */
header.scrolled .logo-large {
    opacity: 0;
    visibility: hidden;
}

header.scrolled .logo-small {
    opacity: 1;
    visibility: visible;
}

/* Platzhalter für das absolute Logo, damit das Menü nicht verschoben wird */
.logo-placeholder {
    width: 175px; 
    height: 75px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

nav ul li a {
    font-family: var(--font-serif);
    font-size: 1.1rem; /* Slightly larger for the serif typeface readability */
    font-weight: 400;
    letter-spacing: 0.5px;
    color: #1f181a; /* Dunkler Text auf dem rosenholz-farbenen Balken */
}

nav ul li a:hover, nav ul li a.active {
    color: var(--text-light); /* Weißer Hover-Effekt */
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    position: relative;
    background: linear-gradient(rgba(31, 24, 26, 0.4), rgba(31, 24, 26, 0.5)), url('../uploads/atelier_hero.jpg') center/cover no-repeat;
    height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

.hero-content {
    max-width: 800px;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.hero-content p {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--primary-light);
    font-style: italic;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.btn-primary {
    display: inline-block;
    padding: 0.8rem 2rem;
    background-color: var(--primary);
    color: #1f181a;
    font-weight: 600;
    border: 1px solid var(--primary);
    border-radius: 4px;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: transparent;
    color: var(--primary);
}

/* Container & Sections */
section {
    padding: 5rem 2rem;
}

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

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    color: var(--text-dark);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background-color: var(--primary);
    margin: 1rem auto 0;
}

/* Over Mij Grid */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 4rem;
    align-items: center;
}

.about-img img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* Portfolio Filters & Cards */
.filters {
    display: flex;
    justify-content: center;
    gap: 0.35rem; /* Narrow gap between items */
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: none;
    border: 1px solid var(--border-light);
    padding: 0.4rem 0.75rem; /* Extremely tight padding to fit 9 items in one row */
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition);
    border-radius: 30px;
    color: var(--text-muted);
    font-size: 0.88rem; /* Small compact text size */
    white-space: nowrap; /* Prevent wrap within the button */
}

.filter-btn:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #1f181a;
}

.filter-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #1f181a;
    transform: scale(1.06); /* Scale selected button up subtly to make it pop */
    font-weight: 600; /* Make the active category text bolder */
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.portfolio-card {
    background-color: var(--bg-card);
    border-radius: 8px;
    overflow: visible; /* Allowed to overflow on slide-down hover */
    box-shadow: 0 2px 8px rgba(42,32,34,0.04);
    transition: var(--transition);
    border: 1px solid #f3ecee;
    position: relative;
    display: flex;
    flex-direction: column;
}

.portfolio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 12px rgba(42,32,34,0.06);
    z-index: 10; /* Bring hovered card above adjacent cards */
}

.portfolio-img-wrapper {
    aspect-ratio: 1/1;
    overflow: hidden;
    position: relative;
    border-radius: 8px 8px 0 0;
}

.portfolio-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.portfolio-card:hover .portfolio-img-wrapper img {
    scale: 1.05;
}

.portfolio-info-wrapper {
    position: relative;
    background-color: var(--bg-card);
    border-radius: 0 0 8px 8px;
    border-top: 1px solid #f3ecee;
    height: 120px; /* Locked fixed height so rows never shift or overlap */
}

.portfolio-info {
    padding: 1.2rem;
    background-color: var(--bg-card);
    border-radius: 0 0 8px 8px;
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    max-height: 120px; /* Matches fixed wrapper height */
    overflow: hidden; /* Standard text cropped inside the boundaries */
    transition: max-height 0.25s ease, box-shadow 0.25s ease, border-radius 0.25s ease;
    box-sizing: border-box;
}

/* More link hover expansion style overrides */
.portfolio-info.expanded {
    z-index: 20;
    max-height: 400px !important; /* Allows text block to slide down on hover, overriding column limits */
    height: auto !important;
    min-height: 100% !important; /* Never shrinks smaller than the normal box height */
    overflow: visible !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15) !important;
    border-radius: 0 0 8px 8px !important;
    border: 1px solid var(--primary-light) !important;
    border-top: none !important;
}

.desc-container {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0.25rem 0 0.5rem;
    line-height: 1.4;
}

.more-link {
    color: var(--primary-dark);
    font-weight: 500;
    margin-left: 0.35rem;
    text-decoration: underline;
    font-size: 0.9rem;
    cursor: pointer;
}

.more-link:hover {
    color: var(--text-dark);
}

.portfolio-info h3 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 1.15rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Truncate titles to max 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Dynamic Column Font Size Rules (Desktop screens >= 993px) --- */
@media (min-width: 993px) {
    /* 3 Columns - Larger text space */
    .portfolio-grid.cols-3 .portfolio-info-wrapper {
        height: 130px;
    }
    .portfolio-grid.cols-3 .portfolio-info {
        max-height: 130px;
        padding: 1.2rem;
    }
    .portfolio-grid.cols-3 .portfolio-info h3 {
        font-size: 1.2rem;
    }
    .portfolio-grid.cols-3 .desc-container {
        font-size: 0.98rem;
    }
    
    /* 4 Columns - Standard (matches default) */
    .portfolio-grid.cols-4 .portfolio-info-wrapper {
        height: 120px;
    }
    .portfolio-grid.cols-4 .portfolio-info {
        max-height: 120px;
        padding: 1rem;
    }
    .portfolio-grid.cols-4 .portfolio-info h3 {
        font-size: 1.05rem;
    }
    .portfolio-grid.cols-4 .desc-container {
        font-size: 0.92rem;
    }

    /* 5 Columns - Extra compact text sizing to prevent overflow */
    .portfolio-grid.cols-5 .portfolio-info-wrapper {
        height: 110px;
    }
    .portfolio-grid.cols-5 .portfolio-info {
        max-height: 110px;
        padding: 0.8rem;
    }
    .portfolio-grid.cols-5 .portfolio-info h3 {
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }
    .portfolio-grid.cols-5 .desc-container {
        font-size: 0.82rem;
        line-height: 1.3;
    }
    .portfolio-grid.cols-5 .more-link {
        font-size: 0.8rem;
    }
}

/* Before / After Slider */
.slider-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4/3;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.slider-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.slider-before {
    z-index: 10;
    width: 50%;
}

.slider-after {
    z-index: 5;
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary);
    left: 50%;
    z-index: 20;
    cursor: ew-resize;
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #1f181a;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    user-select: none;
}

/* Testimonial Board */
.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.testimonial-card {
    background-color: #ffffff;
    padding: 3.5rem 2.5rem 2.5rem; /* Increased top padding to accommodate star safely */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(42,32,34,0.03);
    border: 1px solid #f3ecee;
    position: relative;
}

.stars {
    color: var(--accent); /* Golden accent color */
    font-size: 1.6rem; /* Larger star size */
    position: absolute;
    top: 0.8rem;
    left: 1rem; /* Pushed closer to the corner edge */
}

.testimonial-author {
    margin-top: 1.5rem;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--primary-dark);
}

/* Contact Grid */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 4rem;
}

.contact-info h3 {
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.contact-info p {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-family: var(--font-sans);
    background-color: #ffffff;
    color: var(--text-dark);
}

.form-group input:focus, .form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 5px rgba(212, 163, 179, 0.3);
}

/* Footer styling */
footer {
    background-color: #1f181a;
    color: var(--text-light);
    text-align: center;
    padding: 4rem 2rem;
    border-top: 1px solid var(--border-dark);
}

footer .brand-font {
    font-family: 'Quicksand', var(--font-sans);
    font-weight: 300;
    letter-spacing: 5px;
    text-transform: uppercase;
    font-size: 2.4rem !important;
}

footer p {
    color: var(--text-muted-light);
    opacity: 0.8;
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(31, 24, 26, 0.95); /* Deep dark background */
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(8px);
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 1200px;
    width: 100%;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    animation: zoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    display: block;
}

/* Override global .slider-container rules for the lightbox variant */
#lightboxSlider {
    max-width: 100% !important;
    aspect-ratio: unset !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    height: 600px !important;
}

.lightbox-caption {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.lightbox-caption h3 {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.lightbox-caption p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #4a3a3c;
    margin-bottom: 1.5rem;
}

.lightbox-badge {
    display: inline-block;
    align-self: flex-start;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    background: var(--primary);
    color: var(--text-dark);
    border-radius: 4px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2.5rem;
    color: #ffffff;
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    z-index: 10000;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 4px rgba(0, 0, 0, 0.9); /* Deep contrast drop-shadow */
}

.lightbox-close:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* Lightbox navigation arrows */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(31, 24, 26, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
    z-index: 10000;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.lightbox-arrow:hover {
    background: var(--primary);
    color: var(--text-dark);
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-arrow:active {
    transform: translateY(-50%) scale(0.96);
}

.lightbox-arrow.disabled,
.lightbox-arrow:disabled {
    background: rgba(120, 120, 120, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    cursor: default !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: translateY(-50%) !important;
}

.lightbox-arrow-left {
    left: 2rem;
}

.lightbox-arrow-right {
    right: 2rem;
}

@media (max-width: 768px) {
    .lightbox-arrow {
        width: 46px;
        height: 46px;
        font-size: 1.6rem;
    }
    .lightbox-arrow-left {
        left: 0.8rem;
    }
    .lightbox-arrow-right {
        right: 0.8rem;
    }
}

.portfolio-card {
    cursor: pointer;
    transition: transform 0.3s var(--transition), box-shadow 0.3s var(--transition);
}

.portfolio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 12px rgba(42,32,34,0.06);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Responsive Lightbox */
@media (max-width: 768px) {
    .lightbox-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .lightbox-img {
        height: 350px;
    }
    
    .lightbox-caption {
        padding: 2rem 1.5rem;
    }
    
    .lightbox-close {
        top: 1rem;
        right: 1.5rem;
    }
}

/* Admin / CMS Styles */
.admin-card {
    background: #ffffff;
    max-width: 500px;
    margin: 5rem auto;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th, .admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.action-btn {
    padding: 0.4rem 1rem;
    background-color: var(--primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.action-btn.delete {
    background-color: #ff4d4d;
    color: white;
}

.action-btn.approve {
    background-color: #2ec4b6;
    color: white;
}

/* Crop Area */
.crop-container {
    max-width: 100%;
    max-height: 400px;
    overflow: hidden;
    margin-bottom: 1rem;
}

@media (max-width: 992px) {
    /* Tablet & Desktop spacing optimizations */
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    }
}

/* Transmutation Slider Grid */
.transmutation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    margin-bottom: 5rem;
}

@media (max-width: 768px) {
    /* Main layout elements grid adaptions */
    .about-grid, .contact-grid, .transmutation-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    /* Mobil menu button toggler style enhancements */
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        color: #1f181a; /* Dark contrast color matching the bar */
        font-size: 2rem;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 120;
        transition: transform 0.2s ease;
        position: absolute;
        right: 1.5rem; /* Forces button to align strictly 1.5rem from right window edge */
        top: 50%;
        transform: translateY(-50%);
    }
    
    .menu-toggle:focus {
        outline: 2px solid var(--primary-dark);
        border-radius: 4px;
    }

    /* Mobile menu layout overlay styling */
    nav ul {
        display: none;
        flex-direction: column;
        align-items: flex-start !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #1f181a; /* Dark contrasting background for links legibility */
        padding: 2rem;
        border-bottom: 3px solid var(--primary);
        gap: 1.5rem !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    }
    
    nav ul.show {
        display: flex;
    }
    
    .hero {
        height: auto;
        min-height: 60vh;
        padding: 4rem 1.5rem 8rem; /* Extra bottom padding to clear the overlapping categories grid */
    }

    .hero-content h1 {
        font-size: 2.2rem !important;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    .hero-content p {
        font-size: 1.1rem !important;
        margin-bottom: 1.5rem;
        line-height: 1.4;
    }
    
    nav ul li {
        width: 100%;
    }
    
    nav ul li a {
        font-size: 1.2rem !important;
        color: var(--text-light) !important; /* White color for contrast in dark overlay */
        display: block;
        padding: 0.5rem 0;
        width: 100%;
    }
    
    nav ul li a:hover, nav ul li a.active {
        color: var(--primary) !important;
    }
    
    /* Mobil filter & media optimizations */
    .filters {
        display: flex !important;
        gap: 0.5rem 0.6rem;
        margin-bottom: 2rem;
        flex-wrap: wrap !important; /* Wrap into multiple lines */
        justify-content: center !important; /* Center the buttons */
        padding: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }
    
    .filter-btn {
        padding: 0.4rem 0.9rem !important;
        font-size: 0.82rem !important;
        white-space: nowrap; /* Prevent button text wrap */
        border-radius: 20px;
        flex-shrink: 0;
        margin: 0 !important;
    }
    
    #media-swap-wrapper {
        aspect-ratio: 1/1 !important;
        max-width: 450px;
        margin: 0 auto;
    }
}

/* Homepage Horizontal Slider Carousel */
.home-carousel-container {
    position: relative;
    width: 100%;
    overflow: visible;  /* Prevent clipping on hover */
}

.home-carousel-viewport {
    overflow-x: auto;
    scroll-behavior: smooth;
    display: flex;
    gap: var(--carousel-gap, 1.5rem);
    padding: 2rem 0.5rem; /* Standard top/bottom space for vertical hover, slight side padding */
    scrollbar-width: none; /* Firefox */
    -webkit-overflow-scrolling: touch;
}

.home-carousel-viewport::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.home-carousel-item {
    box-sizing: border-box;
    padding: 0.5rem; /* Inner padding inside flex items provides shadow space at viewport edges */
    min-width: 160px; /* Sensible mobile boundary limit */
    
    /* Default for desktop: use custom variable if count is <= 6, fallback to 6 items width if > 6 */
    --items-in-row: var(--carousel-items, 6);
    flex: 0 0 calc((100% - ((var(--items-in-row) - 1) * var(--carousel-gap, 1rem))) / var(--items-in-row));
}

/* For slider layout on desktop, cap the visible items in a row to 6 max */
@media (min-width: 1201px) {
    .home-carousel-viewport[style*="--carousel-items"] .home-carousel-item {
        --items-limit: var(--carousel-items);
        --items-in-row: var(--items-limit);
    }
    
    /* If there are more than 6 items, show exactly 6 and hide the rest horizontally */
    .home-carousel-viewport .home-carousel-item {
        flex: 0 0 calc((100% - (5 * var(--carousel-gap, 1rem))) / 6);
    }
    
    /* If count is <= 6, apply dynamic width spacing so all items fit the row */
    .home-carousel-viewport[style*="--carousel-items"] .home-carousel-item {
        /* CSS hack to apply inline width calculations only if items count <= 6 */
        flex: 0 0 calc((100% - ((var(--carousel-items) - 1) * var(--carousel-gap, 1rem))) / var(--carousel-items));
    }
    
    /* Re-evaluate for count > 6: if count > 6, override back to exactly 6 items width */
    .home-carousel-viewport .home-carousel-item:nth-last-child(n+7),
    .home-carousel-viewport .home-carousel-item:nth-last-child(n+7) ~ .home-carousel-item {
        flex: 0 0 calc((100% - (5 * var(--carousel-gap, 1rem))) / 6);
    }
}

/* Fallback for fewer items or smaller screens */
@media (max-width: 1200px) {
    .home-carousel-item {
        flex: 0 0 calc((100% - (3 * var(--carousel-gap, 1rem))) / 4) !important; /* 4 items */
    }
}

@media (max-width: 768px) {
    .home-carousel-item {
        flex: 0 0 calc((100% - (1 * var(--carousel-gap, 1rem))) / 2) !important; /* 2 items */
    }
}

/* Navigation Arrow Controls */
.carousel-arrow {
    position: absolute;
    top: calc(50% - 20px);
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    color: #1f181a;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.carousel-arrow:hover {
    background-color: var(--primary-dark);
    color: white;
}

.carousel-arrow.prev {
    left: -20px;
}

.carousel-arrow.next {
    right: -20px;
}

@media (max-width: 768px) {
    /* Hide arrows on mobile touch devices */
    .carousel-arrow {
        display: none !important;
    }
}
