/* Familia 3D — color palette derived from the logo */
:root {
    --color-bg: #eaf3fb;
    --color-surface: #ffffff;
    --color-primary: #1d4e89;
    --color-primary-dark: #0f3460;
    --color-accent: #4ea3d8;
    --color-text: #15324d;
    --color-text-muted: #4a6580;
    --color-border: #cfdfee;
    --shadow-sm: 0 2px 6px rgba(15, 52, 96, 0.08);
    --shadow-md: 0 6px 18px rgba(15, 52, 96, 0.12);
    --radius: 12px;
    --max-width: 1100px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--color-text);
    background: linear-gradient(180deg, #d6e7f5 0%, var(--color-bg) 240px);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

main {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md);
    z-index: 10;
    flex-shrink: 0;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #ffffff;
    padding: 4px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-text h1 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: 0.5px;
}

.tagline {
    margin: 2px 0 0;
    font-size: 0.95rem;
    opacity: 0.85;
}

/* Intro */
.intro {
    max-width: var(--max-width);
    width: 100%;
    margin: 24px auto 8px;
    padding: 0 20px;
    flex-shrink: 0;
}

.intro h2 {
    margin: 0 0 6px;
    color: var(--color-primary-dark);
    font-size: 1.5rem;
}

.intro p {
    margin: 0;
    color: var(--color-text-muted);
}

/* Product list — scrollable grid */
.product-list {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 16px 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    grid-auto-rows: max-content;
    gap: 20px;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
    border-radius: var(--radius);
}

/* Custom scrollbar */
.product-list::-webkit-scrollbar {
    width: 10px;
}
.product-list::-webkit-scrollbar-track {
    background: transparent;
}
.product-list::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 10px;
}
.product-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

.product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}

.product-card:hover,
.product-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    outline: none;
}

.product-card:focus-visible {
    box-shadow: 0 0 0 3px var(--color-accent), var(--shadow-md);
}

.product-image {
    position: relative;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #eaf3fb 0%, #c9def0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
}

.image-count-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 52, 96, 0.85);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.image-count-badge::before {
    content: "";
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M4 6h13v11H4zm15 2h2v11H8v-2h11z'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.product-info {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.product-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-primary-dark);
}

.product-description {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    flex-grow: 1;
}

/* Footer */
.site-footer {
    background: var(--color-primary-dark);
    color: #ffffff;
    flex-shrink: 0;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 20px;
    text-align: center;
}

.contact-label {
    margin: 0 0 6px;
    font-size: 0.95rem;
    opacity: 0.85;
}

.contact-email {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    padding-bottom: 2px;
}

.contact-email:hover {
    border-bottom-color: #ffffff;
}

.copyright {
    margin: 16px 0 0;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 52, 96, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
    animation: lightbox-fade 0.18s ease;
}

.lightbox[hidden] {
    display: none;
}

@keyframes lightbox-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-figure {
    margin: 0;
    max-width: min(1100px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.lightbox-image {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-caption {
    color: #ffffff;
    text-align: center;
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 0.95rem;
    flex-wrap: wrap;
    justify-content: center;
}

.lightbox-title {
    font-weight: 600;
}

.lightbox-counter {
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

.lightbox-btn {
    position: absolute;
    background: rgba(15, 52, 96, 0.85);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible {
    background: #0f3460;
    outline: none;
    transform: scale(1.08);
}

.lightbox-close {
    top: 18px;
    right: 18px;
    font-size: 1.8rem;
}

.lightbox-prev {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
}
.lightbox-prev:hover,
.lightbox-prev:focus-visible {
    transform: translateY(-50%) scale(1.05);
}

.lightbox-next {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}
.lightbox-next:hover,
.lightbox-next:focus-visible {
    transform: translateY(-50%) scale(1.05);
}

.lightbox.is-single .lightbox-prev,
.lightbox.is-single .lightbox-next,
.lightbox.is-single .lightbox-counter {
    display: none;
}

body.lightbox-open {
    overflow: hidden;
}

/* Mobile */
@media (max-width: 600px) {
    .header-inner {
        padding: 12px 16px;
        gap: 12px;
    }
    .logo {
        width: 52px;
        height: 52px;
    }
    .header-text h1 {
        font-size: 1.3rem;
    }
    .tagline {
        font-size: 0.85rem;
    }
    .intro {
        margin-top: 20px;
        padding: 0 16px;
    }
    .intro h2 {
        font-size: 1.25rem;
    }
    .product-list {
        grid-template-columns: 1fr;
        padding: 12px 16px 20px;
        gap: 16px;
    }
    .footer-inner {
        padding: 20px 16px;
    }
    .contact-email {
        font-size: 1rem;
        word-break: break-all;
    }
    .lightbox {
        padding: 12px;
    }
    .lightbox-btn {
        width: 46px;
        height: 46px;
        font-size: 1.6rem;
    }
    .lightbox-close {
        top: 12px;
        right: 12px;
    }
    .lightbox-prev {
        left: 8px;
    }
    .lightbox-next {
        right: 8px;
    }
    .lightbox-image {
        max-height: 70vh;
    }
}
