/* Meeting room board — designed to be read from across the room. */

:root {
  /* Brand */
  --brand: #f2582c;
  --brand-strong: #d4441c;
  --brand-wash: #fdf0eb;

  /* Neutrals, warmed slightly so the board doesn't feel clinical */
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-alt: #fbfaf9;
  --line: #e8e5e0;
  --line-soft: #f0ede9;

  --ink: #17191d;
  --ink-2: #5d626b;
  --ink-3: #949aa3;

  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 12px 32px -16px rgba(20, 22, 26, 0.16);
  --radius: 16px;
  --radius-sm: 10px;

  --fs: 1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: calc(16px * var(--fs));
  font-feature-settings: "cv05" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.6vh 1.4vw 2.4vh;
  gap: 1.4vh;
}

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

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "brand actions clock";
  align-items: center;
  gap: 1.2vw;
  padding: 0 0.4vw;
}

.clock .date {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.clock .time {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;   /* stops the clock jittering */
}
.clock .next-refresh {
  margin-top: 0.15em;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.brand { display: flex; align-items: center; grid-area: brand; justify-self: start; text-align: left; margin-left: -0.4vw; }
.brand img { max-height: 7.5vh; max-width: 24vw; display: block; margin-left: 0; }
.clock { grid-area: clock; justify-self: end; text-align: right; }
.actions { grid-area: actions; justify-self: end; }
.brand .fallback {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5vw; justify-content: flex-end; }
.actions a {
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  padding: 0.6em 1.15em;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(212, 68, 28, 0.2), 0 8px 18px -10px rgba(212, 68, 28, 0.5);
}

/* ---------- board ---------- */

/* Rows size to their content, so every event is shown and the board grows
   past the viewport on a busy day rather than hiding anything. */
.board {
  flex: 1;
  display: grid;
  grid-auto-rows: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.row { display: grid; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row:not(.head) { min-height: 15vh; }
.row.stripe { background: var(--surface-alt); }

.row.today { background: #fff9f6; }
.row.today .daycell { box-shadow: inset 3px 0 0 var(--brand); }

.cell { min-width: 0; padding: 1.1vh 1.1vw; }
.cell + .cell { border-left: 1px solid var(--line-soft); }

/* Column headings: brand shows up as an underline, not a slab of orange. */
.head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.head .cell { padding: 1.2vh 1.1vw 0.9vh; }
.head .cell h2 {
  margin: 0;
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding-bottom: 0.45em;
  border-bottom: 3px solid var(--brand);
}
.head .cell .warn { margin-left: 0.4em; font-size: 1rem; line-height: 1; }

/* ---------- day column ---------- */

.daycell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.05em;
  background: transparent;
}
.daycell .dow {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.daycell .dom {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.daycell .mon {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-2);
}
.row.today .daycell .dow,
.row.today .daycell .dom { color: var(--brand-strong); }

.daycell .badge {
  margin-top: 0.5em;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--brand);
  color: #fff;
  padding: 0.3em 0.7em;
  border-radius: 999px;
}

/* ---------- events ---------- */

.events { display: flex; flex-direction: column; gap: 0.85vh; font-size: 1rem; }

/* Each entry gets its own accent colour, cycling down the column, so a stack
   of bookings reads as separate items at a glance. */
.event {
  --accent: #64748b;
  --accent-wash: #f4f6f8;
  padding: 0.35em 0.6em 0.4em 0.7em;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-wash);
  line-height: 1.25;
}

.event.c0 { --accent: #d94f1e; --accent-wash: #fdf1ec; }
.event.c1 { --accent: #0f766e; --accent-wash: #eaf6f4; }
.event.c2 { --accent: #4338ca; --accent-wash: #eeeefb; }
.event.c3 { --accent: #a16207; --accent-wash: #fbf4e5; }
.event.c4 { --accent: #9d174d; --accent-wash: #fceef3; }
.event.c5 { --accent: #0369a1; --accent-wash: #eaf4fa; }

.event .title {
  font-size: 1.05em;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.event .when {
  margin-top: 0.1em;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Happening right now outranks the cycling colours. */
.event.now {
  --accent: var(--brand);
  --accent-wash: var(--brand-wash);
  box-shadow: 0 1px 2px rgba(212, 68, 28, 0.12), 0 10px 24px -14px rgba(212, 68, 28, 0.55);
}
.event.now .title { color: var(--brand-strong); font-weight: 700; }
.event.now .when { color: var(--brand-strong); }

.event .pill {
  display: inline-block;
  margin-left: 0.5em;
  vertical-align: 0.1em;
  font-size: 0.65em;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: var(--brand);
  color: #fff;
  padding: 0.25em 0.6em;
  border-radius: 999px;
}

.event.past {
  --accent: #a9b0b8;
  --accent-wash: #f5f6f7;
}
.event.past .title { color: var(--ink-2); font-weight: 500; }
.event.past .when { color: var(--ink-3); }

.empty {
  font-size: 0.95em;
  font-weight: 500;
  color: var(--ink-3);
  opacity: 0.65;
}

/* ---------- status ---------- */

.status {
  position: fixed;
  right: 1vw;
  bottom: 1vh;
  z-index: 2;
  max-width: 60vw;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-3);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  padding: 0.35em 0.8em;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.status:empty { display: none; }
.status.error {
  color: #fff;
  background: #b3200b;
  border-color: #b3200b;
}

/* ---------- responsive / small screens ---------- */

@media (max-width: 820px) {
  #app {
    padding: 1vh 1.2vw 2vh;
    gap: 1vh;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 0.6vh;
    padding: 0;
    text-align: center;
  }
  .clock .date { font-size: 0.8rem; }
  .clock .time { font-size: 2rem; }
  .brand { order: -1; }
  .brand .fallback { font-size: 1.2rem; }
  .actions { justify-content: center; }

  /* Stack the board: one column, each day becomes its own card. */
  .board .row { grid-template-columns: 1fr !important; }
  .head { display: none; }

  .row:not(.head) {
    min-height: auto;
    padding: 0.8vh 0;
  }
  .row:not(.head) + .row:not(.head) { border-top: 1px solid var(--line-soft); }

  /* Day header becomes a compact strip above its categories. */
  .daycell {
    flex-direction: row;
    align-items: baseline;
    gap: 0.6em;
    padding: 0.8vh 1.1vw 0.4vh;
  }
  .daycell .dow { font-size: 0.8rem; }
  .daycell .dom { font-size: 1.6rem; }
  .daycell .mon { font-size: 0.85rem; }
  .daycell .badge { margin: 0 0 0 auto; }

  .cell { padding: 0.6vh 1.1vw; }
  .cell + .cell { border-left: none; border-top: 1px solid var(--line-soft); }

  .events { gap: 0.5vh; font-size: 0.9rem; }

  /* Keep the status pill from covering content on small screens. */
  .status {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: 92vw;
    text-align: center;
  }
}
