/* ───────── XIKTLA · ejemplo Web: un mismo sitio, tres pantallas ─────────
   Dos mundos en este archivo:
   1. La mesa de trabajo (.ej-web-*): botones, regla, pista y tirador. Medidas en rem.
   2. El sitio de muestra (.ej-web-s-*): HTML y CSS reales, medidos en px "lógicos".
      Se dibuja a su ancho verdadero (320–1280 px) y se reduce con transform: scale();
      se reacomoda solo con container queries, sin que JavaScript toque su diseño.   */

.ej-web {
  display: flex; flex-direction: column;
  min-width: 0;
}

/* ── Formatos ── */
.ej-web-barra { display: flex; }
.ej-web-formato {
  flex: 0 1 auto; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 2.75rem; padding: 0 1.1rem;
  background: transparent; color: var(--marfil);
  border: 1px solid rgba(249, 246, 238, .34);
  font: 500 .9375rem/1 var(--inter);
  cursor: pointer;
}
.ej-web-formato + .ej-web-formato { margin-left: -1px; }
.ej-web-formato svg { flex: none; width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.ej-web-formato:hover { border-color: var(--agave); color: var(--agave); position: relative; z-index: 1; }
.ej-web-formato[aria-pressed="true"] {
  background: var(--agave); border-color: var(--agave); color: var(--obsidiana);
  font-weight: 600; position: relative; z-index: 1;
}
.ej-web-formato:focus-visible { position: relative; z-index: 2; }

/* ── Regla: el ancho, medido ── */
.ej-web-regla {
  position: relative;
  height: 2.6rem; margin-top: .9rem;
  border-bottom: 1px solid rgba(249, 246, 238, .34);
}
.ej-web-raya {
  position: absolute; bottom: 0; left: 0;
  width: 1px; height: .35rem;
  background: rgba(249, 246, 238, .5);
}
.ej-web-raya.es-mayor { height: .7rem; background: var(--marfil); }
.ej-web-num {
  position: absolute; bottom: .85rem; left: 0;
  translate: -50% 0;
  font-size: .75rem; line-height: 1; font-variant-numeric: tabular-nums;
  color: rgba(249, 246, 238, .78);
  transition: opacity .15s;
}
.ej-web-num.es-tapado { opacity: 0; }
.ej-web-cursor {            /* la etiqueta que viaja con el tirador */
  position: absolute; bottom: 0; left: 0;
  padding: .3rem .5rem .32rem;
  background: var(--agave); color: var(--obsidiana);
  font: 600 .8125rem/1 var(--sora); font-variant-numeric: tabular-nums; white-space: nowrap;
  will-change: transform;
}

/* ── Pista: donde vive el marco ── */
.ej-web-pista {
  position: relative;
  height: clamp(17rem, 46vh, 24rem);
  margin-top: .75rem;
  background: radial-gradient(circle, rgba(198, 229, 106, .34) 0 .75px, transparent 1.25px) 0 0 / 1.25rem 1.25rem;
}
.ej-web-guia {              /* aquí cambia el formato */
  position: absolute; top: -.75rem; bottom: 0; left: 0;
  border-left: 1px dashed rgba(198, 229, 106, .55);
}
.ej-web-guia span {
  position: absolute; left: .4rem; bottom: .15rem;
  font-size: .75rem; line-height: 1.2; white-space: nowrap;
  color: var(--agave);
  background: var(--obsidiana); padding: .1rem .25rem;
}
.ej-web-marco {
  position: absolute; left: 0; top: 0; z-index: 1;
  overflow: hidden;
  background: var(--marfil);
  box-shadow: 0 0 0 1px rgba(249, 246, 238, .55);
  will-change: width, height;
}

/* ── Tirador ── */
.ej-web-tirador {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 2.75rem; min-height: 2.75rem;
  margin-left: -.5rem;                    /* el filo cae justo sobre el borde del marco */
  touch-action: pan-y;                    /* arrastre horizontal para el tirador; el vertical sigue siendo de la página */
  cursor: ew-resize;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.ej-web-tirador::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: .5rem;
  width: 3px; background: var(--agave);
}
.ej-web-asa {
  position: absolute; left: .5rem; top: 50%; translate: 0 -50%;
  width: 1.5rem; height: 3.5rem;
  display: grid; place-items: center;
  background: var(--agave); color: var(--obsidiana);
}
.ej-web-asa svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; }
.ej-web-tirador:hover .ej-web-asa, .ej-web-tirador.es-arrastre .ej-web-asa { background: var(--marfil); }
.ej-web-tirador:hover::before, .ej-web-tirador.es-arrastre::before { background: var(--marfil); }
.ej-web-tirador:focus-visible { outline-offset: 2px; }
.ej-web.es-arrastre { cursor: ew-resize; }

@keyframes ej-web-invita {
  0%, 100% { translate: 0 -50%; }
  30% { translate: .45rem -50%; }
  60% { translate: -.2rem -50%; }
}
.ej-web-tirador.es-invita .ej-web-asa { animation: ej-web-invita 1.1s ease-in-out 2; }

/* ── Qué cambió ── */
.ej-web-datos {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0 0;
  border-top: 1px solid rgba(249, 246, 238, .2);
}
.ej-web-datos div { padding: .7rem .75rem 0 0; min-width: 0; }
.ej-web-datos div + div { padding-left: .75rem; border-left: 1px solid rgba(249, 246, 238, .2); }
.ej-web-datos dt { font-size: .8125rem; line-height: 1.3; color: rgba(249, 246, 238, .78); }
.ej-web-datos dd {
  margin: .1rem 0 0;
  font: 600 1.0625rem/1.3 var(--sora); font-variant-numeric: tabular-nums;
}
@keyframes ej-web-cambio { from { color: var(--agave); } to { color: var(--marfil); } }
.ej-web-datos dd.es-cambio { animation: ej-web-cambio 1.2s ease-out; }

.ej-web-vivo {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 640px) {
  .ej-web-formato { flex: 1 1 0; padding: 0 .4rem; gap: .4rem; font-size: .875rem; }
  .ej-web-pista { height: 19rem; }
  .ej-web-guia span { display: none; }
  .ej-web-datos dd { font-size: .9375rem; }
}

/* ═════════ El sitio de muestra ═════════ */
.ej-web-sitio {
  container: ej-web-sitio / inline-size;
  position: relative;
  transform-origin: 0 0;
  background: var(--marfil); color: var(--xiktla);
  font: 400 16px/1.5 var(--inter);
  pointer-events: none;
  -webkit-user-select: none; user-select: none;
}

.ej-web-s-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--piedra);
}
.ej-web-s-marca { display: flex; align-items: center; gap: 10px; font: 600 18px/1 var(--sora); white-space: nowrap; }
.ej-web-s-marca i { width: 14px; height: 14px; background: var(--agave-tinta); rotate: 45deg; }
.ej-web-s-enlaces { display: none; gap: 28px; font-size: 15px; }
.ej-web-s-llamado { display: none; padding: 10px 18px; background: var(--xiktla); color: var(--marfil); font-weight: 600; font-size: 15px; }
.ej-web-s-menu { display: grid; gap: 5px; width: 26px; }
.ej-web-s-menu i { height: 2px; background: var(--xiktla); }

.ej-web-s-portada { display: grid; gap: 24px; padding: 28px 20px 8px; }
.ej-web-s-titular {
  font: 600 clamp(32px, 8.4cqi, 68px)/1.02 var(--sora);
  letter-spacing: -.035em;
  max-width: 11ch;
}
.ej-web-s-lineas { display: grid; gap: 9px; margin-top: 20px; max-width: 420px; }
.ej-web-s-lineas i { height: 9px; background: var(--piedra); }
.ej-web-s-lineas i:nth-child(2) { width: 88%; }
.ej-web-s-lineas i:nth-child(3) { width: 54%; }
.ej-web-s-boton {
  display: inline-block; margin-top: 24px; padding: 13px 22px;
  background: var(--xiktla); color: var(--marfil); font-weight: 600; font-size: 15px;
}
.ej-web-s-imagen {
  position: relative; min-height: 150px;
  background: var(--xiktla) url("../assets/patron-circuito.svg") center / 210px 120px;
  background-blend-mode: normal;
}
.ej-web-s-imagen::before { content: ""; position: absolute; inset: 0; background: rgba(14, 59, 50, .82); }
.ej-web-s-imagen::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; translate: -50% -50%; rotate: 45deg;
  background: var(--agave);
  box-shadow: 0 0 0 10px var(--xiktla), 0 0 0 12px var(--agave);
}
.ej-web-s-imagen span {
  position: absolute; left: 12px; bottom: 10px; z-index: 1;
  font-size: 13px; color: var(--marfil);
}

.ej-web-s-bloques { display: grid; gap: 20px; padding: 20px 20px 28px; }
.ej-web-s-bloque b { display: block; margin-top: 12px; font: 600 18px/1.2 var(--sora); }
.ej-web-s-bloque .ej-web-s-lineas { margin-top: 10px; gap: 7px; max-width: none; }
.ej-web-s-bloque .ej-web-s-lineas i { height: 7px; }
.ej-web-s-tinta { height: 96px; background: var(--cantera); border-top: 4px solid var(--xiktla); }
.ej-web-s-bloque:nth-child(2) .ej-web-s-tinta { background: var(--agave); }
.ej-web-s-bloque:nth-child(3) .ej-web-s-tinta { background: var(--piedra); }

/* Tableta: el menú se despliega, la portada y los bloques van a dos columnas */
@container ej-web-sitio (min-width: 600px) {
  .ej-web-s-nav { padding: 18px 32px; }
  .ej-web-s-menu { display: none; }
  .ej-web-s-enlaces { display: flex; }
  .ej-web-s-portada { grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: stretch; padding: 40px 32px 12px; }
  .ej-web-s-titular { font-size: clamp(40px, 6.2cqi, 68px); }
  .ej-web-s-imagen { min-height: 220px; }
  .ej-web-s-bloques { grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 32px 36px; }
  .ej-web-s-bloque:nth-child(3) { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; }
  .ej-web-s-bloque:nth-child(3) b { margin-top: 0; }
  .ej-web-s-tinta { height: 120px; }
}

/* Escritorio: menú completo con llamado, tres columnas */
@container ej-web-sitio (min-width: 1000px) {
  .ej-web-s-nav { padding: 22px 48px; }
  .ej-web-s-llamado { display: block; }
  .ej-web-s-enlaces { margin-left: auto; gap: 36px; }
  .ej-web-s-portada { grid-template-columns: 1.15fr .85fr; gap: 48px; padding: 40px 48px 12px; }
  .ej-web-s-titular { font-size: clamp(56px, 5.4cqi, 72px); }
  .ej-web-s-imagen { min-height: 216px; }
  .ej-web-s-bloques { grid-template-columns: repeat(3, 1fr); gap: 32px; padding: 28px 48px 40px; }
  .ej-web-s-bloque:nth-child(3) { grid-column: auto; display: block; }
  .ej-web-s-bloque:nth-child(3) b { margin-top: 12px; }
  .ej-web-s-tinta { height: 108px; }
}

@media (prefers-reduced-motion: reduce) {
  .ej-web-tirador.es-invita .ej-web-asa, .ej-web-datos dd.es-cambio { animation: none; }
}
