/**
 * THE BONBONNIÈRE SCREEN (docs/15).
 *
 * The console's own stylesheet, not the wall's: this page is a pointer and
 * keyboard application on a laptop, so it uses the console's tokens, the
 * console's theme and whatever CSS the console's own floor allows. The wall's
 * sheet (console-tv.css) is the one held to the television's floor, and the two
 * meet only inside the preview's iframe, which is a separate document.
 *
 * IT WORKS AT 390 PIXELS WIDE, ahead of the rest of the console, because
 * standing at the television with a phone is this page's natural use and it is
 * what makes the QR on the set worth having.
 */

.cb-bon {
  display: flex;
  flex-direction: column;
  gap: var(--cb-space-6xl);
}

.cb-bon-sample {
  margin: 0;
  padding: var(--cb-space-3xl);
  border: 1px solid var(--cbc-line);
  border-radius: var(--cb-radius-2xl);
  background: var(--cbc-surface);
  color: var(--cbc-ink);
  font-size: var(--cb-type-sm-size);
}

.cb-bon-h2 {
  margin: 0 0 var(--cb-space-3xl);
  font-size: var(--cb-type-lg-size);
  font-weight: var(--cb-font-weight-semibold);
  color: var(--cbc-ink);
}

/* ---------------------------------------------------------------------------
   The strip. Each tile is the board itself, drawn small.
   ------------------------------------------------------------------------ */

.cb-bon-strip {
  overflow-x: auto;
}

.cb-strip {
  display: flex;
  gap: var(--cb-space-3xl);
  align-items: stretch;
  padding-bottom: var(--cb-space-lg);
}

.cb-strip-tile {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: var(--cb-space-lg);
  width: var(--cb-space-11xl);
  padding: var(--cb-space-lg);
  border: 1px solid var(--cbc-line);
  border-radius: var(--cb-radius-2xl);
  background: var(--cbc-surface);
  cursor: pointer;
  transition:
    border-color var(--cb-motion-fast) var(--cb-motion-ease),
    background var(--cb-motion-fast) var(--cb-motion-ease);
}

.cb-strip-tile:hover {
  background: var(--cbc-hover);
}

/* The selected tile is the filled one. No rail down its edge: colour alone is
   not a label, and a bar down the left is the tell this console avoids. */
.cb-strip-tile[aria-selected="true"] {
  border-color: var(--cbc-accent);
  background: var(--cbc-accent-quiet);
}

.cb-strip-tile[data-dragging] {
  opacity: 0.4;
}

/**
 * THE BOARD, AT TILE SIZE. Eight by six, exactly as the television has it, so
 * a tile is a picture of a screen rather than a decoration standing for one.
 */
.cb-strip-mini {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 1px;
  aspect-ratio: 16 / 9;
  padding: var(--cb-space-xs);
  border-radius: var(--cb-radius-md);
  background: var(--cbc-sunken);
}

.cb-strip-block {
  border-radius: var(--cb-radius-xxs);
  background: var(--cbc-ink-faint);
}

.cb-strip-tile[aria-selected="true"] .cb-strip-block {
  background: var(--cbc-accent);
}

.cb-strip-foot {
  display: flex;
  gap: var(--cb-space-sm);
  align-items: center;
  justify-content: space-between;
}

.cb-strip-name {
  overflow: hidden;
  flex: 1 1 auto;
  padding: var(--cb-space-xxs) var(--cb-space-xs);
  border-radius: var(--cb-radius-xs);
  color: var(--cbc-ink);
  font-size: var(--cb-type-sm-size);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-strip-name:focus-visible {
  outline: 2px solid var(--cbc-focus);
  outline-offset: 1px;
  background: var(--cbc-sunken);
}

/**
 * REVEALED WHEN THE POINTER IS NEAR IT, one at a time. The same rule the
 * dashboard's cards follow: a control shows its affordance when you approach it
 * and not before, so a strip of five screens is not five crosses.
 */
.cb-strip-drop {
  padding: 0 var(--cb-space-xs);
  border: 0;
  background: none;
  color: var(--cbc-ink-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--cb-motion-fast) var(--cb-motion-ease);
}

.cb-strip-tile:hover .cb-strip-drop,
.cb-strip-drop:focus-visible {
  opacity: 1;
}

.cb-strip-drop:hover {
  color: var(--cbc-poor-text);
}

.cb-strip-add {
  flex: 0 0 auto;
  width: var(--cb-space-9xl);
  border: 1px dashed var(--cbc-line-strong);
  border-radius: var(--cb-radius-2xl);
  background: none;
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-xl-size);
  cursor: pointer;
}

.cb-strip-add[aria-disabled="true"] {
  cursor: default;
  opacity: 0.5;
}

/* ---------------------------------------------------------------------------
   The television mockup, and the room it hangs in
   ------------------------------------------------------------------------ */

.cb-bon-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--cb-space-6xl);
  align-items: start;
}

@media (max-width: 60rem) {
  /* One column below about 960px, which is where the arranger's rows stop
     having room beside a sixteen-by-nine frame. */
  .cb-bon-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.cb-bon-left,
.cb-bon-right {
  display: flex;
  flex-direction: column;
  gap: var(--cb-space-3xl);
  min-width: 0;
}

/**
 * MADE TO LOOK LIKE A TELEVISION, and it is worth doing: this screen is how
 * somebody decides whether a board is any good, and a board judged in a browser
 * window is judged at the wrong shape and with no sense of what the edges do.
 *
 * `.cb-telly` AND NOT `.cb-set`, WHICH IS WHAT IT WAS AND WHAT BROKE EVERY
 * SETTINGS SCREEN IN THE CONSOLE. Two meanings of one short word: a television
 * set here, and one setting in console-panels.css, where `.cb-set` is the
 * two-column grid that `setting()` in views/panel.ts puts every row of every
 * settings screen into. This sheet loads after that one, so this rule won a
 * cascade it was never meant to be in: `display: grid` became `flex`, the
 * label and control columns collapsed into one, and `align-items: center` put
 * every menu, switch and text box in the middle of its row with an empty
 * gutter beside it. Nothing threw and no guard saw it (rule 13b). The children
 * below are still `cb-set-*`, which nothing else defines today; renaming them
 * is the wall's call rather than this fix's.
 */
.cb-telly {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cb-set-bezel {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--cb-radius-lg);
  background: var(--cb-color-black);
  box-shadow: var(--cbc-shadow-high);
}

/**
 * The window the scaled television is seen through.
 *
 * `transform-origin` at the top left and `overflow: hidden` on the bezel are
 * what make a 1920-wide document sit inside a card a third that size without
 * either being clipped or laying itself out differently. --cbs-scale is set
 * from the bezel's real width by wall-set.ts, because it is the one number in
 * this file that cannot be written down.
 */
.cb-set-fit {
  position: absolute;
  inset: 0;
  transform: scale(var(--cbs-scale, 0.25));
  transform-origin: top left;
}

.cb-set-screen {
  display: block;
  border: 0;
}

/**
 * FULL SCREEN IS THE WALL AT ITS OWN SIZE. The scaling above exists to fit a
 * television-sized document into a card; filling a screen is the case where
 * there is no card, so it comes off entirely rather than being recomputed.
 */
.cb-set-screen:fullscreen {
  width: 100vw;
  height: 100vh;
}

/**
 * THE SAFE AREA, DRAWN ON THE MOCKUP RATHER THAN DESCRIBED BESIDE IT.
 * Televisions still overscan and eat three to five percent of every edge, and a
 * board arranged without seeing that is a board with its corners cut off in a
 * room somebody else is standing in.
 */
.cb-set-safe {
  position: absolute;
  inset: 3%;
  border: 1px dashed var(--cbc-accent);
  border-radius: var(--cb-radius-xxs);
  opacity: 0.45;
  pointer-events: none;
}

.cb-set-stand {
  width: 18%;
  height: var(--cb-space-lg);
  border-radius: 0 0 var(--cb-radius-md) var(--cb-radius-md);
  background: var(--cb-color-black);
}

.cb-set-acts {
  display: flex;
  justify-content: center;
  margin-top: var(--cb-space-lg);
}

.cb-room {
  padding: var(--cb-space-3xl);
  border: 1px solid var(--cbc-line);
  border-radius: var(--cb-radius-xl);
  background: var(--cbc-surface);
}

.cb-room-lead {
  margin: 0 0 var(--cb-space-lg);
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-sm-size);
}

.cb-room-row {
  display: flex;
  gap: var(--cb-space-lg);
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   The arranger
   ------------------------------------------------------------------------ */

/**
 * The arranger's own column. It is a flex column rather than nothing, because
 * the judgement line and the two lists below it are one stack with one rhythm,
 * and leaving the container unstyled would let the browser's default margins
 * decide that instead.
 */
.cb-arr {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cb-arr-judge {
  margin: 0;
  padding: var(--cb-space-lg) var(--cb-space-3xl);
  border-radius: var(--cb-radius-xl);
  background: var(--cbc-sunken);
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-sm-size);
}

.cb-arr-judge[data-tone="warn"] {
  color: var(--cbc-warn-text);
}

.cb-arr-judge[data-tone="good"] {
  color: var(--cbc-good-text);
}

.cb-arr-cols {
  display: flex;
  flex-direction: column;
  gap: var(--cb-space-4xl);
  margin-top: var(--cb-space-3xl);
}

.cb-arr-head {
  margin: 0 0 var(--cb-space-lg);
  font-size: var(--cb-type-sm-size);
  font-weight: var(--cb-font-weight-semibold);
  letter-spacing: var(--cb-tracking-xxs);
  text-transform: uppercase;
  color: var(--cbc-ink-muted);
}

.cb-arr-none {
  margin: 0;
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-sm-size);
}

.cb-arr-rows {
  display: flex;
  flex-direction: column;
  gap: var(--cb-space-sm);
}

.cb-arr-row {
  display: flex;
  gap: var(--cb-space-lg);
  align-items: center;
  padding: var(--cb-space-sm) var(--cb-space-lg);
  border-radius: var(--cb-radius-lg);
  background: var(--cbc-sunken);
}

/* A card somebody placed that the television will not draw. Tinted rather than
   railed, and the reason is written in words beside it. */
.cb-arr-row[data-refused] {
  background: var(--cbc-accent-quiet);
}

.cb-arr-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--cbc-ink);
  font-size: var(--cb-type-sm-size);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-arr-said {
  flex: 0 0 auto;
  color: var(--cbc-warn-text);
  font-size: var(--cb-type-xs-size);
}

.cb-arr-size {
  display: flex;
  flex: 0 0 auto;
  gap: var(--cb-space-xs);
  align-items: center;
  color: var(--cbc-ink-faint);
  font-size: var(--cb-type-xs-size);
}

.cb-arr-num {
  width: var(--cb-space-7xl);
  padding: var(--cb-space-xxs) var(--cb-space-xs);
  border: 1px solid var(--cbc-line);
  border-radius: var(--cb-radius-sm);
  background: var(--cbc-surface);
  color: var(--cbc-ink);
  font: inherit;
  font-size: var(--cb-type-xs-size);
}

.cb-arr-move,
.cb-arr-drop {
  flex: 0 0 auto;
  padding: 0 var(--cb-space-sm);
  border: 0;
  background: none;
  color: var(--cbc-ink-muted);
  cursor: pointer;
}

.cb-arr-move[aria-disabled="true"] {
  cursor: default;
  opacity: 0.35;
}

.cb-arr-drop:hover {
  color: var(--cbc-poor-text);
}

.cb-arr-board,
.cb-arr-lib {
  min-width: 0;
}

.cb-arr-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--cb-space-lg);
}

.cb-arr-tile {
  display: flex;
  flex-direction: column;
  gap: var(--cb-space-xxs);
  padding: var(--cb-space-lg);
  border: 1px solid var(--cbc-line);
  border-radius: var(--cb-radius-lg);
  background: var(--cbc-surface);
  text-align: left;
  cursor: pointer;
  transition: background var(--cb-motion-fast) var(--cb-motion-ease);
}

.cb-arr-tile:hover {
  background: var(--cbc-hover);
}

.cb-arr-tile[aria-disabled="true"] {
  cursor: default;
  opacity: 0.45;
}

.cb-arr-tile-name {
  color: var(--cbc-ink);
  font-size: var(--cb-type-sm-size);
  font-weight: var(--cb-font-weight-medium);
}

.cb-arr-tile-note {
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-xs-size);
}

/* ---------------------------------------------------------------------------
   Pairing, and the televisions
   ------------------------------------------------------------------------ */

.cb-bon-sets {
  min-width: 0;
}

.cb-pair-lead {
  margin: 0 0 var(--cb-space-lg);
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-sm-size);
}

.cb-pair-row {
  display: flex;
  gap: var(--cb-space-lg);
  flex-wrap: wrap;
  align-items: center;
}

.cb-pair-name {
  flex: 1 1 12rem;
  min-width: 0;
}

/**
 * The code, in the shape the television shows it: two groups of four, spaced,
 * in tabular figures. A field that reads as one run of eight is a field
 * somebody checks character by character against a screen across the room.
 */
.cb-pair-field {
  flex: 0 0 auto;
  width: 10rem;
  font-family: var(--cb-font-mono);
  font-size: var(--cb-type-lg-size);
  letter-spacing: var(--cb-tracking-xxs);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.cb-tvs {
  display: flex;
  flex-direction: column;
  gap: var(--cb-space-lg);
  margin-top: var(--cb-space-3xl);
}

.cb-tvs-none {
  margin: 0;
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-sm-size);
}

.cb-tv-row {
  display: flex;
  gap: var(--cb-space-3xl);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--cb-space-3xl);
  border: 1px solid var(--cbc-line);
  border-radius: var(--cb-radius-xl);
  background: var(--cbc-surface);
}

.cb-tv-who {
  flex: 1 1 16rem;
  min-width: 0;
}

.cb-tv-row-name {
  margin: 0;
  color: var(--cbc-ink);
  font-size: var(--cb-type-md-size);
  font-weight: var(--cb-font-weight-medium);
}

.cb-tv-row-said {
  margin: 0;
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-xs-size);
  overflow-wrap: anywhere;
}

.cb-tv-seen {
  margin: 0;
  flex: 0 0 auto;
  color: var(--cbc-ink-muted);
  font-size: var(--cb-type-sm-size);
}
