@layer reset, base, theme, components, utilities;

@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html {
    scroll-behavior: smooth;
    /* Smooth scrolling via CSS */
  }

  body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  img, picture, svg, video {
    display: block;
    max-width: 100%;
  }

  button, input, select, textarea {
    font: inherit;
  }
  
  a {
    text-decoration: none;
    color: inherit;
  }
}

@layer theme {
  :root {
    color-scheme: dark light;
    
    /* Design Tokens */
    --color-bg: #09090b;
    --color-surface: #121214;
    --color-primary: #00e5ff; /* Cyan accent */
    --color-primary-glow: rgba(0, 229, 255, 0.4);
    --color-secondary: #0066ff;
    --color-text: #ffffff;
    --color-text-muted: #a1a1aa;
    --color-border: rgba(255, 255, 255, 0.1);
    
    --glass-bg: rgba(25, 25, 30, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', var(--font-sans);
    
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;
    --space-2xl: 8rem;
    
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.38vw, 1rem);
    --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.63vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
    --text-4xl: clamp(2.5rem, 1.8rem + 3.5vw, 4.5rem);
  }
}

@layer base {
  body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    line-height: 1.2;
    text-wrap: balance;
  }
  
  p {
    text-wrap: pretty;
  }

  .container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-lg);
  }
}

@layer components {
  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: var(--text-sm);
    border: 1px solid transparent;
  }

  .btn-primary {
    background: var(--color-primary);
    color: #000;
    box-shadow: 0 0 20px var(--color-primary-glow);
  }
  
  .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--color-primary-glow);
    background: #4dffff;
  }

  .btn-outline {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
  }

  .btn-outline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .btn-large {
    padding: 1rem 2rem;
    font-size: var(--text-base);
  }

  /* Glassmorphism */
  .glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
  }
  
  .glass-card {
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.6), rgba(15, 15, 18, 0.8));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  }

  /* Navbar */
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
  }

  .nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem var(--space-lg);
    max-width: 1400px;
    margin-inline: auto;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--text-lg);
    letter-spacing: -0.5px;
  }

  .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: #000;
    border-radius: var(--radius-md);
    box-shadow: 0 0 15px var(--color-primary-glow);
  }

  .nav-links {
    display: none;
    gap: 2rem;
    font-weight: 500;
    font-size: var(--text-sm);
  }
  
  .nav-links a {
    color: var(--color-text-muted);
    transition: color 0.2s;
  }
  
  .nav-links a:hover {
    color: var(--color-text);
  }

  .nav-actions {
    display: none;
    gap: 1rem;
  }

  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .mobile-menu-btn span {
    width: 100%;
    height: 2px;
    background-color: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s;
  }

  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 90;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-menu.active {
    opacity: 1;
    pointer-events: all;
  }

  .mobile-menu nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
    font-size: var(--text-2xl);
    font-family: var(--font-display);
    font-weight: 700;
  }

  @media (min-width: 768px) {
    .mobile-menu-btn { display: none; }
    .nav-links { display: flex; }
    .nav-actions { display: flex; }
  }

  /* Hero Parallax Section */
  .hero-wrapper {
    position: relative;
    height: 100svh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: clip; /* Required for view-timeline container bounds */
    view-timeline: --hero-scroll;
  }

  .parallax-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  /* Background Grid */
  .layer-bg {
    background-image: 
      linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black, transparent 80%);
    z-index: 0;
  }

  /* Decorative shapes */
  .layer-shapes {
    z-index: 1;
    pointer-events: none;
    /* CSS Native Scroll Animation */
    animation: parallax-shapes linear both;
    animation-timeline: --hero-scroll;
    animation-range: entry 0% exit 100%;
  }

  @keyframes parallax-shapes {
    from { transform: translateY(0); }
    to { transform: translateY(-300px); }
  }

  .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
  }

  .shape-1 {
    width: 40vw;
    height: 40vw;
    background: var(--color-primary);
    top: -10vw;
    right: -10vw;
  }

  .shape-2 {
    width: 30vw;
    height: 30vw;
    background: var(--color-secondary);
    bottom: -10vw;
    left: -5vw;
  }

  /* Hero Content */
  .layer-content {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-lg);
    /* CSS Native Scroll Animation */
    animation: parallax-content linear both;
    animation-timeline: --hero-scroll;
    animation-range: exit 0% exit 100%;
  }

  @keyframes parallax-content {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(150px); opacity: 0; }
  }

  .hero-content {
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }

  .badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-primary);
    border: 1px solid var(--color-primary-glow);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-md);
  }

  .hero-title {
    font-size: var(--text-4xl);
    letter-spacing: -1px;
  }

  .hero-title span {
    color: var(--color-primary);
    text-shadow: 0 0 30px var(--color-primary-glow);
  }

  .hero-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 600px;
  }

  .hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: var(--space-lg);
  }

  /* Features Section */
  .features-section {
    padding-block: var(--space-2xl);
    position: relative;
    z-index: 20;
    background: var(--color-bg);
  }

  .section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
  }

  .section-header h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-sm);
  }

  .section-header p {
    color: var(--color-text-muted);
    font-size: var(--text-lg);
  }

  .features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
  }

  .feature-card {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .hover-lift:hover {
    transform: translateY(-10px);
  }

  .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(0, 229, 255, 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-primary-glow);
  }

  /* Info Section */
  .info-section {
    padding-block: var(--space-xl);
    background: linear-gradient(to bottom, var(--color-bg), var(--color-surface));
  }

  .info-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    align-items: center;
  }

  @media (min-width: 992px) {
    .info-container {
      grid-template-columns: 1fr 1fr;
    }
  }

  .info-text h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-md);
  }

  .info-text p {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin-bottom: var(--space-md);
  }

  .check-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .check-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .check-list li::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e5ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
  }

  /* Mock UI */
  .info-visual {
    padding: var(--space-lg);
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
  }

  .mock-header {
    font-size: var(--text-sm);
    font-weight: 700;
    color: #ff4d4d;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1rem;
  }

  .mock-line {
    height: 12px;
    background: var(--color-border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    width: 100%;
  }
  
  .mock-line.short {
    width: 60%;
  }

  .pulse-red {
    background: #ff4d4d;
    animation: pulse 2s infinite;
  }

  @keyframes pulse {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.4); }
    70% { opacity: 0.5; box-shadow: 0 0 0 10px rgba(255, 77, 77, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
  }

  /* CTA Section */
  .cta-section {
    position: relative;
    padding-block: var(--space-2xl);
    overflow: clip;
    text-align: center;
    view-timeline: --cta-scroll;
  }

  .layer-cta {
    position: absolute;
    inset: 0;
    background: var(--color-secondary);
    opacity: 0.2;
    filter: blur(100px);
    z-index: 0;
    /* CTA background parallax */
    animation: parallax-cta linear both;
    animation-timeline: --cta-scroll;
    animation-range: entry 0% exit 100%;
  }
  
  @keyframes parallax-cta {
    from { transform: translateY(100px) scale(0.8); }
    to { transform: translateY(-100px) scale(1.2); }
  }

  .cta-content {
    position: relative;
    z-index: 10;
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }

  .cta-content h2 {
    font-size: var(--text-3xl);
  }

  .cta-content p {
    color: var(--color-text-muted);
    font-size: var(--text-lg);
    max-width: 600px;
    margin-bottom: var(--space-sm);
  }

  /* Footer */
  .footer {
    background: var(--color-surface);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-border);
  }

  .footer-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    padding-bottom: var(--space-xl);
  }

  @media (min-width: 768px) {
    .footer-container {
      grid-template-columns: 2fr 3fr;
    }
  }

  .footer-brand p {
    color: var(--color-text-muted);
    margin-top: 1rem;
    font-size: var(--text-sm);
  }

  .footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-lg);
  }

  .link-column h4 {
    font-size: var(--text-base);
    margin-bottom: 1rem;
    color: var(--color-text);
  }

  .link-column a {
    display: block;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    font-size: var(--text-sm);
    transition: color 0.2s;
  }

  .link-column a:hover {
    color: var(--color-primary);
  }

  .footer-bottom {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .layer-shapes, .layer-content, .layer-cta {
    animation: none !important;
    transform: none !important;
  }
}
