/* AI Lucy — chat UI. Brand-light: ink ground, EB Garamond headings, gold accents.
   Matches lucyworks.com (ink #15171b, cream #f7f4ec, gold #c9a227 / #e7c15e). Zero deps. */
:root {
  --ink: #15171b;
  --ink-soft: #3d4149;
  --ink-faint: #6b7079;
  --paper: #ffffff;
  --cream: #f7f4ec;
  --cream-deep: #efe9dc;
  --line: #e4ddcd;
  --gold: #c9a227;
  --gold-bright: #e7c15e;
  --gold-soft: #f6edd4;
  --gold-line: #e2cf97;
  --gold-ink: #7a5f14;
  --lucy-bubble: #f3efe4;
  --user-bubble: #15171b;
  --danger: #a3341f;
  --radius: 14px;
  --maxw: 720px;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* ---- header ---- */
header {
  padding: 18px 22px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap; }
.brand h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.005em;
  color: #fff;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold-bright);
  display: inline-block;
  align-self: center;
  box-shadow: 0 0 0 3px rgba(231, 193, 94, 0.18);
}
.brand .tag {
  font-size: 0.82rem;
  color: var(--gold-bright);
  letter-spacing: 0.01em;
}
.subhead {
  margin: 7px 0 0;
  font-size: 0.9rem;
  color: #c9ccd2;
  max-width: 60ch;
}

/* ---- stream ---- */
main {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--cream);
  scroll-behavior: smooth;
}

.msg { display: flex; flex-direction: column; max-width: 100%; }
.msg .bubble {
  max-width: 86%;
  padding: 12px 15px;
  border-radius: var(--radius);
  font-size: 0.97rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(21, 23, 27, 0.04);
}
.msg.user { align-items: flex-end; }
.msg.user .bubble {
  background: var(--user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.lucy { align-items: flex-start; }
.msg.lucy .bubble {
  background: var(--lucy-bubble);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--line);
}
.msg.lucy.gap .bubble { border-left: 3px solid var(--gold); }
.msg.error .bubble {
  background: #fbeeea;
  color: var(--danger);
  border: 1px solid #eccabf;
}

.who {
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin: 0 0 4px 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ---- typing indicator ---- */
.typing .bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}
.typing .dot-t {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint);
  opacity: 0.4;
  animation: blink 1.2s infinite ease-in-out both;
}
.typing .dot-t:nth-child(2) { animation-delay: 0.2s; }
.typing .dot-t:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .typing .dot-t { animation: none; opacity: 0.6; }
  main { scroll-behavior: auto; }
}

/* ---- inline cards (email capture + book a call) ---- */
.card-inline {
  align-self: stretch;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  padding: 16px;
}
.card-inline h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--gold-ink);
}
.card-inline p { margin: 0 0 12px; font-size: 0.9rem; color: var(--ink-soft); }
.card-inline form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-inline input[type=email] {
  flex: 1; min-width: 190px;
  padding: 11px 13px; border: 1px solid var(--gold-line); border-radius: 9px;
  font: inherit; font-size: 0.95rem; background: #fff; color: var(--ink);
}
.card-inline input[type=email]:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-inline .dismiss {
  background: none; border: none; color: var(--ink-faint);
  font-size: 0.85rem; cursor: pointer; padding: 6px 4px; text-decoration: underline;
  font-family: inherit;
}
.card-inline .dismiss:hover { color: var(--ink); }

/* ---- buttons ---- */
.btn {
  appearance: none; border: none; cursor: pointer;
  padding: 11px 20px; border-radius: 9px;
  font-family: var(--sans); font-size: 0.95rem; font-weight: 600;
  background: var(--gold); color: var(--ink);
  transition: background .15s, transform .05s;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.btn:hover { background: var(--gold-bright); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.book { background: var(--ink); color: #fff; }
.btn.book:hover { background: #2a2e36; }

.linklike {
  appearance: none; background: none; border: none; padding: 0;
  color: var(--gold-ink); font: inherit; font-size: inherit;
  text-decoration: underline; cursor: pointer;
}
.linklike:hover { color: var(--ink); }

/* ---- composer ---- */
footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 12px 16px calc(10px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
}
.composer { display: flex; gap: 10px; align-items: flex-end; margin: 0; }
.composer textarea {
  flex: 1;
  resize: none;
  min-height: 46px; max-height: 148px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit; font-size: 1rem;
  background: var(--cream);
  color: var(--ink);
}
.composer textarea::placeholder { color: var(--ink-faint); }
.composer textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: 0;
  border-color: var(--gold);
  background: #fff;
}
.composer .send { align-self: stretch; min-width: 74px; }

.disclaimer {
  margin: 9px 3px 0;
  font-size: 0.75rem;
  color: var(--ink-faint);
  line-height: 1.4;
}
.disclaimer strong { color: var(--ink-soft); }

.counters {
  font-size: 0.72rem; color: var(--ink-faint);
  text-align: center; padding: 6px 0 0;
}

/* ---- responsive ---- */
@media (max-width: 640px) {
  :root { font-size: 15.5px; }
  .wrap { border: none; }
  header { padding: 15px 16px 13px; }
  .brand h1 { font-size: 1.35rem; }
  main { padding: 16px 16px 6px; gap: 14px; }
  .msg .bubble { max-width: 90%; }
  footer { padding: 10px 12px calc(9px + env(safe-area-inset-bottom)); }
  .composer .send { min-width: 64px; padding: 11px 14px; }
}
