/* ==========================================================================
   gadgets.css — the "gadget" preview in the Your know-how section.
   Every selector begins `.gx` (plus @keyframes named `gx-…`). The gadget views
   own `.gxv-*` in gadgets-views.css. Tokens only — see assets/css/tokens.css —
   so there is no colour, font, radius, shadow or timing written out here.
   Loaded after booking.css, before gadgets-views.css. Built by gadgets.js.
   ========================================================================== */

/* The mount. The know-how section is a centred flex column, so the width is set
   explicitly, and min-width:0 lets wide content scroll inside its own box. */
.gx {
  width: 100%;
  max-width: 1000px;   /* same as .demo-window (demo.css) so the two blocks line up */
  min-width: 0;
  margin: 40px auto 0;
  text-align: left;
  font-family: var(--font-sans);
  color: var(--ink);
}
.gx > * { min-width: 0; }
.gx p { max-width: none; }

/* ---- The input box -------------------------------------------------------- */
.gx-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.gx-box:focus-within {
  border-color: var(--ink-subtle);
  box-shadow: var(--focus-ring);
}
.gx-box__icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--accent); /* decorative mark, never text */
}
.gx-box__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-strong);
  font-family: var(--font-sans);
  font-size: 16px; /* 16px stops iOS zooming in on focus */
  font-weight: var(--fw-body);
  line-height: 1.3;
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
}
.gx-box__input:focus,
.gx-box__input:focus-visible { outline: none; } /* the box shows the focus ring instead */
.gx-box__input::placeholder {
  color: var(--ink-subtle);
  opacity: 1; /* browsers dim placeholders; --ink-subtle is already the AA floor */
}
.gx-box__hud {
  flex: 0 0 auto;
  margin-right: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-subtle);
  white-space: nowrap;
}
.gx-box__hud:empty { display: none; }
.gx-box__clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.gx-box__clear:hover { background: var(--paper-2); color: var(--ink); }
.gx-box__clear:focus-visible {
  outline: 2px solid transparent; /* stays visible in forced-colours mode */
  box-shadow: var(--focus-ring);
}

.gx-hint {
  margin: 12px 0 0;
  font-size: var(--fs-tiny);
  color: var(--ink-soft);
}

/* ---- Example chips + "Did you mean" ------------------------------------------ */
/* One row that drifts slowly right-to-left behind faded edges — inspiration for what to
   type, not a menu. The track holds the chips twice (gadgets.js) and moves by exactly
   half its width, so the loop is seamless. Pauses while hovered or focused so a chip can
   be clicked; with reduced motion it becomes a plain swipeable row instead. */
.gx-chips {
  --gx-chip-gap: 8px;
  --gx-fade: 64px;
  position: relative;
  margin: 14px 0 0;
  padding-block: 4px; /* room for the focus ring */
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--gx-fade), #000 calc(100% - var(--gx-fade)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--gx-fade), #000 calc(100% - var(--gx-fade)), transparent 100%);
}
.gx-chips__track {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--gx-chip-gap);
  width: max-content;
  animation: gx-chips-drift 60s linear infinite;
}
.gx-chips__track > .gx-chip:last-child { margin-right: var(--gx-chip-gap); } /* keeps the seam gap equal */
.gx-chips:hover .gx-chips__track,
.gx-chips:focus-within .gx-chips__track { animation-play-state: paused; }
@keyframes gx-chips-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.gx-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 30px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--fw-regular);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.gx-chip:hover { background: var(--rule-warm); }
.gx-chip:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring);
}
.gx-chip--dym {
  background: var(--paper-2);
  color: var(--accent-ink);
  font-weight: var(--fw-medium);
}
.gx-chip--dym:hover {
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px var(--accent-ink);
}
.gx-chip--dym:focus-visible { box-shadow: var(--focus-ring); }

.gx-dym {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: var(--fs-tiny);
  color: var(--ink-soft);
}
.gx-dym__q { margin-left: -6px; } /* hug the chip: "Did you mean [Invoice]?" */

/* ---- The window (the showcase's recipe) ------------------------------------------ */
.gx-stage { margin-top: 20px; }
/* The window stays hidden until the visitor types or taps a chip, then eases in. */
.gx-stage[hidden] { display: none; }
.gx-stage.is-opening { animation: gx-stage-in 320ms var(--ease-out, cubic-bezier(0.22, 0.61, 0.36, 1)) both; }
/* "Tell it a little more": shown when nothing typed so far fits a gadget. */
.gx-more { padding: 28px 24px; }
.gx-more__text { margin: 0; max-width: 56ch; color: var(--ink-2); font-size: var(--fs-body, 15px); line-height: var(--lh-body, 1.55); }
@keyframes gx-stage-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gx-stage.is-opening { animation: none; }
}
.gx-window {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden; /* clips the height animation and any wide view */
  background: var(--paper);
  border: 1px solid var(--rule-warm);
  border-radius: var(--radius-window);
  box-shadow: var(--shadow-window);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 12px); /* clear of the sticky header */
}

.gx-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding-inline: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule-warm);
}
.gx-titlebar__mark { display: block; flex: 0 0 auto; color: var(--ink); }
.gx-titlebar__mark .gx-mark__dot { fill: var(--accent); }
.gx-titlebar__mark .gx-mark__frame { fill: none; stroke: currentColor; }
.gx-titlebar__sep { flex: 0 0 auto; color: var(--ink-faint); font-size: 13px; }
.gx-titlebar__title {
  min-width: 0;
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  color: var(--ink-strong);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.gx-titlebar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
  flex: 0 1 auto;
}

.gx-pill {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  height: 20px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: var(--fw-medium);
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gx-pill--example { background: var(--paper-2); color: var(--ink); }
.gx-pill--live { background: var(--ok-wash); color: var(--ok-ink); } /* the live calendar: same green as the booking section's "Live" */

.gx-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-soft);
}
.gx-status__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--ok);
  flex: 0 0 auto;
}
.gx-status.is-building .gx-status__dot {
  background: var(--accent);
  animation: gx-pulse 1s var(--ease-in-out) infinite;
}

.gx-window__body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.gx-window__body:focus { outline: none; } /* it's only a programmatic focus target */
.gx-window__body:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.gx-icon { display: block; flex: 0 0 auto; }

.gx-window__foot {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--rule-warm);
}
.gx-foot__note {
  min-width: 0;
  font-size: 12px;
  color: var(--ink-subtle);
}
.gx-cta { flex: 0 0 auto; font-size: 13px; }
.gx-cta:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-chip);
}

/* A views' "would send / would reorder" message: a small dark pill above the footer text. */
.gx-toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(100% + 8px);
  z-index: 2;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 7px 14px;
  border-radius: var(--radius-card);
  background: var(--ink-strong);
  color: var(--paper);
  box-shadow: var(--shadow-card);
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--dur) var(--ease-out);
}
.gx-toast.is-out { opacity: 0; }

.gx-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-subtle);
}

/* ---- "Building…" skeleton -------------------------------------------------------- */
.gx-skel { display: grid; gap: 12px; padding: 4px 0 2px; }
.gx-skel__bar {
  display: block;
  height: 14px;
  border-radius: var(--radius-chip);
  background: linear-gradient(90deg, var(--paper-2) 25%, var(--rule-warm) 50%, var(--paper-2) 75%);
  background-size: 200% 100%;
  animation: gx-shimmer 1.1s linear infinite;
}
.gx-skel__bar:nth-child(1) { width: 92%; }
.gx-skel__bar:nth-child(2) { width: 64%; }
.gx-skel__bar:nth-child(3) { width: 78%; }
@keyframes gx-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@keyframes gx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---- Last-resort content, if even the "custom" view fails ---------------------------- */
.gx-fallback__text { margin: 0 0 12px; color: var(--ink-2); }
.gx-fallback__cta {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 0;
  background: var(--btn-dark);
  color: var(--btn-dark-ink);
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  text-decoration: none;
}
.gx-fallback__cta:hover { background: var(--btn-dark-hover); }
.gx-fallback__cta:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }

/* ---- Phones ---------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .gx-window__body { padding: 20px; }
}

@media (max-width: 639px) {
  .gx { margin-top: 32px; }

  .gx-chips { --gx-fade: 32px; margin-top: 10px; }
}

@media (max-width: 559px) {
  /* No room for the HUD inside the box: let it sit on the top border, like a legend. */
  .gx-box__hud {
    position: absolute;
    top: -8px;
    right: 14px;
    margin: 0;
    padding: 0 6px;
    background: var(--surface);
    font-size: 10.5px;
    line-height: 14px;
  }
}

@media (max-width: 519px) {
  .gx-titlebar { gap: 6px; padding-inline: 12px; }
  .gx-titlebar__right { gap: 8px; }
  .gx-pill { max-width: 46vw; }
  .gx-pill__pre { display: none; } /* "Salon & barber" is enough without "Built for:" */
  .gx-status__text { /* the dot stays; the words go to screen readers only */
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .gx-window__foot { padding: 10px 12px; }
}

/* ---- Reduced motion: final states only ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  /* No drift: a plain swipeable row, and only the first set of chips. */
  .gx-chips { overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .gx-chips::-webkit-scrollbar { display: none; }
  .gx-chips__track { animation: none; padding-inline: var(--gx-fade); }
  .gx-chips__track > .gx-chip[aria-hidden="true"] { display: none; }
  .gx-skel__bar,
  .gx-status.is-building .gx-status__dot { animation: none; }
  .gx-box,
  .gx-chip,
  .gx-box__clear,
  .gx-toast { transition: none; }
}
