/* Ask Aethelis™ — reusable embedded assistant */

:root {
  --ask-purple: #8b5cf6;
  --ask-pink: #ec4899;
  --ask-deep: #171229;
  --ask-panel: rgba(24, 18, 43, 0.97);
  --ask-border: rgba(196, 181, 253, 0.24);
  --ask-text: #f8f7ff;
  --ask-muted: #c8c1dc;
}

.ask-aethelis-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  color: white;
  cursor: pointer;
  background:
    linear-gradient(135deg, var(--ask-purple), var(--ask-pink));
  box-shadow:
    0 14px 40px rgba(139, 92, 246, .30),
    0 0 24px rgba(236, 72, 153, .16);
  transition: transform .18s ease, box-shadow .18s ease;
}

.ask-aethelis-launcher:hover {
  transform: translateY(-2px);
  box-shadow:
    0 18px 48px rgba(139, 92, 246, .38),
    0 0 30px rgba(236, 72, 153, .22);
}

.ask-aethelis-panel {
  position: fixed;
  right: 24px;
  bottom: 86px;
  width: min(410px, calc(100vw - 32px));
  height: min(650px, calc(100vh - 120px));
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  color: var(--ask-text);
  background:
    radial-gradient(
      circle at 80% 0%,
      rgba(236,72,153,.14),
      transparent 32%
    ),
    radial-gradient(
      circle at 10% 20%,
      rgba(139,92,246,.18),
      transparent 34%
    ),
    var(--ask-panel);
  border: 1px solid var(--ask-border);
  border-radius: 24px;
  box-shadow: 0 26px 80px rgba(5, 3, 15, .42);
  backdrop-filter: blur(20px);
}

.ask-aethelis-panel.is-open {
  display: flex;
}

.ask-aethelis-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--ask-border);
}

.ask-aethelis-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 13px;
  background:
    linear-gradient(135deg, var(--ask-purple), var(--ask-pink));
  box-shadow: 0 0 22px rgba(139,92,246,.28);
}

.ask-aethelis-title {
  flex: 1;
  min-width: 0;
}

.ask-aethelis-title strong {
  display: block;
  font-size: 15px;
}

.ask-aethelis-title span {
  display: block;
  margin-top: 2px;
  color: var(--ask-muted);
  font-size: 12px;
}

.ask-aethelis-header button {
  border: 0;
  color: var(--ask-muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.ask-aethelis-new {
  font-size: 12px !important;
}

.ask-aethelis-close {
  font-size: 22px !important;
}

.ask-aethelis-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.ask-message {
  max-width: 88%;
  margin: 0 0 13px;
  padding: 11px 13px;
  border-radius: 17px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ask-message.assistant {
  margin-right: auto;
  color: var(--ask-text);
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.08);
  border-bottom-left-radius: 6px;
}

.ask-message.user {
  margin-left: auto;
  color: white;
  background:
    linear-gradient(
      135deg,
      rgba(139,92,246,.95),
      rgba(190,70,190,.92)
    );
  border-bottom-right-radius: 6px;
}

.ask-evidence {
  margin: -5px 0 14px;
  padding: 10px 12px;
  color: var(--ask-muted);
  background: rgba(139,92,246,.08);
  border: 1px solid rgba(167,139,250,.18);
  border-radius: 13px;
  font-size: 11px;
}

.ask-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 18px 12px;
}

.ask-suggestion {
  flex: 0 0 auto;
  border: 1px solid rgba(196,181,253,.22);
  border-radius: 999px;
  padding: 8px 10px;
  color: #ddd7ef;
  background: rgba(255,255,255,.045);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.ask-aethelis-form {
  display: flex;
  gap: 9px;
  padding: 13px;
  border-top: 1px solid var(--ask-border);
  background: rgba(7,5,15,.25);
}

.ask-aethelis-input {
  min-width: 0;
  flex: 1;
  resize: none;
  max-height: 110px;
  border: 1px solid rgba(196,181,253,.20);
  border-radius: 15px;
  padding: 11px 12px;
  outline: none;
  color: white;
  background: rgba(255,255,255,.055);
  font: inherit;
  font-size: 13px;
}

.ask-aethelis-input::placeholder {
  color: #9990ad;
}

.ask-aethelis-input:focus {
  border-color: rgba(167,139,250,.55);
}

.ask-aethelis-send {
  align-self: flex-end;
  border: 0;
  border-radius: 14px;
  padding: 11px 13px;
  color: white;
  background:
    linear-gradient(135deg, var(--ask-purple), var(--ask-pink));
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.ask-aethelis-send:disabled {
  opacity: .5;
  cursor: default;
}

.ask-typing {
  color: var(--ask-muted);
  font-size: 12px;
}

@media (max-width: 600px) {
  .ask-aethelis-launcher {
    right: 16px;
    bottom: 16px;
  }

  .ask-aethelis-panel {
    right: 8px;
    bottom: 76px;
    width: calc(100vw - 16px);
    height: min(680px, calc(100vh - 92px));
    border-radius: 21px;
  }
}

/* Ask Aethelis™ astronaut Apatosaurus */

.ask-aethelis-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 6px 17px 6px 5px;
  overflow: visible;
  background:
    linear-gradient(
      135deg,
      rgba(75, 44, 130, .94),
      rgba(145, 61, 164, .94) 55%,
      rgba(207, 77, 154, .92)
    );
  backdrop-filter: blur(16px);
}

.ask-aethelis-launcher::before {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(
      circle at 25% 50%,
      rgba(196, 181, 253, .22),
      transparent 45%
    ),
    radial-gradient(
      circle at 80% 40%,
      rgba(244, 114, 182, .16),
      transparent 42%
    );
  filter: blur(10px);
  pointer-events: none;
}

.ask-aethelis-launcher-label {
  white-space: nowrap;
  letter-spacing: -.01em;
}

.ask-mascot {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  pointer-events: none;
}

.ask-mascot-launcher {
  width: 60px;
  height: 52px;
  margin: -11px 0 -7px -4px;
  filter:
    drop-shadow(0 5px 10px rgba(24, 12, 50, .28));
  animation:
    ask-dino-float 4.6s ease-in-out infinite;
}

.ask-mascot-header {
  width: 48px;
  height: 43px;
  margin: -5px;
}

.ask-mascot-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ask-aethelis-launcher:hover .ask-mascot-launcher {
  animation:
    ask-dino-hover .8s ease-in-out infinite alternate;
}

.ask-aethelis-mark {
  width: 48px;
  height: 48px;
  overflow: visible;
  background:
    radial-gradient(
      circle,
      rgba(192, 132, 252, .15),
      transparent 68%
    );
  box-shadow: none;
}

.ask-aethelis-panel.is-open .ask-mascot-header {
  animation:
    ask-dino-float 5s ease-in-out infinite;
}

.ask-dino-stars {
  transform-origin: center;
  animation:
    ask-stars-twinkle 3.5s ease-in-out infinite;
}

.ask-dino {
  transform-origin: 60px 60px;
}

@keyframes ask-dino-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-3px) rotate(1deg);
  }
}

@keyframes ask-dino-hover {
  from {
    transform: translateY(-2px) rotate(-1deg);
  }

  to {
    transform: translateY(-6px) rotate(2deg);
  }
}

@keyframes ask-stars-twinkle {
  0%,
  100% {
    opacity: .45;
  }

  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-mascot-launcher,
  .ask-mascot-header,
  .ask-dino-stars,
  .ask-aethelis-launcher:hover .ask-mascot-launcher {
    animation: none;
  }
}

@media (max-width: 600px) {
  .ask-aethelis-launcher {
    min-height: 55px;
    padding-right: 14px;
  }

  .ask-mascot-launcher {
    width: 56px;
    height: 49px;
  }
}

/* Ask Aethelis — animated orbital A brand mark */
.ask-aethelis-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: visible;
  transform-origin: 50% 55%;
  animation: askAethelisMarkFloat 3.8s ease-in-out infinite;
  filter:
    drop-shadow(0 0 5px rgba(255, 70, 218, 0.55))
    drop-shadow(0 0 11px rgba(151, 76, 255, 0.38));
}

.ask-aethelis-mark--normal {
  width: 42px;
  height: 42px;
}

.ask-aethelis-mark--small {
  width: 34px;
  height: 34px;
}

.ask-aethelis-mark-crop {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  transform-style: preserve-3d;
  animation: askAethelisMarkTurn 7s ease-in-out infinite;
}

.ask-aethelis-mark-logo {
  position: absolute;
  width: 155%;
  max-width: none;
  height: auto;

  /*
   * Crop the transparent source logo to its orbital A.
   * The full Aethelis wordmark remains outside the visible container.
   */
  left: 50%;
  top: -7%;
  transform: translateX(-50%);
  user-select: none;
  pointer-events: none;
}

.ask-aethelis-mark::before {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(
      circle,
      rgba(239, 78, 255, 0.22) 0%,
      rgba(139, 76, 255, 0.12) 43%,
      transparent 72%
    );
  opacity: 0.85;
  animation: askAethelisMarkAura 2.8s ease-in-out infinite;
}

.ask-aethelis-mark::after {
  content: "✦";
  position: absolute;
  top: -4px;
  right: -5px;
  color: rgba(255, 196, 248, 0.95);
  font-size: 8px;
  line-height: 1;
  text-shadow: 0 0 7px rgba(255, 86, 226, 0.9);
  animation: askAethelisMarkTwinkle 2.2s ease-in-out infinite;
}

.ask-aethelis-launcher:hover .ask-aethelis-mark {
  animation-duration: 2.4s;
  filter:
    drop-shadow(0 0 7px rgba(255, 75, 219, 0.78))
    drop-shadow(0 0 16px rgba(154, 78, 255, 0.62));
}

.ask-aethelis-launcher:hover .ask-aethelis-mark-crop {
  animation-duration: 3.8s;
}

@keyframes askAethelisMarkFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }

  50% {
    transform: translateY(-4px) rotate(2deg);
  }
}

@keyframes askAethelisMarkTurn {
  0%,
  100% {
    transform: perspective(180px) rotateY(0deg) rotateZ(0deg);
  }

  25% {
    transform: perspective(180px) rotateY(12deg) rotateZ(-2deg);
  }

  50% {
    transform: perspective(180px) rotateY(0deg) rotateZ(2deg);
  }

  75% {
    transform: perspective(180px) rotateY(-12deg) rotateZ(0deg);
  }
}

@keyframes askAethelisMarkAura {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.92);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes askAethelisMarkTwinkle {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.72) rotate(0deg);
  }

  50% {
    opacity: 1;
    transform: scale(1.15) rotate(25deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-aethelis-mark,
  .ask-aethelis-mark-crop,
  .ask-aethelis-mark::before,
  .ask-aethelis-mark::after {
    animation: none !important;
  }
}

/* Ask Aethelis — open-state declutter + accessible composer contrast */

/* Ghost the floating launcher whenever the chat panel is open. */
.ask-aethelis-root:has(.ask-aethelis-panel:not([hidden])) .ask-aethelis-launcher,
.ask-aethelis-root:has(.ask-aethelis-panel[aria-hidden="false"]) .ask-aethelis-launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.92);
}

/* Keep the transition soft instead of making the launcher disappear abruptly. */
.ask-aethelis-launcher {
  transition:
    opacity 180ms ease,
    visibility 180ms ease,
    transform 180ms ease,
    filter 180ms ease;
}

/* Slightly brighter dark composer for better visual contrast. */
.ask-aethelis-input,
.ask-aethelis-composer textarea,
.ask-aethelis-composer input {
  background: rgba(47, 38, 58, 0.96);
  color: rgba(255, 250, 255, 0.98);
  border-color: rgba(224, 157, 255, 0.34);
}

/* Make “Ask Aethelis anything…” clearly readable. */
.ask-aethelis-input::placeholder,
.ask-aethelis-composer textarea::placeholder,
.ask-aethelis-composer input::placeholder {
  color: rgba(238, 222, 244, 0.72);
  opacity: 1;
}

/* Give keyboard/mouse focus a clearer Aethelis glow. */
.ask-aethelis-input:focus,
.ask-aethelis-composer textarea:focus,
.ask-aethelis-composer input:focus {
  background: rgba(55, 43, 68, 0.98);
  border-color: rgba(226, 114, 255, 0.68);
  outline: none;
  box-shadow:
    0 0 0 2px rgba(190, 89, 255, 0.13),
    0 0 18px rgba(202, 76, 255, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .ask-aethelis-launcher {
    transition: none;
  }
}

/* Ask Aethelis movable viewport controls */
.ask-aethelis-launcher {
  touch-action: manipulation;
}

@media (min-width: 761px) {
  .ask-aethelis-launcher {
    cursor: grab;
    touch-action: none;
  }

  .ask-aethelis-launcher:active {
    cursor: grabbing;
  }
}

.ask-aethelis-dismiss {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(214, 174, 255, 0.28);
  border-radius: 999px;
  background: rgba(24, 11, 42, 0.88);
  color: #ffffff;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.ask-aethelis-dismiss:hover,
.ask-aethelis-dismiss:focus-visible {
  border-color: rgba(240, 111, 219, 0.8);
  box-shadow: 0 0 0 3px rgba(165, 76, 255, 0.2);
  outline: none;
}


/* #68 viewport anchoring */
.ask-aethelis-launcher {
  position: fixed !important;
  z-index: 9998;
}

.ask-aethelis-panel {
  position: fixed !important;
  z-index: 9999;
}

/* =========================================================
   ASK AETHELIS MOBILE
   Small orb when closed, phone assistant when open
   ========================================================= */

@media (max-width: 600px) {
  .ask-aethelis-launcher {
    position: fixed !important;
    left: auto !important;
    top: auto !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;

    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;

    box-sizing: border-box !important;
    display: grid !important;
    place-items: center !important;
    gap: 0 !important;

    margin: 0 !important;
    padding: 3px !important;

    overflow: hidden !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 123, 237, .52) !important;
    background: linear-gradient(
      145deg,
      #7657ff,
      #df47ce
    ) !important;
    box-shadow:
      0 8px 28px rgba(122, 67, 220, .38),
      0 0 18px rgba(223, 71, 206, .20) !important;

    transform: none !important;
  }

  .ask-aethelis-launcher-label {
    display: none !important;
  }

  .ask-aethelis-launcher .ask-aethelis-mark {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    margin: 0 !important;
    flex: none !important;
  }

  .ask-aethelis-panel {
    position: fixed !important;

    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;

    top:
      max(
        18px,
        env(safe-area-inset-top)
      ) !important;

    bottom: auto !important;

    width: auto !important;
    height:
      min(
        620px,
        calc(var(--ask-visual-height, 100dvh) - 42px)
      ) !important;

    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;

    max-height:
      calc(
        var(--ask-visual-height, 100dvh) - 42px
      ) !important;

    border:
      1px solid
      rgba(213, 151, 255, .28) !important;

    border-radius: 18px !important;
    overflow: hidden !important;

    box-shadow:
      0 24px 70px rgba(0, 0, 0, .48),
      0 0 34px rgba(165, 76, 255, .16) !important;
  }

  .ask-aethelis-header {
    flex: 0 0 auto !important;
    min-height: 62px !important;
    padding:
      max(8px, env(safe-area-inset-top))
      10px
      8px
      13px !important;
  }

  .ask-aethelis-header button {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .ask-aethelis-messages {
    min-width: 0 !important;
    padding: 14px !important;
    overscroll-behavior: contain !important;
  }

  .ask-message {
    max-width: 90% !important;
    font-size: 14px !important;
  }

  .ask-suggestions {
    flex: 0 0 auto !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
    padding: 0 12px 10px !important;
    overflow: visible !important;
  }

  .ask-suggestion {
    width: 100% !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    padding: 9px 12px !important;
    white-space: normal !important;
    text-align: left !important;
  }

  .ask-aethelis-form {
    flex: 0 0 auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding:
      9px
      max(9px, env(safe-area-inset-right))
      max(9px, env(safe-area-inset-bottom))
      max(9px, env(safe-area-inset-left)) !important;
  }

  .ask-aethelis-input {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  .ask-aethelis-send {
    min-width: 62px !important;
    min-height: 44px !important;
  }
}
