/* ============================================
   RationalBit Hub — Design System
   ============================================ */

/* 1. Custom Properties */
:root {
  --bg-primary: #0f0f13;
  --bg-secondary: #1a1a24;
  --bg-tertiary: #242436;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --accent-purple: #8c85ff;
  --accent-teal: #2ec4b6;
  --accent-yellow: #f5c542;
  --accent-blue: #357df9;
  --accent-red: #ff6b6b;
  --accent-gradient: linear-gradient(135deg, #ff6b6b, #f5c542, #2ec4b6, #357df9, #8c85ff);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --glow: rgba(140, 133, 255, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --header-height: 72px;
}

/* 2. Reset / Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* 3. Typography */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

/* 4. Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0.75rem auto 0;
  text-align: center;
}

/* 5. Components — Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
}

.btn-primary:hover {
  background: #7a72f0;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(140, 133, 255, 0.3);
}

.btn-card {
  background: var(--card-accent, var(--accent-purple));
  color: #fff;
  width: 100%;
  justify-content: center;
  padding: 0.875rem 1.5rem;
}

.btn-card:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn svg,
.btn-card svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 6. Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: rgba(15, 15, 19, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: all var(--transition-base);
}

.header.scrolled {
  background: rgba(15, 15, 19, 0.95);
  border-bottom-color: var(--border-subtle);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  z-index: 1001;
}

.header-logo img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

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

.nav-links a {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-purple);
  border-radius: 1px;
  transition: width var(--transition-base);
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* 7. Hero */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--header-height) + 2rem) 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-logo-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
}

.hero-logo {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-xl);
  position: relative;
  z-index: 1;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: var(--accent-gradient);
  filter: blur(80px);
  opacity: 0.35;
  border-radius: var(--radius-full);
  z-index: 0;
  animation: pulseGlow 4s ease-in-out infinite alternate;
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero .tagline {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-weight: 400;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes pulseGlow {
  from { opacity: 0.25; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0.4; transform: translate(-50%, -50%) scale(1.15); }
}

/* Background grid */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, black 20%, transparent 70%);
}

/* 8. Products */
.products {
  padding: clamp(4rem, 8vw, 8rem) 0;
  text-align: center;
}

.products h2 {
  margin-bottom: 0.5rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3.5rem;
}

.product-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all var(--transition-base);
  overflow: hidden;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 60px var(--card-glow, transparent);
}

.product-card:hover::before {
  opacity: 1;
}

.card-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
}

.product-card h3 {
  margin-bottom: 0.5rem;
}

.card-tagline {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.925rem;
  margin-bottom: 1rem;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.65;
  margin-bottom: 1.5rem;
  flex: 1;
}

.card-badge {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.badge-coming-soon {
  background: rgba(53, 125, 249, 0.12);
  border-color: rgba(53, 125, 249, 0.25);
  color: var(--accent-blue);
}

.card-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.875rem;
}

.card-link-pill {
  padding: 0.35rem 0.85rem;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  transition: all var(--transition-fast);
}

.card-link-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* 9. About */
.about {
  padding: clamp(4rem, 8vw, 8rem) 0;
}

.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 4rem;
  align-items: center;
}

.about-image-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

.about-image {
  width: 260px;
  height: 260px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid transparent;
  background-origin: border-box;
  background-clip: content-box, border-box;
  background-image:
    linear-gradient(var(--bg-primary), var(--bg-primary)),
    var(--accent-gradient);
}

.about-content h2 {
  margin-bottom: 1.5rem;
}

.about-content p {
  font-size: 1.05rem;
  line-height: 1.75;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.social-link:hover {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

/* 10. Contact */
.contact {
  padding: clamp(4rem, 8vw, 8rem) 0;
  text-align: center;
  position: relative;
}

.contact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(80%, 600px);
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 1px;
}

.contact h2 {
  margin-bottom: 0.75rem;
}

.contact > .container > p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.contact-email:hover {
  border-color: var(--accent-purple);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.contact-email svg {
  width: 22px;
  height: 22px;
  color: var(--accent-purple);
}

/* 11. Footer */
.footer {
  padding: 3rem 0 2rem;
  border-top: 2px solid;
  border-image: var(--accent-gradient) 1;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.footer-logo img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

.copyright {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 12. Animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.from-left {
  transform: translateX(-30px);
}

.animate-on-scroll.from-left.visible {
  transform: translateX(0);
}

.animate-on-scroll.from-right {
  transform: translateX(30px);
}

.animate-on-scroll.from-right.visible {
  transform: translateX(0);
}

.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }

/* Hero fade-in on load */
.hero-content {
  animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 13. Subpage Styles */
.subpage-hero {
  padding: calc(var(--header-height) + 4rem) 0 3rem;
  text-align: center;
}

.subpage-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.5rem;
}

.subpage-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.925rem;
  color: var(--accent-purple);
  transition: all var(--transition-fast);
}

.back-link:hover {
  color: var(--text-primary);
  transform: translateX(-4px);
}

/* Legal / Policy Content */
.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.legal-content h2 {
  font-size: 1.5rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-content h3 {
  font-size: 1.15rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-content p {
  line-height: 1.8;
  margin-bottom: 1rem;
}

.legal-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.legal-content li {
  position: relative;
  padding-left: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.7;
  list-style: disc;
}

.legal-content a {
  color: var(--accent-purple);
  transition: color var(--transition-fast);
}

.legal-content a:hover {
  color: var(--text-primary);
}

.effective-date {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* FAQ / Support */
.faq-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
  background: var(--bg-secondary);
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.faq-question:hover {
  background: var(--bg-tertiary);
}

.faq-question .chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-base);
  color: var(--text-muted);
}

.faq-item.open .faq-question .chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.faq-answer-inner {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.faq-item.open .faq-answer {
  max-height: 500px;
}

.support-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.support-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.support-section p {
  line-height: 1.75;
  margin-bottom: 1rem;
}

.support-section h3 {
  font-size: 1.15rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.support-contact {
  text-align: center;
  padding: 3rem 1.5rem;
  margin-top: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.support-contact p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

/* 14. Media Queries */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 19, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    gap: 2.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    font-size: 1.25rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }

  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2.5rem;
  }

  .about-image {
    width: 200px;
    height: 200px;
  }

  .about-image-wrapper {
    justify-content: center;
  }

  .social-links {
    justify-content: center;
  }

  .hero-logo {
    width: 110px;
    height: 110px;
  }
}

@media (max-width: 480px) {
  .hero-logo {
    width: 90px;
    height: 90px;
  }

  .hero-glow {
    width: 200px;
    height: 200px;
  }

  .product-card {
    padding: 2rem 1.5rem 1.5rem;
  }

  .card-logo {
    width: 80px;
    height: 80px;
  }
}

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

  html {
    scroll-behavior: auto;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }

  .hero-glow {
    animation: none;
  }
}
