/* HIPERGRAPHICS · DS-0015 · COMMON COMPONENTS
   Canonical: packages/design-system/styles/hg-controls.css
   One visual control, two mechanisms: staff uses a CSS SVG because its button
   contains legacy emoji; public demo already injects one native SVG in demo-v5.js.
   NEVER draw a second pseudo-icon on a button that already has an SVG child. */

/* Consistent HiperGraphics selection, including staff and all public pages. */
::selection { background:var(--hg-yellow); color:var(--hg-ink); }
::-moz-selection { background:var(--hg-yellow); color:var(--hg-ink); }

.hg-voice-trigger {
  /* No position declaration here! Position belongs to the field wrapper. */
  display:inline-grid;
  place-items:center;
  box-sizing:border-box;
  flex:none;
  appearance:none;
  min-width:var(--hg-voice-size,44px);
  min-height:var(--hg-voice-size,44px);
  padding:0;
  border:1.5px solid var(--hg-ink);
  border-radius:0;
  background-color:var(--hg-yellow);
  color:var(--hg-ink);
  cursor:pointer;
  vertical-align:middle;
  line-height:1;
}
.hg-voice-trigger:hover:not(:disabled) { background-color:#ffe069; }
.hg-voice-trigger:focus-visible {
  outline:var(--hg-focus-width,3px) solid var(--hg-focus);
  outline-offset:2px;
}
.hg-voice-trigger:disabled { cursor:not-allowed; opacity:.5; }

/* Both field systems use the same geometric contract: mic overlays the input,
   never sits below it and never changes the field's document flow. */
.with-voice,
.v7-input-voice { position:relative; min-width:0; width:100%; }
.with-voice > input,
.with-voice > textarea { width:100%; padding-right:60px; }
.with-voice > .hg-voice-trigger {
  position:absolute;
  z-index:2;
  right:2px;
  top:1px;
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;
  margin:0;
  font-size:0;         /* hide legacy emoji only in staff */
  color:transparent;   /* do not affect the external image */
}
.with-voice > .hg-voice-trigger:not(:has(svg)):not(:has(img))::before {
  content:"";
  width:24px;
  height:24px;
  display:block;
  background:url("./hg-mic-hand.svg") center / contain no-repeat;
  pointer-events:none;
}
.with-voice > .hg-voice-trigger.active,
.with-voice > .hg-voice-trigger[aria-pressed="true"] {
  background-color:var(--hg-signal);
}
.with-voice > .hg-voice-trigger.active::before,
.with-voice > .hg-voice-trigger[aria-pressed="true"]::before {
  filter:brightness(0) invert(1);
}

/* The public demonstration dynamically moves its button into .v7-input-voice,
   then inserts its OWN SVG. Do not cover or replace that existing SVG. */
.v7-input-voice > .hg-voice-trigger::before { content:none !important; }
.v7-input-voice > .hg-voice-trigger { z-index:2; }
.v7-input-voice > .hg-voice-trigger svg {
  display:block;
  max-width:24px;
  max-height:24px;
  color:inherit;
  fill:none;
}
.v7-input-voice > .hg-voice-trigger[aria-pressed="true"] svg {
  fill:currentColor;
}
@media (prefers-reduced-motion:reduce) {
  .hg-voice-trigger { transition:none !important; }
}
/* HG shared compact toolbar — one row, accessible touch targets, no visible SSE text. */
.hg-toolbar{display:flex;align-items:center;gap:4px;min-width:0;flex:none;flex-wrap:nowrap}
.hg-toolbar .hg-toolbar-control{display:inline-flex;align-items:center;justify-content:center;gap:2px;min-height:44px;min-width:0;padding:0 4px;border:1px solid var(--hg-ink);background:var(--hg-white);color:var(--hg-ink);font:750 .75rem/1 var(--hg-font-body,Arial,sans-serif);white-space:nowrap;flex:none}
.hg-toolbar-select img{display:block;width:15px;height:15px;flex:none}
.hg-toolbar-select select{width:43px;min-width:0;height:42px;padding:0;border:0;border-radius:0;background:transparent;color:inherit;font:inherit;cursor:pointer}
.hg-toolbar .hg-toolbar-toggle{width:44px;padding:0;background:transparent;border-color:transparent;color:#287447}
.hg-toolbar .hg-toolbar-toggle[aria-pressed="false"]{color:var(--hg-signal)}
.hg-toolbar .hg-toolbar-toggle[data-connection]:not([data-connection="connected"])[aria-pressed="true"]{color:#8a6500}
.hg-toolbar-icon{display:block;width:22px;height:22px;flex:none}
.hg-toolbar-toggle[aria-pressed="true"] .hg-toolbar-off-mark,.hg-toolbar-toggle .hg-toolbar-disconnected{display:none}
.hg-toolbar-toggle[data-connection]:not([data-connection="connected"]) .hg-toolbar-bell{display:none}
.hg-toolbar-toggle[data-connection]:not([data-connection="connected"]) .hg-toolbar-disconnected{display:block}
.hg-toolbar .hg-toolbar-control:hover{background:var(--hg-paper)}
.hg-toolbar-control:focus-visible,.hg-toolbar-select:focus-within{outline:3px solid var(--hg-focus,var(--hg-cobalt));outline-offset:1px}
/* Keep announcements available to assistive technology without occupying header width. */
.hg-toolbar .hg-toolbar-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}
