/* Atlas, the enquiry assistant (assistant.js): in the contact page, and as a "Speak to Atlas" bubble on other pages.
   Builds on styles.css: .contact__form, .form-row, .form-field, .btn, .label, .form-status, .sr-only. */

/* ---------- contact page: the tabs */
.enquire { display: grid; gap: 14px; min-width: 0; }
.enquire__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.enquire__tabs[hidden] { display: none; }
.enquire__tabs button {
  font: 500 14px var(--font); color: var(--text-2); background: none; border: 0; border-radius: var(--radius-sm);
  padding: 11px 10px; cursor: pointer; transition: background .2s, color .2s;
}
.enquire__tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.enquire .contact__form[hidden] { display: none; }

/* ---------- the chat (same in the page and in the bubble's panel) */
.assistant { gap: 16px; }
.atlas-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); color: #04121A; box-shadow: 0 0 0 4px var(--accent-soft);
}
.atlas-avatar svg { width: 24px; height: 24px; }
.atlas-head { display: flex; align-items: center; gap: 12px; }
.atlas-head__text { display: grid; line-height: 1.25; margin-right: auto; }
.atlas-head__text strong { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text); }
.atlas-head__text span { font-size: 13px; color: var(--text-3); }
.assistant__badge {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 999px; padding: 3px 10px;
}

.assistant__log { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 2px; }
.bubble { max-width: 88%; padding: 11px 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble--bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--text); }
.bubble--visitor { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-border); border-bottom-right-radius: 4px; color: var(--text); }
.bubble.is-typing { color: var(--text-3); font-style: italic; }

.atlas-starters { display: flex; flex-wrap: wrap; gap: 8px; }
.atlas-chip {
  font: 500 13.5px var(--font); color: var(--text); background: var(--surface-2); border: 1px solid var(--accent-border);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; transition: background .2s, border-color .2s;
}
.atlas-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

.assistant__compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.assistant__compose textarea {
  width: 100%; min-height: 80px; max-height: 180px; resize: vertical; font: 400 15px/1.45 var(--font); color: var(--text);
  background: var(--field-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px;
}
.assistant__compose textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.assistant__compose .btn { height: 52px; }
.assistant [hidden], .atlas-panel [hidden] { display: none !important; }

.assistant__skip { justify-self: start; align-self: flex-start; background: none; border: 0; padding: 0; font: 500 14px var(--font); color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.assistant__recap { border: 1px solid var(--accent-border); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 6px; }
.assistant__recap p:last-child { color: var(--text); font-size: 15px; }
.assistant__details { display: grid; gap: 16px; }
.assistant__consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.assistant__consent input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.assistant__consent input[aria-invalid="true"] { outline: 2px solid #E5484D; outline-offset: 2px; }
.assistant__note { font-size: 12.5px; color: var(--text-3); }
.atlas-fallback { display: grid; gap: 12px; }
.atlas-fallback p { color: var(--text); font-size: 15px; }

/* ---------- every other page: the bubble and its panel */
.atlas-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 45;
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 18px 7px 7px; border-radius: 999px; cursor: pointer;
  font: 500 15px var(--font); color: var(--text); background: var(--bg-2); border: 1px solid var(--accent-border);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7), 0 0 0 1px rgba(45, 212, 191, .08);
  transition: transform .2s, border-color .2s;
}
.atlas-launcher:hover { transform: translateY(-2px); border-color: var(--accent); }
.atlas-launcher b { font-weight: 600; color: var(--accent); }
.atlas.is-open .atlas-launcher { border-color: var(--accent); }
html.menu-open .atlas-launcher, html.menu-open .atlas-nudge { display: none; }

.atlas-panel {
  position: fixed; right: 24px; bottom: 92px; z-index: 70; width: 400px; max-height: min(680px, calc(100vh - 120px)); overflow-y: auto;
  display: grid; gap: 14px; padding: 18px; border-radius: var(--radius-lg);
  background: var(--bg-2); border: 1px solid var(--line-strong); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .75);
}
.atlas-panel[hidden] { display: none; }
.atlas-panel .assistant__log { max-height: 340px; }
.atlas-panel .bubble { font-size: 14.5px; }
.atlas-panel .form-row { grid-template-columns: 1fr; gap: 14px; }
.atlas-close {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--text-2); font-size: 20px; line-height: 1; cursor: pointer;
}
.atlas-close:hover { color: var(--text); border-color: var(--text-3); }

.atlas-nudge {
  position: fixed; right: 24px; bottom: 92px; z-index: 45; max-width: 290px;
  padding: 14px 40px 14px 16px; border-radius: 16px 16px 4px 16px;
  background: var(--bg-2); border: 1px solid var(--accent-border); box-shadow: 0 20px 44px -18px rgba(0, 0, 0, .7);
  animation: atlas-pop .35s ease-out;
}
.atlas-nudge[hidden] { display: none; }
.atlas-nudge__text { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: 400 14.5px/1.45 var(--font); color: var(--text); }
.atlas-nudge__close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: none; color: var(--text-3); font-size: 18px; cursor: pointer; }
.atlas-nudge__close:hover { color: var(--text); background: var(--surface-2); }
@keyframes atlas-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .assistant__log { max-height: 360px; }
  .bubble { max-width: 94%; }
}
/* Phones: the bubble shrinks to the avatar, and the chat opens full screen. */
@media (max-width: 600px) {
  .atlas-launcher { right: 16px; bottom: 16px; padding: 6px; }
  .atlas-launcher__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .atlas-launcher .atlas-avatar { width: 46px; height: 46px; }
  .atlas-panel { inset: 0; width: auto; max-height: none; border-radius: 0; border: 0; padding: 16px; align-content: start; }
  .atlas-panel .assistant__log { max-height: none; }
  .atlas.is-open .atlas-launcher { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-launcher, .atlas-chip { transition: none; }
  .atlas-nudge { animation: none; }
}
