/* ==========================================================================
   TextFormatter.ai — Production CSS
   Mobile-first, accessible, dark mode, performance-optimized
   ========================================================================== */

/* --- Design Tokens (HSL, matches Lovable exactly) --- */
:root {
  --bg: 0 0% 100%;
  --fg: 0 0% 13%;
  --card: 0 0% 100%;
  --card-fg: 0 0% 13%;
  --primary: 217 89% 51%;
  --primary-fg: 0 0% 100%;
  --secondary: 214 32% 96%;
  --secondary-fg: 0 0% 13%;
  --muted: 220 14% 96%;
  --muted-fg: 220 9% 38%;
  --border: 220 13% 91%;
  --ring: 217 89% 51%;
  --font: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --text-display: 2.5rem;
  --text-title: 1.5rem;
  --text-body: 1.125rem;
  --text-label: 1rem;
  --text-small: 0.875rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 5.5rem;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-xs: 0.375rem;
  --max-w: 1200px;
  --max-w-md: 900px;
  --max-w-sm: 768px;
}

.dark {
  --bg: 0 0% 13%;
  --fg: 0 0% 98%;
  --card: 0 0% 15%;
  --card-fg: 0 0% 98%;
  --primary: 217 89% 61%;
  --primary-fg: 0 0% 100%;
  --secondary: 220 10% 20%;
  --secondary-fg: 0 0% 95%;
  --muted: 220 10% 20%;
  --muted-fg: 220 9% 78%;
  --border: 220 10% 25%;
  --ring: 217 89% 61%;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* --- Base --- */
body {
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.7;
  color: hsl(var(--fg));
  background: hsl(var(--bg));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
input, textarea, select, button { font-family: var(--font); font-size: inherit; }

:focus-visible {
  outline: 3px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: hsl(var(--primary) / 0.2); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 600;
  line-height: 1.3;
  color: hsl(var(--fg));
  text-wrap: balance;
}
h1, h2 { letter-spacing: -0.01em; }

.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;
}

/* --- Skip Link --- */
.skip-link {
  position: absolute; top: -100%; left: 0.5rem; z-index: 9999;
  background: hsl(var(--primary)); color: hsl(var(--primary-fg));
  padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-xs);
  font-weight: 600; font-size: var(--text-small);
  transition: top 0.15s;
}
.skip-link:focus { top: 0.5rem; }

/* --- Section Divider --- */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(var(--border)) 30%, hsl(var(--border)) 70%, transparent);
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: hsl(var(--bg) / 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}

.hdr {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max-w); margin: 0 auto;
  padding: var(--space-xs) var(--space-sm); width: 100%;
}

.hdr-logo {
  font-size: var(--text-body); font-weight: 600;
  color: hsl(var(--fg)); transition: opacity 0.15s;
  white-space: nowrap;
}
.hdr-logo:hover { opacity: 0.8; }

.hdr-actions { display: flex; align-items: center; gap: var(--space-xs); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-family: var(--font);
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }

.btn-sm {
  border-radius: var(--radius-xs);
  background: hsl(217 89% 45%); color: hsl(var(--primary-fg));
  font-size: var(--text-label); font-weight: 500;
  padding: var(--space-xs) var(--space-sm); line-height: 1.5;
}
.btn-sm:hover { background: hsl(217 89% 40%); }

.btn-lg {
  border-radius: var(--radius-sm);
  background: hsl(217 89% 45%); color: hsl(var(--primary-fg));
  font-size: var(--text-label); font-weight: 600;
  padding: var(--space-sm) var(--space-lg); line-height: 1.4;
}
.btn-lg:hover { background: hsl(217 89% 40%); }

/* --- Theme Toggle --- */
.theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-xs);
  border: none; background: transparent;
  color: hsl(var(--muted-fg)); cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}
.theme-btn:hover { color: hsl(var(--fg)); background: hsl(var(--muted)); }
.theme-btn svg { width: 20px; height: 20px; display: block; }
.theme-btn .icon { display: none; }
.theme-btn .icon.active { display: block; }

/* --- Text Gradient --- */
.text-grad {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary) / 0.7));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dark .text-grad {
  background: linear-gradient(135deg, hsl(217 89% 70%), hsl(217 89% 55%));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Trust Text --- */
.trust { margin-top: var(--space-sm); font-size: var(--text-small); color: hsl(var(--fg) / 0.6); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: var(--space-xl) var(--space-sm); text-align: center;
  background: linear-gradient(180deg, hsl(var(--secondary) / 0.4), hsl(var(--bg)));
}
.hero-inner { max-width: var(--max-w-md); margin: 0 auto; }
.hero h1 { font-size: clamp(1.75rem, 5vw + 0.5rem, var(--text-display)); font-weight: 700; margin-bottom: var(--space-sm); }
.hero-sub {
  font-size: clamp(var(--text-label), 2.5vw, var(--text-body)); color: hsl(var(--muted-fg));
  font-weight: 400; line-height: 1.65; margin-bottom: var(--space-lg);
  max-width: 720px; margin-left: auto; margin-right: auto; text-wrap: balance;
}

/* ==========================================================================
   Logo Marquee
   ========================================================================== */
.logos { padding: var(--space-lg) var(--space-sm); text-align: center; }
.logos-wrap { max-width: var(--max-w); margin: 0 auto; }
.marquee { overflow: hidden; min-height: 44px; }
.marquee-track {
  display: flex; gap: var(--space-sm); width: max-content;
  will-change: transform; animation: slide 30s linear infinite;
}
.badge {
  flex-shrink: 0; width: 100px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm); font-size: var(--text-small); font-weight: 500;
  color: hsl(var(--fg)); user-select: none;
}
@keyframes slide { to { transform: translateX(-50%); } }

/* ==========================================================================
   Marketing Sections
   ========================================================================== */
.mk { padding: var(--space-xl) var(--space-sm); text-align: center; }
.mk-alt { background: hsl(var(--secondary) / 0.2); }
.mk-h { font-size: clamp(1.25rem, 3.5vw, var(--text-title)); margin-bottom: var(--space-xs); }
.mk-p {
  color: hsl(var(--muted-fg)); font-size: var(--text-body);
  line-height: 1.65; margin-bottom: var(--space-lg); text-wrap: balance;
}

/* --- Timeline (How It Works) --- */
.steps { display: grid; grid-template-columns: 1fr; gap: var(--space-lg); max-width: var(--max-w-md); margin: 0 auto; }
.step { text-align: center; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: hsl(var(--primary)); color: hsl(var(--primary-fg));
  font-size: 1.125rem; font-weight: 700; margin-bottom: var(--space-sm);
}
.step h3 { font-size: var(--text-body); margin-bottom: var(--space-xs); }
.step p { color: hsl(var(--muted-fg)); font-size: var(--text-body); line-height: 1.6; margin: 0 auto; }

/* --- Cards (Features, Audiences) --- */
.cards { display: grid; grid-template-columns: 1fr; gap: var(--space-sm); max-width: var(--max-w); margin: 0 auto; }
.crd {
  display: flex; align-items: flex-start; gap: var(--space-sm);
  padding: var(--space-md); background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); text-align: left; transition: border-color 0.15s;
}
.crd:hover { border-color: hsl(var(--primary) / 0.3); }
.crd-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; margin-top: 0.125rem; }
.crd h3 { font-size: var(--text-label); font-weight: 600; margin-bottom: var(--space-xs); }
.crd p { color: hsl(var(--muted-fg)); font-size: var(--text-body); line-height: 1.6; }

/* --- Social Proof --- */
.proof { text-align: center; }
.proof-num { font-size: clamp(var(--text-title), 5vw, var(--text-display)); font-weight: 700; color: hsl(var(--primary)); }
.proof-label { font-size: var(--text-body); color: hsl(var(--muted-fg)); font-weight: 400; margin-top: var(--space-xs); margin-bottom: var(--space-lg); }

.quotes { display: grid; grid-template-columns: 1fr; gap: var(--space-sm); max-width: var(--max-w); margin: 0 auto; }
.quote {
  display: flex; flex-direction: column; padding: var(--space-md);
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); text-align: left;
  transition: border-color 0.15s; position: relative;
}
.quote:hover { border-color: hsl(var(--primary) / 0.3); }
.quote::before {
  content: '\201C'; position: absolute; top: 8px; left: 14px;
  font-size: 3.5rem; line-height: 1; color: hsl(var(--primary) / 0.1);
  font-family: Georgia, serif; pointer-events: none;
}
.quote-text { flex: 1; font-size: var(--text-body); font-weight: 400; font-style: italic; color: hsl(var(--fg)); line-height: 1.6; margin-bottom: var(--space-sm); }
.quote-who { font-size: var(--text-small); font-weight: 600; color: hsl(var(--fg)); }

/* --- CTA Banner --- */
.cta-banner {
  padding: var(--space-xl) var(--space-sm); text-align: center;
  background: hsl(var(--primary) / 0.05);
  border-top: 1px solid hsl(var(--border));
}

/* --- FAQ --- */
.faq { padding: var(--space-xl) var(--space-sm); }
.faq > div > h2 { text-align: center; font-size: clamp(1.25rem, 3.5vw, var(--text-title)); margin-bottom: var(--space-lg); }
.faq-list { max-width: var(--max-w-sm); margin: 0 auto; }
.faq-item {
  border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs); overflow: hidden; transition: background 0.15s;
}
.faq-item.active { background: hsl(var(--muted)); }
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-sm) var(--space-md); cursor: pointer; gap: var(--space-sm);
}
.faq-q h3 { font-size: var(--text-label); font-weight: 500; margin: 0; line-height: 1.45; letter-spacing: 0; }
.faq-chevron {
  flex-shrink: 0; width: 20px; height: 20px;
  color: hsl(var(--muted-fg)); transition: transform 0.25s ease;
}
.faq-item.active .faq-chevron { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.faq-a-inner { padding: 0 var(--space-md) var(--space-sm); }
.faq-a p { color: hsl(var(--muted-fg)); font-size: var(--text-body); line-height: 1.7; margin: 0; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: hsl(var(--bg)); border-top: 1px solid hsl(var(--border)); padding: var(--space-md) var(--space-sm); }
.ftr {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-xs); font-size: var(--text-small); color: hsl(var(--muted-fg));
  max-width: var(--max-w); margin: 0 auto;
}
.ftr-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-sm); }
.ftr-nav a { color: hsl(var(--muted-fg)); transition: color 0.15s; }
.ftr-nav a:hover { color: hsl(var(--fg)); }

/* ==========================================================================
   Content Pages (Privacy, Terms)
   ========================================================================== */
.pg { padding: var(--space-lg) var(--space-sm) var(--space-xl); }
.pg > h1 { text-align: center; font-size: clamp(1.25rem, 4vw, var(--text-title)); font-weight: 700; margin-bottom: var(--space-lg); }
.pg-body { max-width: var(--max-w-sm); margin: 0 auto; }
.pg-body h2 { margin-top: var(--space-lg); margin-bottom: var(--space-sm); font-size: var(--text-title); }
.pg-body h3 { margin-top: var(--space-md); margin-bottom: var(--space-xs); font-size: var(--text-body); }
.pg-body p { margin-bottom: var(--space-sm); color: hsl(var(--muted-fg)); font-size: var(--text-body); line-height: 1.7; }
.pg-body ul, .pg-body ol { margin-bottom: var(--space-sm); padding-left: var(--space-md); }
.pg-body li { margin-bottom: var(--space-xs); color: hsl(var(--muted-fg)); font-size: var(--text-body); line-height: 1.65; }
.pg-body a { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2px; }
.pg-body strong { color: hsl(var(--fg)); font-weight: 600; }

/* Contact */
.contact { padding: var(--space-lg) var(--space-sm) var(--space-xl); text-align: center; }
.contact h1 { font-size: clamp(1.25rem, 4vw, var(--text-title)); font-weight: 700; margin-bottom: var(--space-lg); }
.contact-form { max-width: 560px; margin: 0 auto; text-align: left; }

/* 404 */
.e404 {
  padding: var(--space-2xl) var(--space-sm); text-align: center; min-height: 60vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.e404 h1 { font-size: 5rem; margin-bottom: var(--space-xs); }
.e404 p { color: hsl(var(--muted-fg)); font-size: var(--text-body); margin-bottom: var(--space-lg); }

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ==========================================================================
   Responsive — Mobile First (breakpoints: 640, 768, 1024)
   ========================================================================== */
@media (min-width: 640px) {
  .hdr { padding: var(--space-xs) var(--space-md); }
  .hdr-logo { font-size: var(--text-title); }
  .btn-sm { font-size: var(--text-label); padding: var(--space-xs) var(--space-md); }
  .btn-lg { font-size: 1.125rem; padding: var(--space-sm) var(--space-lg); }
  .hero { padding: var(--space-2xl) var(--space-md); }
  .mk { padding: var(--space-2xl) var(--space-md); }
  .cta-banner { padding: var(--space-2xl) var(--space-md); }
  .faq { padding: var(--space-2xl) var(--space-md); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
  .quotes { grid-template-columns: repeat(3, 1fr); }
  .ftr { flex-direction: row; gap: var(--space-sm); }
  .ftr-nav { gap: var(--space-sm); }
  .badge { width: 110px; height: 44px; font-size: var(--text-small); }
  .step p { font-size: var(--text-body); }
}

@media (min-width: 768px) {
  .mk { padding: var(--space-2xl) var(--space-lg); }
  .hero { padding: var(--space-2xl) var(--space-lg); }
  .cta-banner { padding: var(--space-2xl) var(--space-lg); }
  .faq { padding: var(--space-2xl) var(--space-lg); }
  .faq-q { padding: var(--space-md) var(--space-md); }
  .faq-a-inner { padding: 0 var(--space-md) var(--space-md); }
}

@media (min-width: 1024px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .site-header, .site-footer, .theme-btn, .btn, .marquee, .cta-banner { display: none !important; }
  body { font-size: 12pt; color: #000; background: #fff; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
