/* ===== IMPORTS ===== */
/* Self-hosted fonts loaded separately via fonts.css */

/* ===== CSS VARIABLES ===== */
:root {
    --animation-delay: 0s;
    --text-primary: rgba(44, 44, 44, 0.95);
    --text-secondary: rgba(44, 44, 44, 0.85);
    --text-accent: #5C4033;
    --text-charcoal-brown: #5C4033;
    --color-brown: #5C4033;
    --color-pink: #D88C9A;
}

/* ===== BLOG CATEGORY BUTTONS ===== */
/* Selected category state - uses pink to amber gradient for visibility */
.category-btn-selected {
    background: linear-gradient(to right, #f472b6, #fbbf24);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
    border-color: transparent;
}

/* Default category state */
.category-btn-default {
    background: linear-gradient(to right, #f3f4f6, #f9fafb);
    color: #1f2937;
    border: 1px solid #e5e7eb;
}

.category-btn-default:hover {
    background: linear-gradient(to right, #fdf2f8, #fffbeb);
    border-color: #f9a8d4;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

/* Base button styles */
.category-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Count badge within button */
.category-count {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.3);
}

.category-btn-default .category-count {
    background: rgba(209, 213, 219, 0.6);
}

/* ===== BASE STYLES ===== */
body {
    background: linear-gradient(270deg, #D88C9A, #FCEEEE, #FAFAFA, #F2E8CF, #5C4033, #FFDBD0, #C8D9A5, #E6D8FF, #FFE9A6, #D8ECFF, #D88C9A);
    background-size: 2000% 2000%;
    animation: gradientMove 60s ease-in-out infinite;
    animation-delay: var(--animation-delay);
    font-family: 'Inter', sans-serif;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
}

.hero-title {
    font-family: 'Dancing Script', cursive !important;
    font-weight: 600 !important;
    color: var(--text-charcoal-brown) !important;
    letter-spacing: 0.02em !important;
    text-shadow: 0 2px 20px rgba(255, 255, 255, 0.8) !important;
    font-size: 3.5rem !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
}

.section-title {
    font-weight: 400;
    color: var(--text-primary);
}

.body-text {
    color: var(--text-secondary);
    line-height: 1.7;
    font-weight: 300;
}

.mary-intro {
    font-family: 'Caveat', cursive;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== LAYOUT COMPONENTS ===== */
/* Header */
header {
    position: relative;
    z-index: 1;
}

.brand-logo {
    font-family: 'Caveat', cursive;
    font-weight: 600;
    color: #5C4033;
    letter-spacing: 0.02em;
}

.nav-link {
    font-family: 'Caveat', cursive;
    font-weight: 500;
    font-size: 2rem;
    color: #5C4033;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #D88C9A;
}

/* Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background-image: url('/images/optimized/desktop/background1-1920w.webp');
    background-image: -webkit-image-set(
        url('/images/optimized/desktop/background1-1920w.webp') type('image/webp'),
        url('/images/optimized/desktop/background1-1920w.jpg') type('image/jpeg')
    );
    background-image: image-set(
        url('/images/optimized/desktop/background1-1920w.webp') type('image/webp'),
        url('/images/optimized/desktop/background1-1920w.jpg') type('image/jpeg')
    );
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-text-container {
    margin-top: 40vh;
}

/* Services Page Background */
.services-background {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), url('/images/optimized/desktop/services_background-1920w.webp');
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), -webkit-image-set(
        url('/images/optimized/desktop/services_background-1920w.webp') type('image/webp'),
        url('/images/optimized/desktop/services_background-1920w.png') type('image/png')
    );
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), image-set(
        url('/images/optimized/desktop/services_background-1920w.webp') type('image/webp'),
        url('/images/optimized/desktop/services_background-1920w.png') type('image/png')
    );
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.services-content {
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

/* ===== ANIMATIONS ===== */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 50% 100%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 0%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem !important;
        line-height: 1.1 !important;
        white-space: normal !important;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .body-text {
        font-size: 1rem;
    }
}

@media (min-width: 1200px) {
    .hero-title {
        font-size: 4rem !important;
    }
}

/* ===== TESTIMONIALS CAROUSEL ===== */
.testimonials-carousel {
    max-width: 100%;
    position: relative;
    overflow: hidden; /* Prevent horizontal scroll */
}

.testimonials-track {
    width: 600%; /* 6 testimonials * 100% */
}

.testimonial-card {
    box-sizing: border-box;
}

.carousel-btn {
    z-index: 30;
    opacity: 0.9;
    border: 2px solid rgba(92, 64, 51, 0.1);
    backdrop-filter: blur(8px);
}

.carousel-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
    border-color: rgba(92, 64, 51, 0.2);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.15);
}

/* Ensure no horizontal overflow on page */
body, html {
    overflow-x: hidden;
}

/* Show arrows only when there's enough space */
@media (max-width: 640px) {
    .carousel-btn {
        display: none;
    }
}

.carousel-dot {
    background-color: var(--color-brown);
    opacity: 0.3;
    cursor: pointer;
}

.carousel-dot.active {
    opacity: 1;
    background-color: var(--color-pink);
}

.carousel-dot:hover {
    opacity: 0.7;
}

/* Responsive adjustments for carousel */
@media (min-width: 768px) {
    .testimonials-track {
        width: 300%; /* 6 testimonials / 2 per view = 3 * 100% */
    }
}

@media (min-width: 1024px) {
    .testimonials-track {
        width: 200%; /* 6 testimonials / 3 per view = 2 * 100% */
    }
}

/* ===== HOW IT WORKS SECTION ===== */
.how-it-works-step {
    position: relative;
    transition: transform 0.3s ease;
}

.how-it-works-step:hover {
    transform: translateY(-5px);
}

.step-number {
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-number span {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0.9;
    text-align: center;
    vertical-align: middle;
    margin-top: -3px; /* Adjust for Playfair Display font baseline */
    height: 100%;
    width: 100%;
}

.how-it-works-step:hover .step-number {
    background-color: var(--color-pink);
}

.how-it-works-step:hover .step-number span {
    color: white !important;
}

/* Add subtle animation to steps */
.how-it-works-step {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.how-it-works-step:nth-child(1) { animation-delay: 0.1s; }
.how-it-works-step:nth-child(2) { animation-delay: 0.2s; }
.how-it-works-step:nth-child(3) { animation-delay: 0.3s; }
.how-it-works-step:nth-child(4) { animation-delay: 0.4s; }
.how-it-works-step:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===== MOBILE MENU STYLES ===== */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    isolation: isolate; /* Create new stacking context */
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    background: linear-gradient(135deg, #FAFAFA 0%, #F2E8CF 50%, #FCEEEE 100%);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 10000 !important; /* Ensure content is also above everything */
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

.mobile-menu-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    color: var(--color-brown);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.mobile-nav {
    padding: 5rem 2rem 2rem;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li {
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(30px);
    animation: slideInFromRight 0.4s ease forwards;
}

.mobile-menu-overlay.active .mobile-nav-list li {
    opacity: 1;
    transform: translateX(0);
}

.mobile-nav-list li:nth-child(1) { animation-delay: 0.1s; }
.mobile-nav-list li:nth-child(2) { animation-delay: 0.15s; }
.mobile-nav-list li:nth-child(3) { animation-delay: 0.2s; }
.mobile-nav-list li:nth-child(4) { animation-delay: 0.25s; }
.mobile-nav-list li:nth-child(5) { animation-delay: 0.3s; }

.mobile-nav-link {
    display: block;
    padding: 1rem 1.5rem;
    font-family: 'Caveat', cursive;
    font-weight: 500;
    font-size: 1.75rem;
    color: var(--color-brown);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    background: rgba(255, 255, 255, 0.4);
    color: var(--color-pink);
    transform: translateX(10px);
}

.mobile-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: rgba(92, 64, 51, 0.1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.mobile-nav-link:hover::after {
    transform: scaleX(1);
}

/* Animation for menu items */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Hamburger button styling */
#mobile-menu-button {
    color: var(--color-brown);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

#mobile-menu-button:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Ensure header elements are properly sized on mobile */
@media (max-width: 767px) {
    header {
        padding: 1rem;
    }
    
    .brand-logo {
        font-size: 1.5rem;
    }
}

/* Responsive Background Images */
@media (max-width: 640px) {
    .hero-section::before {
        background-image: url('/images/optimized/mobile/background1-640w.webp');
        background-image: -webkit-image-set(
            url('/images/optimized/mobile/background1-640w.webp') type('image/webp'),
            url('/images/optimized/mobile/background1-640w.jpg') type('image/jpeg')
        );
        background-image: image-set(
            url('/images/optimized/mobile/background1-640w.webp') type('image/webp'),
            url('/images/optimized/mobile/background1-640w.jpg') type('image/jpeg')
        );
    }
    
    .services-background {
        background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), url('/images/optimized/mobile/services_background-640w.webp');
        background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), -webkit-image-set(
            url('/images/optimized/mobile/services_background-640w.webp') type('image/webp'),
            url('/images/optimized/mobile/services_background-640w.png') type('image/png')
        );
        background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), image-set(
            url('/images/optimized/mobile/services_background-640w.webp') type('image/webp'),
            url('/images/optimized/mobile/services_background-640w.png') type('image/png')
        );
        background-size: cover;
        background-position: center;
        background-attachment: scroll; /* Fixed attachment doesn't work well on mobile */
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .hero-section::before {
        background-image: url('/images/optimized/tablet/background1-1024w.webp');
        background-image: -webkit-image-set(
            url('/images/optimized/tablet/background1-1024w.webp') type('image/webp'),
            url('/images/optimized/tablet/background1-1024w.jpg') type('image/jpeg')
        );
        background-image: image-set(
            url('/images/optimized/tablet/background1-1024w.webp') type('image/webp'),
            url('/images/optimized/tablet/background1-1024w.jpg') type('image/jpeg')
        );
    }
    
    .services-background {
        background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), url('/images/optimized/tablet/services_background-1024w.webp');
        background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), -webkit-image-set(
            url('/images/optimized/tablet/services_background-1024w.webp') type('image/webp'),
            url('/images/optimized/tablet/services_background-1024w.png') type('image/png')
        );
        background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)), image-set(
            url('/images/optimized/tablet/services_background-1024w.webp') type('image/webp'),
            url('/images/optimized/tablet/services_background-1024w.png') type('image/png')
        );
        background-size: cover;
        background-position: center;
    }
}

/* Lazy loaded background images */
.lazy-bg-loaded {
    transition: opacity 0.3s ease-in-out;
}

/* ===== IMAGE LOADING OPTIMIZATIONS ===== */

/* Placeholder for lazy loaded images */
img[data-src], img[data-lazy] {
    background: linear-gradient(45deg, #f3f4f6 25%, transparent 25%, transparent 75%, #f3f4f6 75%, #f3f4f6),
                linear-gradient(45deg, #f3f4f6 25%, transparent 25%, transparent 75%, #f3f4f6 75%, #f3f4f6);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* Image loading states for blur-up effect */
img.image-loading {
    opacity: 0.6;
    filter: blur(5px);
    transform: scale(1.05);
    transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

img.image-loaded {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

img.image-error {
    opacity: 0.5;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

/* Prevent layout shift with aspect ratio containers */
.aspect-ratio-container {
    position: relative;
    width: 100%;
}

.aspect-ratio-container::before {
    content: '';
    display: block;
    padding-top: var(--aspect-ratio, 75%); /* Default 4:3 */
}

.aspect-ratio-container > img,
.aspect-ratio-container > picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Critical image loading optimization */
img[fetchpriority="high"] {
    content-visibility: visible;
}

/* Smooth image reveal animation */
@keyframes imageReveal {
    from {
        opacity: 0;
        transform: scale(1.05);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

.image-reveal {
    animation: imageReveal 0.6s ease-out forwards;
}

/* Picture element enhancements */
picture {
    display: block;
    line-height: 0; /* Remove default spacing */
}

picture img {
    width: 100%;
    height: auto;
    vertical-align: top;
}
