/* SuperCurrator · mundo «plano de metro». Tokens y componentes comunes a ambos hubs. */
@font-face {
  font-family: "Archivo";
  src: url("fuentes/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --tinta: #1b1f2a;
  --tinta-2: #2a3040;
  --papel: #ffffff;
  --suelo: #ffffff;
  --hueco: #f5f6f8;
  --via: #d6dbe4;
  --filete: #e3e6ec;
  --mudo: #555c6b;
  --senal: #f4c430;
  --senal-suave: #fdf3cf;
  --error: #b42318;
  --l1: #2a62a8;
  --l2: #c4471c;
  --l3: #2e7d3e;
  --l4: #6b4fa0;
  --l5: #a23a55;
  --c: var(--tinta);
  --radio: 12px;
  --sombra: 0 1px 2px rgb(27 31 42 / .06), 0 6px 18px -8px rgb(27 31 42 / .18);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

.l1 { --c: var(--l1); } .l2 { --c: var(--l2); } .l3 { --c: var(--l3); } .l4 { --c: var(--l4); } .l5 { --c: var(--l5); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--suelo);
  color: var(--tinta);
  font: 400 15px/1.45 "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: color-mix(in oklab, var(--l1) 22%, white); color: var(--tinta); }
:focus-visible { outline: 3px solid var(--tinta); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { caret-color: var(--c); }
.sin-scroll { overflow: hidden; }
* { scrollbar-width: thin; scrollbar-color: var(--via) transparent; }

.i { width: 20px; height: 20px; flex: none; }
.i-xl { width: 40px; height: 40px; stroke-width: 1.6; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--via); border-radius: 10px;
  background: var(--papel); color: var(--tinta);
  font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .i { width: 18px; height: 18px; }
.btn-pri { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.btn-linea { background: var(--c); border-color: var(--c); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-xl { min-height: 54px; width: 100%; font-size: 16px; border-radius: 12px; }
.btn-icono {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.btn-icono:active { transform: scale(0.94); }
.cargando { position: relative; color: transparent !important; }
.cargando::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid #fff; border-right-color: transparent; animation: gira .7s linear infinite;
}
.btn:not(.btn-pri):not(.btn-linea).cargando::after { border-color: var(--tinta); border-right-color: transparent; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--tinta); }
  .btn-pri:hover { background: var(--tinta-2); }
  .btn-linea:hover { filter: brightness(1.08); border-color: var(--c); }
  .btn-icono:hover { background: var(--hueco); }
}

/* Roundel de línea */
.roundel {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); color: #fff; box-shadow: 0 0 0 2.5px var(--papel), 0 0 0 4px var(--c);
  font-weight: 800; font-size: 11px; letter-spacing: .02em;
}

/* Estaciones: la firma del mundo */
.estaciones {
  --avance: 0;
  position: relative; display: grid; grid-template-columns: repeat(4, 1fr);
  margin: 0; padding: 0; list-style: none;
}
.estaciones::before, .estaciones::after {
  content: ""; position: absolute; top: 8px; left: 12.5%; height: 4px; border-radius: 2px;
}
.estaciones::before { right: 12.5%; background: color-mix(in oklab, var(--c) 28%, white); }
.estaciones::after {
  width: calc(75% * var(--avance)); background: var(--c);
  transform-origin: left;
}
@keyframes via { from { transform: scaleX(0); } }
.estacion { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.estacion i {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--papel); border: 3.5px solid var(--c);
  display: grid; place-items: center; margin-top: 0;
}
.estacion span { font-size: 11px; font-weight: 600; color: var(--mudo); white-space: nowrap; }
.estacion time { font-size: 10.5px; color: var(--mudo); letter-spacing: .02em; }
.estacion[data-estado="hecha"] i { background: var(--c); border-color: var(--c); }
.estacion[data-estado="saltada"] i { border-color: var(--c); border-style: dashed; }
.estacion[data-estado="actual"] i {
  border-color: var(--c); border-width: 5px; transform: scale(1.15);

}
.estacion[data-estado="actual"] span { color: var(--tinta); font-weight: 800; }
.es-suyo .estacion[data-estado="actual"] i, .estaciones.es-suyo .estacion[data-estado="actual"] i { background: var(--senal); }
@keyframes late {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--c) 45%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px;
  border-radius: 999px; background: var(--hueco); color: var(--mudo);
  font-size: 13px; font-weight: 700;
}
.chip .i { width: 16px; height: 16px; }
.chip-suyo { background: var(--senal); color: var(--tinta); }

/* Campos */
.campo { display: grid; gap: 6px; }
.campo > span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--mudo); }
.campo > span .i { width: 16px; height: 16px; }
input:not([type="file"]), textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1.5px solid var(--via); border-radius: 10px; background: var(--papel);
  transition: border-color 160ms ease;
}
textarea { resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #727988; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--tinta); }

/* Hoja inferior (drawer) */
.hoja-inferior {
  position: fixed; inset: 0; z-index: 40; display: grid; align-items: end;
  background: rgb(27 31 42 / .45);
  transition: opacity 240ms var(--ease-out);
}
.hoja-caja {
  display: grid; gap: 14px; width: min(560px, 100%); margin: 0 auto;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--papel); border-radius: 18px 18px 0 0;
  transition: transform 320ms var(--ease-drawer);
}
@starting-style {
  .hoja-inferior { opacity: 0; }
  .hoja-caja { transform: translateY(100%); }
}
.hoja-caja h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.hoja-confirmar { justify-items: center; text-align: center; }
.hoja-acciones { display: flex; gap: 10px; width: 100%; }
.hoja-acciones .btn { flex: 1; }
.hueco { flex: 1; }

/* Opciones tipo chip pulsable */
.opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.opciones button {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--via); background: var(--papel); font-weight: 600; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease;
}
.opciones button:active { transform: scale(0.96); }
.opciones button[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }

/* Contador 1–4 */
.contador { display: inline-flex; align-items: center; border: 1.5px solid var(--via); border-radius: 10px; width: max-content; background: var(--papel); }
.contador button { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.contador output { min-width: 32px; text-align: center; font-weight: 800; font-size: 18px; }

/* Aviso */
#aviso {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 12px; background: var(--tinta); color: #fff; font-weight: 700;
  box-shadow: var(--sombra);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
#aviso.visible { opacity: 1; transform: translate(-50%, 0); }
#aviso[data-tipo="error"] { background: var(--error); }

/* Acceso */
.acceso {
  min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 16px;
  width: min(360px, 100%); margin: 0 auto; padding: 24px 16px;
}
.acceso h1 { font-size: 22px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.error { display: flex; align-items: center; gap: 6px; color: var(--error); font-weight: 700; }

.vacio { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; color: var(--mudo); font-weight: 700; }

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

[hidden] { display: none !important; }

/* El movimiento firma solo cuando la línea cambia de estación. */
.estaciones.cambia::after { animation: via 600ms var(--ease-out) both; }
.estaciones.cambia .estacion[data-estado="actual"] i { animation: late 900ms var(--ease-out) 300ms 1 both; }
/* El amarillo y su anillo solo sobre tinta, donde contrastan. */
.placa :focus-visible, .visor :focus-visible { outline-color: var(--senal); }

/* Variante vertical: la línea baja por la izquierda. */
.estaciones.vertical { grid-template-columns: 1fr; gap: 22px; padding: 4px 0; }
.estaciones.vertical::before, .estaciones.vertical::after { top: 14px; left: 8px; width: 4px; height: auto; }
.estaciones.vertical::before { right: auto; bottom: 14px; }
.estaciones.vertical::after { height: calc((100% - 28px) * var(--avance)); transform-origin: top; }
.estaciones.vertical .estacion { flex-direction: row; align-items: center; gap: 12px; }
.estaciones.vertical .estacion span { font-size: 14px; }
.estaciones.vertical .estacion time { margin-left: auto; }
.estaciones.vertical.cambia::after { animation-name: via-v; }
@keyframes via-v { from { transform: scaleY(0); } }

/* Menú de cuenta */
.perfil-cuenta { position: relative; }
.perfil-cuenta summary { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid white; border-radius: 50%; cursor: pointer; font-weight: 800; list-style: none; }
.perfil-cuenta summary::-webkit-details-marker { display: none; }
.perfil-menu { position: absolute; z-index: 20; top: 48px; right: 0; min-width: 210px; display: grid; gap: 6px; padding: 14px; background: var(--papel); color: var(--tinta); border: 1px solid var(--filete); border-radius: 12px; box-shadow: 0 6px 18px #0003; }
.perfil-menu small { color: var(--mudo); }
.perfil-menu button { text-align: left; background: transparent; border: 0; padding: 10px 4px; color: var(--tinta); cursor: pointer; font: inherit; }
.perfil-dialogo { margin: auto; width: min(400px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: 16px; color: var(--tinta); }
.perfil-dialogo::backdrop { background: #0009; }
.perfil-dialogo form, .perfil-dialogo label { display: grid; gap: 10px; }
.perfil-dialogo form { gap: 16px; }
.perfil-dialogo input, .acceso input { width: 100%; padding: 12px; border: 1px solid var(--via); border-radius: 10px; font: inherit; }
