/* Motif Sketch's own look, on top of the suite's css/motif.css (the palette, fonts, app bar, menus, dialogs and toasts).
   The look of docs/mockups/v2.html (decisions 26-39). */

.glyph { width: 16px; height: 12px; flex: none; }

/* App bar: the project title, the dirty dot and the layout switch */
.title { display: flex; align-items: center; gap: 6px; padding: 4px 10px; margin-right: 6px; border-radius: 6px; color: var(--ink); font-weight: 500; min-width: 0; max-width: 320px; }
.title .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.title:hover { background: var(--hover); }
.title .dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.title-edit { font: inherit; font-weight: 500; color: var(--ink); background: var(--canvas); border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 8px; width: 240px; margin-right: 6px; }
.cmd .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: -2px; }

.switch { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--hover); margin: 0 4px; }
.switch button { display: flex; align-items: center; height: 28px; padding: 0 8px; border-radius: 6px; color: var(--muted); }
.switch button:hover { color: var(--ink); }
.switch button[aria-pressed="true"] { background: var(--bar); color: var(--ink); box-shadow: 0 1px 2px rgba(15,23,42,.15); }
.switch svg { width: 22px; height: 14px; }

/* Workspace and the three layouts */
.work { flex: 1; display: flex; min-height: 0; --left: 50%; }
.pane { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--canvas); }
.divider { width: 1px; flex: none; background: var(--line-strong); cursor: col-resize; display: none; position: relative; touch-action: none; }
.divider::after { content: ""; position: absolute; inset: 0 -5px; }
.divider:hover { background: var(--accent); }
.s-split .pane.context { flex: 0 0 var(--left); } .s-split .pane.sketch { flex: 1; } .s-split .divider { display: block; }
.s-context .pane.context, .s-sketch .pane.sketch { flex: 1; }
.s-context .pane.sketch, .s-sketch .pane.context { flex: 0 0 136px; }
.s-context .pane.sketch { border-left: 1px solid var(--line-strong); } .s-sketch .pane.context { border-right: 1px solid var(--line-strong); }

.tools { height: 40px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--strip); overflow: hidden; }
.tools .name { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 10px 0 4px; white-space: nowrap; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: 6px; color: var(--text); }
.tool:hover { background: var(--hover); color: var(--ink); }

.canvas { flex: 1; position: relative; min-height: 0; overflow: hidden; cursor: default; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--canvas); }
.canvas.panning:active { cursor: grabbing; }
.canvas > svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.canvas.empty { display: grid; place-items: center; }
.empty-note { color: var(--muted); }

/* Diagrams on screen */
svg.scene text { font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif; pointer-events: none; }
svg.scene .hit { cursor: pointer; }
svg.scene .divider { stroke: var(--dg-Divider); stroke-width: 1; stroke-dasharray: 6 6; vector-effect: non-scaling-stroke; }
svg.scene .grip { pointer-events: stroke; }
/* Selection: orange, on screen only */
svg.scene .sel .outline { stroke: var(--dg-Selection) !important; stroke-width: 3px !important; stroke-dasharray: none !important; }
svg.scene .sel.relationship .outline { stroke-width: 2.5px !important; }
svg.scene .drop .outline { stroke: var(--dg-Selection) !important; stroke-width: 3px !important; stroke-dasharray: 5 3 !important; }
svg.scene .dragging { opacity: .55; }
svg.scene .hit:hover:not(.sel) .outline { filter: brightness(.96); }

/* Collapsed pane: thumbnail strip */
.thumb { display: none; }
.collapsed .tools, .collapsed .canvas { display: none; }
.collapsed .thumb { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 10px; height: 100%; background: var(--strip); cursor: pointer; }
.collapsed .thumb:hover .mini { border-color: var(--accent); }
.thumb .label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.thumb .mini { width: 114px; height: 100px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--canvas); padding: 4px; display: flex; transition: border-color .15s; pointer-events: none; }
.thumb .mini svg { width: 100%; height: 100%; }
.thumb .hint { font-size: 11px; color: var(--muted); text-align: center; }
.start-btn { width: 114px; padding: 12px 8px; border-radius: 8px; border: 1px dashed var(--line-strong); background: var(--canvas); color: var(--ink); text-align: center; white-space: normal; font-weight: 500; }
.start-btn:hover { border-color: var(--accent); }
.start-btn small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 4px; }
.start-btn.big { width: 240px; padding: 20px 16px; font-size: 15px; }
.start-btn.big small { font-size: 12px; }

/* Floating cards on the canvas (dialogs are cards too, but sit in a scrim) */
.card { position: absolute; z-index: 5; cursor: auto; user-select: text; -webkit-user-select: text; touch-action: auto; }
.dialog { position: relative; }
.props { width: 260px; max-height: calc(100% - 24px); overflow: auto; }
.ro .field input, .ro .field textarea, .ro .field select { border-color: transparent; background: none; padding-left: 0; appearance: none; resize: none; opacity: 1; }
.ro .field input::placeholder { color: transparent; }
.section { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.flag-note { font-size: 12px; color: var(--banner-ink); background: var(--banner); border-radius: 6px; padding: 6px 8px; margin: 0 0 10px; }
.source { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--ink); }
.seam { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; }
.seam .row { align-items: center; gap: 4px; }
.seam .row input { flex: 1; }
.seam .check { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 400; color: var(--ink); margin: 6px 0 0; }
.seam .check input { width: auto; }
.seam .field { margin: 8px 0 0; }
.seam-none { margin-bottom: 6px; }
.ro .seam { border-color: transparent; padding: 0 0 6px; }
.source span { flex: 1; }

.unplaced { left: 12px; top: 12px; width: 232px; max-height: calc(100% - 24px); overflow: auto; }
.unplaced.drop { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.unplaced header span.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 11px; padding: 0 6px; }
.item { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; cursor: grab; background: var(--strip); margin-bottom: 6px; touch-action: none; user-select: none; -webkit-user-select: none; }
.item:hover { border-color: var(--accent); }
.item b { display: block; color: var(--ink); font-weight: 500; }
.item span { font-size: 11px; color: var(--muted); }
.badge { position: absolute; top: 12px; left: 12px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow); color: var(--ink); font-weight: 500; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hint-chip { position: absolute; left: 12px; top: 12px; font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 5px 12px; pointer-events: none; }
.ghost-drag { position: fixed; z-index: 50; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 10px; font-weight: 500; box-shadow: var(--shadow); white-space: nowrap; }

.welcome { left: 20px; bottom: 20px; width: 340px; }
.welcome .body p { margin: 0 0 10px; }
.welcome .tip { display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--strip); font-size: 12px; margin-bottom: 12px; }
.welcome .tip svg { margin-top: 2px; color: var(--accent); }

.link-box { height: 120px !important; font-family: "IBM Plex Mono", Consolas, monospace; font-size: 11px !important; word-break: break-all; }

/* Narrow screens: no Split layout, slimmer strips */
@media (max-width: 899px) {
  .s-context .pane.sketch, .s-sketch .pane.context { flex-basis: 100px; }
  .thumb .mini, .start-btn:not(.big) { width: 80px; } .thumb .mini { height: 74px; }
  .props { width: 230px; } .welcome { width: 280px; }
  .tool .label { display: none; }
  /* Two layouts, and the other pane's strip moves between them (decision 26) */
  .switch { display: none !important; }
  /* Only the title and a read-only pill's source (a repo can have a long
     name) give way, so nothing else is cut off */
  .appbar > * { flex-shrink: 0; }
  .appbar > .title, .appbar > .pill { flex-shrink: 1; }
  .title { overflow: hidden; min-width: 0; }
  .pill .long { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}

/* Phones: view only (decision 30), so the bar must fit */
@media (max-width: 599px) {
  .title { padding: 4px 6px; margin-right: 2px; }
  .pill { padding: 0 8px; }
  /* Seen only as the eye, but still read out by screen readers */
  .pill .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .props { width: calc(100% - 24px); max-height: 45%; }
  .s-context .pane.sketch, .s-sketch .pane.context { flex-basis: 92px; }
}
