/* Ask Garrick — the eager half of the stylesheet.

   This is the only Garrick sheet a visitor who never opens the panel pays for.
   It carries the mount's frame, the launcher, and the two rules that are
   compliance surface rather than decoration: the AI badge the launcher declares
   before anything is loaded, and the closed-panel verdict.

   Every rule below is copied from bdr-garrick.css, the panel sheet, which still
   carries all of them. The duplication is deliberate: the panel sheet is loaded
   on first open and must remain complete on its own, and a launcher rule deleted
   from it to avoid repeating itself here is a rule that goes missing the moment
   the split is ever undone. Two of the rules -- the focus ring and the
   reduced-motion block -- are written there as selector lists that also cover
   panel controls which do not exist yet at this point; the eager copy takes the
   launcher's share of each and says so at the rule. Every other rule is
   byte-identical.

   THE DUPLICATION IS ALSO THE HAZARD, and it has already fired twice: this file
   was first written against the pre-redesign palette and kept defining the
   retired tokens itself, so the launcher every visitor saw stayed orange and
   opened a blue panel; and 0.2.2 rewrote the panel sheet's tokens in place and
   never touched this one, so the launcher was painted from 0.2.0's values until
   the first click. Nothing was undefined and nothing was unstyled, so nothing
   failed. garrick-launcher-css.test.cjs now resolves both sheets through the
   cascade and fails if they ever disagree about the launcher again, which is
   why the rules here are copied mechanically rather than by hand. */

.bdr-garrick {
  /* §1 of the panel build spec (5 September 2026). This block is the whole
     palette: a colour that is not here is not in the panel. It is copied
     byte-for-byte into bdr-garrick-launcher.css, the eager sheet, and
     tests/js/garrick-launcher-css.test.cjs resolves both and fails if they
     ever disagree. Change a value here and change it there. */

  /* The shell: the header and the footer. */
  --bdr-garrick-shell: #2b3038;
  /* The raised surface: Garrick's reply, the composer's field, the review
     list and the three top controls. Owner decision, 8 September 2026: the
     panel is one solid dark grey, so this is the lift that separates a bubble
     from the ground it sits on -- 1.55:1 against the shell, the step the
     reference the owner chose takes between its ground and its bubbles; white
     on it is 8.5:1. (Until 8 September it was #363c45, eleven points above the
     shell, tuned to read as the same grey when islanded in a white transcript.
     There is no white transcript now.) */
  --bdr-garrick-reply: #ffffff;
  --bdr-garrick-field: #eef2f6;

  /* The transcript's ground, over a panel that paints no ground of its own.
     THE SHELL, SOLID. Owner decision, 8 September 2026: no glass. 0.3.2 had
     already made it opaque white, because the page's own text ghosted through
     the 92% veil and read as part of the answer; the owner then took the white
     away too, so the panel is one dark surface from edge to edge and nothing
     of the page shows through it at any opacity. Header, thread, progress and
     composer all stand on the shell. Still no backdrop-filter. */
  --bdr-garrick-transcript: #ffffff;

  /* Interactive. Two blues with two jobs. #007FAF is every filled control and
     every outline on a light ground: white on it is 4.51:1, which is what lets
     Send keep white text. #00A5E2 is the brand blue and is used on the dark
     shell only -- 4.73:1 there, and 2.81:1 as text on anything light, which
     fails. Amber is the route to a person, and nothing else. */
  --bdr-garrick-fill: #007faf;
  --bdr-garrick-brand: #00a5e2;
  --bdr-garrick-amber: #ffb020;

  /* Ink. White is the text on the dark ground; this is the dim ink -- the
     disclosure, the small labels, the typing dots -- 8.29:1 on the shell,
     quiet without disappearing. (--bdr-garrick-ink and --bdr-garrick-ink-dim,
     the two inks for the white transcript, retired with it on 8 September
     2026.) */
  --bdr-garrick-disclosure: #566172;
  /* Muted ink for the boot note, the one surface still on the dark shell. Full
     reasoning in bdr-garrick.css; this sheet is on every page and pays by byte. */
  --bdr-garrick-disclosure-shell: #c7cdd5;

  /* Control geometry: one rule weight and one corner for every control, so a
     phone button and an answer button are recognisably the same kind of thing.
     There are no pills anywhere in the panel. */
  --bdr-garrick-rule: 2px;
  --bdr-garrick-radius: 10px;

  /* The one value §1 does not carry. The rule an answer button wears at rest
     is also the edge of the review list, the confirmation box, the reply hint,
     the three top controls and the row dividers -- one rule on the dark ground,
     written once so none of them can drift apart. It is the launcher's own
     rule: 22% white. */
  --bdr-garrick-rule-ink: rgba(20, 24, 29, 0.18);

  /* The lift the chip and the panel both stand on. It has a name because the
     pending state below has to RESTATE it: `box-shadow` cascades and animates
     as one list, so a rule that adds a ring to the lift has to carry the lift
     with it, and a fourth hand-kept copy of a two-layer shadow is exactly the
     shape of drift the eager sheet has already suffered twice. */
  --bdr-garrick-lift: 0 22px 54px rgba(10, 16, 24, 0.20), 0 1px 3px rgba(10, 16, 24, 0.12);

  /* Enqueued faces, not palette. */
  --bdr-garrick-font: "Geist", "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bdr-garrick-font-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color: #ffffff;
  font-family: var(--bdr-garrick-font);
  font-size: 16px;
  line-height: 1.55;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  /* The panel is a stacking context of its own, so a theme's z-index cannot be
     raised between the transcript and the compliance surface below it. */
  isolation: isolate;
}

/* --- compliance armour begins ---
   Between this comment and its closing pair is the only place this sheet may
   say !important. tests/js/garrick-css-hygiene.test.cjs reads the pair and
   fails any declaration that says it anywhere else, because a stray
   !important is how a layered fix outlives the rule it was meant to patch. */
/* The mount's own frame, restated at id strength so an ordinary theme rule
   cannot detach it, sink it behind the page, or reflow it into the document. */
#bdr-garrick.bdr-garrick {
  display: block !important;
  opacity: 1 !important;
  position: fixed !important;
  visibility: visible !important;
  z-index: 99999 !important;
}

#bdr-garrick.bdr-garrick[hidden] {
  display: none !important;
}
/* --- compliance armour ends --- */

.bdr-garrick,
.bdr-garrick *,
.bdr-garrick *::before,
.bdr-garrick *::after {
  box-sizing: border-box;
}

.bdr-garrick[hidden] {
  display: none;
}

/* ------------------------------------------------------------ launcher */

/* Bottom-right, on the shell. The wordmark carries the name -- it literally
   reads "Ask Garrick" -- and the AI badge rides beside it, the same word the
   disclosure uses, on the page before a single deferred byte is fetched.

   UNDER THE MOUNT'S ID, for the reason every other control in this sheet is:
   hello-elementor's reset.css paints `[type="button"], [type="submit"], button`
   -- an attribute selector, 0,1,0, the same weight as a class -- and it is
   enqueued after both of the plugin's sheets, so it takes every tie. #57 raised
   Close, the answer buttons and the hint out of that tie and left the launcher
   in it, and the split in #60 turned the tie into a defect that MOVES: the eager
   sheet is enqueued before the reset and lost `display`, `padding`,
   `border-radius`, `background-color` and `box-shadow` to it, while this sheet
   is injected into the head on the first click, lands after the reset, and won
   them back. Two copies of one declaration, two different winners, and the chip
   changed shape under the visitor's finger 29ms into the click that opened it:
   180x64 as a transparent, 3px-radius, inline-block box with the AI badge on a
   second line, then 217x52 as the shell pill with the badge beside the wordmark.
   Measured on staging 0.3.0, 5 September 2026. At 1,1,0 neither sheet is in the
   tie any more, so the closed chip lays out at its final size from first paint
   and the panel sheet arriving changes nothing about it. */
#bdr-garrick .bdr-garrick__launcher {
  align-items: center;
  background: var(--bdr-garrick-shell);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--bdr-garrick-radius);
  box-shadow: var(--bdr-garrick-lift);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  gap: 9px;
  min-height: 52px;
  padding: 13px 16px;
  transition: border-color 160ms cubic-bezier(0.2, 0, 0, 1);
}

/* Brand blue answers the pointer. It is on the shell, which is the only ground
   the brand blue is allowed on. */
#bdr-garrick .bdr-garrick__launcher:hover {
  border-color: var(--bdr-garrick-brand);
}

/* Busy, not disabled: the boot script marks the launcher busy while the panel's
   code is on the wire, because disabling the button would drop a keyboard user
   to the body for the length of the download. The widget's paint used to
   disagree and write `disabled` for the length of a turn -- which is how the
   dialog's focus restore came to aim the keyboard at a control that could not
   take it -- so it does not any more, and the `[disabled]` half of this
   selector went with it rather than sitting here matching nothing. */
#bdr-garrick .bdr-garrick__launcher[aria-busy="true"] {
  cursor: progress;
}

/* The open verdict has to outrank the resting rule above, and an id beats any
   number of classes: while the resting rule was a bare class this rule's three
   classes were enough, and the moment that rule took the mount's id they stopped
   being. The mount is the same element either way -- `#bdr-garrick` IS
   `.bdr-garrick` -- so this is the same selector at 1,2,0. */
#bdr-garrick[data-garrick-open="true"] .bdr-garrick__launcher {
  display: none;
}

/* The wait, made visible. `aria-busy` was the only feedback the click produced
   and nobody can see it, so a 2.4-2.7s cold load read to a tester as a click
   that did nothing. The chip pulses its rule on the typing dots' own 1.2s
   ease-in-out, and the unpulsed ring holds the state at the trough. Nothing
   here is on the layout path: the busy chip is the resting chip's box, which is
   the shape change #75 just removed and this must not reintroduce. The ring is
   MIXED FROM THE TOKEN, not transcribed from it. The argument in full is in
   bdr-garrick.css, beside the identical rule; this sheet is on every page and
   pays for its prose by the byte. */
#bdr-garrick .bdr-garrick__launcher[aria-busy="true"] {
  animation: bdr-garrick-launcher-pending 1.2s ease-in-out infinite;
  border-color: var(--bdr-garrick-brand);
  box-shadow: var(--bdr-garrick-lift), 0 0 0 3px color-mix(in srgb, var(--bdr-garrick-brand) 28%, transparent);
}

@keyframes bdr-garrick-launcher-pending {
  0%, 100% { border-color: var(--bdr-garrick-brand); }
  50% { border-color: rgba(255, 255, 255, 0.22); }
}

/* The boot script's one sentence, for a load that failed. OUT OF FLOW, like the
   panel, so it cannot set the mount's width and cannot move the chip; and empty
   drops its BOX, not the element, so the live region is still in the
   accessibility tree when the sentence arrives. Both arguments in full are in
   bdr-garrick.css, beside the identical rules. */
.bdr-garrick__boot-note {
  background: var(--bdr-garrick-shell);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--bdr-garrick-radius);
  bottom: 100%;
  color: var(--bdr-garrick-disclosure-shell);
  font-size: 14px;
  margin: 0 0 9px;
  max-width: min(264px, calc(100vw - 36px));
  padding: 10px 12px;
  position: absolute;
  right: 0;
  width: max-content;
}

.bdr-garrick__boot-note:empty {
  background: none;
  border: 0;
  padding: 0;
}

/* The wordmark, on the launcher and in the panel header. The source is
   2142x323, so 22px tall is 146px wide. Height alone sets it: setting width, or
   both, distorts it. It is an <img> by URL and never inlined -- the SVG carries
   a clipPath id, and duplicate ids in one document resolve to the first. */
.bdr-garrick__logo {
  display: block;
  flex: none;
  height: 22px;
  width: auto;
}

/* The panel sheet declares this ring once for every control on the shell; the
   launcher is the only one of them that exists before the panel is fetched, so
   the eager sheet takes the launcher's share of that selector list and nothing
   else. Same declarations, same specificity (1,2,0 either way -- the mount's id,
   the launcher's class, one pseudo-class), so the two sheets cannot disagree
   about the ring. The theme's own `button:focus-visible` ring is 0,1,1 and loses
   to this from either sheet. */
#bdr-garrick .bdr-garrick__launcher:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

/* --- compliance armour begins --- */
/* --------------------------------------------------- compliance, eager

   The word AI is on the launcher, and the launcher is on every page before any
   deferred byte has been fetched. Its armour therefore cannot be deferred with
   the panel: a badge whose styling arrives on first open is a badge a theme can
   erase for every visitor who never opens the panel. This rule is the same one
   the panel sheet carries, and the widget still rewrites it inline on boot. */
#bdr-garrick .bdr-garrick__badge--ai {
  background: transparent !important;
  border: 1px solid var(--bdr-garrick-brand, #00a5e2) !important;
  border-radius: 5px !important;
  color: var(--bdr-garrick-brand, #00a5e2) !important;
  display: inline-block !important;
  font-family: var(--bdr-garrick-font) !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  letter-spacing: 1.44px !important;
  line-height: 9px !important;
  opacity: 1 !important;
  padding: 3px 7px !important;
  text-indent: 0 !important;
  text-transform: uppercase !important;
  visibility: visible !important;
}

/* Closed still means closed. The panel's markup is server-rendered on every
   page, so between first paint and first open it is in the document with none
   of its own styling loaded; without this a theme's `[hidden] { display: block }`
   reset would paint an unstyled dialog over the page. */
#bdr-garrick .bdr-garrick__panel[hidden] {
  display: none !important;
}
/* --- compliance armour ends --- */

@media (max-width: 640px) {
  .bdr-garrick {
    bottom: 12px;
    right: 12px;
  }
}

/* The panel sheet makes every transition instant in one selector list; the
   launcher is the only one of them on the page yet, so this is its share. */
@media (prefers-reduced-motion: reduce) {
  #bdr-garrick .bdr-garrick__launcher {
    transition: none;
  }

  /* The state stays; only the pulse goes. The brand border and the ring are
     declared outside this block, so they are what is left standing. */
  #bdr-garrick .bdr-garrick__launcher[aria-busy="true"] {
    animation: none;
  }
}
