/* mockups/devtools/toolbar.css — chrome for the design toolbar.
 *
 * Deliberately token-free. Every colour here is a literal: the bar has to stay
 * legible while the page it sits on is previewing an unreadable palette, and a
 * bar that recoloured with the thing it is measuring would be useless. For the
 * same reason it names its own font stack instead of inheriting --sans, which
 * the Fonts menu can rewrite.
 *
 * Everything is prefixed .pdt- and lives inside #pdt-root, so it cannot
 * collide with a mockup class, and no rule here targets a page element.
 */

#pdt-root {
  --pdt-bg: #17151a;
  --pdt-bg-2: #211e26;
  --pdt-line: #35313d;
  --pdt-fg: #efeaf2;
  --pdt-dim: #a79fb2;
  --pdt-accent: #d8a657;
  --pdt-good: #8ec07c;
  --pdt-warn: #e6a35a;
  --pdt-bad: #ef8b7a;

  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 2147483000;
  font: 500 12px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--pdt-fg);
  -webkit-font-smoothing: antialiased;
}

#pdt-root *,
#pdt-root *::before,
#pdt-root *::after { box-sizing: border-box; }

/* The element reset is written :where(#pdt-root) so it contributes ZERO
   specificity from the id — otherwise `#pdt-root button` (1-0-1) would beat
   every `.pdt-*` class rule (0-1-0) below, and every button in the bar would
   render with the reset's transparent background and inherited colour instead
   of its own. Found the hard way: the collapsed pill came up as pale text on
   the page's own tan. */
:where(#pdt-root) button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}
:where(#pdt-root) input,
:where(#pdt-root) textarea,
:where(#pdt-root) output { font: inherit; color: inherit; }

/* ---------- collapsed pill ---------- */
.pdt-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--pdt-bg);
  border: 1px solid var(--pdt-line);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
  letter-spacing: .3px;
}
.pdt-pill:hover { background: var(--pdt-bg-2); }
.pdt-pill .pdt-mark { color: var(--pdt-accent); font-size: 13px; }

/* ---------- the bar ---------- */
.pdt-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 6px;
  border-radius: 12px;
  background: var(--pdt-bg);
  border: 1px solid var(--pdt-line);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .42);
}
.pdt-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 8px;
  color: var(--pdt-dim);
  white-space: nowrap;
}
.pdt-tab:hover { background: var(--pdt-bg-2); color: var(--pdt-fg); }
.pdt-tab[aria-expanded="true"] { background: var(--pdt-bg-2); color: var(--pdt-fg); box-shadow: inset 0 0 0 1px var(--pdt-line); }
.pdt-tab .pdt-mark { font-size: 12px; opacity: .9; }
.pdt-tab.pdt-dirty::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--pdt-accent);
}
.pdt-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--pdt-line); }

/* ---------- the Compare switch (cohesion roadmap, Phase 0d) ----------
   Lives ON the bar rather than inside a panel: it is the one control that
   flips a whole identity, so it must be one click from anywhere. The ⇄ mark
   dims when neither identity is fully applied. */
.pdt-compare { display: flex; align-items: center; gap: 7px; padding: 0 4px 0 2px; }
.pdt-compare .pdt-mark { font-size: 13px; color: var(--pdt-accent); cursor: help; }
.pdt-compare .pdt-seg button { padding: 3px 10px; }
.pdt-compare-mixed .pdt-mark { color: var(--pdt-dim); opacity: .55; }

/* ---------- the panel ---------- */
.pdt-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 430px;
  max-height: min(70vh, 620px);
  overflow: auto;
  padding: 14px 15px 16px;
  border-radius: 12px;
  background: var(--pdt-bg);
  border: 1px solid var(--pdt-line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
  overscroll-behavior: contain;
}
.pdt-panel[hidden] { display: none; }
.pdt-panel h3 {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--pdt-dim);
}
.pdt-panel h4 {
  margin: 16px 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--pdt-dim);
}
.pdt-panel h4:first-child { margin-top: 0; }
.pdt-note { margin: 0 0 10px; color: var(--pdt-dim); font-weight: 400; }
.pdt-empty { color: var(--pdt-dim); font-weight: 400; font-style: italic; }

/* ---------- candidate rows ---------- */
.pdt-list { display: flex; flex-direction: column; gap: 4px; }
.pdt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  text-align: left;
  background: var(--pdt-bg-2);
  border: 1px solid transparent;
}
.pdt-row:hover { border-color: var(--pdt-line); }
.pdt-row[aria-pressed="true"] { border-color: var(--pdt-accent); }
.pdt-row-main { flex: 1; min-width: 0; }
.pdt-row-label { display: block; }
.pdt-row-note { display: block; color: var(--pdt-dim); font-weight: 400; font-size: 11px; }
.pdt-row-flag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #2f2a36;
  color: var(--pdt-dim);
}
.pdt-row-flag.pdt-ship { background: #2f4133; color: var(--pdt-good); }

.pdt-swatches { display: flex; gap: 3px; flex: none; }
.pdt-swatch {
  width: 14px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, .16);
}

/* ---------- segmented control ---------- */
.pdt-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--pdt-bg-2);
  border: 1px solid var(--pdt-line);
}
.pdt-seg button {
  padding: 4px 12px;
  border-radius: 6px;
  color: var(--pdt-dim);
}
.pdt-seg button[aria-pressed="true"] { background: #38323f; color: var(--pdt-fg); }

.pdt-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

/* ---------- sliders ---------- */
.pdt-slider { display: grid; grid-template-columns: 116px 1fr 58px; align-items: center; gap: 10px; margin-bottom: 8px; }
.pdt-slider label { color: var(--pdt-dim); font-weight: 400; }
.pdt-slider input[type="range"] { width: 100%; accent-color: var(--pdt-accent); }
.pdt-slider output { text-align: right; font-variant-numeric: tabular-nums; }
.pdt-slider.pdt-off label, .pdt-slider.pdt-off output { opacity: .45; }

.pdt-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 400; color: var(--pdt-dim); }
.pdt-toggle input { accent-color: var(--pdt-accent); }
.pdt-toggle span.pdt-key { color: var(--pdt-fg); font-weight: 500; }

/* ---------- contrast readout ---------- */
.pdt-contrast { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pdt-contrast th {
  text-align: left;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--pdt-dim);
  padding: 0 6px 5px 0;
  font-weight: 700;
}
.pdt-contrast td { padding: 3px 6px 3px 0; border-top: 1px solid var(--pdt-line); font-weight: 400; }
.pdt-contrast .pdt-pair { display: inline-flex; align-items: center; gap: 6px; }
.pdt-chipbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 17px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 10px;
  font-weight: 700;
}
.pdt-ratio { text-align: right; }
.pdt-badge {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .6px;
  padding: 2px 5px;
  border-radius: 4px;
}
.pdt-badge.pdt-aaa { background: #2f4133; color: var(--pdt-good); }
.pdt-badge.pdt-aa { background: #3b3a2a; color: var(--pdt-warn); }
.pdt-badge.pdt-fail { background: #452b28; color: var(--pdt-bad); }

/* ---------- token diff + JSON ---------- */
.pdt-diff { display: flex; flex-direction: column; gap: 3px; }
.pdt-diff-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; font-weight: 400; }
.pdt-diff-row code { font: 500 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--pdt-fg); }
.pdt-diff-val { display: inline-flex; align-items: center; gap: 5px; color: var(--pdt-dim); font: 400 10.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.pdt-dot { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, .16); }

.pdt-json {
  width: 100%;
  height: 168px;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  resize: vertical;
  background: #0f0d12;
  color: #d7d0e0;
  border: 1px solid var(--pdt-line);
  font: 400 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}

.pdt-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pdt-btn {
  padding: 6px 12px;
  border-radius: 7px;
  background: var(--pdt-bg-2);
  border: 1px solid var(--pdt-line);
  color: var(--pdt-fg);
}
.pdt-btn:hover { background: #2c2733; }
.pdt-btn.pdt-primary { border-color: var(--pdt-accent); color: var(--pdt-accent); }
.pdt-said { color: var(--pdt-good); font-weight: 400; }

/* ---------- icon role grid ---------- */
.pdt-icons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pdt-icons .pdt-ico-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 2px;
  border-radius: 7px;
  background: var(--pdt-bg-2);
}
.pdt-icons .pdt-ico-cell b { font-size: 15px; font-weight: 400; line-height: 1; }
.pdt-icons .pdt-ico-cell b .pdt-ico { display: block; }
.pdt-icons .pdt-ico-cell span { font-size: 8px; color: var(--pdt-dim); text-align: center; word-break: break-word; }
.pdt-icons .pdt-ico-cell.pdt-ico-missing { background: transparent; box-shadow: inset 0 0 0 1px var(--pdt-line); }
.pdt-icons .pdt-ico-cell.pdt-ico-missing span { color: var(--pdt-warn); }

/* ---------- injected icons on the PAGE, not in the bar ----------
   The toolbar rewrites every [data-icon] element's content to an <svg>, and
   most of those sit inline in running text where an emoji used to. Without a
   baseline nudge the glyph rides high and every row it is in grows.
   .pdt-ico-gap is the dashed placeholder for a role the set has no glyph for —
   it is deliberately visible, because a gap silently filled with a lookalike
   would make the whole side-by-side comparison dishonest. */
.pdt-ico { display: inline-block; vertical-align: -0.14em; flex: none; }

/* ---------- baseline grid overlay + measure mode ---------- */
#pdt-grid {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(120, 60, 200, .22) 0,
    rgba(120, 60, 200, .22) 1px,
    transparent 1px,
    transparent var(--pdt-grid-step, 8px));
}
#pdt-measure-box {
  position: fixed;
  z-index: 2147482500;
  pointer-events: none;
  border: 1px solid rgba(216, 166, 87, .95);
  background: rgba(216, 166, 87, .13);
  border-radius: 2px;
}
#pdt-measure-tip {
  position: fixed;
  z-index: 2147482600;
  pointer-events: none;
  max-width: 320px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #17151a;
  color: #efeaf2;
  border: 1px solid #35313d;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  font: 400 10.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}
html.pdt-measuring, html.pdt-measuring * { cursor: crosshair !important; }

/* ---------- type-scale readout (Phase 2) ---------- */
.pdt-scale { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pdt-scale th {
  text-align: left;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--pdt-dim);
  padding: 0 6px 5px 0;
  font-weight: 700;
}
.pdt-scale td { padding: 2px 6px 2px 0; border-top: 1px solid var(--pdt-line); font-weight: 400; }
.pdt-scale-group td {
  color: var(--pdt-dim);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  padding-top: 7px;
  border-top: 1px solid var(--pdt-line);
}
.pdt-scale-token { color: var(--pdt-accent); white-space: nowrap; }
.pdt-scale-use { color: var(--pdt-fg); }
.pdt-scale-px { text-align: right; white-space: nowrap; }
.pdt-scale-ref { color: var(--pdt-dim); white-space: nowrap; }
