/* The Mur tab and /mur (wall.js): one cell per camera, every car park's, each its own car park's embedded page in a
   frame, and the camera chosen beside them on a wide screen, under them on a phone. Built on app.css (linked before
   this one) for the colours and the buttons. A cell is as wide as a column and 16:9, so the tile inside keeps the
   camera's shape; across the screen the rows share the screen's height instead. A frame never moves in the page (it
   would load again): where a cell shows is its order, and the big one is data-big. */

.wall-tab {
  /* The wall's columns in Auto, as wide as the tab leaves them. */
  --wall-cols: 2;
  --wall-gap: .5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

/* The container its grid's cells are measured from (100cqi below): the wall's own width, not the window's. */
.wall-area { position: relative; min-width: 0; container-type: inline-size; }

.wall-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  min-height: var(--tap);
  margin-bottom: .5rem;
}
.wall-bar p { margin: 0; }
.wall-bar #wall-hint { flex: 1 1 14rem; }
.wall-tools { display: flex; gap: .5rem; }
.wall-bar button, .wall-bar .button { width: auto; min-height: var(--tap); padding-inline: 1rem; }
.wall-bar button[aria-pressed="true"] {
  --fill: var(--accent-fill);
  --fill-hover: var(--accent-fill-hover);
  --fill-active: var(--accent-fill-hover);
  border-color: transparent;
  color: var(--on-accent);
}

/* The layouts, as one row of buttons. */
.wall-layouts { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.wall-layouts > span { margin-right: .25rem; color: var(--muted); font-size: .875rem; }
.wall-bar .wall-layouts button { min-width: var(--tap); padding-inline: .75rem; }
.wall-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.wall-actions .icon { width: 1.125rem; height: 1.125rem; }

.wall-grid {
  --cols: var(--wall-cols);
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  /* A cell: a column's width at 16:9. */
  grid-auto-rows: calc((100cqi - (var(--cols) - 1) * var(--wall-gap)) / var(--cols) * 9 / 16);
  /* The big one goes first; the others fill the places it leaves. */
  grid-auto-flow: row dense;
  gap: var(--wall-gap);
}
.wall-grid[data-layout="2"] { --cols: 2; }
.wall-grid[data-layout="3"], .wall-grid[data-layout="focus"] { --cols: 3; }
.wall-grid[data-layout="4"] { --cols: 4; }

.wall-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #000;
}
.wall-cell[data-big] { grid-column: span 2; grid-row: span 2; }
/* A car park whose gateway is older than one frame per camera: all its cameras in its one cell. */
.wall-site-cell[data-wide] { grid-column: span 2; }
.wall-cell[data-picked] { box-shadow: 0 0 0 2px var(--accent); }
/* Its size is the grid's, never its content's: the cover below fits itself to it. */
.wall-cell { container: wall-cell / size; }
.wall-frame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }

/* A car park with cameras to show: its own cell steps aside, out of the grid, its list frame still running (for its
   calls and its next hello). Drawn, not display: none, so that no browser takes the frame for gone. */
.wall-site-cell[data-quiet] {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  pointer-events: none;
}

/* Left off by the filter (Parkings): out of the grid as a quiet cell is, its frame kept and stopped (wall.js). */
.wall-cell[data-off] {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  pointer-events: none;
}

/* The car park left on alone: its button stays pressed, and says it can't go (its title). */
.wall-bar button[aria-disabled="true"] { cursor: not-allowed; }

/* A car park's cell while it has no camera to show: its name, and what its page says, under the page's own words. */
.wall-cell-name {
  position: absolute;
  left: .25rem;
  bottom: .25rem;
  z-index: 1;
  display: flex;
  gap: .5rem;
  max-width: calc(100% - .5rem);
  margin: 0;
  padding: .125rem .5rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--scrim);
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}
.wall-site-state { color: var(--muted); font-weight: 400; }
.wall-site-state:empty { display: none; }
.wall-cell[data-page="login"] .wall-site-state { color: var(--warn-text); }
.wall-cell[data-page="offline"] .wall-site-state { color: var(--bad-text); }

/* A call on the camera's lane: a ring round the picture and the station's name on it. */
.wall-cell[data-call]::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  box-shadow: inset 0 0 0 4px var(--mark-call);
  pointer-events: none;
}
.wall-call-tag {
  position: absolute;
  top: .25rem;
  right: .25rem;
  z-index: 2;
  max-width: calc(100% - .5rem);
  margin: 0;
  padding: .125rem .625rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--mark-call);
  color: #14181d;
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}
.wall-cell[data-big] .wall-call-tag { top: .5rem; right: .5rem; padding: .25rem .875rem; font-size: 1.125rem; }

/* Out of reach: over the frame, whatever page the browser put in it. */
.wall-site-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem;
  background: var(--bg);
  text-align: center;
}
.wall-site-cover[hidden] { display: none; }
.wall-site-cover p { margin: 0; color: var(--bad-text); overflow-wrap: anywhere; }
.wall-site-cover button { width: auto; min-width: 8rem; min-height: var(--tap); }
.wall-cover-short { display: none; }

/* A phone's cell (about 167 x 94 px): one word and a smaller button, still 32 px to touch. The whole sentence stays
   the cover's title and name. */
@container wall-cell (height < 8rem) or (width < 14rem) {
  .wall-site-cover { gap: .25rem; padding: .25rem; }
  .wall-site-cover p { font-size: .8125rem; line-height: 1.2; }
  .wall-cover-long { display: none; }
  .wall-cover-short { display: inline; }
  .wall-site-cover button { min-width: 0; min-height: 2rem; padding: .125rem .75rem; font-size: .8125rem; }
}

/* One camera alone: its cell across the wall, at the camera's shape, never taller than the window leaves. */
.wall-grid[data-single] { grid-auto-rows: auto; }
.wall-grid[data-single] .wall-cell:not([data-alone], [data-quiet], [data-off]) { display: none; }
.wall-grid[data-single] .wall-cell[data-alone] {
  grid-column: 1 / -1;
  grid-row: auto;
  height: min(calc(100cqi * 9 / 16), calc(100vh - 12rem));
  min-height: 12rem;
}

/* ---- Across the screen: the browser's full screen (the app's Plein écran), the window where it is refused, and
   always on /mur. Edge to edge, 2 px between cameras, the bar over the top and gone when nothing moves. */
.wall-area[data-full] {
  position: fixed;
  inset: 0;
  /* Over the app's header, tab bar and menus (app.css, up to 70); under its alerts and the camera's own full screen. */
  z-index: 90;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #000;
}
.wall-area[data-full]::backdrop { background: #000; }
.wall-area[data-full] .wall-grid {
  height: 100%;
  gap: 2px;
  grid-template-columns: repeat(var(--full-cols, 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--full-rows, 1), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.wall-area[data-full] .wall-cell { border-radius: 0; }
.wall-area[data-full] .wall-cell[data-picked] { box-shadow: none; }
.wall-area[data-full] .wall-grid[data-single] .wall-cell[data-alone] { grid-column: auto; height: auto; min-height: 0; }
.wall-area[data-full] .wall-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  margin: 0;
  padding: .75rem 1rem 2rem;
  background: linear-gradient(rgb(0 0 0 / .85), transparent);
  transition: opacity .2s;
}
.wall-area[data-full] #wall-hint { display: none; }
.wall-area[data-full][data-idle] .wall-bar { opacity: 0; pointer-events: none; }
/* The strip that brings the bar back: a pointer over a camera's frame reaches only the frame. */
.wall-hot { display: none; }
.wall-area[data-full][data-idle] .wall-hot { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: block; height: 2.5rem; }
@media (prefers-reduced-motion: reduce) {
  .wall-area[data-full] .wall-bar { transition: none; }
}

/* /mur: the page is the wall. */
html.mur, html.mur body { height: 100%; margin: 0; overflow: hidden; background: #000; }
.wall-kiosk-title { margin: 0 .5rem 0 0; font-size: 1rem; }

.wall-panel { min-width: 0; padding: 1rem; border-radius: var(--radius); background: var(--panel); }
.wall-panel h2 { margin: 0 0 .5rem; overflow-wrap: anywhere; }
.wall-panel-body > .sub:first-child { margin-top: 0; }

/* The lanes of the camera chosen: that car park's own app in its lane mode, framed (wall.js, showLane). The frame has
   its own scroll; on a phone it is most of the window under the wall, beside it the window's height. */
.wall-panel[data-lane] { padding: .5rem; }
.wall-panel[data-lane] h2 { margin: .25rem .5rem .5rem; font-size: 1rem; }
.wall-lane { position: relative; height: 80dvh; min-height: 20rem; overflow: hidden; border-radius: var(--radius); background: var(--bg); }
.wall-lane-frame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.wall-lane-open { display: inline-block; margin: .5rem .5rem .25rem; font-size: .875rem; }

/* Wider than a phone (700 px): the wall on the left, the camera chosen in a column on the right, kept in view. */
/* The column is wide enough for a lane bar of two or three lanes on one row (feed.css: under 38rem a lane shows its
   newest read only). */
@media (width > 43.75rem) {
  .wall-tab { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
  .wall-panel { position: sticky; top: 1rem; }
  .wall-lane { height: calc(100dvh - 9rem); }
}
@media (width >= 68.75rem) {
  .wall-tab { --wall-cols: 3; grid-template-columns: minmax(0, 1fr) 24rem; }
}
@media (width >= 100rem) {
  .wall-tab { --wall-cols: 4; grid-template-columns: minmax(0, 1fr) 30rem; }
}

/* ---- The other side: this car park's app framed in a Mur (/embed/lane, data-embed="lane" on the root; app.js,
   embedded). The lane bar, the search and the events, nothing of the app around them: no header nor tabs, no camera,
   screens, calls or VPN help. The sas boom shows in the exit lane's card only, as the wall's camera is the picture. */
html[data-embed="lane"] header,
html[data-embed="lane"] #vpn,
html[data-embed="lane"] #call-panel,
html[data-embed="lane"] #call-screen,
html[data-embed="lane"] #camera,
html[data-embed="lane"] .live-main > #sas { display: none !important; }
html[data-embed="lane"] main,
html[data-embed="lane"] main.app { max-width: none; padding: .5rem; }
html[data-embed="lane"] .live { display: block; }
html[data-embed="lane"] .live-main { position: static; max-height: none; overflow: visible; margin: 0; padding: 0; }
.embed-login { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: .5rem; }
.embed-login p { margin: 0; }
.embed-login .button { width: auto; }
