@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/BricolageGrotesque.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #171b2d;
  --panel: #181828;
  --panel-hover: #1e1e32;
  --line: #272b45;
  --ink: #e9ebf3;
  --dim: #8b90a7;
  --accent: #ffa600;
  --free: #3ed598;
  --busy: #ff6b5e;
  --stale: #ffa600;
  --offline: #5c617a;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- header ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(0.8rem, 2vh, 1.4rem) clamp(1.2rem, 2.5vw, 2.4rem);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-family: var(--mono);
  font-size: clamp(0.65rem, 1.1vh, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--dim);
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 1.8vw, 1.6rem);
}

.brand .logo {
  height: clamp(2rem, 5vh, 3.2rem);
  width: auto;
  display: block;
}

.brand h1 {
  border-left: 1px solid var(--line);
  padding-left: clamp(0.9rem, 1.8vw, 1.6rem);
  font-size: clamp(1.4rem, 3.4vh, 2.4rem);
  font-weight: 700;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.clock { text-align: right; }

.time {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.6rem, 4vh, 2.7rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.date {
  font-size: clamp(0.75rem, 1.6vh, 1.05rem);
  color: var(--dim);
}

/* ---------- layout ---------- */

.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: clamp(1rem, 2vw, 2rem);
  padding: clamp(1rem, 2.2vh, 1.8rem) clamp(1.2rem, 2.5vw, 2.4rem);
}

/* ---------- floor plan ---------- */

.plan-wrap {
  flex: 1.15;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan {
  position: relative;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 649 / 839;
  background: #1d2330; /* matches the rendered plan's background */
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.plan img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plan svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.area { transition: fill 0.6s, stroke 0.6s; }

.area.free   { fill: rgba(62, 213, 152, 0.30); stroke: var(--free); }
.area.busy   { fill: rgba(255, 107, 94, 0.34); stroke: var(--busy); }
.area.stale  { fill: rgba(255, 166, 0, 0.26); stroke: var(--stale); }
.area.offline{ fill: rgba(92, 97, 122, 0.24);  stroke: var(--offline); stroke-dasharray: 6 5; }

.area { stroke-width: 2; vector-effect: non-scaling-stroke; }

.area.busy { animation: breathe 4s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { fill: rgba(255, 107, 94, 0.26); }
  50%      { fill: rgba(255, 107, 94, 0.44); }
}

@media (prefers-reduced-motion: reduce) {
  .area.busy { animation: none; }
}

.area-name {
  font-family: var(--display);
  font-weight: 700;
  fill: var(--ink);
  paint-order: stroke;
  stroke: rgba(23, 27, 45, 0.75);
  stroke-width: 3px;
}

.area-sub {
  font-family: var(--mono);
  font-weight: 500;
  fill: var(--dim);
  paint-order: stroke;
  stroke: rgba(23, 27, 45, 0.75);
  stroke-width: 3px;
}

.area-sub.free { fill: var(--free); }
.area-sub.busy { fill: var(--busy); }
.area-sub.stale { fill: var(--stale); }

/* ---------- room cards ---------- */

.rooms {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: clamp(0.6rem, 1.4vh, 1rem);
  align-content: stretch;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--offline);
  border-radius: 10px;
  padding: clamp(0.7rem, 1.8vh, 1.2rem) clamp(0.8rem, 1.6vw, 1.3rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 0;
}

.card.free   { border-left-color: var(--free); }
.card.busy   { border-left-color: var(--busy); }
.card.stale  { border-left-color: var(--stale); }

.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }

.card-name {
  font-size: clamp(1.05rem, 2.6vh, 1.7rem);
  font-weight: 700;
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-cap {
  font-family: var(--mono);
  font-size: clamp(0.7rem, 1.5vh, 0.95rem);
  color: var(--dim);
  white-space: nowrap;
}

.card-status {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(0.85rem, 2vh, 1.25rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card.free  .card-status { color: var(--free); }
.card.busy  .card-status { color: var(--busy); }
.card.stale .card-status { color: var(--stale); }
.card.offline .card-status { color: var(--offline); }

.card-env {
  display: flex;
  gap: clamp(1.2rem, 2.4vw, 2.4rem);
  white-space: nowrap;
}

.env-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  min-width: 0;
}

.env-label {
  font-family: var(--mono);
  font-size: clamp(0.55rem, 1.2vh, 0.75rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.env-value {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(0.95rem, 2.3vh, 1.5rem);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* offline rooms: hide the stats, show a note instead */
.card-env.nodata .env-stat { display: none; }

.card-env.nodata::before {
  content: attr(data-msg);
  font-family: var(--mono);
  font-size: clamp(0.7rem, 1.6vh, 1rem);
  color: var(--dim);
}

.offline-banner {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: rgba(255, 166, 0, 0.12);
  border: 1px solid var(--stale);
  color: var(--stale);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
}

/* portrait displays: plan on top, cards below */
@media (orientation: portrait) {
  .layout { flex-direction: column; }
  .plan-wrap { flex: 1.4; }
  .rooms { flex: 1; }
}
