/* «El Telar» — capa de arte (tokens, tipografía, layout, lienzo) y pieles de
   las primitivas Base UI. Los widgets son de la librería; la ropa es nuestra. */

/* Fallbacks con métricas compensadas: mientras Solway/Alegreya descargan, el
   serif local se estira/encoge a sus medidas (medidas reales contra Times) y
   el intercambio de fuente no mueve el layout. */
@font-face {
  font-family: "Solway-fb";
  src: local("Times New Roman"), local("Liberation Serif"), local("Georgia");
  size-adjust: 119.8%;
  ascent-override: 79.3%;
  descent-override: 20.9%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Alegreya-fb";
  src: local("Times New Roman"), local("Liberation Serif"), local("Georgia");
  size-adjust: 98.1%;
  ascent-override: 104%;
  descent-override: 35.7%;
  line-gap-override: 0%;
}

:root {
  /* Grano de tela (técnica t3code): feTurbulence inline a opacidad baja,
     aplicado POR SUPERFICIE sobre su background-color — nunca capa global. */
  --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  --indigo: oklch(0.26 0.055 265);
  --indigo-deep: oklch(0.21 0.05 265);
  --thread: oklch(0.9 0.025 85);
  --thread-dim: oklch(0.78 0.04 85);
  --madder: oklch(0.58 0.16 28);
  --mustard: oklch(0.78 0.12 85);
  --seam: oklch(0.36 0.05 265);
  --step: clamp(4rem, 10vh, 8rem);
}
* {
  margin: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background-color: var(--indigo);
  background-image: var(--grain);
  color: var(--thread);
  font-family: "Alegreya", "Alegreya-fb", serif;
  font-size: 1.1rem;
  line-height: 1.68;
}
.frame {
  max-width: 66rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

/* ——— view transition: cross-fade sobrio del cambio de idioma ——— */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ——— toggle de idioma (Base UI ToggleGroup) ——— */
.lang {
  position: fixed;
  top: 1.1rem;
  right: 1.25rem;
  z-index: 10;
  font-family: "Solway", "Solway-fb", serif;
  font-size: 0.8rem;
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}
.lang .gh {
  /* misma chapa que el selector: fondo sólido para flotar sobre el lienzo */
  display: inline-flex;
  align-items: center;
  background: var(--indigo);
  border: 1px solid var(--thread-dim);
  color: var(--thread-dim);
  padding-inline: 0.5rem;
}
.lang .gh:hover,
.lang .gh:focus-visible {
  color: var(--mustard);
  border-color: var(--mustard);
}
.lang .gh:focus-visible {
  outline: 2px solid var(--mustard);
  outline-offset: 2px;
}
.lang-toggle {
  /* fondo sólido: el selector flota sobre el lienzo del hero y sin él la
     red se transparenta detrás del botón inactivo */
  background: var(--indigo);
  border: 1px solid var(--thread-dim);
  color: var(--thread-dim);
  font: inherit;
  padding: 0.22rem 0.65rem;
  cursor: pointer;
}
.lang-toggle[data-pressed] {
  color: var(--indigo-deep);
  background: var(--mustard);
  border-color: var(--mustard);
}
.lang-toggle + .lang-toggle {
  border-left: 0;
}
.lang-toggle:focus-visible {
  outline: 2px solid var(--mustard);
  outline-offset: 2px;
}

/* ——— hero ——— */
header {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
}
.selvage {
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    var(--madder) 0 14px,
    var(--mustard) 14px 28px,
    transparent 28px 42px
  );
}
.loom {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.loom canvas {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.headline {
  position: relative;
  text-align: center;
  padding: clamp(2rem, 6vh, 4rem) 1rem;
}
h1 {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 800;
  font-size: clamp(2.2rem, 5.8vw, 4.6rem);
  line-height: 1.08;
  text-wrap: balance;
  max-width: 18ch;
  margin-inline: auto;
  text-shadow: 0 2px 30px var(--indigo-deep);
}
h1 .hilo {
  color: var(--mustard);
}
.headline .hero-explain {
  margin-top: 1.4rem;
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  color: var(--thread);
  max-width: 52ch;
  margin-inline: auto;
  text-wrap: pretty;
}
.headline .hero-sub {
  margin-top: 1rem;
  font-size: clamp(0.98rem, 1.5vw, 1.12rem);
  font-style: italic;
  color: var(--thread-dim);
  max-width: 48ch;
  margin-inline: auto;
  text-wrap: pretty;
}

/* ——— scroll hint: la lanzadera desciende por un hilo ——— */
.hint {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  color: var(--thread-dim);
  font-family: "Solway", "Solway-fb", serif;
  font-size: 0.78rem;
  transition: opacity 0.5s;
  pointer-events: none;
  z-index: 5;
}
.hint.gone {
  opacity: 0;
}
.hint svg {
  display: block;
}
.hint .shuttle {
  animation: descend 2.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
@keyframes descend {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translateY(26px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hint .shuttle {
    animation: none;
    transform: translateY(10px);
  }
}

section {
  padding-block: var(--step);
}
h2 {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 3.6vw, 2.7rem);
  text-wrap: balance;
}
.sub {
  font-style: italic;
  color: var(--thread-dim);
  margin-top: 0.4rem;
}

/* ——— minador ——— */
.miner {
  background-color: var(--indigo-deep);
  background-image: var(--grain);
  border-block: 1px solid var(--seam);
}
.bench {
  max-width: 44rem;
  border: 2px solid var(--thread);
}
.pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 1.5rem;
}
.pair {
  display: inline-flex;
  align-items: baseline;
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--thread-dim);
  font-size: 1.5rem;
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 500;
}
.nf {
  display: inline-flex;
}
.nf-input {
  field-sizing: content;
  min-width: 1.3ch;
  max-width: 4ch;
  background: none;
  border: 0;
  color: var(--mustard);
  font: inherit;
  font-weight: 700;
  text-align: center;
  padding: 0 0.1ch;
}
.nf-input:focus-visible {
  outline: none;
  background: oklch(0.32 0.05 265);
}
.pair-del {
  background: none;
  border: 0;
  color: var(--thread-dim);
  cursor: pointer;
  font: inherit;
  font-size: 0.85em;
  padding: 0 0 0 0.5rem;
  align-self: center;
}
.pair-del:hover {
  color: var(--madder);
}
.pair-add {
  color: var(--thread-dim);
  border: 1.5px dashed var(--thread-dim);
  cursor: pointer;
  background: none;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 400;
  padding-inline: 1.1rem;
}
.run {
  display: block;
  width: 100%;
  padding: 0.95rem;
  background: var(--madder);
  color: var(--thread);
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 700;
  font-size: 1.08rem;
  border: 0;
  cursor: pointer;
}
.run:disabled {
  opacity: 0.6;
  cursor: wait;
}
.out {
  padding: 1.25rem 1.4rem;
  border-top: 2px solid var(--thread);
  min-height: 5.5rem;
}
.out code {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.out .meta {
  margin-top: 0.55rem;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--thread-dim);
}
.out .fail {
  color: oklch(0.75 0.12 28);
}
.out .verify {
  margin-top: 0.55rem;
  font-size: 0.95rem;
}
.out .verify b {
  color: var(--mustard);
  font-weight: 500;
}

/* ——— carrera ——— */
.race h2 {
  max-width: 22ch;
}
.race .lead {
  margin-top: 1.2rem;
  max-width: 62ch;
}
.controls {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 6.5ch minmax(10rem, 20rem) auto;
  align-items: center;
  column-gap: 1.4rem;
  row-gap: 0.35rem;
  font-family: "Solway", "Solway-fb", serif;
}
.nval {
  font-weight: 800;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.slider {
  width: min(18rem, 55vw);
}
.slider-control {
  display: flex;
  align-items: center;
  height: 1.5rem;
  cursor: pointer;
}
.slider-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: var(--seam);
}
.slider-indicator {
  position: absolute;
  inset-block: 0;
  background: var(--mustard);
}
.slider-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  translate: 0 -1px;
  rotate: 45deg;
  background: var(--mustard);
}
.slider-thumb:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 3px;
}
.gobtn {
  background: var(--thread);
  color: var(--indigo-deep);
  border: 0;
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 1.3rem;
  cursor: pointer;
}
.gobtn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.cloths {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 56rem;
}
.cloth {
  border: 1px solid var(--seam);
  padding: 1.3rem 1.4rem;
  display: grid;
  grid-template-rows: auto 2.9rem auto;
  align-content: start;
}
.cloth .slot {
  display: flex;
  align-items: center;
  min-height: 2.9rem;
}
.cloth .n {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 800;
  font-size: 2rem;
  display: block;
  font-variant-numeric: tabular-nums;
}
.cloth.naive .n {
  color: var(--madder);
}
.cloth.ic .n {
  color: var(--mustard);
}
.cloth .lbl {
  display: block;
  font-style: italic;
  color: var(--thread-dim);
  font-size: 0.95rem;
}
.cloth .n small {
  font-family: "Alegreya", "Alegreya-fb", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 0.55em;
  color: var(--thread-dim);
}
.cloth .note {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  font-style: italic;
  color: var(--thread-dim);
}
.weaving {
  height: 4px;
  width: 100%;
  max-width: 14rem;
  background: repeating-linear-gradient(
    90deg,
    var(--madder) 0 12px,
    transparent 12px 24px
  );
  animation: weave-slide 0.7s linear infinite;
}
@keyframes weave-slide {
  to {
    background-position: 24px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .weaving {
    animation: none;
  }
}

/* ——— honestidad ——— */
.honesty .frame {
  max-width: 46rem;
}
.tag {
  border: 1px dashed var(--thread-dim);
  padding: 1.8rem 2rem;
}
.honesty h2 {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
}
.honesty ul {
  list-style: none;
  padding: 0;
  margin-top: 1.2rem;
}
.honesty li {
  padding-block: 0.7rem;
}
.honesty li + li {
  border-top: 1px solid var(--seam);
}
.honesty li b {
  font-weight: 700;
  color: var(--mustard);
}

footer {
  border-top: 1px solid var(--seam);
  font-size: 0.9rem;
  padding-block: 2rem;
  color: var(--thread-dim);
}
footer .frame {
  display: grid;
  gap: 0.4rem;
}
footer a {
  color: var(--thread);
  text-decoration-color: var(--thread-dim);
  text-underline-offset: 0.15em;
}
footer a:hover,
footer a:focus-visible {
  color: var(--mustard);
  text-decoration-color: var(--mustard);
}

/* ═══ Estados de interacción: sistemáticos, no opcionales ═══ */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}
:focus-visible {
  outline: 2px solid var(--mustard);
  outline-offset: 2px;
}
button,
a,
.slider-thumb {
  transition:
    background-color 0.18s var(--ease-out),
    color 0.18s var(--ease-out),
    border-color 0.18s var(--ease-out),
    transform 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out);
}
@media (hover: hover) {
  .run:hover:not(:disabled) {
    background: oklch(0.64 0.17 28);
  }
  .gobtn:hover:not(:disabled) {
    background: var(--mustard);
  }
  .pair-add:hover {
    color: var(--thread);
    border-color: var(--thread);
  }
  .lang-toggle:hover:not([data-pressed]) {
    color: var(--thread);
    border-color: var(--thread);
  }
  .slider-thumb:hover {
    box-shadow: 0 0 0 6px oklch(0.78 0.12 85 / 0.25);
  }
}
.run:active:not(:disabled),
.gobtn:active:not(:disabled),
.pair-add:active {
  transform: translateY(1px);
}
.pair-del {
  min-width: 2.2rem;
  min-height: 2.2rem;
  font-size: 0.6em;
  display: inline-grid;
  place-items: center;
  padding-left: 0.35rem;
}
.slider-thumb:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 4px;
}

/* ═══ Capas de la presentación ═══ */

.intro {
  margin-top: 1.4rem;
  max-width: 62ch;
  text-wrap: pretty;
}
.found-head {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 500;
}
.recipe {
  margin-top: 0.8rem;
  padding: 1rem 1.2rem;
  background-color: var(--indigo);
  background-image: var(--grain);
  border-left: 3px solid var(--mustard);
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 400;
  font-size: 1.02rem;
  line-height: 1.7;
  overflow-x: auto;
}
.out .raw {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--seam);
  font-size: 0.88rem;
  color: var(--thread-dim);
}
.out .raw code {
  font-size: 0.95rem;
  color: var(--thread);
  font-weight: 400;
}
.out .raw .raw-legend {
  display: block;
  margin-top: 0.25rem;
  font-style: italic;
}
.race-note {
  margin-top: 0.7rem;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--thread-dim);
  max-width: 62ch;
}

/* ——— regular e irregular + GPU: la primera hundida, la segunda al aire,
   para que dos paneles seguidos no se fundan en uno ——— */
.par {
  background-color: var(--indigo-deep);
  background-image: var(--grain);
  border-block: 1px solid var(--seam);
}
#gpu {
  background: none;
  border-block: 0;
}
#gpu .par-stage {
  background-color: var(--indigo-deep);
}
.par h2 {
  max-width: 24ch;
}
.par-steps {
  margin-top: 1.8rem;
  display: inline-flex;
}
.par-step {
  background: none;
  border: 1px solid var(--seam);
  color: var(--thread-dim);
  font-family: "Solway", "Solway-fb", serif;
  font-size: 0.9rem;
  padding: 0.42rem 1rem;
  cursor: pointer;
}
.par-step + .par-step {
  border-left: 0;
}
.par-step[data-pressed] {
  color: var(--indigo-deep);
  background: var(--mustard);
  border-color: var(--mustard);
}
@media (hover: hover) {
  .par-step:hover:not([data-pressed]) {
    color: var(--thread);
  }
}
.par-stage {
  margin-top: 1.2rem;
  max-width: 50rem;
  height: clamp(300px, 42vh, 460px);
  background-color: var(--indigo);
  border: 1px solid var(--seam);
}
.par-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.par-legend {
  margin-top: 0.9rem;
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.86rem;
  color: var(--thread-dim);
}
.par-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.par-legend b {
  color: var(--thread);
  font-weight: 500;
}
.leg-swatch {
  width: 11px;
  height: 11px;
  transform: rotate(45deg);
  flex: none;
}
.leg-madder {
  background: var(--madder);
}
.leg-mustard {
  background: var(--mustard);
}
.leg-thread {
  background: var(--thread);
  opacity: 0.85;
}
.leg-sq-mustard {
  background: var(--mustard);
  transform: none;
}
.leg-sq-madder {
  background: var(--madder);
  transform: none;
}
.leg-sq-hollow {
  border: 1.4px solid var(--thread-dim);
  transform: none;
}
.leg-fade {
  background: var(--thread);
  opacity: 0.3;
}
.par-meta {
  margin-top: 0.9rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.par-pct {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 800;
  font-size: 2.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--mustard);
  min-width: 5.2ch;
}
.par-pct.low {
  color: oklch(0.68 0.17 28);
}
.par-pct-label {
  color: var(--thread-dim);
  font-size: 0.95rem;
  max-width: 34ch;
}
.par-cap {
  margin-top: 1.1rem;
  max-width: 64ch;
  line-height: 1.62;
  text-wrap: pretty;
}
.par-cap b {
  color: var(--mustard);
  font-weight: 500;
}
.npasses {
  grid-column: 1 / -1;
  min-height: 1.4em;
  font-family: "Alegreya", "Alegreya-fb", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 0.86rem;
  color: var(--thread-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 620px) {
  .controls {
    grid-template-columns: 6.5ch minmax(0, 1fr);
  }
  .controls .gobtn {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
@media (prefers-reduced-motion: reduce) {
  button,
  a,
  .slider-thumb {
    transition: none;
  }
}

/* ═══ Dos orillas: la función como hilos tejidos ═══ */

.shores {
  display: block;
  width: 100%;
  height: auto;
  padding: 1.2rem 0.6rem 0.4rem;
  touch-action: none;
  user-select: none;
}
.shores.holding {
  cursor: grabbing;
}
.shores .rail {
  fill: var(--seam);
}
.shores .slot {
  cursor: pointer;
}
.shores .slot .hit {
  fill: transparent;
}
.shores .slot text {
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 700;
  font-size: 21px;
  fill: var(--thread);
  text-anchor: middle;
  transition: fill 0.15s var(--ease-out);
}
.shores .slot .eyelet {
  fill: var(--thread-dim);
}
.shores .slot.in.used text {
  fill: var(--mustard);
}
.shores .slot.in.armed text {
  fill: var(--madder);
}
.shores .slot.in:hover text,
.shores .slot.out.ready:hover text {
  fill: var(--mustard);
}
.shores .slot.out.ready .eyelet {
  fill: var(--mustard);
}
.shores .slot.extend text {
  font-size: 17px;
  font-weight: 400;
  fill: var(--thread-dim);
}
.shores .slot.extend:hover text {
  fill: var(--thread);
}

.shores .thread {
  fill: none;
  stroke: var(--mustard);
  stroke-width: 3;
  stroke-linecap: round;
}
.shores .twist {
  fill: none;
  stroke: oklch(0.92 0.06 90 / 0.7);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 3.5 4.5;
}
.shores .woven.held .thread {
  stroke: var(--madder);
}
.shores .thread.loose {
  stroke: var(--madder);
  stroke-dasharray: 7 6;
}
.shores .thread.ghost {
  stroke: var(--thread-dim);
  stroke-width: 1.7;
  stroke-dasharray: 6 7;
  opacity: 0.6;
}
.shores .grab {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  cursor: grab;
}
.shores .shuttle {
  fill: var(--mustard);
  stroke: var(--indigo-deep);
  stroke-width: 1.2;
  cursor: grab;
}
.shores .woven.held .shuttle {
  fill: var(--madder);
  cursor: grabbing;
}

.text-editor {
  border-top: 1px solid var(--seam);
}
.text-editor summary {
  cursor: pointer;
  padding: 0.55rem 1.2rem;
  font-family: "Solway", "Solway-fb", serif;
  font-size: 0.85rem;
  color: var(--thread-dim);
  list-style: none;
}
.text-editor summary::-webkit-details-marker {
  display: none;
}
.text-editor summary:hover {
  color: var(--thread);
}
.text-editor .pairs {
  padding-top: 0.4rem;
}
.text-editor .pair {
  font-size: 1.1rem;
  padding: 0.35rem 0.6rem;
}

/* ═══ pestañas de reglas sobre el banco ═══ */
.rule-tabs {
  margin-top: 2.4rem;
  max-width: 44rem; /* mismo ancho que .bench: las pestañas viven sobre él */
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem;
  position: relative;
  z-index: 1;
  padding-inline: 0.9rem;
}
.rule-tab {
  background: none;
  border: 2px solid var(--seam);
  border-bottom: 0;
  color: var(--thread-dim);
  font-family: "Solway", "Solway-fb", serif;
  font-size: 0.92rem;
  padding: 0.42rem 1rem 0.55rem;
  cursor: pointer;
  transition: color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.rule-tab[aria-pressed="true"] {
  border-color: var(--thread);
  color: var(--mustard);
  margin-bottom: -2px;
  padding-bottom: calc(0.55rem + 2px);
  background: var(--indigo-deep);
}
@media (hover: hover) {
  .rule-tab:hover {
    color: var(--thread);
    border-color: var(--thread-dim);
  }
}
.rule-tab:focus-visible {
  outline: 2px solid var(--mustard);
  outline-offset: -2px;
}

/* ═══ el botón de cribar, vestido de tela ═══ */
.run {
  position: relative;
  overflow: hidden;
  background-color: var(--madder);
  background-image:
    var(--grain),
    repeating-linear-gradient(
    90deg,
    oklch(0.52 0.15 28) 0 2px,
    transparent 2px 10px
  );
  border-block: 2px solid oklch(0.48 0.14 28);
}
@media (hover: hover) {
  .run:hover:not(:disabled) {
    background-color: oklch(0.63 0.17 28);
  }
}
.run.sifting {
  animation: run-weave 0.8s linear infinite;
}
@keyframes run-weave {
  to {
    background-position: 0 0, 10px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .run.sifting {
    animation: none;
  }
}

/* ═══ selector de vistas del programa ═══ */
.found-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.view-toggle {
  display: inline-flex;
}
.view-tab {
  background: none;
  border: 1px solid var(--seam);
  color: var(--thread-dim);
  font-family: "Solway", "Solway-fb", serif;
  font-size: 0.78rem;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
}
.view-tab + .view-tab {
  border-left: 0;
}
.view-tab[data-pressed] {
  color: var(--indigo-deep);
  background: var(--mustard);
  border-color: var(--mustard);
}
@media (hover: hover) {
  .view-tab:hover:not([data-pressed]) {
    color: var(--thread);
  }
}

/* ═══ traza y mini-telar ═══ */
.trace-head {
  margin-top: 0.8rem;
  font-family: "Solway", "Solway-fb", serif;
  font-weight: 500;
  font-size: 0.95rem;
}
.trace .recipe {
  margin-top: 0.5rem;
}
/* ═══ la llegada del resultado ═══ */
.reveal {
  animation: rise-in 0.3s var(--ease-out) both;
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
}
/* los hilos fantasma se tejen de izquierda a derecha, escalonados */
.ghost-reveal {
  clip-path: inset(-5% 100% -5% 0);
  animation: ghost-weave 0.5s var(--ease-out) both;
}
@keyframes ghost-weave {
  to {
    clip-path: inset(-5% 0% -5% 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .ghost-reveal {
    animation-duration: 0.01s;
    animation-delay: 0s !important;
  }
}

/* ═══ De ejemplos a teoremas ═══ */

.teo .frame {
  max-width: 46rem;
}
.teo p {
  margin-top: 1.1rem;
  text-wrap: pretty;
}
.teo .intro {
  margin-top: 1.4rem;
}
.teo-try {
  margin-top: 0.8rem;
}
.teo-load {
  color: var(--thread-dim);
  border: 1.5px dashed var(--thread-dim);
  cursor: pointer;
  background: none;
  font: inherit;
  font-size: 1rem;
  padding: 0.35rem 1.1rem;
}
.teo-load:hover,
.teo-load:focus-visible {
  color: var(--mustard);
  border-color: var(--mustard);
}
.teo-ladder {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}
.teo-ladder li {
  padding-block: 0.7rem;
}
.teo-ladder li + li {
  border-top: 1px solid var(--seam);
}
.teo-ladder b {
  font-weight: 700;
  color: var(--mustard);
  font-family: "Solway", "Solway-fb", serif;
}
.teo-decl {
  color: var(--thread-dim);
  font-style: italic;
  font-size: 0.95rem;
}
.teo-duel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.4rem;
}
.teo-duel > div {
  border: 1px solid var(--seam);
  padding: 1.1rem 1.3rem;
}
.teo-duel .llm {
  border-left: 3px solid var(--madder);
}
.teo-duel .spec {
  border-left: 3px solid var(--mustard);
}
.teo-duel h3 {
  font-family: "Solway", "Solway-fb", serif;
  font-size: 1.02rem;
}
.teo-duel p {
  margin-top: 0.4rem;
  font-size: 0.98rem;
}
@media (max-width: 40rem) {
  .teo-duel {
    grid-template-columns: 1fr;
  }
}
