:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #53635d;
  --paper: #f8faf8;
  --line: #cbd8d1;
  --leaf: #216b4d;
  --leaf-dark: #174735;
  --water: #2d718b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: var(--water);
  font-weight: 700;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 24px;
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 280px;
}

.eyebrow {
  color: var(--leaf);
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.02;
}

.intro-copy p:not(.eyebrow) {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.photo-panel {
  margin: 0;
  min-height: 280px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #d8e6e2;
}

.photo-panel img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  display: block;
}

.photo-panel figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 0.75rem;
}

.chat-layout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #eef5f1;
}

.source-strip span {
  color: var(--muted);
  font-weight: 700;
}

.messages {
  min-height: 360px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  width: min(760px, 100%);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message.user .bubble {
  background: var(--leaf);
  color: #fff;
  border-color: var(--leaf);
}

.message.bot .bubble {
  background: #fbfdfb;
}

.thinking {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.thinking-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--leaf);
  animation: pulse-dot 1s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.meta ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.source-list li {
  margin: 8px 0;
}

.source-url {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.trace {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5f1;
  color: var(--ink);
  white-space: normal;
}

.trace summary {
  cursor: pointer;
  font-weight: 700;
}

.trace ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.trace li {
  margin: 5px 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 16px;
}

.chips button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f6;
  color: var(--ink);
  cursor: pointer;
}

.chips button:hover {
  border-color: var(--leaf);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
}

.composer input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
}

.composer button {
  min-width: 104px;
  border: 0;
  border-radius: 8px;
  background: var(--leaf-dark);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.composer button:disabled {
  background: #8aa49a;
  cursor: wait;
}

.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;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 16px 0;
  }

  .intro {
    grid-template-columns: 1fr;
  }

  .intro-copy {
    min-height: 0;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer button {
    min-height: 46px;
  }
}
