/* Stowe Holdings 1.4.0: Zola, the help bot (every page). Behaviour: assets/js/components/zola.js
   Recoloured to the Enterprise Balanced palette: midnight, electric cobalt, Stowe gold.
   Every class starts with "sa-" so nothing here touches the rest of the site. */
.sa {
  --vh: 1vh;
  --dvh: 1dvh;
  --sa-navy: #0b1626;
  --sa-deep: #0b1626;
  --sa-teal: #8fb0ff;
  --sa-teal-deep: #1f5bff;
  --sa-gold: #d8b979;
  --sa-ink: #0b1626;
  --sa-muted: #6b778a;
  --sa-line: #dde2ea;
  --sa-paper: #f4f6f9;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 85;
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--sa-ink);
}
.sa .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;
}

/* ---------- Launcher ---------- */
.sa-launch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: 52px;
  padding: 0 7px;
  border: 1px solid rgba(143, 176, 255, 0.45);
  border-radius: 999px;
  background: linear-gradient(135deg, #13274a, var(--sa-deep));
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 34px -12px rgba(11, 22, 38, 0.6), 0 0 0 4px rgba(143, 176, 255, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sa-launch-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
}
/* Round icon until hovered or focused, then the label slides out */
.sa-launch:hover .sa-launch-text,
.sa-launch:focus-visible .sa-launch-text { max-width: 220px; opacity: 1; margin: 0 12px 0 10px; }
.sa-launch:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -12px rgba(11, 22, 38, 0.65), 0 0 0 5px rgba(143, 176, 255, 0.2); }
.sa-launch:focus-visible { outline: 2px solid var(--sa-gold); outline-offset: 3px; }
.sa-launch-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sa-gold);
  color: var(--sa-navy);
}
.sa-launch-ico svg { width: 20px; height: 20px; }
.sa.is-open .sa-launch { display: none; }

/* ---------- Panel ---------- */
.sa-panel {
  display: flex;
  flex-direction: column;
  width: 370px;
  height: min(580px, calc(calc(100 * var(--vh)) - 110px));
  height: min(580px, calc(calc(100 * var(--dvh)) - 110px));
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(11, 22, 38, 0.1);
  box-shadow: 0 30px 70px -24px rgba(11, 22, 38, 0.55), 0 2px 8px rgba(11, 22, 38, 0.08);
  animation: sa-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  transform-origin: bottom right;
}
.sa-panel[hidden] { display: none; }
@keyframes sa-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }

.sa-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background:
    radial-gradient(120% 140% at 100% 0, rgba(143, 176, 255, 0.28), transparent 55%),
    linear-gradient(135deg, #13274a, var(--sa-deep));
  color: #fff;
}
.sa-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--sa-gold), var(--sa-teal));
}
.sa-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sa-gold);
  color: var(--sa-navy);
}
.sa-avatar svg { width: 20px; height: 20px; }
.sa-head-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.sa-head-text b { font-family: Archivo, Inter, sans-serif; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.sa-head-text small { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #c7d6e0; }
.sa-dot { width: 7px; height: 7px; border-radius: 50%; background: #5fd3a8; box-shadow: 0 0 0 3px rgba(95, 211, 168, 0.22); }
.sa-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}
.sa-close svg { width: 18px; height: 18px; }
.sa-close:hover { background: rgba(255, 255, 255, 0.16); }
.sa-close:focus-visible { outline: 2px solid var(--sa-gold); outline-offset: 2px; }

/* ---------- Messages ---------- */
.sa-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  background: var(--sa-paper);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sa-msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; }
.sa-msg.is-new { animation: sa-msg 0.3s ease both; }
@keyframes sa-msg { from { opacity: 0; transform: translateY(6px); } }
.sa-msg--user { align-self: flex-end; align-items: flex-end; }
.sa-bubble {
  margin: 0;
  padding: 10px 13px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  border: 1px solid var(--sa-line);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.sa-msg--user .sa-bubble {
  border-radius: 14px 14px 4px 14px;
  border-color: transparent;
  background: var(--sa-navy);
  color: #fff;
}

.sa-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sa-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--sa-line);
  color: var(--sa-ink);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.sa-link:hover { border-color: var(--sa-teal); transform: translateX(2px); box-shadow: 0 6px 16px -10px rgba(11, 22, 38, 0.4); }
.sa-link:focus-visible { outline: 2px solid var(--sa-teal-deep); outline-offset: 2px; }
.sa-link-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(143, 176, 255, 0.16);
  color: var(--sa-teal-deep);
}
.sa-link-ico svg { width: 15px; height: 15px; }
.sa-link--video .sa-link-ico { background: var(--sa-navy); color: var(--sa-gold); }
.sa-link--video .sa-link-ico svg { width: 11px; height: 11px; margin-left: 2px; }
.sa-link--portal .sa-link-ico { background: rgba(216, 185, 121, 0.22); color: #8a6d2f; }
.sa-link-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sa-link-body b { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.sa-link-body small { font-size: 12px; color: var(--sa-muted); line-height: 1.3; }

.sa-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sa-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(31, 91, 255, 0.35);
  background: #fff;
  color: var(--sa-teal-deep);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.sa-chip:hover { background: var(--sa-teal-deep); border-color: var(--sa-teal-deep); color: #fff; }
.sa-chip:focus-visible { outline: 2px solid var(--sa-gold); outline-offset: 2px; }

.sa-typing .sa-bubble { display: inline-flex; gap: 4px; padding: 13px 14px; }
.sa-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--sa-teal-deep); opacity: 0.4; animation: sa-dot 1s infinite ease-in-out; }
.sa-typing span:nth-child(2) { animation-delay: 0.15s; }
.sa-typing span:nth-child(3) { animation-delay: 0.3s; }
/* Zola AI: the note under an AI answer, the wait message, and the send button while it thinks */
.sa-note { margin: 4px 0 0; font-size: 11px; line-height: 1.35; color: var(--sa-muted); }
.sa-wait { margin: 4px 0 0; font-size: 11.5px; color: var(--sa-muted); }
.sa-form.is-busy .sa-send { opacity: 0.45; cursor: progress; }
@keyframes sa-dot { 50% { opacity: 1; transform: translateY(-2px); } }

/* ---------- Input ---------- */
.sa-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--sa-line);
}
.sa-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #cfd8df;
  border-radius: 999px;
  background: #fff;
  color: var(--sa-ink);
  font-family: inherit;
  font-size: 16px; /* 16px stops iPhones zooming in on tap */
}
.sa-input::placeholder { color: #8795a1; }
.sa-input:focus { outline: none; border-color: var(--sa-teal-deep); box-shadow: 0 0 0 3px rgba(143, 176, 255, 0.25); }
.sa-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--sa-gold);
  color: var(--sa-navy);
  cursor: pointer;
  transition: background 0.2s ease;
}
.sa-send svg { width: 18px; height: 18px; }
.sa-send:hover { background: #e2c68e; }
.sa-send:focus-visible { outline: 2px solid var(--sa-teal-deep); outline-offset: 2px; }
.sa-foot { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 11px; color: var(--sa-muted); text-align: center; }
.sa-foot a { color: var(--sa-teal-deep); font-weight: 600; }

/* ---------- Phones: compact launcher, panel as a bottom sheet ---------- */
@media (max-width: 600px) {
  .sa { right: 12px; bottom: 12px; }
  .sa-launch { padding: 0 7px; min-height: 52px; }
  .sa.is-open { left: 0; right: 0; bottom: 0; }
  .sa-panel {
    width: 100%;
    height: min(calc(88 * var(--vh)), 640px);
    height: min(calc(88 * var(--dvh)), 640px);
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sa-panel, .sa-msg.is-new, .sa-typing span { animation: none; }
  .sa-launch, .sa-link, .sa-chip, .sa-launch-text { transition: none; }
}

@media print { .sa { display: none; } }

/* ---------- Zola (1.4.0) ---------- */
.zl-face {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 22%;
  width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4d7dff, #1f5bff 55%, #0f3bb8);
}
.zl-face i { width: 12%; height: 28%; border-radius: 3px; background: #fff; animation: zl-blink 5s infinite; }
@keyframes zl-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
.sa-launch-ico { position: relative; background: none; box-shadow: 0 0 0 2px var(--sa-gold); }
.sa-ping { position: absolute; right: -2px; top: -2px; width: 11px; height: 11px; border-radius: 50%; background: #5ee09a; border: 2px solid var(--sa-deep); }
.sa-ping::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #5ee09a; animation: zl-ping 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) infinite; }
@keyframes zl-ping { from { transform: scale(1); opacity: 0.8; } to { transform: scale(2.4); opacity: 0; } }
.sa-launch { border-color: rgba(216, 185, 121, 0.45); }
.sa-avatar { background: none !important; padding: 0 !important; box-shadow: 0 0 0 2px var(--sa-gold); border-radius: 50%; overflow: hidden; }
.sa-panel, .sa-launch, .sa-send, .sa-link, .sa-chip, .sa-input { border-radius: 4px; }
.sa-panel { border-radius: 6px; transform-origin: 100% 100%; animation: zl-in 0.42s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes zl-in { from { opacity: 0; transform: perspective(900px) translate3d(0, 18px, 0) rotateX(8deg) scale(0.96); } }
.sa-quick { display: flex; gap: 6px; padding: 8px 12px; background: var(--sa-paper); border-bottom: 1px solid var(--sa-line); overflow-x: auto; }
.sa-quick button, .sa-quick a {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--sa-line); border-radius: 4px; background: #fff; color: var(--sa-ink);
  font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.sa-quick svg { width: 12px; height: 12px; color: #1f5bff; }
.sa-quick button:hover, .sa-quick a:hover { border-color: #1f5bff; color: #1f5bff; }
.sa-hi {
  position: absolute; right: 0; bottom: 64px; width: 250px; padding: 12px 14px;
  background: #fff; color: var(--sa-ink); border: 1px solid var(--sa-line); border-left: 3px solid var(--sa-gold); border-radius: 4px;
  box-shadow: 0 20px 40px -20px rgba(11, 22, 38, 0.5);
  font: inherit; font-size: 13.5px; line-height: 1.45; text-align: left; cursor: pointer;
  animation: zl-hi 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transition: opacity 0.4s, transform 0.4s;
}
.sa-hi.is-out { opacity: 0; transform: translateY(6px); }
@keyframes zl-hi { from { opacity: 0; transform: translateY(10px); } }
.sa.is-open .sa-hi { display: none; }
@media (prefers-reduced-motion: reduce) {
  .zl-face i, .sa-ping::after, .sa-panel, .sa-hi { animation: none !important; }
}

/* On a page with a hero (#home), Zola waits below the fold: hidden while the hero is on screen,
   it rises in once the visitor scrolls past (zola.js toggles .is-waiting). An open chat always shows. */
.sa-launch { transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0.35s, box-shadow 0.2s ease; }
.sa.is-waiting .sa-launch,
.sa.is-waiting .sa-hi { opacity: 0; visibility: hidden; transform: translateY(24px) scale(0.92); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .sa-launch { transition: opacity 0.2s, visibility 0.2s; }
  .sa.is-waiting .sa-launch { transform: none; }
}
