/* css/sheet.css: the contact sheet (stills across the window, by day). Moved from style.css (UI plan step 20d); 20f added
   its one-line bar. How many stills across is #sheetCols (1 | 2 | 3 | 4, the kit .seg; data-cols on the grid). */

/* ---------- contact sheet ---------------------------------------------- */

.sheet-area { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg-video); }   /* relative: the tools sit on it (stage/pane-tools.js) */
/* Wraps: on a phone the range text otherwise squeezes into a column a few words
   wide, the bar grows to half the screen and the stills get the leftovers. */
.sheet-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 7px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12px;
}
.sheet-bar select {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px 7px; font-size: 12px;
}
.sheet-hint { margin-left: auto; }

.sheet-grid { --sheet-pad: 6px; flex: 1; overflow-y: auto; padding: var(--sheet-pad); }
.sheet-sentinel { height: 1px; width: 100%; pointer-events: none; }
.sheet-error { color: var(--err-fg); font-size: 13px; }   /* the sheet could not be drawn: why (stage/contact-sheet.js) */

/* One section per calendar day. The header is sticky INSIDE its section (a
   sticky grid item could not travel — its containing block is its own grid
   area), so it holds at the top while that day's stills scroll under it and
   the next day's header pushes it off. */
.sheet-day { position: relative; }
.sheet-day + .sheet-day { margin-top: 8px; }
.sheet-day-head {
  /* The sticky edge is inset by the scroll pane's padding; cancel it so the
     header hugs the visible top edge. */
  position: sticky; top: calc(-1 * var(--sheet-pad)); z-index: 1; margin: 0 0 4px;
  padding: 5px 6px 4px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text); background: rgba(5, 7, 10, .94); border-bottom: 1px solid var(--line);
}
.sheet-day-head small { font-weight: 400; color: var(--muted); margin-left: 8px; }
.sheet-day-tiles {
  display: grid; gap: 4px;
  /* Tiles size themselves to the pane so the whole window stays glanceable
     rather than forcing a horizontal scroll nobody will use. */
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));   /* until a column count is set (contact-sheet.js) */
}

.sheet-grid .tile {
  position: relative; aspect-ratio: 16 / 9; background: var(--bg);
  border: 1px solid transparent; border-radius: 3px; overflow: hidden; cursor: pointer;
}
/* `fill`, never `cover`, on every still: stills are cut from the camera's second
   stream, which these cameras send at 640x480 or 352x240 -- the whole 16:9
   picture squeezed. Filling a 16:9 box stretches it back to the real shape and
   shows all of it. `cover` cut off the top and bottom (a quarter of the picture
   on a 4:3 stream) and, in the zone painter and the enhance selector, put the
   drawn cells/box somewhere else: both are fractions of the FULL frame. */
.sheet-grid .tile img { width: 100%; height: 100%; object-fit: fill; display: block; }
.sheet-grid .tile b {
  position: absolute; left: 0; bottom: 0; padding: 1px 4px;
  background: rgba(0,0,0,.6); font: 10px/1.4 ui-monospace, Menlo, Consolas, monospace;
  font-weight: 400; color: var(--text-2);
}
.sheet-grid .tile:hover { border-color: var(--accent); }
/* A tile with something in it gets a ring, so a block of activity reads as a
   block even when the subject itself is small at this size. */
.sheet-grid .tile.hasevent { border-color: var(--tile-event-line); }
.sheet-grid .tile.now { border-color: var(--tl-playhead); box-shadow: 0 0 0 1px var(--tl-playhead); }
.sheet-grid .tile-kinds { position: absolute; top: 0; left: 0; right: 0; height: 3px; display: flex; }
.sheet-grid .tile-kinds i { flex: 1; background: var(--k, var(--kind-other)); }   /* .k-<kind> (css/kit.css) sets --k */

.sheet-grid .tile.gap {
  display: grid; place-content: center; gap: 2px; text-align: center;
  background: repeating-linear-gradient(45deg, var(--err-bg-deeper), var(--err-bg-deeper) 6px, var(--err-bg-deep) 6px, var(--err-bg-deep) 12px);
  border-color: var(--gap-line);
}
.sheet-grid .tile.gap span { color: var(--live-fg); font-size: 10px; letter-spacing: .04em; }
.sheet-grid .tile.gap b { position: static; background: none; color: var(--gap-text); }
/* A security responder's sheet (js/stage/contact-sheet.js): where its hours start, and a tile that rolled out of them
   before its still was loaded (never asked for). */
.sheet-grid .sheet-floor { margin: var(--s2) 0; font-size: var(--fs-sm); }
.sheet-grid .tile.outside { background: repeating-linear-gradient(45deg, var(--denied-bg), var(--denied-bg) 6px, var(--denied-bg-2) 6px, var(--denied-bg-2) 12px); }
.sheet-grid .tile.outside img { visibility: hidden; }

/* Stills across, on every screen (Wade, 2026-11-02); one column is the HD view (contact-sheet.js sheetHdWatch). */
.sheet-grid[data-cols="1"] .sheet-day-tiles { grid-template-columns: 1fr; }
.sheet-grid[data-cols="2"] .sheet-day-tiles { grid-template-columns: repeat(2, 1fr); }
.sheet-grid[data-cols="3"] .sheet-day-tiles { grid-template-columns: repeat(3, 1fr); }
.sheet-grid[data-cols="4"] .sheet-day-tiles { grid-template-columns: repeat(4, 1fr); }

/* The bar on one line on a wide screen: the range gives way (its full text is its tooltip). */
@media not all and (max-width: 1000px) {
  .sheet-bar { flex-wrap: nowrap; }
  .sheet-bar select, #sheetCols { flex: none; }
  #sheetCam { flex: 0 1 auto; min-width: 8em; max-width: 16em; }   /* a long camera name gives way (the select clips it) */
  #sheetCols button { height: calc(var(--ctl-h-sm) - 2px); }   /* the group as tall as the selects beside it: the bar stays 41 px */
  #sheetRange { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-hint { flex: 0 1 auto; min-width: 0; margin-left: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
