/* Insiteum · Midnight · Textos legales (aviso legal, privacidad, cookies)
   Lectura larga: cabecera con luz, pestañas entre textos, índice fijo y prosa a 68ch. */

/* nav: página actual (pendiente de llevar a core) */
.nav__links a[aria-current="page"] { color: var(--ink); background: oklch(60% 0.08 250 / 0.2); box-shadow: 0 0 0 1px oklch(80% 0.08 235 / 0.28) inset, 0 0 24px -6px oklch(64% 0.17 255 / 0.55); }

/* <button class="btn">: core no hereda la tipografía en botones (pendiente de llevar a core) */
button.btn { font-family: inherit; border: 0; cursor: pointer; }

/* ---------- cabecera ---------- */
.doc-head { position: relative; isolation: isolate; padding: clamp(128px, 14vw, 188px) 0 clamp(36px, 4vw, 56px); overflow: clip; border-bottom: 1px solid var(--rule); }
.doc-head__light { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(50% 80% at 85% 0%, oklch(52% 0.108 250 / 0.38), transparent 70%),
    radial-gradient(35% 60% at 10% 100%, oklch(64% 0.17 255 / 0.12), transparent 70%); }
.doc-head__eyebrow { color: var(--sky); font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 560; margin-bottom: 16px; }
.doc-head__title { font-size: clamp(2.75rem, 7vw, 6.5rem); font-weight: 400; font-stretch: 112%; line-height: 0.95; letter-spacing: -0.035em; max-width: 14ch;
  background: linear-gradient(100deg in oklch, var(--ink) 30%, var(--ice) 70%, var(--sky)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 0.3em; margin-bottom: -0.24em; } /* hueco para g, p, y sin mover nada */
.doc-head__meta { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; font-size: 0.9375rem; color: var(--muted); }
.doc-head__meta .ico { width: 18px; height: 18px; color: var(--sky); }
.doc-tabs { margin-top: clamp(28px, 3vw, 40px); }
.doc-tabs ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.doc-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; border-radius: 999px; font-size: 0.9375rem; font-weight: 500; color: var(--ink-2); text-decoration: none;
  background: oklch(24% 0.06 260 / 0.4); box-shadow: 0 0 0 1px oklch(72% 0.06 248 / 0.28) inset; transition: color 300ms var(--ease), box-shadow 300ms var(--ease), background-color 300ms var(--ease); }
.doc-tabs a:hover { color: var(--ink); box-shadow: 0 0 0 1px oklch(82% 0.08 235 / 0.6) inset; }
.doc-tabs a[aria-current="page"] { color: oklch(15% 0.06 262); font-weight: 580; background: linear-gradient(135deg in oklch, oklch(93% 0.05 220), oklch(80% 0.1 238));
  box-shadow: 0 1px 0 oklch(100% 0 0 / 0.55) inset, 0 10px 26px -12px oklch(64% 0.17 255 / 0.8); }
@media (prefers-reduced-motion: no-preference) {
  .doc-head__eyebrow, .doc-head__title, .doc-head__meta, .doc-tabs { animation: soft-in 1000ms var(--ease) backwards; }
  .doc-head__title { animation-delay: 80ms; } .doc-head__meta { animation-delay: 200ms; } .doc-tabs { animation-delay: 300ms; }
}

/* ---------- cuerpo ---------- */
.doc { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: clamp(32px, 6vw, 112px); padding-top: clamp(40px, 5vw, 72px); padding-bottom: var(--sec); align-items: start; }
.doc__aside { position: sticky; top: 100px; max-height: calc(100vh - 120px); overflow: auto; scrollbar-width: thin; }
.toc { border-radius: 20px; padding: 6px 6px 10px; background: oklch(18% 0.055 262 / 0.55); box-shadow: 0 0 0 1px oklch(60% 0.07 252 / 0.2) inset; }
.toc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 14px; cursor: pointer; list-style: none;
  font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 560; color: var(--muted); border-radius: 14px; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary .ico { width: 18px; height: 18px; color: var(--sky); transition: transform 400ms var(--ease); }
.toc[open] summary .ico { transform: rotate(45deg); }
.toc__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.toc__list a { position: relative; display: block; padding: 9px 14px 9px 18px; border-radius: 12px; font-size: 0.9375rem; line-height: 1.35; color: var(--ink-2); text-decoration: none; transition: color 250ms var(--ease), background-color 250ms var(--ease); }
.toc__list a::before { content: ""; position: absolute; left: 6px; top: 50%; width: 3px; height: 0; margin-top: 0; border-radius: 3px; background: linear-gradient(var(--cyan), var(--electric)); box-shadow: 0 0 10px oklch(70% 0.15 240 / 0.8); transition: height 350ms var(--ease), margin 350ms var(--ease); }
.toc__list a:hover { color: var(--ink); background: oklch(30% 0.06 260 / 0.35); }
.toc__list a.is-active { color: var(--ink); background: oklch(34% 0.07 255 / 0.35); }
.toc__list a.is-active::before { height: 18px; margin-top: -9px; }

.prose { font-size: 1.0625rem; line-height: 1.7; color: var(--ink-2); min-width: 0; }
.prose p, .prose ul { margin: 0 0 1em; }
.prose > :not(.doc__sec), .doc__sec > :not(.table-scroll) { max-width: 70ch; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--sky); text-decoration: underline; text-decoration-color: oklch(80% 0.1 240 / 0.45); overflow-wrap: anywhere; transition: color 250ms var(--ease), text-decoration-color 250ms var(--ease); }
.prose a:hover { color: var(--ice); text-decoration-color: currentColor; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.55em; padding-left: 0.2em; }
.prose li::marker { color: var(--sky); }
.doc__intro p { font-size: clamp(1.125rem, 0.5vw + 1rem, 1.3125rem); line-height: 1.55; color: var(--ink); }
.doc__sec { padding-top: clamp(28px, 3vw, 40px); margin-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--rule); scroll-margin-top: 96px; }
.doc__sec h2 { font-size: clamp(1.5rem, 1.4vw + 1rem, 2.125rem); font-weight: 400; font-stretch: 112%; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); margin-bottom: 0.7em; }
.doc__updated { margin-top: clamp(32px, 4vw, 48px); padding-top: 20px; border-top: 1px solid var(--rule); font-size: 0.9375rem; color: var(--muted); }

/* tablas */
.table-scroll { margin: 1.4em 0 0.6em; overflow-x: auto; border-radius: 18px; background: oklch(16% 0.05 263 / 0.7); box-shadow: 0 0 0 1px oklch(60% 0.07 252 / 0.24) inset; scrollbar-width: thin; }
.table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.table-scroll table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.table-scroll th, .table-scroll td { padding: 14px 15px; text-align: left; vertical-align: top; }
.table-scroll th { font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 560; color: var(--sky); background: oklch(22% 0.065 260 / 0.7); }
.table-scroll td { border-top: 1px solid var(--rule); color: var(--ink-2); }
.table-scroll td:first-child { color: var(--ink); font-weight: 500; }
.table-scroll th:first-child { min-width: 10.5em; }
.table-scroll th:nth-child(3) { min-width: 14em; }
.table-hint { display: none; font-size: 0.8125rem; color: var(--muted); }

/* gestión del consentimiento */
.consent-box { margin-top: 1.4em; padding: clamp(20px, 3vw, 28px); border-radius: 22px;
  background: radial-gradient(120% 140% at 0% 0%, oklch(36% 0.1 248 / 0.6), oklch(17% 0.055 262 / 0.7) 70%); box-shadow: 0 0 0 1px oklch(85% 0.08 225 / 0.28) inset; }
.consent-box .btn { text-decoration: none; white-space: normal; max-width: 100%; text-align: left; }
.consent-box__nojs { margin: 14px 0 0; font-size: 0.9375rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .doc { grid-template-columns: 1fr; gap: 28px; }
  .doc__aside { position: static; max-height: none; overflow: visible; }
  .table-hint { display: block; }
}
@media (max-width: 640px) {
  .doc-head__title { font-size: clamp(2.6rem, 12.5vw, 4rem); }
  .doc-tabs ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); }
  .doc-tabs ul::-webkit-scrollbar { display: none; }
  .doc-tabs a { white-space: nowrap; }
  .prose { font-size: 1rem; }
  .table-scroll th, .table-scroll td { padding: 12px 14px; }
  /* con JS, las tablas se apilan en fichas (cada celda lleva su encabezado) */
  .table-scroll.is-stacked { overflow: visible; background: none; box-shadow: none; border-radius: 0; }
  .is-stacked table, .is-stacked tbody, .is-stacked tr, .is-stacked td { display: block; min-width: 0; width: auto; }
  .is-stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .is-stacked tr { margin-bottom: 12px; padding: 6px 0; border-radius: 18px; background: oklch(16% 0.05 263 / 0.7); box-shadow: 0 0 0 1px oklch(60% 0.07 252 / 0.24) inset; }
  .is-stacked td { border-top: 0; padding: 10px 18px; }
  .is-stacked td + td { border-top: 1px solid var(--rule); }
  .is-stacked td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 560; color: var(--sky); }
  .is-stacked + .table-hint { display: none; }
}

/* ==========================================================================
   MODO DÍA (html[data-theme="dia"]) · textos legales (aviso legal, privacidad, cookies)
   Mismo fichero en las tres páginas. Cabecera con velos, pestañas e índice en
   cristal blanco, tablas en cristal con cabecera azul al 8 %. El banner
   .consent lo resuelve core. Patrón: docs/MODO-DIA-PATRONES.md
   ========================================================================== */

/* cabecera */
html[data-theme="dia"] .doc-head__light { background:
    radial-gradient(50% 80% at 85% 0%, var(--veil-1), transparent 70%),
    radial-gradient(35% 60% at 10% 100%, var(--veil-2), transparent 70%); opacity: 0.8; }
html[data-theme="dia"] .doc-head__title { filter: drop-shadow(0 12px 26px oklch(55% 0.17 258 / 0.16)); }
html[data-theme="dia"] .doc-tabs a { background: var(--g1); box-shadow: 0 0 0 1px var(--edge-strong) inset, 0 1px 0 oklch(100% 0 0 / 0.8) inset; }
html[data-theme="dia"] .doc-tabs a:hover { color: var(--ink); background: oklch(100% 0 0 / 0.85); box-shadow: 0 0 0 1px oklch(45% 0.12 252 / 0.45) inset, 0 10px 22px -16px var(--glow); }
html[data-theme="dia"] .doc-tabs a[aria-current="page"] { color: var(--btn-ink);
  background: linear-gradient(135deg in oklch, var(--btn-a), var(--btn-b) 60%, var(--btn-c));
  box-shadow: 0 1px 0 oklch(100% 0 0 / 0.35) inset, 0 -4px 10px oklch(30% 0.12 258 / 0.25) inset, 0 10px 24px -12px var(--glow-strong); }

/* índice */
html[data-theme="dia"] .toc { background: linear-gradient(165deg, var(--g1), var(--g2));
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 0 0 1px var(--edge) inset, 0 1px 0 oklch(100% 0 0 / 0.9) inset, 0 24px 50px -36px var(--sh);
  outline: 1px solid oklch(40% 0.08 254 / 0.08); outline-offset: -1px; }
html[data-theme="dia"] .toc__list a::before { box-shadow: 0 2px 8px var(--glow); }
html[data-theme="dia"] .toc__list a:hover { background: oklch(52% 0.108 250 / 0.08); }
html[data-theme="dia"] .toc__list a.is-active { background: oklch(52% 0.108 250 / 0.13); }

/* prosa */
html[data-theme="dia"] .prose a { text-decoration-color: oklch(45% 0.13 252 / 0.4); }
html[data-theme="dia"] .prose a:hover { text-decoration-color: currentColor; }

/* tablas */
html[data-theme="dia"] .table-scroll { background: linear-gradient(165deg, var(--g1), var(--g2));
  box-shadow: 0 0 0 1px var(--edge) inset, 0 0 0 1px oklch(40% 0.08 254 / 0.12), 0 24px 50px -40px var(--sh); }
html[data-theme="dia"] .table-scroll th { background: oklch(52% 0.108 250 / 0.09); }

/* gestión del consentimiento */
html[data-theme="dia"] .consent-box { background: radial-gradient(120% 140% at 0% 0%, oklch(82% 0.07 240 / 0.7), oklch(98% 0.01 245 / 0.55) 70%);
  box-shadow: 0 0 0 1px oklch(45% 0.12 252 / 0.24) inset, 0 1px 0 oklch(100% 0 0 / 0.9) inset, 0 30px 60px -44px var(--sh); }

@media (max-width: 640px) {
  html[data-theme="dia"] .table-scroll.is-stacked { background: none; box-shadow: none; }
  html[data-theme="dia"] .is-stacked tr { background: linear-gradient(165deg, var(--g1), var(--g2));
    box-shadow: 0 0 0 1px var(--edge) inset, 0 0 0 1px oklch(40% 0.08 254 / 0.12), 0 20px 40px -34px var(--sh); }
}
