/* The chat page (SPEC section 6). Self-contained: system fonts, no images, no third parties.
   Works from 360 pixels wide; text is at least 16 pixels; every colour pair meets 4.5:1. */

:root {
  --text: #1f2933;
  --muted: #4b5563;
  --background: #ffffff;
  --panel: #f3f4f6;
  --person: #e4eef9;
  --accent: #0b5fa5;
  --accent-dark: #084a80;
  --error: #9f1c1c;
  --border: #d1d5db;
  --focus: #ffbf47;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
}

h1 { font-size: 1.25rem; margin: 0; }
p { margin: 0 0 0.5rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

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

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.tagline { margin: 0; color: var(--muted); font-size: 0.95rem; }

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.45rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1.4;
  vertical-align: middle;
}

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
[hidden] { display: none !important; }

/* Access screen */
.access-form {
  margin: 2rem auto;
  padding: 0 1rem;
  width: 100%;
  max-width: 26rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Conversation */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message {
  max-width: 44rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.message.person {
  align-self: flex-end;
  background: var(--person);
  white-space: pre-wrap;
}

.message.assistant { align-self: flex-start; background: var(--panel); }
.message.assistant p:last-child, .message.assistant ul:last-child, .message.assistant ol:last-child { margin-bottom: 0; }
.message.assistant ul, .message.assistant ol { margin: 0 0 0.5rem; padding-left: 1.4rem; }
.message.assistant li { margin-bottom: 0.3rem; }
.message.notice { color: var(--muted); font-style: italic; }

.starters { max-width: 44rem; }
.starters p { color: var(--muted); }

.starter {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.9rem;
  text-align: left;
  font: inherit;
  color: var(--accent);
  background: var(--background);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
}

.starter:hover { background: var(--person); }

.status { margin: 0; padding: 0 1rem 0.5rem; color: var(--muted); font-style: italic; }

/* Composer */
.composer { padding: 0.5rem 1rem 0.75rem; border-top: 1px solid var(--border); }
.composer label { display: block; margin-bottom: 0.25rem; font-size: 0.95rem; color: var(--muted); }
.composer-row { display: flex; gap: 0.5rem; align-items: flex-end; }

textarea, input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--muted);
  border-radius: 8px;
  background: var(--background);
}

textarea { resize: vertical; min-height: 2.75rem; }

button {
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:disabled { opacity: 0.55; cursor: default; }

button.secondary { color: var(--accent); background: var(--background); }
button.secondary:hover { background: var(--person); }

.error { color: var(--error); margin: 0; }

/* Footer: always visible */
.bottom {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.bottom p { margin: 0; }

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

@media (min-width: 700px) {
  .messages { padding: 1.25rem 1.5rem; }
  .composer, .bottom, .top { padding-left: 1.5rem; padding-right: 1.5rem; }
}
