/* The stops that hold a board (the switchboard, a job for two), and the row of things found along the way. */

/* a stop with a board: words, painting, then the bench the board stands on */
/* (a lit bulb's glow may reach past the board; it must never widen the page) */
.stop.play { overflow-x: clip; display: grid; gap: var(--words-gap); grid-template-columns: minmax(0, 1fr); justify-items: center; grid-template-areas: "words" "painting" "bench"; }
.stop.play .words { grid-area: words; }
.stop.play .painting { grid-area: painting; }
.bench { grid-area: bench; position: relative; z-index: 2; width: min(100% - 2 * var(--gutter), var(--board-max)); margin-top: 0; display: grid; justify-items: center; gap: var(--bench-gap); }
.bench .board { width: 100%; }
/* until its stop comes near a board is not built (js/boards.js): its place is kept, so nothing jumps */
.bench .board:empty { aspect-ratio: var(--board-shape); }
#switchboard { --board-shape: 380 / 459; }
#belltower { --board-shape: 380 / 530; }
/* the self-play watches this mark: it is on screen only when most of the board is */
.seen-from { position: absolute; left: 50%; top: 58%; width: 1px; height: 1px; pointer-events: none; }
/* a line for a screen reader only */
.said { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* a board that is off screen stops its own animations */
.board.away, .board.away::before, .board.away::after, .board.away *, .board.away *::before, .board.away *::after { animation-play-state: paused !important; }
.words .nudge { margin-top: 0.7em; font-style: italic; color: var(--tagline-ink); }
/* without JavaScript there is no board to play: the stop is its lit painting and its words, and nothing says "tap" */
html:not(.js) .bench, html:not(.js) .words .nudge { display: none; }

/* "Again": quiet, in the game's lettering, there only once the job is lit */
/* (a word with a brass line under it, not a button shape: nothing boxed is laid over the night) */
.again { min-width: var(--tap); min-height: var(--tap); padding: 0 0.4em; border: 0; background: transparent; color: var(--filament); font-family: var(--display); font-style: italic; font-weight: 500; font-size: var(--story); text-decoration: underline; text-decoration-color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 0.28em; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.again[hidden] { display: none; }
.again:focus-visible { outline: 1.5px solid var(--amber); outline-offset: 3px; }
@media (hover: hover) { .again:hover { text-decoration-color: var(--amber); color: var(--paper); } }

/* whose half is whose: a portrait and an enamel name plate above and below the board */
.owner { display: flex; align-items: center; gap: 0.6em; }
.owner img { width: var(--portrait); height: var(--portrait); border-radius: 50%; box-shadow: 0 0 0 1.5px var(--brass); }
.owner .plate { padding: 0.5em 1.3em 0.55em; background: center / 100% 100% no-repeat; color: var(--enamel-ink); font-family: var(--display); font-weight: 700; font-size: var(--plate-text); line-height: 1; white-space: nowrap; }

/* the plate's picture is the board's own, and is asked for only once the board is built */
.bench.built .owner .plate { background-image: url("../assets/img/board/plate.webp"); }

/* ---- on a phone (anything narrower than 11:10): the house and its board are one scene on one screen,
   as on the game's own job screen but with more of the house showing. The house is a window on its
   painting, the full width of the screen; the board stands right under it, over its foot. The two
   together are never taller than the screen (--screen), unless the screen is too small for a board a
   thumb can use; then the house keeps a least height and the scene runs a little long. ---- */
@media not (min-aspect-ratio: 11/10) {
  .stop.play { --screen: 100vh; --set: calc(var(--screen) * 0.94); --house: max(var(--house-least), calc(var(--set) - var(--board-w) * var(--board-tall) - var(--below))); }
  @supports (height: 100svh) { .stop.play { --screen: 100svh; } }
  /* the board is as wide as the screen's height allows, and never so small a thumb cannot use it */
  #switchboard { --board-tall: 1.208; --board-w: clamp(var(--board-least), min(100vw - 2 * var(--gutter), var(--screen) * 0.39), var(--board-max)); --below: 58px; --focus: 0.47; }
  #belltower { --board-tall: 1.395; --board-w: clamp(var(--board-least), min(100vw - 2 * var(--gutter), var(--screen) * 0.372), var(--board-max)); --below: 98px; --focus: 0.44; }
  /* its board has a name above it, which must stand clear of the house's foot: here the bench sits below the house, not over it */
  #belltower.stop.play .bench { margin-top: calc(-1 * var(--words-gap) + var(--half-clear)); }
  .stop.play .painting { width: 100%; max-width: none; height: var(--house); aspect-ratio: auto; }
  /* the window: the painting keeps its own shape behind it, placed so its house (--focus, a share of the painting's height) is in the middle */
  .stop.play .painting .cut { container-type: size; }
  .stop.play .painting img { --tall: calc(100cqw * 1858 / 1440); inset: auto; left: 0; width: 100%; height: var(--tall); top: clamp(calc(100cqh - var(--tall)), calc(50cqh - var(--focus) * var(--tall)), 0px); }
  .stop.play .bench { width: var(--board-w); margin-top: calc(-1 * var(--words-gap) - var(--board-over)); gap: var(--half-gap); }
  /* whose half is whose, said small as in the game: a portrait and a name, at the board's left */
  .stop.play .owner { justify-self: start; gap: 0.5em; }
  .stop.play .owner img { width: var(--half-portrait); height: var(--half-portrait); }
  .stop.play .bench.built .owner .plate, .stop.play .owner .plate { padding: 0; background: none; color: var(--tagline-ink); font-family: var(--ui); font-weight: 700; font-size: var(--half-label); letter-spacing: 0.01em; text-shadow: var(--text-shadow); }
}

/* From 11:10 the words run across the top and the painting and the board stand side by side beneath,
   each no taller than two thirds of the screen, so the two are seen whole together. On a short, wide
   screen (a phone on its side) the board keeps a size a thumb can use and the scene scrolls. */
@media (min-aspect-ratio: 11/10) {
  .stop.play { grid-template-columns: auto auto; grid-template-areas: "words words" "painting bench"; gap: var(--bench-gap) var(--gutter); align-content: center; justify-content: center; justify-items: center; align-items: center; min-height: 0; }
  #belltower.stop.play { grid-template-areas: "words words" "bench painting"; }
  .stop.play .words { max-width: var(--measure); text-align: center; }
  .stop.play .painting { height: var(--painting-play); }
  .stop.play .bench { width: var(--board-w); margin-top: 0; }
  #switchboard { --board-w: clamp(var(--board-min), var(--play-h) / 1.21, var(--board-max-side)); }
  #belltower { --board-w: clamp(var(--board-min), (var(--play-h) - 2 * var(--portrait) - 3 * var(--bench-gap)) / 1.4, var(--board-max-side)); }
}

/* ---- along the way: what the game gives besides its jobs, in three parts under one heading. Each part
   is its pictures with a line under them; no boxes. Side by side on a wide screen, one under another on
   a phone, with the page's brass mark between them. ---- */
.along { padding: var(--stop-gap) var(--gutter) 0; display: grid; justify-items: center; gap: var(--words-gap); }
.finds { width: 100%; max-width: var(--finds-max); display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--find-gap); }
.find { display: grid; justify-items: center; align-content: start; gap: var(--find-inner); text-align: center; }
.find .set { display: flex; align-items: center; justify-content: center; min-height: var(--thing); }
.find p { font-family: var(--display); font-style: italic; font-weight: 500; font-size: var(--story); line-height: 1.3; color: var(--tagline-ink); text-wrap: balance; }
.find.stars .set { gap: var(--finds-gap); }
.find.stars img { width: var(--star); height: var(--star); }
.find.stars img:nth-child(2) { width: calc(var(--star) * 1.3); height: calc(var(--star) * 1.3); transform: translateY(-12%); }      /* the middle one stands a little higher, as on the game's result card */
.find.things img { width: var(--thing); height: var(--thing); margin: 0 calc(var(--thing) * -0.05); }
.find.crew .set { gap: var(--crew-gap); }
.find.crew img { width: var(--portrait-big); height: var(--portrait-big); border-radius: 50%; box-shadow: 0 0 0 1.5px var(--brass); }
/* between two parts on a phone: the same mark as under a heading */
.find + .find::before { content: ""; width: var(--ornament); height: 11px; margin-bottom: calc(var(--find-gap) - var(--find-inner)); background: var(--brass); opacity: 0.7; -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
.along .words p { margin-top: 0; }
@media (min-width: 900px) {
  .finds { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: var(--gutter); }
  .find + .find::before { display: none; }
  .find .set { min-height: var(--thing); }
}

@keyframes plate-pulse { 0%, 100% { transform: none; filter: none; } 30% { transform: scale(1.06); filter: brightness(1.25); } 60% { transform: scale(0.99); } }
@media (prefers-reduced-motion: no-preference) {
  .owner.pulse { animation: plate-pulse var(--fade) ease-out; }
  .again { transition: color var(--fade), text-decoration-color var(--fade); }
}
/* with reduced motion the plate still answers: it brightens for a moment, without moving */
@media (prefers-reduced-motion: reduce) { .owner.pulse .plate { outline: 2px solid var(--amber); outline-offset: 2px; } }
/* with reduced motion the board is shown done, so nothing says "tap" over it */
@media (prefers-reduced-motion: reduce) { .words .nudge { display: none; } }
