/* ---------------------------------------------------------------------------
   Documentos legales — Advansys (IRAMAX S.A.)
   Hoja compartida por privacidad.html y terminos.html.
   Derivada de la usada en los documentos de CarsCRM, con la paleta y la
   tipografía del sitio institucional. Sin dependencias externas.
   --------------------------------------------------------------------------- */

:root {
  --bg:            #ffffff;
  --bg-sutil:      #f4f6fa;
  --superficie:    #ffffff;
  --tinta:         #0f1c32;
  --tinta-media:   #47536b;
  --tinta-suave:   #64748b;
  --linea:         #e1e6ef;
  --linea-fuerte:  #c7cfdd;
  --acento:        #1a2b4a;
  --acento-tinta:  #e8601a;
  --acento-bg:     #eef1f8;
  --marca:         #e8601a;
  --alerta:        #9a5b00;
  --alerta-bg:     #fdf4e3;
  --radio:         10px;
  --ancho-texto:   68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0f1c32;
    --bg-sutil:     #16243d;
    --superficie:   #142138;
    --tinta:        #e8ecf4;
    --tinta-media:  #b4bfd2;
    --tinta-suave:  #8d9ab1;
    --linea:        #26344f;
    --linea-fuerte: #3a4a68;
    --acento:       #9db4dd;
    --acento-tinta: #f08a4d;
    --acento-bg:    #1a2942;
    --marca:        #f08a4d;
    --alerta:       #e0b062;
    --alerta-bg:    #241d10;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tinta);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont,
               ui-sans-serif, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

/* --- Accesibilidad --------------------------------------------------------- */

.saltar {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--acento); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radio) 0;
}
.saltar:focus { left: 0; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Barra superior -------------------------------------------------------- */

.barra {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--linea);
}

.barra-int {
  max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}

.marca {
  display: flex; align-items: center; gap: 10px;
  font-weight: 650; letter-spacing: -.01em; color: var(--tinta); text-decoration: none;
  font-size: .95rem;
}

.marca-logo { height: 26px; width: auto; display: block; flex: 0 0 auto; }

@media (prefers-color-scheme: dark) {
  /* El logo es azul sobre transparente: sobre fondo oscuro necesita respaldo claro. */
  .marca-logo { background: #fff; border-radius: 6px; padding: 3px 7px; box-sizing: content-box; }
}

.barra-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }

.barra-nav a {
  font-size: .875rem; text-decoration: none; color: var(--tinta-media);
  padding: 6px 11px; border-radius: 7px; white-space: nowrap;
}
.barra-nav a:hover { background: var(--bg-sutil); color: var(--tinta); }
.barra-nav a[aria-current="page"] { background: var(--acento-bg); color: var(--acento-tinta); font-weight: 600; }

/* --- Estructura ------------------------------------------------------------ */

.pagina { max-width: 1120px; margin: 0 auto; padding: 0 24px 96px; }

.encabezado { padding: 56px 0 32px; border-bottom: 1px solid var(--linea); margin-bottom: 40px; }

.kicker {
  font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--marca); margin: 0 0 12px;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.2vw, 2.85rem);
  line-height: 1.12; letter-spacing: -.025em; margin: 0 0 16px; font-weight: 700;
}

.bajada { font-size: 1.15rem; color: var(--tinta-media); margin: 0 0 20px; max-width: 62ch; }

.sellos { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .875rem; color: var(--tinta-suave); margin: 0; }
.sellos > span { display: inline-flex; align-items: center; gap: 6px; }
.sellos strong { color: var(--tinta-media); font-weight: 600; }

.cuerpo { display: grid; grid-template-columns: 1fr; gap: 48px; align-items: start; }

/* Dos columnas sólo si la página trae índice. Sin `:has` —o sin índice— queda en una sola
   columna, que es la degradación correcta: si no, el <main> cae en la celda de 232px. */
@media (min-width: 1040px) {
  .cuerpo:has(> .indice) { grid-template-columns: 232px minmax(0, 1fr); gap: 64px; }
  .indice { position: sticky; top: 84px; }
}

/* --- Índice ---------------------------------------------------------------- */

.indice { font-size: .875rem; }
.indice h2 {
  font-size: .76rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--tinta-suave); margin: 0 0 12px; padding: 0; border: 0;
}
.indice ol { list-style: none; margin: 0; padding: 0; counter-reset: idx; }
.indice li { counter-increment: idx; margin: 0; }
.indice a {
  display: block; padding: 5px 12px; color: var(--tinta-media); text-decoration: none;
  border-left: 2px solid var(--linea); line-height: 1.45;
}
.indice a::before { content: counter(idx) ". "; color: var(--tinta-suave); }
.indice a:hover { color: var(--acento); border-left-color: var(--acento); background: var(--bg-sutil); }

/* --- Texto ----------------------------------------------------------------- */

.texto { max-width: var(--ancho-texto); }
.texto > p:first-child { font-size: 1.09rem; }

h2 {
  font-size: 1.4rem; letter-spacing: -.018em; line-height: 1.3; font-weight: 680;
  margin: 56px 0 4px; padding-top: 28px; border-top: 1px solid var(--linea);
}
h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
h2 .num { color: var(--tinta-suave); font-weight: 500; margin-right: .5ch; }

h3 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; margin: 32px 0 6px; }

p { margin: 0 0 16px; }
ul, ol { padding-left: 24px; margin: 0 0 18px; }
li { margin-bottom: 8px; }
li > ul, li > ol { margin-top: 8px; }

strong { font-weight: 650; }
em { font-style: italic; }

a { color: var(--acento); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--acento-tinta); }

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .875em; background: var(--bg-sutil); border: 1px solid var(--linea);
  padding: .1em .4em; border-radius: 5px; word-break: break-word;
}

/* --- Tablas ---------------------------------------------------------------- */

.tabla { overflow-x: auto; margin: 22px 0; border: 1px solid var(--linea); border-radius: var(--radio); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
caption { caption-side: top; text-align: left; padding: 12px 16px 0; color: var(--tinta-suave); font-size: .85rem; }
th, td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--linea); }
thead th { background: var(--bg-sutil); font-weight: 650; font-size: .85rem; letter-spacing: .01em; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
th[scope="row"] { font-weight: 600; color: var(--tinta-media); white-space: nowrap; background: var(--bg-sutil); }
td ul, td ol { margin-bottom: 0; }

/* --- Bloques destacados ---------------------------------------------------- */

.nota, .aviso, .clave {
  border: 1px solid var(--linea); border-left-width: 3px;
  border-radius: 0 var(--radio) var(--radio) 0;
  padding: 16px 20px; margin: 24px 0; font-size: .97rem;
}
.nota  { background: var(--bg-sutil);   border-left-color: var(--linea-fuerte); }
.clave { background: var(--acento-bg);  border-left-color: var(--marca); }
.aviso { background: var(--alerta-bg);  border-left-color: var(--alerta); }
.nota > :last-child, .aviso > :last-child, .clave > :last-child { margin-bottom: 0; }

.rotulo {
  display: block; font-size: .74rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: 6px;
}
.clave .rotulo { color: var(--marca); }
.aviso .rotulo { color: var(--alerta); }
.nota  .rotulo { color: var(--tinta-suave); }

/* --- Pasos numerados ------------------------------------------------------- */

ol.pasos { list-style: none; counter-reset: paso; padding-left: 0; margin: 24px 0; }
ol.pasos > li {
  counter-increment: paso; position: relative; padding-left: 48px; margin-bottom: 24px;
}
ol.pasos > li::before {
  content: counter(paso); position: absolute; left: 0; top: -1px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--acento); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .88rem;
}
ol.pasos > li::after {
  content: ""; position: absolute; left: 15px; top: 34px; bottom: -20px; width: 1px;
  background: var(--linea);
}
ol.pasos > li:last-child::after { display: none; }

/* --- Pie ------------------------------------------------------------------- */

.pie {
  margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--linea);
  color: var(--tinta-suave); font-size: .875rem; max-width: var(--ancho-texto);
}
.pie p { margin-bottom: 10px; }
.pie-enlaces { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 16px; }

/* --- Impresión ------------------------------------------------------------- */

@media print {
  .barra, .indice, .saltar { display: none !important; }
  body { font-size: 10.5pt; line-height: 1.5; color: #000; background: #fff; }
  .pagina { max-width: none; padding: 0; }
  .cuerpo { display: block; }
  .texto { max-width: none; }
  h1 { font-size: 20pt; }
  h2 { font-size: 13pt; margin-top: 22pt; page-break-after: avoid; }
  h3 { page-break-after: avoid; }
  .nota, .aviso, .clave, table, ol.pasos > li { page-break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .texto a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #444; }
}
