/* Ask the guide sidecar. Colours come only from the custom properties in ../app.css (contrast pairs are in scripts/check_contrast.py). */

body { padding-bottom: 72px; }

.guide-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.guide-launcher {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  min-height: 44px; min-width: 44px; padding: 10px 20px;
  font: 700 15px/1.2 var(--font-body); color: var(--white); background: var(--accent);
  border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}
.guide-launcher:hover { background: var(--accent-hover); }
.guide-launcher[aria-expanded="true"] { background: var(--ink); color: var(--on-ink); }

.guide-panel {
  position: fixed; right: 16px; bottom: 76px; z-index: 60;
  width: min(400px, calc(100vw - 32px));
  /* --guide-top is set by guide.js to the bottom of the sticky top bar, so the panel never covers the toggle or the step bar. */
  max-height: calc(100vh - var(--guide-top, 160px) - 88px); max-height: calc(100dvh - var(--guide-top, 160px) - 88px);
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--cream); color: var(--ink); font: 400 14px/1.45 var(--font-body);
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}
.guide-panel[hidden] { display: none; }

.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guide-title { margin: 0; font: 700 20px/1.2 var(--font-head); color: var(--ink); }

.guide-close, .guide-send, .guide-suggest {
  font: 600 14px/1.3 var(--font-body); cursor: pointer; border-radius: 8px; min-height: 44px;
}
.guide-close { min-width: 44px; padding: 8px 14px; color: var(--ink); background: var(--white); border: 1.5px solid var(--ink); border-radius: 999px; }
.guide-close:hover { background: var(--accent-soft); }

.guide-status { margin: 0; padding: 8px 10px; font-size: 13px; color: var(--ink); background: var(--pale); border-radius: 8px; }
.guide-panel[data-guide-mode="offline"] .guide-status { color: var(--warn-ink); background: var(--warn); border: 1px solid var(--warn-border); }

.guide-subhead { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.guide-suggest-wrap { flex: 0 1 auto; min-height: 0; overflow-y: auto; max-height: 34vh; }
.guide-suggest-list { display: flex; flex-direction: column; gap: 6px; }
.guide-suggest {
  text-align: left; padding: 8px 12px; font-weight: 500; color: var(--ink); border-radius: 14px;
  background: var(--white); border: 1px solid var(--line);
}
.guide-suggest:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.guide-suggest:disabled, .guide-send:disabled { color: var(--muted); background: var(--cream-2); cursor: not-allowed; }

.guide-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 2px; overflow-wrap: anywhere;
}
.guide-log:empty { display: none; }
.guide-msg { padding: 8px 10px; border-radius: 10px; max-width: 94%; }
.guide-text { margin: 0; white-space: pre-wrap; }
.guide-user { align-self: flex-end; color: var(--white); background: var(--accent); }
.guide-bot { align-self: flex-start; color: var(--ink); background: var(--cream-2); border: 1px solid var(--line); }
.guide-pending { align-self: flex-start; color: var(--muted); background: var(--cream-2); font-style: italic; }
.guide-error { align-self: stretch; max-width: 100%; color: var(--danger-ink); background: var(--danger-bg); border: 1px solid var(--danger-border); }
.guide-note { align-self: center; max-width: 100%; color: var(--muted); background: var(--white); font-size: 13px; text-align: center; }

.guide-tag {
  display: inline-block; margin-bottom: 4px; padding: 1px 8px; font-size: 12px; font-weight: 600;
  border-radius: 999px; border: 1px solid transparent;
}
.guide-offline-note { display: block; margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.guide-tag-offline { color: var(--warn-ink); background: var(--warn); border-color: var(--warn-border); }
.guide-tag-live { color: var(--teal-ink); background: var(--pale); border-color: var(--teal); }

.guide-form { display: flex; flex-direction: column; gap: 6px; }
.guide-input {
  width: 100%; min-height: 64px; max-height: 140px; padding: 8px 10px; resize: vertical;
  font: 400 14px/1.4 var(--font-body); color: var(--ink); background: var(--white);
  border: 1.5px solid var(--ink); border-radius: 12px;
}
.guide-input::placeholder { color: var(--muted); opacity: 1; }
.guide-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.guide-counter { font-size: 12px; color: var(--muted); }
.guide-counter-full { color: var(--danger-ink); font-weight: 600; }
.guide-send { padding: 8px 22px; color: var(--white); background: var(--accent); border: 1.5px solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--ink); }
.guide-send:hover:not(:disabled) { background: var(--accent-hover); }
.guide-send:disabled { box-shadow: none; }

.guide-launcher:focus-visible, .guide-close:focus-visible, .guide-suggest:focus-visible,
.guide-send:focus-visible, .guide-input:focus-visible, .guide-log:focus-visible {
  outline: 3px solid var(--focus-light); outline-offset: 2px;
}
.guide-launcher:focus-visible { box-shadow: 0 0 0 2px var(--white), 0 0 0 5px var(--focus-light); }
.guide-launcher[aria-expanded="true"]:focus-visible { outline-color: var(--sun); }

@media (max-width: 640px) {
  .guide-launcher { right: 12px; bottom: 12px; }
  .guide-panel {
    left: 0; right: 0; bottom: 0; width: auto;
    max-height: calc(100vh - var(--guide-top, 160px) - 12px); max-height: calc(100dvh - var(--guide-top, 160px) - 12px);
    border-radius: var(--radius) var(--radius) 0 0; border-width: 1.5px 0 0 0; box-shadow: none;
  }
  .guide-input { font-size: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .guide-launcher, .guide-suggest, .guide-send { transition: background-color 0.12s; }
}
