/* Mesial · textos legales (/legal/*). Usa los tokens de tokens.css; no depende de styles.css salvo .btn y .link-arrow. */

.lg-page {
  width: min(1120px, 100% - 40px);
  margin-inline: auto;
  padding-block: var(--s-10) var(--s-16);
}

/* Selector de documento */
.lg-docs {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-8);
}
.lg-docs a {
  padding: 8px 16px;
  border: 1px solid var(--linea);
  border-radius: var(--r-pill);
  background: var(--blanco);
  color: var(--noche);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}
.lg-docs a:hover { border-color: var(--linea-fuerte); }
.lg-docs a[aria-current='page'] { background: var(--noche); border-color: var(--noche); color: var(--blanco); }

.lg-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: var(--s-12);
  align-items: start;
}

/* Tabla de contenido */
.lg-toc {
  position: sticky;
  top: var(--s-6);
  max-height: calc(100vh - var(--s-12));
  overflow-y: auto;
  padding-right: var(--s-2);
}
.lg-toc-title { font-size: 0.82rem; font-weight: 700; color: var(--gris); margin: 0 0 var(--s-3); }
.lg-toc-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.lg-toc-fold > summary::-webkit-details-marker { display: none; }
.lg-toc-fold > summary .icon { transition: transform var(--dur, 0.18s) var(--ease); }
.lg-toc-fold[open] > summary .icon { transform: rotate(90deg); }
.lg-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--linea); }
.lg-toc li a {
  display: block;
  padding: 6px 0 6px var(--s-4);
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--gris);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}
.lg-toc li a:hover { color: var(--noche); border-left-color: var(--linea-fuerte); }
.lg-print { margin-top: var(--s-5); }

/* Documento */
.lg-doc { max-width: 70ch; font-size: 1.0625rem; line-height: 1.7; color: var(--noche-700); }
.lg-head h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.7rem);
  line-height: 1.12;
  color: var(--noche);
  margin: 0;
}
.lg-updated, .lg-lead { color: var(--gris); margin-top: var(--s-3); }
.lg-lead { max-width: 60ch; font-size: 1.05rem; }

.lg-summary {
  margin-top: var(--s-6);
  padding: var(--s-5) var(--s-6);
  background: var(--noche-050);
  border-radius: var(--r-card);
  color: var(--noche);
}
.lg-summary h2 { font-family: var(--font-sans); font-size: 1rem; font-weight: 700; margin: 0 0 var(--s-2); }
.lg-summary ul { margin: 0; padding-left: 1.1em; }
.lg-summary li + li { margin-top: 6px; }

.lg-sec { margin-top: var(--s-10); }
.lg-sec h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.55rem;
  line-height: 1.2;
  color: var(--noche);
  margin: 0 0 var(--s-3);
  scroll-margin-top: var(--s-6);
}
.lg-sec h2:focus { outline: none; }
.lg-sec h2:focus-visible { outline: 2px solid var(--noche); outline-offset: 4px; }
.lg-sec h3 { font-family: var(--font-sans); font-size: 1.02rem; font-weight: 700; color: var(--noche); margin: var(--s-5) 0 var(--s-2); }
.lg-sec p { margin: 0 0 var(--s-3); }
.lg-sec ul { margin: 0 0 var(--s-3); padding-left: 1.2em; }
.lg-sec li + li { margin-top: 6px; }
.lg-doc a { color: var(--noche); text-underline-offset: 3px; }

.lg-table-wrap { overflow-x: auto; margin: var(--s-4) 0; border: 1px solid var(--linea); border-radius: var(--r-card); background: var(--blanco); }
.lg-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; line-height: 1.5; }
.lg-table th, .lg-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--linea); }
.lg-table thead th { font-size: 0.82rem; color: var(--gris); font-weight: 700; background: var(--crema); }
.lg-table tbody th { font-weight: 700; color: var(--noche); min-width: 9em; }
.lg-table tbody tr:last-child th, .lg-table tbody tr:last-child td { border-bottom: 0; }

.lg-foot { margin-top: var(--s-12); padding-top: var(--s-5); border-top: 1px solid var(--linea); color: var(--gris); font-size: 0.95rem; }
.lg-review { font-size: 0.85rem; color: var(--gris); margin: 0 0 var(--s-2); }

/* Índice */
.lg-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); margin-top: var(--s-8); }
.lg-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-6);
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: var(--r-card);
  color: var(--noche);
  text-decoration: none;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.lg-card:hover { border-color: var(--linea-fuerte); box-shadow: var(--shadow-hover); }
.lg-card h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.015em; font-size: 1.35rem; line-height: 1.2; margin: 0; }
.lg-card p { color: var(--gris); margin: 0; flex: 1; }
.lg-contact { margin-top: var(--s-8); color: var(--noche); }
.lg-contact a { color: var(--noche); }

@media (max-width: 900px) {
  .lg-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
  .lg-toc { position: static; max-height: none; overflow: visible; padding: var(--s-4); border: 1px solid var(--linea); border-radius: var(--r-card); background: var(--blanco); }
  .lg-toc ul { border-left: 0; columns: 2; column-gap: var(--s-6); }
  .lg-toc li a { padding-left: 0; border-left: 0; break-inside: avoid; }
  .lg-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .lg-page { width: calc(100% - 32px); padding-top: var(--s-6); }
  .lg-toc ul { columns: 1; margin-top: var(--s-2); }
  .lg-toc-fold > summary { min-height: 44px; margin: 0; font-size: 0.9375rem; color: var(--noche); }
  .lg-doc { font-size: 1rem; }
  .lg-summary { padding: var(--s-4); }
}

/* Impresión: solo el documento, sin cabecera, pie, navegación ni índice. */
@media print {
  body:has(.lg-page) .site-header,
  body:has(.lg-page) .site-footer,
  body:has(.lg-page) .mobile-nav,
  body:has(.lg-page) .skip-link,
  body:has(.lg-page) .toast-container,
  .lg-docs,
  .lg-toc { display: none !important; }
  body:has(.lg-page) { background: #fff; }
  .lg-page { width: auto; padding: 0; }
  .lg-layout { display: block; }
  .lg-doc { max-width: none; font-size: 11pt; line-height: 1.5; color: #000; }
  .lg-summary { background: none; border: 1px solid #999; }
  .lg-sec { break-inside: auto; }
  .lg-sec h2, .lg-sec h3 { break-after: avoid; }
  .lg-table-wrap { overflow: visible; border-color: #999; }
  .lg-table th, .lg-table td { border-color: #bbb; }
  .lg-table tr { break-inside: avoid; }
  .lg-doc a { color: #000; text-decoration: underline; }
  .lg-doc a[href^='mailto:']::after, .lg-doc a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 0.85em; }
  .lg-doc a[href^='mailto:']::after { content: ''; }
  @page { margin: 18mm 16mm; }
}

.lg-credits { margin-top: var(--s-8); }
.lg-credits h2 { font-size: 1.25rem; margin-bottom: var(--s-2); }
.lg-credits p, .lg-credits li { font-size: 0.9rem; color: var(--ink-2); }
.lg-credits ul { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: 4px; }
.lg-credits a { color: var(--noche); }
