/* =========================================================
   ADVANTAGE SECTION (Scoped)
   Path: homepage/advantage/advantage.css
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;600;700&family=Inter:wght@300;400;500;600&display=swap");

.advantage-section {
  --bg: #050505;
  --card-bg: #0a0a0a;
  --border: #1f1f1f;
  --text: #ffffff;
  --muted: #8a8a8a;

  --accent: #7832ff;
  --accent-glow: rgba(120, 50, 255, 0.6);

  position: relative;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: clip;
  isolation: isolate;
  z-index: 3;

  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.adv-wrap {
  padding: 8rem 5%;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* -------------------------
   Background Layers
------------------------- */
.adv-bg-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

.adv-grid-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 25%, black 25%, transparent 75%);
  opacity: 0.75;
}

.adv-floating-network {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
  transform: translate3d(0, 0, 0);
}

.adv-network-node {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--accent);
  opacity: 0.35;
}

.adv-network-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.2;
  transform-origin: left center;
}

/* Node/Line Positioning */
.adv-network-node.n1 { top: 15%; left: 10%; }
.adv-network-node.n2 { top: 25%; right: 15%; }
.adv-network-node.n3 { bottom: 30%; left: 20%; }

.adv-network-line.l1 { top: 15.5%; left: 10.5%; width: 320px; transform: rotate(25deg); }
.adv-network-line.l2 { top: 25.5%; right: 15.5%; width: 420px; transform: rotate(145deg); }

/* -------------------------
   Header (Titles)
------------------------- */
.adv-header { margin-bottom: 6rem; }
.adv-header-compact { margin-bottom: 2rem; }

.adv-eyebrow {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
  border-left: 2px solid var(--accent);
  padding-left: 15px;
}

.adv-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.9;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -2px;
  margin: 0;
  position: relative; /* Ensure z-index works */
  z-index: 10;
}

/* Cross-browser outline fallback 
   (Ensures text is visible even if browser doesn't support text-stroke)
*/
.adv-title-outline {
  color: rgba(255, 255, 255, 0.22);
  text-shadow:
    0 0 18px rgba(120, 50, 255, 0.20),
    0 0 1px rgba(255, 255, 255, 0.25);
}

@supports (-webkit-text-stroke: 1px #fff) {
  .adv-title-outline {
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.9);
    text-shadow: none;
  }
}

/* -------------------------
   Cards Grid
------------------------- */
.adv-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

.adv-card {
  background: var(--card-bg);
  position: relative;
  min-height: 400px;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-basis: calc(33.333% - 0.66px);
  overflow: hidden;
}

.adv-card-wide { flex-basis: calc(50% - 0.5px); }

/* Card Hover Effects */
.adv-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.07), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1;
}

.adv-card::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  background: radial-gradient(300px circle at var(--mouse-x) var(--mouse-y), var(--accent), transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 2;
  pointer-events: none;
}

.adv-card:hover::before,
.adv-card:hover::after { opacity: 1; }

.adv-card-content {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.adv-card-icon {
  width: max-content;
  color: var(--text);
  border: 1px solid #333;
  padding: 14px;
  border-radius: 999px;
  transition: 0.3s;
}

.adv-card:hover .adv-card-icon {
  background: #fff;
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 25px var(--accent-glow);
}

.adv-card h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  line-height: 1;
  margin: 0 0 1rem 0;
  color: #fff;
  letter-spacing: -1px;
  text-transform: uppercase;
}

.adv-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 92%;
}

.adv-card-number {
  font-family: "Space Grotesk", sans-serif;
  font-size: 4rem;
  font-weight: 700;
  color: #1a1a1a;
  position: absolute;
  bottom: 18px;
  right: 20px;
  z-index: 0;
}

/* -------------------------
   Marquee
------------------------- */
.adv-marquee {
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  padding: 2rem 0;
  background: #000;
  position: relative;
  z-index: 2;
}

.adv-marquee-inner { width: 100%; overflow: hidden; white-space: nowrap; }

.adv-marquee-track {
  display: inline-block;
  animation: adv-scroll 30s linear infinite;
  will-change: transform;
}

.adv-logo {
  display: inline-block;
  padding: 0 4rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #333;
  transition: color 0.3s, text-shadow 0.3s;
}

.adv-logo:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes adv-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* -------------------------
   Portal Section
------------------------- */
.adv-portal {
  background: #030303;
  position: relative;
  z-index: 2;
}

.adv-portal-interface {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 3rem;
  align-items: start;
}

.adv-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border: 1px solid #333;
  overflow: hidden;
  transform: perspective(1000px) rotateX(2deg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px #222 inset;
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.adv-viewport:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow), 0 0 0 2px var(--accent) inset;
  transform: perspective(1000px) rotateX(0deg) scale(1.01);
}

.adv-viewport-media { width: 100%; height: 100%; position: relative; }

.adv-viewport video,
.adv-viewport img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.2) brightness(0.8) sepia(20%);
  transition: all 0.8s ease;
  opacity: 0.85;
}

.adv-viewport img { display: none; }

.adv-viewport.is-active video,
.adv-viewport.is-active img {
  filter: grayscale(0%) contrast(1.1) brightness(1) sepia(0%);
  opacity: 1;
  transform: scale(1.02);
}

/* -------------------------
   HUD & Overlays
------------------------- */
.adv-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  mix-blend-mode: overlay;
  opacity: 0.5;
  background: repeating-linear-gradient(
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.3) 3px,
    rgba(0, 0, 0, 0.3) 4px
  );
}

.adv-frame {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.adv-frame::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-width: 2px 0 0 2px;
}

.adv-frame::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-width: 0 2px 2px 0;
}

.adv-hud {
  position: absolute;
  bottom: 28px;
  left: 28px;
  z-index: 10;
  text-transform: uppercase;
  font-family: "Space Grotesk", sans-serif;
  max-width: 70%;
}

.adv-hud-row {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: 1px;
}

.adv-hud-row strong.adv-hud-live {
  color: var(--accent);
  animation: adv-blink 2s infinite;
}

#adv-hud-title {
  color: #fff;
  font-size: 2.5rem;
  margin-top: 10px;
  line-height: 1;
  text-shadow: 0 0 10px var(--accent-glow);
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 8px;
}

.adv-audio {
  position: absolute;
  bottom: 28px;
  right: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 2px;
}

.adv-eq {
  display: inline-flex;
  gap: 3px;
  margin-left: 10px;
  height: 20px;
  align-items: flex-end;
}

.adv-eq i {
  width: 3px;
  background: var(--accent);
  display: inline-block;
  height: 20%;
  animation: adv-eq 1s infinite alternate ease-in-out;
}
.adv-eq i:nth-child(2) { animation-delay: 0.2s; height: 60%; }
.adv-eq i:nth-child(3) { animation-delay: 0.4s; height: 80%; }
.adv-eq i:nth-child(4) { animation-delay: 0.1s; height: 35%; }

/* -------------------------
   Controls
------------------------- */
.adv-controls-title {
  font-family: "Space Grotesk", sans-serif;
  color: var(--muted);
  letter-spacing: 2px;
  font-size: 1rem;
  margin: 0 0 1.5rem 0;
  border-bottom: 1px solid #222;
  padding-bottom: 10px;
  text-transform: uppercase;
}

.adv-control-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.adv-control-list li {
  padding: 15px 10px;
  border-left: 2px solid #333;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent);
  margin-bottom: 6px;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  color: #888;
  transition: all 0.3s;
}

.adv-control-list li:hover {
  color: #fff;
  padding-left: 20px;
  border-color: #fff;
}

.adv-control-list li.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: linear-gradient(90deg, rgba(120, 50, 255, 0.15), transparent);
  padding-left: 25px;
  box-shadow: -5px 0 15px -5px var(--accent);
}

/* -------------------------
   CTA Button
------------------------- */
.adv-cta {
  display: flex;
  justify-content: center;
  margin-top: 6rem;
  padding-bottom: 1rem;
}

.adv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  text-transform: uppercase;
  padding: 1.5rem 4rem;
  border: 1px solid #333;
  border-radius: 100px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
}

.adv-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 0%;
  background: #fff;
  z-index: -1;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.adv-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
  letter-spacing: 2px;
  color: #000;
}

.adv-btn:hover::before { width: 100%; }

/* -------------------------
   Animations & Responsive
------------------------- */
@keyframes adv-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes adv-eq { 0% { height: 20%; } 100% { height: 100%; } }

@media (max-width: 1024px) {
  .adv-card, .adv-card-wide { flex-basis: calc(50% - 0.5px); }
  .adv-portal-interface { grid-template-columns: 1fr; }
  #adv-hud-title { font-size: 1.8rem; }
}

@media (max-width: 768px) {
  .adv-card, .adv-card-wide { flex-basis: 100%; }
  #adv-hud-title { font-size: 1.4rem; }
}

/* -------------------------
   HARDEN AGAINST BUGS / ANIMATION FAILURES
   (Forces headings to be visible even if JS fails)
------------------------- */
.advantage-section .adv-title,
.advantage-section .adv-eyebrow,
.advantage-section .adv-card h3,
.advantage-section #adv-hud-title {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  color: #fff !important;
}

.advantage-section #adv-hud-title {
  position: relative;
  z-index: 20;
}

.adv-viewport.is-loading .adv-viewport-media {
  animation: adv-system-flush 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes adv-system-flush {
  0%   { filter: brightness(1); transform: scale(1.02); }
  20%  { filter: brightness(2) contrast(2) hue-rotate(90deg); transform: scale(1.1) skewX(5deg); }
  40%  { opacity: 0; filter: brightness(0); }
  60%  { opacity: 0; }
  100% { opacity: 1; filter: brightness(1); transform: scale(1.02); }
}