/* METALINK VISION — AI CRM Operating System */

.crm-os {
  position: relative;
  width: 100%;
  padding: 100px 0 120px;
  background: #071124;
  background-color: #071124;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}

/* Prevent global section scroll glow from washing out this dark block */
.crm-os.section--scroll::before {
  display: none;
}

.crm-os__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background: transparent !important;
}

.crm-os__beams {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(79, 70, 229, 0.18), transparent),
    radial-gradient(ellipse 50% 30% at 80% 60%, rgba(6, 182, 212, 0.1), transparent),
    radial-gradient(ellipse 40% 25% at 15% 70%, rgba(139, 92, 246, 0.12), transparent);
  pointer-events: none;
  z-index: 1;
}

.crm-os__shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.crm-os__shape {
  position: absolute;
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 12px;
  opacity: 0.25;
  animation: crmOsFloat 12s ease-in-out infinite;
}

.crm-os__shape--1 { width: 80px; height: 80px; top: 12%; left: 8%; transform: rotate(15deg); }
.crm-os__shape--2 { width: 50px; height: 50px; top: 70%; right: 10%; animation-delay: -4s; border-radius: 50%; }
.crm-os__shape--3 { width: 60px; height: 60px; bottom: 15%; left: 20%; animation-delay: -8s; }

@keyframes crmOsFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(8deg); }
}

.crm-os__header {
  position: relative;
  z-index: 3;
  text-align: center;
  margin-bottom: 48px;
}

.crm-os__header .section__badge {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, 0.35);
}

.crm-os__header .section__title {
  color: #fff;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.crm-os__header .section__subtitle {
  color: rgba(255, 255, 255, 0.6);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.crm-os__header .gradient-text {
  background: linear-gradient(135deg, #a5b4fc 0%, #67e8f9 50%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.crm-os__viewport {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.crm-os__stage {
  position: relative;
  min-height: 680px;
  margin: 0 auto;
  border-radius: 24px;
  background:
    radial-gradient(ellipse 75% 65% at 50% 42%, rgba(30, 41, 82, 0.55) 0%, transparent 68%),
    linear-gradient(180deg, rgba(7, 17, 36, 0.98) 0%, rgba(10, 20, 42, 0.99) 50%, rgba(7, 17, 36, 0.98) 100%);
  border: 1px solid rgba(79, 70, 229, 0.22);
  box-shadow:
    inset 0 0 80px rgba(79, 70, 229, 0.08),
    0 24px 64px rgba(0, 0, 0, 0.35);
}

.crm-os__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.crm-os__line {
  fill: none;
  stroke: url(#crmOsLineGrad);
  stroke-width: 2.5;
  stroke-dasharray: 10 8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(6, 182, 212, 0.65));
  opacity: 0;
}

.crm-os__line.is-drawn {
  opacity: 0.85;
  animation: crmOsLinePulse 1.8s ease-in-out infinite;
}

@keyframes crmOsLinePulse {
  0%, 100% { opacity: 0.6; stroke-dashoffset: 0; }
  50% { opacity: 1; stroke-dashoffset: -36; }
}

.crm-os__packet {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #06B6D4;
  box-shadow: 0 0 12px #06B6D4;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}

/* Core Engine */
.crm-os__core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  text-align: center;
  width: 220px;
}

.crm-os__core-ring {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  border: 1px solid rgba(79, 70, 229, 0.3);
  animation: crmOsCoreSpin 20s linear infinite;
}

.crm-os__core-ring::before {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  border: 1px dashed rgba(6, 182, 212, 0.25);
  animation: crmOsCoreSpin 30s linear infinite reverse;
}

@keyframes crmOsCoreSpin {
  to { transform: rotate(360deg); }
}

.crm-os__core-inner {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(49, 46, 129, 0.95), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(129, 140, 248, 0.45);
  box-shadow:
    0 0 60px rgba(79, 70, 229, 0.5),
    0 0 120px rgba(6, 182, 212, 0.2),
    inset 0 0 30px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  animation: crmOsBreathe 4s ease-in-out infinite;
}

.crm-os__core-inner i {
  font-size: 2rem;
  background: linear-gradient(135deg, #818cf8, #06B6D4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.crm-os__core-inner > span {
  display: none;
}

.crm-os__core-inner .brand-logo__mark--core {
  width: 60px;
  margin-bottom: 4px;
}

.crm-os__core-inner > small {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@keyframes crmOsBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(79, 70, 229, 0.5); }
  50% { transform: scale(1.04); box-shadow: 0 0 80px rgba(79, 70, 229, 0.7); }
}

.crm-os__core-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.crm-os__core-stats > div {
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(129, 140, 248, 0.28);
  border-radius: 12px;
  min-width: 90px;
}

.crm-os__core-stats em {
  display: block;
  font-style: normal;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  color: #06B6D4;
  font-variant-numeric: tabular-nums;
}

.crm-os__core-stats span {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
}

/* Feature modules */
.crm-os__module {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 148px;
  padding: 14px 12px;
  text-align: center;
  background: linear-gradient(145deg, rgba(17, 24, 48, 0.96), rgba(10, 16, 34, 0.94));
  border: 1px solid rgba(129, 140, 248, 0.32);
  border-radius: 16px;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 6;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
  --orbit-r: min(38vw, 300px);
  transform: translate(-50%, -50%)
    rotate(var(--angle, 0deg))
    translateY(calc(-1 * var(--orbit-r)))
    rotate(calc(-1 * var(--angle, 0deg)))
    scale(0.8);
}

.crm-os__module.is-in {
  opacity: 1;
  transform: translate(-50%, -50%)
    rotate(var(--angle))
    translateY(calc(-1 * var(--orbit-r)))
    rotate(calc(-1 * var(--angle)))
    scale(1);
}

.crm-os.is-live .crm-os__module {
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}

.crm-os__module.is-active {
  border-color: rgba(79, 70, 229, 0.6);
  box-shadow: 0 0 30px rgba(79, 70, 229, 0.35), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.crm-os__module-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), transparent 50%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.crm-os__module.is-active .crm-os__module-glow {
  opacity: 1;
}

.crm-os__module-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.5), rgba(139, 92, 246, 0.3));
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.crm-os__module h4 {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.35;
  color: #f1f5f9;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.crm-os__module-pulse {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 8px #22C55E;
  animation: crmOsPulse 2s ease-in-out infinite;
}

.crm-os__module.is-active .crm-os__module-pulse {
  animation: crmOsPulseFast 0.8s ease-in-out infinite;
}

@keyframes crmOsPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

@keyframes crmOsPulseFast {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

/* Live feed */
.crm-os__feed {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 92%);
  background: rgba(12, 20, 40, 0.92);
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: 16px;
  padding: 14px 16px;
  z-index: 8;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.crm-os__feed-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #22C55E;
  margin-bottom: 10px;
}

.crm-os__feed-header i {
  animation: crmOsPulse 1.5s ease-in-out infinite;
}

.crm-os__feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 72px;
  overflow: hidden;
}

.crm-os__feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  animation: crmOsFeedIn 0.5s ease forwards;
}

.crm-os__feed-item i {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(79, 70, 229, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: #a5b4fc;
  flex-shrink: 0;
}

.crm-os__feed-item time {
  margin-left: auto;
  font-size: 0.5625rem;
  color: rgba(255, 255, 255, 0.35);
}

@keyframes crmOsFeedIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* AI Assistant insight */
.crm-os__assistant {
  position: absolute;
  top: 8%;
  right: 4%;
  max-width: 220px;
  padding: 14px 16px;
  background: rgba(30, 20, 55, 0.92);
  border: 1px solid rgba(167, 139, 250, 0.45);
  border-radius: 14px;
  z-index: 7;
  opacity: 0;
  transform: translateY(10px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
}

.crm-os.is-live .crm-os__assistant {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease 1.2s, transform 0.6s ease 1.2s;
}

.crm-os__assistant i {
  color: #c4b5fd;
  margin-bottom: 6px;
  font-size: 1.125rem;
}

.crm-os__assistant p {
  font-size: 0.6875rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.crm-os__assistant.is-updating p {
  animation: crmOsInsightFlash 0.4s ease;
}

@keyframes crmOsInsightFlash {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Mini revenue chart in core area */
.crm-os__chart {
  position: absolute;
  left: 4%;
  bottom: 12%;
  width: 140px;
  z-index: 7;
  opacity: 0;
}

.crm-os.is-live .crm-os__chart {
  opacity: 1;
  transition: opacity 0.8s ease 0.8s;
}

.crm-os__chart svg {
  width: 100%;
  height: auto;
}

.crm-os__chart-path {
  fill: none;
  stroke: url(#crmOsChartGrad);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}

.crm-os.is-live .crm-os__chart-path {
  animation: crmOsChartDraw 2s ease forwards 1s;
}

@keyframes crmOsChartDraw {
  to { stroke-dashoffset: 0; }
}

@media (max-width: 900px) {
  .crm-os__stage { min-height: 580px; }
  .crm-os__module {
    width: 120px;
    padding: 10px 8px;
    --orbit-r: min(42vw, 220px);
  }
  .crm-os__module h4 { font-size: 0.5625rem; }
  .crm-os__assistant { top: 4%; right: 2%; max-width: 160px; }
  .crm-os__chart { display: none; }
}

@media (max-width: 640px) {
  .crm-os { padding: 72px 0 100px; }
  .crm-os__stage { min-height: 520px; }
  .crm-os__module { width: 100px; --orbit-r: min(44vw, 180px); }
  .crm-os__module-icon { width: 32px; height: 32px; font-size: 0.75rem; }
  .crm-os__core { width: 180px; }
  .crm-os__core-inner { width: 110px; height: 110px; }
  .crm-os__feed { width: 96%; }
}

@media (prefers-reduced-motion: reduce) {
  .crm-os__module,
  .crm-os__core-inner,
  .crm-os__core-ring,
  .crm-os__shape,
  .crm-os__line,
  .crm-os__module-pulse {
    animation: none !important;
  }
  .crm-os__module { opacity: 1; }
  .crm-os.is-live .crm-os__module { transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(-1 * var(--orbit-r))) rotate(calc(-1 * var(--angle))) scale(1); }
}
