/* ===================================================================
   PaginaWeb V3 · Light Professional
   Identidad: Henríquez 2026 — Hueso + Navy + Rojo discreto
   =================================================================== */

:root {
    /* Brand (Navy autoridad) */
    --brand-700: #184780;
    --brand-600: #1f4f93;
    --brand-500: #2960a8;
    --brand-300: #7fa1d4;
    --brand-100: #d6e1f3;
    --brand-50:  #eef3fb;

    /* CTA / Urgencia (Rojo discreto) */
    --cta-600: #B00027;
    --cta-700: #900020;
    --cta-500: #c91d3e;
    --cta-100: #fbd0d7;
    --cta-50:  #fdecef;

    /* Fondos claros */
    --bg:       #F7F6F4;   /* hueso cálido */
    --surface:  #FFFFFF;
    --card:     #FFFFFF;
    --border:   #E5E7EB;
    --muted-bg: #F1F0EC;

    /* Texto */
    --text-900: #111111;
    --text-700: #374151;
    --text-500: #6B7280;
    --text-400: #9CA3AF;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 400;
    font-feature-settings: "ss01", "cv11";
    background: var(--bg);
    color: var(--text-700);
}

/* Tipografía fluida — headings con peso firme */
h1, h2, h3, h4 {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: var(--text-900);
}
.h-display {
    font-size: clamp(1.875rem, 3.75vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: var(--text-900);
}
.h-section {
    font-size: clamp(1.375rem, 2.25vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-900);
}

/* Navbar — subrayado animado en navy */
.nav-link::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 8px;
    height: 2px;
    background: var(--brand-700);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .25s ease;
    border-radius: 2px;
}
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--text-900) !important; }

.alert.is-hiding { opacity: 0; }

/* CTA principal — NAVY (acción) */
.btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    font-size: 0.875rem;
    border-radius: 9999px;
    background: var(--brand-700);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 8px 20px -8px rgba(24, 71, 128, 0.45);
}
.btn-cta:hover {
    background: #0e2748;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -8px rgba(24, 71, 128, 0.55);
}

/* CTA secundario — outline oscuro sobre claro */
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.63rem 1.4rem;
    font-size: 0.875rem;
    border-radius: 9999px;
    border: 1.5px solid var(--text-900);
    color: var(--text-900);
    background: transparent;
    font-weight: 600;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.btn-outline:hover {
    background: var(--text-900);
    color: #fff;
}

/* Botón urgencia (solo casos puntuales: emergencia) */
.btn-urgent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    font-size: 0.875rem;
    border-radius: 9999px;
    background: var(--cta-600);
    color: #fff;
    font-weight: 700;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 8px 20px -8px rgba(176, 0, 39, 0.5);
}
.btn-urgent:hover { background: var(--cta-700); color: #fff; transform: translateY(-1px); }

/* Bento Grid */
.bento-grid {
    display: grid;
    gap: 0.875rem;
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
}
@media (min-width: 480px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(180px, auto);
    }
}
@media (min-width: 768px) {
    .bento-grid {
        gap: 1rem;
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: minmax(120px, auto);
    }
}
.bento-cell {
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 1.25rem;
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
    box-shadow: 0 1px 2px rgba(17, 17, 17, 0.04);
}
@media (min-width: 480px) {
    .bento-cell { border-radius: 1.5rem; padding: 1.5rem; }
}
@media (min-width: 768px) {
    .bento-cell { padding: 1.75rem; }
}
.bento-cell:hover {
    border-color: var(--brand-700);
    transform: translateY(-2px);
    box-shadow: 0 16px 40px -16px rgba(17, 17, 17, 0.18);
}
/* On mobile (single col) span-2 just fills the column */
@media (min-width: 480px) {
    .bento-cell--lg { grid-column: span 2; }
}
@media (min-width: 768px) {
    .bento-cell--cols-2 { grid-column: span 2; }
    .bento-cell--cols-3 { grid-column: span 3; }
    .bento-cell--cols-4 { grid-column: span 4; }
    .bento-cell--rows-1 { grid-row: span 1; max-height: 120px; overflow: hidden; }
    .bento-cell--rows-2 { grid-row: span 2; }
    .bento-cell--rows-3 { grid-row: span 3; }
    .bento-cell--rows-4 { grid-row: span 4; }
    .bento-cell--rows-5 { grid-row: span 5; }
    .bento-cell--rows-6 { grid-row: span 6; }
    .bento-cell--rows-7 { grid-row: span 7; }
    .bento-cell--rows-8 { grid-row: span 8; }
    /* compat. con datos viejos */
    .bento-cell--xl   { grid-column: span 2; grid-row: span 2; }
    .bento-cell--wide { grid-column: span 2; }
}

/* Bento — variante navy (autoridad) */
.bento-cell--brand {
    background: linear-gradient(135deg, #0e2748, var(--brand-700));
    border-color: transparent;
    color: #fff;
}
.bento-cell--brand h1, .bento-cell--brand h2, .bento-cell--brand h3, .bento-cell--brand h4 { color: #fff; }
.bento-cell--brand:hover { border-color: transparent; box-shadow: 0 16px 40px -16px rgba(14, 39, 72, 0.55); }

/* Bento — variante urgencia (rojo) */
.bento-cell--cta {
    background: linear-gradient(135deg, var(--cta-700), var(--cta-600));
    border-color: transparent;
    color: #fff;
}
.bento-cell--cta h1, .bento-cell--cta h2, .bento-cell--cta h3, .bento-cell--cta h4 { color: #fff; }
.bento-cell--cta:hover { border-color: transparent; box-shadow: 0 16px 40px -16px rgba(176, 0, 39, 0.5); }

/* Bento — variante verde esmeralda */
.bento-cell--green {
    background: linear-gradient(135deg, #064e3b, #059669);
    border-color: transparent;
    color: #fff;
}
.bento-cell--green h1, .bento-cell--green h2, .bento-cell--green h3, .bento-cell--green h4 { color: #fff; }
.bento-cell--green:hover { border-color: transparent; box-shadow: 0 16px 40px -16px rgba(5, 150, 105, 0.5); }

/* Bento — variante dorado/ámbar */
.bento-cell--gold {
    background: linear-gradient(135deg, #78350f, #d97706);
    border-color: transparent;
    color: #fff;
}
.bento-cell--gold h1, .bento-cell--gold h2, .bento-cell--gold h3, .bento-cell--gold h4 { color: #fff; }
.bento-cell--gold:hover { border-color: transparent; box-shadow: 0 16px 40px -16px rgba(217, 119, 6, 0.5); }

/* Bento — variante gris oscuro */
.bento-cell--dark {
    background: linear-gradient(135deg, #111111, #374151);
    border-color: transparent;
    color: #fff;
}
.bento-cell--dark h1, .bento-cell--dark h2, .bento-cell--dark h3, .bento-cell--dark h4 { color: #fff; }
.bento-cell--dark:hover { border-color: transparent; box-shadow: 0 16px 40px -16px rgba(17,17,17,0.6); }

/* Frame de imagen de producto (fondo blanco para fotos PNG) */
.product-image-frame {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}
.product-image-frame--sm { aspect-ratio: 1 / 1; padding: 16px; }
.product-image-frame--lg { aspect-ratio: 4 / 3; padding: 24px; }

.product-image-frame img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform .35s ease;
}

/* Product Card — refinado */
.product-card {
    background: var(--card);
    border: 1px solid var(--border);
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
    box-shadow: 0 1px 2px rgba(17, 17, 17, 0.03);
}
.product-card:hover {
    transform: translateY(-2px);
    border-color: var(--brand-700);
    box-shadow: 0 18px 40px -16px rgba(17, 17, 17, 0.18);
}
.product-card:hover .product-image-frame img { transform: scale(1.04); }

.product-main-image {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.product-main-image-link {
    width: 100%; height: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Thumbnails */
.product-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 10px;
}
.product-thumb-btn {
    border: 2px solid transparent;
    background: #fff;
    border-radius: 12px;
    padding: 6px;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;  /* elimina el delay de 300ms en móvil */
    -webkit-tap-highlight-color: transparent;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.product-thumb-btn img {
    width: 100%;
    height: 60px;
    object-fit: contain;
}
.product-thumb-btn:hover { transform: translateY(-2px); }
.product-thumb-btn.active {
    border-color: var(--brand-700);
    box-shadow: 0 0 0 3px rgba(24, 71, 128, 0.18);
}

/* ───── Galería de imágenes ───── */

/* Stage: contenedor apilado con aspecto 4:3 */
.product-gallery-stage {
    aspect-ratio: 4 / 3;
    position: relative;
    background: #fff;
    overflow: hidden;
}

/* ── Galería de imágenes del producto ──────────────────────────────────── */

/* Stage: contenedor con relación 4:3 garantizada via ::before (padding-top:75%)
   Funciona en TODOS los browsers. No depende de aspect-ratio ni de hijos en flujo. */
.product-gallery-stage {
    position: relative;
    width: 100%;
    display: block;
    overflow: hidden;
    background: #fff;
    border: 0;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
}
.product-gallery-stage::before {
    content: '';
    display: block;
    padding-top: 75%; /* 4:3 aspect ratio */
}

/* Todas las imgs en el stage: absolutas, opacity:0
   NO son display:none → Safari y todos los browsers las descargan al cargar la página
   El swap es puro opacity (sin descarga, instantáneo) */
.gallery-slide-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 24px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.gallery-slide-img.gal-active {
    opacity: 1;
}

/* Flechas del lightbox: ocultas siempre en móvil, visibles en desktop cuando el JS agrega lb-arrow-show */
.lb-arrow { display: none !important; }
@media (min-width: 640px) {
    .lb-arrow.lb-arrow-show { display: flex !important; }
}

/* Dots indicador de posición en la galería */
.gallery-dot {
    opacity: 0.55;
    transform: scale(0.85);
}
.gallery-dot-active {
    opacity: 1;
    background-color: #fff !important;
    transform: scale(1.2);
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

/* Sidebar categorías: scroll sin barra visible */
#catalogSidebar nav { scrollbar-width: none; -ms-overflow-style: none; }
#catalogSidebar nav::-webkit-scrollbar { display: none; }

/* Legacy .product-gallery-slide — ya no se usa, se mantiene por si hay cache viejo */
.product-gallery-slide { display: none; }
.product-gallery-slide.pg-active { display: flex; }
.product-gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;       /* tap cae en el <button>, no en la imagen */
}

.product-modal-image {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    width: auto; height: auto;
    object-fit: contain;
}

/* Timeline (Servicios) */
.timeline {
    position: relative;
    padding-left: 36px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
}
.timeline-item {
    position: relative;
    padding-bottom: 28px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-icon {
    position: absolute;
    left: -36px;
    top: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border);
    color: var(--text-400);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 1;
}
.timeline-icon.bg-success {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
}

/* Textura sutil del hero (claro) */
.hero-grain {
    position: relative;
}
.hero-grain::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at top left,  rgba(24, 71, 128, 0.10), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(176, 0, 39, 0.06), transparent 60%);
    pointer-events: none;
}
.hero-grain::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.25 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.10'/></svg>");
    opacity: 0.4;
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* Prose para descripciones HTML */
.prose-artisan {
    color: var(--text-700);
    line-height: 1.7;
    font-weight: 400;
}
.prose-artisan h1, .prose-artisan h2, .prose-artisan h3, .prose-artisan h4 {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 800;
    color: var(--text-900);
    margin: 1.2em 0 0.5em;
}
.prose-artisan h2 { font-size: 1.5rem; }
.prose-artisan h3 { font-size: 1.25rem; }
.prose-artisan h4 { font-size: 1.1rem; }
.prose-artisan p { margin-bottom: 1em; }
.prose-artisan ul, .prose-artisan ol { margin: 1em 0 1em 1.4em; }
.prose-artisan li { margin-bottom: 0.35em; }
.prose-artisan strong { color: var(--text-900); font-weight: 700; }
.prose-artisan a {
    color: var(--brand-700);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.prose-artisan img { max-width: 100%; height: auto; border-radius: 12px; margin: 1em 0; }

/* Animaciones de entrada */
[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .7s ease, transform .7s ease;
}
[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-fadein { animation: fadeIn .45s ease both; }

/* Accordion (FAQ) */
.faq-item .faq-toggle[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
    background: var(--brand-700);
    color: #fff;
}
.faq-icon {
    transition: transform .25s ease, background-color .25s ease, color .25s ease;
}

/* Marcas — strip de logos */
.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: #fff;
    color: var(--text-500);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.875rem;
    text-decoration: none;
    transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.brand-logo:hover {
    border-color: var(--brand-700);
    color: var(--brand-700);
    transform: translateY(-1px);
}

/* Scrollbar claro */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: rgba(17, 17, 17, 0.12);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(17, 17, 17, 0.25); }

/* ── Carrito de compras ──────────────────────────────────────────────────── */

/* Badge en el navbar */
.cart-badge {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 3px;
    background: #dc2626;
    color: #fff;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
    box-sizing: border-box;
}

/* Toast de confirmación */
.cart-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #1c1917;
    color: #fff;
    padding: 0.6rem 1.1rem;
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.28);
    opacity: 0;
    transform: translateY(0.6rem);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
.cart-toast.cart-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Botón "+" sobre las tarjetas del catálogo — siempre visible */
.card-add-btn {
    position: absolute;
    bottom: 0.6rem;
    right: 0.6rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    opacity: 1;
    transform: scale(1);
    transition: transform 0.15s ease, background-color 0.15s ease;
    z-index: 2;
}
.product-card:hover .card-add-btn {
    transform: scale(1.12);
}
