/* =========================================================
   Weaver — css/layout.css
   Step 2: top bar, workspace panel grid, panel chrome,
   resizer handles, responsive mobile stacking.
   ========================================================= */

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.topbar-left { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }
.topbar-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.topbar-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.topbar-title { font-size: 1.02rem; font-weight: 650; letter-spacing: .03em; }
.topbar-sub { font-size: .68rem; color: var(--faint); font-family: var(--font-mono); }

/* ---------- Workspace skeleton ---------- */
#view-workspace.is-active { display: flex; flex-direction: column; }
.workspace-panels {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
}

/* ---------- Panels ---------- */
.panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}
.panel.is-hidden { display: none; }
.panel.is-expanded { flex: 1 1 100%; }

.panel-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.panel-title .icon { color: var(--accent); }
.panel-actions { display: flex; align-items: center; gap: 6px; }

.panel-body { flex: 1; overflow-y: auto; min-height: 0; }

.panel-footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.panel-footer .btn { flex: 1; }

/* ---------- Resizer handles (JS behaviour arrives in Step 9) ---------- */
.resizer {
  flex: none;
  width: 6px;
  background: var(--border);
  cursor: col-resize;
  position: relative;
  z-index: 5;
  transition: background .15s ease;
}
.resizer:hover, .resizer.is-dragging { background: var(--accent); }

/* ---------- Responsive: mobile stacks vertically ---------- */
@media (max-width: 860px) {
  .workspace-panels { flex-direction: column; }
  .resizer {
    width: auto;
    height: 6px;
    cursor: row-resize;
  }
}
/* =========================================================
   Step 8: top bar extras — Scribe bar + responsive labels
   ========================================================= */
.scribe-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(320px, 30vw);
}
.scribe-bar .input { padding: 7px 10px; font-size: .8rem; }
.btn-label { white-space: nowrap; }

@media (max-width: 860px) {
  .scribe-bar { display: none; }         /* mobile Scribe entry arrives with Step 21 */
  .topbar .btn-label { display: none; }  /* icon-only top bar on phones */
  .topbar .btn { padding: 8px; width: 34px; height: 34px; }
}
/* =========================================================
   Step 9: resize engine touch support
   ========================================================= */
.resizer { touch-action: none; }
.resizer.is-dragging { background: var(--accent); }

@media (max-width: 860px) {
  .resizer { height: 10px; } /* fatter touch target on phones */
}
/* ---------- Stage 6.5: topbar — shrinkable center, truncating title ---------- */
.topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
.topbar-center { min-width: 0; }
.topbar-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-sub {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
