/* office.css — "The Office" as a holographic fleet command deck.
 *
 * Rewritten 2026-10-28, replacing the pixel-art office sim. Design notes:
 *  - everything animated uses transform/opacity only, because the dormant bay
 *    renders 60 pods and filter/box-shadow animation on that many nodes stutters
 *    badly in the mobile webview
 *  - the glow is a static box-shadow; only rings and the scanline move
 *  - pods inherit their type color through a --pod custom property set inline by
 *    office.js, so one rule set covers every agent type
 *  - prefers-reduced-motion stops every animation at the bottom of this file
 */

.office-scene {
  position: relative;
  min-height: 320px;
  padding: 0;
  background: transparent;
}

.hx-deck {
  position: relative;
  padding: 14px 14px 22px;
  background:
    radial-gradient(900px 420px at 50% -12%, rgba(56,189,248,0.10), transparent 70%),
    radial-gradient(700px 400px at 12% 108%, rgba(168,85,247,0.08), transparent 72%),
    linear-gradient(180deg, #060a14 0%, #080d18 55%, #060a12 100%);
  border: 1px solid rgba(56,189,248,0.16);
  border-radius: 14px;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
/* Faint engineering grid behind everything. */
.hx-deck::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(56,189,248,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,189,248,0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 36%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 36%, #000 25%, transparent 78%);
  pointer-events: none;
}
.hx-scanline {
  position: absolute; left: 0; right: 0; height: 2px; top: -2px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.5), transparent);
  animation: hx-scan 7s linear infinite;
  pointer-events: none;
}
@keyframes hx-scan { 0%{transform:translateY(0)} 100%{transform:translateY(700px)} }

/* ── HUD ────────────────────────────────────────────────────────────────── */
.hx-hud {
  position: relative;
  display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap;
  padding: 2px 4px 14px;
}
.hx-hud-stat { line-height: 1; }
.hx-hud-val {
  font-family: 'Oswald', sans-serif;
  font-size: 30px; font-weight: 700; color: #cfe6f5;
  letter-spacing: .02em;
}
.hx-hud-stat.live .hx-hud-val { color: #22c55e; text-shadow: 0 0 16px rgba(34,197,94,.55); }
.hx-hud-stat.off  .hx-hud-val { color: #ef4444; }
.hx-hud-stat.total .hx-hud-val { color: #38bdf8; }
.hx-hud-key {
  margin-top: 4px; font-size: 9px; letter-spacing: .22em;
  color: rgba(190,215,235,.42); font-weight: 600;
}
.hx-hud-bar {
  flex: 1 1 120px; min-width: 100px; height: 3px; margin-bottom: 6px;
  background: rgba(56,189,248,.12); border-radius: 2px; overflow: hidden;
}
.hx-hud-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #22c55e, #38bdf8);
  box-shadow: 0 0 10px rgba(56,189,248,.6);
}

/* ── Command core ───────────────────────────────────────────────────────── */
.hx-command {
  position: relative; margin: 2px 0 20px;
  padding: 18px 16px 16px; text-align: center;
  border: 1px solid rgba(var(--podrgb), .28);
  border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(420px 180px at 50% 0%, rgba(var(--podrgb), .16), transparent 70%),
    linear-gradient(180deg, rgba(10,16,28,.9), rgba(8,12,22,.75));
}
.hx-command-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(var(--podrgb),.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--podrgb),.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
  pointer-events: none;
}
.hx-command-inner { position: relative; }
.hx-command-label {
  font-size: 9px; letter-spacing: .3em; font-weight: 700;
  color: rgba(var(--podrgb), .75); margin-bottom: 12px;
}
.hx-command-pod { position: relative; width: 74px; height: 74px; margin: 0 auto 12px; }
.hx-core-cmd {
  width: 54px; height: 54px; top: 10px; left: 10px; font-size: 16px;
}
.hx-ring-cmd { width: 74px; height: 74px; border-width: 2px; }
.hx-command-name {
  font-family: 'Oswald', sans-serif; font-size: 17px; font-weight: 600;
  color: #e6f2fb; letter-spacing: .02em;
}
.hx-command-meta {
  margin-top: 5px; font-size: 10px; letter-spacing: .14em;
  color: rgba(200,222,240,.5); display: flex; gap: 8px; justify-content: center; align-items: center;
}
.hx-dot-sep { width: 3px; height: 3px; border-radius: 50%; background: rgba(200,222,240,.35); }
.hx-command-task {
  margin: 10px auto 0; max-width: 460px; font-size: 11px; line-height: 1.55;
  color: rgba(205,228,245,.62);
  padding: 7px 11px; border-radius: 8px;
  background: rgba(var(--podrgb), .07);
  border: 1px solid rgba(var(--podrgb), .16);
}

/* ── Bays ───────────────────────────────────────────────────────────────── */
.hx-bay { margin-bottom: 20px; position: relative; }
.hx-bay-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.hx-bay-title {
  font-size: 10px; letter-spacing: .26em; font-weight: 700; color: rgba(56,189,248,.82);
}
.hx-bay-count {
  font-size: 10px; font-weight: 700; color: rgba(205,228,245,.55);
  padding: 1px 7px; border-radius: 9px;
  background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.2);
}
.hx-bay-rule {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(56,189,248,.28), transparent);
}
.hx-bay-dim .hx-bay-title { color: rgba(168,185,205,.55); }
.hx-bay-dim .hx-bay-rule { background: linear-gradient(90deg, rgba(150,170,195,.16), transparent); }

.hx-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
.hx-grid-dense { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }

/* ── Pods ───────────────────────────────────────────────────────────────── */
.hx-pod {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 6px 2px 0; cursor: default;
}
.hx-core {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: .04em; color: #eaf5ff;
  background: radial-gradient(circle at 34% 28%, rgba(var(--podrgb), .55), rgba(var(--podrgb), .14) 62%, rgba(8,12,22,.9));
  border: 1px solid rgba(var(--podrgb), .55);
  z-index: 2;
}
.hx-pod-live .hx-core { box-shadow: 0 0 18px rgba(var(--podrgb), .45), inset 0 0 14px rgba(var(--podrgb), .22); }
.hx-initials { opacity: .95; }

.hx-ring {
  position: absolute; top: 0; left: 50%; width: 60px; height: 60px;
  margin-left: -30px; margin-top: -2px;
  border: 1px solid rgba(var(--podrgb), .4);
  border-top-color: transparent; border-left-color: transparent;
  border-radius: 50%;
  animation: hx-spin 4.2s linear infinite;
  animation-delay: var(--delay, 0s);
}
.hx-ring-2 {
  width: 72px; height: 72px; margin-left: -36px; margin-top: -8px;
  border-color: rgba(var(--podrgb), .16);
  border-bottom-color: transparent; border-right-color: transparent;
  animation-duration: 7s; animation-direction: reverse;
}
@keyframes hx-spin { to { transform: rotate(360deg); } }

/* The data beam: a short pulse under an active pod. */
.hx-beam {
  position: absolute; top: 46px; left: 50%; width: 1px; height: 12px;
  margin-left: -0.5px;
  background: linear-gradient(180deg, rgba(var(--podrgb), .8), transparent);
  animation: hx-beam 2.4s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes hx-beam { 0%,100%{opacity:.25;transform:scaleY(.5)} 50%{opacity:1;transform:scaleY(1)} }

.hx-pod-lead .hx-core::after {
  content: ''; position: absolute; top: -7px; left: 50%; margin-left: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #fbbf24; box-shadow: 0 0 9px rgba(251,191,36,.85);
}

.hx-pod-dormant { opacity: .5; }
.hx-pod-dormant .hx-core {
  width: 34px; height: 34px; font-size: 10px;
  background: radial-gradient(circle at 34% 28%, rgba(var(--podrgb), .2), rgba(10,14,24,.92));
  border-color: rgba(var(--podrgb), .24);
}
.hx-pod-dormant:hover { opacity: .95; }

.hx-pod-name {
  margin-top: 16px; max-width: 100%; font-size: 9.5px; line-height: 1.3;
  text-align: center; color: rgba(205,228,245,.62);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hx-pod-dormant .hx-pod-name { margin-top: 6px; font-size: 9px; color: rgba(190,210,230,.45); }

/* ── Tooltip ────────────────────────────────────────────────────────────── */
.hx-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  width: 230px; padding: 10px 12px; border-radius: 10px;
  background: rgba(9,14,24,.97);
  border: 1px solid rgba(56,189,248,.28);
  box-shadow: 0 14px 34px rgba(0,0,0,.6);
  opacity: 0; visibility: hidden; transition: opacity .14s ease, transform .14s ease;
  z-index: 40; text-align: left; pointer-events: none;
}
.hx-pod:hover .hx-tip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.hx-tip-name { font-size: 12px; font-weight: 700; color: #e9f4fd; margin-bottom: 5px; }
.hx-tip-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.hx-tip-type {
  font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor;
}
.hx-tip-status { font-size: 8.5px; letter-spacing: .1em; color: rgba(200,222,240,.55); font-weight: 600; }
.hx-tip-lead {
  font-size: 8.5px; letter-spacing: .1em; font-weight: 700;
  color: #fbbf24; border: 1px solid rgba(251,191,36,.5); border-radius: 4px; padding: 1px 5px;
}
.hx-tip-desc { font-size: 10.5px; line-height: 1.5; color: rgba(200,222,240,.6); }
.hx-tip-task {
  margin-top: 6px; font-size: 10.5px; line-height: 1.5; color: rgba(125,230,180,.85);
  padding-left: 8px; border-left: 2px solid rgba(34,197,94,.5);
}

/* ── Empty / overflow / error ───────────────────────────────────────────── */
.hx-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px 0 30px;
}
.hx-empty-pulse {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(56,189,248,.3);
  animation: hx-breathe 3.4s ease-in-out infinite;
}
@keyframes hx-breathe {
  0%,100% { transform: scale(.85); opacity: .35; }
  50%     { transform: scale(1.08); opacity: .9; }
}
.hx-empty-text { font-size: 11px; letter-spacing: .1em; color: rgba(200,222,240,.42); }
.hx-more {
  margin-top: 12px; text-align: center; font-size: 10px; letter-spacing: .08em;
  color: rgba(190,212,235,.4);
}
.hx-error {
  padding: 26px 22px; text-align: center; font-size: 12px; color: #ef4444;
  border: 1px solid rgba(239,68,68,.3); border-radius: 12px;
  background: rgba(239,68,68,.05);
}
.hx-error-title { font-size: 13px; font-weight: 700; color: #fca5a5; margin-bottom: 6px; }
.hx-error-detail { font-size: 11.5px; line-height: 1.6; color: rgba(200,222,240,.6); }
.hx-retry {
  margin-top: 14px; padding: 7px 18px; border-radius: 8px; cursor: pointer;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  color: #cfe6fb; background: rgba(56,189,248,.1);
  border: 1px solid rgba(56,189,248,.35);
}
.hx-retry:hover { background: rgba(56,189,248,.2); }

/* ── Boot state ─────────────────────────────────────────────────────────── */
/* Shown only while the first fetch is in flight. The old panel sat on a static
   "Loading office..." with no timeout, so a restarting portal looked broken. */
.hx-deck-boot { min-height: 260px; display: flex; align-items: center; justify-content: center; }
.hx-boot { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px 0; }
.hx-boot-ring {
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid rgba(56,189,248,.25);
  border-top-color: rgba(56,189,248,.9);
  animation: hx-spin 1.1s linear infinite;
}
.hx-boot-text {
  font-size: 11px; letter-spacing: .22em; font-weight: 700; color: #7dd3fc;
  animation: hx-fade 1.8s ease-in-out infinite;
}
.hx-boot-sub { font-size: 11px; color: rgba(200,222,240,.45); }
@keyframes hx-spin { to { transform: rotate(360deg); } }
@keyframes hx-fade { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hx-deck { padding: 12px 10px 18px; border-radius: 12px; }
  .hx-hud { gap: 16px; }
  .hx-hud-val { font-size: 24px; }
  .hx-grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .hx-grid-dense { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .hx-core { width: 38px; height: 38px; font-size: 11px; }
  .hx-ring { width: 52px; height: 52px; margin-left: -26px; }
  .hx-ring-2 { width: 62px; height: 62px; margin-left: -31px; }
  .hx-beam { top: 40px; }
  /* A tooltip wider than the viewport is worse than none. */
  .hx-tip { width: 180px; }
}

/* Respect the system setting. Everything above still reads correctly static. */
@media (prefers-reduced-motion: reduce) {
  .hx-scanline, .hx-ring, .hx-beam, .hx-empty-pulse,
  .hx-boot-ring, .hx-boot-text { animation: none; }
  .hx-scanline { opacity: 0; }
}
