/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #FAF7F2;
  --warm-white: #F2EDE8;
  --charcoal: #2C2825;
  --charcoal-light: #4A4541;
  --terracotta: #C4856A;
  --terracotta-light: #E8C4B4;
  --sage: #8A9E8A;
  --border: #E0D8D0;
  --ink: #1A1715;
  --muted: #7A7068;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Source Sans 3', 'Helvetica Neue', sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === NAV === */
.site-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 24px 48px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.nav-tagline {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* === LAYOUT === */
.chat-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.chat-header {
  text-align: center;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
}

.chat-header h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 8px;
}

.chat-header p {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 300;
}

/* === EXAMPLE FLOW CHOOSER === */
.flow-chooser {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.flow-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--charcoal-light);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: 8px 18px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.flow-btn:hover,
.flow-btn.active {
  background: var(--warm-white);
  border-color: var(--terracotta-light);
  color: var(--charcoal);
}

/* === MESSAGE AREA === */
.messages {
  flex: 1;
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 400px;
}

.message {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.6s ease forwards;
  opacity: 0;
}

.message.user { align-items: flex-end; }
.message.ai   { align-items: flex-start; }

.message-bubble {
  max-width: 85%;
  padding: 16px 20px;
  border-radius: 20px;
  font-size: 0.97rem;
  line-height: 1.65;
}

.message.user .message-bubble {
  background: var(--warm-white);
  border: 1px solid var(--border);
  color: var(--charcoal);
  border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
  background: transparent;
  color: var(--charcoal);
  padding-left: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === TYPING INDICATOR === */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
  margin-bottom: 4px;
}

.typing-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: 0.04em;
  font-style: italic;
  font-family: var(--font-serif);
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--terracotta-light);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.25; transform: scale(1); }
  30%             { opacity: 1;    transform: scale(1.1); }
}

/* === INPUT === */
.chat-input-area {
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
}

.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 18px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--charcoal);
  resize: none;
  outline: none;
  line-height: 1.55;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.2s ease;
}

.chat-textarea::placeholder { color: var(--muted); font-weight: 300; }
.chat-textarea:focus { border-color: var(--terracotta-light); }

.send-btn {
  background: var(--charcoal);
  color: var(--cream);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

.send-btn:hover  { background: var(--charcoal-light); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }

/* === TRANSITION STATE === */
.messages.resetting .message {
  animation: none;
  opacity: 0;
  pointer-events: none;
}

.messages.resetting::after {
  content: '';
  flex: 1;
}