/**
 * AI pillar — premium UX (خوانایی، سلسله‌مراتب، تعامل)
 */

.ai-hub--premium {
  --ai-premium-radius: 20px;
  --ai-premium-shadow: 0 24px 64px color-mix(in srgb, var(--ai-accent) 7%, transparent);
}

/* —— Hero studio —— */

.ai-hero--studio {
  gap: clamp(1.75rem, 4vw, 2.75rem);
  padding: clamp(1.35rem, 3.5vw, 2rem);
}

@media (min-width: 900px) {
  .ai-hero--studio {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: start;
  }
}

.ai-hero--studio .ai-lead {
  max-width: 38rem;
  font-size: clamp(0.98rem, 2.1vw, 1.08rem);
  line-height: 1.9;
  margin-bottom: 1rem;
}

.ai-hero__insight {
  margin: 0 0 1.15rem;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--ai-accent-2) 22%, var(--border-subtle));
  background: linear-gradient(
    125deg,
    color-mix(in srgb, var(--ai-accent-2) 8%, transparent),
    color-mix(in srgb, var(--ai-accent) 5%, transparent) 55%,
    transparent
  );
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--text);
  font-weight: 600;
}

.ai-hero__insight::before {
  content: "◆";
  margin-inline-end: 0.45rem;
  font-size: 0.55rem;
  color: var(--ai-accent);
  vertical-align: middle;
}

.ai-chip-rail {
  display: flex;
  gap: 0.45rem;
  margin: 0.25rem 0 0;
  padding: 0.35rem 0 0.65rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent);
}

.ai-chip-rail::-webkit-scrollbar {
  display: none;
}

.ai-chip-rail li {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 0.4rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ai-accent) 20%, var(--border-subtle));
  background: color-mix(in srgb, var(--surface-elevated, #fff) 85%, var(--ai-accent-soft));
  white-space: nowrap;
  transition:
    transform 0.28s var(--ai-ease),
    border-color 0.28s ease,
    box-shadow 0.28s var(--ai-ease);
}

@media (hover: hover) {
  .ai-chip-rail li:hover {
    transform: translateY(-2px);
    border-color: var(--ai-accent-border);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--ai-accent) 10%, transparent);
  }
}

.ai-hero--studio .ai-chips {
  display: none;
}

/* Flow deck (stage) */

.ai-flow-deck {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: var(--ai-premium-radius);
  border: 1px solid color-mix(in srgb, var(--ai-accent) 20%, var(--border-subtle));
  background: color-mix(in srgb, var(--surface-elevated, #fff) 80%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--ai-premium-shadow);
}

.ai-flow-deck__label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ai-accent);
}

.ai-flow-deck__tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.ai-flow-deck__tab {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.25s var(--ai-ease),
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s var(--ai-ease);
}

.ai-flow-deck__tab.is-active {
  color: var(--ai-accent);
  border-color: var(--ai-accent-border);
  background: var(--ai-accent-soft);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ai-accent) 10%, transparent);
}

.ai-flow-deck__tab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ai-accent) 50%, transparent);
  outline-offset: 2px;
}

.ai-flow-deck__panel {
  display: none;
  margin: 0;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.75;
  color: var(--text);
  border: 1px dashed color-mix(in srgb, var(--ai-accent) 25%, var(--border-subtle));
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--ai-accent) 6%, transparent),
    transparent 70%
  );
  min-height: 4.25rem;
}

.ai-flow-deck__panel.is-active {
  display: block;
  animation: ai-flow-in 0.38s var(--ai-ease);
}

@keyframes ai-flow-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.ai-flow-deck__steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.25rem;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-subtle);
}

.ai-flow-deck__steps span {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.22rem 0.45rem;
  border-radius: 8px;
  background: var(--ai-accent-soft);
  color: var(--ai-accent);
  border: 1px solid var(--ai-accent-border);
}

.ai-flow-deck__steps i {
  font-size: 0.55rem;
  color: var(--text-muted);
  font-style: normal;
  opacity: 0.6;
}

.ai-hero--studio .ai-loop {
  min-height: 180px;
  margin-top: 0.65rem;
}

.ai-hero--studio .ai-stats {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.85rem;
}

/* —— Subnav indicator —— */

.ai-subnav--premium {
  display: block;
  position: sticky;
  padding: 0.45rem 0.55rem;
  gap: 0.2rem;
}

.ai-subnav__track {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.ai-subnav__track::-webkit-scrollbar {
  display: none;
}

.ai-subnav__indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--ai-accent), var(--ai-accent-2));
  box-shadow: 0 0 12px color-mix(in srgb, var(--ai-accent) 45%, transparent);
  transition:
    transform 0.32s var(--ai-ease),
    width 0.32s var(--ai-ease),
    opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.ai-subnav--premium.is-ready .ai-subnav__indicator {
  opacity: 1;
}

.ai-subnav--premium a {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* —— Systems catalog UX —— */

.ai-systems__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 767px) {
  .ai-systems__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-systems__hint {
    max-width: none;
  }

  .ai-hub--premium .ai-systems__filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .ai-hub--premium .ai-systems__filters::-webkit-scrollbar {
    display: none;
  }
}

.ai-systems__meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
}

.ai-systems__meta strong {
  color: var(--ai-accent);
  font-weight: 800;
}

.ai-systems__hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 22rem;
  line-height: 1.55;
}

.ai-hub--premium .ai-systems__filters {
  flex: 1 1 auto;
  justify-content: flex-start;
  max-width: none;
  margin-bottom: 0;
  border-radius: 16px;
}

.ai-hub--premium .ai-systems__grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
  gap: 1.1rem;
}

.ai-hub--premium .ai-system-card {
  border-radius: var(--ai-premium-radius);
  padding: 1.2rem 1.25rem 1.3rem;
}

.ai-hub--premium .ai-system-card__body {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-hub--premium .ai-system-card.is-expanded .ai-system-card__body {
  display: block;
  -webkit-line-clamp: unset;
}

.ai-system-card__more {
  align-self: flex-start;
  margin-top: 0.15rem;
  padding: 0.25rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: var(--ai-accent-soft);
  color: var(--ai-accent);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ai-system-card__more:hover {
  background: color-mix(in srgb, var(--ai-accent) 18%, transparent);
}

.ai-system-card__more:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ai-accent) 45%, transparent);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .ai-system-card__more {
    display: none;
  }

  .ai-hub--premium .ai-system-card__body {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}

/* —— Chapter sections —— */

.ai-hub--premium {
  counter-reset: ai-chapter;
}

.ai-section--chapter {
  position: relative;
}

.ai-section--chapter > .ai-section__head .ai-kicker::after {
  content: counter(ai-chapter, decimal-leading-zero);
  counter-increment: ai-chapter;
  margin-inline-start: 0.5rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--ai-accent);
  background: var(--ai-accent-soft);
  border: 1px solid var(--ai-accent-border);
  vertical-align: middle;
}

/* —— Levels as stepped journey —— */

.ai-levels__journey {
  position: relative;
  padding-top: 0.5rem;
}

@media (min-width: 768px) {
  .ai-levels__journey::before {
    content: "";
    position: absolute;
    top: 2.75rem;
    inset-inline: 8%;
    height: 2px;
    background: linear-gradient(
      90deg,
      transparent,
      var(--ai-accent-border),
      var(--ai-accent-border),
      transparent
    );
    z-index: 0;
  }
}

.ai-levels__journey .ai-level-card {
  position: relative;
  z-index: 1;
}

.ai-level-card__level-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
  box-shadow: 0 0 0 4px var(--ai-accent-soft);
}

/* —— Scenarios —— */

.ai-tabs--story .ai-tabs__list {
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  max-width: 100%;
  border-radius: 16px;
}

.ai-tabs--story .ai-tabs__list::-webkit-scrollbar {
  display: none;
}

.ai-tabs--story .ai-tabs__btn {
  flex: 0 0 auto;
  scroll-snap-align: start;
  white-space: nowrap;
}

.ai-tabs--story .ai-tabs__panel {
  min-height: 9rem;
  padding: 1.5rem 1.45rem;
}

.ai-tabs--story .ai-tabs__panel h3 {
  font-size: 1.15rem;
  margin-bottom: 0.65rem;
}

/* —— Process timeline (desktop) —— */

@media (min-width: 1024px) {
  .ai-process--timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    position: relative;
  }

  .ai-process--timeline::before {
    content: "";
    position: absolute;
    top: 1.65rem;
    inset-inline: 2%;
    height: 2px;
    background: linear-gradient(90deg, var(--ai-accent-border), transparent);
    z-index: 0;
  }

  .ai-process--timeline li {
    flex: 1 1 calc(20% - 0.65rem);
    min-width: 9rem;
    flex-direction: column;
    text-align: center;
    z-index: 1;
  }
}

/* —— FAQ grid on wide screens —— */

@media (min-width: 900px) {
  .ai-faq--studio {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
}

/* —— CTA quotes carousel feel —— */

.ai-cta-examples--stack li {
  transition:
    transform 0.3s var(--ai-ease),
    border-color 0.3s ease;
}

@media (hover: hover) {
  .ai-cta-examples--stack li:hover {
    transform: translateX(-4px);
    border-color: var(--ai-accent-border);
  }
}

/* —— RAG plain-language callout —— */

.ai-rag-plain {
  margin: 0 0 1.35rem;
  padding: 1rem 1.15rem;
  border-radius: var(--ai-premium-radius);
  border: 1px solid color-mix(in srgb, var(--ai-accent) 22%, var(--border-subtle));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--ai-accent) 7%, transparent),
    color-mix(in srgb, var(--ai-accent-2) 5%, transparent) 55%,
    transparent
  );
}

.ai-rag-plain__title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ai-accent);
}

.ai-rag-plain p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.85;
  color: var(--text-muted);
}

/* —— Hero 3D visual (ai-agents.webp) —— */

.ai-hero--visual {
  align-items: center;
}

@media (min-width: 900px) {
  .ai-hero--visual {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
    grid-template-areas:
      "copy visual"
      "companion companion";
    align-items: center;
  }

  .ai-hero--visual .ai-hero__copy {
    grid-area: copy;
  }

  .ai-hero--visual .ai-hero__stage {
    grid-area: visual;
  }

  .ai-hero--visual .ai-hero__companion {
    grid-area: companion;
  }
}

.ai-hero--visual .ai-hero__stage {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
  min-height: min(48vh, 460px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-hub--art .ai-hero--visual .ai-hero__stage::before {
  display: none;
}

.ai-hero__visual {
  position: relative;
  width: min(100%, 28rem);
  margin-inline: auto;
  aspect-ratio: 1;
  perspective: 1500px;
  perspective-origin: 50% 40%;
}

.ai-hero__visual-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  animation: ai-hero-orbit 10s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.ai-hero__visual.is-tilting .ai-hero__visual-inner {
  animation: none;
  transition: transform 0.12s ease-out;
}

@keyframes ai-hero-orbit {
  0%,
  100% {
    transform: rotateX(6deg) rotateY(-12deg) translateY(0) translateZ(0);
  }

  25% {
    transform: rotateX(3deg) rotateY(8deg) translateY(-16px) translateZ(28px);
  }

  50% {
    transform: rotateX(9deg) rotateY(14deg) translateY(-8px) translateZ(16px);
  }

  75% {
    transform: rotateX(4deg) rotateY(-6deg) translateY(-20px) translateZ(32px);
  }
}

.ai-hero__figure {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  object-fit: contain;
  transform: translateZ(48px) scale(1.02);
  filter: drop-shadow(0 36px 52px color-mix(in srgb, var(--ai-accent) 26%, transparent))
    drop-shadow(0 12px 28px color-mix(in srgb, var(--ai-accent-2) 18%, transparent));
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.ai-hero__visual-glow {
  position: absolute;
  inset: 10% 0 22%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(
    ellipse 58% 48% at 50% 48%,
    color-mix(in srgb, var(--ai-accent) 24%, transparent),
    color-mix(in srgb, var(--ai-accent-2) 10%, transparent) 45%,
    transparent 72%
  );
  transform: translateZ(-100px) scale(1.15);
  pointer-events: none;
  animation: ai-hero-glow-pulse 5.5s ease-in-out infinite;
}

@keyframes ai-hero-glow-pulse {
  50% {
    opacity: 0.65;
    transform: translateZ(-100px) scale(1.22);
  }
}

.ai-hero__visual-shine {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(
    125deg,
    transparent 35%,
    rgb(255 255 255 / 0.28) 46%,
    transparent 56%
  );
  mix-blend-mode: soft-light;
  pointer-events: none;
  opacity: 0.5;
  animation: ai-hero-shine-sweep 8s ease-in-out infinite;
}

@keyframes ai-hero-shine-sweep {
  0%,
  100% {
    transform: translateX(-8%) skewX(-8deg);
    opacity: 0.25;
  }

  45% {
    transform: translateX(12%) skewX(-8deg);
    opacity: 0.55;
  }
}

.ai-hero__visual-floor {
  position: absolute;
  z-index: 1;
  bottom: 4%;
  inset-inline: 8%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(
    ellipse 85% 60% at 50% 50%,
    color-mix(in srgb, var(--ai-accent) 22%, transparent),
    transparent 72%
  );
  transform: rotateX(78deg) translateZ(-72px);
  filter: blur(10px);
  opacity: 0.85;
  pointer-events: none;
}

.ai-hero__companion {
  display: grid;
  gap: 0.85rem;
  width: 100%;
  margin-top: 0.35rem;
}

@media (min-width: 768px) {
  .ai-hero__companion {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 1rem;
    align-items: stretch;
  }
}

.ai-hero--visual .ai-flow-deck {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--ai-accent) 12%, var(--border-subtle));
  background: color-mix(in srgb, var(--surface-elevated, #fff) 68%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--ai-accent) 6%, transparent);
}

.ai-stats--inline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding: 0.9rem 0.85rem;
  margin: 0;
  border-radius: var(--ai-premium-radius);
  border: 1px solid color-mix(in srgb, var(--ai-accent) 12%, var(--border-subtle));
  background: color-mix(in srgb, var(--surface-elevated, #fff) 65%, transparent);
  backdrop-filter: blur(10px);
  align-content: center;
}

.ai-stats--inline .ai-stats__item strong {
  font-size: 1.2rem;
}

@media (max-width: 899px) {
  .ai-hero--visual .ai-hero__stage {
    min-height: auto;
    padding-block: 0.5rem 0.25rem;
  }

  .ai-hero__visual {
    width: min(88vw, 22rem);
  }
}

/* —— Reduced motion —— */

@media (prefers-reduced-motion: reduce) {
  .ai-flow-deck__panel.is-active {
    animation: none;
  }

  .ai-subnav__indicator {
    transition: none;
  }

  .ai-hero__visual-inner {
    animation: none;
    transform: rotateX(4deg) rotateY(-8deg);
  }

  .ai-hero__visual-glow,
  .ai-hero__visual-shine {
    animation: none;
  }
}
