/* ══════════════════════════════════════════════════════════════════
   THE FLOOR — /room cockpit styles (PR-R4, 2026-05-20)
   Single layout. Office + Thread always visible. Lineup avatar
   strip top. Atlas slide-up drawer at bottom. No tabs, no modes.
   ══════════════════════════════════════════════════════════════════ */

/* ─── Scoped tokens — keep the cockpit self-contained ──────────── */
.floor {
  --surface:        #0c0d10;
  --surface-sunk:   #08090b;
  --surface-raised: #14161b;
  --surface-elev:   #181b21;
  --surface-hover:  #1c2027;

  --ink:        #e8eaed;
  --ink-dim:    #9ca3af;
  --ink-mute:   #6b7280;
  --ink-faint:  #4b5159;
  --ink-ghost:  #2f343c;

  --line:        #1f2228;
  --line-soft:   #15171c;
  --line-strong: #2a2e36;

  --accent:      #b8923a;
  --accent-soft: #cba552;
  --accent-wash: rgba(184, 146, 58, 0.10);
  --accent-line: rgba(184, 146, 58, 0.35);

  --gain:      #22c55e;
  --loss:      #ef4444;

  --sans:  'Geist', 'Inter Tight', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease:  cubic-bezier(0.22, 1, 0.36, 1);

  background: var(--surface);
  color: var(--ink);
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--sans);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
}

.floor .live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gain); vertical-align: middle;
  animation: floor-live-pulse 2s var(--ease) infinite;
}
@keyframes floor-live-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

.floor .mono { font-family: var(--mono); font-size: 0.92em; }
.floor .dim  { color: var(--ink-dim); }
.floor .accent-fg { color: var(--accent); }
.floor .num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ─── TOP ─────────────────────────────────────────────────────── */
.floor-top {
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunk);
  position: sticky; top: 0; z-index: 30;
}
.floor-top-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 64px;
}

.floor-brand {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 22px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
}
.floor-brand-bar {
  width: 4px; height: 32px; background: var(--accent); border-radius: 1px;
  flex-shrink: 0;
}
.floor-brand-text { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.floor-brand-eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--ink); text-transform: uppercase;
}
.floor-brand-status {
  font-size: 9.5px; letter-spacing: 0.18em; color: var(--gain);
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 5px;
}
.floor-brand-stats {
  display: flex; flex-direction: column; gap: 2px;
  padding-left: 16px; border-left: 1px solid var(--line);
  font-size: 10px; line-height: 1.25;
  color: var(--ink-dim);
}
.floor-brand-stats span { white-space: nowrap; }
.floor-brand-stats .num { color: var(--ink); font-weight: 500; }
.floor-brand-stats .dim { color: var(--ink-mute); letter-spacing: 0.12em; }

/* ─── Lineup strip ────────────────────────────────────────────── */
.lineup-strip {
  flex: 1;
  display: flex; align-items: stretch;
  gap: 0;
  overflow-x: auto;
  min-width: 0;
}
.lineup-strip::-webkit-scrollbar { height: 0; }

.lineup-team {
  display: flex; flex-direction: column;
  padding: 6px 14px 8px;
  min-width: 0;
}
.lineup-team-name {
  font-size: 8.5px; letter-spacing: 0.18em; color: var(--ink-mute);
  text-transform: uppercase; padding-bottom: 4px;
  white-space: nowrap;
}
.lineup-team-chips { display: flex; gap: 6px; }

.lineup-div {
  width: 1px; background: var(--line);
  align-self: stretch;
  margin: 0;
}

.fchip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px; cursor: pointer; text-align: left;
  color: var(--ink); font-family: var(--sans); font-size: 11.5px;
  position: relative; overflow: hidden;
  transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 140ms var(--ease);
  min-height: 38px;
  white-space: nowrap;
}
.fchip:hover {
  border-color: var(--voice, var(--accent));
  background: var(--surface-elev);
  transform: translateY(-1px);
}
.fchip.active {
  border-color: var(--voice, var(--accent));
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--voice, var(--accent)) 16%, var(--surface-elev)) 0%,
    var(--surface-elev) 70%);
}
.fchip:focus-visible {
  outline: 2px solid var(--voice, var(--accent));
  outline-offset: 2px;
}
.fchip-av {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--voice, var(--accent));
  color: var(--surface-sunk);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  flex-shrink: 0;
}
.fchip-body { display: flex; flex-direction: column; gap: 1px; line-height: 1.1; min-width: 0; }
.fchip-name { font-weight: 500; color: var(--ink); font-size: 11.5px; }
.fchip-meta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; letter-spacing: 0.06em; color: var(--ink-faint);
}
.fchip-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint);
}
.fchip.hot     .fchip-dot { background: var(--gain); box-shadow: 0 0 6px var(--gain); animation: floor-live-pulse 2s var(--ease) infinite; }
.fchip.warm    .fchip-dot { background: var(--accent); }
.fchip.dormant .fchip-dot { background: var(--ink-faint); }
.fchip.error   .fchip-dot { background: var(--loss); }
.fchip-mark {
  position: absolute; right: -1px; top: 0; bottom: 0;
  width: 3px; background: var(--voice, var(--accent));
}

/* ─── Voice-color explainer eyebrow (PR-R4 discoverability) ── */
.floor-color-explainer {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  padding: 6px 22px;
  background: var(--surface-sunk);
  border-bottom: 1px dashed var(--line-soft);
}

/* ─── Voice tape (second heartbeat) ───────────────────────────── */
.voice-tape {
  display: grid;
  grid-template-columns: 3px auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 22px;
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  transition: background 200ms var(--ease), opacity 280ms var(--ease);
  opacity: 0;
}
.voice-tape.in  { opacity: 1; }
.voice-tape.out { opacity: 0.0; }
.voice-tape:hover { background: var(--surface-raised); }
.voice-tape.empty { cursor: default; }
.voice-tape.empty .vt-text { color: var(--ink-mute); }
.vt-rail {
  display: block; width: 3px; height: 22px;
  background: var(--voice, var(--accent));
  border-radius: 1px;
}
.vt-meta {
  font-size: 11px; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-dim);
}
.vt-name { color: var(--voice, var(--accent)); font-weight: 600; letter-spacing: 0.02em; }
.vt-sep  { color: var(--ink-faint); }
.vt-ago  { color: var(--ink-mute); }
.vt-ticker { color: var(--accent); font-weight: 600; }
.vt-text {
  font-family: var(--sans); font-size: 13.5px; color: var(--ink);
  font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.vt-counter {
  font-size: 9.5px; letter-spacing: 0.14em; color: var(--ink-faint);
  white-space: nowrap;
}

/* ─── MAIN: Thread (left) + Office (right) ────────────────────── */
.floor-main {
  display: grid;
  grid-template-columns: minmax(0, 40fr) minmax(0, 60fr);
  min-height: 0;
  overflow: hidden;
}
.floor-thread {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  min-height: 0;
}
.floor-office {
  background: var(--surface);
  overflow-y: auto;
  min-height: 0;
}

/* Empty / loading states inside the floor slots */
.floor-empty, .floor-loading {
  padding: 32px 26px;
  font-family: var(--sans);
  color: var(--ink-mute);
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.floor-empty .eyebrow, .floor-loading .eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* When atlas drawer is open, dim the main area but keep it visible. */
.floor.atlas-up .floor-main { filter: brightness(0.5) saturate(0.7); pointer-events: none; }

/* ─── Atlas drawer ────────────────────────────────────────────── */
.atlas-backdrop {
  position: absolute; inset: 0 0 var(--atlas-dock-h, 44px) 0;
  background: rgba(8, 9, 11, 0.55);
  backdrop-filter: blur(2px);
  z-index: 20;
  animation: floor-fade-in 200ms var(--ease);
}
@keyframes floor-fade-in { from { opacity: 0; } to { opacity: 1; } }

.atlas-dock {
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
  height: 44px;
  position: relative;
  z-index: 25;
}
.atlas-dock.open {
  height: 65vh;
  border-top: 1px solid var(--accent-line);
}

.atlas-tab {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 0 22px;
  background: var(--surface-sunk);
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--sans);
  color: var(--ink);
  min-height: 44px;
  transition: background 140ms var(--ease);
  flex-shrink: 0;
}
.atlas-tab:hover { background: var(--surface-raised); }
.atlas-dock.open .atlas-tab { border-bottom-color: var(--accent-line); background: var(--surface-raised); }

.atlas-tab-l {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
.atlas-tab-bar { width: 3px; height: 16px; background: var(--accent); border-radius: 1px; }
.atlas-tab-label { color: var(--ink); }
.atlas-tab-sub   { color: var(--ink-mute); text-transform: none; letter-spacing: 0.02em; font-size: 11px; font-family: var(--sans); font-style: italic; }
.atlas-dock.open .atlas-tab-label { color: var(--accent); }

.atlas-tab-r {
  display: inline-flex; align-items: center; gap: 18px;
  font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--ink);
}
.atlas-tab-stat { display: inline-flex; align-items: center; gap: 6px; }
.atlas-tab-stat .dim { color: var(--ink-mute); letter-spacing: 0.14em; font-size: 9.5px; text-transform: uppercase; }
.atlas-tab-stat .accent-fg { color: var(--accent); }
.atlas-tab-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-dim);
  transition: all 140ms var(--ease);
}
.atlas-tab:hover .atlas-tab-glyph { color: var(--accent); border-color: var(--accent-line); }

.atlas-drawer-body {
  flex: 1; min-height: 0; overflow: auto;
  background: var(--surface);
  animation: floor-rise-in 320ms var(--ease);
}
@keyframes floor-rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ─── Surface tweaks for the floor ────────────────────────────── */
.floor-thread .tv { padding: 20px 22px; }
.floor-thread .tv-top { padding-bottom: 14px; }
.floor-thread .tv-topic { font-size: 19px; max-width: none; }
.floor-thread .tv-stream { padding: 4px 0; }
.floor-thread .tv-meta,
.floor-thread .tv-stream,
.floor-thread .tv-add { max-width: none; margin: 0; }
.floor-thread .tv-add { margin-top: 14px; }

.floor-office .ao { padding: 18px 22px 14px; }
.floor-office .ao-name { font-size: 26px; }
.floor-office .ao-head { gap: 18px; padding-bottom: 14px; }

/* ─── Mobile (<1024px): viewport-locked, internal scroll, anchored Atlas
   PR-R7 (2026-05-20). Previous "90vh × 2" stack created ~200vh of page
   scroll and pushed the Atlas drawer below two full viewports — Quinn
   reported the page as unusable. New approach:
   • .floor stays viewport-locked (calc(100vh - 40px) under room-pre strip)
   • Thread + Office split the middle 50/50 with INTERNAL scroll
   • atlas-dock pinned via position: fixed bottom — always 1 tap away
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .floor {
    height: calc(100vh - 40px);     /* room-pre strip (40px) sits above */
    min-height: 0;
    overflow: hidden;
    grid-template-rows: auto 1fr;   /* atlas-dock dropped from grid — fixed-positioned below */
  }
  .floor-top { position: relative; top: auto; }
  .floor-top-row { flex-direction: column; min-height: 0; }
  .floor-brand { border-right: 0; border-bottom: 1px solid var(--line); width: 100%; padding: 8px 16px; }
  .floor-brand-stats { flex-direction: row; padding-left: 16px; gap: 14px; }
  .lineup-strip { padding: 4px 8px; }
  .lineup-team { padding: 6px 10px 8px; }

  .voice-tape { grid-template-columns: 3px auto 1fr; padding: 8px 16px; font-size: 12px; }
  .vt-counter { display: none; }
  .vt-text { font-size: 12.5px; }

  .floor-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: auto;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 44px;            /* reserve space for the fixed Atlas tab */
  }
  .floor-thread, .floor-office {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 0;
    height: 100%;
    overflow-y: auto;
  }
  .floor-office { border-bottom: 0; }
  .floor-thread .tv-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .floor-office .ao-body { grid-template-columns: 1fr; }
  .floor-office .ao-head { grid-template-columns: 1fr; }

  /* Atlas drawer pinned to viewport bottom — always reachable in 1 tap */
  .atlas-dock {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 35;
    border-top: 1px solid var(--line);
    height: 44px;
  }
  .atlas-dock.open { height: 80vh; }
  .atlas-tab-r { gap: 12px; font-size: 10px; }
  .atlas-tab-sub { display: none; }
  .atlas-backdrop { z-index: 34; }
}
