/*
 * link — hoja base de las visualizaciones en modo fragmento. Siempre oscura.
 *
 * Los nombres de las variables son contrato público (los mismos que html_render
 * de T3 Code): añadir es seguro; renombrar o quitar rompe páginas publicadas.
 * Clases de apoyo: .stats, .table-wrap, .card, .cols, .legend, .muted, .num, .note.
 * <link-chart> (chart.js) usa las clases .lc-*, internas del componente.
 * Las clases .link-* son internas de las páginas del servicio.
 * Ejemplos de uso en examples/.
 */

:root {
  color-scheme: dark;

  /* Texto sobre --background / --card: --foreground 15,2 / 14,0:1;
     --muted-foreground 7,3 / 6,8:1. */
  --background: #161615;
  --foreground: #ecebe6;
  --muted: #232321;
  --muted-foreground: #a6a59e;
  --card: #1e1e1c;
  --card-foreground: #ecebe6;
  --popover: #232321;
  --popover-foreground: #ecebe6;
  --secondary: #232321;
  --secondary-foreground: #ecebe6;
  --border: #33332f;
  --ring: #7eaaf0;
  --code-background: #232321;
  --code-foreground: #ecebe6;

  /* Único acento de la interfaz: enlaces, foco y acciones principales. */
  --primary: #7eaaf0;
  --primary-foreground: #0f1d33;
  --accent: #7eaaf0;
  --accent-foreground: #0f1d33;
  --accent-surface: #1a2638;

  /* Estados: como texto superan 6,4:1 sobre --background, --card, --muted y
     su propia -surface. */
  --destructive: #f08a80;
  --destructive-foreground: #2b0d0a;
  --destructive-surface: #3a1c19;
  --warning: #e6ac4a;
  --warning-foreground: #2a1a00;
  --warning-surface: #352812;
  --success: #6cc47f;
  --success-foreground: #0b2412;
  --info: #7eaaf0;
  --info-foreground: #0f1d33;

  /* Series categóricas, en este orden. Todas ≥ 3:1 sobre --background y
     --card; pares adyacentes validados para daltonismo (ΔE ≥ 8,4) y visión
     normal (ΔE ≥ 19,3). Son colores de marca, no de texto. */
  --chart-1: #3987e5;
  --chart-2: #d95926;
  --chart-3: #199e70;
  --chart-4: #c98500;
  --chart-5: #d55181;
  --chart-6: #0ca30c;

  --radius: 8px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- Documento ---------- */

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

html {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--background);
  overflow-wrap: break-word;
}

/* Página de un enlace: arriba queda una franja con el control de caducidad y
   debajo, ocupando el resto de la ventana, el marco aislado con el contenido.
   El marco vive en flujo normal (no fixed) para evitar que Safari en iOS
   muestree un iframe fijo en el borde inferior y pinte blanco tras la barra
   de direcciones al desplazarse. */
html:has(> body > .link-frame) {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body:has(> .link-frame) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  /* 3.5rem: el control mide 44 px en pantallas táctiles, más su margen. */
  padding-top: calc(3.5rem + env(safe-area-inset-top));
}

body:has(> .link-frame:first-child) {
  padding-top: env(safe-area-inset-top);
}

.link-frame {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--background);
}

.login-form { display: grid; gap: 1rem; max-width: 22rem; margin: 1.25rem 0 .75rem; }
.login-form label { display: grid; gap: .35rem; }
.login-form input {
  box-sizing: border-box; width: 100%; min-height: 2.75rem; padding: .5rem .75rem;
  font: inherit; color: var(--foreground); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.login-form[hidden], .link-secondary[hidden] { display: none; }
.link-secondary {
  min-height: 2.75rem; padding: .4rem .9rem; font: inherit; color: var(--foreground);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.owner-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#auth-status:empty { margin: 0; }

/* Contenedor de lectura. `overflow-x: auto` es la red de seguridad: si algo
   del fragmento no cabe, se desplaza dentro y la página no desborda. */
.link-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.5rem max(1rem, env(safe-area-inset-right)) calc(4rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overflow-x: auto;
}

@media (min-width: 40rem) {
  .link-main {
    padding: 0.5rem max(2rem, env(safe-area-inset-right)) calc(5rem + env(safe-area-inset-bottom)) max(2rem, env(safe-area-inset-left));
  }
}


/* Portada y página de error. */
.link-message {
  max-width: 44rem;
  padding-top: min(18vh, 9rem);
}

.link-message h1 {
  font-size: 1.5rem;
}

.link-message .link-wordmark {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 2rem;
}

.link-wordmark img {
  width: 2rem;
  height: 2rem;
}

.link-action {
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.link-action:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Índice del propietario: una fila táctil por enlace. */
.link-index {
  max-width: 48rem;
  padding-top: 2.5rem;
}

.link-index .link-wordmark {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.25rem;
}

.link-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.link-list li {
  max-width: none;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.index-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  margin: 1.25rem 0 0.75rem;
}

.index-search {
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 2.375rem;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.index-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.index-filter {
  min-height: 2.125rem;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.index-filter:hover {
  color: var(--foreground);
  background: var(--muted);
}

.index-filter[aria-pressed="true"] {
  color: var(--primary-foreground);
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.link-item {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
}

.link-item[hidden] {
  display: none !important;
}

.link-row {
  display: grid;
  gap: 0.125rem;
  padding: 0.25rem;
  border-radius: var(--radius);
  color: var(--foreground);
  text-decoration: none;
}

.link-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0 0.25rem 0.25rem;
}

.link-mini {
  min-height: 1.875rem;
  padding: 0.15rem 0.6rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.link-mini:hover:not(:disabled) {
  color: var(--foreground);
  background: var(--muted);
}

.link-mini.danger {
  color: var(--destructive);
}

.link-mini:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (pointer: coarse) {
  .index-search {
    font-size: 16px;
    min-height: 2.75rem;
  }
  .index-filter,
  .link-mini {
    min-height: 2.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
  }
}

.link-row:hover {
  background: var(--muted);
}

.link-row-main {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.link-row-title {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.link-row-slug {
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.link-row:hover .link-row-title {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.link-row-meta {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.link-soon {
  color: var(--warning);
}

.link-gone {
  color: var(--destructive);
}

@media (min-width: 40rem) {
  .link-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    column-gap: 1.5rem;
  }

  .link-row-meta {
    white-space: nowrap;
  }
}

/* ---------- Texto ----------
   Las páginas de solo texto (informes, resúmenes, pasos) se resuelven con
   elementos: el ritmo vertical lo dan los márgenes de cada uno. */

h1,
h2,
h3,
h4 {
  max-width: 40ch;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.3125rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.5rem;
}

h4 {
  font-size: 1rem;
  margin: 1.25rem 0 0.375rem;
}

@media (min-width: 40rem) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.375rem;
  }
}

/* Un título seguido de otro no suma los dos márgenes. */
:is(h1, h2, h3) + :is(h2, h3, h4) {
  margin-top: 0.75rem;
}

p,
ul,
ol,
dl,
blockquote {
  margin: 0 0 1rem;
}

p,
li,
dd,
blockquote {
  max-width: 75ch;
}

p {
  text-wrap: pretty;
}

ul,
ol {
  padding-left: 1.5rem;
}

li + li {
  margin-top: 0.375rem;
}

li > ul,
li > ol {
  margin: 0.375rem 0 0;
}

ol > li::marker {
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

ul > li::marker {
  color: var(--muted-foreground);
}

/* <dl> sin clase = ficha de pares término/valor: dos columnas, apiladas en
   móvil. Admite <div> agrupando cada par. .stats tiene su propio diseño. */
dl:not([class]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 75ch;
}

dl:not([class]) > div {
  display: contents;
}

dl:not([class]) dt {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

dl:not([class]) dd {
  margin: 0 0 0.625rem;
}

@media (min-width: 40rem) {
  dl:not([class]) {
    grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
    column-gap: 1.5rem;
  }

  dl:not([class]) dt {
    grid-column: 1;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.9375rem;
  }

  dl:not([class]) dd {
    grid-column: 2;
    margin: 0;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
  }

  /* Un término con varios valores: el segundo valor no repite la raya. */
  dl:not([class]) dd + dd {
    border-top: 0;
    padding-top: 0;
  }
}

blockquote {
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted-foreground);
}

blockquote > :last-child {
  margin-bottom: 0;
}

/* Cita con autor: <figure><blockquote>…</blockquote><figcaption>Autor</figcaption></figure> */
blockquote + figcaption {
  margin-top: 0.5rem;
  padding-left: calc(1rem + 3px);
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

strong,
b {
  font-weight: 650;
}

small {
  font-size: 0.8125rem;
}

mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: var(--warning-surface);
  color: var(--foreground);
}

abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: 0.18em;
  cursor: help;
}

time {
  font-variant-numeric: tabular-nums;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--code-background);
  color: var(--code-foreground);
}

kbd {
  padding: 0.05em 0.4em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--muted);
}

pre {
  margin: 0 0 1rem;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code-background);
  color: var(--code-foreground);
  line-height: 1.5;
  tab-size: 2;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

details {
  margin: 0 0 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

details + details {
  margin-top: -1rem;
  border-top: 0;
}

summary {
  cursor: pointer;
  padding: 0.625rem 0;
  font-weight: 600;
}

summary:hover {
  color: var(--primary);
}

details[open] > summary {
  margin-bottom: 0.25rem;
}

details[open] {
  padding-bottom: 0.25rem;
}

/* ---------- Tablas ---------- */

/* Una tabla corta no se estira a todo el ancho del escritorio; dentro de
   .table-wrap ocupa lo que necesite. */
table {
  width: 100%;
  max-width: 48rem;
  margin: 0 0 1.5rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

caption {
  caption-side: top;
  padding-bottom: 0.5rem;
  text-align: left;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

thead th {
  vertical-align: bottom;
  border-bottom-color: var(--muted-foreground);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
}

tbody th {
  font-weight: 600;
}

tfoot td,
tfoot th {
  border-bottom: 0;
  font-weight: 650;
}

tbody tr:last-child > * {
  border-bottom-color: var(--muted-foreground);
}

/* Columna numérica: alineada a la derecha y sin partir la cifra. */
.num {
  text-align: right;
  white-space: nowrap;
}

/* Tabla más ancha que la pantalla: se desplaza dentro de su caja. */
.table-wrap {
  max-width: 100%;
  margin: 0 0 1.5rem;
  overflow-x: auto;
}

/* Hasta cinco columnas la tabla se ajusta al ancho; con más, mantiene un
   ancho mínimo y se desplaza dentro de su caja para no aplastar las columnas.
   Así es seguro envolver cualquier tabla. Se ajusta con style="min-width: …". */
.table-wrap > table {
  max-width: none;
  margin: 0;
}

.table-wrap > table:has(tr > :nth-child(6)) {
  min-width: 40rem;
}

.table-wrap > table:has(tr > :nth-child(9)) {
  min-width: 56rem;
}

/* En las tablas anchas, cabeceras e identificadores de fila no se parten. */
.table-wrap > table:has(tr > :nth-child(6)) thead th,
.table-wrap > table:has(tr > :nth-child(6)) tbody th {
  white-space: nowrap;
}

/* ---------- Figuras y gráficos ---------- */

figure {
  margin: 0 0 1.75rem;
}

figcaption {
  margin-top: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

img,
video,
svg {
  height: auto;
}

img,
video,
canvas {
  display: block;
}

figure > img {
  border-radius: var(--radius);
}

/* ---------- Clases de apoyo ---------- */

/* Aviso destacado: <div class="note">…</div>. Sin data-status es «Nota»;
   data-status="success" | "warning" | "problem" lo convierten en «Correcto»,
   «Atención» o «Problema». La etiqueta la escribe la hoja, así el estado se
   lee como texto y no solo como color. */
.note {
  --note: var(--info);
  max-width: 75ch;
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--note);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--note) 9%, var(--card));
}

.note::before {
  content: "Nota";
  display: block;
  margin-bottom: 0.25rem;
  color: var(--note);
  font-size: 0.8125rem;
  font-weight: 650;
}

.note[data-status="success"] {
  --note: var(--success);
}

.note[data-status="success"]::before {
  content: "Correcto";
}

.note[data-status="warning"] {
  --note: var(--warning);
}

.note[data-status="warning"]::before {
  content: "Atención";
}

.note[data-status="problem"] {
  --note: var(--destructive);
}

.note[data-status="problem"]::before {
  content: "Problema";
}

.note > :last-child {
  margin-bottom: 0;
}

/* Texto secundario. */
.muted {
  color: var(--muted-foreground);
}

/* Panel con fondo y borde para agrupar un gráfico o un bloque. */
.card {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-foreground);
}

.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

@media (min-width: 40rem) {
  .card {
    padding: 1.25rem 1.5rem;
  }
}

/* Columnas que se apilan solas en pantallas estrechas. */
.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.cols > * {
  min-width: 0;
  margin: 0;
}

/* Cifras clave: <dl class="stats"><div><dt>Etiqueta</dt><dd>Cifra</dd>
   <dd>Nota opcional</dd></div>…</dl> */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: 1px;
  margin: 0 0 2rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

/* Cada celda dibuja su propio filete: si la última fila queda incompleta, el
   hueco se ve como parte del panel y no como un bloque de otro color. */
.stats > div {
  min-width: 0;
  padding: 0.875rem 1rem 1rem;
  box-shadow: 0 0 0 1px var(--border);
}

.stats dt {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.stats dd {
  margin: 0;
}

.stats dd:first-of-type {
  margin-top: 0.25rem;
  font-size: 1.625rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.stats dd + dd {
  margin-top: 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

/* Leyenda: <ul class="legend"><li style="--swatch: var(--chart-1)">Serie</li></ul> */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.legend li::before {
  content: "";
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  background: var(--swatch, var(--muted-foreground));
}

/* ---------- <link-chart> (chart.js) ---------- */

link-chart {
  --lc-surface: var(--background);
  display: block;
  min-width: 0;
  margin: 0 0 1rem;
}

.card link-chart {
  --lc-surface: var(--card);
}

link-chart:last-child {
  margin-bottom: 0;
}

.lc-legend li.lc-key-line::before,
.lc-readout dt.lc-key-line::before {
  height: 3px;
  border-radius: 2px;
}

.lc-legend li.lc-key-dashed::before,
.lc-readout dt.lc-key-dashed::before {
  background: repeating-linear-gradient(90deg, var(--swatch) 0 5px, transparent 5px 8px);
}

.lc-legend li.lc-key-shade::before {
  background: color-mix(in srgb, var(--foreground) 14%, transparent);
}

.lc-legend li.lc-key-hatch::before {
  background: repeating-linear-gradient(45deg, var(--muted-foreground) 0 1px, transparent 1px 4px);
}

.lc-plot {
  position: relative;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lc-plot:focus-visible {
  outline-offset: 4px;
}

.lc-plot svg {
  display: block;
  max-width: none;
  overflow: hidden;
}

.lc-plot text {
  fill: var(--muted-foreground);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lc-plot .lc-label,
.lc-plot .lc-value,
.lc-plot .lc-cat {
  fill: var(--foreground);
}

.lc-plot .lc-label {
  font-weight: 600;
}

.lc-plot .lc-lane,
.lc-plot .lc-note {
  font-size: 11px;
}

.lc-plot .lc-note {
  fill: var(--foreground);
  paint-order: stroke;
  stroke: var(--lc-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}

/* Ancho del gráfico < 560 px: chart.js añade .lc-narrow y mide con 11 px. */
.lc-plot.lc-narrow text {
  font-size: 11px;
}

.lc-grid {
  stroke: var(--border);
}

.lc-base {
  stroke: var(--muted-foreground);
}

.lc-zero {
  stroke: var(--foreground);
  stroke-width: 1.5;
}

.lc-shade {
  fill: var(--foreground);
  fill-opacity: 0.06;
}

.lc-hatch {
  stroke: var(--muted-foreground);
  stroke-opacity: 0.55;
}

.lc-band {
  fill-opacity: 0.3;
}

.lc-marker {
  stroke: var(--muted-foreground);
  stroke-dasharray: 2 3;
}

.lc-line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.lc-end,
.lc-dot {
  stroke: var(--lc-surface);
  stroke-width: 2;
}

.lc-end-open {
  fill: var(--lc-surface);
  stroke-width: 2;
}

.lc-lead {
  stroke-width: 1;
}

.lc-cross {
  stroke: var(--foreground);
  stroke-opacity: 0.5;
}

.lc-highlight {
  fill: var(--foreground);
  fill-opacity: 0.06;
}

.lc-readout {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.lc-readout-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.625rem;
  margin: 0 0 0.375rem;
  font-size: 0.875rem;
}

.lc-readout-head strong {
  font-size: 1.0625rem;
}

.lc-export {
  margin-left: auto;
  min-height: 1.75rem;
  padding: 0.15rem 0.6rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.lc-export:hover {
  color: var(--foreground);
  background: var(--muted);
}

.lc-pdf {
  float: right;
  margin: 0.25rem 0 0.5rem 0.75rem;
}

.lc-standalone-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

@media (pointer: coarse) {
  .lc-export {
    min-height: 2.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
  }
}

.lc-readout dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 0.375rem 1rem;
  margin: 0;
}

.lc-readout dl > div {
  min-width: 0;
}

.lc-readout dt {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.lc-readout dt::before {
  content: "";
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  background: var(--swatch);
}

.lc-readout dd {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.lc-readout-info {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
}

.lc-data {
  margin-top: 1rem;
}

.lc-data-note {
  font-size: 0.8125rem;
}

.lc-error {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--destructive);
  border-radius: var(--radius);
  background: var(--destructive-surface);
}

/* ---------- Accesibilidad ---------- */

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

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

@media print {
  html,
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html:has(> body > .link-frame),
  body:has(> .link-frame) {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-top: 0 !important;
  }

  .link-frame {
    height: var(--link-frame-height, 100vh) !important;
    overflow: visible !important;
  }

  link-bar,
  .lc-export,
  .lc-standalone-bar,
  .index-toolbar,
  .link-item-actions,
  .owner-actions {
    display: none !important;
  }
}
