/* ============================================================
   Robin · legal-document.css
   Estilo "documento jurídico" reutilizado del visor de sentencias
   (app/sentencias/router.py _BASE_CSS) para todas las páginas
   legales: aviso legal, privacidad, cookies, términos, DPA.
   ============================================================ */

:root {
  --robin-ink: #0f1419;
  --robin-text: #1c1f24;
  --robin-muted: #5b6577;
  --robin-soft: #8a92a3;
  --robin-line: #e3e6ec;
  --robin-bg: #ffffff;
  --robin-paper: #f3f4f6;
  --robin-accent: #8b7cf6;
  --watermark: url("robin-character.png");
}

* { box-sizing: border-box; }
html, body { background: var(--robin-paper); }
body {
  font-family: "Iowan Old Style", "Charter", "Palatino Linotype",
               "Book Antiqua", Georgia, "Times New Roman", serif;
  color: var(--robin-text);
  line-height: 1.7;
  margin: 0;
  padding: 0;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
}

/* Barra superior mínima para volver a la web */
.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 244, 246, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--robin-line);
}
.legal-topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.legal-topbar a.back {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--robin-muted);
  text-decoration: none;
  letter-spacing: .02em;
}
.legal-topbar a.back:hover { color: var(--robin-ink); }
.legal-topbar .nav {
  display: flex;
  gap: 18px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
}
.legal-topbar .nav a {
  color: var(--robin-soft);
  text-decoration: none;
  letter-spacing: .02em;
}
.legal-topbar .nav a:hover { color: var(--robin-ink); }
.legal-topbar .nav a.current { color: var(--robin-accent); font-weight: 600; }

/* Hoja A4 con sombra y marca de agua */
.sheet {
  background: var(--robin-bg);
  max-width: 820px;
  margin: 28px auto 60px;
  padding: 36px 72px 72px;
  position: relative;
  box-shadow: 0 1px 3px rgba(15,20,25,.04), 0 8px 32px rgba(15,20,25,.07);
  overflow: hidden;
  min-height: 1100px;
}
.sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--watermark);
  background-repeat: no-repeat;
  background-position: 92% 38%;
  background-size: 360px auto;
  opacity: .035;
  pointer-events: none;
  transform: rotate(-18deg);
}

/* Cabecera con logo + referencia (versión y fecha) */
header.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  position: relative;
}
header.brand .logo img {
  height: 66px;
  width: auto;
  display: block;
  margin-left: -2px;
}
header.brand .ref {
  font-family: "iA Writer Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--robin-soft);
  letter-spacing: .02em;
  text-align: right;
  line-height: 1.5;
}

/* Bloque tipo CENDOJ con metadatos (responsable, versión, vigencia) */
.cendoj-block {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--robin-text);
  border-top: 1px solid var(--robin-line);
  border-bottom: 1px solid var(--robin-line);
  padding: 14px 0;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 18px;
}
.cendoj-block .k { color: var(--robin-muted); font-weight: 600; }
.cendoj-block .v { color: var(--robin-ink); }

/* Bloque del título centrado (TIPO DOCUMENTO / subtítulo) */
.title-block {
  text-align: center;
  margin: 24px 0 30px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.title-block .court {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .55em;
  text-transform: uppercase;
  color: var(--robin-ink);
  margin-bottom: 6px;
  padding-right: -.55em;
}
.title-block .sala {
  font-size: 15px;
  font-weight: 500;
  color: var(--robin-text);
  margin-bottom: 22px;
  letter-spacing: .04em;
}

/* Cuerpo justificado con tipografía serif */
article.cuerpo {
  font-size: 16.5px;
  line-height: 1.78;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
article.cuerpo > p { margin: 0 0 14px 0; text-indent: 0; }
article.cuerpo ul,
article.cuerpo ol {
  margin: 0 0 14px 0;
  padding-left: 22px;
}
article.cuerpo li { margin-bottom: 6px; }

/* Encabezados de sección estilo CENDOJ: mayúsculas espaciadas y centradas */
article.cuerpo h2.seccion {
  text-align: center;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .35em;
  word-spacing: 1em;
  color: var(--robin-ink);
  text-transform: uppercase;
  margin: 42px 0 24px;
  padding-right: -.35em;
}
article.cuerpo h3 {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--robin-ink);
  margin: 28px 0 12px;
  text-align: left;
}
article.cuerpo .ordinal {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--robin-ink);
  text-transform: uppercase;
  font-size: .94em;
}

/* Bloque destacado para puntos críticos (datos del responsable, contacto DPO) */
article.cuerpo .bloque-destacado {
  background: #faf8ff;
  border-left: 3px solid var(--robin-accent);
  border-radius: 0 6px 6px 0;
  padding: 14px 20px 6px;
  margin: 18px 0;
  font-size: 15px;
  text-align: left;
}
article.cuerpo .bloque-destacado p { margin-bottom: 8px; }
article.cuerpo .bloque-destacado strong { color: var(--robin-ink); }

/* Tabla (cookies, encargados, sub-encargados, plazos) */
article.cuerpo table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 22px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  text-align: left;
}
article.cuerpo table thead th {
  background: #f7f6fb;
  color: var(--robin-ink);
  font-weight: 600;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--robin-line);
  padding: 10px 12px;
}
article.cuerpo table tbody td {
  border-bottom: 1px solid var(--robin-line);
  padding: 10px 12px;
  color: var(--robin-text);
  vertical-align: top;
}
article.cuerpo table tbody tr:last-child td { border-bottom: 0; }

/* Pie de página: marca + identificador del documento */
footer.pie {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--robin-line);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 11px;
  color: var(--robin-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
footer.pie strong { color: var(--robin-ink); font-weight: 600; }
footer.pie .links a {
  color: var(--robin-soft);
  text-decoration: none;
  margin-left: 12px;
}
footer.pie .links a:hover { color: var(--robin-ink); }

/* Responsivo móvil */
@media (max-width: 720px) {
  .sheet {
    margin: 0;
    padding: 24px 22px 48px;
    box-shadow: none;
    min-height: 0;
  }
  header.brand { flex-direction: column; align-items: flex-start; gap: 10px; }
  header.brand .logo img { height: 30px; margin-left: 0; }
  header.brand .ref { text-align: left; }
  .title-block .court { font-size: 17px; letter-spacing: .35em; }
  .cendoj-block { font-size: 12px; grid-template-columns: 1fr; }
  .cendoj-block .k { margin-top: 4px; }
  article.cuerpo h2.seccion { font-size: 12.5px; letter-spacing: .25em; word-spacing: .6em; }
  article.cuerpo table { font-size: 12px; }
  article.cuerpo table thead th,
  article.cuerpo table tbody td { padding: 8px 9px; }
  .legal-topbar-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* Print: A4 limpio con paginación Robin */
@media print {
  html, body { background: #fff; }
  .legal-topbar { display: none; }
  .sheet {
    box-shadow: none;
    margin: 0;
    padding: 14mm 18mm 18mm;
    max-width: none;
    min-height: 0;
  }
  .sheet::before {
    background-position: 90% 30%;
    background-size: 320px auto;
    opacity: .04;
  }
  @page {
    size: A4;
    margin: 12mm 14mm 14mm;
    @bottom-right {
      content: "Robin · " counter(page) " / " counter(pages);
      font-family: ui-sans-serif, system-ui, sans-serif;
      font-size: 9pt;
      color: #8a92a3;
    }
  }
}
