/*
 * The room (docs/canvas-room.md): a full-window canvas view of a topic's line, opened from the
 * "Full screen" button under the strip, on every topic page.
 */

/* the link, in the .under row: as the strip's "Show more" */
.room-open {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  margin-left: auto;
}
.room-open:hover { text-decoration: underline; }
p.shown:not([hidden]) + .room-open { margin-left: 0; }

/* the overlay: the whole window, over everything; the page never zooms under it */
.room {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.room[hidden] { display: none; }
.room-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }

/* one bar along the top (eighth round, Nov 21): one row, one height, the same margins left, right and
   top; the home room's chips at the left, play and close at the right. Zooming is pinch, wheel,
   trackpad and the keys + - 0; the +, - and "Whole line" buttons are gone. */
.room-bar {
  --room-edge: 10px;
  --room-h: 36px;
  position: absolute;
  top: max(var(--room-edge), env(safe-area-inset-top));
  left: max(var(--room-edge), env(safe-area-inset-left));
  right: max(var(--room-edge), env(safe-area-inset-right));
  height: var(--room-h);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
  pointer-events: none;   /* the empty stretch of the bar is the canvas's */
}
.room-bar > * { pointer-events: auto; }
.room-controls {
  flex: none;
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.room-controls button {
  min-width: var(--room-h);
  height: var(--room-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.room-controls .room-close { padding: 0; font-size: 19px; font-weight: 500; }
.room-controls button:hover { border-color: var(--faint); }
.room-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* play: the strip's triangle, a square while it plays (lines.css .play) */
.room-controls .room-play { display: grid; place-items: center; padding: 0; color: var(--accent); }
.room-controls .room-play[hidden] { display: none; }
.room-play svg { display: block; fill: currentColor; }
.room-play .play-stop, .room-play.on .play-go { display: none; }
.room-play.on .play-stop { display: inline; }
.room-controls .room-play.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* ---------- cards: the taps-and-cards piece adds its rules below this line ---------- */
/* a card is the strip's pinned tip (.tip.pinned in lines.css), placed by room-cards.js near its
   anchor; it stays under the controls when the two meet */
.room-card { z-index: 0; }
.room-card[hidden] { display: none; }

/* ---------- the home page (room-home.js): its link under the strip, the group chips, the lit story's button ---------- */
/* the link is last in the home strip's .under row, at the right; the count or the lit story's button sits just before it */
.home-strip .under .room-open { flex: none; }
.home-strip .under :is(p.shown, .story-row):not([hidden]) ~ .room-open { margin-left: 0; }
/* the chips: the page's own (lines.css .groups) in one row at the left of the bar, as tall as the
   controls and in their pill (border, surface, shadow, 13 px). Where they do not fit (a phone) the row
   slides sideways under the finger (touch-action: pan-x; room-shell.js lets its moves through) and
   fades where chips are hidden: the right until scrolled to the end, the left once scrolled. The 4 px
   padding, taken back by the margin, keeps the shadows from being cut by the scrolling box. */
.groups.room-groups {
  --fade-l: 0px;
  --fade-r: 0px;
  flex: 0 1 auto;
  min-width: 0;
  margin: -4px;
  padding: 4px;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.groups.room-groups:not(.at-start) { --fade-l: 28px; }
.groups.room-groups:not(.at-end) { --fade-r: 36px; }
.groups.room-groups.at-start.at-end { -webkit-mask-image: none; mask-image: none; }
.room-groups button {
  height: var(--room-h);
  padding: 0 13px;
  font-size: 13px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  touch-action: pan-x;
}
.room-groups button:hover { border-color: var(--faint); }
/* the lit story's button, bottom left above the date scale, in the line's colour (set by the script) */
.room-story { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: 38px; z-index: 1; }
.room-story[hidden] { display: none; }
.room-story button {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
}
.room-story button:hover { border-color: var(--faint); text-decoration: underline; }
