:root {
    --bg: #f2f8ff;
    --bg-soft: #eef5ff;
    --text: #102033;
    --muted: #4d6077;
    --brand: #2f80ed;
    --brand-dark: #195ec5;
    --brand-soft: #dcecff;
    --card: #ffffff;
    --line: #d7e5fb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    background-image:
        linear-gradient(to right, rgba(47, 128, 237, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(47, 128, 237, 0.03) 1px, transparent 1px);
    background-size: 22px 22px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(8px);
    background: linear-gradient(120deg, rgba(238, 246, 255, .96), rgba(222, 238, 255, .93));
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(30, 79, 138, .08);
}

.modern-nav-container {
    width: min(1200px, 92%);
    margin: 0 auto;
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    text-decoration: none;
    color: #17395d;
    font-weight: 600;
    letter-spacing: .01em;
}

.logo-text {
    color: inherit;
}

.logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: #22415f;
    font-size: .95rem;
    position: relative;
    transition: color .2s ease;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease;
    background: linear-gradient(90deg, #6cb6ff, #2f80ed);
}

.nav a:hover { color: var(--brand-dark); }
.nav a:hover::after { transform: scaleX(1); }

.nav-toggle {
    display: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

section {
    width: min(1200px, 92%);
    margin: 0 auto;
}

.catalogo, .pisos-page, .page {
    padding: 42px 0 64px;
    animation: fadeUp .5s ease both;
    position: relative;
}

h1 {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    margin: 0 0 1rem;
    letter-spacing: -.01em;
}

.catalogo h1::after,
.pisos-page h1::after,
.page h1::after {
    content: "";
    display: block;
    margin-top: .5rem;
    width: 80px;
    height: 3px;
    border-radius: 4px;
    background: linear-gradient(90deg, #86c5ff, #2f80ed);
}

.catalogo .categorias, .pisos-page .filtros {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.catalogo .categorias a, .pisos-page .filtros a, .contact-card a {
    text-decoration: none;
    border: 1px solid #c4dcff;
    border-radius: 999px;
    padding: .45rem .8rem;
    background: #fff;
    color: #1f4f8a;
    transition: all .2s ease;
}

.catalogo .categorias a:hover, .pisos-page .filtros a:hover, .contact-card a:hover {
    background: var(--brand-soft);
    transform: translateY(-1px);
}

.grid, .pisos-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.card, .piso-card, .contact-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 26px rgba(22, 77, 150, .08);
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
}

.card:hover, .piso-card:hover, .contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 30px rgba(22, 77, 150, .12);
}

.card::before, .piso-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #8fd0ff, #2f80ed);
}

.img-wrap img, .piso-img img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.card h3, .piso-info h3 {
    margin: .85rem .85rem .35rem;
}

.card .precio, .piso-info .precio {
    margin: 0 .85rem .55rem;
    color: var(--brand-dark);
    font-weight: 600;
}

.card > a {
    display: inline-block;
    margin: 0 .85rem 1rem;
    text-decoration: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #61b2ff, #2f80ed);
    color: #fff;
    padding: .45rem .8rem;
    transition: transform .2s ease, box-shadow .2s ease;
}

.card > a:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(47, 128, 237, .28);
}

.piso-info { padding-bottom: .8rem; }

.calculadora {
    margin: 0 .85rem;
    border-top: 1px solid #efefef;
    padding-top: .65rem;
}

.calculadora input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: .5rem .65rem;
}

.calculadora small {
    display: block;
    margin-top: .45rem;
    color: #4c6685;
    font-size: .82rem;
}

.resultado { margin-top: .45rem; color: #4a4a4a; font-size: .92rem; }

.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.contact-card {
    padding: 1rem;
    position: relative;
}

.producto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-items: start;
}

.producto .imagen > img {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    object-fit: cover;
}

.producto-viewer {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, #ffffff, #eef5ff);
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.producto-viewer #productoMainImage {
    width: 100%;
    max-height: 540px;
    object-fit: contain;
}

.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #cfe2ff;
    background: rgba(255,255,255,.9);
    color: #1d4ed8;
    cursor: pointer;
}

.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }

.galeria-muestras {
    margin-top: .7rem;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .5rem;
}

.muestra-thumb {
    border: 1px solid #dbeafe;
    border-radius: 8px;
    padding: 3px;
    background: #fff;
    cursor: pointer;
}

.muestra-thumb.active {
    border-color: #2f80ed;
    box-shadow: 0 0 0 2px rgba(47,128,237,.15);
}

.muestra-thumb img {
    width: 100%;
    height: 74px;
    object-fit: contain;
    display: block;
    border-radius: 5px;
    background: #fff;
}

.contact-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #86c5ff, #2f80ed);
}

.site-footer {
    margin-top: 2.2rem;
    background: radial-gradient(120% 120% at 0% 0%, #f7fbff 0%, #eaf3ff 48%, #e2eeff 100%);
    border-top: 1px solid #cfe1ff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.page-intro {
    background: linear-gradient(120deg, #eff6ff, #dcecff);
}

.footer-container {
    width: min(1200px, 92%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1.4rem;
    padding: 2.1rem 0 1.1rem;
}

.footer-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #d3e5ff;
    padding: .25rem;
    margin-bottom: .6rem;
}

.footer-col h4 {
    margin-bottom: .5rem;
    color: #17395d;
    font-size: 1.02rem;
}

.footer-col p,
.footer-col li {
    color: #486382;
    font-size: .95rem;
}

.footer-col li + li,
.footer-col p + p {
    margin-top: .42rem;
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-col a {
    color: #335e92;
    text-decoration: none;
    transition: color .2s ease;
}

.footer-col a:hover {
    color: #1d4f89;
    text-decoration: underline;
}

.footer-bottom {
    width: min(1200px, 92%);
    margin: 0 auto;
    border-top: 1px solid #cfe1ff;
    padding: .8rem 0 1.2rem;
    font-size: .9rem;
    color: #4f6582;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .grid, .pisos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-container, .contact-grid { grid-template-columns: 1fr; }
    .producto { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .nav-toggle { display: block; padding: .35rem .65rem; }
    .nav { display: none; width: 100%; padding-bottom: .65rem; }
    .nav.open { display: flex; }
    .modern-nav-container { align-items: flex-start; flex-wrap: wrap; padding-top: .7rem; }
    .grid, .pisos-grid { grid-template-columns: 1fr; }
}
