/* Cam Across — seamless page, pause and card transitions (see js/ascii.js compose and
   js/boot.js). The page colour comes from the theme before first paint;
   page content is held (clipped, still laid out and measurable) until its glyph assembly draws
   its first frame, so no frame shows the page uncovered or in the wrong theme. The header, with
   the toolbar in it, is never held or broken up: the toolbar only fades in once the puzzle loads. */
html { background: var(--bg); }
html.ca-hold :is(main, .kbd) { clip-path: inset(0 0 100% 0); }
.ca-boot { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 80; }
.ascii-overlay { pointer-events: none; }

/* No cross-document view transition on purpose: the swarm hand-off already joins the two pages,
   and a skipped transition (hidden or throttled tab) logs an error and can delay the new page. */

/* Press state: links and buttons give a small, crisp push before the page breaks into glyphs. */
.bar :is(a, button), .pause button, .card :is(a, button), a.day, .page a.btn {
  transition: transform 140ms cubic-bezier(.2, .8, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.bar :is(a, button):active, .pause button:active, .card :is(a, button):active, a.day:active, .ca-press {
  transform: scale(0.93);
  transition-duration: 60ms;
}

/* The result card's backdrop fades in under the card's assembly instead of snapping dark. */
.modal:not([hidden]) { animation: ca-dim 260ms cubic-bezier(.2, .7, .2, 1) both; }
@keyframes ca-dim { from { opacity: 0; } }

/* The toolbar belongs to the header: it appears when the puzzle loads, with a short fade. */
.toolbar:not([hidden]) > :is(.tl, .tr) { animation: ca-fade 220ms ease-out both; }
@keyframes ca-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .toolbar:not([hidden]) > :is(.tl, .tr) { animation: none; }
  html.ca-hold :is(main, .kbd) { clip-path: none; }
  .ca-press, .bar :is(a, button):active, .pause button:active, .card :is(a, button):active, a.day:active { transform: none; }
  .modal:not([hidden]) { animation: none; }
}

/* Print on white whatever the theme (the page colour set by js/boot.js would otherwise win). */
@media print { html { background: #fff !important; } html.ca-hold :is(main, .kbd) { clip-path: none; } .ascii-overlay { display: none; } }
