/* CyberAI neural brand — canvas mesh + label foreground */

@property --neural-scroll-v {
  syntax: '<number>';
  initial-value: 0;
  inherits: true;
}

.brand.brand-neural {
  min-width: clamp(9.5rem, 18vw, 11.5rem);
  min-height: 3.25rem;
  padding: 0.68rem clamp(1.6rem, 3vw, 2rem);
  border-radius: 999px;
  font-family: 'Montserrat', Inter, system-ui, sans-serif;
  font-weight: 900;
  isolation: isolate;
  --brand-energy: 0;
  --brand-click-amp: 1;
  cursor: pointer;
  background:
    radial-gradient(ellipse 120% 200% at 22% 50%, rgba(55, 192, 255, 0.28), transparent 58%),
    radial-gradient(ellipse 110% 180% at 78% 50%, rgba(255, 138, 0, 0.22), transparent 55%),
    linear-gradient(135deg, rgba(3, 16, 28, 0.98) 0%, rgba(2, 12, 22, 0.96) 100%);
  border: 1px solid rgba(55, 192, 255, 0.48);
  box-shadow:
    0 0 0 1px rgba(55, 192, 255, 0.14),
    0 0 calc(36px + 24px * var(--brand-energy)) rgba(55, 192, 255, calc(0.34 + 0.28 * var(--brand-energy))),
    0 0 calc(56px + 40px * var(--brand-energy)) rgba(255, 138, 0, calc(0.16 + 0.22 * var(--brand-energy))),
    0 8px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 0 0 3px rgba(55, 192, 255, 0.06);
  backdrop-filter: blur(14px) saturate(calc(1.35 + 0.25 * var(--brand-energy)));
  -webkit-backdrop-filter: blur(14px) saturate(calc(1.35 + 0.25 * var(--brand-energy)));
  animation: brandAmbientHalo 4.2s ease-in-out infinite;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.35s ease,
    filter 0.35s ease;
}

@keyframes brandAmbientHalo {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(55,192,255,0.14),
      0 0 36px rgba(55,192,255,0.34),
      0 0 56px rgba(255,138,0,0.16),
      0 8px 28px rgba(0,0,0,0.42),
      inset 0 1px 0 rgba(255,255,255,0.09),
      0 0 0 3px rgba(55,192,255,0.06);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(55,192,255,0.22),
      0 0 52px rgba(55,192,255,0.44),
      0 0 72px rgba(255,138,0,0.22),
      0 8px 28px rgba(0,0,0,0.42),
      inset 0 1px 0 rgba(255,255,255,0.12),
      0 0 0 6px rgba(55,192,255,0.09);
  }
}

/* CSS-only degrade when canvas has not initialized */
.brand-neural:not(.is-canvas-ready) {
  background:
    radial-gradient(ellipse 90% 160% at 18% 50%, rgba(55, 192, 255, 0.35), transparent 55%),
    radial-gradient(ellipse 85% 150% at 50% 50%, rgba(168, 85, 247, 0.12), transparent 50%),
    radial-gradient(ellipse 90% 160% at 82% 50%, rgba(255, 138, 0, 0.3), transparent 55%),
    linear-gradient(135deg, rgba(3, 16, 28, 0.98) 0%, rgba(2, 12, 22, 0.96) 100%);
}

.brand-neural.is-canvas-ready {
  background:
    radial-gradient(ellipse 100% 180% at 28% 50%, rgba(55, 192, 255, 0.12), transparent 58%),
    radial-gradient(ellipse 100% 180% at 72% 50%, rgba(255, 138, 0, 0.1), transparent 55%),
    linear-gradient(135deg, rgba(3, 16, 28, 0.98) 0%, rgba(2, 12, 22, 0.96) 100%);
}

.brand-neural::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(55, 192, 255, 0.3) 15%,
    rgba(55, 192, 255, 1) 35%,
    rgba(255, 138, 0, 0.95) 50%,
    rgba(168, 85, 247, 0.75) 65%,
    rgba(55, 192, 255, 1) 80%,
    transparent 100%
  );
  background-size: 260% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.9;
  z-index: 3;
  pointer-events: none;
  animation: brandBorderFlow 2.4s linear infinite;
  animation-duration: calc(2.4s - 1.3s * min(1, var(--neural-scroll-v, 0)));
}

.brand-neural::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 80% 85% at 50% 50%, rgba(0, 0, 0, 0.1) 0%, transparent 70%),
    radial-gradient(ellipse 130% 80% at 50% 110%, rgba(0, 0, 0, 0.22) 0%, transparent 50%);
  z-index: 1;
  pointer-events: none;
}

.brand-neural.is-hovered,
.brand-neural:hover {
  transform: translateY(-4px) scale(1.042);
  border-color: rgba(255, 138, 0, 0.72);
  filter: brightness(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 138, 0, 0.28),
    0 0 64px rgba(55, 192, 255, 0.58),
    0 0 96px rgba(255, 138, 0, 0.45),
    0 0 120px rgba(168, 85, 247, 0.18),
    0 20px 44px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition:
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.28s ease,
    filter 0.28s ease;
}

.brand-neural.is-hovered::before,
.brand-neural:hover::before {
  opacity: 1;
  animation-duration: calc(1.1s - 0.75s * min(1, var(--neural-scroll-v, 0)));
}

/* Idle breathe — only active when not hovered/bursting */
.brand-neural:not(.is-hovered):not(:hover):not(.click-burst)::before {
  animation:
    brandBorderFlow calc(2.4s - 1.3s * min(1, var(--neural-scroll-v, 0))) linear infinite,
    brandIdleBreathe 3.8s ease-in-out infinite;
}

@keyframes brandIdleBreathe {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 0.95; }
}

.brand-neural.is-pressing,
.brand-neural:active {
  transform: translateY(-1px) scale(0.98);
  transition-duration: 0.12s;
}

.brand-neural.click-burst {
  animation: brandClickBurst 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand-neural.click-burst .brand-label {
  animation: brandLabelPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand-neural.is-hovered .brand-bg-glow,
.brand-neural:hover .brand-bg-glow {
  opacity: 1;
  animation-duration: 2.8s;
}

.brand-neural.is-hovered .brand-label-cyber,
.brand-neural:hover .brand-label-cyber {
  filter: drop-shadow(0 0 16px rgba(55, 192, 255, 1)) drop-shadow(0 0 28px rgba(55, 192, 255, 0.55));
  transform: translateY(-0.5px);
  transition: filter 0.35s ease, transform 0.35s ease;
}

.brand-neural.is-hovered .brand-label-ai,
.brand-neural:hover .brand-label-ai {
  filter: drop-shadow(0 0 18px rgba(255, 138, 0, 1)) drop-shadow(0 0 32px rgba(255, 138, 0, 0.55));
  transform: translateY(-0.5px);
  transition: filter 0.35s ease, transform 0.35s ease;
}

.brand-label-cyber,
.brand-label-ai {
  display: inline-block;
  transition: filter 0.35s ease, transform 0.35s ease;
}

.brand-neural:focus-visible {
  outline: 2px solid var(--accent, #37c0ff);
  outline-offset: 3px;
  box-shadow:
    0 0 0 1px rgba(55, 192, 255, 0.3),
    0 0 48px rgba(55, 192, 255, 0.5),
    0 0 72px rgba(255, 138, 0, 0.35);
}

.brand-neural-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  display: block;
}

.brand-bg-glow {
  position: absolute;
  inset: -25% -10%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 48% 120% at 20% 50%, rgba(55, 192, 255, 0.3) 0%, transparent 68%),
    radial-gradient(ellipse 42% 110% at 50% 50%, rgba(168, 85, 247, 0.1) 0%, transparent 62%),
    radial-gradient(ellipse 45% 115% at 80% 50%, rgba(255, 138, 0, 0.24) 0%, transparent 64%);
  opacity: 0.88;
  animation: brandBgGlow 4.5s ease-in-out infinite;
}

.brand-neural.is-canvas-ready .brand-bg-glow {
  opacity: calc(0.55 + 0.35 * var(--brand-energy));
}

.brand-label {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
  font-size: clamp(1.05rem, 2.2vw, 1.18rem);
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1;
  padding: 0.1rem 0.2rem;
  transition: letter-spacing 0.28s ease;
}

.brand-neural.is-hovered .brand-label,
.brand-neural:hover .brand-label {
  letter-spacing: 0.07em;
  transition: letter-spacing 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-label-cyber {
  color: #7dd3fc;
  background: linear-gradient(180deg, #ffffff 0%, #c8eeff 22%, #37c0ff 68%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(55, 192, 255, 0.8)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}

.brand-label-ai {
  color: #ff8a00;
  background: linear-gradient(180deg, #fff0cc 0%, #ff8a00 42%, #ff6b00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 138, 0, 0.95)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.brand-label--single {
  background: linear-gradient(135deg, #eaf3f9, #37c0ff 40%, #ff8a00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(55, 192, 255, 0.5));
}

/* Shimmer sweep on hover */
.brand-shimmer {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 40%,
    rgba(255, 255, 255, 0.07) 48%,
    rgba(55, 192, 255, 0.18) 50%,
    rgba(255, 138, 0, 0.14) 52%,
    transparent 60%,
    transparent 100%
  );
  background-size: 220% 100%;
  transition: opacity 0.35s ease;
}

.brand-neural.is-hovered .brand-shimmer,
.brand-neural:hover .brand-shimmer {
  opacity: 1;
  animation: brandShimmer 2.2s ease-in-out infinite;
}

.brand-neural.click-burst .brand-shimmer {
  opacity: 1;
  animation: brandShimmerBurst 0.6s ease-out;
}

/* Avatar glyph — base layout only; sizing/animations live in profile-dropdown.css */
.avatar-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  flex-shrink: 0;
}

.avatar-glyph--chatbot,
.avatar-glyph--chatbot .avatar-neural-svg {
  width: 28px;
  height: 28px;
}

.avatar-glyph--chatbot-header,
.avatar-glyph--chatbot-header .avatar-neural-svg {
  width: 24px;
  height: 24px;
}

/* Legacy compact SVG (brand-neural-compact.php) — kept for reference */
.brand-compact-svg {
  width: 50px;
  height: 32px;
  display: block;
  filter: drop-shadow(0 0 4px rgba(55, 192, 255, 0.65)) drop-shadow(0 0 8px rgba(255, 138, 0, 0.35));
}

.brand-compact-brain {
  stroke: rgba(55, 192, 255, 0.85);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: rgba(55, 192, 255, 0.06);
}

.brand-compact-path {
  stroke: rgba(55, 192, 255, 0.75);
  stroke-width: 1;
  stroke-linecap: round;
  fill: none;
}

.brand-compact-path--o {
  stroke: rgba(255, 138, 0, 0.7);
}

.brand-compact-node {
  fill: #7dd3fc;
  filter: drop-shadow(0 0 2px rgba(55, 192, 255, 0.9));
}

.brand-compact-node--o {
  fill: #ff8a00;
  filter: drop-shadow(0 0 2px rgba(255, 138, 0, 0.9));
}

@keyframes brandBorderFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 260% 50%; }
}

@keyframes brandBgGlow {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes brandShimmer {
  0% { background-position: 120% 50%; }
  100% { background-position: -120% 50%; }
}

@keyframes brandShimmerBurst {
  0% { background-position: 100% 50%; opacity: 0.9; }
  100% { background-position: -80% 50%; opacity: 0; }
}

@keyframes brandClickBurst {
  0%   { filter: brightness(1);                  transform: translateY(-3px) scale(1.035); border-color: rgba(55,192,255,0.48); }
  18%  { filter: brightness(1.55) saturate(1.6); transform: translateY(-5px) scale(1.065); border-color: rgba(255,138,0,0.9); }
  42%  { filter: brightness(1.22) saturate(1.3); transform: translateY(-4px) scale(1.05);  border-color: rgba(168,85,247,0.75); }
  100% { filter: brightness(1.06);               transform: translateY(-3px) scale(1.035); border-color: rgba(55,192,255,0.48); }
}

@keyframes brandLabelPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .brand-neural,
  .brand-neural::before,
  .brand-bg-glow,
  .brand-shimmer {
    animation: none !important;
  }
  .brand-neural.is-hovered,
  .brand-neural:hover,
  .brand-neural.click-burst { transform: none; filter: none; }
  .brand-neural.click-burst .brand-label { animation: none; }
  .brand-neural.is-hovered .brand-label,
  .brand-neural:hover .brand-label { letter-spacing: 0.04em; transition: none; }
}

@media (max-width: 480px) {
  .brand.brand-neural {
    min-width: 9rem;
    padding: 0.58rem 1.35rem;
  }
  .brand-label {
    font-size: 1.02rem;
    letter-spacing: 0.03em;
  }
}
