/* ═══════════════════════════════════════════════════════════════════════════
   Antes y ahora — un comparador que se arrastra.

   A la izquierda, la hoja de cálculo tal como se ve un viernes de cierre:
   comas y puntos mezclados, un #¡REF!, un post-it. A la derecha, la misma
   lista en la aplicación. Una línea las separa y se arrastra; sin guion
   queda a la mitad y se ven las dos.
   ═══════════════════════════════════════════════════════════════════════════ */

/* El nombre del archivo, tachado en el titular. La raya se traza cuando el
   titular asoma. */
.archivo {
  position: relative;
  font-family: var(--mono);
  font-size: .62em;
  font-weight: 500;
  letter-spacing: -.04em;
  color: var(--tinta-2);
  white-space: nowrap;
}
.archivo::after {
  content: '';
  position: absolute; left: -2%; right: -2%; top: 54%;
  height: .09em; border-radius: 1em;
  background: var(--alarma);
  transform-origin: left;
  transform: rotate(-2deg);
}
html.js .archivo::after { transform: rotate(-2deg) scaleX(0); transition: transform .7s var(--sale) .3s; }
html.js .revela--visto .archivo::after { transform: rotate(-2deg) scaleX(1); }

.comparador {
  --corte: 50%;
  position: relative;
  height: clamp(460px, 52vw, 600px);
  margin-top: clamp(40px, 6vw, 72px);
  border-radius: var(--radio-xl);
  overflow: hidden;
  box-shadow: var(--sombra);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.comparador__capa { position: absolute; inset: 0; }

/* ── Antes: la hoja de cálculo ─────────────────────────────────────────── */
.hc {
  display: grid; grid-template-rows: auto 1fr auto;
  background: #ffffff;
  color: #1f1f1f;
  font-family: var(--mono);
  font-size: clamp(11px, 1.15vw, 14px);
}
.hc__formula {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #d9d9d9;
  background: #f6f6f6;
  white-space: nowrap; overflow: hidden;
}
.hc__formula i { font-style: italic; font-weight: 700; color: #777; }
.hc__formula span { color: #b3261e; }
.hc__tabla { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hc__tabla th, .hc__tabla td {
  border: 1px solid #e0e0e0;
  padding: 0 8px;
  height: clamp(34px, 4.2vw, 46px);
  text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 400;
}
.hc__tabla thead th, .hc__tabla tbody th {
  background: #f3f3f3; color: #666;
  text-align: center; font-size: .86em;
}
.hc__tabla tr > th:first-child { width: 44px; }
.hc__tabla .hc__cab td { font-weight: 700; background: #fafafa; }
.hc__tabla .hc__mal { color: #b3261e; font-weight: 700; background: #fdecea; }
.hc__tabla .hc__amarillo { background: #fff3a6; }
.hc__tabla .hc__sel { outline: 2px solid #1a73e8; outline-offset: -2px; }
.hc__postit {
  position: absolute; left: 30%; top: 58%;
  width: clamp(150px, 17vw, 200px);
  padding: 14px 14px 18px;
  background: #ffe066;
  color: #4a3b00;
  font-family: var(--sans); font-size: 14px; font-weight: 500; line-height: 1.3;
  transform: rotate(-4deg);
  box-shadow: 0 10px 22px rgb(0 0 0 / .18);
}
.hc__pestanas {
  display: flex; gap: 2px;
  padding: 0 12px;
  background: #f1f1f1;
  border-top: 1px solid #d9d9d9;
  overflow: hidden;
}
.hc__pestanas span { padding: 9px 14px; color: #666; white-space: nowrap; font-size: .9em; }
.hc__pestanas .activa { background: #fff; color: #1f1f1f; font-weight: 700; border-bottom: 3px solid #188038; }

/* ── Ahora: la aplicación ──────────────────────────────────────────────── */
.app {
  clip-path: inset(0 0 0 var(--corte));
  display: grid; grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(60% 80% at 100% 0%, rgb(202 210 37 / .14), transparent 70%),
    #0e1611;
  color: var(--sobre-noche);
  padding: clamp(18px, 2.4vw, 30px) clamp(18px, 3vw, 40px);
}
.app__cab { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.app__materia { font-weight: 700; font-size: clamp(15px, 1.6vw, 19px); letter-spacing: -.02em; }
.app__materia small { display: block; font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--sobre-noche-2); margin-top: 2px; }
.app__estado {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgb(90 214 154 / .12); color: #8ff0bd;
  font-size: 12.5px; font-weight: 600;
}
.app__estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #5ad69a; }
.app__lista { display: grid; align-content: center; gap: clamp(6px, 1vw, 10px); }
.app__fila {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 70px minmax(0, 2fr) 110px;
  align-items: center; gap: clamp(10px, 2vw, 24px);
  padding: clamp(9px, 1.2vw, 14px) 16px;
  border-radius: 14px;
  background: rgb(255 255 255 / .04);
  font-size: clamp(13px, 1.3vw, 15.5px);
}
.app__nombre { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app__def { font-family: var(--mono); font-weight: 700; color: #5ad69a; }
.app__def--baja { color: #ff8f82; }
.app__asis { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--sobre-noche-2); }
.app__asis i { flex: 1; height: 6px; border-radius: 6px; background: rgb(255 255 255 / .08); overflow: hidden; }
.app__asis i::before { content: ''; display: block; height: 100%; width: var(--p); border-radius: inherit; background: #cad225; }
.app__fila:nth-child(1) { --p: 92%; }
.app__fila:nth-child(2) { --p: 96%; }
.app__fila:nth-child(3) { --p: 81%; }
.app__fila:nth-child(4) { --p: 84%; }
.app__fila:nth-child(5) { --p: 61%; background: rgb(255 122 107 / .08); }
.app__fila:nth-child(5) .app__asis i::before { background: #ff8f82; }
.app__marca { justify-self: end; padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; background: rgb(90 214 154 / .12); color: #8ff0bd; white-space: nowrap; }
.app__marca--riesgo { background: rgb(255 122 107 / .16); color: #ff9d91; }
.app__pie { font-family: var(--mono); font-size: 12px; color: var(--sobre-noche-2); }

/* ── La línea, su perilla y las etiquetas ──────────────────────────────── */
.comparador__linea {
  position: absolute; top: 0; bottom: 0; left: var(--corte);
  width: 3px; margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .08), 0 0 24px rgb(202 210 37 / .6);
  pointer-events: none;
}
.comparador__perilla {
  position: absolute; top: 50%; left: 50%;
  display: grid; place-items: center;
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: #fff; color: #161b17;
  box-shadow: 0 8px 24px rgb(0 0 0 / .25);
  transition: transform var(--dur-1) var(--sale);
}
.comparador__perilla svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.comparador:active .comparador__perilla { transform: scale(.92); }
.comparador:has(.comparador__control:focus-visible) .comparador__perilla { outline: 3px solid var(--lima); outline-offset: 3px; }

.comparador__etiqueta {
  position: absolute; top: 14px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  pointer-events: none;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.comparador__etiqueta--antes { left: 14px; top: auto; bottom: 54px; background: rgb(0 0 0 / .72); color: #fff; }
.comparador__etiqueta--ahora { right: 14px; background: rgb(202 210 37 / .95); color: #11200f; }

/* El control es un rango invisible del tamaño del comparador: se arrastra
   con el dedo, con el ratón o con las flechas, y un lector de pantalla lo
   anuncia como lo que es. Sin guion no movería nada, así que no está. */
.comparador__control {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none; appearance: none;
}
html:not(.js) .comparador__control { display: none; }

.comparador__pie { margin-top: 18px; text-align: center; font-size: 14.5px; color: var(--tinta-2); }

@media (max-width: 760px) {
  .hc__tabla .hc__col-f, .hc__tabla .hc__col-c { display: none; }
  .app__fila { grid-template-columns: minmax(0, 1fr) 46px 84px; }
  .app__asis { display: none; }
  .hc__postit { left: 8%; top: 62%; }
}
