/* =====================================================================
   TÉRMINOS Y CONDICIONES · condiciones de uso  (CSS propio de este módulo)
   Estructura:  [ banner ] ~transición~ [ sección clara: resumen · índice + secciones · cierre ]
   Solo usa de la web global: la barra de navegación, el pie y el fondo
   de banner del <body> (styles.css). Todo lo demás está definido aquí
   y cuelga de body.tm-page, así que no afecta a otras páginas.
   ===================================================================== */

.tm-page {
  --tm-blue: #5ca8ff;
  --tm-ink: #0f1424;          /* texto sobre fondo claro */
  --tm-muted: #5a6582;
  --tm-paper: #ffffff;        /* fondo de la sección clara (debe ser igual al de la transición) */
  --tm-card: #f3f7ff;
  --tm-line: #e2e9f7;
  --tm-radius: 28px;
  /* acento de esta página:  --tone acento · --tint fondo de etiqueta · --tag texto legible sobre blanco
     --from/--to degradado · --edge borde · --glow sombra (r, g, b) */
  --tone: #b07cff; --tint: #f1e8ff; --tag: #6428c4; --from: #fbf8ff; --to: #eee2ff; --edge: #dccbfa; --glow: 140, 84, 230;
}

/* sin esto, el display de algunos contenedores ignora el atributo hidden */
.tm-page [hidden] { display: none !important; }

/* ===== 1. BANNER (el fondo es el banner global del <body>) ===== */
.tm-banner {
  position: relative;
  padding: 140px 20px clamp(120px, 15vw, 180px);
  text-align: center;
  color: #fff;
  animation: rise .7s ease both;
}
.tm-banner h1 {
  font-family: 'Oxanium', sans-serif;
  font-weight: 800;
  font-size: clamp(34px, 8.5vw, 64px);
  line-height: 1.08;
  text-shadow: 0 4px 18px rgba(0, 0, 0, .5);
}
.tm-banner h1 span { color: var(--tm-blue); }
.tm-banner p.tm-sub {
  max-width: 660px;
  margin: 14px auto 0;
  font-size: clamp(15px, 3.6vw, 18px);
  color: #d5daf0;
}
.tm-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.tm-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-size: 13.5px; font-weight: 600; color: #d5daf0;
  background: rgba(16, 18, 30, .72);
  border: 1px solid var(--line);
  border-radius: 99px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tm-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tm-blue); box-shadow: 0 0 10px var(--tm-blue); }

/* ===== OLA divisoria (igual que Inicio y Sugerencias): dos capas · quieta en PC, con movimiento en móvil ===== */
.tm-wave {
  position: absolute;
  left: 0; right: 0; bottom: -1px;          /* -1px: sin línea entre la ola y la sección clara */
  height: clamp(70px, 10vw, 120px);
  overflow: hidden;
  pointer-events: none;
}
.tm-wave svg {
  position: absolute;
  bottom: 0; left: 0;
  display: block;
  width: 200%; height: 100%;                /* el dibujo se repite 2 veces: -50% encaja sin saltos */
}
.tm-wave .back  { fill: rgba(255, 255, 255, .45); }
.tm-wave .front { fill: var(--tm-paper); }
@media (max-width: 759px) {                /* movimiento SOLO en móvil */
  .tm-wave svg { animation: tmDrift 16s linear infinite; }
  .tm-wave .back { animation-duration: 26s; animation-direction: reverse; }
}
@keyframes tmDrift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tm-wave svg { animation: none; } }

/* ===== 3. SECCIÓN CLARA ===== */
.tm-light {
  background: var(--tm-paper);
  color: var(--tm-ink);
  padding: 20px 14px 50px;
}
.tm-inner {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
}

/* --- 3a. Resumen rápido --- */
.tm-summary {
  position: relative;
  overflow: hidden;
  padding: 24px 22px;
  background: linear-gradient(135deg, var(--from), var(--to));
  border: 1px solid var(--edge);
  border-radius: var(--tm-radius);
  box-shadow: 0 10px 30px rgba(var(--glow), .12);
}
.tm-summary::before {                  /* resplandor suave, como en las tarjetas de otras páginas */
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(var(--glow), .24), transparent 68%);
  pointer-events: none;
}
.tm-summary h2 { position: relative; font-size: clamp(19px, 4.6vw, 22px); font-weight: 800; letter-spacing: -.3px; }
.tm-summary h2::before { content: ""; display: block; width: 30px; height: 5px; margin-bottom: 10px; border-radius: 99px; background: var(--tone); }
.tm-summary ul { position: relative; list-style: none; display: grid; gap: 10px; margin-top: 14px; }
.tm-summary li { position: relative; padding-left: 32px; font-size: 15px; line-height: 1.5; color: var(--tm-muted); }
.tm-summary li::before {
  content: "✓";
  position: absolute; left: 0; top: 0;
  display: grid; place-items: center;
  width: 22px; height: 22px;
  font-size: 12px; font-weight: 800; color: var(--tag);
  background: var(--tint); border-radius: 50%;
}
.tm-summary strong { color: var(--tm-ink); }

/* --- 3b. Índice + documento --- */
.tm-layout { display: flex; flex-direction: column; gap: 22px; }

.tm-toc { min-width: 0; }
.tm-toc-box {
  background: var(--tm-card);
  border: 1px solid var(--tm-line);
  border-radius: 22px;
}
.tm-toc-box summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  font-size: 16px; font-weight: 800;
  list-style: none; cursor: pointer;
}
.tm-toc-box summary::-webkit-details-marker { display: none; }
.tm-toc-box summary::after {           /* icono + que gira a × al abrir */
  content: "+";
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  font-size: 20px; line-height: 1; color: var(--tag);
  background: var(--tint); border-radius: 50%;
  transition: transform .25s ease, background .25s;
}
.tm-toc-box[open] summary::after { transform: rotate(45deg); background: var(--tone); color: #0f1424; }
.tm-toc-box summary:focus-visible { outline: 3px solid var(--tm-ink); outline-offset: -4px; border-radius: 22px; }
.tm-toc-list { list-style: none; counter-reset: toc; display: grid; gap: 2px; padding: 0 10px 12px; }
.tm-toc-list li { counter-increment: toc; }
.tm-toc-list a {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 12px;
  font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--tm-muted);
  border-radius: 12px;
  transition: background .2s, color .2s;
}
.tm-toc-list a::before { content: counter(toc); flex: none; min-width: 18px; font-size: 12.5px; font-weight: 800; color: var(--tag); }
.tm-toc-list a:hover { background: #fff; color: var(--tm-ink); }
.tm-toc-list a[aria-current="true"] { background: var(--tint); color: var(--tm-ink); }
.tm-toc-list a:focus-visible { outline: 2px solid var(--tone); outline-offset: 1px; }

.tm-doc { display: flex; flex-direction: column; gap: 16px; min-width: 0; counter-reset: sec; }

/* --- 3c. Secciones --- */
.tm-sec {
  position: relative;
  counter-increment: sec;
  scroll-margin-top: 96px;
  padding: 24px 22px 26px;
  background: #fff;
  border: 1px solid var(--tm-line);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(36, 60, 120, .07);
  transition: border-color .3s, box-shadow .3s;
}
.tm-sec:hover { border-color: var(--edge); box-shadow: 0 16px 36px rgba(var(--glow), .14); }
.tm-sec:target { border-color: var(--tone); box-shadow: 0 16px 36px rgba(var(--glow), .2); }
.tm-sec h2 {
  display: flex; align-items: center; gap: 12px;
  font-size: clamp(19px, 4.6vw, 23px); font-weight: 800; line-height: 1.25; letter-spacing: -.3px;
}
.tm-sec h2::before {
  content: counter(sec);
  flex: none;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  font-size: 15px; font-weight: 800; letter-spacing: 0; color: var(--tag);
  background: var(--tint); border-radius: 12px;
}
.tm-anchor {                           /* botón "copiar enlace" (lo crea el JS) */
  margin-left: auto;
  flex: none;
  width: 32px; height: 32px;
  font-size: 15px; font-weight: 800; color: var(--tm-muted);
  background: transparent; border-radius: 10px;
  opacity: 0; transition: opacity .2s, background .2s, color .2s;
}
.tm-sec:hover .tm-anchor, .tm-anchor:focus-visible { opacity: 1; }
.tm-anchor:hover { background: var(--tint); color: var(--tag); }
.tm-anchor:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }

.tm-sec h3 { margin-top: 20px; font-size: 16px; font-weight: 800; color: var(--tm-ink); }
.tm-sec p { max-width: 72ch; margin-top: 12px; font-size: 15px; line-height: 1.65; color: var(--tm-muted); }
.tm-sec h3 + p { margin-top: 6px; }
.tm-sec strong { color: var(--tm-ink); }
.tm-sec ul { list-style: none; display: grid; gap: 8px; max-width: 72ch; margin-top: 12px; }
.tm-sec li { position: relative; padding-left: 20px; font-size: 15px; line-height: 1.6; color: var(--tm-muted); }
.tm-sec li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.tm-sec a {
  font-weight: 700; color: var(--tag);
  text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: 3px;
  transition: text-decoration-color .2s;
}
.tm-sec a:hover { text-decoration-color: var(--tone); }
.tm-note {
  max-width: 72ch;
  margin-top: 16px; padding: 14px 16px;
  font-size: 14.5px; line-height: 1.55; color: var(--tm-muted);
  background: linear-gradient(135deg, var(--from), var(--to));
  border: 1px solid var(--edge); border-radius: 16px;
}
.tm-sec .tm-note { margin-top: 16px; }

/* ===== 4. BLOQUE FINAL (mismo diseño que el del FAQ) ===== */
.tm-cta {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(96px, 28%, 190px);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 30px 14px 30px 24px;
  background: linear-gradient(135deg, var(--from), var(--to));
  border: 1px solid var(--edge);
  border-radius: var(--tm-radius);
  box-shadow: 0 10px 30px rgba(var(--glow), .12);
}
.tm-cta::before {
  content: "";
  position: absolute; right: -50px; top: 50%;
  width: 300px; height: 300px; transform: translateY(-50%);
  background: radial-gradient(circle, rgba(var(--glow), .26), transparent 68%);
  pointer-events: none;
}
.tm-cta-copy { position: relative; z-index: 1; min-width: 0; }
.tm-cta h2 { font-size: clamp(22px, 5.2vw, 30px); font-weight: 800; line-height: 1.15; letter-spacing: -.4px; }
.tm-cta p { max-width: 56ch; margin-top: 8px; font-size: 15.5px; color: var(--tm-muted); }
.tm-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.tm-btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 15px; font-weight: 800; white-space: nowrap;
  color: #06101f; background: var(--tone);
  border: 1px solid var(--tone); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(var(--glow), .35);
  transition: transform .25s, filter .25s, border-color .25s;
}
.tm-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.tm-btn.ghost { background: #fff; border-color: var(--edge); box-shadow: none; }
.tm-btn.ghost:hover { border-color: var(--tone); filter: none; }
.tm-btn:focus-visible { outline: 3px solid var(--tm-ink); outline-offset: 3px; }
.tm-cta-mob {
  position: relative; z-index: 1;
  width: 100%; height: auto;
  filter: drop-shadow(0 12px 12px rgba(var(--glow), .28));
  animation: tmFloat 5s ease-in-out infinite;
}
@keyframes tmFloat { 50% { transform: translateY(-6px); } }

/* ===== 4b. PIE: fondo blanco continuo y, por encima, la caja oscura del footer ===== */
.tm-foot {
  display: flow-root;
  padding: 10px 14px 34px;
  background: var(--tm-paper);             /* mismo blanco que la sección clara: se ve continuo */
}
.tm-foot .footer-links { flex-wrap: wrap; justify-content: center; gap: 8px 20px; }   /* 4 enlaces caben también en móvil */
.tm-foot footer {
  margin: 0 auto;                          /* el espacio lo da .tm-foot */
  background: #10121e;                     /* sólido: sobre blanco el translúcido original se vería gris */
  border-color: rgba(255, 255, 255, .08);
  box-shadow: 0 18px 44px rgba(16, 24, 56, .28);
}

/* ===== 4c. Botón "subir" ===== */
.tm-top {
  position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  display: grid; place-items: center;
  width: 46px; height: 46px;
  color: #fff; background: #10121e;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(16, 24, 56, .35);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s, transform .25s, background .2s;
}
.tm-top.show { opacity: 1; transform: none; pointer-events: auto; }
.tm-top:hover { background: #1b1f33; }
.tm-top:focus-visible { outline: 3px solid var(--tone); outline-offset: 3px; }
.tm-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ===== 5. TABLET ===== */
@media (min-width: 760px) {
  .tm-light { padding: 30px 20px 60px; }
  .tm-inner { gap: 26px; }
  .tm-summary { padding: 28px 32px; }
  .tm-summary ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 26px; }
  .tm-sec { padding: 30px 32px 32px; }
  .tm-cta { padding: 38px 24px 38px 40px; }
}

/* ===== 6. ESCRITORIO: índice fijo a la izquierda ===== */
@media (min-width: 1000px) {
  .tm-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 26px; align-items: start; }
  .tm-toc { position: sticky; top: 96px; }
  .tm-toc-box summary { pointer-events: none; cursor: default; }    /* en escritorio siempre abierto */
  .tm-toc-box summary::after { display: none; }
  .tm-toc-list { max-height: calc(100vh - 190px); overflow-y: auto; }
}

/* ===== 7. MÓVIL PEQUEÑO, MOVIMIENTO REDUCIDO E IMPRESIÓN ===== */
@media (max-width: 420px) {
  .tm-cta { grid-template-columns: minmax(0, 1fr) 84px; padding: 24px 8px 24px 20px; }
  .tm-actions { gap: 10px; }
  .tm-btn { padding: 11px 18px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-banner, .tm-cta-mob { animation: none; }
  .tm-sec, .tm-btn, .tm-top, .tm-toc-list a { transition: none; }
}
@media print {
  body::before, body::after { display: none; }
  .navbar, .tm-wave, .tm-toc, .tm-cta, .tm-top, .tm-foot, .toast { display: none !important; }
  .tm-page { background: #fff; }
  .tm-banner { padding: 24px 0; color: #000; animation: none; }
  .tm-banner h1, .tm-banner p.tm-sub { color: #000; text-shadow: none; }
  .tm-chip { color: #333; background: none; border-color: #bbb; }
  .tm-light { padding: 0; }
  .tm-sec, .tm-summary { box-shadow: none; break-inside: avoid; }
}