/* ---------------------------------------------------------------------------
   Check panel (2026-09-10): "Check if it is worth automating", shared/check.js. The shell is in
   index.html ([data-check]); the views (chat, offline, done) are built by the script.

   Chosen look (2026-09-10): "quiet document" - a typed sheet on a mono rail, no bubbles, the
   verdict as a serif headline on a rule. The base rules below are the two-tone version the
   modifier .check--a builds on; the class is set in index.html. The entry is the form in the
   hero ([data-check-entry] in index.html, shared/check-entry.js), styled in the page itself.
   --------------------------------------------------------------------------- */
.check {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  --check-rail: 84px; /* variant A: the label column, like the 01-08 rail of the mobile menu */
}
.check-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 22, 33, 0.55);
}
.check-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 32px 64px -24px rgba(15, 22, 33, 0.5);
  outline: none;
}
@media (min-width: 640px) {
  .check { align-items: center; padding: 24px; }
  /* Grows with the conversation up to the cap, then the list scrolls */
  .check-dialog { height: auto; min-height: 440px; max-height: min(720px, calc(100vh - 48px)); max-height: min(720px, calc(100dvh - 48px)); border-radius: 10px; }
}

/* Head (B): the dark band of the hero panel, title in the serif */
.check-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 16px;
  background: var(--band-bg);
  color: var(--band-fg);
  border-bottom: 1px solid var(--band-line);
}
.check-title { margin: 0; font-size: 1.5rem; max-width: none; color: var(--band-fg); }
.check-head .modal-close { background: transparent; border-color: var(--band-line-strong); color: var(--band-fg); }
.check-head .modal-close:hover { border-color: var(--band-fg); }
.check-head .modal-close:focus-visible { outline-color: var(--band-accent); }
@media (prefers-color-scheme: dark) {
  .check-head { background: var(--band-elev); }
}

.check-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 24px 22px;
}
@media (max-width: 480px) {
  .check-head { padding: 16px 18px 14px; }
  .check-body { padding: 14px 18px 18px; }
}
.check-intro { margin: 0; font-size: 0.95rem; color: var(--fg-muted); }
.check-loading, .check-offline { margin: 0; }
.check-loading { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em; color: var(--fg-muted); }
.check-offline { font-size: 1.05rem; line-height: 1.5; }
.check-offline a { text-decoration: underline; text-underline-offset: 3px; }

/* Message list: the only thing that scrolls. Empty until the first message. */
.check-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}
.check-msg {
  max-width: 88%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.check-msg[data-role="user"] { align-self: flex-end; background: var(--soft); border-color: transparent; border-radius: 10px 10px 2px 10px; }
.check-msg[data-role="assistant"] { align-self: flex-start; background: var(--bg-elev); border-radius: 10px 10px 10px 2px; }
.check-who {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.check-msg-body p { margin: 0; max-width: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.check-msg-body p + p { margin-top: 8px; }
.check-verdict { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; line-height: 1.15; color: var(--accent); }
.check-thinking {
  align-self: flex-start;
  margin: 0;
  padding: 6px 2px;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

/* Starter chips: prefill the textarea, hidden after the first message */
.check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg-muted);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.check-chip:hover { border-color: var(--line-strong); color: var(--fg); }
.check-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Composer and the email form share one row: field grows, button keeps its size */
.check-composer, .check-email { flex: none; display: block; }
.check-label { display: block; margin-bottom: 6px; font-size: 0.88rem; color: var(--fg-muted); }
.check-composer .check-label {
  position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden;
}
.check-row { display: flex; align-items: flex-end; gap: 10px; }
.check-input, .check-email-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}
.check-input { resize: none; min-height: 68px; max-height: 40vh; }
.check-input:focus, .check-email-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check-input:disabled, .check-email-input:disabled { opacity: 0.6; }
.check-row .btn { flex: none; }
.check-hint { margin: 8px 0 0; font-size: 0.82rem; color: var(--fg-muted); }
.check-hint a { text-decoration: underline; text-underline-offset: 3px; }

/* Error line above the composer, "Try again" inside */
.check-error {
  flex: none;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid #b91c1c;
  background: var(--soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.check-error p { margin: 0; max-width: none; }
.check-error .link-btn { margin-top: 4px; font-size: 0.9rem; }
.check-err { margin: 6px 0 0; font-size: 0.82rem; color: #b91c1c; }
.check-email-input[aria-invalid="true"] { border-color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .check-backdrop { background: rgba(5, 8, 12, 0.7); }
  .check-dialog { border-color: var(--line-strong); }
  .check-error { border-left-color: #f87171; }
  .check-err { color: #f87171; }
  .check-email-input[aria-invalid="true"] { border-color: #f87171; }
}

/* Done: booking button and the email form, above the (disabled) composer */
.check-foot {
  flex: none;
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.check-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.check-msg-actions { margin-top: 12px; }
.check-sent { margin: 0; font-size: 0.95rem; outline: none; }

/* ---- Variant A: quiet document. A typed sheet: no bubbles, speaker labels in mono on the
   left rail, every turn on its own hairline, the verdict as a serif headline on a rule, the
   starters as numbered underlined links, the field as a single rule. ---- */
.check--a .check-dialog { max-width: 640px; }
.check--a .check-head {
  align-items: flex-start;
  padding: 22px 28px 16px;
  background: var(--bg-elev);
  color: var(--fg);
  border-bottom: 1px solid var(--line-strong);
}
.check--a .check-title { font-size: 1.75rem; letter-spacing: -0.01em; color: var(--fg); }
.check--a .check-head .modal-close { background: var(--bg-elev); border-color: var(--line-strong); color: var(--fg); }
.check--a .check-head .modal-close:hover { border-color: var(--fg); }
.check--a .check-head .modal-close:focus-visible { outline-color: var(--accent); }
.check--a .check-body { gap: 0; padding: 16px 28px 24px; }
.check--a .check-intro, .check--a .check-offline, .check--a .check-loading { padding-left: var(--check-rail); }
.check--a .check-intro { margin-bottom: 12px; }
.check--a .check-list { gap: 0; border-top: 1px solid var(--line); }
.check--a .check-list:empty { border-top: 0; margin-top: -12px; }
.check--a .check-msg {
  display: grid;
  grid-template-columns: var(--check-rail) minmax(0, 1fr);
  align-self: stretch;
  max-width: none;
  padding: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.check--a .check-msg:first-child { border-top: 0; padding-top: 8px; }
.check--a .check-who { margin: 0; padding-top: 3px; font-size: 0.7rem; letter-spacing: 0.12em; }
.check--a .check-msg[data-role="assistant"] .check-who { color: var(--accent); }
.check--a .check-verdict {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.65rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--fg);
}
.check--a .check-verdict[data-verdict="yes"] { color: var(--accent); }
.check--a .check-verdict + p { margin-top: 12px; }
.check--a .check-thinking { align-self: stretch; padding: 14px 0 6px var(--check-rail); border-top: 1px solid var(--line); }
.check--a .check-chips { flex-direction: column; gap: 0; margin-top: 10px; counter-reset: check-chip; }
.check--a .check-chip {
  position: relative;
  padding: 9px 0 9px var(--check-rail);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.95rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.check--a .check-chip:last-child { border-bottom: 1px solid var(--line); }
.check--a .check-chip::before {
  counter-increment: check-chip;
  content: counter(check-chip, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}
.check--a .check-chip:hover { color: var(--accent); text-decoration-thickness: 2px; }
.check--a .check-chip:focus-visible { outline-offset: -2px; }
.check--a .check-composer { margin-top: 16px; }
.check--a .check-composer, .check--a .check-email { display: grid; grid-template-columns: var(--check-rail) minmax(0, 1fr); }
.check--a .check-composer .check-label, .check--a .check-email .check-label {
  position: static; width: auto; height: auto; overflow: visible;
  grid-row: 1; margin: 0; padding-top: 12px; padding-right: 8px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted);
}
.check--a .check-email .check-label { grid-column: 2; grid-row: auto; padding-top: 0; margin-bottom: 2px; }
.check--a .check-row, .check--a .check-hint, .check--a .check-err { grid-column: 2; }
.check--a .check-input, .check--a .check-email-input {
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}
.check--a .check-input { min-height: 60px; }
.check--a .check-input:focus, .check--a .check-email-input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.check--a .check-error { margin-left: var(--check-rail); }
.check--a .check-foot { margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--line-strong); }
.check--a .check-actions { padding-left: var(--check-rail); }
@media (max-width: 480px) {
  .check--a { --check-rail: 58px; }
  .check--a .check-head { padding: 18px 20px 14px; }
  .check--a .check-title { font-size: 1.5rem; }
  .check--a .check-body { padding: 12px 20px 20px; }
}

/* Motion: the sheet rises into place, the hover states ease */
@media (prefers-reduced-motion: no-preference) {
  .check-dialog { animation: check-rise 0.2s ease; }
  .check-chip, .check-input, .check-email-input { transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease; }
  @keyframes check-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
}

/* Mobile menu footer: the check entry as a text link under the booking button */
@media (max-width: 720px) {
  .site-header .nav-foot .nav-check { font-size: 1rem; color: var(--fg); }
}

/* Once the conversation has started the intro has done its job (every variant) */
.check-intro:has(+ .check-list:not(:empty)) { display: none; }
.check--a .check-intro:has(+ .check-list:not(:empty)) + .check-list { border-top: 0; }
