/* Switch de ClearPath (ver rbln-fuel/references/proposals/CLEARPATH-SWITCH.md): bloque pegado + espaciador de 100vh.
   data-state = start | off | on lo pone scripts/switch.js según la posición de las zonas. */
.s-switch {
  /* Resorte sin rebote de Framer: 0,8 s hacia On, 1,2 s hacia Off. Muestreo de 1 - (1 + 9,23 t) e^(-9,23 t). */
  --spring: linear(0, .079 5%, .236 10%, .403 15%, .551 20%, .671 25%, .764 30%, .833 35%, .883 40%, .944 50%, .974 60%, .988 70%, .995 80%, 1);
  position: relative;
}

/* 256 = 4 × 64 (ClearPath: 244). Sin eventos de puntero para no tapar lo que pasa debajo, salvo el interruptor. */
.s-switch__block { position: sticky; top: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s32); padding: calc(4 * var(--s64)) var(--page-pad) 0; text-align: center; pointer-events: none; }

/* Interruptor: entra con fundido de .8 s al aparecer en pantalla y se reinicia al salir (is-in). */
.s-switch__toggle { display: inline-flex; align-items: center; gap: var(--s16); color: var(--ink-on-dark); text-decoration: none; pointer-events: auto; opacity: 0; transition: translate 1.2s var(--spring); }
.s-switch__toggle.is-in { opacity: 1; transition: opacity .8s var(--ease), translate 1.2s var(--spring); }
.s-switch__toggle:focus-visible { outline-color: var(--ink-on-dark); outline-offset: 4px; border-radius: var(--r-control); }
.s-switch[data-state="on"] .s-switch__toggle:focus-visible { outline-color: var(--ink); }

/* Rótulo en Geist Regular, no en Mono (Juanma, 20/10: "probá ponerlo con Geist normal"). */
.s-switch__label { font: 500 var(--body-sm)/1 var(--font-body); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; transition: color 1.2s var(--spring), opacity 1.2s var(--spring), translate 1.2s var(--spring); }
.s-switch__track { position: relative; flex: none; width: 56px; height: 32px; }
/* Negro 20 % de ClearPath; sobre esta foto oscura no se distingue, así que lleva además la hairline del DS. */
.s-switch__track::before { content: ""; position: absolute; inset: 0; border: 1px solid var(--line); border-radius: var(--r-pill); background: color-mix(in srgb, var(--ink) 20%, transparent); transition: transform 1.2s var(--spring), background-color 1.2s var(--spring), border-color 1.2s var(--spring); }
.s-switch__knob { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: var(--r-pill); background: var(--paper); transition: transform 1.2s var(--spring); }

/* Start: la pista es un punto de 2 × 2 px, la perilla en el centro y la etiqueta oculta, corrida hacia el centro.
   La fila se corre para que el punto (centro de la pista, a 28 px del borde derecho de la fila) caiga en el centro
   de la página; al armarse vuelve a centrarse entera. Con foco de teclado se muestra armado, para que se vea qué
   control tiene el foco. */
.s-switch[data-state="start"] .s-switch__toggle:not(:focus-visible) { translate: calc(28px - 50%) 0; }
.s-switch[data-state="start"] .s-switch__toggle:not(:focus-visible) .s-switch__label { opacity: 0; translate: 36px 0; }
.s-switch[data-state="start"] .s-switch__toggle:not(:focus-visible) .s-switch__track::before { transform: scale(calc(2 / 56), calc(2 / 32)); }
.s-switch[data-state="start"] .s-switch__toggle:not(:focus-visible) .s-switch__knob { transform: translateX(12px); }
/* On: perilla 24 px a la derecha, pista rosa, etiqueta en gris apoyo. */
.s-switch[data-state="on"] .s-switch__label { color: var(--muted); transition-duration: .8s; }
.s-switch[data-state="on"] .s-switch__track::before { background-color: var(--rose); border-color: var(--rose); transition-duration: .8s; }
.s-switch[data-state="on"] .s-switch__knob { transform: translateX(24px); transition-duration: .8s; }

/* Textos superpuestos: Off en absoluto sobre On en flujo. */
.s-switch__texts { position: relative; width: 100%; }
.s-switch__off, .s-switch__on { display: flex; flex-direction: column; align-items: center; gap: var(--s32); }
.s-switch__off { position: absolute; top: 0; left: 0; right: 0; color: var(--ink-on-dark); }
.s-switch__on { color: var(--ink); }
.s-switch__title { max-width: 872px; margin: 0; font: 700 var(--h1)/var(--h1-leading) var(--font-heading); letter-spacing: -.02em; text-wrap: balance; }
.s-switch__para { max-width: 440px; margin: 0; text-wrap: pretty; }
.s-switch__clause, .s-switch__on .s-switch__para { color: var(--muted); }

/* Fundido cruzado: el saliente se apaga en .3 s; el entrante espera .4 s y entra en .6 s (titular) y .8 s (párrafo). */
.s-switch__title, .s-switch__para { transition: opacity .3s var(--ease); }
.s-switch[data-state="on"] .s-switch__off > *, .s-switch:not([data-state="on"]) .s-switch__on > * { opacity: 0; }
.s-switch:not([data-state="on"]) .s-switch__off > *, .s-switch[data-state="on"] .s-switch__on > * { transition: opacity .6s var(--ease) .4s; }
.s-switch:not([data-state="on"]) .s-switch__off > .s-switch__para, .s-switch[data-state="on"] .s-switch__on > .s-switch__para { transition-duration: .8s; }

/* Espaciador de 100vh y zonas observadas en la línea media de la pantalla (scripts/switch.js).
   pre: todo lo de arriba de la fila del interruptor · off: de la fila al 50 % del espaciador · on: del 50 % al final. */
.s-switch__spacer { height: 100vh; }
.s-switch__zone, .s-switch__anchor { position: absolute; left: 0; width: 8px; pointer-events: none; }
.s-switch__zone--pre { bottom: calc(100% - 4 * var(--s64)); height: 400vh; }
.s-switch__zone--off { top: calc(4 * var(--s64)); bottom: 50vh; }
.s-switch__zone--on { bottom: 0; height: 50vh; }
/* Destino del clic en Off: 34 % del espaciador (ClearPath). */
.s-switch__anchor { top: calc(100% - 66vh); height: 8px; }

@media (max-width: 1199px) {
  .s-switch__block { padding-top: calc(2 * var(--s64)); padding-bottom: var(--s48); }
  .s-switch__toggle { min-height: 44px; }
  .s-switch__zone--pre { bottom: calc(100% - 2 * var(--s64)); }
  .s-switch__zone--off { top: calc(2 * var(--s64)); }
}
@media (max-width: 809px) {
  .s-switch__block { gap: var(--s24); }
  .s-switch__off, .s-switch__on { gap: var(--s24); }
  .s-switch__title { font-size: var(--h1); }
}

@media (max-width: 1199px) and (prefers-reduced-motion: reduce) {
  /* Sin transición de estados no hace falta recorrer una pantalla vacía. */
  .s-switch__block { position: relative; padding-block: var(--s48); }
  .s-switch__spacer { height: 0; }
  .s-switch__zone, .s-switch__anchor { display: none; }
}
