/* KWScanner marketing site — single CSS file, mobile-first.
 * Brand palette mirrors the dashboard so visitors moving from
 * marketing → product feel they're in the same place.
 *
 * Layers:
 *   1. tokens (CSS custom properties)
 *   2. resets + base typography
 *   3. layout primitives (container, section)
 *   4. components (header, hero, features, pricing, faq, footer)
 *   5. responsive overrides */

/* ----------------------------------------------------------------
 * 1. tokens
 * ---------------------------------------------------------------- */
:root {
  /* brand */
  --primary: #0f766e;
  --primary-dark: #0b5d56;
  --primary-tint: #ccfbf1;
  --accent: #f59e0b;

  /* neutrals */
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-soft: #64748b;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-hero: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);

  /* type scale */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3.25rem;

  /* spacing + shape */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, 0.12);

  /* containers */
  --container: 1200px;
  --container-narrow: 760px;
}

/* ----------------------------------------------------------------
 * 2. reset + base
 * ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, var(--fs-4xl)); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.5vw, var(--fs-3xl)); font-weight: 700; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p  { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-tint);
  padding: 4px 10px;
  border-radius: 100px;
}

/* ----------------------------------------------------------------
 * 3. layout primitives
 * ---------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
.container--narrow { max-width: var(--container-narrow); }

.section {
  padding: clamp(60px, 9vw, 110px) 0;
}
.section--alt { background: var(--bg-alt); }
.section__head {
  max-width: 720px;
  margin: 0 auto 56px;
  text-align: center;
}
.section__lead {
  color: var(--ink-muted);
  font-size: var(--fs-md);
}

/* ----------------------------------------------------------------
 * 4. buttons
 * ---------------------------------------------------------------- */
/* Buttons share the dashboard's `<Button>` geometry — height 40px, 6px
 * radius — so a hero CTA on the marketing site matches the Buy Now button
 * on /billing exactly. Keep this file in sync with
 * apps/web/src/components/ui/button.tsx if either side changes. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--lg { height: 48px; padding: 0 24px; font-size: var(--fs-base); }
.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--primary-dark); }
/* Mirrors the dashboard `outline` button variant — flat muted fill, no
 * visible border. The `.btn` base class keeps a `1px solid transparent`
 * border so layout doesn't shift between primary and secondary buttons. */
.btn--ghost {
  background: var(--bg-alt);
  color: var(--ink);
}
.btn--ghost:hover { background: #e2e8f0; }

/* Brand-bordered button — used for the header "Sign in" CTA. Same flat
 * geometry as `.btn--primary` but transparent fill with a teal border so
 * it reads as the secondary entry-point next to "Get started". */
.btn--outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--outline-primary:hover {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ----------------------------------------------------------------
 * 5. site header
 * ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 700;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.brand__name {
  color: var(--ink);
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
}
.site-nav {
  display: none;
  gap: 28px;
}
.site-nav a {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: var(--fs-sm);
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-header__actions {
  display: none;
  gap: 8px;
}
.menu-toggle {
  background: none;
  border: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 24px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
  padding: 12px 0;
  color: var(--ink-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line-soft);
}
.mobile-nav a:hover { color: var(--ink); text-decoration: none; }
.mobile-nav .btn { margin-top: 8px; }

/* ----------------------------------------------------------------
 * 6. hero
 * ---------------------------------------------------------------- */
.hero {
  background: var(--bg-hero);
  padding: clamp(48px, 8vw, 88px) 0 clamp(40px, 8vw, 96px);
  border-bottom: 1px solid var(--line);
}
.hero__inner {
  display: grid;
  gap: 48px;
}
.hero__copy h1 {
  margin-top: 14px;
  margin-bottom: 16px;
}
.lead {
  font-size: var(--fs-md);
  color: var(--ink-muted);
  max-width: 56ch;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 16px;
}
.hero__meta {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.hero__meta-sep { color: var(--line); }

/* mockup */
.hero__visual { position: relative; }
.mockup {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: rotate(-0.5deg);
}
.mockup__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #cbd5e1;
}
.dot:nth-child(1) { background: #f87171; }
.dot:nth-child(2) { background: #fbbf24; }
.dot:nth-child(3) { background: #34d399; }
.mockup__url {
  margin-left: 12px;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.mockup__body { padding: 8px 0; }
.mockup__row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 70px 64px 56px 60px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--line-soft);
}
.mockup__row:last-child { border-bottom: 0; }
.mockup__row > span:first-child { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mockup__row .num { color: var(--ink-muted); font-variant-numeric: tabular-nums; text-align: right; }
.mockup__row--head {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  padding-top: 14px;
  padding-bottom: 14px;
  background: var(--bg-alt);
}
.mockup__row--head > span:first-child { font-weight: 600; }
/* Center every numeric column (Volume / CPC / Comp.) and the Trend chart so
 * headers and data live on the same vertical axis. Header (.mockup__row--head)
 * and data row use the same span:nth-child rules so the columns stay aligned. */
.mockup__row > span:nth-child(2),
.mockup__row > span:nth-child(3),
.mockup__row > span:nth-child(4),
.mockup__row > span:nth-child(5) { text-align: center; }
.mockup__row .num { text-align: center; } /* override the earlier .num right-align */
.bars { margin: 0 auto; } /* center the trend SVG within its column */
.bars { color: var(--primary); width: 60px; height: 24px; }

/* ----------------------------------------------------------------
 * 7. features
 * ---------------------------------------------------------------- */
.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.feature {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.feature:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.feature__icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--primary-tint);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.feature__icon svg { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--ink-muted); margin: 0; }

/* ----------------------------------------------------------------
 * 9. steps
 * ---------------------------------------------------------------- */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 24px;
  counter-reset: step;
}
.steps li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
}
.step__num {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 12px;
}
.steps h3 { margin-bottom: 8px; }
.steps p { color: var(--ink-muted); margin: 0; }

/* ----------------------------------------------------------------
 * 10. pricing
 *
 * Pay-as-you-go credit tiers shown as a single table — the "buy any
 * amount, the rate scales with volume" story is much clearer here than
 * in stylized plan cards. Wrap the table in a horizontally-scrollable
 * div so very narrow viewports never break the layout.
 * ---------------------------------------------------------------- */
.pricing-table-wrap {
  margin: 0 auto 32px;
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
}
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.pricing-table thead th {
  background: var(--bg-alt);
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.pricing-table tbody td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.pricing-table tbody tr:last-child td { border-bottom: 0; }
.pricing-table tbody td:nth-child(2),
.pricing-table tbody td:nth-child(3) { color: var(--ink-muted); font-weight: 500; }
.pricing-table tbody tr:last-child td {
  background: linear-gradient(0deg, rgba(15, 118, 110, 0.04), transparent);
  font-weight: 600;
  color: var(--primary);
}

.pricing__footnote {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  margin: 8px 0 24px;
}
.pricing__cta { text-align: center; }

/* ----------------------------------------------------------------
 * 11. faq
 * ---------------------------------------------------------------- */
.faq {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq__item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.faq__item dt {
  font-weight: 600;
  font-size: var(--fs-md);
  margin-bottom: 8px;
}
.faq__item dd {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
}

/* ----------------------------------------------------------------
 * 12. cta band
 * ---------------------------------------------------------------- */
.cta {
  padding: clamp(40px, 8vw, 72px) 0;
}
.cta__card {
  background: var(--primary);
  background: linear-gradient(135deg, var(--primary) 0%, #0d9488 100%);
  color: #fff;
  padding: clamp(36px, 6vw, 64px) clamp(24px, 4vw, 48px);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow);
}
.cta__card h2 { color: #fff; margin-bottom: 8px; }
.cta__card p { color: rgba(255, 255, 255, 0.85); margin-bottom: 24px; font-size: var(--fs-md); }
.cta__card .btn--primary {
  background: #fff;
  color: var(--primary);
}
.cta__card .btn--primary:hover { background: #f0fdfa; }

/* ----------------------------------------------------------------
 * 13. footer
 * ---------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.7);
  padding: 56px 0 28px;
  font-size: var(--fs-sm);
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
.site-footer__brand { color: rgba(255, 255, 255, 0.7); }
/* Match the header K-mark exactly: same teal rounded square, white "K".
 * `currentColor` flows from this rule into the SVG <rect> fill. */
.site-footer__brand .brand { color: var(--primary); }
.site-footer__brand .brand__name { color: #fff; }
.site-footer__brand p { margin-top: 12px; max-width: 32ch; color: rgba(255, 255, 255, 0.6); }
.site-footer__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.site-footer__nav h4 {
  color: #fff;
  font-size: var(--fs-sm);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.site-footer__nav a {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  padding: 4px 0;
  font-size: var(--fs-sm);
}
.site-footer__nav a:hover { color: #fff; text-decoration: none; }
.site-footer__legal {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 40px;
  padding-top: 24px;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.5);
}
.site-footer__legal p { margin: 0; }

/* ----------------------------------------------------------------
 * 14. responsive — tablet+
 * ---------------------------------------------------------------- */
@media (min-width: 720px) {
  .hero__inner { grid-template-columns: 1fr 1fr; align-items: center; }
  .features { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .site-footer__inner { grid-template-columns: 1fr 1fr; gap: 48px; }
  .site-footer__nav { grid-template-columns: 1fr 1fr; }
}

/* ----------------------------------------------------------------
 * 15. responsive — desktop
 * ---------------------------------------------------------------- */
@media (min-width: 960px) {
  .site-nav, .site-header__actions { display: flex; }
  .menu-toggle { display: none; }
  #mobile-nav { display: none !important; }
  .features { grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
  .site-footer__inner { grid-template-columns: 1fr 2fr; gap: 64px; }
}

/* ----------------------------------------------------------------
 * 16. secondary pages (legal, about, contact)
 *
 * Shared layout for any non-marketing page that wants the same header/
 * footer chrome but a focused single-column reading experience.
 * ---------------------------------------------------------------- */
.page {
  padding: clamp(48px, 7vw, 80px) 0 clamp(64px, 10vw, 120px);
}
.page__head {
  margin-bottom: 40px;
}
.page__head h1 {
  margin: 12px 0 8px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}
.page__head .lead {
  color: var(--ink-muted);
  margin: 0;
  font-size: var(--fs-md);
}
.page__meta {
  margin-top: 12px;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* Long-form prose: heading hierarchy, links, lists, callouts. */
.prose h2 {
  margin-top: 40px;
  margin-bottom: 12px;
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.prose h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: var(--fs-md);
  color: var(--ink);
}
.prose p,
.prose li {
  color: var(--ink-muted);
  font-size: var(--fs-base);
  line-height: 1.7;
}
.prose ul, .prose ol {
  margin: 12px 0 20px;
  padding-left: 1.4em;
}
.prose li { margin-bottom: 6px; }
.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.prose a:hover { color: var(--primary-dark); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose .callout {
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--bg-alt);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}
.prose .callout strong { display: block; margin-bottom: 4px; color: var(--ink); }
.prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* About / Contact: feature-card-ish layout primitives. */
.value-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 32px 0;
}
.value-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.value-card h3 {
  margin: 0 0 8px;
  font-size: var(--fs-md);
  color: var(--ink);
}
.value-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: 1.65;
}

/* Contact page channel cards. */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 32px 0;
}
.contact-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-card__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}
.contact-card__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink);
}
.contact-card__body {
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  line-height: 1.6;
  margin: 0;
}
.contact-card a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}
.contact-card a:hover { text-decoration: underline; }

@media (min-width: 720px) {
  .value-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}

/* ----------------------------------------------------------------
 * 17. accessibility helpers
 * ---------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
