/* ==========================================================================
   Aulaplex · sistema de diseño (página pública, panel y página publicada)
   Una sola fuente de estilos: la app la sirve tal cual y publicacion/build.js la incrusta
   en la página publicada, así las dos se ven igual.

   Idea: cotejar = poner dos cosas lado a lado y marcar la diferencia. El resaltador amarillo
   marca solo dos cosas: lo que coincide con tu búsqueda y el mejor precio. Todo lo demás es tinta
   azul sobre papel frío, y el azul de tinta (--accent) es el único color de acción.

   Tipografías: Bricolage Grotesque (titulares, precios, nombre) e Instrument Sans (texto e interfaz).
   Si no cargan, se usan las del sistema.
   ========================================================================== */

:root {
  color-scheme: light;
  /* papel y tinta */
  --paper: oklch(98.5% 0.004 255);
  --paper-2: oklch(96% 0.009 255);
  --surface: oklch(100% 0 0);
  --ink: oklch(24% 0.05 265);
  --ink-2: oklch(42% 0.045 265);
  --ink-3: oklch(50% 0.04 265);
  --line: oklch(92% 0.01 260);
  --line-strong: oklch(82% 0.02 260);
  --control: oklch(62% 0.035 262); /* borde de campos: 3:1 contra el fondo */
  --icon-bg: oklch(100% 0 0); /* fondo de los íconos de plataforma: blanco también en oscuro (los íconos se hicieron para fondo claro) */
  /* acción: azul de tinta */
  --accent: oklch(48% 0.2 266);
  --accent-hover: oklch(42% 0.2 266);
  --accent-ink: oklch(100% 0 0);
  --accent-soft: oklch(95% 0.035 266);
  --focus: oklch(52% 0.2 262);
  /* resaltador: coincidencias y mejor precio */
  --hl: oklch(91.5% 0.165 97);
  --hl-ink: oklch(24% 0.05 265);
  /* palabras buscadas: en claro, una franja de resaltador bajo el texto; en oscuro, el bloque amarillo completo con texto oscuro */
  --mark-bg: var(--hl);
  --mark-ink: var(--ink);
  --mark-h: 52%;
  --mark-y: 88%;
  /* estados */
  --good: oklch(46% 0.13 155);
  --danger: oklch(50% 0.19 28);
  --star: oklch(76% 0.16 75);
  --series: oklch(48% 0.2 266); /* barras de datos del panel */
  --shadow: 0 1px 2px oklch(24% 0.05 265 / 0.06), 0 12px 32px oklch(24% 0.05 265 / 0.1);
  --shadow-lg: 0 24px 70px oklch(24% 0.05 265 / 0.3);
  --scrim: oklch(20% 0.05 265 / 0.55);

  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* espacio (base 4) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 72px;
  /* escala tipográfica fluida */
  --t-xs: 0.8125rem;
  --t-sm: 0.875rem;
  --t-md: 1rem;
  --t-lg: clamp(1.0625rem, 0.5vw + 0.95rem, 1.1875rem);
  --t-xl: clamp(1.25rem, 1vw + 1rem, 1.5rem);
  --t-2xl: clamp(1.75rem, 2.6vw + 0.9rem, 2.75rem);
  /* medidas */
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: oklch(19% 0.03 265);
    --paper-2: oklch(15.5% 0.028 265);
    --surface: oklch(23.5% 0.035 265);
    --ink: oklch(95.5% 0.01 265);
    --ink-2: oklch(80% 0.025 265);
    --ink-3: oklch(70% 0.03 265);
    --line: oklch(31% 0.035 265);
    --line-strong: oklch(39% 0.04 265);
    --control: oklch(60% 0.04 265);
    --accent: oklch(74% 0.14 266);
    --accent-hover: oklch(80% 0.12 266);
    --accent-ink: oklch(17% 0.04 265);
    --accent-soft: oklch(30% 0.07 266);
    --focus: oklch(75% 0.15 255);
    --mark-ink: var(--hl-ink);
    --mark-h: 100%;
    --mark-y: 0;
    --good: oklch(78% 0.15 155);
    --danger: oklch(75% 0.15 28);
    --star: oklch(80% 0.15 80);
    --series: oklch(72% 0.14 266);
    --shadow: 0 1px 2px oklch(0% 0 0 / 0.3), 0 12px 32px oklch(0% 0 0 / 0.35);
    --shadow-lg: 0 24px 70px oklch(0% 0 0 / 0.6);
    --scrim: oklch(10% 0.03 265 / 0.7);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: oklch(19% 0.03 265);
  --paper-2: oklch(15.5% 0.028 265);
  --surface: oklch(23.5% 0.035 265);
  --ink: oklch(95.5% 0.01 265);
  --ink-2: oklch(80% 0.025 265);
  --ink-3: oklch(70% 0.03 265);
  --line: oklch(31% 0.035 265);
  --line-strong: oklch(39% 0.04 265);
  --control: oklch(60% 0.04 265);
  --accent: oklch(74% 0.14 266);
  --accent-hover: oklch(80% 0.12 266);
  --accent-ink: oklch(17% 0.04 265);
  --accent-soft: oklch(30% 0.07 266);
  --focus: oklch(75% 0.15 255);
  --mark-ink: var(--hl-ink);
  --mark-h: 100%;
  --mark-y: 0;
  --good: oklch(78% 0.15 155);
  --danger: oklch(75% 0.15 28);
  --star: oklch(80% 0.15 80);
  --series: oklch(72% 0.14 266);
  --shadow: 0 1px 2px oklch(0% 0 0 / 0.3), 0 12px 32px oklch(0% 0 0 / 0.35);
  --shadow-lg: 0 24px 70px oklch(0% 0 0 / 0.6);
  --scrim: oklch(10% 0.03 265 / 0.7);
}
@media (prefers-contrast: more) {
  :root {
    --line: var(--line-strong);
    --ink-3: var(--ink-2);
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px); /* el foco y los anclajes no quedan tapados por la cabecera fija */
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-md);
  line-height: 1.55;
  font-optical-sizing: auto;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}
ol,
ul {
  padding: 0;
  list-style: none;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  text-wrap: balance;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection {
  background: var(--hl);
  color: var(--hl-ink);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: var(--s4);
  top: -80px;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  text-decoration: none;
  font-weight: 600;
}
.skip:focus {
  top: var(--s3);
}
.ico {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Botones y campos ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s5);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-ghost {
  background: transparent;
  border-color: var(--control);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--surface);
}
.btn-small {
  min-height: 40px;
  padding: 0 var(--s4);
  font-size: var(--t-sm);
}
.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}
.link {
  min-height: 40px;
  background: none;
  border: 0;
  padding: 0 var(--s2);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  text-decoration-color: var(--line-strong);
}
.link:hover {
  text-decoration-color: var(--accent);
}

.field {
  display: grid;
  gap: var(--s1);
}
.field > span {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
}
input[type='text'],
input[type='search'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='url'],
select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s3);
  background: var(--surface);
  border: 1.5px solid var(--control);
  border-radius: var(--r-md);
}
input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}
input:hover:not(:disabled),
select:hover:not(:disabled) {
  border-color: var(--ink-2);
}
input:focus-visible,
select:focus-visible {
  outline-offset: 0;
  border-color: var(--focus);
}
input:disabled,
select:disabled {
  background: var(--paper-2);
  cursor: not-allowed;
}
input[type='checkbox'],
input[type='radio'] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

/* ---------- Cabecera fija ---------- */

.demo-banner {
  background: var(--paper-2);
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: var(--t-sm);
  padding: var(--s2) var(--gutter);
}
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: color-mix(in oklch, var(--paper) 93%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.top.scrolled {
  border-bottom-color: var(--line);
}
.top-in {
  display: flex;
  align-items: center;
  gap: var(--s4);
  max-width: var(--max);
  min-height: var(--header-h);
  margin-inline: auto;
  padding: var(--s2) var(--gutter);
}
.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  font-stretch: 80%;
  font-variation-settings: 'wdth' 80;
  text-decoration: none;
}
.brand-hl {
  /* cartel de resaltador: texto oscuro sobre amarillo en los dos temas */
  display: inline-block;
  background: var(--hl);
  color: var(--hl-ink);
  padding: 0 8px 1px;
  border-radius: 6px;
  line-height: 1.15;
  transform: rotate(-1.5deg);
}
.top-spacer {
  flex: 1;
}
.nav {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
/* ---------- Interruptor de tema (claro / oscuro) ---------- */
.top-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--s3);
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1.5px solid var(--control);
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--accent-soft);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* el botón muestra el tema al que se pasa: luna en claro, sol en oscuro */
.theme-toggle .i-sun {
  display: none;
}
.theme-toggle[data-to='light'] .i-sun {
  display: block;
}
.theme-toggle[data-to='light'] .i-moon {
  display: none;
}
/* ---------- Selector de idioma ----------
   Una píldora con el globo, el código del idioma y una flecha. El control real es un <select> nativo que cubre toda la
   píldora sin verse: así se abre con el toque o el teclado, y en el celular muestra el selector del sistema. */
.lang-pick {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 var(--s3) 0 var(--s3);
  border: 1.5px solid var(--control);
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
}
.lang-pick:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--accent-soft);
}
.lang-pick:has(select:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.lang-pick svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lang-pick .lang-chev {
  width: 14px;
  height: 14px;
  margin-inline-start: -2px;
}
.lang-code {
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.lang-pick select {
  position: absolute;
  inset: -1.5px; /* cubre también el borde: toda la píldora se puede tocar */
  width: calc(100% + 3px);
  height: calc(100% + 3px);
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  opacity: 0;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
}
.lang-pick select:hover:not(:disabled) {
  border-color: transparent;
}
.search-pill {
  display: none;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  max-width: 320px;
  min-height: 44px;
  padding: 0 var(--s4);
  background: var(--surface);
  border: 1.5px solid var(--control);
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
}
.search-pill:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.search-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top.show-pill .search-pill {
  display: inline-flex;
}
.who {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--t-sm);
}
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  font-size: var(--t-xs);
  font-weight: 700;
}
.badge-premium {
  background: var(--hl);
  border-color: var(--hl);
  color: var(--hl-ink);
}

/* artifact: vista previa del plan */
.plan-switch {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg button {
  min-height: 36px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 650;
  cursor: pointer;
}
.seg button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
.seg button[data-plan='premium'][aria-pressed='true'] {
  background: var(--hl);
  color: var(--hl-ink);
}

/* ---------- Portada: compacta, el buscador es lo primero ---------- */

.hero {
  position: relative;
  z-index: 5; /* las sugerencias del buscador quedan por encima de los filtros, y por debajo de la cabecera */
}
.hero-in {
  max-width: var(--max);
  margin-inline: auto;
  padding: var(--s5) var(--gutter) var(--s4);
}
.hero h1 {
  /* Título grande: ancho normal, peso 700 y tamaño óptico automático (el que corresponde a su tamaño real).
     Antes iba en peso 800, ancho 78 %, tamaño óptico 96 y -0.03em de espaciado: las letras se tocaban y costaba leerlo. */
  max-width: 20ch;
  font-size: var(--t-2xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  font-stretch: 100%;
  font-variation-settings: normal;
  text-wrap: balance;
}
.lede {
  max-width: 62ch;
  margin-top: var(--s3);
  font-size: var(--t-lg);
  color: var(--ink-2);
}
.search {
  position: relative;
  display: flex;
  gap: var(--s2);
  max-width: 780px;
  margin-top: var(--s4);
  padding: var(--s2);
  background: var(--surface);
  border: 1.5px solid var(--control);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.search:focus-within {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.search-box {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  color: var(--ink-3);
}
.search-box > .ico {
  position: absolute;
  left: var(--s3);
  pointer-events: none;
}
.search input[type='search'] {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 52px 0 44px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  font-size: var(--t-lg);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.search input[type='search']::-webkit-search-cancel-button {
  display: none;
}
.search input:focus-visible {
  outline: 0;
}
.search .clear {
  position: absolute;
  right: var(--s1);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.search .clear:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.search > .btn {
  min-height: 52px;
  padding: 0 var(--s6);
  font-size: var(--t-md);
}
.sug {
  position: absolute;
  z-index: 30;
  top: calc(100% + var(--s3));
  left: calc(var(--s2) * -1);
  right: calc(var(--s2) * -1);
  max-height: 340px;
  overflow: auto;
  padding: var(--s2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.sug-group {
  padding: var(--s2) var(--s3) var(--s1);
  font-size: var(--t-xs);
  font-weight: 650;
  color: var(--ink-3);
}
.sug [role='option'] {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  padding: 0 var(--s3);
  border-radius: var(--r-sm);
  color: var(--ink);
  cursor: pointer;
}
.sug [role='option'] .ico {
  color: var(--ink-3);
}
.sug [role='option'][aria-selected='true'],
.sug [role='option']:hover {
  background: var(--accent-soft);
}
.suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--s3);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.15s, background-color 0.15s;
}
.chip:hover {
  border-color: var(--ink-2);
}

/* ---------- Tablero: filtros + resultados ---------- */

.board {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: var(--s7);
  max-width: var(--max);
  margin-inline: auto;
  padding: var(--s5) var(--gutter) var(--s8);
  align-items: start;
}

.filters {
  position: sticky;
  top: calc(var(--header-h) + var(--s4));
  max-height: calc(100dvh - var(--header-h) - var(--s5));
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: var(--s2); /* aire para la barra de desplazamiento */
  scrollbar-width: thin;
}
.filters > summary {
  display: none;
}
.filters-body {
  display: grid;
  gap: var(--s5);
}
.filter-groups {
  display: grid;
  gap: var(--s5);
}
.filters fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.filters legend {
  float: left; /* la leyenda queda dentro del flujo: sin esto la línea superior del grupo la atraviesa */
  width: 100%;
  padding: 0;
  margin-bottom: var(--s2);
  font-weight: 700;
  font-size: var(--t-sm);
  color: var(--ink);
}
.filters legend + * {
  clear: both;
}
.filters fieldset + fieldset {
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
.lock-note {
  display: grid;
  gap: var(--s3);
  padding: var(--s4);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklch, var(--accent) 28%, transparent);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
}
.lock-note strong {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 750;
}
.lock-note .btn {
  justify-self: start;
  background: var(--accent);
  color: var(--accent-ink);
}
.filters-locked .filter-groups {
  opacity: 0.55;
}
.check {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 40px;
  font-size: var(--t-sm);
  cursor: pointer;
}
/* .check .dot: la lista de plataformas de la página publicada (publicacion/plantilla*.html) sigue usando el punto de color;
   el sitio con servidor ya usa .plat-ico (ver abajo). */
.check .dot,
.course-platform .dot,
.pick .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--brand, var(--ink-3));
  flex: none;
}
/* ícono de cada plataforma en la lista de plataformas; sin ícono, la inicial sobre el color de la marca */
.plat-ico {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--icon-bg);
}
.plat-ico img {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.plat-ico-initial {
  border-color: transparent;
  background: var(--brand, var(--ink-3));
  color: var(--on-brand, #fff);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.plat-ico-initial::before {
  content: attr(data-initial);
}
.check .count {
  margin-left: auto;
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.platform-list {
  display: grid;
}
.price-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
}
.filters .reset {
  justify-self: start;
}
.fine {
  font-size: var(--t-xs);
  color: var(--ink-3);
}
.filters .fine {
  margin-top: var(--s2);
}
/* Avisos bajo el botón del diálogo Premium (pago único, a quién escribir): separados entre sí y del botón. */
#premium-actions .fine {
  margin-top: var(--s2);
}
#btn-pay-verify {
  margin-top: var(--s3);
}
/* Formas de pagar del diálogo Premium (Mercado Pago, PayPal): cada una con su precio, porque PayPal cobra en otra moneda. */
.pay-methods {
  display: grid;
  gap: var(--s5);
}
.pay-method {
  display: grid;
  gap: var(--s2);
}
.pay-method + .pay-method {
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
.pay-price {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.pay-method .btn {
  width: 100%;
}
/* Resultado de «Ya pagué» / del regreso de Mercado Pago, debajo de los botones del diálogo Premium. */
.pay-status {
  margin-top: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  font-size: var(--t-sm);
}
.pay-status.bad {
  background: color-mix(in oklch, var(--danger) 12%, var(--surface));
  color: var(--danger);
}
.filters-done {
  display: none;
}

/* ---------- Resultados ---------- */

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--s3) var(--s5);
  padding-bottom: var(--s3);
}
.results-head h2 {
  font-size: var(--t-xl);
  font-weight: 750;
  letter-spacing: -0.015em;
  font-stretch: 88%;
  font-variation-settings: 'wdth' 88;
}
.results-head h2 small {
  display: block;
  margin-top: 2px;
  font-family: var(--font);
  font-size: var(--t-sm);
  font-weight: 450;
  color: var(--ink-3);
  font-stretch: 100%;
  font-variation-settings: normal;
  letter-spacing: 0;
}
.sort {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.sort select {
  width: auto;
  min-height: 40px;
}
.sort-note {
  margin-bottom: var(--s3);
  font-size: var(--t-xs);
  color: var(--ink-3);
  max-width: 70ch;
}
.active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.chip-x {
  background: var(--accent-soft);
  border-color: color-mix(in oklch, var(--accent) 35%, transparent);
  padding-right: var(--s2);
}
.chip-x .ico {
  width: 16px;
  height: 16px;
}
.chip-x:hover {
  border-color: var(--accent);
}
.progress {
  height: 3px;
  margin-bottom: var(--s3);
  border-radius: 3px;
  background: transparent;
  overflow: hidden;
}
.progress.on {
  background: var(--line);
}
.progress.on::after {
  content: '';
  display: block;
  width: 35%;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
@media (prefers-reduced-motion: no-preference) {
  .progress.on::after {
    animation: slide 1.1s ease-in-out infinite;
  }
  @keyframes slide {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(300%);
    }
  }
}

.list {
  display: grid;
  gap: var(--s3);
  container-type: inline-size;
  transition: opacity 0.15s;
}
.list.loading {
  opacity: 0.55;
}

/* Tarjeta de curso: una por objeto que se compara */
.course {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s3) var(--s5);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.course:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.course-main {
  min-width: 0;
}
.course-platform {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--ink-2);
}
.lang {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.course-title {
  margin-top: var(--s1);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.012em;
  font-stretch: 90%;
  font-variation-settings: 'wdth' 90;
  text-wrap: balance;
}
.course-meta {
  margin-top: var(--s1);
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.course-note {
  margin-top: var(--s2);
  font-size: var(--t-xs);
  color: var(--ink-3);
}
.course-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s3) var(--s6);
}
.course-rating {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.rating-line {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.stars {
  --pct: 0%;
  position: relative;
  display: inline-block;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--line-strong);
}
.stars::before {
  content: '★★★★★';
}
.stars::after {
  content: '★★★★★';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--pct);
  overflow: hidden;
  white-space: nowrap;
  color: var(--star);
}
.score {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 750;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.score.none {
  font-family: var(--font);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
}
.score-bar {
  display: block;
  width: 96px;
  height: 4px;
  margin: 8px 0 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.score-bar i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  background: var(--good);
}
.course-price strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.course-price .soft {
  font-family: var(--font);
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--ink-2);
}
.course-price .free {
  color: var(--good);
}
.course-price small {
  display: block;
  font-size: var(--t-xs);
  color: var(--ink-3);
}
.course-action {
  display: grid;
  gap: var(--s2);
  align-content: start;
}
.course-go {
  min-width: 132px;
}
.course-go[aria-disabled='true'] {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--line-strong);
  cursor: pointer;
  opacity: 1;
}
.course-go[aria-disabled='true']:hover {
  background: var(--paper-2);
  border-color: var(--ink-2);
}
.course-go-hint {
  max-width: 24ch;
  font-size: var(--t-xs);
  line-height: 1.35;
  color: var(--ink-3);
}
.course-go-hint strong {
  color: var(--ink-2);
}
.course-go-hint .dest {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "Mismo tema en…": la comparación entre plataformas, dentro de la tarjeta */
.course-also {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px dashed var(--line-strong);
  font-size: var(--t-xs);
  color: var(--ink-3);
}
.course-also-label {
  margin-right: var(--s1);
  font-weight: 650;
}
.course-also .chip {
  min-height: 36px;
  font-size: var(--t-sm);
}
.pick {
  position: relative;
  gap: var(--s2);
}
.pick input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.pick:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pick:has(input:checked)::before {
  content: '✓';
  font-weight: 800;
  color: var(--accent);
}
.pick:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.course-also.nudge .pick {
  animation: nudge 0.5s ease-in-out 2;
  border-color: var(--accent);
}
@keyframes nudge {
  50% {
    background: var(--hl);
    color: var(--hl-ink);
  }
}
@media (prefers-reduced-motion: reduce) {
  .course-also.nudge .pick {
    animation: none;
    background: var(--hl);
    color: var(--hl-ink);
  }
}

/* Dos columnas cuando la tarjeta es ancha (container query: depende del ancho de la lista, no de la pantalla) */
@container (min-width: 640px) {
  .course {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'main action'
      'facts action'
      'also also';
    align-items: start;
  }
  .course-main {
    grid-area: main;
  }
  .course-facts {
    grid-area: facts;
  }
  .course-action {
    grid-area: action;
    justify-items: end;
    text-align: right;
  }
  .course-go-hint {
    text-align: right;
  }
  .course-also {
    grid-area: also;
  }
  .web-course {
    grid-template-areas: 'main action';
  }
  .web-course.with-facts {
    grid-template-areas:
      'main action'
      'facts action';
  }
  .web-facts {
    grid-area: facts;
  }
}

/* El resaltador: marca las palabras buscadas. Es el único movimiento de la página. */
mark {
  color: var(--mark-ink);
  background: linear-gradient(var(--mark-bg), var(--mark-bg)) 0 var(--mark-y) / 100% var(--mark-h) no-repeat;
  padding: 0 2px;
  margin: 0 -1px;
  border-radius: 3px;
}
@media (prefers-reduced-motion: no-preference) {
  .list.sweep mark {
    animation: sweep 0.55s ease-out 0.12s both;
  }
  @keyframes sweep {
    from {
      background-size: 0% var(--mark-h);
    }
    to {
      background-size: 100% var(--mark-h);
    }
  }
}

/* Carga: esqueletos con la forma de las tarjetas */
.skel {
  display: grid;
  gap: var(--s3);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.skel i {
  display: block;
  height: 14px;
  border-radius: 6px;
  background: var(--paper-2);
}
.skel i:nth-child(1) {
  width: 22%;
}
.skel i:nth-child(2) {
  height: 22px;
  width: 70%;
}
.skel i:nth-child(3) {
  width: 40%;
}
@media (prefers-reduced-motion: no-preference) {
  .skel i {
    background: linear-gradient(90deg, var(--paper-2) 30%, var(--line) 50%, var(--paper-2) 70%) 0 0 / 300% 100%;
    animation: shimmer 1.4s linear infinite;
  }
  @keyframes shimmer {
    to {
      background-position: -300% 0;
    }
  }
}

/* Resultados en vivo (búsqueda web) */
.web {
  margin-top: var(--s7);
}
.web-head {
  padding-bottom: var(--s4);
}
.web-head h3 {
  font-size: var(--t-xl);
  font-weight: 750;
  letter-spacing: -0.015em;
  font-stretch: 88%;
  font-variation-settings: 'wdth' 88;
}
.web-head p {
  margin-top: 2px;
  max-width: 70ch;
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.live-tag {
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.web-snippet {
  margin-top: var(--s2);
  max-width: 70ch;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--ink-2);
}
.web-note {
  margin-top: var(--s2);
  font-size: var(--t-xs);
  color: var(--ink-3);
}

/* Puntuación, costo y autor de cada curso en vivo, leídos de su página */
.web-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: var(--s4) var(--s6);
  margin: var(--s2) 0 0;
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}
.fact {
  min-width: 0;
}
.fact dt {
  font-size: var(--t-xs);
  font-weight: 650;
  color: var(--ink-3);
}
.fact dd {
  display: grid;
  gap: 2px;
  justify-items: start;
  min-width: 0;
  margin: var(--s1) 0 0;
  overflow-wrap: anywhere;
}
.fact-val {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 750;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.fact-val.soft {
  font-family: var(--font);
  font-size: var(--t-md, 1rem);
  font-weight: 650;
  color: var(--ink-2);
}
.fact-val.free {
  color: var(--good);
}
.fact-val.none {
  font-family: var(--font);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-3);
}
.fact-val.person {
  font-family: var(--font);
  font-size: var(--t-md, 1rem);
  font-weight: 650;
  line-height: 1.3;
}
.fact-sub {
  font-size: var(--t-xs);
  line-height: 1.35;
  color: var(--ink-3);
}
.fact-sub s {
  text-decoration-thickness: 1px;
}
.fact .rating-line {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.fact-skel {
  display: block;
  width: 7rem;
  height: 20px;
  border-radius: 6px;
  background: var(--paper-2);
}
@media (prefers-reduced-motion: no-preference) {
  .fact-skel {
    background: linear-gradient(90deg, var(--paper-2) 30%, var(--line) 50%, var(--paper-2) 70%) 0 0 / 300% 100%;
    animation: shimmer 1.4s linear infinite;
  }
}
.web-facts.off {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
}
.fact-off {
  max-width: 52ch;
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.reading {
  margin-bottom: var(--s3);
  font-size: var(--t-xs);
  color: var(--ink-3);
}

/* Sitio sin catálogo propio (SOLO_EN_VIVO=1): los resultados en vivo son los únicos y no hay orden ni filtros de precio */
.live-only .sort {
  display: none;
}
.live-only .web {
  margin-top: 0;
}
.live-only .web-head h3 {
  position: absolute; /* sigue nombrando la sección para lectores de pantalla, pero el título de la página ya lo dice */
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.live-only .web-head {
  padding-bottom: var(--s3);
}

.locked {
  display: grid;
  gap: var(--s3);
  justify-items: start;
  padding: var(--s6) var(--s5);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklch, var(--accent) 28%, transparent);
  border-radius: var(--r-lg);
}
.locked p {
  max-width: 56ch;
}
.locked strong {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 750;
}
.locked .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
}

.empty {
  padding: var(--s7) var(--s5);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}
.empty h3 {
  font-size: var(--t-xl);
  font-weight: 700;
}
.empty p {
  margin-top: var(--s2);
  max-width: 60ch;
  color: var(--ink-2);
}
.empty .suggest {
  margin-top: var(--s4);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
  margin-top: var(--s6);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.foot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--s4) var(--s6);
  max-width: var(--max);
  margin-inline: auto;
  padding: var(--s6) var(--gutter) var(--s7);
  border-top: 1px solid var(--line);
  font-size: var(--t-xs);
  line-height: 1.6;
  color: var(--ink-3);
}
.foot p {
  max-width: 62ch;
}
/* Enlaces a los Términos y a la Política de privacidad: una línea propia, sobre el aviso de derechos de autor. */
.foot .foot-links {
  grid-column: 1 / -1;
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
}
.foot-links a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.foot-links a:hover {
  color: var(--ink);
}
/* Aviso de derechos de autor: ocupa todo el ancho, debajo de los demás textos. */
.foot .foot-legal {
  grid-column: 1 / -1;
  max-width: none;
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere; /* un titular largo y sin espacios no ensancha la página */
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s6);
}
.foot-legal a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.foot-legal a:hover {
  color: var(--ink);
}

/* ---------- Diálogos ---------- */

dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
@media (prefers-reduced-motion: no-preference) {
  dialog,
  dialog::backdrop {
    transition: opacity 0.2s ease, transform 0.2s ease, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
  }
  dialog:not([open]),
  dialog:not([open])::backdrop {
    opacity: 0;
  }
  dialog:not([open]) {
    transform: translateY(12px) scale(0.98);
  }
  @starting-style {
    dialog[open],
    dialog[open]::backdrop {
      opacity: 0;
    }
    dialog[open] {
      transform: translateY(12px) scale(0.98);
    }
  }
}
.dialog-body {
  display: grid;
  gap: var(--s4);
  padding: var(--s6);
}
.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--s4);
}
.dialog-head h2 {
  /* mismo tratamiento que el título de la portada (mismo tamaño, misma legibilidad) */
  font-size: var(--t-2xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  font-stretch: 100%;
  font-variation-settings: normal;
  text-wrap: balance;
}
.x {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.x:hover {
  background: var(--paper-2);
}
.auth-form {
  display: grid;
  gap: var(--s4);
}
.tabs {
  display: flex;
  gap: var(--s5);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  font-weight: 650;
  color: var(--ink-3);
  cursor: pointer;
}
.tabs button[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.error {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: color-mix(in oklch, var(--danger) 12%, var(--surface));
  color: var(--danger);
  font-size: var(--t-sm);
  font-weight: 600;
}
.plan-list {
  display: grid;
  gap: var(--s2);
}
.plan-list li {
  display: flex;
  gap: var(--s3);
}
.plan-list li::before {
  content: '✓';
  font-weight: 800;
  color: var(--accent);
}
.price-line {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Mis cursos (Premium) ---------- */
.course-save {
  gap: var(--s2);
  justify-content: center;
}
.course-save .ico {
  width: 18px;
  height: 18px;
}
.course-save.is-locked {
  color: var(--ink-2);
}
.course-save.is-saved {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.course-save.is-saved .ico {
  fill: currentColor;
}
.save-error {
  max-width: 24ch;
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.35;
  color: var(--danger);
}
.saved-count {
  display: inline-block;
  min-width: 20px;
  margin-left: var(--s2);
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.saved-count:empty {
  display: none;
}
dialog.dialog-wide {
  width: min(680px, calc(100vw - 32px));
}
#saved-body {
  display: grid;
  gap: var(--s4);
}
#saved-body:focus {
  outline: none;
}
.saved-lead {
  color: var(--ink-2);
}
.saved-alerts {
  display: grid;
  gap: var(--s1);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--paper-2);
}
.saved-alerts .fine {
  margin: 0;
}
.saved-empty {
  padding: var(--s5) var(--s4);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink-2);
  text-align: center;
}
.saved-list {
  display: grid;
  gap: var(--s3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.saved-item {
  display: grid;
  gap: var(--s2);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand, var(--line-strong));
  border-radius: var(--r-md);
  background: var(--surface);
}
.saved-title {
  font-size: var(--t-md);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.saved-title a {
  color: var(--ink);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.saved-title a:hover {
  text-decoration-color: var(--accent);
}
.saved-cost {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s3);
}
.saved-cost-label {
  font-size: var(--t-xs);
  font-weight: 650;
  color: var(--ink-3);
}
.saved-cost strong {
  font-size: var(--t-lg);
  font-variant-numeric: tabular-nums;
}
.saved-item .fine {
  margin: 0;
}
.saved-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
}
.from-premium {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--paper-2);
}

/* ---------- Pantallas chicas ---------- */

@media (max-width: 880px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s4);
    padding-top: var(--s4);
  }
  .filters {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .filters > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 var(--s4);
    border: 1.5px solid var(--control);
    border-radius: var(--r-md);
    background: var(--surface);
    font-weight: 650;
    cursor: pointer;
    list-style: none;
  }
  .filters > summary::-webkit-details-marker {
    display: none;
  }
  .filters > summary::after {
    content: '';
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-3px);
    transition: transform 0.2s;
  }
  .filters[open] > summary::after {
    transform: rotate(225deg);
  }
  .filters[open] > summary {
    margin-bottom: var(--s4);
  }
  .filters[open] .filters-body {
    padding: var(--s4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
  }
  .filters-done {
    display: inline-flex;
    justify-self: stretch;
  }
  .hero-in {
    padding-top: var(--s5);
  }
  .nav .who .name {
    display: none;
  }
  .plan-switch > span {
    display: none;
  }
}

@media (max-width: 720px) {
  .search {
    flex-direction: column;
  }
  .search > .btn {
    min-height: 52px;
  }
  .course {
    padding: var(--s4);
  }
  .course-go {
    width: 100%;
  }
  .course-go-hint {
    max-width: none;
  }
  .top.show-pill .brand,
  .top.show-pill .top-spacer {
    display: none; /* con el buscador compacto a la vista, la marca cede el lugar */
  }
  .top.show-pill .search-pill {
    flex: 1;
    max-width: none;
  }
}

/* Cabecera en celulares. Marca + idioma + tema + Premium + cuenta no caben en una fila de 320 a 560 px (en francés, «Se
   connecter» es más largo que «Entrar»): arriba van la marca y los dos botones redondos, y debajo, a la derecha, Premium y
   la cuenta. Al bajar por la página, cuando aparece el buscador compacto, vuelve a una sola fila: buscador + idioma + tema. */
@media (max-width: 640px) {
  .top-in {
    flex-wrap: wrap;
    gap: 0 var(--s2);
    padding-block: var(--s1);
  }
  .brand {
    order: 1;
  }
  .top-spacer {
    order: 2;
  }
  .top-tools {
    order: 3;
    gap: var(--s2);
  }
  .nav {
    order: 4;
    flex: 0 0 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--s2);
  }
  .nav .link {
    min-height: 36px;
  }
  .top.show-pill .nav {
    display: none;
  }
  .top.show-pill .search-pill {
    order: 1;
    min-width: 0;
  }
}
@media (max-width: 400px) {
  .lang-pick {
    padding-inline: var(--s3);
    gap: 4px;
  }
  .lang-pick .lang-chev {
    display: none;
  }
}

/* Contraste forzado y alto contraste del sistema */
@media (forced-colors: active) {
  .course,
  .chip,
  .btn,
  .skel,
  .search,
  .locked,
  .empty {
    border: 1px solid CanvasText;
  }
  mark {
    background: Highlight;
    color: HighlightText;
  }
  .stars::after {
    color: Highlight;
  }
}

/* ---------- Página «Dejar de recibir avisos» (baja.html) ---------- */
.bye {
  display: grid;
  gap: var(--s4);
  justify-items: start;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: var(--s7, 56px) var(--s4);
}
.bye h1 {
  font-size: var(--t-2xl);
  line-height: 1.1;
  text-wrap: balance;
}
.bye p {
  margin: 0;
}
.bye a:not(.brand):not(.btn) {
  color: var(--ink-2);
}
.bye a.btn-primary {
  color: var(--accent-ink);
}

/* ---------- Olvidé mi contraseña (diálogo de acceso) y página «Elige tu contraseña nueva» (restablecer.html) ---------- */
.forgot-link {
  justify-self: start;
  padding: 0;
}
.forgot-sent {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  font-size: var(--t-md);
}
.reset-page .reset-form {
  width: min(420px, 100%);
}
.reset-page .reset-done:not(.error) {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  font-weight: 600;
}
.reset-page .reset-done.error {
  width: 100%;
}

/* ---------- Panel: pagos de Premium ---------- */
.pay-admin,
.mail-admin {
  margin-top: var(--s5);
}
.pay-checks {
  display: grid;
  gap: var(--s1);
  margin-bottom: var(--s3);
  font-size: var(--t-sm);
}
.pay-checks .good {
  color: var(--good);
  font-weight: 700;
}
.pay-checks .bad-text {
  color: var(--danger);
  font-weight: 700;
}
.pay-admin code,
.mail-admin code {
  overflow-wrap: anywhere;
}
.mail-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  margin-bottom: var(--s2);
  font-size: var(--t-sm);
}
.pay-sub {
  margin: var(--s4) 0 var(--s2);
  font-size: var(--t-md);
}

/* ---------- Términos de uso y Política de privacidad (/terminos, /privacidad) ---------- */
.legal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3) var(--s5);
  max-width: 760px;
  margin-inline: auto;
  padding: var(--s5) var(--gutter) 0;
}
/* La regla de celulares de la cabecera del sitio (.brand { order: 1 }) no aplica aquí: la marca va primero, el enlace para volver después. */
.legal-head .brand {
  order: 0;
}
.legal-back {
  color: var(--ink-2);
  font-size: var(--t-sm);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.legal-back:hover {
  color: var(--ink);
}
.legal-doc {
  max-width: 760px;
  margin-inline: auto;
  padding: var(--s6) var(--gutter) var(--s8);
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.legal-doc h1 {
  font-family: var(--font-display);
  font-size: var(--t-2xl);
  line-height: 1.1;
  text-wrap: balance;
  margin: 0 0 var(--s3);
}
.legal-doc h2 {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  line-height: 1.2;
  text-wrap: balance;
  margin: var(--s7) 0 var(--s3);
}
.legal-doc p,
.legal-doc ul,
.legal-doc dl {
  margin: 0 0 var(--s4);
}
.legal-doc ul {
  list-style: disc;
  padding-left: 1.25em;
}
.legal-doc li + li {
  margin-top: var(--s2);
}
.legal-doc a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}
.legal-meta {
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.legal-lang {
  display: grid;
  gap: var(--s1);
  padding: var(--s3) var(--s4);
  border-left: 3px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: var(--t-sm);
}
.legal-data dt {
  margin-top: var(--s4);
  font-weight: 650;
}
.legal-data dd {
  margin: var(--s1) 0 0;
  color: var(--ink-2);
}
.auth-terms a,
.pay-terms a {
  color: inherit;
}
