/* assets/css/styles.css */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Lato:wght@300;400&display=swap');

/* ========================================= */
/* 1. RESET Y VARIABLES GLOBALES             */
/* ========================================= */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-body: #f4f1ea;       
    --text-main: #2b2623;     
    --brown-accent: #5c4d42;  
    --gold-accent: #bfa480;   
    --header-height: 80px;
    --header-height-mobile: 60px;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Lato', sans-serif;
}

/* ========================================= */
/* 2. HEADER                                 */
/* ========================================= */
header {
    height: var(--header-height);
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(244, 241, 234, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease; /* Transición suave para el efecto scroll */
}

/* Estado Header Scrolled (Se activa con JS) */
header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 70px; /* Se hace un poco más compacto */
}

.logo {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    letter-spacing: 1px;
    text-decoration: none;
    color: var(--text-main);
    text-transform: uppercase;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 1.5px;
    margin-left: 25px;
    text-transform: uppercase;
    transition: opacity 0.3s;
}

.nav-links a:hover { opacity: 0.7; }

/* ========================================= */
/* 3. HERO SLIDESHOW (PORTADA)               */
/* ========================================= */
.hero {
    position: relative;
    width: 100%;
    height: 80vh; 
    min-height: 400px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.hero-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    z-index: 0;
}

.hero-slide.active { opacity: 1; }

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    color: white;
    padding: 0 20px;
    text-shadow: 0 2px 15px rgba(0,0,0,0.4);
}

.hero-content h2 {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    margin: 0;
    line-height: 1.1;
}

/* ========================================= */
/* 4. BARRA DE CATEGORÍAS                    */
/* ========================================= */
.category-bar {
    background-color: var(--bg-body);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 20px 0;
    margin-bottom: 50px;
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    transition: top 0.3s ease;
}

.category-list {
    display: flex;
    justify-content: center;
    gap: 30px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.category-link {
    text-decoration: none;
    color: #888;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 2px;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-link:hover, .category-link.active {
    color: var(--text-main);
    border-color: var(--text-main);
}

/* ========================================= */
/* 5. GRILLA DE PRODUCTOS                    */
/* ========================================= */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 100px; 
}

.section-title {
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 30px;
    color: var(--brown-accent);
    margin-bottom: 40px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 40px;
}

/* --- CARD DE PRODUCTO --- */
.product-card {
    display: block;
    text-decoration: none;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 8px;
    /* Transición elástica para el efecto hover de JS */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

/* Efecto Glow/Scale controlado por JS */
.product-card.is-hovered {
    transform: scale(1.03) translateY(-5px);
    box-shadow: 0 15px 30px rgba(191, 164, 128, 0.3); /* Resplandor dorado suave */
    z-index: 10;
    background-color: #fff; /* Fondo blanco para que destaque */
}

/* Efecto Click */
.product-card.is-clicked {
    transform: scale(0.98);
}

.image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background-color: #e8e4dc;
    margin-bottom: 15px;
    border-radius: 4px;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease, opacity 0.4s ease;
}

/* Cambio de imagen (CSS Hover clásico) */
@media (hover: hover) {
    .product-card:hover .image-container .img-main { opacity: 0; }
    .img-hover { position: absolute; top: 0; left: 0; opacity: 0; z-index: 2; transition: opacity 0.4s ease; }
    .product-card:hover .img-hover { opacity: 1; }
}

.product-info { text-align: center; padding: 10px; }

.product-category {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 5px;
}

.product-name {
    font-size: 16px;
    font-family: 'Cinzel', serif;
    margin: 5px 0;
}

.product-price {
    font-size: 14px;
    color: var(--brown-accent);
}

/* ========================================= */
/* 6. PÁGINA DE DETALLES (PRODUCT DETAILS)   */
/* ========================================= */
.product-detail-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 1.5fr 1fr; 
    gap: 60px;
}

.gallery-wrapper { display: flex; gap: 20px; }

.thumbnails {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80px;
    flex-shrink: 0; 
}

.thumb {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.3s;
    border: 1px solid transparent;
}
.thumb.active, .thumb:hover { opacity: 1; border-color: var(--text-main); }

.main-image-frame {
    flex-grow: 1;
    background-color: #e8e4dc;
    aspect-ratio: 3/4;
    position: relative;
}
.main-image-frame img { width: 100%; height: 100%; object-fit: cover; }

.product-info-detail {
    position: sticky;
    top: calc(var(--header-height) + 40px);
    height: fit-content;
}

.detail-title {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    margin: 10px 0 20px 0;
    line-height: 1.2;
}

.btn-add-cart {
    width: 100%;
    padding: 18px;
    background-color: var(--text-main);
    color: white;
    font-family: 'Lato', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 20px;
}
.btn-add-cart:hover { background-color: var(--brown-accent); }

/* ========================================= */
/* 7. CARRITO (DRAWER), BUSCADOR Y OVERLAY   */
/* ========================================= */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(43, 38, 35, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    backdrop-filter: blur(2px);
}
.overlay.active { opacity: 1; visibility: visible; }

.cart-drawer {
    position: fixed;
    top: 0; right: -100%; 
    width: 400px;
    max-width: 85vw; 
    height: 100vh;
    background: white;
    box-shadow: -5px 0 30px rgba(0,0,0,0.15);
    z-index: 200;
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 30px;
    display: flex;
    flex-direction: column;
}
.cart-drawer.open { right: 0; }

.drawer-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee; padding-bottom: 20px; margin-bottom: 20px;
}
.close-btn { cursor: pointer; font-size: 24px; padding: 5px; }

/* --- BUSCADOR (SEARCH OVERLAY) --- */
.search-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    z-index: 300;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease;
}
.search-overlay.active { opacity: 1; visibility: visible; }

.search-container { text-align: center; width: 100%; max-width: 600px; position: relative; }

.search-input {
    width: 100%; border: none; border-bottom: 2px solid #2b2623;
    font-family: 'Cinzel', serif; font-size: 30px; padding: 10px 0;
    background: transparent; text-align: center; outline: none; color: #2b2623;
}
.search-input::placeholder { color: #ccc; font-family: 'Lato', sans-serif; font-size: 20px; text-transform: uppercase; letter-spacing: 2px; }

.close-search {
    position: absolute; top: -50px; right: 0;
    font-size: 40px; cursor: pointer; color: #888; transition: color 0.3s;
}
.close-search:hover { color: #000; }

/* ========================================= */
/* 8. ANIMACIONES Y EFECTOS (Scroll Reveal)  */
/* ========================================= */
.reveal-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal-hidden.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Retraso escalonado para la grilla de productos */
.product-card:nth-child(2) { transition-delay: 0.1s; }
.product-card:nth-child(3) { transition-delay: 0.2s; }
.product-card:nth-child(4) { transition-delay: 0.3s; }


/* ========================================= */
/* 9. MEDIA QUERIES (RESPONSIVE CELULARES)   */
/* ========================================= */

@media (max-width: 768px) {
    header { height: var(--header-height-mobile); padding: 0 20px; }
    .logo { font-size: 20px; }
    .nav-links a { margin-left: 15px; font-size: 11px; }

    .hero { height: 60vh; min-height: 350px; }
    .hero-content h2 { font-size: 2.5rem; }

    .category-bar {
        top: var(--header-height-mobile);
        padding: 15px 0;
        margin-bottom: 30px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; 
    }
    .category-list {
        justify-content: flex-start; flex-wrap: nowrap;
        padding: 0 20px; gap: 25px;
    }
    .category-link { flex-shrink: 0; }

    .container { padding: 0 20px 60px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    
    .product-detail-container { grid-template-columns: 1fr; gap: 30px; padding: 0 20px; margin-top: 20px; }
    .gallery-wrapper { flex-direction: column-reverse; }
    .thumbnails { flex-direction: row; width: 100%; overflow-x: auto; justify-content: flex-start; }
    .thumb { width: 60px; height: 80px; }
    .product-info-detail { position: static; }
    .detail-title { font-size: 24px; }

    .cart-drawer { width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; } 
    .hero h2 { font-size: 2rem; }
}