/* Page-local 14-room grid (Dec 1, 2026). Markup and tile styles match
   the live /quake/ and /calculator/ "Elsewhere in the house" grid.
   Cozy on (html.rc-compact, from labs_rooms_compact / ?compact=1) hides
   the grid; toggling Cozy shows it again. Ultra (sideways-phone) hides
   it so the map or board can fill the screen. */
.rg-rooms {
  --rg-acc: #0F766E;
  --rg-card: var(--k5-bg, var(--paper, #fff));
  --rg-soft: var(--k5-soft, var(--paper-2, #F4F5F6));
  --rg-ink: var(--k5-ink, var(--ink, #11161C));
  --rg-line: var(--k5-line, var(--line, rgba(17,22,28,.12)));
  --rg-mut: var(--k5-mut, var(--ink-55, rgba(17,22,28,.55)));
  --rg-dim: var(--ink-77, rgba(17,22,28,.77));
  --rg-paper: var(--k5-bg, var(--paper, #fff));
  padding-block: clamp(36px, 5vw, 64px);
  padding-top: 0;
  color: var(--rg-ink);
}
html[data-dark] .rg-rooms,
html[data-edition="dark"] .rg-rooms {
  --rg-acc: #5EEAD4;
  --rg-card: #131A21;
  --rg-soft: #1A2129;
  --rg-ink: #E8EEF3;
  --rg-line: rgba(255,255,255,.12);
  --rg-mut: rgba(232,238,243,.62);
  --rg-dim: rgba(232,238,243,.77);
  --rg-paper: #131A21;
}
.rg-sechead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.rg-sechead .d2 { margin: .3rem 0 0; }
.rg-sechead__a {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rg-ink);
  text-decoration: none;
  display: inline-flex;
  gap: .4rem;
}
.rg-sechead__a:hover { color: var(--rg-acc); }
.rg-rmgrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 1180px) { .rg-rmgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 860px)  { .rg-rmgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .rg-rmgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } }
@media (max-height: 500px) and (orientation: landscape) {
  .rg-rmgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.rg-rm {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "g c" "t t";
  align-items: center;
  gap: 8px 6px;
  padding: 11px 12px 10px;
  border: 1px solid var(--rg-line);
  border-radius: 12px;
  background: var(--rg-card);
  color: var(--rg-ink);
  text-decoration: none;
  min-width: 0;
  transition: border-color .2s, background .2s, transform .2s;
}
.rg-rm:hover { border-color: var(--rg-dim); background: var(--rg-soft); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .rg-rm:hover { transform: none; } }
.rg-rm__g {
  grid-area: g;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--rg-soft);
  color: var(--rg-ink);
}
.rg-rm__g svg { width: 18px; height: 18px; }
.rg-rm__c {
  grid-area: c;
  justify-self: end;
  font-size: .74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--rg-dim);
  padding: .1rem .45rem;
  border-radius: 6px;
  background: var(--rg-soft);
}
.rg-rm__t { grid-area: t; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.rg-rm__t b { font-size: .88rem; font-weight: 600; }
.rg-rm__t > span {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .68rem;
  color: var(--rg-mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rg-rm__t > span .livedot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16A34A;
  display: inline-block;
}
.rg-rm.is-here { border-color: var(--rg-ink); box-shadow: inset 0 0 0 1px var(--rg-ink); }
.rg-rm.is-here .rg-rm__g { background: var(--rg-ink); color: var(--rg-paper); }
.rg-rm__here {
  position: absolute;
  top: -8px;
  left: 50px;
  font-size: .54rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .1rem .4rem;
  border-radius: 5px;
  background: var(--rg-ink);
  color: var(--rg-paper);
}
.rg-rm--aside { border-style: dashed; }
@media (max-width: 620px) {
  .rg-rm { padding: 9px 10px; }
  .rg-rm__g { width: 28px; height: 28px; }
  .rg-rm__here { left: auto; right: 8px; }
}

/* Cozy on = room grid off. Ultra (sideways phone) also hides it. */
html.rc-compact #rooms,
html.k5-ultra #rooms { display: none !important; }

@media print { .rg-rooms { display: none !important; } }

/* Tighten the void between the last page-content band and the room grid.
   Shared site.css gives the last .band in main a full --band bottom padding
   (~92px on a 1440 desk, 56px on a phone) because #rooms sits after </main>,
   so it is not a sibling of that band. Drop that leftover and add a short gap. */
main > .band:last-of-type,
main > section:last-of-type {
  padding-bottom: 0;
}
main > .band:last-of-type .wrap,
main > section:last-of-type .wrap {
  display: flow-root;
}
main > .band:last-of-type .wrap > :last-child,
main > section:last-of-type .wrap > :last-child,
main > .band:last-of-type p:last-of-type,
main > section:last-of-type p:last-of-type,
main > .band:last-of-type dd:last-of-type,
main > section:last-of-type dd:last-of-type {
  margin-bottom: 0;
}
main > .band:last-of-type article,
main > section:last-of-type article,
#wire article,
#wire .w {
  padding-bottom: 0;
}
main > .band:last-of-type details:last-of-type,
main > section:last-of-type details:last-of-type {
  padding-bottom: 0;
}
#rooms.rg-rooms,
#rooms.band {
  padding-top: 32px;
  margin-top: 0;
}
@media (max-width: 620px) {
  #rooms.rg-rooms,
  #rooms.band { padding-top: 20px; }
}
