:root {
  --ink: #18362f;
  --ink-soft: #5b6d67;
  --forest: #204f42;
  --moss: #6f8b55;
  --sage: #dfe8d7;
  --cream: #f6f1e5;
  --paper: #fffdf7;
  --orange: #e7743c;
  --orange-dark: #c95627;
  --line: rgba(32, 79, 66, 0.15);
  --shadow: 0 24px 70px rgba(29, 56, 48, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(32, 79, 66, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 79, 66, 0.035) 1px, transparent 1px),
    var(--cream);
  background-size: 32px 32px;
  font-family: "DM Sans", sans-serif;
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  width: 36rem;
  height: 36rem;
  top: -19rem;
  right: -13rem;
  background: rgba(186, 207, 157, 0.48);
}

.ambient-two {
  width: 28rem;
  height: 28rem;
  bottom: -17rem;
  left: -13rem;
  background: rgba(231, 116, 60, 0.12);
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
}

.brand-mark svg {
  width: 29px;
  fill: var(--paper);
}

.brand-mark circle {
  fill: var(--orange);
}

.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.58);
  color: var(--ink-soft);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58a44b;
  box-shadow: 0 0 0 4px rgba(88, 164, 75, 0.14);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(530px, 1.28fr);
  column-gap: clamp(44px, 7vw, 112px);
  row-gap: 28px;
  align-items: start;
  padding: 55px 0 90px;
}

.hero {
  padding-top: 52px;
}

.eyebrow,
.chat-kicker {
  margin: 0 0 14px;
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: var(--forest);
  font-family: "DM Serif Display", serif;
  font-size: clamp(3.25rem, 6vw, 5.9rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.88;
}

.hero h1 em {
  color: var(--orange);
  font-weight: 400;
}

.hero-copy {
  max-width: 430px;
  margin: 30px 0 0;
  color: var(--ink-soft);
  font-size: 1.03rem;
  line-height: 1.75;
}

.data-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 24px;
}

.data-badges span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.65);
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.contact-trigger {
  margin-top: 20px;
  padding: 9px 14px;
  border: 1px solid rgba(32, 79, 66, 0.25);
  border-radius: 999px;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  transition: 160ms ease;
}

.contact-trigger:hover {
  border-color: var(--forest);
  background: var(--forest);
  color: white;
}

.chat-shell {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 650px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(32, 79, 66, 0.12);
  border-radius: 28px;
  background: rgba(255, 253, 247, 0.93);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.chat-kicker {
  margin-bottom: 4px;
  font-size: 0.62rem;
}

.chat-topbar h2 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-size: 1.55rem;
  font-weight: 400;
}

.clear-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: 160ms ease;
}

.clear-button:hover {
  background: var(--sage);
  color: var(--forest);
}

.clear-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.messages {
  height: 445px;
  padding: 26px;
  overflow-y: auto;
  scrollbar-color: rgba(32, 79, 66, 0.25) transparent;
}

.message {
  display: flex;
  gap: 11px;
  margin-bottom: 22px;
  animation: message-in 240ms ease both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
  color: white;
  font-family: "DM Serif Display", serif;
}

.bubble {
  max-width: 84%;
  padding: 13px 16px;
  border-radius: 6px 18px 18px;
  background: var(--sage);
  color: #29463e;
  font-size: 0.92rem;
  line-height: 1.62;
}

.message-content {
  max-width: 84%;
}

.message-content .bubble {
  max-width: 100%;
}

.bubble p {
  margin: 0 0 10px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble h2,
.bubble h3 {
  margin: 16px 0 6px;
  color: var(--forest);
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  line-height: 1.2;
}

.bubble h2:first-child,
.bubble h3:first-child {
  margin-top: 0;
}

.bubble h2 {
  font-size: 1.12rem;
}

.bubble h3 {
  font-size: 1rem;
}

.inline-citation {
  display: inline-block;
  margin: 0 1px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(32, 79, 66, 0.1);
  color: var(--forest);
  font-size: 0.78em;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.inline-citation:hover,
.inline-citation:focus-visible {
  background: var(--forest);
  color: white;
}

.bubble ul,
.bubble ol {
  margin: 8px 0;
  padding-left: 21px;
}

.bubble li + li {
  margin-top: 5px;
}

.bubble strong {
  color: var(--forest);
}

.speaker {
  color: var(--forest);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.user-message .bubble {
  border-radius: 18px 6px 18px 18px;
  background: var(--forest);
  color: white;
}

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

.refusal-message .bubble {
  border: 1px solid rgba(231, 116, 60, 0.25);
  background: #fff0e6;
}

.source-list {
  margin-top: 10px;
}

.tool-activity {
  margin-top: 9px;
}

.tool-call {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(111, 139, 85, 0.25);
  border-radius: 11px;
  background: rgba(223, 232, 215, 0.46);
}

.tool-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--forest);
  color: white;
}

.tool-icon svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.tool-call small,
.tool-call strong {
  display: block;
}

.tool-call small {
  color: var(--moss);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-call strong {
  margin: 1px 0;
  font-size: 0.69rem;
}

.tool-query {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-count {
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 700;
  white-space: nowrap;
}

.source-heading {
  margin: 0 0 6px;
  color: #7a8983;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.source-card {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  max-width: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 7px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-decoration: none;
  transition: 150ms ease;
  scroll-margin: 18px;
}

.source-card:hover {
  border-color: rgba(32, 79, 66, 0.35);
  background: white;
  transform: translateY(-1px);
}

.source-number {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
}

.source-copy {
  min-width: 0;
}

.source-card small,
.source-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card small {
  color: var(--orange-dark);
  font-size: 0.57rem;
  font-weight: 700;
  text-transform: uppercase;
}

.source-card strong {
  margin-top: 2px;
  font-size: 0.67rem;
}

.source-arrow {
  color: var(--ink-soft);
  font-size: 0.61rem;
  font-weight: 700;
  white-space: nowrap;
}

.source-card:target {
  border-color: var(--orange);
  background: #fff6ee;
  box-shadow: 0 0 0 3px rgba(231, 116, 60, 0.13);
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 8px 0 4px 45px;
}

.suggestions button {
  min-height: 76px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.35;
  text-align: left;
  transition: 160ms ease;
}

.suggestions button span {
  display: block;
  margin-bottom: 7px;
  color: var(--orange);
  font-size: 1.05rem;
}

.suggestions button:hover {
  border-color: rgba(32, 79, 66, 0.35);
  background: white;
  color: var(--forest);
  transform: translateY(-2px);
}

.suggestions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.turnstile-row {
  min-height: 40px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 8px 20px;
}

.turnstile-widget {
  min-height: 35px;
}

.turnstile-row p,
.security-warning {
  margin: 0;
  color: var(--orange-dark);
  font-size: 0.68rem;
  line-height: 1.4;
}

.security-warning {
  padding: 0 20px 8px;
  text-align: center;
}

.composer {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin: 0 20px;
  padding: 10px 10px 10px 18px;
  border: 1px solid rgba(32, 79, 66, 0.2);
  border-radius: 18px;
  background: white;
  box-shadow: 0 8px 25px rgba(27, 60, 50, 0.08);
  transition: 160ms ease;
}

.composer:focus-within {
  border-color: var(--moss);
  box-shadow: 0 0 0 4px rgba(111, 139, 85, 0.12);
}

.composer textarea {
  width: 100%;
  max-height: 120px;
  padding: 7px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #8c9993;
}

.send-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--orange);
  color: white;
  cursor: pointer;
  transition: 160ms ease;
}

.send-button:hover {
  background: var(--orange-dark);
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.send-button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.composer-note {
  margin: 10px 20px 18px;
  color: #89958f;
  font-size: 0.66rem;
  text-align: center;
}

.field-note {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.field-note-number {
  color: var(--orange);
  font-family: "DM Serif Display", serif;
  font-size: 1.55rem;
}

.field-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.field-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--forest);
}

.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 59px;
  height: 42px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--moss);
  animation: bounce 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 120ms;
}

.typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 38px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

footer p {
  margin: 0;
}

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

.app-loading {
  min-height: 65vh;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}

.contact-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 43, 36, 0.55);
  backdrop-filter: blur(7px);
}

.contact-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid rgba(32, 79, 66, 0.14);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.contact-panel h2 {
  margin: 0 0 10px;
  font-family: "DM Serif Display", serif;
  font-size: 2rem;
  font-weight: 400;
}

.contact-panel > p:not(.eyebrow) {
  margin: 0 0 20px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.contact-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--sage);
  cursor: pointer;
  font-size: 1.35rem;
}

.contact-panel form,
.contact-panel label {
  display: grid;
  gap: 7px;
}

.contact-panel form {
  gap: 15px;
}

.contact-panel label {
  color: var(--forest);
  font-size: 0.76rem;
  font-weight: 700;
}

.contact-panel label span,
.contact-panel form small {
  color: var(--ink-soft);
  font-weight: 400;
}

.contact-panel input,
.contact-panel textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: white;
  color: var(--ink);
  resize: vertical;
}

.contact-panel input:focus,
.contact-panel textarea:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(111, 139, 85, 0.12);
}

.contact-send {
  padding: 11px 15px;
  border: 0;
  border-radius: 11px;
  background: var(--orange);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.contact-send:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.contact-unavailable {
  padding: 15px;
  border: 1px solid rgba(231, 116, 60, 0.25);
  border-radius: 12px;
  background: #fff0e6;
}

.contact-unavailable p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
    padding-top: 25px;
  }

  .hero {
    padding: 18px 0 8px;
    text-align: center;
  }

  .hero-copy {
    margin-right: auto;
    margin-left: auto;
  }

  .data-badges {
    justify-content: center;
  }

  .chat-shell {
    grid-column: 1;
    grid-row: auto;
  }

  .field-note {
    max-width: 550px;
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 600px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    padding: 18px 0;
  }

  main {
    padding-bottom: 54px;
  }

  .hero h1 {
    font-size: clamp(3.2rem, 17vw, 4.8rem);
  }

  .hero-copy {
    font-size: 0.92rem;
  }

  .chat-shell {
    min-height: 610px;
    border-radius: 21px;
  }

  .chat-topbar,
  .messages {
    padding-right: 17px;
    padding-left: 17px;
  }

  .messages {
    height: 410px;
  }

  .suggestions {
    grid-template-columns: 1fr;
    margin-left: 45px;
  }

  .suggestions button {
    min-height: auto;
  }

  .suggestions button span {
    display: inline;
    margin-right: 7px;
  }

  .bubble {
    max-width: 90%;
  }

  .message-content {
    max-width: 90%;
  }

  .source-links {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
