@layer base, layout, components, interactive;

@layer base {
  :root {
    --bg-color: oklch(0.1 0.02 260);
    --surface: oklch(0.15 0.02 260);
    --primary-color: oklch(0.65 0.2 260);
    --primary-glow: oklch(0.65 0.2 260 / 0.4);
    --secondary-color: oklch(0.7 0.2 300);
    --accent-color: oklch(0.8 0.15 190);
    
    --text-main: oklch(0.98 0.01 260);
    --text-muted: oklch(0.7 0.02 260);
    
    --card-bg: oklch(1 0 0 / 0.05);
    --card-border: oklch(1 0 0 / 0.1);
    
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    --radius: 1.5rem;
    --shadow-deep: 0 20px 60px -15px oklch(0 0 0 / 0.5);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  html {
    scroll-behavior: smooth;
  }

  body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
  }
  
  .noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.05;
    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)'/%3E%3C/svg%3E");
    z-index: 100;
  }
}

@layer layout {
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
  }

  section {
    padding: 8rem 0;
  }

  /* Navbar Styles */
  .navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 0;
    z-index: 1000;
    transition: var(--transition);
  }

  .navbar.scrolled {
    background: oklch(0.1 0.02 260 / 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--card-border);
  }

  .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
  }

  .logo span {
    color: var(--primary-color);
  }

  .nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
  }

  .nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
  }

  .nav-links a:hover {
    color: var(--primary-color);
  }

  .nav-cta {
    background: var(--primary-color);
    color: white !important;
    padding: 0.6rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 15px var(--primary-glow);
  }
}

@layer components {
  /* Marketplace Section */
  .marketplace-header {
    text-align: center;
    margin-bottom: 4rem;
  }

  .marketplace-header h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 1rem;
  }

  .marketplace-header h2 span {
    color: var(--primary-color);
  }

  .marketplace-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }

  .col-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    color: var(--text-main);
  }

  .market-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .market-item {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: var(--transition);
  }

  .market-item:hover {
    border-color: var(--primary-color);
    transform: translateX(10px);
    background: oklch(0.2 0.02 260);
  }

  .item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
  }

  .item-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
  }

  .item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .item-reward {
    color: var(--accent-color);
    font-weight: 700;
  }

  .item-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
  }

  .tier-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid currentColor;
  }

  .tier-master { color: #fbbf24; }
  .tier-gold { color: #d1d5db; }
  .tier-silver { color: #94a3b8; }

  /* Hero Section updates */
  .hero-btns {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
  }

  .btn {
    padding: 1.125rem 2.5rem;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
  }

  .btn.primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 8px 30px var(--primary-glow);
  }

  .btn.secondary {
    background: var(--card-bg);
    color: white;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
  }

  .btn:hover {
    transform: translateY(-4px);
  }

  /* Process Cards */
  .process-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
  }

  .process-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 3rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
  }

  .process-card::before {
    content: attr(data-step);
    position: absolute;
    top: -20px;
    right: -10px;
    font-size: 8rem;
    font-weight: 900;
    color: oklch(1 0 0 / 0.03);
    font-family: var(--font-heading);
  }

  .process-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-deep);
  }

  .card-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
  }

  .process-card h3 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }

  /* Form Section */
  .form-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
  }

  .form-info h2 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
  }

  .form-info h2 span {
    color: var(--accent-color);
  }

  .benefit-list {
    list-style: none;
    margin-top: 2rem;
  }

  .benefit-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-weight: 500;
  }

  .benefit-list span {
    color: var(--accent-color);
    font-weight: 800;
  }

  .form-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-deep);
    border: 1px solid var(--card-border);
  }

  .form-group {
    margin-bottom: 1.5rem;
  }

  label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
  }

  input, select, textarea {
    width: 100%;
    padding: 1rem;
    background: oklch(0 0 0 / 0.2);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    color: white;
    font-family: inherit;
    transition: var(--transition);
  }

  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
  }

  .submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition);
  }

  .submit-btn:hover {
    background: oklch(0.7 0.2 260);
    transform: scale(1.02);
  }

  .submit-btn svg {
    width: 20px;
    height: 20px;
  }
}

@layer interactive {
  .status-message {
    margin-top: 1.5rem;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
    text-align: center;
    border-radius: 0.75rem;
  }

  .status-message.show {
    padding: 1rem;
    max-height: 100px;
  }

  .status-message.success { background: oklch(0.4 0.15 150); }
  .status-message.error { background: oklch(0.4 0.15 20); }

  .badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-glow);
    color: var(--primary-color);
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
  }

  .section-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 4rem;
  }

  .section-header h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 968px) {
  .form-wrapper {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
  section {
    padding: 4rem 0;
  }
}
