/* House Of Tiles & Bathware LLP - Global Design System */

:root {
    --primary-color: #1A1A1A; /* Sophisticated Dark Gray */
    --accent-color: #D4A64A;
    --bg-color: #FFFFFF;
    --text-color: #444444; /* Slightly softer text */
    --light-gray: #F4F4F4;
    --medium-gray: #2A2A2A; /* For footer and dark sections */
    --heading-font: 'Poppins', sans-serif;
    --body-font: 'Poppins', sans-serif;
    --transition-smooth: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    --container-width: 1200px;
    --header-height: 80px;

    /* Animation tokens */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --duration-enter: 0.9s;
    --duration-hover: 0.45s;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    font-weight: 300; /* Lighter for elegance */
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding-top: var(--header-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: var(--heading-font);
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
    letter-spacing: -0.02em; /* Modern tight spacing */
}

h1 { letter-spacing: -0.04em; } /* More architectural */

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--duration-hover) var(--ease-out-quart);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
}

/* Typography Utility */
.section-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 4rem;
    position: relative;
    padding-bottom: 1.5rem;
    font-weight: 700;
    text-transform: capitalize;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.6s var(--ease-out-expo);
}

.section-title:hover::after {
    width: 80px;
}

.text-center { text-align: center; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 1.2rem 3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: 
        background-color var(--duration-hover) var(--ease-out-quart),
        color var(--duration-hover) var(--ease-out-quart),
        border-color var(--duration-hover) var(--ease-out-quart),
        transform 0.3s var(--ease-out-expo),
        box-shadow 0.3s var(--ease-out-expo);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 8px 25px rgba(212, 166, 74, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-dark {
    background-color: var(--medium-gray);
    color: #fff;
}

.btn-dark:hover {
    background-color: var(--accent-color);
}

/* Layout Components */
.section-padding {
    padding: 10rem 0;
}

.dark-section {
    background-color: var(--medium-gray);
    color: rgba(255,255,255,0.9);
}

.dark-section h1, .dark-section h2, .dark-section h3 {
    color: #fff;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: 
        padding 0.4s var(--ease-out-quart),
        background-color 0.4s var(--ease-out-quart),
        box-shadow 0.4s var(--ease-out-quart);
}

.main-header.scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.main-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    display: block;
    max-width: 180px; /* Adjust based on preferred logo size */
}

.logo img {
    width: 100%;
    height: auto;
    display: block;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: #777;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--accent-color);
    transition: width 0.4s var(--ease-out-expo);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-color);
}

.mobile-menu-toggle {
    display: none;
}

/* Page Hero (Subpages) */
.page-hero {
    background-color: var(--medium-gray);
    color: #fff;
    padding: 8rem 0;
    text-align: center;
    overflow: hidden;
    /* Smooth rendering for background images */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.page-hero h1 {
    color: #fff;
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.breadcrumb {
    color: var(--accent-color);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
    display: block;
}

/* Fix: background-attachment:fixed causes jank on mobile/touch devices.
   Degrade gracefully to scroll for smooth performance. */
@supports (-webkit-touch-callout: none) {
    .page-hero,
    .dark-section {
        background-attachment: scroll !important;
    }
}

@media (max-width: 992px) {
    .page-hero,
    .dark-section {
        background-attachment: scroll !important;
    }
}

/* Footer */
.main-footer {
    background-color: var(--primary-color);
    color: rgba(255,255,255,0.6);
    padding: 8rem 0 4rem;
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 6rem;
}

.main-footer h4 {
    color: #fff;
    margin-bottom: 2rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 600;
}

.main-footer p, .main-footer li {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.main-footer a {
    color: rgba(255,255,255,0.5);
}

.main-footer a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 4rem;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================================================
   Cards & Grids — GPU-accelerated smooth animations
   ============================================================ */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.premium-card {
    background-color: var(--light-gray);
    overflow: hidden;
    transition: 
        transform var(--duration-hover) var(--ease-out-expo),
        box-shadow var(--duration-hover) var(--ease-out-expo);
    will-change: transform;
}

.premium-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.card-img {
    height: 300px;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-hover) var(--ease-out-expo);
    will-change: transform;
    /* Force GPU layer for smooth scaling */
    transform: translateZ(0) scale(1);
    backface-visibility: hidden;
}

.premium-card:hover .card-img img {
    transform: translateZ(0) scale(1.08);
}

.card-body {
    padding: 2rem;
}

/* ============================================================
   Scroll Animations — Buttery entrance effects
   ============================================================ */
.fade-up {
    opacity: 0;
    transform: translate3d(0, 50px, 0);
    transition: 
        opacity var(--duration-enter) var(--ease-out-expo),
        transform var(--duration-enter) var(--ease-out-expo);
    will-change: opacity, transform;
}

.fade-up.active {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Staggered delays for cards in grids — creates a cascading reveal */
.grid-3 .fade-up:nth-child(1) { transition-delay: 0s; }
.grid-3 .fade-up:nth-child(2) { transition-delay: 0.12s; }
.grid-3 .fade-up:nth-child(3) { transition-delay: 0.24s; }
.grid-3 .fade-up:nth-child(4) { transition-delay: 0.08s; }
.grid-3 .fade-up:nth-child(5) { transition-delay: 0.16s; }
.grid-3 .fade-up:nth-child(6) { transition-delay: 0.24s; }

/* Image reveal animation — smooth fade-in when lazy images load */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.6s var(--ease-out-quart);
}

img[loading="lazy"].img-loaded {
    opacity: 1;
}

/* ============================================================
   Gallery — Masonry with smooth image hover
   ============================================================ */
.masonry-gallery,
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    height: 300px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-hover) var(--ease-out-expo),
                filter var(--duration-hover) var(--ease-out-quart);
    /* Force GPU compositing for jank-free hover */
    transform: translateZ(0) scale(1);
    backface-visibility: hidden;
    will-change: transform;
}

.gallery-item:hover img {
    transform: translateZ(0) scale(1.06);
    filter: brightness(0.85);
}

/* Subtle overlay on hover */
.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.25) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--duration-hover) var(--ease-out-quart);
    pointer-events: none;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Staggered gallery reveals */
.masonry-gallery .fade-up:nth-child(1),
.gallery-grid .fade-up:nth-child(1) { transition-delay: 0s; }
.masonry-gallery .fade-up:nth-child(2),
.gallery-grid .fade-up:nth-child(2) { transition-delay: 0.08s; }
.masonry-gallery .fade-up:nth-child(3),
.gallery-grid .fade-up:nth-child(3) { transition-delay: 0.16s; }
.masonry-gallery .fade-up:nth-child(4),
.gallery-grid .fade-up:nth-child(4) { transition-delay: 0.24s; }
.masonry-gallery .fade-up:nth-child(5),
.gallery-grid .fade-up:nth-child(5) { transition-delay: 0.10s; }
.masonry-gallery .fade-up:nth-child(6),
.gallery-grid .fade-up:nth-child(6) { transition-delay: 0.18s; }
.masonry-gallery .fade-up:nth-child(7),
.gallery-grid .fade-up:nth-child(7) { transition-delay: 0.26s; }
.masonry-gallery .fade-up:nth-child(8),
.gallery-grid .fade-up:nth-child(8) { transition-delay: 0.12s; }
.masonry-gallery .fade-up:nth-child(9),
.gallery-grid .fade-up:nth-child(9) { transition-delay: 0.20s; }

/* ============================================================
   Lightbox — Smooth open/close with backdrop blur
   ============================================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    visibility: hidden;
    transition: 
        background-color 0.5s var(--ease-out-quart),
        backdrop-filter 0.5s var(--ease-out-quart),
        -webkit-backdrop-filter 0.5s var(--ease-out-quart),
        visibility 0s 0.5s;
    cursor: zoom-out;
}

.lightbox.active {
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    visibility: visible;
    transition: 
        background-color 0.5s var(--ease-out-quart),
        backdrop-filter 0.5s var(--ease-out-quart),
        -webkit-backdrop-filter 0.5s var(--ease-out-quart),
        visibility 0s 0s;
}

.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    opacity: 0;
    transform: scale(0.92) translate3d(0, 20px, 0);
    transition: 
        opacity 0.5s var(--ease-out-expo) 0.05s,
        transform 0.5s var(--ease-out-expo) 0.05s;
}

.lightbox.active img {
    opacity: 1;
    transform: scale(1) translate3d(0, 0, 0);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 
        background-color 0.3s var(--ease-out-quart),
        transform 0.3s var(--ease-out-expo);
    opacity: 0;
}

.lightbox.active .lightbox-close {
    opacity: 1;
    transition: 
        opacity 0.4s var(--ease-out-quart) 0.2s,
        background-color 0.3s var(--ease-out-quart),
        transform 0.3s var(--ease-out-expo);
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

/* ============================================================
   Floating WhatsApp Button
   ============================================================ */
.floating-whatsapp {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #25D366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: transform 0.3s var(--ease-out-expo),
                box-shadow 0.3s var(--ease-out-quart);
    animation: float-pulse 2s infinite;
}

.floating-whatsapp:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

@keyframes float-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Sticky Mobile CTA */
.mobile-sticky-cta {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.mobile-sticky-cta a {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: white;
}

.mobile-sticky-cta .call {
    background-color: var(--primary-color);
}

.mobile-sticky-cta .whatsapp {
    background-color: #25D366;
}

/* Interactive hover styles for other main body images that are previewable */
main img:not(.logo img):not([src*="logo.png"]):not(.card-img img):not(.gallery-item img) {
    cursor: zoom-in;
    transition: transform var(--duration-hover) var(--ease-out-expo), box-shadow var(--duration-hover) var(--ease-out-expo);
}

main img:not(.logo img):not([src*="logo.png"]):not(.card-img img):not(.gallery-item img):hover {
    transform: translateZ(0) scale(1.02);
    box-shadow: 0 25px 50px rgba(0,0,0,0.3) !important;
}

/* ============================================================
   Reduce motion for users who prefer it
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-up {
        opacity: 1;
        transform: none;
    }

    img[loading="lazy"] {
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .nav-links {
        display: none; /* Mobile logic in main.js */
    }

    .mobile-menu-toggle {
        display: block;
        width: 30px;
        height: 20px;
        position: relative;
        cursor: pointer;
        z-index: 1001;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--primary-color);
        position: absolute;
        transition: transform 0.4s var(--ease-out-expo),
                    opacity 0.3s var(--ease-out-quart);
    }

    .mobile-menu-toggle span:nth-child(1) { top: 0; }
    .mobile-menu-toggle span:nth-child(2) { top: 9px; }
    .mobile-menu-toggle span:nth-child(3) { top: 18px; }

    /* Hamburger → X animation */
    .mobile-menu-toggle.toggle-active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .mobile-menu-toggle.toggle-active span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .mobile-menu-toggle.toggle-active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .nav-links.mobile-active {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        background-color: #fff;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        animation: fadeInMenu 0.4s var(--ease-out-expo);
    }

    @keyframes fadeInMenu {
        from {
            opacity: 0;
            transform: translate3d(0, -10px, 0);
        }
        to {
            opacity: 1;
            transform: translate3d(0, 0, 0);
        }
    }

    .split-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .mobile-sticky-cta {
        display: flex;
    }

    .floating-whatsapp {
        display: none;
    }

    body {
        padding-bottom: 50px; /* Space for sticky CTA */
    }
}