/* Views (views.js, docs/ARTIFACTS.md §7a): the sidebar's Views section, a view full-bleed, and focus mode.
   Flat: hairlines and spacing, no boxes; the view itself gets every pixel the chrome gives up. */

/* ---------- the sidebar's views: items of the frame's sidebar (frame.css .s-item) ---------- */
.nav .vw-new, .nav .vw-building { color: var(--chrome-fg-2); }
.nav .vw-new:hover { color: var(--chrome-fg); }
.nav .vw-building svg { animation: cp-run 2.4s linear infinite; }
.nav .vw-drag { opacity: .45; }
.nav .vw-over { box-shadow: inset 0 2px 0 var(--canopy); }
.nav .vw-x { cursor: pointer; padding: 0 2px; }
.vw-more-h { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 6px 0 4px; }
.vw-more-row { display: flex; align-items: center; gap: 4px; }
.vw-more-row > button:first-child { flex: 1; min-width: 0; }
.vw-more-mv { display: inline-flex; gap: 2px; flex: none; }
/* A pinned thing's name keeps its room: its state gives way first (frame.css .s-item .state; tour of 14 Nov). */
.nav .s-item .lbl { min-width: 3.5em; }

/* ---------- a view, full page ---------- */
.vw-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.vw-bar { flex: none; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 8px 20px; border-bottom: var(--hair, 1px solid var(--line)); }
.vw-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.vw-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-title .dim { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vw-acts a.btn { text-decoration: none; }
.vw-modes { display: inline-flex; gap: 2px; margin-left: 6px; padding-left: 8px; border-left: var(--hair, 1px solid var(--line)); }
.vw-modes .btn { padding: 0 7px; }
.vw-modes .btn svg { width: 16px; height: 16px; }
.vw-modes .btn.on { color: var(--text); background: var(--ink-3); }
.vw-frame { flex: 1; width: 100%; min-height: 0; border: 0; display: block; background: var(--ink-1); }
body.vw-on .view { overflow: hidden; }

/* ---------- the handle that brings the chrome back ---------- */
/* A pull on the left edge, half way down, in a gutter of its own: the view starts after it, so it never covers the
   view's content (tour of 14 Nov). On a phone it is a slim strip across the top instead (below). */
.vw-handle { position: fixed; z-index: var(--z-sticky); top: 50%; left: env(safe-area-inset-left); transform: translateY(-50%);
  width: 20px; height: 56px; display: grid; place-items: center; padding: 0;
  background: var(--ink-0); color: var(--text-2); border: 1px solid var(--line-2); border-left: 0; border-radius: 0 4px 4px 0; opacity: .72; }
.vw-handle:hover, .vw-handle:focus-visible { opacity: 1; color: var(--text); }
.vw-handle svg { width: 14px; height: 14px; }
.vw-handle span { display: none; }
.vw-handle[hidden] { display: none; }
body.chrome-hidden .vw-page { padding-left: calc(20px + env(safe-area-inset-left)); }

/* ---------- compact and hidden: the frame's own rules (frame.css, "focus mode on a view") ---------- */
body.chrome-compact .topbar { display: none; } /* ⌘K's sheet (ask.js) still opens in focus mode */
body.chrome-hidden .rail, body.chrome-hidden .topbar, body.chrome-hidden .mnav, body.chrome-hidden .vw-bar { display: none; }
body.chrome-hidden .vw-tabs { display: none; }

/* ---------- "+ New view", Share: one dialog, flat ---------- */
.vw-dlg-back { position: fixed; inset: 0; z-index: var(--z-dialog); background: var(--scrim); display: grid; place-items: center; padding: 16px; }
.vw-dlg { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--pop-bg); color: var(--text); border: 0; border-radius: 6px; padding: 18px 20px; box-shadow: var(--elev-3);
  animation: cp-pop-in var(--dur-2) var(--ease-out); }
.vw-dlg h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.vw-dlg-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line); margin: 12px 0; }
.vw-dlg-tabs button { background: none; border: 0; color: var(--text-2); padding: 8px 0; font: inherit; border-bottom: 2px solid transparent; cursor: pointer; }
.vw-dlg-tabs button.on { color: var(--text); border-bottom-color: var(--canopy); }
.vw-dlg-f { display: flex; flex-direction: column; gap: 12px; }
.vw-dlg-f[hidden] { display: none; }
.vw-dlg-f label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.vw-dlg-f label.check, .vw-dlg-radio label { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.vw-dlg-f textarea, .vw-dlg-f input:not([type=checkbox]):not([type=radio]), .vw-dlg-f select { background: var(--ink-2); border: 1px solid var(--control); border-radius: 4px; padding: 8px 10px; color: var(--text); font: 14px var(--sans); min-width: 0; }
.vw-dlg-row { display: flex; gap: 12px; flex-wrap: wrap; }
.vw-dlg-row > label { flex: 1 1 180px; }
.vw-dlg-radio { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.vw-dlg-radio legend { font-size: 12px; color: var(--text-3); padding: 0 6px 0 0; }
.vw-dlg-acts { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- phone ---------- */
@media (max-width: 780px) {
  .vw-bar { padding: 6px 12px; gap: 4px 8px; }
  .vw-title { flex-basis: 100%; }
  .vw-desk { display: none; } /* there is no rail to narrow on a phone */
  /* The bar is one row of its own at 375 (tour of 14 Nov: the state buttons wrapped under a stray divider). */
  .vw-acts { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .vw-acts::-webkit-scrollbar { display: none; }
  .vw-acts > * { flex: none; }
  .vw-modes { border-left: 0; padding-left: 0; margin-left: auto; }
  .vw-det { display: none; }
  .vw-tabs { padding: 0 12px; overflow-x: auto; }
  /* The pull is a strip across the top, in space of its own, clear of the notch: it never covers the view. */
  .vw-handle { top: 0; left: 0; right: 0; transform: none; width: auto; height: calc(32px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
    display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; opacity: 1; font: 12.5px var(--sans); }
  .vw-handle span { display: inline; }
  .vw-handle svg { width: 16px; height: 16px; }
  body.chrome-hidden .vw-page { padding-left: 0; padding-top: calc(32px + env(safe-area-inset-top)); }
  .mnav .vw-tab { min-width: 0; }
  .mnav .vw-tab .vw-tab-l { display: block; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
