/* UMBRALIS · Niran Floating Chat Widget (Eclipse Orb + Animated Line Mouth) */

@keyframes niranPlasmaSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes niranFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

@keyframes niranBlink {
  0%, 91%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.08); }
}

@keyframes niranMouthSpeak {
  0%   { height: 2px; width: 9px; border-radius: 999px; }
  18%  { height: 5.5px; width: 7.5px; border-radius: 999px; }
  36%  { height: 2.2px; width: 10.5px; border-radius: 999px; }
  56%  { height: 4.8px; width: 8px; border-radius: 999px; }
  78%  { height: 2px; width: 10px; border-radius: 999px; }
  100% { height: 2px; width: 9px; border-radius: 999px; }
}

@keyframes niranDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes niranPanelIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Root floating anchor */
.niran-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9990;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Launcher stack (tooltip + orb) */
.niran-launcher-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.niran-teaser {
  background: rgba(14, 14, 20, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 107, 26, 0.14);
  color: #F5F3EE;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 240px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.niran-teaser.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.niran-teaser-close {
  background: none;
  border: none;
  color: #8A8A96;
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  flex: none;
}

.niran-teaser-close:hover {
  color: #F5F3EE;
}

/* --- ECLIPSE ORB COMPONENT (used in both launcher 68px and header 44px) --- */
.niran-orb-btn {
  width: 74px;
  height: 74px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  border-radius: 9999px;
  outline: none;
  animation: niranFloat 3.8s ease-in-out infinite;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 12px 24px rgba(10, 10, 14, 0.34));
}

.niran-orb-btn:hover {
  transform: scale(1.07);
}

.niran-orb-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 107, 26, 0.55);
}

.niran-orb {
  --orb-size: 74px;
  --core-inset: 3px;
  --eye-w: 3.8px;
  --eye-h: 9.2px;
  --eye-gap: 6.5px;
  width: var(--orb-size);
  height: var(--orb-size);
  position: relative;
  border-radius: 9999px;
}

.niran-orb--sm {
  --orb-size: 46px;
  --core-inset: 2.5px;
  --eye-w: 2.5px;
  --eye-h: 6px;
  --eye-gap: 4.2px;
}

.niran-bloom {
  position: absolute;
  inset: -7px;
  border-radius: 9999px;
  background: conic-gradient(
    from 215deg,
    rgba(255, 179, 107, 0.76) 0deg,
    rgba(255, 107, 26, 0.92) 78deg,
    rgba(220, 48, 24, 0.72) 138deg,
    rgba(124, 58, 237, 0.56) 210deg,
    rgba(168, 85, 247, 0.72) 275deg,
    rgba(255, 179, 107, 0.76) 360deg
  );
  filter: blur(10px);
  opacity: 0.72;
  animation: niranPlasmaSpin 11s linear infinite;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.niran-orb--sm .niran-bloom {
  inset: -4px;
  filter: blur(6px);
  opacity: 0.65;
}

.niran-ring {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: conic-gradient(
    from 215deg,
    #FFD093 0deg,
    #FF7A29 68deg,
    #FF3D1A 122deg,
    #6B21A8 196deg,
    #A855F7 265deg,
    #E9B6FF 302deg,
    #FFD093 360deg
  );
  filter: blur(1px);
  animation: niranPlasmaSpin 11s linear infinite;
  pointer-events: none;
}

.niran-orb.is-thinking .niran-bloom,
.niran-orb.is-thinking .niran-ring {
  animation-duration: 2.1s;
  opacity: 0.96;
}

@keyframes niranSpeakPulse {
  0%, 100% {
    box-shadow:
      inset 0 0 8px rgba(0, 0, 0, 0.45),
      0 0 0 0 rgba(255, 107, 26, 0.42);
  }
  50% {
    box-shadow:
      inset 0 0 8px rgba(0, 0, 0, 0.35),
      0 0 18px 3px rgba(255, 107, 26, 0.55);
  }
}

.niran-core {
  position: absolute;
  inset: var(--core-inset);
  border-radius: 9999px;
  background: #0D0E14;
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.55),
    0 2px 10px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
}

.niran-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9999px;
  transform: scale(1.04);
  transition: transform 0.22s ease-out, filter 0.28s ease;
  user-select: none;
  pointer-events: none;
}

/* Exact oval aperture matching the glossy 3D obsidian visor inside the purple ring */
.niran-visor-mask {
  position: absolute;
  left: 34%;
  top: 45.5%;
  width: 44%;
  height: 52%;
  transform: translate(-50%, -50%) perspective(140px) rotateY(-16deg);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.niran-orb.is-happy .niran-core {
  transform: scale(1.05);
}

.niran-orb.is-speaking .niran-core {
  animation: niranSpeakPulse 1.15s ease-in-out infinite;
}

.niran-orb.is-thinking .niran-avatar-img {
  filter: brightness(1.06) saturate(1.1);
}

.niran-face {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease-out;
}

.niran-eyes-normal {
  display: flex;
  align-items: center;
  gap: var(--eye-gap);
}

.niran-eye {
  width: var(--eye-w);
  height: var(--eye-h);
  border-radius: 9999px;
  background: #FFF8EA;
  box-shadow: 0 0 6px rgba(255, 248, 234, 0.95), 0 0 12px rgba(255, 168, 76, 0.55);
  animation: niranBlink 4.2s infinite;
  transition: transform 0.14s ease-out;
}

.niran-eyes-happy {
  display: none;
  align-items: center;
  justify-content: center;
}

.niran-orb.is-happy .niran-eyes-normal,
.niran-orb-btn:hover .niran-orb:not(.is-thinking):not(.is-speaking) .niran-eyes-normal {
  display: none;
}

.niran-orb.is-happy .niran-eyes-happy,
.niran-orb-btn:hover .niran-orb:not(.is-thinking):not(.is-speaking) .niran-eyes-happy {
  display: flex;
}

/* Minimal luminous line mouth (appears on hover / awake / speaking) */
.niran-mouth-slot {
  height: 0;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.24s ease, transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.24s ease, margin-top 0.24s ease;
}

.niran-orb.is-awake .niran-mouth-slot,
.niran-orb.is-happy .niran-mouth-slot,
.niran-orb.is-speaking .niran-mouth-slot,
.niran-orb-btn:hover .niran-mouth-slot {
  height: 6px;
  margin-top: 2.5px;
  opacity: 1;
  transform: scaleX(1);
}

.niran-orb--sm.is-awake .niran-mouth-slot,
.niran-orb--sm.is-happy .niran-mouth-slot,
.niran-orb--sm.is-speaking .niran-mouth-slot {
  height: 4px;
  margin-top: 2px;
}

.niran-mouth-line {
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: #FFF8EA;
  box-shadow: 0 0 6px rgba(255, 248, 234, 0.9), 0 0 10px rgba(255, 107, 26, 0.5);
  transition: width 0.2s ease, height 0.2s ease, border-radius 0.2s ease;
}

.niran-orb--sm .niran-mouth-line {
  width: 6.5px;
  height: 1.6px;
}

/* Gentle curved smile when awake/happy (not speaking) */
.niran-orb.is-happy:not(.is-speaking) .niran-mouth-line {
  width: 10px;
  height: 3.5px;
  background: transparent;
  border-bottom: 2px solid #FFF8EA;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 2px 6px rgba(255, 179, 107, 0.55);
}

.niran-orb--sm.is-happy:not(.is-speaking) .niran-mouth-line {
  width: 7px;
  height: 2.5px;
  border-bottom-width: 1.6px;
}

/* Living animated speech line */
.niran-orb.is-speaking .niran-mouth-line {
  background: #FFF8EA;
  border: none;
  animation: niranMouthSpeak 0.42s ease-in-out infinite;
}

/* Online green pulse badge on launcher */
.niran-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background: #34D399;
  border: 2px solid #0A0A0E;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.85);
}

/* --- FLOATING CHAT PANEL --- */
.niran-panel {
  position: fixed;
  right: 24px;
  bottom: 104px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 132px);
  background: rgba(12, 12, 18, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.65),
    0 0 40px rgba(255, 107, 26, 0.14),
    0 0 24px rgba(168, 85, 247, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9991;
  color: #F5F3EE;
}

.niran-panel.is-open {
  display: flex;
  animation: niranPanelIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.niran-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(240px 100px at 12% 0%, rgba(255, 107, 26, 0.16), transparent 72%),
    radial-gradient(220px 100px at 90% 0%, rgba(168, 85, 247, 0.14), transparent 72%),
    rgba(18, 18, 24, 0.8);
  flex: none;
}

.niran-head-meta {
  flex: 1;
  min-width: 0;
}

.niran-head-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #F5F3EE;
  line-height: 1.15;
}

.niran-head-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: #A1A1AA;
  margin-top: 2px;
}

.niran-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
}

.niran-head-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #A1A1AA;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.niran-head-close:hover {
  color: #F5F3EE;
  border-color: rgba(255, 107, 26, 0.45);
  background: rgba(255, 107, 26, 0.12);
}

/* Body container (holds thread + optional gate overlay) */
.niran-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Thread */
.niran-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.niran-thread::-webkit-scrollbar {
  width: 5px;
}

.niran-thread::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.niran-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.niran-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #FF6B1A, #CC4400);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 18px -6px rgba(255, 107, 26, 0.45);
}

.niran-msg--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #F5F3EE;
  border-bottom-left-radius: 4px;
}

.niran-msg--system {
  align-self: center;
  background: transparent;
  color: #8A8A96;
  font-size: 11.5px;
  text-align: center;
  max-width: 92%;
}

/* Quick reply chips */
.niran-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.niran-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #D4D4D8;
  font-size: 12px;
  font-family: inherit;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.niran-chip:hover {
  border-color: rgba(255, 107, 26, 0.6);
  background: rgba(255, 107, 26, 0.14);
  color: #F5F3EE;
}

/* Typing dots */
.niran-typing {
  align-self: flex-start;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.niran-typing.is-visible {
  display: flex;
}

.niran-typing span {
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background: #FF8F4D;
  animation: niranDotBounce 1.2s infinite ease-in-out;
}

.niran-typing span:nth-child(2) { animation-delay: 0.15s; }
.niran-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Intro / contact gate (shown only once if visitor hasn't registered yet) */
.niran-gate {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(320px 260px at 50% 10%, rgba(255, 107, 26, 0.14), transparent 72%),
    radial-gradient(280px 240px at 85% 85%, rgba(168, 85, 247, 0.12), transparent 72%),
    rgba(12, 12, 18, 0.98);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  z-index: 5;
}

.niran-gate.is-hidden {
  display: none;
}

.niran-gate h3 {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 800;
  color: #F5F3EE;
  letter-spacing: -0.01em;
}

.niran-gate p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #A1A1AA;
  max-width: 290px;
}

.niran-gate-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.niran-gate-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  padding: 10px 13px;
  color: #F5F3EE;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}

.niran-gate-form input:focus {
  border-color: #FF6B1A;
  box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.2);
}

.niran-gate-form button {
  margin-top: 2px;
  border: none;
  border-radius: 11px;
  padding: 11px 14px;
  background: linear-gradient(135deg, #FF6B1A, #CC4400);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 20px -4px rgba(255, 107, 26, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.niran-gate-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -4px rgba(255, 107, 26, 0.65);
}

.niran-gate-err {
  font-size: 12px;
  color: #F87171;
  min-height: 16px;
}

/* Composer */
.niran-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 18, 24, 0.9);
  flex: none;
}

.niran-composer textarea {
  flex: 1;
  resize: none;
  max-height: 96px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  color: #F5F3EE;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 9px 12px;
  outline: none;
}

.niran-composer textarea:focus {
  border-color: #FF6B1A;
  box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.18);
}

.niran-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #FF6B1A, #CC4400);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  box-shadow: 0 4px 14px rgba(255, 107, 26, 0.4);
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.niran-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.niran-send-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Mobile adaptation */
@media (max-width: 520px) {
  .niran-root {
    right: 14px;
    bottom: 14px;
  }
  .niran-teaser {
    display: none;
  }
  .niran-panel {
    right: 10px;
    left: 10px;
    bottom: 92px;
    width: auto;
    max-width: none;
    height: min(540px, calc(100dvh - 110px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .niran-orb-btn,
  .niran-bloom,
  .niran-ring,
  .niran-eye,
  .niran-mouth-line {
    animation: none !important;
  }
}
