/* MeadowMind chatbot — Carolina Meadows design system (CLAUDE.md §6).
   Navy chrome, cream ground, white surfaces, gold used sparingly. Georgia
   headings, Calibri body. Accessible: 16px floor, real focus states, AA contrast. */

:root {
  --navy: #1a1a2e;
  --navy-soft: #26263f;
  --gold: #c4a44a;
  --gold-light: #d4b96a;
  --cream: #faf7f0;
  --white: #ffffff;
  --grey: #6b7280;
  --grey-light: #9ca3af;
  --line: #e7e2d6;
  --shadow: 0 1px 3px rgba(26, 26, 46, 0.08), 0 6px 20px rgba(26, 26, 46, 0.06);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Calibri, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--navy);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

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

.chat {
  max-width: 820px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

/* --- Header --- */
.chat-head {
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
}
.brand { display: flex; align-items: baseline; gap: 0.6rem; }
.brand .mark { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.brand .sub { color: var(--grey-light); font-size: 0.85rem; }

.notice {
  background: #f2ede0;
  color: #6a5a30;
  font-size: 0.86rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

/* --- Messages --- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }

.bubble {
  max-width: 78%;
  padding: 0.8rem 1.05rem;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow);
}
.msg.assistant .bubble {
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg.user .bubble {
  background: var(--navy);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.bubble.typing { color: var(--grey); font-style: italic; }
.bubble.typing .dots span {
  display: inline-block; width: 6px; height: 6px; margin-left: 2px;
  background: var(--grey-light); border-radius: 50%;
  animation: blink 1.2s infinite both;
}
.bubble.typing .dots span:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .bubble.typing .dots span { animation: none; opacity: 0.5; }
}

.error-note { color: #9a3f3f; font-size: 0.9rem; padding: 0 1.25rem 0.5rem; }

.sources {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--grey);
  max-width: 78%;
}

/* --- Composer --- */
.composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 0.9rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--cream);
}
.composer textarea {
  flex: 1;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  resize: none;
  max-height: 160px;
}

/* --- Buttons --- */
.btn-send {
  font-family: var(--sans); font-size: 1rem; font-weight: 600;
  padding: 0.7rem 1.3rem; border: 1px solid transparent; border-radius: 12px;
  background: var(--gold); color: var(--navy); cursor: pointer;
  transition: background 0.15s ease;
}
.btn-send:hover { background: var(--gold-light); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  background: transparent; color: var(--cream); border: 1px solid transparent;
  padding: 0.35rem 0.6rem; border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { color: var(--gold-light); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (max-width: 520px) {
  .bubble { max-width: 88%; }
}
