/* =====================================================
   TECLIOS · Legal (Términos / Privacidad)
   Documento largo con TOC sticky + contenido en prose.
   Depende de colors_and_type.css (tokens de :root).
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bone);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Paper grain · fixed overlay (igual que landing) */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .055 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: .50;
  pointer-events: none;
  z-index: 200;
}

/* Anchor scroll offset para que el nav sticky no tape el título de cada sección */
section[id] { scroll-margin-top: 96px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.wrap {
  width: min(1240px, 100% - 64px);
  margin: 0 auto;
}

/* ====================== NAV ====================== */
nav.legal-top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bone) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
nav.legal-top .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -.025em;
  color: var(--indigo-ink);
  line-height: 1;
  position: relative;
  padding-right: 11px;
}
.brand::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  position: absolute;
  bottom: 1px;
  right: 0;
}

.legal-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bone-2);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
}
.legal-switch a {
  padding: 7px 16px;
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.legal-switch a:hover { color: var(--ink); }
.legal-switch a.on {
  background: var(--indigo-ink);
  color: var(--bone);
}

/* Back-cluster · GAP 4 Plan 3d.E Phase 5. Dos botones de navegación back
   en legal pages: "Volver al login" (Teclios app) y "Volver a inicio"
   (teclios-www landing). Stack vertical en mobile via responsive. */
.back-cluster {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.back {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  transition: border-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.back:hover { color: var(--ink); border-color: rgba(20,20,43,.30); }

/* ====================== EYEBROW ====================== */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--crimson);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow.muted { color: var(--fg-faint); }

/* ====================== HERO ====================== */
.legal-hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--line);
}
.legal-hero .grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 64px;
  align-items: end;
}
.legal-hero h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(48px, 6.4vw, 88px);
  letter-spacing: -.035em;
  line-height: .98;
  color: var(--indigo-ink);
  text-wrap: balance;
}
.legal-hero h1 .punct {
  color: var(--crimson);
  display: inline-block;
}
.legal-hero .lead {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-muted);
  margin: 0;
  text-wrap: pretty;
  max-width: 50ch;
}
.legal-hero .lead b { color: var(--ink); font-weight: 600; }
.legal-hero .meta {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.legal-hero .meta .m {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  line-height: 1.7;
}
.legal-hero .meta .m b {
  display: block;
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--indigo-ink);
  font-weight: 600;
}

/* ====================== BODY ====================== */
.legal-body {
  padding: 56px 0 96px;
}
.legal-body .grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 80px;
  align-items: start;
}

/* ===== TOC ===== */
.toc {
  position: sticky;
  top: 96px;
  align-self: start;
}
.toc-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--crimson);
  font-weight: 500;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.toc ol li {
  border-bottom: 1px dashed var(--line);
}
.toc ol li:last-child { border-bottom: 0; }
.toc ol li a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg-muted);
  transition: color var(--d-fast) var(--ease);
}
.toc ol li a:hover { color: var(--ink); }
.toc ol li a.on {
  color: var(--indigo-ink);
  font-weight: 600;
}
.toc ol li a .n {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--fg-faint);
  padding-top: 2px;
}
.toc ol li a.on .n { color: var(--crimson); }

/* ===== CONTENT ===== */
.content {
  min-width: 0;
  max-width: 720px;
}
.content section {
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
}
.content section:first-child { padding-top: 0; }
.content section:last-child { border-bottom: 0; padding-bottom: 0; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}
.sec-head .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--crimson);
  font-weight: 500;
  flex-shrink: 0;
}
.sec-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(26px, 2.4vw, 32px);
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--indigo-ink);
  margin: 0;
  text-wrap: balance;
}

.prose p,
.prose ul,
.prose ol {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg);
  margin: 0 0 14px;
  text-wrap: pretty;
}
.prose ul,
.prose ol {
  padding-left: 22px;
}
.prose li { margin-bottom: 8px; }
.prose li:last-child { margin-bottom: 0; }
.prose b, .prose strong { color: var(--indigo-ink); font-weight: 600; }
.prose a {
  color: var(--indigo-ink);
  font-weight: 600;
  border-bottom: 1.5px solid var(--ember);
  transition: color var(--d-fast) var(--ease);
}
.prose a:hover { color: var(--crimson); }
.prose code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bone-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--indigo-ink);
  letter-spacing: 0;
}
.prose h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  margin: 22px 0 10px;
  color: var(--indigo-ink);
  letter-spacing: -.01em;
}

/* ===== CALLOUT (en lenguaje plano) ===== */
.callout {
  margin: 22px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: flex-start;
  background: var(--indigo-ink);
  color: var(--bone);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.callout::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50% 60% at 95% 5%, rgba(240,122,31,.18), transparent 60%),
    radial-gradient(40% 50% at 5% 95%, rgba(212,38,58,.14), transparent 70%);
  pointer-events: none;
}
.callout > * { position: relative; z-index: 1; }
.callout.light {
  background: var(--bone-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.callout.light::before { display: none; }
.callout .mk {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(245,239,225,.10);
  color: var(--bone);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  position: relative;
  flex-shrink: 0;
}
.callout .mk::after {
  content: "";
  width: 5px; height: 5px;
  background: var(--crimson);
  border-radius: 50%;
  position: absolute;
  bottom: 5px; right: 5px;
}
.callout.light .mk {
  background: var(--indigo-ink);
  color: var(--bone);
}
.callout .lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ember-2);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
}
.callout.light .lbl { color: var(--crimson); }
.callout .body-txt {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--bone);
  text-wrap: pretty;
}
.callout.light .body-txt { color: var(--ink); }
.callout .body-txt b { color: var(--bone); font-weight: 600; }
.callout.light .body-txt b { color: var(--indigo-ink); }
.callout .body-txt a {
  color: var(--ember-2);
  border-bottom: 1.5px solid var(--ember);
  font-weight: 600;
}
.callout.light .body-txt a {
  color: var(--indigo-ink);
  border-bottom-color: var(--ember);
}

/* ===== DATA TABLE (usada en privacidad para qué datos / con quién) ===== */
.data-table {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--panel);
}
.data-table .row {
  display: grid;
  grid-template-columns: 1.4fr 2.2fr 1fr;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  align-items: start;
}
.data-table .row:last-child { border-bottom: 0; }
.data-table .row.head {
  background: var(--bone-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
}
.data-table .row .k {
  font-weight: 600;
  color: var(--indigo-ink);
}
.data-table .row.head .k { color: var(--fg-faint); }
.data-table .row .t {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.data-table .row.head .t { font-size: 10px; }
.data-table .row .v b { font-weight: 600; color: var(--indigo-ink); }

/* ====================== FOOTER ====================== */
footer.foot {
  background: var(--indigo-ink);
  color: rgba(245,239,225,.50);
  padding: 32px 0;
  border-top: 1px solid rgba(245,239,225,.10);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
footer.foot .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
footer.foot a { color: rgba(245,239,225,.65); transition: color var(--d-fast) var(--ease); }
footer.foot a:hover { color: var(--bone); }
footer.foot .links { display: flex; gap: 32px; flex-wrap: wrap; }

/* ====================== RESPONSIVE ====================== */
@media (max-width: 1080px) {
  .wrap { width: min(100% - 48px, 1240px); }
  .legal-body .grid { grid-template-columns: 240px 1fr; gap: 56px; }
  .legal-hero .grid { gap: 48px; }
}
@media (max-width: 880px) {
  .legal-hero { padding: 48px 0 40px; }
  .legal-hero .grid { grid-template-columns: 1fr; gap: 32px; align-items: start; }
  .legal-hero .meta { grid-template-columns: 1fr 1fr; gap: 18px; }
  .legal-body { padding: 40px 0 64px; }
  .legal-body .grid { grid-template-columns: 1fr; gap: 32px; }
  .toc {
    position: relative;
    top: auto;
    background: var(--bone-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 18px 20px;
  }
  .toc-label { padding-bottom: 12px; margin-bottom: 10px; }
  .toc ol { max-height: 220px; overflow-y: auto; }
  .data-table .row { grid-template-columns: 1fr; gap: 4px; padding: 14px 16px; }
  .data-table .row.head { display: none; }
  .data-table .row .k::before { content: ""; }
  .data-table .row .t {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--line);
  }
}
@media (max-width: 767px) {
  /* Mobile · GAP 1 Plan 3d.E Phase 5. Layout shell + nav cluster wrap. */
  nav.legal-top .row { gap: 12px; flex-wrap: wrap; }
  nav.legal-top .row > * { flex: 0 1 auto; }
  .back-cluster { width: 100%; justify-content: flex-start; gap: 8px; }
  .back {
    font-size: 12px;
    padding: 7px 11px;
  }
  .legal-hero h1 { font-size: clamp(36px, 9vw, 48px); }
  .legal-body .toc { font-size: 13px; }
}
@media (max-width: 560px) {
  .legal-switch { width: 100%; }
  .legal-hero .meta { grid-template-columns: 1fr; }
  footer.foot .row { flex-direction: column; align-items: flex-start; gap: 16px; }
}
