/* D189 P2 · the workspace shell, in draft's design system (Dusk — draft themes/dusk-dark.js; depth boxes — DepthButton.css;
   no capsules — D60). Every colour is a token here; the PAGE always renders in its own colours (white paper in every theme). */
@font-face { font-family: "DM Sans"; font-weight: 400; font-display: swap; src: url("/fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-display: swap; src: url("/fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-style: italic; font-display: swap; src: url("/fonts/barlow-condensed-latin-800-italic.woff2") format("woff2"); }
:root {
  color-scheme: dark;
  --bg: #1B1B1B; --card: #262626; --well: #2E2E2E; --line: #343434; --ink: #FFFFFF; --muted: #A3A3A3; --faint: #959595;
  --accent: #FBD3C4; --accent-edge: #F2C2B2; --on-accent: #1B1B1B; --good: #9FD8A8; --warn: #F2CC8F; --bad: #F2A090;
  --surface: #141414;
  --rest: 0 3px 8px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.08);
  --hover: 0 7px 17px rgba(0,0,0,.50), inset 0 1px 0 rgba(255,255,255,.10);
  --press: 0 2px 5px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  --glow: 0 10px 26px rgba(251,211,196,.16), inset 0 1px 0 rgba(255,255,255,.30);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ws { display: grid; grid-template-rows: auto auto auto 1fr auto; height: 100vh; }
/* the depth box */
.ws-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--well); color: var(--ink); border-radius: 9px; box-shadow: var(--rest);
  font-weight: 700; font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: transform .16s, box-shadow .16s, border-color .16s, color .16s;
}
.ws-b:hover:not(:disabled), .ws-b:focus-visible { transform: translateY(-2px); box-shadow: var(--hover); border-color: var(--accent); color: var(--accent); }
.ws-b:active:not(:disabled) { transform: translateY(0); box-shadow: var(--press); }
.ws-b:disabled { opacity: .45; cursor: default; }
.ws-b[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.ws-b.ws-p { background: var(--accent); color: var(--on-accent); border-color: var(--accent-edge); box-shadow: var(--glow); }
.ws-b.ws-p:hover:not(:disabled) { color: var(--on-accent); }
.ws-ic { width: 32px; padding: 0; }
.ws-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; flex-shrink: 0; }
.ws-grow { flex: 1 1 auto; }

/* top bar */
.ws-top { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line); min-width: 0; flex-wrap: wrap; }
.ws-stamp { text-decoration: none; }
.ws-stamp span { display: inline-block; background: #fff; color: #0f0f0f; border: 2px solid #0f0f0f; transform: rotate(-2deg); padding: 2px 7px;
  font: italic 800 13px/1 "Barlow Condensed", system-ui; letter-spacing: .06em; }
.ws-name { font-weight: 700; min-width: 2ch; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 4px; border-radius: 6px; outline: none; }
.ws-name:hover, .ws-name:focus { background: var(--well); }
.ws-meta { color: var(--faint); font-size: 12px; white-space: nowrap; }
.ws-kind { font-size: 11.5px; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.ws-saved { color: var(--faint); font-size: 12px; white-space: nowrap; }
.ws-saved:not(:empty)::before { content: "● "; color: var(--good); }
/* modes + tools */
.ws-modes { display: flex; gap: 4px; padding: 8px 14px 0; }
.ws-mode { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.ws-mode[aria-selected="true"] { background: var(--card); color: var(--ink); }
.ws-tools { display: flex; align-items: center; gap: 4px; padding: 7px 14px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; min-height: 58px; }
.ws-tool { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; padding: 5px 6px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; flex-shrink: 0; }
.ws-tool i { font-style: normal; font-size: 16px; line-height: 1.1; color: var(--ink); }
.ws-tool:hover:not(:disabled) { background: var(--well); color: var(--ink); }
.ws-tool[aria-pressed="true"] { background: var(--well); box-shadow: var(--rest); border-color: var(--line); color: var(--accent); }
.ws-tool[aria-pressed="true"] i { color: var(--accent); }
.ws-tool:disabled { opacity: .4; cursor: default; }

/* the workspace: strip · canvas · properties */
.ws-body { display: grid; grid-template-columns: 150px minmax(0, 1fr) 290px; min-height: 0; }
.ws-strip { border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.ws-thumb { position: relative; padding: 0; border: 0; background: none; cursor: pointer; display: grid; gap: 4px; justify-items: start; color: var(--faint); font-size: 11px; }
.ws-thumb img { width: 100%; border-radius: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.45); background: #fff; }
.ws-thumb[aria-current="true"] img { outline: 2px solid var(--accent); outline-offset: 3px; }
.ws-canvas { position: relative; overflow: auto; background: var(--surface); min-width: 0; }
.ws[data-drag="true"] .ws-canvas { outline: 2px dashed var(--accent); outline-offset: -8px; }
.ws-zoom { padding: 28px 32px 90px; }
.ws-zoom .pt-ed-pages { --ws-page-w: 816px; display: grid; gap: 26px; justify-items: center; }
.ws-zoom .pt-ed-page { width: var(--ws-page-w); max-width: none; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.ws-zoom .pt-ed-page figcaption { color: var(--faint); }
.ws-empty { display: none; place-content: center; text-align: center; height: 100%; padding: 40px; }
.ws[data-state="empty"] .ws-empty, .ws[data-state="loading"] .ws-empty { display: grid; }
.ws[data-state="loading"] .ws-empty__t::after { content: "…"; }
.ws-empty__t { font: 400 30px/1.2 "Instrument Serif", Georgia, serif; margin: 0 0 6px; }
.ws-empty__s { color: var(--muted); margin: 0; }
.ws-empty__err { color: var(--bad); min-height: 1.4em; }
.ws-nav { position: sticky; bottom: 16px; left: 50%; transform: translateX(-50%); width: max-content; margin-top: -60px; display: flex; gap: 6px; align-items: center;
  background: rgba(38,38,38,.96); border: 1px solid var(--line); padding: 6px 10px; border-radius: 12px; box-shadow: var(--hover); font-size: 12.5px; z-index: 4; }
.ws-nav .ws-b { height: 28px; }
.ws-nav .ws-ic { width: 28px; }
#ws-pct, #ws-pageno { min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }
.ws-props { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.ws-ptabs { display: flex; gap: 4px; }
.ws-ptab { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-weight: 700; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.ws-ptab[aria-selected="true"] { background: var(--well); color: var(--ink); box-shadow: var(--rest); }
.ws-panel, .ws-changes { background: var(--card); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.ws-changes:empty { display: none; }
.ws-panel p, .ws-changes p { margin: 0; }
.ws-lbl { font-size: 11.5px; color: var(--faint); }
.ws-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ws-v { min-width: 2.6em; text-align: center; font-variant-numeric: tabular-nums; }
.ws-sel { height: 32px; border-radius: 9px; background: var(--well); border: 1px solid var(--line); padding: 0 8px; }
.ws-color { width: 16px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; }
.ws-note { font-size: 12px; color: var(--warn); }
.ws-ok { font-size: 12.5px; color: var(--good); } .ws-ok::before { content: "● "; }
.ws-warn { font-size: 12.5px; color: var(--warn); } .ws-warn::before { content: "▲ "; }
.ws-faint { color: var(--faint); } .ws-small { font-size: 11.5px; }
.ws-status { margin: 0; padding: 6px 14px; min-height: 30px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.ws-status[data-kind="good"] { color: var(--good); } .ws-status[data-kind="bad"] { color: var(--bad); }
/* the signature maker, as a dialog */
.ws-dialog { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0,0,0,.55); padding: 16px; }
.ws-dialog .pt-ed-maker { width: min(680px, 100%); max-height: 90vh; overflow: auto; background: var(--card); color: var(--ink); border-color: var(--line); }
.ws-dialog .pt-ed-maker .pt-btn, .ws-dialog .pt-ed-maker .pt-tab { border-radius: 9px; background: var(--well); color: var(--ink); border-color: var(--line); }
.ws-dialog .pt-ed-maker .pt-btn.pt-primary, .ws-dialog .pt-ed-maker .pt-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent-edge); }
.ws-dialog .pt-text, .ws-dialog .pt-file { background: var(--well); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; }
.pt-ed-mark { display: grid; place-items: center; width: 100%; height: 100%; font: 700 calc(var(--pt-k, 1) * 13px)/1 system-ui; color: #111; }

/* narrower: the properties fold under; phones: the strip and properties become bottom areas, the canvas full width (P5 refines) */
@media (max-width: 1100px) { .ws-body { grid-template-columns: 120px minmax(0, 1fr) 240px; } }
@media (max-width: 820px) {
  .ws { height: auto; min-height: 100vh; }
  .ws-body { grid-template-columns: minmax(0, 1fr); }
  .ws-strip { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .ws-thumb { width: 64px; flex-shrink: 0; }
  .ws-canvas { min-height: 60vh; }
  .ws-props { border-left: 0; border-top: 1px solid var(--line); }
  .ws-zoom { padding: 16px 12px 80px; }
}
@media (prefers-reduced-motion: reduce) { .ws-b { transition: none; } }

/* D189 P4 · version history (in the dialog) */
.ws-hist { width: min(560px, 100%); max-height: 80vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 10px; }
.ws-hist__t { margin: 0; font: 400 24px/1.2 "Instrument Serif", Georgia, serif; }
.ws-hist__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ws-hist__list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--well); font-size: 13px; }

/* ── D189 P5 · shortcuts, phones, accessibility ── */
.ws-keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.ws-keys dt { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--accent); white-space: nowrap; }
.ws-keys dd { margin: 0; color: var(--muted); }
.ws-sheetbar { display: none; }
@media (max-width: 820px) {
  .ws-body { grid-template-columns: minmax(0, 1fr); }
  /* the strip and the properties leave the flow: bottom sheets over the canvas, opened from the sheet bar */
  .ws-strip, .ws-props {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; max-height: 62vh; overflow: auto; background: var(--card);
    border: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 32px rgba(0,0,0,.5);
    transform: translateY(105%); transition: transform .24s cubic-bezier(.22, 1, .36, 1); padding: 16px;
  }
  .ws-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .ws-thumb { width: auto; }
  .ws-strip.ws-sheet--open, .ws-props.ws-sheet--open { transform: none; }
  .ws-sheetbar { display: flex; gap: 8px; justify-content: center; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg); position: sticky; bottom: 0; z-index: 16; }
  .ws-top { gap: 6px; }
  .ws-top .ws-b:not(.ws-ic):not(.ws-p) { padding: 0 9px; }
  #ws-to-resume { display: none; }   /* the résumé road is in the desktop workspace; the phone keeps its tools */
  .ws-canvas { min-height: 70vh; }
}
@media (prefers-reduced-motion: reduce) { .ws-strip, .ws-props, .ws-tool, .ws-b { transition: none !important; } }
