.ask-block,
#ask-section {
  margin-top: 4rem;
}

#ask-section {
  margin: 0;
  padding: 0;
}

.ask-block h2,
#ask-section h2 {
  font-size: clamp(1.4rem, 1.8vw, 2.2rem);
  margin-bottom: 0.75rem;
}

.ask-examples {
  margin-top: -0.25rem;
}

.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  margin-top: 0.75rem;
}

.ask-form {
  margin-bottom: 3rem;
}

.ask-input-wrap {
  position: relative;
  width: 50%;
  min-width: 280px;
}

.ask-input-wrap input {
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.65rem 5.5rem 0.65rem 1rem;
  font-size: 1rem;
}

.ask-input-wrap input:focus,
.ask-input-wrap input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(21, 19, 18, 0.08);
}

.ask-input-wrap button {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  padding: 0 1.1rem;
  font-weight: 500;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s ease-in, color 0.2s ease-in;
}

.ask-input-wrap button svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.chat-input button svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.ask-chip,
.chat-chip {
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--text);
  border-radius: 16px;
  padding: 0.45rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: lowercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease-in, color 0.2s ease-in, border-color 0.2s ease-in;
}

.chat-chip {
  text-align: left;
}

.ask-chip:hover,
.ask-chip:focus-visible,
.chat-chip:hover,
.chat-chip:focus-visible {
  background: #fff0e6;
  color: var(--text);
  box-shadow: inset 0 0 0 1px #d94a1f;
  text-decoration: none;
}


.ask-input-wrap button:hover,
.ask-input-wrap button:focus-visible,
.chat-input button:hover,
.chat-input button:focus-visible {
  border-color: var(--accent);
  background: #d94a1f;
  color: #ffffff;
  text-decoration: none;
}

.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 19, 18, 0.25);
  z-index: 1000;
  display: none;
}

.chat-backdrop.is-open {
  display: block;
}

.chat-panel {
  position: fixed;
  right: 1.5rem;
  bottom: 4.75rem;
  z-index: 1002;
  width: min(420px, calc(100vw - 2rem));
  max-height: min(70vh, 640px);
  min-height: 300px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(21, 19, 18, 0.12);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease-out, transform 0.22s ease-out, visibility 0.22s;
}

.chat-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  text-transform: uppercase;
  font-weight: 700;
}

.chat-close {
  border: 1px solid transparent;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-panel.is-empty .chat-messages {
  flex: 1 1 auto;
  padding: 0;
}

.chat-message {
  display: flex;
}

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

.chat-bubble {
  max-width: 85%;
  padding: 0.65rem 0.85rem;
  border-radius: 16px;
  background: var(--panel);
  font-size: 0.98rem;
  line-height: 1.5;
}

.chat-bubble p {
  margin: 0 0 0.65rem;
}

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

.chat-bubble ul {
  margin: 0 0 0.65rem 1.1rem;
  padding: 0;
}

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

.chat-bubble li {
  margin: 0.2rem 0;
}

.chat-bubble strong {
  font-weight: 600;
}

.chat-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem;
}

.chat-link-row:last-child {
  margin-bottom: 0;
}

.chat-link-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  text-decoration: none;
}

.chat-link-icon {
  width: 1rem;
  height: 1rem;
}

.chat-bubble-typing {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-style: italic;
  background: linear-gradient(120deg, #f0ebe7 20%, #ffffff 50%, #f0ebe7 80%);
  background-size: 200% 100%;
  animation: chat-shimmer 1.6s ease-in-out infinite;
}

.chat-message-user .chat-bubble {
  background: #fff0e6;
  color: var(--text);
  border-radius: 16px;
}

.chat-message-user .chat-bubble.is-single-line {
  border-radius: 999px;
}

.chat-suggestions {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
}

.chat-suggestions.is-visible {
  display: flex;
}

.chat-sources {
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--card-border);
}

.chat-sources summary {
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.chat-sources-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0;
}

.chat-sources-list a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.chat-citation-quote {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.chat-input {
  position: relative;
  --chat-input-height: 44px;
  --chat-button-size: 36px;
  --chat-button-gap: 4px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--card-border);
}

.chat-input-wrap {
  position: relative;
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 25px;
  background: #ffffff;
  padding: 10px 88px 4px 16px;
  min-height: var(--chat-input-height);
  box-sizing: border-box;
}

.chat-input input {
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.65rem 5.5rem 0.65rem 1rem;
  font-size: 1rem;
}

.chat-input textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 1rem;
  line-height: 24px;
  resize: none;
  overflow: hidden;
  background: transparent;
  height: auto;
  min-height: 0;
}

.chat-input textarea:focus,
.chat-input textarea:focus-visible,
.chat-input button:focus,
.chat-input button:focus-visible {
  outline: none;
  box-shadow: none;
}

.chat-input-wrap:focus-within {
  box-shadow: inset 0 0 0 2px rgba(21, 19, 18, 0.08);
}

.chat-input button {
  position: absolute;
  right: var(--chat-button-gap);
  bottom: var(--chat-button-gap);
  height: var(--chat-button-size);
  min-height: var(--chat-button-size);
  border: none;
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s ease-in, color 0.2s ease-in;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ask-chip--accent {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.ask-chip--accent:hover,
.ask-chip--accent:focus-visible {
  background: var(--text);
  border-color: var(--text);
  color: #ffffff;
}

.chat-input button:disabled,
.chat-input textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1001;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 1.1rem 0 0.9rem;
  box-shadow: 0 4px 20px rgba(21, 19, 18, 0.22);
  transition: background 0.2s ease-in, transform 0.15s ease;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.chat-fab:hover,
.chat-fab:focus-visible {
  background: #d94a1f;
  transform: scale(1.04);
  outline: none;
}

.chat-fab svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.chat-fab.is-hidden {
  display: none;
}

@keyframes chat-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 720px) {
  .ask-input-wrap {
    width: 100%;
    min-width: 0;
  }

  .chat-panel {
    right: 1rem;
    left: 1rem;
    bottom: 5rem;
    width: auto;
    max-height: 80vh;
  }

  .chat-fab {
    right: 1rem;
    bottom: 1rem;
  }

}
