/* ==========================================================================
   Arfai — Enterprise WhatsApp & Meta API Platform
   Design System & Global Stylesheet
   ========================================================================== */

:root {
  /* Surface & Ink Palette */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-dark: #0b1220;
  --bg-dark-elevated: #131e33;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-on-dark: #f8fafc;
  --text-on-dark-muted: #94a3b8;

  /* Brand Accents */
  --brand-emerald: #059669;
  --brand-emerald-bright: #10b981;
  --brand-emerald-soft: #ecfdf5;
  --brand-blue: #2563eb;
  --brand-blue-soft: #eff6ff;
  --brand-indigo: #4f46e5;

  /* Borders & Shadows */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-dark: rgba(255, 255, 255, 0.12);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 12px 32px rgba(5, 150, 105, 0.16);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --container-max: 1200px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  --nav-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-page);
}

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

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* Layout Helpers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 24px;
}

.section {
  padding-block: 88px;
}

.section-sm {
  padding-block: 56px;
}

.section-dark {
  background-color: var(--bg-dark);
  color: var(--text-on-dark);
}

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

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

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0 0 12px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.25rem, 4.4vw, 3.5rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.section-dark p {
  color: var(--text-on-dark-muted);
}

.lead {
  font-size: 1.125rem;
  line-height: 1.7;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-emerald);
  background: var(--brand-emerald-soft);
  border: 1px solid rgba(5, 150, 105, 0.2);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
}

.section-dark .eyebrow {
  background: rgba(16, 185, 129, 0.14);
  color: var(--brand-emerald-bright);
  border-color: rgba(16, 185, 129, 0.3);
}

.section-header {
  max-width: 700px;
  margin-bottom: 48px;
}

.section-header.centered {
  margin-inline: auto;
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--brand-emerald);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-muted);
}

.section-dark .btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-on-dark);
  border-color: var(--border-dark);
}

.section-dark .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.14);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 24px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  padding: 8px 14px;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

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

.nav-links a.active {
  color: var(--brand-emerald);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--text-primary);
}

.mobile-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Mobile Drawer */
.mobile-nav {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 24px 24px;
}

.mobile-toggle-input:checked ~ .mobile-nav {
  display: block;
}

.mobile-nav ul {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.mobile-nav a.active,
.mobile-nav a:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Grids & Cards */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.card-dark {
  background: var(--bg-dark-elevated);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 28px;
}

.icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: var(--brand-emerald-soft);
  color: var(--brand-emerald);
}

.icon-box.blue {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
}

.section-dark .icon-box {
  background: rgba(16, 185, 129, 0.14);
  color: var(--brand-emerald-bright);
}

/* Hero Section */
.hero {
  padding-block: 72px 84px;
  background:
    radial-gradient(circle at 88% 12%, rgba(16, 185, 129, 0.1), transparent 38%),
    radial-gradient(circle at 12% 85%, rgba(37, 99, 235, 0.08), transparent 40%),
    var(--bg-page);
  border-bottom: 1px solid var(--border-light);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.hero-highlight-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* Interactive Sandbox Widget in Hero (Pure CSS Radio Tabs) */
.api-sandbox {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  border: 1px solid #1e293b;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}

.css-tab-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sandbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #0f172a;
  border-bottom: 1px solid var(--border-dark);
  gap: 12px;
}

.sandbox-dots {
  display: flex;
  gap: 6px;
}

.sandbox-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.sandbox-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sandbox-tab {
  display: inline-block;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-on-dark-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

#sandbox-wa:checked ~ .sandbox-topbar label[for="sandbox-wa"],
#sandbox-wh:checked ~ .sandbox-topbar label[for="sandbox-wh"],
#sandbox-capi:checked ~ .sandbox-topbar label[for="sandbox-capi"] {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--brand-emerald-bright);
}

.sandbox-panel {
  display: none;
}

#sandbox-wa:checked ~ .sandbox-body .sandbox-panel-wa,
#sandbox-wh:checked ~ .sandbox-body .sandbox-panel-wh,
#sandbox-capi:checked ~ .sandbox-body .sandbox-panel-capi {
  display: block;
}

.sandbox-body {
  padding: 20px;
}

.code-block {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre;
}

.wa-preview-bar {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #13231d;
  border: 1px solid rgba(16, 185, 129, 0.28);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.wa-preview-meta {
  font-size: 0.78rem;
  color: var(--brand-emerald-bright);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.wa-preview-text {
  font-size: 0.9rem;
  color: #f1f5f9;
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.16);
  color: var(--brand-emerald-bright);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-emerald-bright);
}

/* Trust / Metrics Strip */
.metrics-strip {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding-block: 36px;
}

.metric-item {
  text-align: left;
  padding-inline: 12px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Tabs / Use Case Switcher (Pure CSS Radio Tabs) */
.css-tabs-wrap {
  position: relative;
}

.tab-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 28px;
}

.tab-btn {
  display: inline-block;
  border: none;
  background: transparent;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#ind-ecom:checked ~ .tab-bar label[for="ind-ecom"],
#ind-fin:checked ~ .tab-bar label[for="ind-fin"],
#ind-health:checked ~ .tab-bar label[for="ind-health"],
#ind-log:checked ~ .tab-bar label[for="ind-log"] {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
}

#ind-ecom:checked ~ .tab-panel-ecom,
#ind-fin:checked ~ .tab-panel-fin,
#ind-health:checked ~ .tab-panel-health,
#ind-log:checked ~ .tab-panel-log {
  display: block;
}

/* Lists with Checkmarks */
.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.section-dark .check-list li {
  color: var(--text-on-dark-muted);
}

.check-icon {
  color: var(--brand-emerald);
  flex-shrink: 0;
  margin-top: 3px;
}

/* Page Banner (Inner Pages) */
.page-hero {
  padding-block: 60px 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

/* Architecture Diagram Box */
.arch-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

/* Pricing Cards */
.pricing-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.pricing-card.featured {
  border: 2px solid var(--brand-emerald);
  box-shadow: var(--shadow-lg);
}

.popular-badge {
  position: absolute;
  top: -13px;
  right: 24px;
  background: var(--brand-emerald);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.price-figure {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 12px 0 4px;
}

.price-figure span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* FAQ Accordion (Native HTML5 <details> / <summary>) */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-trigger {
  list-style: none;
  padding: 20px 24px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.faq-trigger::-webkit-details-marker {
  display: none;
}

.faq-trigger:hover {
  background: var(--bg-subtle);
}

.faq-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}

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

.faq-content {
  padding: 0 24px 20px;
  color: var(--text-secondary);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--brand-emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.form-feedback {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  display: none;
}

.form-feedback.success {
  display: block;
  background: var(--brand-emerald-soft);
  border: 1px solid rgba(5, 150, 105, 0.35);
  color: #065f46;
}

.form-feedback.error {
  display: block;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Sitemap Page Styling */
.sitemap-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sitemap-link-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-light);
}

.sitemap-link-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sitemap-link-row a {
  font-weight: 600;
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sitemap-link-row a:hover {
  color: var(--brand-emerald);
  text-decoration: underline;
}

.sitemap-link-row span {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* CTA Banner */
.cta-banner {
  background: linear-gradient(135deg, #0b1220 0%, #112238 100%);
  color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border: 1px solid #1e293b;
}

.cta-banner p {
  color: var(--text-on-dark-muted);
  margin-bottom: 0;
}

/* Footer */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding-top: 68px;
  padding-bottom: 36px;
  border-top: 1px solid #1e293b;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border-dark);
}

.footer-col h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f8fafc;
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  font-size: 0.92rem;
  color: var(--text-on-dark-muted);
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: var(--brand-emerald-bright);
}

.footer-bottom {
  padding-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.86rem;
  color: var(--text-on-dark-muted);
}

.footer-bottom-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-bottom-links a:hover {
  color: #ffffff;
}

/* Badge tags */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.tag-green {
  background: var(--brand-emerald-soft);
  color: var(--brand-emerald);
  border-color: rgba(5, 150, 105, 0.22);
}

.tag-blue {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-color: rgba(37, 99, 235, 0.22);
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .hero-grid,
  .grid-2,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cta-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 36px 28px;
  }
}

@media (max-width: 768px) {
  .nav-links,
  .header-actions .btn-secondary {
    display: none;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding-block: 64px;
  }
}
