/* Perplexity Design System */
:root {
    /* Primitive Color Tokens */
    --color-white: rgba(255, 255, 255, 1);
    --color-black: rgba(0, 0, 0, 1);
    --color-cream-50: rgba(252, 252, 249, 1);
    --color-cream-100: rgba(255, 255, 253, 1);
    --color-gray-200: rgba(245, 245, 245, 1);
    --color-gray-300: rgba(167, 169, 169, 1);
    --color-gray-400: rgba(119, 124, 124, 1);
    --color-slate-500: rgba(98, 108, 113, 1);
    --color-brown-600: rgba(94, 82, 64, 1);
    --color-charcoal-700: rgba(31, 33, 33, 1);
    --color-charcoal-800: rgba(38, 40, 40, 1);
    --color-slate-900: rgba(19, 52, 59, 1);
    --color-teal-300: rgba(50, 184, 198, 1);
    --color-teal-400: rgba(45, 166, 178, 1);
    --color-teal-500: rgba(33, 128, 141, 1);
    --color-teal-600: rgba(29, 116, 128, 1);
    --color-teal-700: rgba(26, 104, 115, 1);
    --color-teal-800: rgba(41, 150, 161, 1);
    --color-red-400: rgba(255, 84, 89, 1);
    --color-red-500: rgba(192, 21, 47, 1);
    --color-orange-400: rgba(230, 129, 97, 1);
    --color-orange-500: rgba(168, 75, 47, 1);

    /* TestAstra Custom Colors */
    --color-primary-blue: #1E3A8A;
    --color-accent-blue: #3B82F6;
    --color-primary-purple: #7C3AED;
    --color-accent-purple: #A855F7;
    --color-gunmetal: #374151;
    --color-neon-cyan: #00D9FF;
    --color-neon-pink: #FF6B9D;

    /* RGB versions for opacity control */
    --color-brown-600-rgb: 94, 82, 64;
    --color-teal-500-rgb: 33, 128, 141;
    --color-slate-900-rgb: 19, 52, 59;
    --color-slate-500-rgb: 98, 108, 113;
    --color-red-500-rgb: 192, 21, 47;
    --color-red-400-rgb: 255, 84, 89;
    --color-orange-500-rgb: 168, 75, 47;
    --color-orange-400-rgb: 230, 129, 97;

    /* Background color tokens (Light Mode) */
    --color-bg-1: rgba(59, 130, 246, 0.08);
    --color-bg-2: rgba(245, 158, 11, 0.08);
    --color-bg-3: rgba(34, 197, 94, 0.08);
    --color-bg-4: rgba(239, 68, 68, 0.08);
    --color-bg-5: rgba(147, 51, 234, 0.08);
    --color-bg-6: rgba(249, 115, 22, 0.08);
    --color-bg-7: rgba(236, 72, 153, 0.08);
    --color-bg-8: rgba(6, 182, 212, 0.08);

    /* Semantic Color Tokens (Dark Mode for TestAstra) */
    --color-background: #0a0a0f;
    --color-surface: #1a1a2e;
    --color-text: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.7);
    --color-primary: var(--color-neon-cyan);
    --color-primary-hover: var(--color-accent-blue);
    --color-primary-active: var(--color-primary-blue);
    --color-secondary: rgba(255, 255, 255, 0.1);
    --color-secondary-hover: rgba(255, 255, 255, 0.2);
    --color-secondary-active: rgba(255, 255, 255, 0.3);
    --color-border: rgba(255, 255, 255, 0.2);
    --color-btn-primary-text: #000000;
    --color-card-border: rgba(255, 255, 255, 0.1);
    --color-card-border-inner: rgba(255, 255, 255, 0.1);
    --color-error: var(--color-red-400);
    --color-success: var(--color-neon-cyan);
    --color-warning: var(--color-orange-400);
    --color-info: var(--color-gray-300);
    --color-focus-ring: rgba(0, 217, 255, 0.4);

    /* Typography */
    --font-family-base: "Orbitron", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 20px;
    --font-size-3xl: 24px;
    --font-size-4xl: 30px;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 550;
    --font-weight-bold: 600;
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --letter-spacing-tight: -0.01em;

    /* Spacing */
    --space-0: 0;
    --space-1: 1px;
    --space-2: 2px;
    --space-4: 4px;
    --space-6: 6px;
    --space-8: 8px;
    --space-10: 10px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
    --space-48: 48px;
    --space-64: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-base: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.03);

    /* Animation */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background: var(--color-background);
    color: var(--color-text);
    overflow-x: hidden;
    line-height: var(--line-height-normal);
}

/* Back button */
.back-button {
    position: fixed;
    top: var(--space-32);
    left: var(--space-32);
    color: var(--color-text);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    padding: var(--space-12) var(--space-24);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

/* Page transitions */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        var(--color-background), 
        var(--color-primary-blue), 
        var(--color-primary-purple)
    );
    transform: translateX(100%);
    z-index: 1000;
    pointer-events: none;
}

/* Canvas container */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(45deg, 
        var(--color-background), 
        var(--color-primary-blue), 
        var(--color-primary-purple)
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Glitch text effect */
.glitch {
    position: relative;
    color: var(--color-text);
    font-size: clamp(2rem, 8vw, 5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px var(--color-neon-cyan);
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite linear alternate-reverse;
    color: var(--color-neon-cyan);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite linear alternate-reverse;
    color: var(--color-neon-pink);
    z-index: -2;
}

@keyframes glitch-1 {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-2 {
    0% { transform: translate(0); }
    20% { transform: translate(2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-2px, 2px); }
    80% { transform: translate(-2px, -2px); }
    100% { transform: translate(0); }
}



/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-32);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-32);
    margin-bottom: var(--space-20);
    flex-wrap: wrap;
}

.footer-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--color-neon-cyan);
    text-shadow: 0 0 10px var(--color-neon-cyan);
}

.footer-copyright {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .back-button,
    .theme-toggle {
        top: var(--space-16);
        padding: var(--space-8) var(--space-16);
    }

    .back-button {
        left: var(--space-16);
    }

    .theme-toggle {
        right: var(--space-16);
    }
}
  /* ============ WRAPPER ============ */
  .ta-hero-visual{
    position:relative;
    width:min(92vw, 640px);
    aspect-ratio:1/1;
    overflow:visible;
  }

  /* ============ BACKGROUND LAYERS ============ */
  .ta-bg{
    position:absolute;
    inset:-20%;
    z-index:0;
    pointer-events:none;
  }
  .ta-bg-grid{
    position:absolute;
    inset:0;
    background-image:
      linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size:48px 48px;
    -webkit-mask-image:radial-gradient(circle at 50% 50%, black 0%, transparent 70%);
    mask-image:radial-gradient(circle at 50% 50%, black 0%, transparent 70%);
  }
  .ta-bg-dots{
    position:absolute;
    inset:0;
    background-image:radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size:22px 22px;
    -webkit-mask-image:radial-gradient(circle at 50% 50%, black 0%, transparent 65%);
    mask-image:radial-gradient(circle at 50% 50%, black 0%, transparent 65%);
  }
  .ta-blur-circle{
    position:absolute;
    border-radius:50%;
    filter:blur(60px);
    opacity:0.35;
  }
  .ta-blur-1{
    width:38%; height:38%;
    top:8%; left:2%;
    background:radial-gradient(circle, var(--blue), transparent 70%);
  }
  .ta-blur-2{
    width:34%; height:34%;
    bottom:6%; right:4%;
    background:radial-gradient(circle, var(--violet), transparent 70%);
  }
  .ta-star{
    position:absolute;
    width:2px; height:2px;
    background:#fff;
    border-radius:50%;
    opacity:0.4;
  }

  /* ============ FLOATING PARTICLES ============ */
  .ta-particle-field{
    position:absolute;
    inset:0;
    z-index:1;
    pointer-events:none;
  }
  .ta-particle{
    position:absolute;
    width:3px; height:3px;
    border-radius:50%;
    background:var(--cyan);
    box-shadow:0 0 6px 1px currentColor;
    animation:ta-drift linear infinite;
  }
  @keyframes ta-drift{
    0%{   transform:translate3d(0,0,0);   }
    25%{  transform:translate3d(6px,-8px,0); }
    50%{  transform:translate3d(-4px,-14px,0); }
    75%{  transform:translate3d(-8px,-4px,0); }
    100%{ transform:translate3d(0,0,0);   }
  }

  /* ============ STAGE (parallax root) ============ */
  .ta-stage{
    position:absolute;
    inset:0;
    z-index:2;
  }
  .ta-layer{
    position:absolute;
    inset:0;
    transition:transform 0.6s cubic-bezier(.2,.6,.2,1);
    will-change:transform;
  }

  /* ============ CONNECTIONS ============ */
  .ta-connections{ z-index:3; }
  .ta-link{
    position:absolute;
    top:50%; left:50%;
    height:1px;
    transform-origin:0 50%;
    background:linear-gradient(90deg, rgba(59,130,246,0.55), rgba(6,182,212,0.05));
    opacity:0.55;
    animation:ta-link-pulse 5s ease-in-out infinite;
  }
  @keyframes ta-link-pulse{
    0%,100%{ opacity:0.35; }
    50%{ opacity:0.7; }
  }
  .ta-particle-travel{
    position:absolute;
    top:-2px; left:0;
    width:4px; height:4px;
    border-radius:50%;
    background:#8FD9FF;
    box-shadow:0 0 8px 2px rgba(143,217,255,0.8);
    animation:ta-travel 3.6s linear infinite;
    opacity:0;
  }
  @keyframes ta-travel{
    0%{  opacity:0; transform:translateX(6%); }
    8%{  opacity:0.9; }
    92%{ opacity:0.6; }
    100%{opacity:0; transform:translateX(96%); }
  }

  /* ============ RINGS ============ */
  .ta-rings{ z-index:4; }
  .ta-ring{
    position:absolute;
    top:50%; left:50%;
    border-radius:50%;
    border:1px solid rgba(255,255,255,0.10);
    transform:translate(-50%,-50%);
  }
  .ta-ring-1{ width:44%; height:44%; animation:ta-spin-cw 60s linear infinite; }
  .ta-ring-2{ width:56%; height:56%; animation:ta-spin-ccw 80s linear infinite; border-style:dashed; }
  .ta-ring-3{ width:68%; height:68%; animation:ta-spin-cw 140s linear infinite; }
  @keyframes ta-spin-cw{ from{transform:translate(-50%,-50%) rotate(0deg);} to{transform:translate(-50%,-50%) rotate(360deg);} }
  @keyframes ta-spin-ccw{ from{transform:translate(-50%,-50%) rotate(0deg);} to{transform:translate(-50%,-50%) rotate(-360deg);} }

  .ta-ring-pulse{
    position:absolute;
    top:50%; left:50%;
    width:20%; height:20%;
    border-radius:50%;
    border:1px solid rgba(6,182,212,0.5);
    transform:translate(-50%,-50%) scale(1);
    opacity:0;
    animation:ta-ring-expand 7s ease-out infinite;
  }
  @keyframes ta-ring-expand{
    0%{  opacity:0; transform:translate(-50%,-50%) scale(1); }
    10%{ opacity:0.5; }
    75%{ opacity:0; transform:translate(-50%,-50%) scale(3.4); }
    100%{opacity:0; transform:translate(-50%,-50%) scale(3.4); }
  }

  /* ============ CORE ============ */
  .ta-core-wrap{ z-index:5; }
  .ta-core{
    position:absolute;
    top:50%; left:50%;
    width:31%; height:31%;
    min-width:120px; min-height:120px;
    transform:translate(-50%,-50%);
    border-radius:50%;
    background:
      radial-gradient(circle at 35% 30%, rgba(255,255,255,0.10), transparent 55%),
      radial-gradient(circle at 50% 50%, rgba(6,182,212,0.20), rgba(139,92,246,0.16) 60%, rgba(5,7,10,0.4) 100%);
    backdrop-filter:blur(20px);
    -webkit-backdrop-filter:blur(20px);
    border:1px solid var(--border);
    box-shadow:
      0 0 40px 6px rgba(6,182,212,0.25),
      0 0 90px 20px rgba(139,92,246,0.18),
      inset 0 1px 1px rgba(255,255,255,0.15);
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    animation:ta-breathe 6s ease-in-out infinite;
  }
  @keyframes ta-breathe{
    0%,100%{ transform:translate(-50%,-50%) scale(1);
      box-shadow:0 0 40px 6px rgba(6,182,212,0.22), 0 0 90px 20px rgba(139,92,246,0.15), inset 0 1px 1px rgba(255,255,255,0.15); }
    50%{ transform:translate(-50%,-50%) scale(1.03);
      box-shadow:0 0 56px 10px rgba(6,182,212,0.34), 0 0 110px 26px rgba(139,92,246,0.24), inset 0 1px 1px rgba(255,255,255,0.2); }
  }
  .ta-core-inner{ padding:8px; }
  .ta-core-title{
    font-size:clamp(14px, 2.6vw, 19px);
    font-weight:600;
    letter-spacing:0.06em;
    color:#fff;
  }
  .ta-core-sub{
    margin-top:4px;
    font-size:clamp(8px, 1.2vw, 10px);
    letter-spacing:0.03em;
    color:rgba(255,255,255,0.55);
  }
  .ta-core-pulse{
    position:absolute;
    top:50%; left:50%;
    width:31%; height:31%;
    min-width:120px; min-height:120px;
    border-radius:50%;
    transform:translate(-50%,-50%) scale(1);
    border:1px solid rgba(6,182,212,0.45);
    opacity:0;
    animation:ta-core-expand 5s ease-out infinite;
  }
  @keyframes ta-core-expand{
    0%{opacity:0; transform:translate(-50%,-50%) scale(1);}
    12%{opacity:0.55;}
    80%{opacity:0; transform:translate(-50%,-50%) scale(2.2);}
    100%{opacity:0; transform:translate(-50%,-50%) scale(2.2);}
  }

  /* ============ MODULES ============ */
  .ta-modules{ z-index:6; }
  .ta-module{
    position:absolute;
    transform:translate(-50%,-50%);
    width:20%;
    min-width:84px;
    aspect-ratio:1/1;
    border-radius:50%;
    background:var(--glass);
    backdrop-filter:blur(20px);
    -webkit-backdrop-filter:blur(20px);
    border:1px solid var(--border);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
    padding:6px;
  }
  .ta-module-name{
    font-size:clamp(10px, 1.6vw, 12.5px);
    font-weight:600;
    color:#fff;
    letter-spacing:0.01em;
  }
  .ta-module-status{
    margin-top:5px;
    display:flex;
    align-items:center;
    gap:5px;
    font-size:clamp(8px, 1.1vw, 9.5px);
    color:rgba(255,255,255,0.55);
  }
  .ta-dot{
    width:6px; height:6px;
    border-radius:50%;
    flex:none;
  }

  .ta-mod-capture{ top:50%; left:8%; box-shadow:0 0 26px 2px rgba(59,130,246,0.16); }
  .ta-mod-capture .ta-dot{ background:var(--blue); box-shadow:0 0 6px 2px rgba(59,130,246,0.7); animation:ta-dot-pulse 2s ease-in-out infinite; }

  .ta-mod-apiforge{ top:50%; left:92%; box-shadow:0 0 26px 2px rgba(139,92,246,0.16); animation:ta-orbit 18s ease-in-out infinite; }
  .ta-mod-apiforge .ta-dot{ background:var(--violet); }

  .ta-mod-genesis{ top:8%; left:50%; box-shadow:0 0 26px 2px rgba(6,182,212,0.16); }
  .ta-mod-genesis::after{
    content:"";
    position:absolute; inset:-1px;
    border-radius:50%;
    border:1px solid rgba(6,182,212,0.5);
    opacity:0;
    animation:ta-shimmer 4s ease-in-out infinite;
  }
  .ta-mod-genesis .ta-dot{ background:var(--cyan); }

  @keyframes ta-dot-pulse{
    0%,100%{ box-shadow:0 0 6px 2px rgba(59,130,246,0.7); }
    50%{ box-shadow:0 0 12px 5px rgba(59,130,246,0.95); }
  }
  @keyframes ta-orbit{
    0%,100%{ transform:translate(-50%,-50%) translateY(0px); }
    50%{ transform:translate(-50%,-50%) translateY(-10px); }
  }
  @keyframes ta-shimmer{
    0%,100%{ opacity:0; }
    50%{ opacity:0.8; }
  }

  /* ============ RESPONSIVE ============ */
  @media (max-width:768px){
    .ta-hero-visual{ width:min(94vw, 420px); }
  }

  /* ============ MOBILE OPTIMIZATIONS ============ */
  :root{
    --sat: env(safe-area-inset-top, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
  }

  body{
    overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
    min-height:100vh;
    min-height:100dvh;
    padding-top:var(--sat);
    padding-bottom:var(--sab);
    padding-left:var(--sal);
    padding-right:var(--sar);
  }

  @media (min-width:1025px){
    body{
      padding-top:0;
      padding-bottom:0;
      padding-left:0;
      padding-right:0;
    }
  }

  button, a.btn, [role="button"], .ta-module, .back-button, .install-button{
    min-height:44px;
    min-width:44px;
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
  }

  @media (hover:none) and (pointer:coarse){
    button:hover, a.btn:hover, .ta-module:hover, .install-button:hover{
      transform:none !important;
      filter:none !important;
      box-shadow:none !important;
    }
    button:active, a.btn:active, .ta-module:active, .install-button:active{
      transform:scale(0.96);
      transition:transform 0.1s;
    }
  }

  @media (prefers-reduced-motion:reduce){
    *, *::before, *::after{
      animation-duration:0.01ms !important;
      animation-iteration-count:1 !important;
      transition-duration:0.01ms !important;
    }
  }

  @media (max-width:768px){
    .back-button{
      top:calc(16px + var(--sat));
      font-size:0.85rem;
    }
    .footer-links{
      gap:16px;
    }
  }

  @media (max-width:480px){
    .glitch{
      font-size:clamp(1.5rem, 10vw, 2.5rem);
    }
    .back-button{
      top:calc(12px + var(--sat));
      left:12px;
      padding:8px 16px;
    }
  }