/* ============================================================
   BUREAU OF LOST TIMELINES — DIVISION ROOMS (rooms.html)
   Version: 2.0 (Dossier system)

   A room is a wire, not a record sheet, so it is the one surface in the
   Bureau that reads as two columns: the lines you belong to on the left,
   the traffic on the selected line on the right. Everything else about it
   is still Bureau paper — ink panel, hairline rules, a coloured rail down
   the left of a row.

   Colours keep their Bureau meanings: purple (the posting token) is a thing
   you belong to, phosphor is the machine confirming itself — a line you sent,
   a count of new traffic — amber is a section that is still open, and the
   deep red of a seal is only ever used on a closed room.
   ============================================================ */

.rooms-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) var(--s-7);
}

.rooms-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
}

/* ---------- the rail: the lines on this terminal ---------- */
.room-rail {
  background: var(--ink-1);
  background-image: var(--fibre);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-inset);
  padding: var(--s-3);
  position: sticky;
  top: var(--s-3);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
}

.rail-title {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--muted-strong);
}

.room-new-btn {
  background: transparent;
  border: 1px solid var(--cat-timeline);
  border-radius: var(--r-1);
  color: var(--cat-timeline);
  padding: 6px var(--s-2);
  min-height: 32px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease);
}

.room-new-btn:hover {
  background: var(--cat-timeline);
  color: var(--ink-0);
}

.room-new-btn:focus-visible {
  outline: 2px solid var(--cat-timeline);
  outline-offset: 2px;
}

.rail-lead {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  line-height: var(--lh-body);
  color: var(--muted);
  padding: var(--s-2) 0;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

/* A room card is a button: the whole card selects the line, so nothing on the
   rail needs a second click target to hunt for. */
.room-card {
  display: grid;
  gap: 3px;
  text-align: left;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-left: var(--spine) solid var(--cat-timeline);
  border-radius: var(--r-1);
  padding: var(--s-2);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease),
              background var(--dur-1) var(--ease);
}

.room-card:hover {
  border-color: var(--line-strong);
  background: var(--ink-3);
}

.room-card.active {
  border-color: var(--cat-timeline);
  background: var(--ink-3);
  box-shadow: 0 0 0 1px var(--cat-timeline);
}

.room-card:focus-visible {
  outline: 2px solid var(--cat-timeline);
  outline-offset: 2px;
}

/* A section that is still open carries the amber the Bureau uses for a live
   thing; a sealed one loses its colour entirely. */
.room-card.closed {
  border-left-color: var(--alert-deep);
  opacity: 0.62;
}

.rc-kind {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--folklore);
}

.room-card.closed .rc-kind {
  color: var(--muted);
}

.rc-title {
  font-family: var(--font-my);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--paper-bright);
  overflow-wrap: anywhere;
}

.rc-sub {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--paper-dim);
  overflow-wrap: anywhere;
}

.rc-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  color: var(--muted);
}

.rc-meta .rc-new {
  color: var(--phosphor-bright);
}

.rc-seal {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--alert-bright);
  border: 1px solid var(--alert-deep);
  border-radius: var(--r-1);
  padding: 2px 6px;
}

.room-empty {
  font-family: var(--font-my);
  font-size: var(--fs-label);
  line-height: 1.7;
  color: var(--muted-strong);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-2);
  padding: var(--s-5) var(--s-3);
}

.room-empty .my {
  color: var(--muted);
}

/* ---------- the stage: the selected line ---------- */
.room-stage {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}

.room-head {
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-top: var(--spine) solid var(--cat-timeline);
  border-radius: var(--r-2);
  padding: var(--s-3) var(--s-4);
}

.room-head-line {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.rh-kind {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--cat-timeline);
  white-space: nowrap;
}

.rh-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  line-height: var(--lh-snug);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--paper-bright);
  overflow-wrap: anywhere;
}

.rh-seal,
.rh-opened {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-1);
  border: 1px solid var(--line-strong);
  color: var(--muted-strong);
}

.rh-seal {
  color: var(--alert-bright);
  border-color: var(--alert-deep);
}

.room-head-my {
  font-family: var(--font-my);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--paper);
  margin-top: 4px;
}

.room-head-purpose {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: var(--lh-body);
  color: var(--muted-strong);
  margin-top: var(--s-2);
}

.room-head-purpose-my {
  font-family: var(--font-my);
  font-size: var(--fs-label);
  line-height: 1.7;
  color: var(--paper-dim);
}

.room-seal-btn {
  margin-top: var(--s-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  color: var(--muted-strong);
  padding: 6px var(--s-3);
  min-height: 32px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
}

.room-seal-btn:hover {
  color: var(--alert-bright);
  border-color: var(--alert-deep);
}

.room-seal-btn:focus-visible {
  outline: 2px solid var(--alert-bright);
  outline-offset: 2px;
}

/* The log is the only part of this page that scrolls: a wire has a length, and
   the Bureau does not make you scroll the whole terminal to read it. */
.room-log {
  background: var(--ink-1);
  background-image: var(--fibre);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-inset);
  padding: var(--s-3) var(--s-4);
  max-height: 58vh;
  min-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.room-line {
  display: grid;
  gap: 3px;
  padding-left: var(--s-2);
  border-left: var(--spine) solid var(--ink-4);
}

/* A line you sent is the machine answering you, so it carries phosphor. */
.room-line.mine {
  border-left-color: var(--phosphor-dim);
}

.rl-who {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.rl-name {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--paper-bright);
  overflow-wrap: anywhere;
}

.rl-dept {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  color: var(--cat-timeline);
  white-space: nowrap;
}

.rl-time {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.rl-text {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--paper);
  overflow-wrap: anywhere;
}

/* ---------- the composer ---------- */
.room-compose {
  background: var(--ink-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  padding: var(--s-3);
}

.compose-label {
  display: block;
}

.compose-label > span {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--muted-strong);
  margin-bottom: 5px;
}

.room-compose textarea {
  display: block;
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  color: var(--paper);
  padding: 10px var(--s-2);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  outline: none;
  box-shadow: var(--shadow-inset);
  resize: vertical;
  transition: border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

.room-compose textarea:focus {
  border-color: var(--cat-timeline);
  box-shadow: 0 0 0 3px var(--timeline-wash-2);
}

.compose-foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.compose-hint {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  color: var(--muted);
}

.char-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-mono);
  color: var(--muted);
}

.char-count.over {
  color: var(--alert-bright);
}

.room-send-btn {
  background: var(--cat-timeline);
  border: 1px solid var(--cat-timeline);
  border-radius: var(--r-1);
  color: var(--ink-0);
  padding: 10px var(--s-4);
  min-height: 40px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: filter var(--dur-1) var(--ease);
}

.room-send-btn:hover {
  filter: brightness(1.12);
}

.room-send-btn:focus-visible {
  outline: 2px solid var(--cat-timeline);
  outline-offset: 2px;
}

/* ---------- narrow screens: the rail becomes a drawer on top ---------- */
@media (max-width: 860px) {
  .rooms-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .room-rail {
    position: static;
  }

  .room-log {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .room-card,
  .room-new-btn,
  .room-seal-btn,
  .room-send-btn,
  .room-compose textarea {
    transition: none;
  }
}
