/* Hallmark · macrostructure: long-document · genre: editorial · theme: custom (tokens de marca Patrimonista) · nav: N1a · footer: Ft2
 * Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V4
 *
 * Hoja compartida de las páginas legales (/legal/*.html). Tokens tomados del
 * tailwind.config de app-main (ocean, charcoal, cool) y de la Eina01 que ya
 * sirve la landing desde /fonts. Sin JavaScript obligatorio: legal.js solo
 * abre el índice en escritorio. Se imprime limpio (@media print). */

@font-face {
  font-family: 'Eina01';
  src: url('/fonts/Eina01-Regular.otf') format('opentype');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Eina01';
  src: url('/fonts/Eina01-SemiBold.otf') format('opentype');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --papel: #F8F8FC;
  --tinta: #272938;
  --tinta-suave: #4B4F63;
  --gris: #6F7D89;
  --linea: #DCDEEA;
  --acento: #3816F5;
  --acento-hover: #2F13D6;
  --acento-suave: #E9E5FF;
  --font-texto: 'Eina01', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --medida: 65ch;
  --radio: 4px;
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.25rem;
  --t-lg: 1.5rem;
  --t-xl: clamp(2rem, 1.3rem + 2.2vw, 2.75rem);
  --esp-1: 0.5rem;
  --esp-2: 1rem;
  --esp-3: 1.5rem;
  --esp-4: 2.5rem;
  --esp-5: 4rem;
  --esp-6: 6rem;
  --margen: clamp(1rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; color-scheme: light; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--papel);
  color: var(--tinta);
  font: 400 var(--t-base) / 1.65 var(--font-texto);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--acento); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
a:hover { color: var(--acento-hover); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 2px; }

.saltar { position: absolute; left: -999px; top: 0; background: var(--tinta); color: #fff; padding: 0.5rem 0.75rem; z-index: 10; }
.saltar:focus { left: 1rem; }

/* Cabecera: marca + los dos documentos hermanos */
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--margen);
  border-bottom: 1px solid var(--linea);
}
.marca { font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; color: var(--tinta); text-decoration: none; white-space: nowrap; }
.marca:hover { color: var(--acento); }
.hermanas { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: var(--t-sm); justify-content: flex-end; }
@media (max-width: 40rem) { .cabecera { flex-wrap: wrap; } .hermanas { width: 100%; justify-content: flex-start; } }
.hermanas a { white-space: nowrap; color: var(--tinta-suave); text-decoration: none; padding: 0.5rem 0; }
.hermanas a:hover { color: var(--acento); }

/* Documento: índice lateral + texto a 65ch */
.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--esp-4);
  padding: var(--esp-4) var(--margen) var(--esp-6);
  max-width: 70rem;
  margin: 0 auto;
}
@media (min-width: 60rem) {
  .doc { grid-template-columns: minmax(0, 15rem) minmax(0, var(--medida)); gap: var(--esp-5); padding-top: var(--esp-5); }
}
.texto { min-width: 0; max-width: var(--medida); }

h1, h2, h3 { font-weight: 600; font-style: normal; line-height: 1.15; letter-spacing: -0.015em; overflow-wrap: anywhere; min-width: 0; margin: 0; }
h1 { font-size: var(--t-xl); margin-bottom: var(--esp-3); }
.lede { font-size: var(--t-md); line-height: 1.5; color: var(--tinta-suave); margin: 0 0 var(--esp-4); }

/* Ficha del documento: responsable, domicilio, versión, contacto */
.ficha {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.5rem 1.5rem;
  margin: 0 0 var(--esp-4);
  padding: var(--esp-3) 0;
  border-top: 1px solid var(--tinta);
  border-bottom: 1px solid var(--linea);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}
.ficha div { display: contents; }
.ficha dt { color: var(--gris); font-weight: 600; letter-spacing: 0.02em; }
.ficha dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
  .ficha { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .ficha dt { margin-top: 0.75rem; }
  .ficha div:first-child dt { margin-top: 0; }
}

/* Secciones numeradas: el número es contenido, no decoración */
.texto section { margin-top: var(--esp-5); scroll-margin-top: var(--esp-3); }
.texto section:first-of-type { margin-top: 0; }
.texto section:first-of-type h2 { border-top: 0; padding-top: 0; }
.texto .intro + section { margin-top: var(--esp-4); }
.texto .intro + section h2 { border-top: 1px solid var(--linea); padding-top: var(--esp-2); }
.texto h2 { font-size: var(--t-lg); margin-bottom: var(--esp-2); padding-top: var(--esp-2); border-top: 1px solid var(--linea); }
.texto h2 .num { color: var(--gris); font-variant-numeric: tabular-nums; margin-right: 0.6rem; }
.texto h3 { font-size: var(--t-base); margin: var(--esp-3) 0 var(--esp-1); }
.texto p { margin: 0 0 var(--esp-2); }
.texto ul, .texto ol { padding-left: 1.25rem; margin: 0 0 var(--esp-2); }
.texto li { margin-bottom: 0.35rem; }
.texto li::marker { color: var(--gris); }
.texto strong { font-weight: 600; }

.tabla-scroll { overflow-x: auto; margin: var(--esp-2) 0 var(--esp-3); }
.texto table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); min-width: 34rem; }
.texto th, .texto td { text-align: left; vertical-align: top; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--linea); }
.texto th { color: var(--gris); font-weight: 600; letter-spacing: 0.02em; }

.nota { background: var(--acento-suave); padding: var(--esp-2) var(--esp-3); border-radius: var(--radio); margin: var(--esp-2) 0 var(--esp-3); }
.nota p:last-child { margin-bottom: 0; }

/* Índice: details en móvil; legal.js lo abre en escritorio */
.lateral { min-width: 0; }
@media (min-width: 60rem) {
  .lateral { position: sticky; top: var(--esp-3); align-self: start; max-height: calc(100vh - var(--esp-4)); overflow: auto; }
}
.indice summary { cursor: pointer; font-weight: 600; font-size: var(--t-sm); letter-spacing: 0.02em; color: var(--tinta); padding: 0.5rem 0; list-style: none; border-bottom: 1px solid var(--linea); }
.indice summary::-webkit-details-marker { display: none; }
.indice summary::after { content: '+'; float: right; color: var(--gris); }
.indice details[open] summary::after { content: '\2013'; }
.indice ol { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: var(--t-sm); counter-reset: sec; }
.indice li { counter-increment: sec; }
.indice a { display: flex; gap: 0.6rem; color: var(--tinta-suave); text-decoration: none; padding: 0.3rem 0; line-height: 1.35; min-height: 44px; align-items: center; }
@media (min-width: 60rem) { .indice a { min-height: 0; } }
.indice a::before { content: counter(sec); color: var(--gris); font-variant-numeric: tabular-nums; min-width: 1.4rem; flex: none; }
.indice a:hover { color: var(--acento); }

/* Pie: una sola línea */
.pie {
  border-top: 1px solid var(--linea);
  padding: var(--esp-3) var(--margen) var(--esp-4);
  font-size: var(--t-sm);
  color: var(--tinta-suave);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  max-width: 70rem;
  margin: 0 auto;
}
.pie p { margin: 0; }
.pie a { color: var(--tinta-suave); text-decoration: none; white-space: nowrap; }
.pie a:hover { color: var(--acento); }

@media print {
  .cabecera, .lateral, .pie, .saltar { display: none; }
  .doc { display: block; padding: 0; max-width: none; }
  .texto { max-width: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .texto section { break-inside: avoid-page; }
}
