/* Do You Observe? (game/design-observe.md, section 12), on the site's tokens. Phones first: at 360 px the table is
   four columns of 76 px with 8 px between them and 16 px gutters, on a .scene, which is dark in both themes. A round
   on the table is the bar (32 + 8), two lines of prompt (48 + 6), the sand (8 + 8), the table (176, 260 or 344 for
   two, three or four rows) and the foot (12 + 44 + 12): each of one height in look, fog and find, so that the table
   stands on one spot. The page also loads game.css, which colours the drawings and the seal and holds the pieces
   this game shares with The Line-Up (the tabs, the panel, the end screen, the week, the box of text to share).
   Inside the scene the tokens are the dark ones whatever the theme, so --text there is the tiles' paper and --bg
   their ink: the marks laid over a tile are drawn with those two. */

/* ---- a round on the table ---- */

.observe__play { margin-inline: 0; }
.observe__play > * { margin-inline: var(--gutter); }
.observe__play > .observe__scene { margin-inline: 0; }
/* From the look on, the round's column is as tall as it will be once the round is answered (the answer adds a
   heading, a caption and the change in words: some 80 px). The shell brings a screen that does not fit to the
   top of the window, and this way it does so when the look begins and has no cause to between a tap and its
   answer, when a second tap of the same finger would land on whatever had moved under it. The height is the
   table's own (rows of tiles a quarter of the window wide, less the gutters and the gaps) and 260 px for what
   stands round it: 436, 520 and 604 px at 360 px, and no more than the table at its widest needs. */
.observe__play--r2 { min-height: min(calc(50vw + 256px), 497px); }
.observe__play--r3 { min-height: min(calc(75vw + 250px), 603px); }
.observe__play--r4 { min-height: min(calc(100vw + 244px), 708px); }

.observe__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); height: 32px; margin-bottom: var(--s-2); color: var(--muted); font-size: 1rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.observe__round { color: var(--text); font-weight: 600; }

/* Two lines, kept in every phase. */
.observe__prompt { display: flex; flex-direction: column; justify-content: center; height: 3rem; margin-block: 0 6px; overflow: hidden; font-size: 1rem; line-height: 1.5rem; }
.observe__prompt:focus, .observe__verdict:focus { outline: none; }
/* How long the look lasts, in words: shown only where nothing may move (the last rule of this file). */
.observe__still { display: none; color: var(--muted); }

/* The sand: one bar that runs out, from full to nothing, in the look's own time. The length is chosen by class, one
   for every look the level table has and its double (ObserveCore.LOOKS); a test fails if a look has none. The
   shell's alarm and the view's count end the look, and the bar only shows it. Spent, it keeps its place. */
.observe__sand { height: 8px; margin-bottom: var(--s-2); overflow: hidden; border-radius: 4px; background: var(--line); }
.observe__grain { display: block; width: 100%; height: 100%; border-radius: 4px; background: var(--gilt); transform-origin: 0 50%; animation: observe-sand 10s linear both; }
.observe__sand--s4 .observe__grain { animation-duration: 4s; }
.observe__sand--s5 .observe__grain { animation-duration: 5s; }
.observe__sand--s6 .observe__grain { animation-duration: 6s; }
.observe__sand--s8 .observe__grain { animation-duration: 8s; }
.observe__sand--s10 .observe__grain { animation-duration: 10s; }
.observe__sand--s12 .observe__grain { animation-duration: 12s; }
.observe__sand--s16 .observe__grain { animation-duration: 16s; }
.observe__sand--s20 .observe__grain { animation-duration: 20s; }
.observe__sand--s24 .observe__grain { animation-duration: 24s; }
.observe__sand--spent .observe__grain { animation: none; transform: scaleX(0); }
@keyframes observe-sand {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* The table: four places wide at every width. A place is its drawing, a square paper tile. */
.observe__scene { position: relative; overflow: hidden; padding: calc(var(--s-2) - 1px) var(--gutter); border-block: 1px solid var(--line); background-color: var(--surface); }
.observe__table { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); width: 100%; max-width: 26rem; margin: 0 auto; }
.observe__place { position: relative; display: block; width: 100%; min-width: 0; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; }
.observe__place > svg:first-child { display: block; width: 100%; height: auto; }
.observe__place--tap { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  .observe__place--tap:hover { box-shadow: 0 0 0 2px var(--line-strong); }
}

/* The fog: a veil on every place, as large as a tile, and a pale drift across the table whose pace has nothing to
   do with the fog's length. The second table then appears at once: nothing fades or moves that could point at
   the change. */
.observe__veil { display: block; padding-top: 100%; border-radius: 4px; background: var(--text); opacity: .5; }
.observe__scene--fog::before { content: ""; position: absolute; top: 0; bottom: 0; left: -70%; z-index: 1; width: 70%; background: linear-gradient(90deg, transparent, var(--text), transparent); opacity: .35; animation: observe-fog 2.4s ease-in-out infinite alternate; pointer-events: none; }
@keyframes observe-fog {
  from { transform: translateX(0); }
  to { transform: translateX(245%); }
}

/* The ways on from a screen, in a row of two halves. What starts a look ("Show me the table") stands in the left
   half on every screen, and what ends one or leads on ("I have looked", "Next round") in the right half: a double
   tap then never starts or ends a look by accident, wherever the page has scrolled to between its two taps. The
   way that lets an earlier day go stands in the left half as well (see "a day begun before midnight", below). */
.observe__ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: var(--s-2); }
.observe__button { width: 100%; max-width: 16rem; min-height: 44px; padding: var(--s-1) var(--s-2); font-size: 1rem; touch-action: manipulation; }
.observe__button--start { grid-column: 1; justify-self: start; }
.observe__button--on { grid-column: 2; justify-self: end; }
/* The foot of a round: one row of controls 44 px high, or nothing at the same height. Its words are a size
   smaller, so that "See the table as it was" keeps to one line in half of a 360 px phone. */
.observe__foot { min-height: 44px; margin-block: var(--s-3); }
.observe__foot .observe__button { font-size: .9375rem; }
.observe__left { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.35; }

/* ---- a round answered ---- */

.observe__verdict { margin-block: 0; font-size: 1.35rem; line-height: 1.75rem; }
.observe__kind { margin-block: 0 var(--s-2); color: var(--muted); font-size: 1rem; line-height: 1.5rem; }
.observe__caption { margin: 0 0 6px; color: var(--muted); font-size: .8125rem; line-height: 1.25rem; text-align: center; }
/* A place that changed: a ring round its tile, and its number on a plate. The place tapped: a disc with a tick or
   a cross. Shapes, so that neither rests on a colour. The plate stands on the tile's upper edge, on the ring, and
   so partly outside the tile: the overlay is as large as the tile and shows what is drawn past its box. */
.observe__over { position: absolute; top: 0; left: 0; width: 100%; height: 100%; max-width: none; overflow: visible; pointer-events: none; }
.observe__place--changed { box-shadow: 0 0 0 3px var(--gilt); }
.observe__plate, .observe__disc { fill: var(--bg); }
.observe__no { fill: var(--text); font-family: "EB Garamond", Georgia, "Times New Roman", serif; font-weight: 600; }
.observe__sign { stroke: var(--text); }
.observe__changes { display: grid; gap: 2px; margin-top: var(--s-2); font-size: .875rem; line-height: 1.25rem; }
.observe__tapped { margin-block: 2px 0; color: var(--muted); font-size: .875rem; line-height: 1.25rem; }

/* ---- before a table ---- */

/* A screen of words: its lines one under the other and no box round them, so that the control that starts a look
   stands high, where the look has its table, and a row of ways has the whole width for its two halves. */
.observe__sheet { display: grid; gap: var(--s-3); max-width: 40rem; }
.observe__sheet .observe__bar { margin-bottom: 0; }
.observe__lede { margin: 0; }
.observe__facts { margin: 0; font-weight: 600; }
.observe__note { margin: 0; color: var(--muted); font-size: .92em; }
.observe__reached { margin: 0; font-family: var(--display); font-size: 1.3rem; font-weight: var(--display-weight); line-height: 1.3; }
/* A day begun before midnight: that it is an earlier day's table, and the way to today's, which lets the day in
   hand go. A double tap must never reach that way. It stands in the left half of a row of its own, where no way
   that leads to this screen stands ("Next round" is in the right half, and the two halves never meet, wherever
   the page has scrolled to between two taps); and last on the screen, 430 px or more down it, so that the row of
   tabs, which leads here too, is never brought to where it stands: the shell brings a screen up to the top of
   the window, by no more than the stage stood down it, and the stage stands at most some 370 px down the page. */
.observe__carried { display: grid; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--line); }
/* The longer look: a switch whose knob stands left or right, and beside it what it does. */
.observe__longer { display: grid; gap: var(--s-1); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.observe__switch { display: inline-flex; align-items: center; justify-self: start; gap: var(--s-3); max-width: calc(50% - var(--s-1)); min-height: 44px; padding: 0; font-size: 1rem; line-height: 1.25; border: 0; border-radius: 4px; background: none; color: var(--text); font-family: inherit; font-weight: 600; text-align: left; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.observe__knob { position: relative; flex: none; width: 46px; height: 26px; border: 2px solid var(--line-strong); border-radius: 13px; }
.observe__knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--line-strong); }
.observe__switch--chosen .observe__knob { border-color: var(--gilt); background: var(--gilt); }
.observe__switch--chosen .observe__knob::after { left: 23px; background: var(--bg); }
.observe__switch-note { margin: 0; color: var(--muted); font-size: .88em; }

/* ---- the day's end: its five rounds, a disc for a round found, a ring for a slip, a dash for one not played ---- */

.observe__day { display: grid; gap: var(--s-1); }
.observe__rounds { display: flex; align-items: center; gap: var(--s-3); min-height: 20px; }
.observe__mark { display: block; width: 18px; height: 18px; border-radius: 50%; }
.observe__mark--right { background: var(--text); }
.observe__mark--wrong { border: 2px solid var(--text); }
.observe__mark--unplayed { height: 2px; border-radius: 0; background: var(--line-strong); }

/* ---- wider screens: the table gets an edge and stops growing, and the round keeps to a column round it ---- */

@media (min-width: 600px) {
  .observe__play { max-width: 30rem; margin-inline: auto; }
  .observe__play > .observe__scene { margin-inline: var(--gutter); }
  .observe__scene { padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-lg); }
}

/* ---- a window wider than it is tall (a phone on its side, a low window on a desk): the tile is bounded by the
   window's height as well, so that the whole table is in sight while the sand runs. What stands round the table is
   212 px (the bar 40, the prompt 54, the sand 16, the scene's edge 34, the foot 68), so a table of four rows may
   be 100vh - 212px tall, which is also its width; three rows and two are worked out the same way. A tile is never
   under 48 px (a table 13.5rem wide), the smallest size the drawings were made to be read at, and still a fair
   tap; where that is too much for the window, the foot goes below its edge first. Each width is given twice: by
   the window's height, and then, for a browser that knows it, by the height the window has while the browser's
   own bars are showing (svh), which a phone on its side takes from the page and which does not change as they
   come and go. Upright windows are not touched. ---- */

@media (orientation: landscape) {
  .observe__play--r2 .observe__table { max-width: max(13.5rem, min(26rem, calc(200vh - 416px))); max-width: max(13.5rem, min(26rem, calc(200svh - 416px))); }
  .observe__play--r3 .observe__table { max-width: max(13.5rem, min(26rem, calc(133.33vh - 280px))); max-width: max(13.5rem, min(26rem, calc(133.33svh - 280px))); }
  .observe__play--r4 .observe__table { max-width: max(13.5rem, min(26rem, calc(100vh - 212px))); max-width: max(13.5rem, min(26rem, calc(100svh - 212px))); }
}

/* ---- nothing moves: a still, full bar, a plain cover, and the look's length in words ---- */

@media (prefers-reduced-motion: reduce) {
  .observe__grain, .observe__scene--fog::before { animation: none; }
  .observe__scene--fog::before { display: none; }
  .observe__still { display: block; }
}
