/* ==========================================================================
   Ask ORA — Chat widget
   Scoped under #ora-chat to avoid collisions with site styles.
   Uses ORA design tokens (--navy, --gold, etc.) defined in styles.css.
   ========================================================================== */

#ora-chat,
#ora-chat * {
  box-sizing: border-box;
}

/* ----- Trigger button ----- */
.ora-chat-trigger {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  background: #1B2A4A;
  color: #fff;
  border: 1px solid rgba(201, 169, 110, 0.4);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  box-shadow: 0 4px 16px rgba(27, 42, 74, 0.28);
  transition: background 200ms ease-out, border-color 200ms ease-out;
}
.ora-chat-trigger:hover,
.ora-chat-trigger:focus-visible {
  background: #141F33;
  border-color: #C9A96E;
  outline: none;
}
.ora-chat-trigger:focus-visible {
  outline: 2px solid #C9A96E;
  outline-offset: 3px;
}
.ora-chat-trigger__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: #C9A96E;
}
.ora-chat-trigger[hidden] { display: none !important; }

/* ----- Panel ----- */
#ora-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9001;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border: 1px solid rgba(27, 42, 74, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(27, 42, 74, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: #2D2D2D;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}
#ora-chat-panel[data-open="true"] {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* ----- Header ----- */
.ora-chat-header {
  padding: 16px 18px;
  background: #1B2A4A;
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.ora-chat-header__title {
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 2px;
  color: #fff;
  letter-spacing: 0.01em;
}
.ora-chat-header__sub {
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}
.ora-chat-header__sub a {
  color: #C9A96E;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease-out;
}
.ora-chat-header__sub a:hover { border-bottom-color: #C9A96E; }
.ora-chat-header__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.ora-chat-header__btn {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
  transition: color 200ms ease-out;
}
.ora-chat-header__btn:hover,
.ora-chat-header__btn:focus-visible {
  color: #C9A96E;
  outline: none;
}
.ora-chat-header__close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.ora-chat-header__close:hover { background: rgba(255, 255, 255, 0.06); }

/* ----- Messages ----- */
.ora-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FBFAF7;
}
.ora-chat-msg {
  max-width: 92%;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}
.ora-chat-msg--user {
  align-self: flex-end;
  background: #EFEDE7;
  color: #2D2D2D;
  padding: 10px 14px;
  border-radius: 6px;
}
.ora-chat-msg--assistant {
  align-self: flex-start;
  background: #fff;
  color: #2D2D2D;
  padding: 12px 14px 14px;
  border-radius: 6px;
  border: 1px solid rgba(27, 42, 74, 0.08);
  border-left: 2px solid #C9A96E;
  position: relative;
}
.ora-chat-msg--assistant p { margin: 0 0 8px; }
.ora-chat-msg--assistant p:last-child { margin-bottom: 0; }
.ora-chat-msg--assistant strong { font-weight: 600; color: #1B2A4A; }
.ora-chat-msg--assistant em { font-style: italic; }
.ora-chat-msg--assistant ul,
.ora-chat-msg--assistant ol {
  margin: 4px 0 8px 18px;
  padding: 0;
}
.ora-chat-msg--assistant li { margin: 2px 0; }
.ora-chat-msg--assistant a {
  color: #1B2A4A;
  border-bottom: 1px solid #C9A96E;
  text-decoration: none;
}
.ora-chat-msg--assistant a:hover { color: #C9A96E; }
.ora-chat-msg__copy {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: 0;
  color: #596B7D;
  cursor: pointer;
  padding: 4px;
  font-size: 11px;
  font-family: inherit;
  opacity: 0;
  transition: opacity 200ms ease-out, color 200ms ease-out;
}
.ora-chat-msg--assistant:hover .ora-chat-msg__copy,
.ora-chat-msg__copy:focus-visible { opacity: 1; }
.ora-chat-msg__copy:hover { color: #1B2A4A; }
.ora-chat-msg__copy[data-copied="true"] { color: #2E7D32; opacity: 1; }

.ora-chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}
.ora-chat-typing span {
  width: 6px;
  height: 6px;
  background: #C9A96E;
  border-radius: 50%;
  animation: ora-chat-bounce 900ms ease-in-out infinite;
}
.ora-chat-typing span:nth-child(2) { animation-delay: 150ms; }
.ora-chat-typing span:nth-child(3) { animation-delay: 300ms; }
@keyframes ora-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ----- Lead capture inline card ----- */
.ora-chat-lead {
  align-self: stretch;
  background: #fff;
  border: 1px solid rgba(27, 42, 74, 0.12);
  border-radius: 6px;
  padding: 14px 14px 12px;
}
.ora-chat-lead__heading {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 16px;
  color: #1B2A4A;
  margin: 0 0 8px;
}
.ora-chat-lead__field {
  display: block;
  margin-bottom: 8px;
}
.ora-chat-lead__field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #596B7D;
  margin-bottom: 3px;
}
.ora-chat-lead__field input,
.ora-chat-lead__field select,
.ora-chat-lead__field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid rgba(27, 42, 74, 0.18);
  border-radius: 4px;
  background: #fff;
  color: #2D2D2D;
  transition: border-color 200ms ease-out;
}
.ora-chat-lead__field input:focus,
.ora-chat-lead__field select:focus,
.ora-chat-lead__field textarea:focus {
  outline: none;
  border-color: #C9A96E;
  box-shadow: 0 0 0 2px rgba(201, 169, 110, 0.18);
}
.ora-chat-lead__field textarea { min-height: 60px; resize: vertical; }
.ora-chat-lead__honeypot { position: absolute; left: -9999px; }
.ora-chat-lead__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ora-chat-lead__btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 200ms ease-out;
}
.ora-chat-lead__btn--primary { background: #C9A96E; color: #1B2A4A; border-color: #C9A96E; }
.ora-chat-lead__btn--primary:hover { background: #b8963e; }
.ora-chat-lead__btn--secondary { background: transparent; color: #596B7D; }
.ora-chat-lead__btn--secondary:hover { color: #1B2A4A; }
.ora-chat-lead__error {
  font-size: 12px;
  color: #C62828;
  margin-top: 6px;
}
.ora-chat-lead__success {
  font-size: 13px;
  color: #1B2A4A;
  padding: 12px 4px;
}

/* ----- Composer ----- */
.ora-chat-composer {
  flex-shrink: 0;
  border-top: 1px solid rgba(27, 42, 74, 0.08);
  padding: 10px 12px;
  background: #fff;
}
.ora-chat-composer__row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ora-chat-composer textarea {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid rgba(27, 42, 74, 0.15);
  border-radius: 4px;
  resize: none;
  max-height: 120px;
  min-height: 38px;
  background: #fff;
  color: #2D2D2D;
}
.ora-chat-composer textarea:focus {
  outline: none;
  border-color: #C9A96E;
  box-shadow: 0 0 0 2px rgba(201, 169, 110, 0.18);
}
.ora-chat-composer__send {
  background: #C9A96E;
  color: #1B2A4A;
  border: 0;
  border-radius: 4px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 200ms ease-out;
}
.ora-chat-composer__send:hover { background: #b8963e; }
.ora-chat-composer__send:disabled { background: rgba(201, 169, 110, 0.4); cursor: not-allowed; }
.ora-chat-composer__hint {
  font-size: 11px;
  color: #596B7D;
  margin: 6px 2px 0;
  text-align: center;
  line-height: 1.4;
}

/* ----- Mobile ----- */
@media (max-width: 600px) {
  #ora-chat-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: 0;
  }
  .ora-chat-trigger {
    right: 16px;
    bottom: 16px;
  }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  #ora-chat-panel,
  .ora-chat-trigger,
  .ora-chat-msg__copy,
  .ora-chat-composer__send { transition: none; }
  .ora-chat-typing span { animation: none; opacity: 0.6; }
}
