.office {
  --amber: #b7791f;
  margin-top: 32px;
}

.office h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.office [hidden] {
  display: none !important;
}

.office-stale {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 13px;
}

.office-stale::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.office-stage {
  position: relative;
  width: 100%;
  /* W2M-4: the floor grows with the agents; office-room.js sets --floor-h. */
  aspect-ratio: 640 / var(--floor-h, 400);
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef2ea;
}

/* A taller floor zooms out to today's height on a wide screen; a phone keeps the full width. */
@media (min-width: 720px) {
  .office-stage {
    width: calc(100% * 400 / var(--floor-h, 400));
    margin-inline: auto;
  }
}

.office-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  transition:
    opacity 0.3s,
    filter 0.3s;
}

.office-is-stale .office-canvas {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.office-agent {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 6.875%;
  /* 68 room px on any floor height (W2M-4). */
  height: calc(17% * 400 / var(--floor-h, 400));
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 8px;
}

.office-agent:hover {
  background: rgba(0, 0, 0, 0.04);
}

.office-agent:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.office-name {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font:
    600 12px/1.2 'Instrument Sans',
    system-ui,
    sans-serif;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
  color: var(--ink);
}

.office-bubble,
.office-quip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 8px;
  font:
    12px/1.3 'Instrument Sans',
    system-ui,
    sans-serif;
  color: var(--ink);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The agent who is talking sits above a neighbour's name label. */
.office-agent:has(> .office-quip:not([hidden])) {
  z-index: 1;
}

.office-quip {
  font-style: italic;
  color: var(--muted);
  border-style: dashed;
}

.office-bubble::after,
.office-quip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: translate(-50%, -3px) rotate(45deg);
}

.office-alert {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: var(--muted);
}

.office-agent[data-alert='amber'] .office-alert {
  background: var(--amber);
}

.office-agent[data-alert='red'] .office-alert {
  background: var(--red);
}

.office-panel {
  margin-top: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.office-panel h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.office-panel-role {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.office-panel-line {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 14px;
}

.office-panel-alert {
  margin: 6px 0 0;
  color: var(--red);
  font-size: 13px;
}

.office-panel button {
  margin-top: 12px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.office-panel button:hover {
  border-color: var(--green);
  color: var(--green);
}

.office-panel button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.office-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.office-legend li {
  display: flex;
  align-items: center;
}

.office-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  background: var(--muted);
}

.office-swatch.working {
  background: var(--green);
}

.office-swatch.waiting {
  background: #6b8bd6;
}

.office-swatch.idle {
  background: #b9c2b5;
}

.office-swatch.amber {
  background: var(--amber);
}

.office-swatch.red {
  background: var(--red);
}

.office-more {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 600px) {
  .office-bubble,
  .office-quip {
    max-width: 120px;
    font-size: 11px;
  }

  .office-name {
    font-size: 11px;
    padding: 0 4px;
  }

  .office-alert {
    width: 16px;
    height: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .office-canvas {
    transition: none;
  }
}

.office-canvas {
  border-radius: 12px;
}

/* Seated: 15 room px below the seat (the box is 68 room px high), under the floor line. */
.office-agent[data-label='floor'] .office-name {
  top: 122%;
}

.office-agent[data-label='above'] .office-name {
  top: auto;
  bottom: 100%;
  margin-bottom: 2px;
}

/* The name sits above the head: a bubble or quip above goes over the name (W2M3_PANTRY_SEATS). */
.office-agent[data-label='above'] .office-bubble:not([data-place]),
.office-agent[data-label='above'] .office-quip:not([data-place]) {
  margin-bottom: 22px;
}

.office-agent[data-side='left'] .office-bubble,
.office-agent[data-side='left'] .office-quip {
  left: 0;
  transform: none;
}

.office-agent[data-side='right'] .office-bubble,
.office-agent[data-side='right'] .office-quip {
  left: auto;
  right: 0;
  transform: none;
}

/* The owner sits at the executive desk; not a button, only a name and a new-job bubble. */
.office-owner {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 6.875%;
  /* 68 room px on any floor height (W2M-4). */
  height: calc(17% * 400 / var(--floor-h, 400));
  pointer-events: none;
}

/* W2M3_PANTRY_SEATS: beside the head when above would cover another agent's face. */
.office-agent .office-bubble[data-place='right'],
.office-agent .office-quip[data-place='right'] {
  left: 100%;
  right: auto;
  top: 0;
  bottom: auto;
  transform: none;
  margin: 0 0 0 4px;
}

.office-agent .office-bubble[data-place='left'],
.office-agent .office-quip[data-place='left'] {
  left: auto;
  right: 100%;
  top: 0;
  bottom: auto;
  transform: none;
  margin: 0 4px 0 0;
}

.office-bubble[data-place]::after,
.office-quip[data-place]::after {
  display: none;
}

/* W2M5: agent list under the office on a phone (web/design/W2M5_PHONE_AGENT_LIST.md). */
.office-list {
  display: none;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.office-list li + li {
  border-top: 1px solid var(--line);
}

.office-list-row {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 2px 10px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
}

.office-list-row:focus-visible {
  outline: 2px solid var(--green);
}

.office-list-row .office-swatch {
  margin: 0;
  grid-row: 1 / 3;
}

.office-list-who {
  font:
    600 14px/1.3 'Instrument Sans',
    system-ui,
    sans-serif;
  color: var(--ink);
}

.office-list-who small {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

.office-list-what {
  grid-column: 2;
  font-size: 12px;
  color: #4c5d55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.office-list-row[data-alert='red'] .office-list-what {
  color: var(--red);
}

.office-list-go {
  grid-row: 1 / 3;
  grid-column: 3;
  color: #b9c2b5;
  font-size: 18px;
}

/* On a phone the list carries the tasks: no bubbles or quips over the small room. */
@media (max-width: 719px) {
  .office-has-list .office-list {
    display: block;
  }

  .office-has-list .office-bubble,
  .office-has-list .office-quip {
    display: none;
  }
}
