/* =========================================================
   PÁGINAS LEGALES - anunciosjuridicos.es
   Aviso legal, privacidad, cookies, condiciones y accesibilidad.
   Usa las variables de color de web-fluid.css.
   ========================================================= */

/* --- Accesibilidad base --- */
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 9999; padding: .75rem 1rem; background: #fff; color: #025197; border: 3px solid #025197; border-radius: 4px; font-weight: bold; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid #046ac4; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors: active) { :focus-visible { outline: 3px solid CanvasText; } }

html { scroll-behavior: smooth; }

.legal-page {
    --lg-azul: var(--color-primario, #025197);
    --lg-azul-2: var(--color-secundario, #046ac4);
    --lg-azul-claro: var(--color-azul-claro, #e9f2fc);
    --lg-texto: #2f3640;
    --lg-suave: #5f6b7a;
    --lg-borde: #e3e8ef;
    font-family: Arial, sans-serif;
    color: var(--lg-texto);
    padding-bottom: 50px;
}

/* --- Cabecera de la página --- */
.legal-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #013a6e 0%, var(--lg-azul) 55%, var(--lg-azul-2) 100%);
    color: #fff;
    padding: 48px 20px 54px;
}
.legal-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    border: 40px solid rgba(255, 255, 255, .06);
    pointer-events: none;
}
.legal-hero-inner { position: relative; max-width: 1140px; margin: 0 auto; }
.legal-kicker {
    display: inline-block;
    margin: 0 0 14px;
    padding: 5px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .15);
    font-size: 13px;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.legal-hero h1 {
    margin: 0 0 12px;
    font-size: 40px;
    line-height: 1.15;
    color: #fff;
    text-shadow: none;
}
.legal-lead { max-width: 720px; margin: 0 0 18px; font-size: 17px; line-height: 1.6; color: rgba(255, 255, 255, .92); }
.legal-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; font-size: 14px; color: rgba(255, 255, 255, .85); }
.legal-meta span::before { content: "•"; margin-right: 8px; opacity: .6; }
.legal-meta span:first-child::before { content: none; }

/* --- Distribución: índice + contenido --- */
.legal-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 40px;
    max-width: 1140px;
    margin: -26px auto 0;
    padding: 0 20px;
    position: relative;
}

/* --- Índice --- */
.legal-toc { align-self: start; position: sticky; top: 96px; }
.legal-toc details {
    background: #fff;
    border: 1px solid var(--lg-borde);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(2, 81, 151, .08);
    overflow: hidden;
}
.legal-toc summary {
    cursor: pointer;
    list-style: none;
    padding: 16px 20px;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--lg-azul);
    border-bottom: 1px solid var(--lg-borde);
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after { content: "▾"; float: right; transition: transform .2s ease; }
.legal-toc details:not([open]) summary { border-bottom: 0; }
.legal-toc details:not([open]) summary::after { transform: rotate(-90deg); }
.legal-toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 8px 0; }
.legal-toc li { counter-increment: toc; margin: 0; }
.legal-toc a {
    display: flex;
    gap: 10px;
    padding: 8px 20px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--lg-texto);
    text-decoration: none;
    border-left: 3px solid transparent;
}
.legal-toc a::before { content: counter(toc); min-width: 18px; font-weight: bold; color: var(--lg-azul); }
.legal-toc a:hover, .legal-toc a:focus-visible { background: var(--lg-azul-claro); border-left-color: var(--lg-azul); color: var(--lg-azul); }

/* --- Contenido --- */
.legal-body { min-width: 0; }
.legal-section {
    background: #fff;
    border: 1px solid var(--lg-borde);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: 0 4px 14px rgba(2, 81, 151, .04);
    scroll-margin-top: 20px;
}
.legal-section h2 {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 18px;
    font-size: 24px;
    line-height: 1.25;
    color: var(--lg-azul);
    text-shadow: none;
}
.legal-num {
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--lg-azul-claro);
    color: var(--lg-azul);
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
}
.legal-section h3 { margin: 22px 0 8px; font-family: Arial, sans-serif !important; font-weight: bold !important; font-size: 17px; color: var(--lg-texto); text-shadow: none; }
.legal-section p, .legal-section li { font-size: 15.5px; line-height: 1.75; color: var(--lg-texto); }
.legal-section p { margin: 0 0 14px; }
.legal-section p:last-child { margin-bottom: 0; }
.legal-section a { color: var(--lg-azul); font-weight: bold; text-decoration: underline; text-underline-offset: 2px; }
.legal-section a:hover { text-decoration: none; }

.legal-list { list-style: none; margin: 0 0 14px; padding: 0; }
.legal-list li { position: relative; padding-left: 28px; margin-bottom: 8px; }
.legal-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: .7em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lg-azul-2);
}
.legal-list-check li::before {
    content: "✓";
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    background: none;
    color: #1d7a3a;
    font-weight: bold;
}

/* --- Ficha de datos --- */
.legal-ficha {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 16px;
    border: 1px solid var(--lg-borde);
    border-radius: 10px;
    overflow: hidden;
    background: var(--lg-borde);
}
.legal-ficha div { background: #fbfcfe; padding: 14px 18px; }
.legal-ficha div.legal-ficha-ancha { grid-column: 1 / -1; }
.legal-ficha dt { margin: 0 0 3px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--lg-suave); }
.legal-ficha dd { margin: 0; font-size: 15.5px; font-weight: bold; color: var(--lg-texto); line-height: 1.5; }
.legal-ficha dd a { font-weight: bold; }

/* --- Avisos destacados --- */
.legal-callout {
    display: flex;
    gap: 14px;
    margin: 0 0 16px;
    padding: 16px 20px;
    border-radius: 10px;
    background: var(--lg-azul-claro);
    border-left: 5px solid var(--lg-azul);
}
.legal-callout-icono { flex: 0 0 auto; font-size: 22px; line-height: 1.3; }
.legal-callout p { margin: 0 0 8px; }
.legal-callout p:last-child { margin: 0; }
.legal-callout-ok { background: #ecfdf3; border-left-color: #1d7a3a; }
.legal-callout-aviso { background: #fff8e6; border-left-color: #b7791f; }

/* --- Tablas --- */
.legal-tabla-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--lg-borde); border-radius: 10px; }
.legal-tabla { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.legal-tabla caption { text-align: left; padding: 12px 16px; font-weight: bold; color: var(--lg-azul); background: #fbfcfe; border-bottom: 1px solid var(--lg-borde); }
.legal-tabla th, .legal-tabla td { padding: 12px 16px; text-align: left; vertical-align: top; line-height: 1.55; border-bottom: 1px solid var(--lg-borde); }
.legal-tabla thead th { background: var(--lg-azul); color: #fff; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; }
.legal-tabla tbody tr:nth-child(even) td, .legal-tabla tbody tr:nth-child(even) th { background: #f8fafc; }
.legal-tabla tbody tr:last-child td, .legal-tabla tbody tr:last-child th { border-bottom: 0; }
.legal-tabla tbody th { font-weight: bold; color: var(--lg-texto); }

/* --- Pasos --- */
.legal-pasos { list-style: none; counter-reset: paso; margin: 0 0 16px; padding: 0; }
.legal-pasos li { counter-increment: paso; position: relative; padding: 0 0 18px 56px; }
.legal-pasos li::before {
    content: counter(paso);
    position: absolute;
    left: 0;
    top: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--lg-azul);
    color: #fff;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}
.legal-pasos li::after { content: ""; position: absolute; left: 18px; top: 40px; bottom: 2px; width: 2px; background: var(--lg-borde); }
.legal-pasos li:last-child { padding-bottom: 0; }
.legal-pasos li:last-child::after { content: none; }
.legal-pasos strong { display: block; color: var(--lg-azul); }

/* --- Bloque de texto modelo --- */
.legal-modelo {
    margin: 0 0 16px;
    padding: 18px 22px;
    border: 1px dashed #9db4cc;
    border-radius: 10px;
    background: #fbfcfe;
    font-size: 15px;
    line-height: 1.7;
}
.legal-modelo p { margin: 0 0 8px; }

/* --- Volver arriba --- */
.legal-arriba { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: normal !important; color: var(--lg-suave) !important; text-decoration: none !important; }
.legal-arriba:hover { color: var(--lg-azul) !important; text-decoration: underline !important; }

/* --- Otras páginas legales --- */
.legal-relacionadas {
    max-width: 1140px;
    margin: 20px auto 0;
    padding: 0 20px;
}
.legal-relacionadas-inner {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 40px;
}
.legal-relacionadas-caja {
    grid-column: 2;
    padding: 22px 26px;
    border-radius: 12px;
    background: var(--lg-azul-claro);
}
.legal-relacionadas h2 { margin: 0 0 12px; font-family: Arial, sans-serif !important; font-weight: bold !important; font-size: 16px; color: var(--lg-azul); text-shadow: none; }
.legal-relacionadas ul { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; }
.legal-relacionadas a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #c9d8ea;
    color: var(--lg-azul);
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}
.legal-relacionadas a:hover { background: var(--lg-azul); color: #fff; border-color: var(--lg-azul); }
.legal-relacionadas a[aria-current="page"] { background: var(--lg-azul); color: #fff; border-color: var(--lg-azul); }

/* --- Móvil y tableta --- */
@media (max-width: 900px) {
    .legal-hero { padding: 36px 20px 46px; }
    .legal-hero h1 { font-size: 30px; }
    .legal-lead { font-size: 16px; }
    .legal-layout, .legal-relacionadas-inner { grid-template-columns: 1fr; gap: 20px; }
    .legal-relacionadas-caja { grid-column: 1; }
    .legal-toc { position: static; }
    .legal-section { padding: 22px 20px; }
    .legal-section h2 { font-size: 21px; }
}
@media (max-width: 600px) {
    .legal-ficha { grid-template-columns: 1fr; }
    .legal-tabla thead { display: none; }
    .legal-tabla, .legal-tabla tbody, .legal-tabla tr, .legal-tabla th, .legal-tabla td { display: block; width: 100%; box-sizing: border-box; }
    .legal-tabla tr { border-bottom: 1px solid var(--lg-borde); }
    .legal-tabla tbody tr:last-child { border-bottom: 0; }
    .legal-tabla td, .legal-tabla th { border: 0; padding: 4px 16px; }
    .legal-tabla tbody th { padding-top: 14px; }
    .legal-tabla td:last-child { padding-bottom: 14px; }
    .legal-tabla td[data-label]::before { content: attr(data-label) ": "; font-weight: bold; color: var(--lg-suave); }
}

/* --- Impresión --- */
@media print {
    .skip-link, .cab, footer, .enlaces-interes-section, .ediciones-disponibles-section, .legal-toc, .legal-relacionadas, .legal-arriba { display: none !important; }
    .legal-hero { background: none; color: #000; padding: 0 0 12px; }
    .legal-hero h1, .legal-lead, .legal-meta, .legal-kicker { color: #000; background: none; }
    .legal-layout { display: block; margin: 0; padding: 0; }
    .legal-section { box-shadow: none; border: 0; border-bottom: 1px solid #999; border-radius: 0; padding: 12px 0; break-inside: avoid-page; }
    .legal-tabla thead th { background: #eee; color: #000; }
}
