@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Crimson+Pro:wght@300;400;600&display=swap');

:root {
  --cream:       #f5f0e8;
  --cream-dark:  #ede6d6;
  --terracotta:  #E35336;
  --terra-light: #b06040;
  --green-dark:  #1a4a1a;
  --emerald:     #379456;
  --turquoise:   #40e0d0;
  --black:       #1a1a18;
  --border:      rgba(139,74,47,0.2);
  --nav-height:  56px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--cream);
  color: var(--terracotta);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ── NAV ── */
nav {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
  position: relative;
  z-index: 200;
  flex-shrink: 0;
}

.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-logo span {
  color: var(--turquoise);
}

/* hamburger button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 300;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--terracotta);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* animate to X when open */
.nav-toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* dropdown menu */
.nav-links {
  display: none;
  flex-direction: column;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  list-style: none;
  z-index: 200;
}

.nav-links.open {
  display: flex;
}

.nav-links li a {
  display: block;
  padding: 1rem 1.4rem;
  color: var(--terracotta);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s, background 0.2s;
}

.nav-links li:last-child a {
  border-bottom: none;
}

.nav-links li a:hover {
  color: var(--turquoise);
  background: var(--cream-dark);
}

/* ── MAIN ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 1rem;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

/* ── CHAT WINDOW ── */
#chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  -webkit-overflow-scrolling: touch;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  animation: fadeUp 0.3s ease forwards;
}

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

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

.msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 1rem;
  line-height: 1.65;
}

.msg.user .msg-bubble {
  background: var(--cream-dark);
  border: 1px solid var(--border);
  color: var(--emerald);
}

.msg.ai .msg-bubble {
  background: transparent;
  color: var(--emerald);
  border-left: 3px solid var(--turquoise);
  padding-left: 1rem;
}

.msg.ai .msg-bubble strong,
.msg.ai .msg-bubble b {
  color: var(--green-dark);
  font-weight: 600;
}

.msg.ai .msg-bubble h1,
.msg.ai .msg-bubble h2,
.msg.ai .msg-bubble h3 {
  color: var(--green-dark);
  font-family: 'Playfair Display', serif;
  margin-bottom: 0.4rem;
}

/* ── TYPING INDICATOR ── */
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--turquoise);
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--turquoise);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

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

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* ── INPUT AREA ── */
.input-area {
  border-top: 1px solid var(--border);
  padding: 0.8rem 0 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

#user-input {
  flex: 1;
  background: var(--cream-dark);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.65rem 0.9rem;
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--black);
  resize: none;
  min-height: 48px;
  max-height: 140px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

#user-input:focus { border-color: var(--turquoise); }
#user-input::placeholder { color: rgba(139,74,47,0.4); }

button {
  cursor: pointer;
  border: none;
  font-family: 'Crimson Pro', serif;
  transition: all 0.2s;
}

#send-btn {
  background: var(--green-dark);
  color: var(--cream);
  padding: 0 1.2rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  height: 48px;
  white-space: nowrap;
}

#send-btn:hover    { background: var(--turquoise); }
#send-btn:disabled { opacity: 0.4; cursor: default; }

.action-row {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.btn-minor {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--terra-light);
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
}

.btn-minor:hover {
  border-color: var(--turquoise);
  color: var(--turquoise);
}

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.72rem;
  color: rgba(139,74,47,0.4);
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── DESKTOP ── */
@media (min-width: 640px) {
  nav {
    padding: 0 2rem;
  }

  .nav-toggle {
    display: none;
  }

  .nav-links {
    display: flex;
    flex-direction: row;
    position: static;
    border-bottom: none;
    gap: 2rem;
  }

  .nav-links li a {
    padding: 0;
    border-bottom: none;
    font-size: 0.85rem;
  }

  .nav-links li a:hover {
    background: transparent;
  }

  main {
    padding: 0 1.5rem;
  }

  .msg {
    max-width: 85%;
  }
}
