/* ============================================================
   RapiDesq — Design System & Styles
   ============================================================ */

/* --- CSS Variables / Design Tokens --- */
:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1D4ED8;
  --color-primary-light: #DBEAFE;
  --color-secondary: #0F172A;
  --color-text: #334155;
  --color-text-light: #64748B;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F8FAFC;
  --color-border: #E2E8F0;
  --color-success: #059669;
  --color-accent: #7C3AED;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  --max-width: 1200px;
  --header-height: 64px;
  --sidebar-width: 260px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-secondary);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: 2.75rem; font-weight: 800; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p + p {
  margin-top: 1rem;
}

/* --- Utility --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-dark {
  background: var(--color-secondary);
  color: #CBD5E1;
}

.section-dark h2,
.section-dark h3 {
  color: #F1F5F9;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--color-text-light);
}

.section-heading {
  margin-bottom: 1rem;
}

.section-subheading {
  color: var(--color-text-light);
  font-size: 1.125rem;
  max-width: 640px;
  margin: 0 auto 3rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-coming-soon {
  background: #94A3B8;
  color: #fff;
  cursor: default;
  pointer-events: none;
  opacity: 0.85;
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: 1.125rem;
}

/* --- Site Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-logo img,
.header-logo svg {
  height: 32px;
  width: auto;
}

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

.header-nav a {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition);
}

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

.header-cta .btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--color-secondary);
}

/* Mobile nav */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
  }

  .header-nav.open {
    display: flex;
  }

  .header-cta {
    width: 100%;
  }

  .header-cta .btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- Site Footer --- */
.site-footer {
  background: var(--color-secondary);
  color: #94A3B8;
  padding: 4rem 0 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand p {
  margin-top: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-brand .footer-logo {
  height: 28px;
  width: auto;
}

.footer-col h4 {
  color: #F1F5F9;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col a {
  color: #94A3B8;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: #E2E8F0;
}

.footer-bottom {
  border-top: 1px solid #1E293B;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Hero Section --- */
.hero {
  padding: 6rem 0 5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--color-secondary) 0%, #1E293B 100%);
  color: #CBD5E1;
}

.hero h1 {
  color: #F8FAFC;
  font-size: 3.25rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}

.hero p {
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

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

@media (max-width: 768px) {
  .hero {
    padding: 4rem 0 3rem;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 1.1rem;
  }
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: var(--color-primary);
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--color-text-light);
  font-size: 0.95rem;
}

.card-icon-accent {
  background: #EDE9FE;
  color: var(--color-accent);
}

.card-icon-success {
  background: #D1FAE5;
  color: var(--color-success);
}

@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Steps / How it Works --- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  counter-reset: step;
}

.step {
  text-align: center;
  position: relative;
}

.step-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.step h3 {
  margin-bottom: 0.75rem;
}

.step p {
  color: var(--color-text-light);
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

/* --- Feature Highlights Grid --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.feature-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--color-primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature-item h4 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.feature-item p {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

@media (max-width: 1024px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Features Page — Detailed Sections --- */
.feature-section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--color-border);
}

.feature-section:last-child {
  border-bottom: none;
}

.feature-section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.feature-section:nth-child(even) .feature-section-inner {
  direction: rtl;
}

.feature-section:nth-child(even) .feature-section-inner > * {
  direction: ltr;
}

.feature-section-text h2 {
  margin-bottom: 1rem;
}

.feature-section-text p {
  color: var(--color-text-light);
  margin-bottom: 1rem;
}

.feature-section-text ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-section-text li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  font-size: 0.95rem;
}

.feature-section-text li svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--color-success);
}

.feature-visual {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.feature-visual-icon {
  width: 80px;
  height: 80px;
  color: var(--color-primary);
  opacity: 0.6;
}

@media (max-width: 768px) {
  .feature-section-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .feature-section:nth-child(even) .feature-section-inner {
    direction: ltr;
  }

  .feature-visual {
    min-height: 200px;
  }
}

/* --- Documentation Layout --- */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  gap: 3rem;
  min-height: calc(100vh - var(--header-height) - 200px);
}

/* --- Docs Sidebar --- */
.docs-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
}

.sidebar-toggle {
  display: none;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-secondary);
  cursor: pointer;
  margin-bottom: 1rem;
  text-align: left;
}

.sidebar-nav h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
}

.sidebar-nav h3:first-child {
  margin-top: 0;
}

.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.9rem;
  color: var(--color-text);
  border-radius: 4px;
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav a:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.sidebar-nav a.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

@media (max-width: 1024px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .docs-sidebar {
    position: static;
    max-height: none;
  }

  .sidebar-nav {
    display: none;
    padding-bottom: 1rem;
  }

  .sidebar-nav.open {
    display: block;
  }
}

/* --- Docs Content --- */
.docs-content {
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 2rem;
}

.breadcrumb a {
  color: var(--color-text-light);
}

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

.breadcrumb-sep {
  color: var(--color-border);
}

.docs-content h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.docs-content .doc-lead {
  font-size: 1.125rem;
  color: var(--color-text-light);
  margin-bottom: 2.5rem;
}

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

.docs-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

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

.docs-content p {
  margin-bottom: 1rem;
}

.docs-content ul,
.docs-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.docs-content ul {
  list-style: disc;
}

.docs-content ol {
  list-style: decimal;
}

.docs-content li {
  margin-bottom: 0.5rem;
}

.docs-content li > ul,
.docs-content li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.docs-content strong {
  color: var(--color-secondary);
}

/* Code blocks in docs */
.docs-content code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--color-bg-alt);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  color: var(--color-secondary);
}

.docs-content pre {
  background: var(--color-secondary);
  color: #E2E8F0;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

/* Info/tip callout boxes */
.callout {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.callout-info {
  background: var(--color-primary-light);
  border-left: 4px solid var(--color-primary);
}

.callout-tip {
  background: #D1FAE5;
  border-left: 4px solid var(--color-success);
}

.callout-warning {
  background: #FEF3C7;
  border-left: 4px solid #D97706;
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* --- Docs Hub Cards --- */
.docs-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.docs-hub-card {
  display: block;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.docs-hub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.docs-hub-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--color-secondary);
}

.docs-hub-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin: 0;
}

.docs-hub-section {
  margin-bottom: 3rem;
}

.docs-hub-section > h2 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
  .docs-hub-grid {
    grid-template-columns: 1fr;
  }
}

/* --- CTA Banner --- */
.cta-banner {
  text-align: center;
  padding: 5rem 1.5rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
}

.cta-banner h2 {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.cta-banner p {
  font-size: 1.125rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.cta-banner .btn-coming-soon {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
}

/* --- Page Hero (inner pages) --- */
.page-hero {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #1E293B 100%);
  color: #CBD5E1;
  padding: 4rem 0 3rem;
  text-align: center;
}

.page-hero h1 {
  color: #F8FAFC;
  margin-bottom: 1rem;
}

.page-hero p {
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Misc --- */
.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;
}

/* Smooth anchor offset for sticky header */
:target::before {
  content: '';
  display: block;
  height: calc(var(--header-height) + 1rem);
  margin-top: calc(-1 * (var(--header-height) + 1rem));
}
