/* ==========================================================================
   RaOrg – Páginas legales (Términos de uso / Privacidad)
   ========================================================================== */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    color-scheme: light;
    --bg-body: #f5f5f5;
    --bg-container: #ffffff;
    --bg-panel: #f8f8f8;
    --text-main: #222222;
    --text-secondary: #555555;
    --text-muted: #6b6b6b;
    --border-color: #e0e0e0;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --link: #0062cc;
    --accent-soft: #e8f2ff;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --warn-bg: #fff8e8;
    --warn-border: #f5a623;
    --danger: #c93a3a;
    --danger-soft: #fff0f0;
    --navy-1: #1a1a2e;
    --navy-2: #16213e;
    --navy-3: #0f3460;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-body: #121212;
    --bg-container: #1e1e1e;
    --bg-panel: #181818;
    --text-main: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #8f8f8f;
    --border-color: #333333;
    --link: #5aaeff;
    --accent-soft: #1a2a3a;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --warn-bg: #2a2010;
    --danger: #ff7b7b;
    --danger-soft: #3a1c1c;
}

/* ── Base ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

html:has(dialog[open]) { overflow: hidden; }

body {
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

p {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-secondary);
}
p + p { margin-top: 12px; }

a.inline {
    color: var(--link);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}
a.inline:hover { text-decoration-thickness: 2px; }

code.scope {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.85em;
    word-break: break-word;
}

.icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    background: var(--primary-color);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    z-index: 300;
    transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ── Nav ───────────────────────────────────────────────────────────────── */
.site-nav {
    background: var(--bg-container);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}

.nav-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav-actions { display: flex; align-items: center; gap: 10px; }

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
}
.nav-logo img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}
.nav-logo span {
    font-family: 'Outfit', 'Roboto', sans-serif;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}
.nav-back:hover { background: var(--accent-soft); }

.theme-btn {
    background: none;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    transition: all 0.2s;
}
.theme-btn:hover { border-color: var(--primary-color); color: var(--link); }

.theme-btn .icon-sun { display: none; }
[data-theme="dark"] .theme-btn .icon-sun { display: block; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--navy-1) 0%, var(--navy-2) 50%, var(--navy-3) 100%);
    color: #fff;
    text-align: center;
    padding: 56px 24px 48px;
}

.hero-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.hero h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.hero p {
    font-size: 15px;
    opacity: 0.9;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
    color: #fff;
}

.hero-date {
    display: inline-block;
    margin-top: 16px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.14);
    padding: 4px 14px;
    border-radius: 20px;
    color: #fff;
}

/* ── Contenido ─────────────────────────────────────────────────────────── */
.content {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* Índice */
.toc {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px 26px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow-color);
}
.toc h2 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.toc ol {
    list-style: none;
    counter-reset: toc;
    columns: 2;
    column-gap: 28px;
}
.toc li { counter-increment: toc; break-inside: avoid; }
.toc a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.toc a::before {
    content: counter(toc);
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--link);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.toc a:hover { background: var(--accent-soft); color: var(--link); }

/* Tarjeta de sección */
.section-card {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 32px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow-color);
    scroll-margin-top: 84px;
    transition: background 0.3s, border-color 0.3s;
}
.section-card:target { border-color: var(--primary-color); }

.section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.section-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--link);
}
.section-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}
.section-num {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: var(--link);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Cajas destacadas */
.highlight-box,
.warning-box {
    border-radius: 0 10px 10px 0;
    padding: 16px 20px;
    margin: 18px 0 6px;
}
.highlight-box {
    background: var(--accent-soft);
    border-left: 4px solid var(--primary-color);
}
.warning-box {
    background: var(--warn-bg);
    border-left: 4px solid var(--warn-border);
}
.highlight-box p,
.warning-box p {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.65;
}
.highlight-box p { font-style: italic; }

/* Listas */
.info-list {
    list-style: none;
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.info-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.info-list .check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--link);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.info-list .check.no {
    background: var(--danger-soft);
    color: var(--danger);
}
.info-list .check .icon { stroke-width: 2.5; }

/* Badges */
.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 13px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}
.badge .icon { color: var(--link); }

/* Enlace a documento relacionado */
.related-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 24px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.related-box p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    flex: 1 1 280px;
}
.related-box a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--link);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 14px;
    border: 1.5px solid var(--link);
    border-radius: 8px;
    transition: background 0.2s;
}
.related-box a:hover { background: var(--accent-soft); }

/* Tarjeta de contacto */
.contact-card {
    background: linear-gradient(135deg, var(--navy-1), var(--navy-3));
    color: #fff;
    border-radius: 14px;
    padding: 30px 32px;
    text-align: center;
    margin-top: 32px;
}
.contact-card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}
.contact-card p {
    font-size: 14px;
    opacity: 0.9;
    color: #fff;
    margin-bottom: 18px;
}
.contact-card a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    color: var(--navy-3);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 10px;
    transition: opacity 0.2s;
}
.contact-card a:hover { opacity: 0.9; }

/* Footer */
.site-footer {
    text-align: center;
    padding: 28px 24px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}
.site-footer a { color: var(--link); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .sep { margin: 0 6px; }

/* Botón volver arriba */
.back-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-container);
    color: var(--link);
    box-shadow: 0 4px 14px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 90;
}
.back-top.show { opacity: 1; visibility: visible; transform: none; }
.back-top:hover { border-color: var(--primary-color); }

/* ── Diálogo de contacto ───────────────────────────────────────────────── */
.contact-dialog {
    border: none;
    border-radius: 20px;
    padding: 0;
    width: calc(100% - 32px);
    max-width: 420px;
    margin: auto;
    background: var(--bg-container);
    color: var(--text-main);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}
.contact-dialog::backdrop {
    background: rgba(0, 20, 50, 0.6);
    backdrop-filter: blur(3px);
}
.contact-dialog[open] { animation: pop 0.25s ease; }

@keyframes pop {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.dialog-body { padding: 44px 32px 32px; text-align: center; position: relative; }

.dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dialog-close:hover { background: var(--bg-panel); color: var(--text-main); }

.dialog-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.contact-dialog h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-main);
}
.dialog-sub { font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

.email-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--accent-soft);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px 12px 18px;
    margin-bottom: 16px;
}
.email-box span {
    font-weight: 700;
    color: var(--link);
    font-size: 15px;
    word-break: break-all;
    text-align: left;
    user-select: all;
}
.copy-btn {
    flex-shrink: 0;
    border: none;
    background: var(--primary-color);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 16px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.2s;
}
.copy-btn:hover { background: var(--primary-hover); }
.copy-btn.copied { background: #1a8f47; }

.mail-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: var(--text-main);
    color: var(--bg-container);
    font-weight: 700;
    font-size: 14px;
    padding: 12px 22px;
    border-radius: 11px;
    transition: opacity 0.2s;
}
.mail-link:hover { opacity: 0.85; }

.dialog-note { margin-top: 22px; font-size: 12px; color: var(--text-muted); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .hero { padding: 44px 20px 40px; }
    .hero h1 { font-size: 1.6rem; }
    .content { padding: 28px 16px 64px; }
    .section-card { padding: 22px 18px; }
    .nav-inner { padding: 12px 16px; }
    .nav-back span { display: none; }
    .nav-back { padding: 8px; }
    .toc { padding: 18px; }
    .toc ol { columns: 1; }
    .related-box { flex-direction: column; align-items: flex-start; }
    .contact-card { padding: 26px 20px; }
    .dialog-body { padding: 44px 20px 24px; }
}

/* ── Impresión ─────────────────────────────────────────────────────────── */
@media print {
    body { background: #fff; color: #000; }
    .site-nav, .toc, .contact-card, .related-box,
    .back-top, .contact-dialog, .skip-link { display: none !important; }
    .hero { background: none; color: #000; padding: 0 0 16px; border-bottom: 2px solid #000; }
    .hero h1, .hero p, .hero-date { color: #000; background: none; }
    .hero-icon { display: none; }
    .content { padding: 16px 0; max-width: none; }
    .section-card { box-shadow: none; border: none; padding: 0 0 12px; break-inside: avoid; }
    p, .info-list li { color: #000; }
    a { color: #000; text-decoration: underline; }
}
