/* Páginas legales de Capria: misma paleta y tipografía que la landing (index.html). */
:root {
  --bg: #020617;          /* slate-950 */
  --bg-deep: #000000;
  --surface: rgba(15, 23, 42, 0.45);
  --line: rgba(30, 41, 59, 0.8);
  --ink: #ffffff;
  --text: #cbd5e1;        /* slate-300 */
  --muted: #94a3b8;       /* slate-400 */
  --faint: #64748b;       /* slate-500 */
  --indigo: #6366f1;
  --indigo-soft: #a5b4fc; /* indigo-300 */
  --emerald: #34d399;     /* emerald-400 */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(to bottom, var(--bg), var(--bg-deep)) fixed;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; }

a { color: var(--indigo-soft); text-decoration-color: rgba(165, 180, 252, 0.35); text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--indigo-soft); outline-offset: 3px; border-radius: 4px; }

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 640px) {
  .wrap {
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }
}

/* Cabecera */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.75);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.site-header .logo { display: flex; align-items: center; border-radius: 8px; }
.site-header .logo img { display: block; height: 24px; width: auto; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.3s, border-color 0.3s, background-color 0.3s;
}
.back:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.06); transform: translateY(-2px); }
.back svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Cabecera del documento */
.doc-head { padding-block: 64px 40px; }
@media (min-width: 640px) { .doc-head { padding-block: 96px 48px; } }
.eyebrow {
  margin: 0;
  color: var(--indigo-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
h1 {
  margin: 16px 0 0;
  color: var(--ink);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.lede { max-width: 40rem; margin: 20px 0 0; color: var(--muted); font-size: 18px; }
.updated { margin: 16px 0 0; color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Selector entre páginas legales */
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.legal-nav a {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.3s, border-color 0.3s;
}
.legal-nav a:hover { color: var(--ink); border-color: #334155; }
.legal-nav a[aria-current="page"] { color: var(--ink); border-color: rgba(99, 102, 241, 0.6); background: rgba(99, 102, 241, 0.12); }

/* Cuerpo: índice lateral + texto */
.doc { display: grid; gap: 40px; padding-bottom: 96px; }
@media (min-width: 960px) { .doc { grid-template-columns: 15rem minmax(0, 1fr); gap: 64px; } }

.toc { align-self: start; }
@media (min-width: 960px) { .toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 96px); } }
.toc p { margin: 0 0 12px; color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 16px; color: var(--muted); font-size: 14px; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--ink); }

.prose { min-width: 0; max-width: 44rem; }
.prose section { padding-top: 8px; scroll-margin-top: 96px; }
.prose section + section { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--line); }
.prose h2 { margin: 0 0 16px; color: var(--ink); font-size: 22px; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; text-wrap: balance; }
.prose h3 { margin: 28px 0 8px; color: var(--ink); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.prose p { margin: 0 0 16px; }
.prose ul { margin: 0 0 16px; padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--indigo); }
.prose strong { color: var(--ink); font-weight: 600; }

/* Fichas de datos (responsable, cookies) */
.facts {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}
.facts div { display: grid; gap: 2px 24px; padding: 14px 20px; }
.facts div + div { border-top: 1px solid var(--line); }
@media (min-width: 640px) { .facts div { grid-template-columns: 11rem minmax(0, 1fr); } }
.facts dt { color: var(--faint); font-size: 14px; }
.facts dd { margin: 0; min-width: 0; color: var(--text); overflow-wrap: anywhere; }

/* Tabla de cookies */
.table-scroll { margin: 0 0 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
th, td { padding: 12px 16px; text-align: left; vertical-align: top; }
th { color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
td { border-top: 1px solid rgba(30, 41, 59, 0.6); }
tr:first-child td { border-top: 0; }
td code { color: var(--ink); font-family: var(--font-mono); font-size: 13px; }

/* Marcadores de posición que el titular debe rellenar */
.ph {
  padding: 1px 6px;
  border: 1px dashed rgba(52, 211, 153, 0.5);
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 0.86em;
  white-space: normal;
}

.note {
  margin: 0 0 16px;
  padding: 14px 18px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
  font-size: 15px;
}

/* Pie */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-deep); }
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding-block: 32px;
  color: var(--faint);
  font-size: 13px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer a { color: var(--faint); text-decoration: none; }
.site-footer a:hover, .site-footer a[aria-current="page"] { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
