/* Infinity explorer: the scene buttons, the readout, and the four scenes (the hotel's rooms, the pairs, the grid of fractions
   and the list of decimals). Builds on the shared .explorer, .btn and .cx styles in styles.css. Nothing scrolls sideways:
   rooms, pairs and buttons wrap, and the grid and the list of decimals scale with the width of their box (cqi), so even at
   a large text size the page stays as wide as the window. */
.infinity-explorer { min-width: 0; }
.infinity-explorer [hidden] { display: none !important; }

.ie-scenes, .ie-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ie-scenes { margin-bottom: 0.8rem; }
.ie-scene { flex: 1 1 auto; min-height: 44px; }
.ie-scene[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.ie-controls { display: flex; flex-direction: column; gap: 0.6rem; }
.ie-controls-host { margin-bottom: 0.8rem; }
.ie-add[aria-disabled="true"] { opacity: 0.55; }

/* The readout is the live region: it is also what the student reads. */
.ie-readout { margin: 0; min-height: 3em; padding: 0.55rem 0.75rem; border-radius: 10px; background: var(--accent-soft); font-weight: 500; overflow-wrap: anywhere; }
.ie-stage-host { margin-top: 0.8rem; }
.ie-stage { position: relative; min-width: 0; }
.ie-legend { margin: 0 0 0.6rem; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }

/* Sentences for screen readers sit beside what they describe and cannot be seen. */
.ie-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Hilbert's Hotel: a window of the first rooms, with "…" for the rest. A guest is told apart by the letter in the name and by the
   border (solid original, dashed newcomer, double bus), so colour is never the only cue. */
.ie-sign { display: inline-block; max-width: 100%; margin: 0 0 0.6rem; padding: 0.25rem 0.7rem; border: 2px solid var(--bad); border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; }
.ie-rooms { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 3.4rem), 1fr)); gap: 0.4rem; }
.ie-room { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.3rem 0.25rem; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); }
.ie-room-tag { font-size: 0.7rem; font-weight: 600; color: var(--muted); max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.ie-guest { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ie-guest--original { border-color: var(--line); background: var(--accent-soft); }
.ie-guest--newcomer { border-style: dashed; border-color: var(--user-line); background: var(--warn-soft); }
.ie-guest--bus { border-style: double; border-width: 4px; border-color: var(--good); background: var(--good-soft); padding: 0.15rem 0.1rem; }
.ie-room--more { border: 0; background: transparent; justify-content: center; font-size: 1.5rem; color: var(--muted); }

/* Count by pairing: each pair is a column with the natural number on top, a line, and its partner below. */
.ie-pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 0.4rem; }
.ie-pair { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 2.6rem; padding: 0.2rem 0.25rem; border: 2px solid transparent; border-radius: 10px; font-variant-numeric: tabular-nums; }
.ie-pair-top, .ie-pair-bottom { min-width: 2.2rem; padding: 0.15rem 0.4rem; border-radius: 6px; text-align: center; font-weight: 700; }
.ie-pair-top { background: var(--accent-soft); }
.ie-pair-bottom { background: var(--good-soft); }
.ie-pair-link { width: 0; height: 1.1rem; border-left: 3px solid var(--text); }
.ie-pair--new { border-color: var(--text); }
.ie-pair--more { color: var(--muted); }

/* The fractions: a grid in a picture, so the path can be drawn through it. */
.ie-grid-wrap { max-width: 420px; border-radius: 10px; }
.ie-axis { fill: var(--muted); font-size: 13px; font-weight: 600; }
.ie-dots { fill: var(--muted); font-size: 18px; font-weight: 700; }
.ie-cell { stroke-width: 1.5; }
.ie-cell--open { fill: var(--surface); stroke: var(--border); }
.ie-cell--counted { fill: var(--accent-soft); stroke: var(--accent); }
.ie-cell--skipped { fill: var(--surface-2); stroke: var(--muted); stroke-dasharray: 4 3; }
.ie-cell--now { stroke: var(--text); stroke-width: 4; stroke-dasharray: none; }
.ie-frac { fill: var(--text); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.ie-frac--open { fill: var(--muted); font-weight: 500; }
.ie-frac--skipped { fill: var(--muted); text-decoration: line-through; }
.ie-sub { fill: var(--muted); font-size: 13.5px; font-weight: 700; pointer-events: none; }
.ie-path { fill: none; stroke: var(--user-line); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; opacity: 0.6; pointer-events: none; }
.ie-walker { fill: var(--user-line); stroke: var(--surface); stroke-width: 2; }

/* Cantor's diagonal: rows of digits. The list is its own container so the digits scale with its width (cqi): six digits, the
   row number and the dots always fit, at any text size. A diagonal digit has a heavy box, a digit of the new number is
   green with a box of its own, and one not built yet is a dashed "?". The padding is in px (as the card's own is), so a bigger
   root font does not narrow the box and shrink the digits. */
.ie-numbers { container-type: inline-size; list-style: none; margin: 0; padding: 0.5rem min(0.6rem, 9.6px); display: flex; flex-direction: column; gap: 0.25rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ie-number { position: relative; display: flex; align-items: center; gap: 0.12em; white-space: nowrap; font-size: min(1.1rem, 6.5cqi); line-height: 1.6; font-variant-numeric: tabular-nums; }
.ie-number--new { margin-top: 0.25rem; padding-top: 0.3rem; border-top: 2px dashed var(--border); }
.ie-k { flex: none; width: 2.2em; font-size: 0.85em; font-weight: 700; color: var(--muted); }
.ie-zero, .ie-more { flex: none; font-weight: 700; }
.ie-digit { flex: none; display: inline-grid; place-items: center; width: 1.45em; height: 1.6em; border: 2px solid transparent; border-radius: 0.3em; font-weight: 600; }
.ie-digit--diag { border-color: var(--text); background: var(--warn-soft); font-weight: 800; }
.ie-digit--now { border-width: 4px; padding: 0; }
.ie-digit--new { border-color: var(--good); background: var(--good-soft); font-weight: 800; }
.ie-digit--blank { border-style: dashed; border-color: var(--muted); background: transparent; color: var(--muted); font-weight: 600; }

/* Motion is only for people who have not asked for less: the guests slide into their new rooms, then the newcomers arrive. */
@media (prefers-reduced-motion: no-preference) {
  .ie-moved { animation: ie-shift 0.5s ease-out both; }
  .ie-new { animation: ie-arrive 0.45s ease-out 0.5s both; }
  @keyframes ie-shift { from { transform: translateX(-1.2rem); opacity: 0.35; } to { transform: none; opacity: 1; } }
  @keyframes ie-arrive { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
}
