/* Public event board on the home page — one event per row, filters beside it.

   Design tokens live here because this sheet is loaded only by index.html.
   They exist mainly so the board stops hardcoding light-theme colours: the tag
   chips, the LIVE badge and every shadow used to be fixed light values, which
   read as lit patches on a dark page. Each one now has a dark counterpart.

   Depth comes from layered shadow over a hairline ring rather than a 1px grey
   border — borders make every surface equally loud, so nothing leads. */
:root {
  --bd-radius: 16px;
  --bd-radius-sm: 10px;
  --bd-accent: #7c3aed;
  --bd-accent-hover: #6d28d9;
  --bd-accent-soft: rgba(124, 58, 237, 0.09);
  --bd-accent-line: rgba(124, 58, 237, 0.20);
  --bd-accent-glow: rgba(124, 58, 237, 0.16);
  --bd-ring: rgba(16, 18, 27, 0.08);
  --bd-ring-strong: rgba(16, 18, 27, 0.14);
  --bd-shadow: 0 1px 2px rgba(16, 18, 27, 0.04), 0 6px 16px -12px rgba(16, 18, 27, 0.24);
  --bd-shadow-lift: 0 2px 4px rgba(16, 18, 27, 0.05), 0 18px 34px -20px rgba(16, 18, 27, 0.35);
  --bd-live: #dc2626;
  --bd-live-ink: #b91c1c;
  --bd-live-soft: #fee2e2;
  --bd-live-line: #fecaca;
  --bd-inset: rgba(16, 18, 27, 0.05);
}

[data-theme="dark"] {
  --bd-accent: #a78bfa;
  --bd-accent-hover: #c4b5fd;
  --bd-accent-soft: rgba(167, 139, 250, 0.13);
  --bd-accent-line: rgba(167, 139, 250, 0.26);
  --bd-accent-glow: rgba(167, 139, 250, 0.22);
  --bd-ring: rgba(255, 255, 255, 0.07);
  --bd-ring-strong: rgba(255, 255, 255, 0.13);
  --bd-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 20px -14px rgba(0, 0, 0, 0.7);
  --bd-shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.45), 0 22px 42px -22px rgba(0, 0, 0, 0.85);
  /* Desaturated so a LIVE chip reads as a label, not a warning light. */
  --bd-live: #f87171;
  --bd-live-ink: #fca5a5;
  --bd-live-soft: rgba(248, 113, 113, 0.13);
  --bd-live-line: rgba(248, 113, 113, 0.28);
  --bd-inset: rgba(0, 0, 0, 0.25);
}

.board-section {
  margin: 0 0 2.25rem;
}

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.board-head h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.board-count {
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--bd-accent-soft);
  color: var(--bd-accent);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Search sits above everything — the fastest path to one known event. */
.board-search {
  position: relative;
  margin-bottom: 1.1rem;
}
.board-search input {
  width: 100%;
  padding: 0.85rem 2.6rem 0.85rem 2.7rem;
  font: inherit;
  color: var(--text, #1a1a1a);
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring);
  border-radius: 999px;
  box-shadow: var(--bd-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.board-search input::placeholder { color: var(--text-muted, #5c5c5c); opacity: 0.75; }
.board-search input:hover { border-color: var(--bd-ring-strong); }
.board-search input:focus {
  outline: none;
  border-color: var(--bd-accent);
  box-shadow: 0 0 0 4px var(--bd-accent-glow);
}
.board-search-icon {
  position: absolute;
  left: 1.05rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}
.board-search-clear {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.45rem;
  border-radius: 50%;
  color: var(--text-muted, #5c5c5c);
}
.board-search-clear:hover { background: var(--border, #e5e7eb); }

.board-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* ── Filters ─────────────────────────────────────────────────────────── */
.board-filters {
  position: sticky;
  top: 1rem;
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  padding: 1.1rem 1.15rem 1.2rem;
}
.board-filter-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #5c5c5c);
  margin: 0 0 0.75rem;
}
.board-field { margin-bottom: 0.85rem; }
.board-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.board-field select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text, #1a1a1a);
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring-strong);
  border-radius: var(--bd-radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.board-field select:focus {
  outline: none;
  border-color: var(--bd-accent);
  box-shadow: 0 0 0 3px var(--bd-accent-glow);
}
.board-reset {
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted, #5c5c5c);
  background: none;
  border: 1px solid var(--bd-ring-strong);
  border-radius: var(--bd-radius-sm);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.board-reset:hover { background: var(--bg, #fafafa); color: var(--text, #1a1a1a); }

/* ── One event per row ───────────────────────────────────────────────── */
.board-list { display: flex; flex-direction: column; gap: 0.75rem; }

.board-row {
  position: relative;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 0 1.25rem;
  align-items: center;
  padding: 0.95rem 1.15rem;
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.board-row:hover {
  border-color: var(--bd-ring-strong);
  box-shadow: var(--bd-shadow-lift);
  transform: translateY(-2px);
}

/* Status rail. An inset rounded bar rather than border-left: it does not add to
   the box, so a live row lines up with a plain one instead of shifting 4px. */
.board-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 0.18s ease;
}
.board-row.is-live::before { background: var(--bd-live); }
.board-row.is-today::before { background: var(--bd-accent); }

.board-media {
  width: 140px;
  height: 92px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bd-inset);
  display: block;
  box-shadow: inset 0 0 0 1px var(--bd-ring);
}
/* Generated date tile shown when an event has no media of its own.
   Colours live here rather than in the JS so the tile follows the theme: on a
   dark page the old hardcoded white card and pale tint read as a lit panel.
   Dark uses lighter ink on a deep tint — same hierarchy, inverted. */
.board-media-ph {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ph-tint);
  --ph-ink: #64748b;
  --ph-tint: #f4f6f8;
  --ph-card: #ffffff;
  --ph-on-ink: #ffffff;
}
.board-media-ph[data-kind="rsvp"] { --ph-ink: #7c3aed; --ph-tint: #f5f0ff; }
.board-media-ph[data-kind="reg"]  { --ph-ink: #2563eb; --ph-tint: #eff5ff; }

[data-theme="dark"] .board-media-ph {
  --ph-ink: #98a2b3;
  --ph-tint: #1a1b1e;
  --ph-card: #212228;
  /* Ink is light in dark mode, so the month band needs dark text on it. */
  --ph-on-ink: #16161a;
}
[data-theme="dark"] .board-media-ph[data-kind="rsvp"] { --ph-ink: #a78bfa; --ph-tint: #1e1a2b; }
[data-theme="dark"] .board-media-ph[data-kind="reg"]  { --ph-ink: #7aa2f7; --ph-tint: #161d2c; }
.board-media-ph svg {
  width: 100%;
  height: 100%;
  display: block;
  /* SVG text does not inherit the page font automatically in every engine. */
  font-family: 'DM Sans', system-ui, sans-serif;
}

.board-body { min-width: 0; }
.board-title {
  margin: 0 0 0.28rem;
  font-size: 1.12rem;
  font-weight: 680;
  line-height: 1.28;
  letter-spacing: -0.011em;
}
/* Inline text flow rather than flex: with flex, a wrapping meta row stranded
   its separator at the end of the line. As text, the dot stays glued to the
   item it introduces. */
.board-meta {
  margin: 0;
  font-size: 0.855rem;
  line-height: 1.55;
  color: var(--text-muted, #5c5c5c);
}
.board-meta-item { white-space: nowrap; }
.board-meta-item + .board-meta-item::before {
  content: "·";
  margin-right: 0.4rem;
  opacity: 0.42;
}
.board-meta-icon {
  width: 0.92em;
  height: 0.92em;
  margin-right: 0.32em;
  vertical-align: -0.14em;
  opacity: 0.75;
}
.board-desc {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted, #5c5c5c);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.board-tags-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.board-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}
.board-tag {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bd-accent);
  background: var(--bd-accent-soft);
  border: 1px solid var(--bd-accent-line);
}

.board-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--bd-live-ink);
  background: var(--bd-live-soft);
  border: 1px solid var(--bd-live-line);
}
.board-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bd-live);
  animation: boardPulse 1.8s ease-in-out infinite;
}
@keyframes boardPulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.25 } }
@media (prefers-reduced-motion: reduce) {
  .board-live-dot { animation: none }
  .board-row:hover { transform: none }
}

.board-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: stretch;
  align-self: stretch;
  justify-content: flex-start;
  min-width: 8.5rem;
}

.board-btn {
  display: inline-block;
  padding: 0.48rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 640;
  text-align: center;
  text-decoration: none;
  border-radius: var(--bd-radius-sm);
  border: 1px solid transparent;
  color: var(--bd-accent);
  background: var(--bd-accent-soft);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.board-btn:hover {
  background: var(--bd-accent-line);
  text-decoration: none;
}
.board-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--bd-accent-glow);
}
/* One filled action per row so the eye lands on the thing worth doing. */
.board-btn-primary {
  background: var(--bd-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(16, 18, 27, 0.12);
}
.board-btn-primary:hover { background: var(--bd-accent-hover); color: #fff; }
[data-theme="dark"] .board-btn-primary { color: #1b1524; }
[data-theme="dark"] .board-btn-primary:hover { color: #1b1524; }

/* Compact capacity chip — sits at bottom-right; click opens View names (PIN). */
.board-rsvp-progress {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  width: 100%;
  margin: auto 0 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--bd-ring);
  border-radius: var(--bd-radius-sm);
  background: var(--bd-inset);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.board-rsvp-progress:hover {
  border-color: var(--bd-accent-line);
  background: var(--bd-accent-soft);
}
.board-rsvp-progress:focus-visible {
  outline: 2px solid var(--event-nav-accent, #7c3aed);
  outline-offset: 2px;
}
.board-rsvp-bar {
  display: block;
  height: 0.32rem;
  border-radius: 999px;
  background: var(--bd-ring-strong);
  overflow: hidden;
}
.board-rsvp-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bd-accent), var(--bd-accent-hover));
  border-radius: inherit;
}
.board-rsvp-count {
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.1;
  color: var(--text-muted, #5c5c5c);
  white-space: nowrap;
}

.board-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted, #5c5c5c);
  background: var(--bd-inset);
  border: 1px solid var(--bd-ring);
  border-radius: var(--bd-radius);
}

.board-day {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.5rem 0 0.6rem;
  padding: 0.35rem 0;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted, #5c5c5c);
  background: var(--bg, #fafafa);
}
/* Hairline running to the right edge, so the label reads as a divider. */
.board-day::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--bd-ring-strong);
}
.board-day:first-child { margin-top: 0; }

@media (max-width: 860px) {
  .board-layout { grid-template-columns: 1fr; }
  .board-filters { position: static; }
  /* Media above text once the row is too narrow to hold three columns. */
  .board-row { grid-template-columns: 1fr; gap: 0.7rem; }
  .board-media { width: 100%; height: 158px; }
  /* A sticky divider needs the page background to hide rows passing beneath it. */
  .board-day { top: 0; }

  /* Real artwork earns the full-width slot. The generated date tile does not —
     at 158px tall it let one event fill the whole screen. Where the row falls
     back to the placeholder, shrink it to a badge and put the title alongside,
     so a phone shows three or four events instead of one. */
  .board-row:has(.board-media-ph) {
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: start;
    column-gap: 0.85rem;
  }
  .board-row:has(.board-media-ph) .board-media-ph { width: 92px; height: 62px; }
  .board-row:has(.board-media-ph) .board-actions { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .board-meta-item { display: block; }
  .board-meta-item + .board-meta-item::before { content: none; }
  .board-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; align-self: stretch; }
  .board-btn { flex: 1 1 auto; }
  .board-rsvp-progress {
    flex: 1 1 6.5rem;
    margin: 0;
    max-width: none;
  }
}

/* ── In session now ───────────────────────────────────────────────────────
   Rooms occupied at this moment, above the event board. One line per room:
   room, who, until when. Hidden entirely whenever nothing is in use, which is
   most of the day — so it must stay cheap to skip and never leave a gap. */
.rooms-now {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 0.95rem 1.15rem 1rem;
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  overflow: hidden;
}
.rooms-now::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--bd-accent);
}
.rooms-now[hidden] { display: none !important; }

.rooms-now-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.rooms-now-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #5c5c5c);
}
.rooms-now-all {
  font-size: 0.82rem;
  font-weight: 640;
  color: var(--bd-accent);
  text-decoration: none;
  white-space: nowrap;
}
.rooms-now-all:hover { text-decoration: underline; }

.rooms-now-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rooms-now-item {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.3rem 0;
  font-size: 0.95rem;
  line-height: 1.35;
}
.rooms-now-item + .rooms-now-item {
  border-top: 1px solid var(--bd-ring);
}

/* Filled = in the room now, hollow = doors open, starting within 10 minutes. */
.rooms-now-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
  transform: translateY(-1px);
}
[data-theme="dark"] .rooms-now-dot {
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
.rooms-now-dot.is-soon,
[data-theme="dark"] .rooms-now-dot.is-soon {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--text-muted, #5c5c5c);
  opacity: 0.6;
}

.rooms-now-room {
  font-weight: 700;
  white-space: nowrap;
}
.rooms-now-who {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted, #5c5c5c);
}
.rooms-now-time {
  flex: none;
  margin-left: auto;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #5c5c5c);
  white-space: nowrap;
}

@media (max-width: 520px) {
  /* Room and time hold the line; the name drops beneath rather than truncating
     to a couple of characters. */
  .rooms-now-item { flex-wrap: wrap; row-gap: 0.1rem; }
  .rooms-now-who {
    flex: 1 0 100%;
    margin-left: 1.1rem;
    font-size: 0.88rem;
  }
}

/* ── Mobile filter collapse ───────────────────────────────────────────────
   On a phone the filter panel used to sit between the search box and the first
   event, so the whole first screen was chrome. Collapsed behind a button, with
   a count so an applied filter is never invisible while hidden. */
.board-filters-toggle {
  display: none;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 640;
  color: var(--text, #1a1a1a);
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring);
  border-radius: var(--bd-radius-sm);
  box-shadow: var(--bd-shadow);
  cursor: pointer;
}
.board-filters-count {
  min-width: 1.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--bd-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
[data-theme="dark"] .board-filters-count { color: #1b1524; }
.board-filters-count[hidden] { display: none; }
.board-filters-chevron {
  margin-left: auto;
  transition: transform 0.15s ease;
}
.board-filters-toggle[aria-expanded="true"] .board-filters-chevron {
  transform: rotate(180deg);
}

@media (max-width: 860px) {
  .board-filters-toggle { display: flex; }
  /* Collapsed by default — the events are why anyone opened the page. */
  .board-filters { display: none; }
  .board-filters.is-open { display: block; }
  /* The button directly above already says "Filters". */
  .board-filters .board-filter-title { display: none; }
}

/* ── Post a document link ─────────────────────────────────────────────────
   Shown in the detail modal when an event names a document but has no link
   behind it yet. Deliberately plain: it is a small utility form inside a
   reading surface, not a call to action competing with the event itself. */
.board-doc-hint {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted, #5c5c5c);
}
.board-doc-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.5rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text, #1a1a1a);
  background: var(--surface, #fff);
  border: 1px solid var(--bd-ring-strong);
  border-radius: var(--bd-radius-sm);
}
.board-doc-input:focus {
  outline: none;
  border-color: var(--bd-accent);
  box-shadow: 0 0 0 3px var(--bd-accent-glow);
}
.board-doc-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.board-doc-status {
  font-size: 0.85rem;
  color: var(--text-muted, #5c5c5c);
}
.board-doc-status.is-error { color: #b91c1c; }
[data-theme="dark"] .board-doc-status.is-error { color: #fca5a5; }

/* Signup roster in the detail modal: one wrapping line of numbered names, so a
   long list stays scannable without becoming a column of its own. */
#boardSignupsBody {
  line-height: 1.6;
  word-break: break-word;
}
