/* Sorrin website JAMES1 / responsive full-perimeter assistant aura */
@property --sorrinbot-glow-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
html.ai-development-access,
html.ai-development-access body.sorrinbot-page,
body.sorrinbot-page {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #faf9f6;
  -webkit-text-size-adjust: 100%;
}

.sorrinbot-clean-main {
  position: relative;
  width: 100%;
  height: calc(100vh - 72px);
  height: calc(100dvh - 72px);
  min-height: 0;
  overflow: hidden;
  background: #faf9f6;
}

.sorrinbot-clean-stage {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  overflow: hidden;
  background: #f3f0eb url('assets/ai-home-background-grid-v98.png') center center / cover no-repeat;
}

.sorrinbot-clean-stage::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    radial-gradient(circle at 30% 58%, rgba(255, 255, 255, .74) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(180deg, rgba(250, 249, 246, .13) 0%, rgba(250, 249, 246, .07) 38%, rgba(250, 249, 246, .18) 100%);
  pointer-events: none;
}

.sorrinbot-character-space {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.sorrinbot-character {
  position: absolute;
  bottom: 54px;
  left: 77%;
  width: auto;
  height: clamp(430px, 56dvh, 610px);
  max-width: 44vw;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 22px 22px rgba(20, 25, 27, .12));
  opacity: 0;
  transform: translateX(-50%) scale(1.12125);
  transform-origin: 50% 88%;
  transition: opacity .18s ease, filter .24s ease;
  image-rendering: auto;
}

.sorrinbot-character.is-active { opacity: 1; }

.sorrinbot-messages {
  position: absolute;
  z-index: 5;
  top: 24px;
  right: 36vw;
  bottom: 150px;
  left: max(28px, calc((100vw - 1480px) / 2));
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sorrinbot-messages::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.sorrinbot-clean-stage.has-conversation .sorrinbot-messages {
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sorrinbot-message-stack {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  width: 100%;
  min-height: calc(100% - 4px);
  padding: 34px 56px 40px 30px;
}

.sorrinbot-message {
  position: relative;
  display: flex;
  width: min(610px, 94%);
  margin-right: 0;
  margin-left: auto;
  animation: sorrinbotMessageRise .38s cubic-bezier(.2, .72, .25, 1) both;
}

.sorrinbot-message.is-user {
  width: min(520px, 82%);
  margin-right: auto;
  margin-left: 20px;
  animation-duration: .42s;
}

.sorrinbot-message-mark,
.sorrinbot-message small {
  display: none;
}

.sorrinbot-message-body {
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
  padding: 20px 24px 21px;
  border: 1px solid rgba(211, 218, 225, .94);
  border-radius: 30px 30px 10px 30px;
  background: #f4f7fb;
  box-shadow:
    0 14px 32px rgba(34, 45, 56, .13),
    0 3px 8px rgba(34, 45, 56, .05);
  isolation: isolate;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sorrinbot-message.is-assistant .sorrinbot-message-body {
  margin-left: auto;
  box-shadow: none;
}

@media (min-width: 821px) {
  .sorrinbot-message.is-assistant.is-long .sorrinbot-message-body {
    width: 100%;
  }
}

.sorrinbot-message-glow {
  position: absolute;
  z-index: 0;
  inset: -3px;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  filter: saturate(1.18) blur(3px);
  opacity: .98;
  pointer-events: none;
}

.sorrinbot-message-glow::before {
  content: '';
  position: absolute;
  --sorrinbot-glow-angle: 0deg;
  inset: 0;
  width: auto;
  height: auto;
  aspect-ratio: auto;
  background: conic-gradient(
    from var(--sorrinbot-glow-angle),
    rgba(255, 222, 38, 0) 0deg,
    rgba(255, 225, 41, .62) 20deg,
    rgba(255, 228, 48, 1) 48deg,
    rgba(255, 215, 25, 1) 78deg,
    rgba(255, 226, 43, .42) 108deg,
    rgba(255, 222, 38, 0) 130deg,
    rgba(255, 222, 38, 0) 169deg,
    rgba(0, 145, 50, 0) 179deg,
    rgba(10, 190, 72, .82) 194deg,
    rgba(0, 205, 76, 1) 220deg,
    rgba(0, 170, 61, 1) 253deg,
    rgba(4, 186, 68, .62) 280deg,
    rgba(0, 145, 50, 0) 300deg,
    rgba(0, 122, 45, 0) 360deg
  );
  animation: sorrinbotGlowOrbit 9.80s linear infinite;
  backface-visibility: hidden;
}

.sorrinbot-message:nth-child(2n) .sorrinbot-message-glow::before {
  animation-delay: -4.73s;
}

.sorrinbot-message:nth-child(3n) .sorrinbot-message-glow::before {
  animation-delay: -7.10s;
}

.sorrinbot-message.is-assistant .sorrinbot-message-body::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  box-sizing: border-box;
  border: 1px solid rgba(211, 218, 225, .94);
  border-radius: inherit;
  background: #f4f7fb;
  box-shadow: none;
  pointer-events: none;
}

.sorrinbot-message.is-user .sorrinbot-message-body {
  margin-right: auto;
  padding: 14px 18px 15px;
  border-color: rgba(29, 34, 42, .98);
  border-radius: 22px 22px 8px 22px;
  background: #252a33;
  box-shadow: 0 8px 19px rgba(19, 23, 29, .2);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.sorrinbot-message.is-user p { color: #faf9f6; }

.sorrinbot-message p {
  position: relative;
  z-index: 2;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #243035;
  font-size: 15px;
  line-height: 1.58;
}

.sorrinbot-message-reserve {
  visibility: hidden;
  user-select: none;
}

.sorrinbot-message-reveal {
  position: absolute;
  inset: 0;
  display: block;
  white-space: pre-wrap;
}

.sorrinbot-message-reveal.is-mobile-word-reveal .sorrinbot-reveal-word {
  display: inline;
  opacity: 0;
  filter: blur(1.5px);
  transition: opacity .2s ease, filter .2s ease;
}

.sorrinbot-message-reveal.is-mobile-word-reveal .sorrinbot-reveal-word.is-visible {
  opacity: 1;
  filter: blur(0);
}

.sorrinbot-message.is-intro {
  width: min(640px, 98%);
}

.sorrinbot-message.is-intro .sorrinbot-message-body {
  padding: 25px 30px 27px;
  border-radius: 34px 34px 11px 34px;
}

.sorrinbot-message.is-intro p {
  color: #1f2d34;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 1.36vw, 1.38rem);
  line-height: 1.52;
}

/* PATCH38 rebuild: keep every SorrinBot reply in the same typography as the opening message.
   User bubbles intentionally retain their existing sans-serif typography. */
.sorrinbot-message.is-assistant p {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 1.36vw, 1.38rem);
  line-height: 1.52;
}

.sorrinbot-message.is-user p {
  font-size: clamp(1.08rem, 1.36vw, 1.38rem);
}

.sorrinbot-message.is-loading .sorrinbot-message-body {
  padding: 15px 18px;
}

.sorrinbot-message.is-loading p {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 34px;
  min-height: 20px;
}

.sorrinbot-message.is-loading p i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #66716f;
  animation: sorrinbotTyping 1s ease-in-out infinite;
}

.sorrinbot-message.is-loading p i:nth-child(2) { animation-delay: .14s; }
.sorrinbot-message.is-loading p i:nth-child(3) { animation-delay: .28s; }

.sorrinbot-composer {
  position: absolute;
  z-index: 7;
  bottom: 24px;
  left: 50%;
  width: min(840px, calc(100% - 48px));
  padding: 8px 10px 8px 19px;
  border: 1px solid rgba(219, 220, 215, .96);
  border-radius: 28px;
  background: rgba(240, 240, 236, .95);
  box-shadow: 0 16px 42px rgba(29, 34, 35, .11), 0 2px 8px rgba(29, 34, 35, .04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.sorrinbot-input-shell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sorrinbot-input-shell textarea {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  max-height: 112px;
  padding: 10px 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  outline: none;
  color: #24292a;
  background: transparent;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.08rem, 1.36vw, 1.38rem);
  line-height: 1.5;
  scrollbar-color: #b7b8b5 transparent;
  scrollbar-width: thin;
}

.sorrinbot-input-shell textarea::placeholder { color: #858887; }
.sorrinbot-input-shell textarea:disabled { color: #858887; }

.sorrinbot-send {
  display: grid;
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  place-items: center;
  margin-bottom: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 38% 32%, #397793 0%, #326d8b 34%, #2d6584 66%, #285b77 100%);
  cursor: pointer;
  transition: background .24s ease, transform .2s ease, opacity .2s ease;
}

.sorrinbot-send span {
  display: block;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-4px);
}

.sorrinbot-send.is-armed {
  background: radial-gradient(circle at 38% 32%, #397793 0%, #326d8b 34%, #2d6584 66%, #285b77 100%);
}

.sorrinbot-send:hover:not(:disabled),
.sorrinbot-send:focus-visible:not(:disabled) {
  background: radial-gradient(circle at 38% 32%, #397793 0%, #326d8b 34%, #2d6584 66%, #285b77 100%);
  outline: none;
  transform: scale(1.035);
}

.sorrinbot-send:disabled {
  opacity: .24;
  cursor: not-allowed;
}

.sorrinbot-send.is-armed:disabled { opacity: .74; }

.sorrinbot-security { min-width: 0; }
.sorrinbot-security [data-turnstile-container] { max-width: 100%; }
.sorrinbot-security [data-turnstile-container]:empty { display: none; }
.sorrinbot-security iframe { max-width: 100%; }

.sorrinbot-error {
  margin: 7px 9px 3px 0;
  color: #9b4035;
  font-size: 10px;
  line-height: 1.4;
  text-align: right;
}

.sorrinbot-error[hidden] { display: none; }

.sorrinbot-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes sorrinbotMessageRise {
  from { opacity: 0; transform: translateY(46px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sorrinbotTyping {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

@keyframes sorrinbotGlowOrbit {
  to { --sorrinbot-glow-angle: 360deg; }
}

@keyframes sorrinbotMessageRiseMobile {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1120px) {
  .sorrinbot-character {
    left: 76%;
    max-width: 42vw;
  }

  .sorrinbot-messages {
    right: 36vw;
    left: 22px;
  }

  .sorrinbot-message-stack { padding-right: 52px; }
}

@media (max-width: 820px) {
  .sorrinbot-message-glow { display: none; }

  .sorrinbot-message.is-assistant .sorrinbot-message-body::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
      from -22deg,
      rgba(255, 222, 38, 0) 0deg,
      rgba(255, 225, 41, .48) 18deg,
      rgba(255, 228, 48, .98) 48deg,
      rgba(255, 215, 25, 1) 96deg,
      rgba(255, 226, 43, .46) 140deg,
      rgba(255, 222, 38, 0) 172deg,
      rgba(0, 150, 52, 0) 182deg,
      rgba(8, 196, 73, .82) 202deg,
      rgba(0, 211, 78, 1) 258deg,
      rgba(0, 174, 64, 1) 317deg,
      rgba(4, 195, 71, .66) 344deg,
      rgba(0, 150, 52, 0) 360deg
    );
    filter: saturate(1.16) blur(3px);
    opacity: .96;
    pointer-events: none;
  }

  .sorrinbot-message {
    animation-name: sorrinbotMessageRiseMobile;
    animation-duration: .34s;
  }

  .sorrinbot-page .site-header { height: 106px; }

  .sorrinbot-page .site-header .nav {
    top: 106px;
  }

  .sorrinbot-clean-main {
    height: calc(100vh - 106px);
    height: calc(100dvh - 106px);
  }

  .sorrinbot-page .site-header.nav-open .nav {
    max-height: calc(100dvh - 106px);
    overflow-y: auto;
  }

  .sorrinbot-character {
    bottom: 70px;
    left: 84%;
    height: clamp(210px, 30dvh, 280px);
    max-width: 52vw;
    transform: translateX(-50%) scale(.98);
  }

  .sorrinbot-clean-stage.has-conversation .sorrinbot-character.is-active {
    opacity: 1;
    filter: drop-shadow(0 14px 16px rgba(20, 25, 27, .1));
  }

  .sorrinbot-messages {
    top: 10px;
    right: 27vw;
    bottom: 108px;
    left: 10px;
  }

  .sorrinbot-message-stack {
    gap: 12px;
    padding: 14px 10px 26px 8px;
  }

  .sorrinbot-clean-stage:not(.has-conversation) .sorrinbot-message-stack {
    justify-content: flex-start;
  }

  .sorrinbot-message { width: 100%; }
  .sorrinbot-message.is-user {
    width: 88%;
    margin-left: 0;
  }

  .sorrinbot-composer {
    bottom: 16px;
    width: calc(100% - 28px);
  }

}

@media (max-width: 520px) {
  .sorrinbot-character {
    bottom: 66px;
    right: -4px;
    left: auto;
    height: clamp(155px, 24dvh, 195px);
    max-width: 45vw;
    transform: scale(1.41);
    transform-origin: 100% 88%;
  }

  .sorrinbot-messages {
    top: 7px;
    right: 22.5vw;
    bottom: 88px;
    left: 7px;
  }

  .sorrinbot-message-stack {
    gap: 10px;
    padding: 9px 5px 20px 7px;
  }

  .sorrinbot-message { width: 100%; }
  .sorrinbot-message.is-user { width: 90%; }

  .sorrinbot-message-body {
    padding: 19px 20px 20px;
    border-radius: 25px 25px 9px 25px;
  }

  .sorrinbot-message.is-intro .sorrinbot-message-body {
    padding: 20px 21px 21px;
    border-radius: 26px 26px 9px 26px;
  }

  .sorrinbot-message.is-intro p {
    font-size: clamp(1.1rem, 4.6vw, 1.2rem);
    line-height: 1.46;
  }

  .sorrinbot-message p {
    font-size: 16px;
    line-height: 1.5;
  }

  .sorrinbot-message.is-assistant p {
    font-size: clamp(1.1rem, 4.6vw, 1.2rem);
    line-height: 1.46;
  }

  .sorrinbot-message.is-user p {
    font-size: clamp(1.1rem, 4.6vw, 1.2rem);
    line-height: 1.46;
  }

  .sorrinbot-message.is-user .sorrinbot-message-body { padding: 15px 18px 16px; }

  .sorrinbot-composer {
    bottom: 8px;
    width: calc(100% - 16px);
    padding: 6px 7px 6px 14px;
    border-radius: 24px;
    touch-action: manipulation;
  }

  .sorrinbot-input-shell textarea {
    font-size: clamp(1.1rem, 4.6vw, 1.2rem);
    line-height: 1.35;
    touch-action: manipulation;
  }

  .sorrinbot-send {
    flex-basis: 39px;
    width: 39px;
    height: 39px;
  }

}

@media (max-height: 650px) and (min-width: 521px) {
  .sorrinbot-character {
    bottom: 46px;
    height: 390px;
  }

  .sorrinbot-messages { bottom: 130px; }
  .sorrinbot-message-stack { padding-top: 10px; }

  .sorrinbot-message.is-intro .sorrinbot-message-body {
    padding-top: 18px;
    padding-bottom: 20px;
  }

  .sorrinbot-composer { bottom: 9px; }
}

@media (max-width: 520px) and (max-height: 650px) {
  .sorrinbot-character {
    bottom: 61px;
    height: clamp(112px, 28dvh, 140px);
  }

  .sorrinbot-messages {
    top: 4px;
    bottom: 76px;
  }

  .sorrinbot-composer { bottom: 5px; }
}

@media (max-width: 360px) {
  .sorrinbot-character {
    height: clamp(145px, 23dvh, 180px);
  }

  .sorrinbot-message.is-intro p { font-size: .96rem; }
  .sorrinbot-message p { font-size: 15.5px; }
  .sorrinbot-message.is-assistant p { font-size: .96rem; }
  .sorrinbot-message.is-user p { font-size: .96rem; }
  .sorrinbot-input-shell textarea { font-size: .96rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sorrinbot-character,
  .sorrinbot-send {
    transition: none;
  }

  .sorrinbot-messages { scroll-behavior: auto; }

  .sorrinbot-message,
  .sorrinbot-message.is-loading p i {
    animation: none;
  }

  .sorrinbot-message-glow::before {
    animation: none;
  }
}
