/*
 * Shared styles for the three public legal pages (/privacidad, /terminos, /eliminacion-datos).
 * Served as a static file from public/ (no session, no CDN, no web fonts): the pages must
 * render without network. Palette derived from --brand #017fc3 only.
 */

:root {
  --brand: #017fc3;
  --brand-dark: #015d8f;
  --brand-deep: #01466b;
  --brand-tint: #e6f2f9;
  --brand-line: #b3d8ed;
  --link: #015d8f;
  --ink: #1f2933;
  --muted: #5b6b79;
  --line: #e3e8ee;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --focus: #017fc3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 18px 40px -28px rgba(16, 24, 40, .35);
  color-scheme: light;
}

/* Dark: the theme chosen in the app (legal.js sets data-theme); the system one without script */
:root[data-theme="dark"] {
  --brand-tint: #0d2a3b;
  --brand-line: #1d4d69;
  --link: #6cc1ef;
  --ink: #e4e9ee;
  --muted: #9fb0bf;
  --line: #2a3541;
  --bg: #0f151b;
  --surface: #161e26;
  --surface-2: #1c2630;
  --focus: #6cc1ef;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 40px -28px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand-tint: #0d2a3b;
    --brand-line: #1d4d69;
    --link: #6cc1ef;
    --ink: #e4e9ee;
    --muted: #9fb0bf;
    --line: #2a3541;
    --bg: #0f151b;
    --surface: #161e26;
    --surface-2: #1c2630;
    --focus: #6cc1ef;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 40px -28px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  background: var(--surface); color: var(--link); padding: 8px 14px; border-radius: 8px;
  box-shadow: var(--shadow); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 24px; }

/* Encabezado: azul estándar con algo de profundidad */
.site-header {
  background-color: var(--brand);
  background-image: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 70%, var(--brand-deep) 100%);
  color: #fff;
}
.site-header .bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding-top: 16px; padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
}
.legal-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.legal-nav a {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  color: #fff; text-decoration: none; font-size: 14px; font-weight: 500;
  background: rgba(0, 0, 0, .14);
}
.legal-nav a:hover { background: rgba(0, 0, 0, .26); }
.legal-nav a[aria-current="page"] { background: #fff; color: var(--brand-deep); font-weight: 600; }
.site-header :focus-visible { outline-color: #fff; }
.site-header .title { padding-top: 28px; padding-bottom: 34px; }
.site-header h1 { margin: 0; font-size: clamp(26px, 4.2vw, 34px); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }

/* Contenido */
main { padding-top: 0; padding-bottom: 48px; }
.doc {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); margin-top: -18px; position: relative;
  padding: 32px 40px 16px;
}
.doc > * { max-width: 70ch; }

.meta {
  margin: 0 0 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 14.5px;
}
.meta b { color: var(--ink); }

.toc {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; margin: 0 0 28px; font-size: 14.5px;
}
.toc-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toc ol { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 28px; }
.toc li { break-inside: avoid; padding: 3px 0; font-size: inherit; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

section { scroll-margin-top: 16px; }
h2 {
  display: flex; align-items: baseline; gap: 10px;
  margin: 34px 0 10px; font-size: 19px; line-height: 1.35; color: var(--ink);
  scroll-margin-top: 16px;
}
.doc section:first-of-type h2 { margin-top: 0; }
h2 .num {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 26px; padding: 0 6px; border-radius: 7px;
  background: var(--brand-tint); color: var(--link); font-size: 14px; font-weight: 700;
}
p, li { font-size: 16px; }
p { margin: 0 0 14px; }
ul { padding-left: 22px; margin: 0 0 16px; }
ul li { margin-bottom: 6px; }
ul li::marker { color: var(--brand); }

/* Ficha del responsable */
.party {
  display: grid; grid-template-columns: minmax(140px, 34%) 1fr;
  margin: 12px 0 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  font-size: 15px;
}
.party dt, .party dd { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); }
.party dt:first-of-type, .party dt:first-of-type + dd { border-top: 0; }
.party dt { background: var(--surface-2); color: var(--muted); font-weight: 600; }

/* Pasos numerados */
.steps { list-style: none; counter-reset: step; margin: 14px 0 22px; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 2px 0 18px 48px; margin: 0; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 15px;
}
.steps li::after {
  content: ""; position: absolute; left: 15px; top: 36px; bottom: 2px; width: 2px;
  background: var(--brand-line);
}
.steps li:last-child { padding-bottom: 2px; }
.steps li:last-child::after { display: none; }
.subject {
  display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; color: var(--link);
}

/* Plazo destacado */
.callout {
  display: flex; align-items: center; gap: 12px;
  background: var(--brand-tint); border: 1px solid var(--brand-line); border-left: 4px solid var(--brand);
  border-radius: 10px; padding: 14px 18px; margin: 8px 0 18px;
  font-size: 17px; font-weight: 600; color: var(--ink);
}

/* Nota neutra */
.note {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 20px 4px; margin: 28px 0 18px;
}
.note h2 { margin-top: 0; font-size: 17px; }

/* Aviso de cierre */
.aside {
  background: var(--surface-2); border-left: 3px solid var(--brand); border-radius: 0 10px 10px 0;
  padding: 12px 16px; margin: 28px 0 18px; font-size: 15px; color: var(--muted);
}

/* Pie */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.site-footer p { margin: 0; font-size: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-footer li { margin: 0; font-size: 14px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .doc { border-radius: 12px; padding: 22px 18px 8px; margin-top: -14px; }
  .site-header .title { padding-top: 20px; padding-bottom: 28px; }
  .toc ol { columns: 1; }
  .party { grid-template-columns: 1fr; }
  .party dt { border-top: 1px solid var(--line); padding-bottom: 2px; }
  .party dd { border-top: 0; padding-top: 2px; }
  .party dt:first-of-type { border-top: 0; }
  .callout { font-size: 16px; }
}

@media print {
  :root { --ink: #000; --muted: #333; --line: #bbb; --bg: #fff; --surface: #fff; --surface-2: #fff; --link: #000; --brand: #000; --brand-tint: #fff; --brand-line: #999; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .skip-link, .legal-nav, .toc { display: none; }
  .site-header { background: none; color: #000; border-bottom: 1px solid #000; }
  .site-header .bar { border: 0; padding-bottom: 0; }
  .brand-mark { box-shadow: inset 0 0 0 1px #000; background: none; }
  .site-header .title { padding: 8px 0 12px; }
  .doc { box-shadow: none; border: 0; margin: 0; padding: 12px 0 0; }
  .doc > * { max-width: none; }
  .wrap { max-width: none; padding: 0; }
  h2 { break-after: avoid; }
  section, .party, .steps li, .callout, .note { break-inside: avoid; }
  .steps li::before { background: #fff; color: #000; border: 1px solid #000; }
  a { color: #000; }
  .doc a[href]::after { content: " (" attr(href) ")"; font-size: 90%; }
  .doc a[href^="mailto:"]::after { content: ""; }
  .site-footer ul { display: none; }
}

/* «Volver»: back to the app */
.volver {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  color: #fff; text-decoration: none; font-size: 14px; font-weight: 600;
  background: rgba(0, 0, 0, .18);
}
.volver:hover { background: rgba(0, 0, 0, .3); text-decoration: none; }
.brand-group { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
@media print { .volver { display: none; } }

/* «Esta página no existe» (public/errors/404.html): the same frame as the legal pages */
.not-found { padding-bottom: 32px; }
.not-found-code { margin: 0 0 8px; font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--brand); }
.not-found-actions { margin-top: 24px; }
.button-primary {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600; text-decoration: none;
}
.button-primary:hover { background: var(--brand-deep); text-decoration: none; }
@media print { .not-found-actions { display: none; } }
