/* =============================================================
   RefCatastral.es — Sistema de Diseño
   Sin dependencias externas. Fuentes del sistema operativo.
   ============================================================= */

/* --- Variables & Tokens ------------------------------------ */
:root {
    /* Tipografía del sistema — prioriza las fuentes más modernas */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
        Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono",
        "Roboto Mono", Consolas, "Courier New", monospace;

    /* Paleta principal */
    --color-primary: hsl(222, 72%, 42%);
    /* Azul catastral */
    --color-primary-dark: hsl(222, 72%, 32%);
    --color-primary-xd: hsl(222, 72%, 22%);
    --color-primary-lite: hsl(222, 72%, 95%);
    --color-accent: hsl(38, 95%, 50%);
    /* Ámbar referencia */
    --color-accent-lite: hsl(38, 95%, 92%);

    /* Grises */
    --color-bg: hsl(210, 25%, 98%);
    --color-surface: #ffffff;
    --color-border: hsl(220, 15%, 88%);
    --color-muted: hsl(220, 12%, 55%);
    --color-text: hsl(222, 20%, 18%);
    --color-text-2: hsl(222, 12%, 40%);

    /* Cabecera */
    --color-header-bg: #ffffff;
    --color-header-txt: hsl(222, 20%, 18%);
    --color-footer-bg: hsl(222, 30%, 12%);

    /* Sombras */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .06);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .10), 0 1px 4px rgba(0, 0, 0, .06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);

    /* Radios */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    /* Transiciones */
    --transition: 150ms ease;
}

/* Modo oscuro automático desactivado a petición de mantener un tema claro fijo */
/*
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg:      hsl(222, 25%, 10%);
        --color-surface: hsl(222, 25%, 14%);
        --color-border:  hsl(222, 20%, 22%);
        --color-muted:   hsl(220, 12%, 55%);
        --color-text:    hsl(210, 20%, 90%);
        --color-text-2:  hsl(210, 12%, 65%);
        --color-primary-lite: hsl(222, 50%, 18%);
        --color-accent-lite:  hsl(38, 50%, 15%);
        --color-header-bg:    hsl(222, 40%, 10%);
        --color-footer-bg:    hsl(222, 35%, 7%);
    }
}
*/

/* --- Reset & Base ------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    /* Protección: AdSense anchor ads inyectan padding-top/bottom en html/body */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    /* Protección: AdSense inyecta padding en body para anchor ads */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

img,
svg {
    display: block;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Layout ------------------------------------------------ */
.container {
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2rem);
}

main.container {
    padding-block: 2rem 3rem;
    flex: 1;
}

/* --- Header ------------------------------------------------ */
.site-header {
    background: var(--color-header-bg);
    color: var(--color-header-txt);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: .9rem;
}

.site-logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    gap: .4rem;
}

.site-logo:hover {
    text-decoration: none;
    opacity: .9;
}

.site-logo span {
    color: var(--color-accent);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-nav a {
    color: var(--color-text-2);
    font-size: .875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 9999px;
    background: transparent;
    transition: all 0.2s ease;
}

.site-nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
    background: rgba(0, 0, 0, 0.05);
}

/* --- Footer ------------------------------------------------ */
.site-footer {
    background: var(--color-footer-bg);
    color: hsl(210, 15%, 55%);
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: .8125rem;
    margin-top: auto;
}

.site-footer p+p {
    margin-top: .4rem;
}

.site-footer a {
    color: hsl(210, 15%, 70%);
}

.site-footer a:hover {
    color: #fff;
}

/* --- Breadcrumbs ------------------------------------------- */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem .5rem;
    font-size: .8125rem;
    color: var(--color-muted);
    margin-bottom: 1.75rem;
    list-style: none;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.breadcrumbs li:not(:last-child)::after {
    content: "/";
    color: var(--color-border);
}

.breadcrumbs a {
    color: var(--color-text-2);
    font-weight: 500;
}

.breadcrumbs a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumbs li:last-child {
    color: var(--color-text);
    font-weight: 600;
}

/* --- Cards ------------------------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
}

.card-link {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    padding: 1rem 1.25rem;
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
}

.card-link:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--color-text);
}

/* --- Grids ------------------------------------------------- */
.grid-provinces {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.grid-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.grid-streets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .6rem;
}

.grid-portals {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .75rem;
}

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* --- Province Card ----------------------------------------- */
.province-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem .75rem;
    text-align: center;
    color: var(--color-text);
    font-weight: 600;
    font-size: .875rem;
    text-decoration: none;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.province-card:hover {
    background: var(--color-primary-lite);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    color: var(--color-primary-dark);
    text-decoration: none;
}

.province-card .icon {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--color-primary-lite);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: background var(--transition);
}

.province-card:hover .icon {
    background: var(--color-primary);
    color: #fff;
}

/* --- Search Form ------------------------------------------- */
.search-box {
    background: var(--color-primary-lite);
    border: 1px solid hsl(222, 50%, 82%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* @media (prefers-color-scheme: dark) { .search-box { border-color: var(--color-border); } } */

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
}

.search-input {
    flex: 1 1 260px;
    font-family: var(--font-sans);
    font-size: 1rem;
    padding: .7rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px hsl(222, 72%, 42%, .15);
}

/* --- Buttons ----------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-family: var(--font-sans);
    font-size: .9375rem;
    font-weight: 600;
    padding: .7rem 1.4rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text-2);
}

.btn-secondary:hover {
    background: hsl(220, 15%, 78%);
    color: var(--color-text);
    text-decoration: none;
}

.btn-accent {
    background: var(--color-accent);
    color: hsl(38, 60%, 15%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .10);
}

.btn-accent:hover {
    opacity: .88;
    text-decoration: none;
}

/* --- Typography -------------------------------------------- */
h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -.5px;
    line-height: 1.2;
    margin-bottom: .5rem;
}

h2 {
    font-size: clamp(1.15rem, 3vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -.3px;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.subtitle {
    color: var(--color-text-2);
    font-size: 1rem;
    margin-bottom: 1.75rem;
}


.page-intro {
    color: var(--color-text-2);
    font-size: .9875rem;
    line-height: 1.7;
    margin-bottom: .75rem;
    max-width: 72ch;
}

.page-intro strong {
    color: var(--color-text);
    font-weight: 600;
}

.page-intro-sub {
    color: var(--color-muted);
    font-size: .85rem;
    line-height: 1.6;
    margin-bottom: 1.75rem;
    max-width: 72ch;
}

.section-title {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: baseline;
    gap: .6rem;
}

.count-badge {
    font-size: .75rem;
    font-weight: 600;
    color: var(--color-muted);
    background: var(--color-border);
    padding: .15rem .55rem;
    border-radius: 99px;
}

/* --- Badge Ref Catastral ----------------------------------- */
.ref-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .8px;
    color: var(--color-accent);
    background: var(--color-accent-lite);
    border: 1px solid hsl(38, 80%, 75%);
    padding: .1rem .45rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

/* @media (prefers-color-scheme: dark) { .ref-badge { border-color: hsl(38, 40%, 35%); } } */

/* --- Stat Cards -------------------------------------------- */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.stat-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--color-muted);
    margin-bottom: .4rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}

.stat-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-muted);
    margin-left: .25rem;
}

/* --- Portal Cards ------------------------------------------ */
.portal-card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: .875rem .625rem;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.portal-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-lite);
    color: var(--color-primary-dark);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.portal-num {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
}

.portal-ref {
    display: block;
    font-size: .625rem;
    color: var(--color-muted);
    margin-top: .3rem;
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Street List ------------------------------------------- */
.street-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .875rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-2);
    font-weight: 500;
    font-size: .9375rem;
    text-decoration: none;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.street-link:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-lite);
    text-decoration: none;
}

.street-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--color-primary);
    opacity: .7;
}

/* --- Alerts / Notices -------------------------------------- */
.alert {
    padding: 1.1rem 1.4rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: 1.5rem;
    font-size: .9375rem;
}

.alert strong {
    display: block;
    margin-bottom: .25rem;
    font-weight: 700;
}

.alert-warning {
    background: hsl(38, 90%, 96%);
    border-color: var(--color-accent);
    color: hsl(30, 60%, 25%);
}

.alert-error {
    background: hsl(0, 80%, 97%);
    border-color: hsl(0, 70%, 55%);
    color: hsl(0, 55%, 30%);
}

.alert-info {
    background: var(--color-primary-lite);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.alert-success {
    background: hsl(140, 60%, 96%);
    border-color: hsl(140, 60%, 45%);
    color: hsl(140, 50%, 18%);
}

/*
@media (prefers-color-scheme: dark) {
    .alert-warning { background: hsl(38, 40%, 14%); color: hsl(38, 80%, 70%); }
    .alert-error   { background: hsl(0, 40%, 14%); color: hsl(0, 70%, 75%); }
    .alert-info    { background: var(--color-primary-lite); color: hsl(222, 70%, 75%); }
    .alert-success { background: hsl(140, 30%, 14%); color: hsl(140, 60%, 60%); }
}
*/

/* --- Hero (Portada) ---------------------------------------- */
.hero {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
    max-width: 640px;
    margin-inline: auto;
}

.hero-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: 0 4px 16px hsl(222, 72%, 42%, .35);
}

.hero-icon svg {
    color: #fff;
    width: 1.75rem;
    height: 1.75rem;
}

.hero h1 {
    margin-bottom: .6rem;
}

.hero p {
    color: var(--color-text-2);
    font-size: 1.0625rem;
    margin-bottom: 0;
}

/* --- Inmueble Ficha ---------------------------------------- */
.ficha-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 720px) {
    .ficha-layout {
        grid-template-columns: 1fr 320px;
    }
}

.ficha-header {
    margin-bottom: 1.5rem;
}

.ficha-address {
    font-size: 1.1rem;
    color: var(--color-text-2);
    margin-top: .35rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.data-row {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.data-row dt {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--color-muted);
}

.data-row dd {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.1;
}

.data-row dd small {
    font-size: .85rem;
    font-weight: 500;
    color: var(--color-muted);
}

.ficha-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.ad-placeholder {
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--color-muted);
    font-size: .875rem;
    text-align: center;
    padding: 2rem;
}

.ad-placeholder svg {
    width: 2.5rem;
    height: 2.5rem;
    opacity: .35;
}

/* --- 404 Page ---------------------------------------------- */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-code {
    font-size: clamp(5rem, 15vw, 9rem);
    font-weight: 900;
    color: var(--color-border);
    line-height: 1;
    margin-bottom: .5rem;
}

.error-page h2 {
    font-size: 1.5rem;
    margin-bottom: .75rem;
}

.error-page p {
    color: var(--color-text-2);
    max-width: 420px;
    margin: 0 auto 2rem;
}

/* --- Animations -------------------------------------------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeUp .3s ease forwards;
}

/* --- Utilities --------------------------------------------- */
.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

.text-muted {
    color: var(--color-muted);
}

.text-center {
    text-align: center;
}

.font-mono {
    font-family: var(--font-mono);
}

/* Visually hidden — accesible para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Paginación AJAX --------------------------------------- */
.pg-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .9rem 0;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .6rem;
    font-family: var(--font-sans);
    font-size: .875rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-2);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
    line-height: 1;
}

.pg-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-lite);
}

.pg-btn--active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px hsl(222, 72%, 42%, .25);
    cursor: default;
}

.pg-btn--active:hover {
    background: var(--color-primary);
    color: #fff;
}

.pg-prev,
.pg-next {
    font-size: 1rem;
    padding: 0 .75rem;
}

.pg-ellipsis {
    color: var(--color-muted);
    font-size: .875rem;
    padding: 0 .2rem;
    user-select: none;
}

/* Estado cargando del grid */
[data-pg-grid] {
    transition: opacity .15s ease;
}

/* --- Buscador Sede Catastro (Home) --- */
.sedecatastro-box {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    max-width: 860px;
    margin: 1.5rem auto 3rem;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-sans);
}

.sedecatastro-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--color-border);
    background: #f8fafc;
    border-radius: 4px 4px 0 0;
}

.sc-tab {
    padding: 0.9rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-muted);
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: background var(--transition);
}

.sc-tab.active {
    background: #fff;
    color: var(--color-text);
    border-color: var(--color-border);
    border-radius: 4px 4px 0 0;
    margin-bottom: -2px;
    border-bottom: 2px solid #fff;
}

.sc-tab:not(.active):hover {
    background: #f1f5f9;
}

.sedecatastro-content {
    padding: 3rem 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    min-height: 320px;
}

.sc-form-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 640px;
}

.sc-form-label {
    font-size: 0.95rem;
    color: var(--color-text-2);
    width: 150px;
    text-align: right;
}

.sc-form-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    box-shadow: 0 0 0 3px rgba(191, 219, 254, 0.4);
    background: #fff;
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.sc-form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.sc-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.sc-btn {
    padding: 0.6rem 1.75rem;
    background: #fff;
    border: 1px solid #f97316;
    /* Naranja Catastro */
    color: #f97316;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    transition: background var(--transition);
}

.sc-btn:hover {
    background: #fff7ed;
}

/* Ajustes Responsive Buscador */
@media (max-width: 640px) {
    .sc-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .sc-form-label {
        width: 100%;
        text-align: left;
    }

    .sedecatastro-tabs {
        flex-direction: row;
    }

    .sc-tab {
        flex: 1 1 33%;
        text-align: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.75rem;
    }

    .sedecatastro-content {
        min-height: 385px;
    }
}

/* =============================================================
   RESPONSIVE — Ficha Inmueble / Acordeón Calle
   ============================================================= */

/* ── Móvil ≤ 640px ─────────────────────────────────────────── */
@media (max-width: 640px) {

    /* sec-grid: label+valor en columna */
    .sec-grid {
        grid-template-columns: 1fr !important;
    }

    .sec-label {
        text-align: left !important;
        padding-bottom: 0.1rem !important;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-weight: 700;
        color: var(--color-muted);
    }

    .sec-value {
        padding-top: 0.1rem !important;
        padding-bottom: 0.85rem !important;
        border-bottom: 1px solid var(--color-border);
    }

    /* Foto fachada: pasa a fila horizontal compacta bajo los datos */
    .sec-box>div[style*="display:flex"],
    .sec-box>div[style*="display: flex"] {
        flex-direction: column !important;
    }

    /* Botones de acción */
    .actions {
        flex-direction: column !important;
    }

    .actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tabla de construcciones: scroll horizontal */
    .sec-table {
        min-width: 480px;
    }

    .sec-box {
        overflow-x: auto;
    }

    /* Cabecera ficha inmueble */
    .inmueble-header h1 {
        font-size: 1.25rem !important;
    }

    .inmueble-header .subtitle {
        font-size: 0.9rem;
    }

    /* Acordeón: trigger compacto, ref oculta */
    .portal-trigger {
        padding: 0.65rem 0.85rem;
        font-size: 0.875rem;
    }

    .portal-ref-small {
        display: none;
    }

    .portal-content {
        padding: 0.85rem;
    }

    /* Buscador de calles */
    .street-search-container {
        max-width: 100% !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .section-title {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* Mapa grande */
    #catastro-map {
        height: 280px !important;
    }

    /* Breadcrumb más pequeño */
    .breadcrumbs {
        font-size: 0.72rem;
    }

    /* section-title flex en calle */
    .section-title>div:first-child {
        flex-wrap: wrap;
    }
}

/* ── Tablet ≤ 760px ────────────────────────────────────────── */
@media (max-width: 760px) {

    /* Bloque de foto fachada: pasa debajo de los datos */
    .sec-box>div>div[style*="width:280px"],
    .sec-box>div>div[style*="width: 280px"],
    .sec-box>div>div[style*="width:220px"],
    .sec-box>div>div[style*="width: 220px"] {
        width: 100% !important;
        border-left: none !important;
        border-top: 1px solid var(--color-border) !important;
        flex-direction: row !important;
        gap: 1rem;
        height: auto !important;
        padding: 1rem !important;
    }

    /* Mapa en ficha */
    #catastro-map {
        height: 340px !important;
    }
}

/* ─── Bloque XREF provincia (debajo del listado de municipios) ─── */
.xor-texto-provincia {
    margin-top: 3rem;
    padding: 2rem 2.25rem;
    background: var(--color-surface, #f8f9fb);
    border: 1px solid var(--color-border, #e2e6ed);
    border-radius: 12px;
    color: var(--color-text, #1e2a3a);
    line-height: 1.8;
}

.xor-texto-provincia .texto-xref-provincia p {
    margin: 0 0 1.1rem;
    font-size: .9625rem;
}

.xor-texto-provincia .texto-xref-provincia p:last-child {
    margin-bottom: 0;
}

.xor-texto-provincia .texto-xref-provincia strong {
    color: var(--color-primary, #2563eb);
    font-weight: 650;
}

/* separador visual entre listado y XREF */
.xor-texto-provincia::before {
    content: '';
    display: block;
    width: 3rem;
    height: 3px;
    background: var(--color-primary, #2563eb);
    border-radius: 2px;
    margin-bottom: 1.5rem;
    opacity: .6;
}

@media (max-width: 640px) {
    .xor-texto-provincia {
        padding: 1.25rem 1rem;
        margin-top: 2rem;
    }

    .xor-texto-provincia .texto-xref-provincia p {
        font-size: .9rem;
    }
}

/* ─── Tarjetas de características (home) ────────────────────── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
    margin: 2.5rem 0;
}

.feature-card {
    background: var(--color-card, #fff);
    border: 1px solid var(--color-border, #e2e6ed);
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    transition: box-shadow .18s ease, transform .18s ease;
}

.feature-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, .09);
    transform: translateY(-2px);
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--color-text, #1e2a3a);
    line-height: 1.3;
}

.feature-card p {
    font-size: .875rem;
    color: var(--color-muted, #6b7280);
    margin: 0;
    line-height: 1.65;
}

.feature-card p strong {
    color: var(--color-text, #1e2a3a);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: .25rem;
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.feature-icon--blue {
    background: #eff6ff;
    color: #2563eb;
}

.feature-icon--green {
    background: #f0fdf4;
    color: #16a34a;
}

.feature-icon--purple {
    background: #faf5ff;
    color: #7c3aed;
}

.feature-icon--orange {
    background: #fff7ed;
    color: #ea580c;
}

.feature-icon--teal {
    background: #f0fdfa;
    color: #0d9488;
}

.feature-icon--red {
    background: #fff1f2;
    color: #e11d48;
}

/* ─── Texto XREF home (debajo del listado de provincias) ──────── */
.xor-texto-home {
    margin-top: 2.75rem;
    padding: 1.75rem 2rem;
    background: var(--color-surface, #f8f9fb);
    border: 1px solid var(--color-border, #e2e6ed);
    border-radius: 12px;
    line-height: 1.8;
    color: var(--color-text, #1e2a3a);
}

.xor-texto-home p {
    margin: 0 0 1rem;
    font-size: .9375rem;
}

.xor-texto-home p:last-child {
    margin-bottom: 0;
}

.xor-texto-home strong {
    color: var(--color-primary, #2563eb);
    font-weight: 650;
}

.xor-texto-home::before {
    content: '';
    display: block;
    width: 3rem;
    height: 3px;
    background: var(--color-primary, #2563eb);
    border-radius: 2px;
    margin-bottom: 1.25rem;
    opacity: .6;
}

@media (max-width: 640px) {
    .features-grid {
        grid-template-columns: 1fr 1fr;
        gap: .75rem;
    }

    .feature-card {
        padding: 1.1rem 1rem;
    }

    .xor-texto-home {
        padding: 1.25rem 1rem;
        margin-top: 2rem;
    }

    .xor-texto-home p {
        font-size: .9rem;
    }
}

@media (max-width: 420px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Enlazado Interno XREF (Calles, Municipios, Provincias) ──────── */
.xor-grid-cercanos-wrap {
    max-width: 1000px;
    margin: 3rem auto;
    padding: 0 1rem;
    text-align: center;
}

.xor-grid-cercanos-wrap h3 {
    font-size: 1.15rem;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.xor-grid-cercanos {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    text-align: left;
}

.xor-grid-cercanos a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text, #334155);
    font-weight: 500;
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.xor-grid-cercanos a:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.xor-grid-cercanos a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-primary, #1e3a8a);
    stroke-width: 2;
}

.xor-grid-cercanos a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 900px) {
    .xor-grid-cercanos {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .xor-grid-cercanos {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Página: Sobre Nosotros
   ========================================================================== */
.sobre-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.sobre-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--color-primary-light, #eff6ff);
    color: var(--color-primary, #2563eb);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.sobre-hero__icon svg {
    width: 32px;
    height: 32px;
}

.sobre-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 1rem;
    color: var(--color-text-dark, #0f172a);
    letter-spacing: -0.025em;
}

.sobre-lead {
    font-size: 1.15rem;
    color: var(--color-muted, #6b7280);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.sobre-contenido {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .05), 0 2px 4px -2px rgba(0, 0, 0, .05);
    border: 1px solid var(--color-border);
}

.sobre-seccion {
    margin-bottom: 3rem;
}

.sobre-seccion:last-child {
    margin-bottom: 0;
}

.sobre-seccion h2 {
    font-size: 1.5rem;
    color: var(--color-text-dark, #0f172a);
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    display: inline-block;
}

.sobre-seccion p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text, #334155);
    margin: 0 0 1.25rem 0;
}

.sobre-seccion p:last-child {
    margin-bottom: 0;
}

.sobre-seccion a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    text-underline-offset: 4px;
    transition: all 0.2s;
}

.sobre-seccion a:hover {
    text-decoration-color: var(--color-primary);
}

.sobre-contacto-box {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-surface);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    margin-top: 1rem;
    font-weight: 500;
    color: var(--color-text-dark);
}

.sobre-contacto-box svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

.sobre-aviso {
    max-width: 720px;
    margin: 3rem auto 0;
    padding: 1.5rem;
    background: #fff7ed;
    border-left: 4px solid #ea580c;
    border-radius: 0 8px 8px 0;
}

.sobre-aviso p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #9a3412;
}

.sobre-aviso strong {
    color: #7c2d12;
}

@media (max-width: 640px) {
    .sobre-hero h1 {
        font-size: 2rem;
    }

    .sobre-lead {
        font-size: 1.05rem;
    }

    .sobre-contenido {
        padding: 2rem 1.5rem;
    }

    .sobre-seccion h2 {
        font-size: 1.3rem;
    }

    .sobre-seccion p {
        font-size: 1rem;
    }
}

/* --- Menú móvil (Sandwich/Hamburger) --- */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--color-text);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 640px) {
    .sobre-hero h1 {
        font-size: 2rem;
    }

    .sobre-lead {
        font-size: 1.05rem;
    }

    .sobre-contenido {
        padding: 2rem 1.5rem;
    }

    .sobre-seccion h2 {
        font-size: 1.3rem;
    }

    .sobre-seccion p {
        font-size: 1rem;
    }
}

@media (max-width: 540px) {
    .site-header {
        position: relative;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-header-bg);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        border-top: 1px solid var(--color-border);
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav a {
        width: 100%;
        padding: 0.75rem 1rem;
        border-radius: 8px;
    }

    .site-nav a .nav-label {
        display: inline;
    }

    .site-header .container {
        padding-block: 0.75rem;
        flex-wrap: wrap;
        /* previene problemas de flex layout raro si cambian los tamaños */
    }
}

@media (max-width: 400px) {
    .site-logo {
        font-size: 1.2rem;
    }

    .site-logo span {
        display: none;
    }
}

/* =============================================================
   PUBLICIDAD — Slots AdSense (activos solo cuando ENABLE_ADS=true)
   Anti-CLS: cada contenedor reserva su altura antes de que
   AdSense inyecte el iframe, evitando Layout Shifts.
   ============================================================= */

/* Base — todos los slots
   · contain:layout paint → barrera CSS: AdSense no puede afectar el layout exterior
   · position:relative    → requerido para que contain funcione correctamente
   · overflow:hidden      → refuerzo adicional frente a iframes sobredimensionados
*/
.ad-slot {
    width: 100%;
    overflow: hidden !important;
    position: relative;
    contain: layout paint;
}

/* Barrera de altura máxima con !important para combatir overrides de AdSense */
.ad-slot--header_under_search,
.ad-slot--in_content_data,
.ad-slot--pre_footer,
.ad-slot--in-feed,
.ad-slot--in_feed_list,
.ad-slot--sidebar_sticky {
    max-height: 280px !important;
}

/* Banner horizontal bajo el buscador y pre-footer */
.ad-slot--header_under_search,
.ad-slot--pre_footer {
    height: 280px;
    overflow-y: hidden;
    margin: 1.5rem 0;
    text-align: center;
}

/* In-Feed (nativo entre listas)
   .ad-slot--in-feed       → clase en producción (hardcoded en AdsManager)
   .ad-slot--in_feed_list  → clase generada por renderPlaceholder() en modo test
*/
.ad-slot--in-feed,
.ad-slot--in_feed_list {
    height: 280px;
    overflow: hidden;
    margin: 1rem 0;
}

/* In-Article (entre tabla de datos y mapa) */
.ad-slot--in_content_data {
    height: 280px;
    overflow-y: hidden;
    margin: 2rem 0;
    text-align: center;
}

/* Skyscraper lateral (calle, escritorio) */
.ad-slot--sidebar_sticky {
    height: 280px;
    overflow-y: hidden;
    position: sticky;
    top: 80px;
    /* Compensa la altura del header */
}

/* Responsive — en móvil los slots mantienen la altura fija pero se reducen */
@media (max-width: 640px) {

    .ad-slot--header_under_search,
    .ad-slot--pre_footer {
        height: 280px;
    }

    .ad-slot--in_content_data {
        height: 280px;
    }

    .ad-slot--sidebar_sticky {
        height: 0;
        overflow: hidden;
        position: static;
    }
}

/* ── Modo prueba de anuncios (ADS_TEST_MODE = true) ─────────────────────── */
.ad-slot--test {
    background: hsl(38, 95%, 97%);
    border: 2px dashed hsl(38, 90%, 55%);
    border-radius: var(--radius-md, 8px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    /* La altura la fija la clase específica del slot (280px) */
}

.ad-test-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem;
    color: hsl(30, 60%, 35%);
    text-align: center;
}

.ad-test-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: hsl(30, 65%, 28%);
}

.ad-test-meta {
    font-size: 0.73rem;
    color: hsl(30, 40%, 50%);
}

.ad-test-meta code {
    font-family: var(--font-mono, monospace);
    background: hsl(38, 80%, 88%);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-size: 0.72rem;
}

/* ====== FAB SHARE ====== */
.fab-share {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background-color: var(--color-primary, #2563eb);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
    /* Optimizaci�n Core Web Vitals */
    contain: layout style;
    will-change: transform;
}

.fab-share:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
    background-color: var(--color-primary-dark, #1d4ed8);
}

.fab-share:active {
    transform: translateY(0) scale(0.95);
}

.fab-share svg {
    width: 24px;
    height: 24px;
}

/* Toast (Notificaci�n de copiado) */
.toast-share {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #334155;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    /* Optimizaci�n Core Web Vitals */
    contain: layout paint style;
    will-change: bottom;
}

.toast-share.show {
    bottom: 2.5rem;
}

@media (max-width: 768px) {
    .fab-share {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 3rem;
        height: 3rem;
    }

    .fab-share svg {
        width: 20px;
        height: 20px;
    }

    .toast-share.show {
        bottom: 2rem;
    }
}

@media (max-width: 640px) {
    .sedecatastro-content {
        padding: 1.5rem 1rem 2rem !important;
    }

    .xor-badge-hero {
        max-width: 100%;
        height: auto !important;
        white-space: normal;
        text-align: center;
        line-height: 1.3;
    }
}