/* home-pwt.css: the Play with Type case in home.html (scenes drawn by pwt.js). Loads after home-text.css.
   Paper is white, ink is the zine's blue; the photos sit on the scans' own black. */

.case[data-project="play-with-type"] {
  --pwt-ink: #2454ac;
  --pwt-black: #121212;   /* the black the zine was scanned on (18, 18, 18) */
}

/* ---------- the cover: the logo on its grid, white ---------- */
.cover-pwt, .tile-pwt { background: #fff; }
/* the live copy that assembles the logo: over the card's media, under its pills (pwt.js puts it there) */
.pwt-cover-live { position: absolute; inset: 0; pointer-events: none; }
/* …and over the case's first tile: both share the first row of the column */
.case[data-project="play-with-type"] .col > [data-slot],
.case[data-project="play-with-type"] .col > .pwt-slot-live { grid-row: 1; grid-column: 1; }
.pwt-slot-live {
  position: relative; aspect-ratio: 3 / 2;
  border-radius: var(--t-radius, 8px); overflow: hidden;
  pointer-events: none;
}
.pwt-slot-live:not(.is-live) { visibility: hidden; }
.slot-wait .pwt-slot-live { visibility: hidden; }   /* the flying card is the cover until it lands, as for the slot */
/* white on the page's #fafafa: the same hairline edge the images get, drawn over the live layer */
.pwt-cover-live::after, .pwt-slot-live::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  outline: 1px solid rgba(0, 0, 0, .06); outline-offset: -1px;
}

/* photos: square scans on the black they were scanned on */
.tile.sq { aspect-ratio: 1; }
.tile.pwt-black { background: var(--pwt-black); }
/* the same photos in <picture> (WebP srcset, JPEG fallback): style-layout.css's `.tile > img` does not reach them */
.tile.pwt-black > picture > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- scenes ---------- */
.tile.pwt-scene { background: #fff; }
.pwt-scene > .pwt-live, .pwt-cover-live > .pwt-live { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* the poster stays under the live scene: its alt text, and the picture the chapter map shows */
.pwt-scene.is-live > .pwt-poster { opacity: 0; }
svg.pwt-live { overflow: hidden; }
svg.pwt-live path { transform-box: view-box; transform-origin: 0 0; }
/* pwt.js crops each scene round its content and sets the tile's aspect-ratio inline to match */
/* …the same ratios reserved before it runs (fit / fitNarrow in pwt.js), so nothing below moves when a scene builds */
.tile.pwt-scene[data-pwt-scene="varianty"] { aspect-ratio: 2; }
@media (max-width: 640px) {
  .tile.pwt-scene[data-pwt-scene="modules"] { aspect-ratio: 4 / 5; }
  .tile.pwt-scene[data-pwt-scene="ruler"] { aspect-ratio: 4 / 3; }
  .tile.pwt-scene[data-pwt-scene="varianty"] { aspect-ratio: 1 / 2; }
  .tile.pwt-scene[data-pwt-scene="vysledek"] { aspect-ratio: 1; }
}

/* ---------- Play: the sandbox (pwt-sandbox.js); a poster until it is mounted ---------- */
.pwt-play { position: relative; display: grid; }
.pwt-play-poster {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 2;
  object-fit: cover; object-position: 50% 0;
  border-radius: var(--t-radius, 8px); background: #fff;
  outline: 1px solid rgba(0, 0, 0, .06); outline-offset: -1px;
}
.pwt-play.is-live .pwt-play-poster { display: none; }
/* while pwt.js waits for the sandbox the poster is only a fallback: not shown, so the lazy image is not fetched;
   the block keeps the poster's place. pwt.js lets it through if the sandbox fails or is slow to come up */
.pwt-play.is-pending > .pwt-play-poster { display: none; }
.pwt-play.is-pending:not(.is-live) {
  aspect-ratio: 3 / 2; border-radius: var(--t-radius, 8px); background: #fff;
  outline: 1px solid rgba(0, 0, 0, .06); outline-offset: -1px;
}
.pwt-play:not(.is-live) > .pwt-sandbox { display: none; }

@media (forced-colors: active) {
  .tile.pwt-scene { border: 1px solid CanvasText; }
}
