/* side-panel.css (console copy) — the two side panels, one grammar: the
   Rooms panel on the LEFT edge (navigation, account — the shell's own
   sidebar markup) and the Explorer panel on the RIGHT edge (the
   workbench's file tree and search).

     HIDDEN   only a slim vertical tab on the panel's own edge (44 px hand)
     OPEN     slides in over the content; auto-hides 2.5 s after the pointer
              leaves it, on Esc, on a press outside, after a room is chosen
     PINNED   docked: the main column yields by the panel width on that
              side and it never auto-hides until unpinned

   State is carried on <aside data-side data-state="hidden|open|pinned">
   and mirrored on <html class="sp-left-pinned sp-right-pinned …">. Every
   colour is one of the console's own tokens (--panel, --border, --text,
   --accent, --kit-seal). Loaded AFTER console.css and builder.css: the
   rules below replace console.css's own fixed/sticky sidebar. Phone first
   (375×812); desk and tablet inherit. Built by js/shared/side-panel.js. */

:root {
  --sp-left-w: var(--sidebar-w, 260px);
  --sp-right-w: 320px;
  --sp-ease: 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (max-width: 899.98px) { :root { --sp-right-w: 300px; } }

/* ---------- the tabs (HIDDEN state) ---------- */
.side-panel-tab {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  min-height: 132px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  z-index: calc(var(--z-bar, 200) + 11);
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--sp-ease), visibility 0s linear 0s;
}
.side-panel-tab-right { right: 0; justify-content: flex-end; }
.side-panel-tab-left { left: 0; justify-content: flex-start; }
.side-panel-tab-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 30px;
  min-height: 132px;
  padding: 14px 0;
  border: 1px solid var(--border);
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  color: var(--text);
}
.side-panel-tab-right .side-panel-tab-face { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); box-shadow: -1px 0 0 var(--accent); }
.side-panel-tab-left .side-panel-tab-face { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; box-shadow: 1px 0 0 var(--accent); }
.side-panel-tab-face svg { flex: none; }
.side-panel-tab-word {
  writing-mode: vertical-rl;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}
.side-panel-tab-right .side-panel-tab-word { transform: rotate(180deg); }
.side-panel-tab:hover .side-panel-tab-face,
.side-panel-tab:focus-visible .side-panel-tab-face { border-color: var(--accent); color: var(--accent); }
.side-panel-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-panel-tab[aria-expanded="true"] { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--sp-ease), visibility 0s linear 420ms; }

/* three stacked edge tabs on the right (Explorer, Terminal, Team): each a
   44 × 110 px hand, 8 px apart, centred as a trio on the edge so all three
   stay clear of the prompt box at the foot (measured: a 442 px tall
   viewport still leaves room — the trio is 346 px against the pair's 228,
   the same margin the pair had at 442 px was checked at 560 px here). */
.side-panel-tab-stack-1, .side-panel-tab-stack-2, .side-panel-tab-stack-3 { min-height: 110px; transform: none; }
.side-panel-tab-stack-1 { top: calc(50% - 173px); }
.side-panel-tab-stack-2 { top: calc(50% - 55px); }
.side-panel-tab-stack-3 { top: calc(50% + 63px); }
.side-panel-tab-stack-1 .side-panel-tab-face, .side-panel-tab-stack-2 .side-panel-tab-face, .side-panel-tab-stack-3 .side-panel-tab-face { min-height: 110px; padding: 10px 0; gap: 8px; }
.side-panel-tab.is-current-view .side-panel-tab-face { border-color: var(--accent); }

/* ---------- the panels ---------- */
.side-panel,
.sidebar.side-panel {
  position: fixed !important;
  top: 0;
  bottom: 0;
  height: 100dvh;
  max-width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
  color: var(--text);
  z-index: calc(var(--z-drawer, 900) + 1);   /* sliding over the content: above the bars, below menus */
  visibility: hidden;
  transition: transform var(--sp-ease), visibility 0s linear 420ms;
}
.side-panel-right {
  right: 0;
  left: auto;
  width: var(--sp-right-w);
  border-left: 1px solid var(--border);
  border-right: 0;
  box-shadow: -1px 0 0 rgba(var(--glow-rgb), 0.12), -12px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
}
.sidebar.side-panel-left {
  left: 0;
  width: var(--sp-left-w) !important;
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(var(--glow-rgb), 0.12), 12px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(-100%);
}
.side-panel[data-state="open"],
.side-panel[data-state="pinned"] {
  transform: translateX(0) !important;
  visibility: visible;
  transition: transform var(--sp-ease), visibility 0s linear 0s;
}
/* a pinned panel is part of the page: just above the top bar (layers.css --z-bar), below every menu */
.side-panel[data-state="pinned"] { z-index: calc(var(--z-bar, 200) + 10) !important; box-shadow: none; }
.side-panel-right[data-state="pinned"] { box-shadow: -1px 0 0 rgba(var(--glow-rgb), 0.12); }
.sidebar.side-panel-left[data-state="pinned"] { box-shadow: 1px 0 0 rgba(var(--glow-rgb), 0.12); }

/* the shell no longer keeps the sidebar in flow; the main column yields to a pinned panel */
.shell { display: block; }
.main { width: 100%; transition: padding-left var(--sp-ease), padding-right var(--sp-ease); box-sizing: border-box; }
html.sp-left-pinned .main { padding-left: var(--sp-left-w); }
html.sp-right-pinned .main { padding-right: var(--sp-right-w); }
.drawer-scrim { display: none !important; }
#hamburger-btn { display: inline-flex !important; }

/* the resize hand on the panel's inner edge (desk only) */
.side-panel-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  background: transparent;
  border: 0;
  padding: 0;
  display: none;
  z-index: 2;
}
.side-panel-right .side-panel-resize { left: -4px; }
.side-panel-left .side-panel-resize { right: -4px; }
.side-panel-resize:focus-visible { outline: 2px solid var(--accent); }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) { .side-panel-resize { display: block; } }

/* ---------- head ---------- */
.side-panel-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.side-panel-title {
  flex: 1;
  margin: 0;
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.side-panel-head .icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); border-radius: var(--radius-pill); border: 0; background: transparent; cursor: pointer; }
.side-panel-head .icon-btn:hover { background: var(--accent-soft, rgba(0,0,0,.06)); }
.side-panel-pin[aria-pressed="true"] { color: var(--kit-seal, var(--accent-2)); background: var(--accent-soft, rgba(0,0,0,.06)); }
.side-panel-pin[aria-pressed="true"] svg { transform: rotate(-35deg); }
.side-panel-pin svg { transition: transform 200ms ease; }
.sidebar.side-panel .sidebar-top { padding: 6px 6px 6px 12px; min-height: 48px; border-bottom: 1px solid var(--border); }
.sidebar.side-panel .sidebar-top .brand { flex: 1; min-width: 0; }
.sidebar.side-panel .sidebar-close-btn { display: inline-flex !important; order: 3; width: 44px; height: 44px; }
.sidebar.side-panel .side-panel-pin { order: 2; }

/* the head's view strip (right panel): two tabs, the active one underlined in the accent */
.side-panel-views { flex: 1; display: flex; align-items: stretch; align-self: stretch; gap: 2px; min-width: 0; }
.side-panel-view {
  min-width: 44px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--text-muted);
  font: 700 11px/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -5px;
}
.side-panel-view:hover { color: var(--text); }
.side-panel-view.is-active { color: var(--text); border-bottom-color: var(--accent); }
.side-panel-view:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-panel-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.side-panel-pane[hidden] { display: none; }
.terminal-mount { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.terminal-mount:empty { flex: none; }
.terminal-loading { margin: 14px 16px; font: 12px/1.4 var(--font-mono); color: var(--text-faint); }
.terminal-loading[hidden] { display: none; }

/* ---------- the scrolling middle ---------- */
.side-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

/* ---------- phone: a full-height sheet from its own edge ---------- */
@media (max-width: 480px) {
  .side-panel, .sidebar.side-panel {
    width: calc(100% - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    z-index: calc(var(--z-drawer, 900) + 1) !important;
  }
  .side-panel-pin { display: none !important; }
  html.sp-left-pinned .main { padding-left: 0 !important; }
  html.sp-right-pinned .main { padding-right: 0 !important; }
  .side-panel-resize { display: none !important; }
  .side-panel-head .icon-btn { min-width: 44px; min-height: 44px; }
  .side-panel-tab { top: 50% !important; bottom: auto !important; }
  .side-panel-tab-stack-1 { top: calc(50% - 173px) !important; }
  .side-panel-tab-stack-2 { top: calc(50% - 55px) !important; }
  .side-panel-tab-stack-3 { top: calc(50% + 63px) !important; }
}

@media (prefers-reduced-motion: reduce) {
  .side-panel, .side-panel-tab, .side-panel-pin svg, .main { transition: none !important; }
  .side-panel-tab[aria-expanded="true"] { transition: none !important; }
}
