/* Chat widget in the Post Sign world (DESIGN.md): spruce and cream only, rust for actions only,
   Saira Condensed caps for labels, Public Sans for reading. Uses the page's tokens with fallbacks. */
.abchat-root {
  --c-spruce: var(--spruce, #1f3a2e);
  --c-spruce-deep: var(--spruce-deep, #152a20);
  --c-cream: var(--cream, #f3ecda);
  --c-cream-edge: var(--cream-edge, #e2d8be);
  --c-rust: var(--rust, #9c3d26);
  --c-on-rust: #fff7ea;
  --c-on-spruce: var(--on-spruce, #f1ebdb);
  --c-ink: var(--ink, #23201a);
  --c-heading-ink: var(--heading-ink, #1b2a22);
  --c-ink-soft: var(--ink-soft, #57513f);
  --c-ease: var(--ease, cubic-bezier(0.2, 0.7, 0.2, 1));
  position: fixed;
  /* Desktop: above the site's back-to-top button (.totop, right 18px, bottom 18px, 42px tall). */
  right: 18px;
  bottom: 72px;
  /* Above .totop (80), below the sticky mobile bar (90) and the header (100) while closed. */
  z-index: 85;
  font-family: "Public Sans", system-ui, -apple-system, sans-serif;
  color: var(--c-ink);
}
.abchat-launcher,
.abchat-send {
  font-family: "Saira Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  background: var(--c-rust);
  color: var(--c-on-rust);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}
.abchat-launcher {
  padding: 12px 18px;
  font-size: 16px;
  box-shadow: 0 10px 22px rgba(10, 20, 15, 0.3);
  transform: rotate(-1.1deg);
}
.abchat-launcher:hover,
.abchat-send:hover { background: #a94229; }
.abchat-launcher:focus-visible,
.abchat-send:focus-visible,
.abchat-close:focus-visible,
.abchat-input:focus-visible,
.abchat-field input:focus-visible { outline: 3px solid var(--c-rust); outline-offset: 2px; }
.abchat-open .abchat-launcher { display: none; }
.abchat-panel {
  width: min(380px, calc(100vw - 24px));
  /* The root sits 72px up; keep the header (and Close) on screen on short laptop windows. */
  max-height: min(620px, calc(100vh - 88px));
  max-height: min(620px, calc(100dvh - 88px));
  display: flex;
  flex-direction: column;
  background: var(--c-cream);
  /* Cream enamel all the way up: a spruce header on the spruce page had no top edge. */
  border: 2px solid var(--c-cream-edge);
  border-radius: 4px;
  box-shadow: 0 16px 30px rgba(10, 20, 15, 0.38);
  overflow: hidden;
  animation: abchat-settle 0.42s var(--c-ease);
  position: relative;
  min-width: 320px;
}
/* Resize grip, top-left (the panel is pinned bottom-right). Two steel hairlines: hardware, not content. */
.abchat-grip {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background:
    linear-gradient(135deg, transparent 0 5px, #8a8f84 5px 6px, transparent 6px 9px, #8a8f84 9px 10px, transparent 10px);
  cursor: nwse-resize;
  touch-action: none;
  z-index: 1;
}
.abchat-grip:focus-visible { outline: 3px solid var(--c-rust); outline-offset: -3px; }
.abchat-panel[hidden] { display: none; }
@keyframes abchat-settle { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.abchat-reduce .abchat-panel { animation: none; }
@media (prefers-reduced-motion: reduce) { .abchat-panel { animation: none; } .abchat-launcher { transform: none; } }
.abchat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-cream);
  color: var(--c-heading-ink);
  border-bottom: 1px solid rgba(35, 32, 26, 0.18);
  padding: 10px 14px;
}
.abchat-title {
  font-family: "Saira Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 9px;
}
/* A rivet: the sign's fastening hardware, drawn like the site's grommet dots. */
.abchat-title::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c9cdc2, #565b52);
  flex: none;
}
.abchat-close {
  background: transparent;
  color: var(--c-heading-ink);
  border: 1px solid rgba(35, 32, 26, 0.3);
  border-radius: 3px;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.abchat-log { position: relative; flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.abchat-msg p { margin: 0; white-space: pre-wrap; line-height: 1.45; font-size: 15px; }
.abchat-msg.user { align-self: flex-end; background: var(--c-spruce); color: var(--c-on-spruce); padding: 8px 11px; border-radius: 4px; max-width: 85%; }
.abchat-msg.bot { align-self: flex-start; max-width: 92%; }
/* Working row: three steel rivets light in turn beside the real stage text. */
.abchat-working { display: flex; align-items: center; gap: 6px; color: var(--c-ink-soft); font-size: 14px; }
.abchat-rivet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c9cdc2, #565b52);
  opacity: 0.35;
  animation: abchat-rivet 1.2s var(--c-ease) infinite;
}
.abchat-rivet:nth-child(2) { animation-delay: 0.2s; }
.abchat-rivet:nth-child(3) { animation-delay: 0.4s; }
.abchat-stage { margin-left: 4px; }
@keyframes abchat-rivet { 0%, 60%, 100% { opacity: 0.35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.abchat-reduce .abchat-rivet { animation: none; opacity: 0.7; }
@media (prefers-reduced-motion: reduce) { .abchat-rivet { animation: none; opacity: 0.7; } }
.abchat-cites { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--c-ink-soft); }
.abchat-cites a { color: var(--c-rust); }
.abchat-card { background: #fffaf0; border: 1px solid var(--c-cream-edge); border-radius: 4px; padding: 12px; display: grid; gap: 8px; }
.abchat-card-title { margin: 0; font-family: "Saira Condensed", sans-serif; text-transform: uppercase; font-weight: 700; letter-spacing: 0.06em; }
.abchat-card-note { margin: 0; font-size: 12px; color: var(--c-ink-soft); }
.abchat-field { display: grid; gap: 3px; font-size: 13px; }
.abchat-field input,
.abchat-input {
  font: inherit;
  font-size: 15px;
  color: var(--c-ink);
  background: #fffdf7;
  border: 1px solid #b9ad8c;
  border-radius: 3px;
  padding: 7px 9px;
}
.abchat-error { margin: 0; font-size: 13px; color: #7a2d1a; }
.abchat-compose { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--c-cream-edge); }
.abchat-input { flex: 1; resize: none; }
.abchat-send { padding: 0 14px; font-size: 15px; }
.abchat-send:disabled { opacity: 0.6; cursor: default; }
.abchat-foot { margin: 0; padding: 7px 14px 10px; font-size: 12px; color: var(--c-ink-soft); }
.abchat-foot a { color: var(--c-rust); font-weight: 600; }
.abchat-open { z-index: 95; }
/* Phones: the site shows a sticky Call / Schedule bar (.msticky, ~80px) and moves .totop to the
   right above it. The launcher sits bottom-left above the bar; the open panel stays above the bar
   so Call and Schedule remain reachable. */
@media (max-width: 760px) {
  .abchat-root { right: auto; left: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .abchat-launcher { font-size: 14px; padding: 10px 14px; }
  .abchat-open { left: 8px; right: 8px; }
  /* Phones: always full width, no resizing (inline sizes from a desktop visit are overridden). */
  .abchat-panel { width: 100% !important; height: auto !important; min-width: 0; max-height: calc(100vh - 170px) !important; max-height: calc(100dvh - 170px) !important; }
  .abchat-grip { display: none; }
}
.abchat-ext { display: inline-block; margin-left: 3px; font-size: 0.9em; text-decoration: none; }
.abchat-live, .abchat-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
