/* ============================================================
   Measure Marketer: Design System
   Light-first premium SaaS with dark toggle.
   Palette: blue (data/trust) + amber (signal/money) + cyan (data-flow)
   Type: Sora (display) / Inter (body) / JetBrains Mono (data)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&display=swap');

/* ---------- Theme tokens (RGB components for Tailwind alpha) ---------- */
/* Brand palette from logo: navy #2D3A5C, emerald-teal #16A88A, coral #F4566B, periwinkle #7B96C7 */
:root {
  --bg: 246 249 248;
  --surface: 255 255 255;
  --surface-2: 243 248 246;
  --fg: 28 38 59;
  --muted-fg: 89 102 125;
  --primary: 11 122 94;
  --primary-bright: 18 168 138;
  --primary-deep: 8 92 71;
  --on-primary: 255 255 255;
  --accent: 206 44 70;
  --accent-bright: 244 86 107;
  --cyan: 14 150 150;
  --muted: 232 239 237;
  --border: 223 231 229;
  --ring: 18 168 138;

  --glass-bg: 255 255 255;
  --glass-alpha: 0.65;
  --glass-border: 255 255 255;
  --glass-border-alpha: 0.6;
  --shadow-color: 15 23 42;

  --grid-line: 15 23 42;
  --grid-alpha: 0.04;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: 8 15 22;
  --surface: 15 25 36;
  --surface-2: 20 32 45;
  --fg: 228 236 240;
  --muted-fg: 148 163 184;
  --primary: 34 200 162;
  --primary-bright: 26 175 142;
  --primary-deep: 13 110 90;
  --on-primary: 4 26 20;
  --accent: 251 113 133;
  --accent-bright: 244 86 107;
  --cyan: 79 209 197;
  --muted: 28 40 56;
  --border: 33 46 66;
  --ring: 34 200 162;

  --glass-bg: 18 27 48;
  --glass-alpha: 0.55;
  --glass-border: 148 163 184;
  --glass-border-alpha: 0.18;
  --shadow-color: 0 0 0;

  --grid-line: 148 163 184;
  --grid-alpha: 0.06;

  color-scheme: dark;
}

/* ---------- Base ---------- */
* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background-color: rgb(var(--bg));
  color: rgb(var(--fg));
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .5s ease, color .5s ease;
}

h1, h2, h3, h4, .font-display {
  font-family: "Sora", "Inter", sans-serif;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.font-mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

::selection { background: rgb(var(--primary) / .22); color: rgb(var(--fg)); }

/* Custom scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: rgb(var(--bg)); }
::-webkit-scrollbar-thumb {
  background: rgb(var(--muted-fg) / .35);
  border-radius: 999px;
  border: 3px solid rgb(var(--bg));
}
::-webkit-scrollbar-thumb:hover { background: rgb(var(--primary) / .55); }

/* ---------- Layout helpers ---------- */
.container-mm { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 1.25rem; }
@media (min-width: 768px) { .container-mm { padding-inline: 2rem; } }

.section { position: relative; padding-block: clamp(4rem, 9vw, 8rem); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: .72rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: rgb(var(--primary));
  padding: .4rem .8rem;
  border: 1px solid rgb(var(--primary) / .22);
  border-radius: 999px;
  background: rgb(var(--primary) / .06);
}

.lead { color: rgb(var(--muted-fg)); font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.7; }

.text-balance { text-wrap: balance; }
.text-gradient {
  background: linear-gradient(100deg, rgb(var(--primary)) 0%, rgb(var(--cyan)) 55%, rgb(var(--accent-bright)) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Backgrounds & atmosphere ---------- */
.bg-grid {
  background-image:
    linear-gradient(rgb(var(--grid-line) / var(--grid-alpha)) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-line) / var(--grid-alpha)) 1px, transparent 1px);
  background-size: 56px 56px;
}
.bg-grid-mask { -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
                mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%); }

.mesh {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.mesh::before, .mesh::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55;
}
.mesh::before {
  width: 46rem; height: 46rem; top: -16rem; left: -10rem;
  background: radial-gradient(circle, rgb(var(--primary) / .55), transparent 62%);
}
.mesh::after {
  width: 40rem; height: 40rem; top: -10rem; right: -12rem;
  background: radial-gradient(circle, rgb(var(--cyan) / .42), transparent 62%);
}
[data-theme="dark"] .mesh::before { opacity: .42; }
[data-theme="dark"] .mesh::after { opacity: .38; }

.blob {
  position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0;
}

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .05; }

/* ---------- Glass surfaces ---------- */
.glass {
  background: rgb(var(--glass-bg) / var(--glass-alpha));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgb(var(--glass-border) / var(--glass-border-alpha));
  box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 20px 50px -28px rgb(var(--shadow-color) / .45);
}

.card {
  position: relative;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 1.25rem;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .35s ease;
}
.card:hover {
  transform: translateY(-6px);
  border-color: rgb(var(--primary) / .4);
  box-shadow: 0 30px 60px -32px rgb(var(--shadow-color) / .5);
}

/* Spotlight that follows cursor (set via JS: --mx, --my) */
.spotlight { position: relative; overflow: hidden; }
.spotlight::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; z-index: 0;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), rgb(var(--primary) / .14), transparent 70%);
}
.spotlight:hover::before { opacity: 1; }
.spotlight > * { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-weight: 600; font-size: .95rem; line-height: 1;
  padding: .95rem 1.5rem; border-radius: .85rem;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .3s ease, background-color .3s ease, color .3s ease, border-color .3s ease;
  will-change: transform;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(var(--ring) / .45); }
.btn-primary {
  background: rgb(var(--primary));
  color: rgb(var(--on-primary));
  box-shadow: 0 12px 26px -12px rgb(var(--primary) / .7);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 38px -14px rgb(var(--primary) / .85); filter: saturate(1.08); }

/* Logo wordmark */
.logo-word { font-family: "Baloo 2", "Sora", sans-serif; font-weight: 700; font-size: 1.4rem; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; }
.logo-marketer { background: linear-gradient(92deg, #1fb87e, #0fa8a0); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Full logo lockup (PNG image), theme-swapped */
.site-logo { height: 2.4rem; width: auto; display: block; }
@media (min-width: 1024px) { .site-logo { height: 2.7rem; } }
.logo-on-dark { display: none; }
[data-theme="dark"] .logo-on-light { display: none; }
[data-theme="dark"] .logo-on-dark { display: block; }
.btn-secondary {
  background: rgb(var(--surface));
  color: rgb(var(--fg));
  border-color: rgb(var(--border));
}
.btn-secondary:hover { transform: translateY(-2px); border-color: rgb(var(--primary) / .5); box-shadow: 0 16px 30px -20px rgb(var(--shadow-color) / .5); }
.btn-ghost { background: transparent; color: rgb(var(--fg)); }
.btn-ghost:hover { background: rgb(var(--muted) / .7); }
.btn-lg { padding: 1.1rem 1.9rem; font-size: 1rem; }
.btn-accent {
  background: linear-gradient(180deg, rgb(var(--accent-bright)), rgb(var(--accent)));
  color: #1a1206;
  box-shadow: 0 12px 26px -12px rgb(var(--accent) / .8);
}
.btn-accent:hover { transform: translateY(-2px); }

.link-arrow { display: inline-flex; align-items: center; gap: .4rem; color: rgb(var(--primary)); font-weight: 600; }
.link-arrow svg { transition: transform .3s ease; }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---------- Pills / chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem; border-radius: 999px;
  background: rgb(var(--muted) / .8); border: 1px solid rgb(var(--border));
  font-size: .85rem; font-weight: 500; color: rgb(var(--fg));
}

.tag-pass { color: rgb(16 185 129); background: rgb(16 185 129 / .12); border-color: rgb(16 185 129 / .3); }
.tag-fail { color: rgb(239 68 68); background: rgb(239 68 68 / .12); border-color: rgb(239 68 68 / .3); }

/* ---------- Navigation ---------- */
.nav-shell {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  transition: transform .4s ease;
}
.nav-bar {
  margin: .75rem auto 0; max-width: 1200px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem .8rem .7rem 1.1rem;
  border-radius: 1rem;
  transition: background-color .35s ease, box-shadow .35s ease, border-color .35s ease, backdrop-filter .35s;
  border: 1px solid transparent;
}
.nav-scrolled .nav-bar {
  background: rgb(var(--glass-bg) / .8);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-color: rgb(var(--glass-border) / var(--glass-border-alpha));
  box-shadow: 0 18px 40px -28px rgb(var(--shadow-color) / .5);
}
.nav-link {
  position: relative; font-size: .92rem; font-weight: 500; color: rgb(var(--muted-fg));
  padding: .5rem .2rem; transition: color .25s ease;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgb(var(--primary)), rgb(var(--cyan)));
  transition: right .3s ease;
}
.nav-link:hover { color: rgb(var(--fg)); }
.nav-link:hover::after, .nav-link[aria-current="page"]::after { right: 0; }
.nav-link[aria-current="page"] { color: rgb(var(--fg)); }

.theme-toggle {
  width: 42px; height: 42px; border-radius: .7rem; display: grid; place-items: center;
  border: 1px solid rgb(var(--border)); background: rgb(var(--surface)); cursor: pointer;
  color: rgb(var(--fg)); transition: transform .3s ease, border-color .3s ease;
}
.theme-toggle:hover { transform: rotate(15deg); border-color: rgb(var(--primary) / .5); }

/* Mobile menu */
.mobile-menu { max-height: 0; overflow: hidden; transition: max-height .45s cubic-bezier(.2,.7,.2,1); }
.mobile-menu.open { max-height: 30rem; }

/* ---------- Marquee ---------- */
.marquee { display: flex; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
           mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee__track { display: flex; flex-shrink: 0; gap: 3rem; padding-right: 3rem; animation: marquee 38s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee--rev .marquee__track { animation-direction: reverse; animation-duration: 46s; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* Logo strip (client + integration marquees), boxless + even height */
.marquee--logos .marquee__track { gap: 3rem; padding-right: 3rem; align-items: center; }
.logo-chip { flex: none; display: grid; place-items: center; }
.logo-chip img {
  height: 36px; width: auto; max-width: 210px; object-fit: contain;
  opacity: .85; transition: opacity .3s ease, filter .3s ease;
}
.logo-chip:hover img { opacity: 1; }
[data-theme="dark"] .logo-chip img { filter: brightness(0) invert(1); opacity: .82; }
[data-theme="dark"] .logo-chip:hover img { opacity: 1; }

/* Brand grid (static logo wall, boxed) */
.brand-box {
  display: grid; place-items: center;
  min-height: 96px; padding: 1rem 1.25rem;
  background: #ffffff;
  border: 1px solid rgb(15 23 42 / .07);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04);
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s ease, border-color .3s ease;
}
.brand-box:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -18px rgb(15 23 42 / .4); border-color: rgb(var(--primary) / .35); }
[data-theme="dark"] .brand-box { border-color: rgb(255 255 255 / .1); box-shadow: 0 2px 10px rgb(0 0 0 / .35); }
.brand-box img { max-height: 38px; max-width: 132px; width: auto; object-fit: contain; }

/* ---------- Counters / stats ---------- */
.stat-num { font-family: "JetBrains Mono", monospace; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- Reveal animation (JS adds .is-in) ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }
.reveal-d4 { transition-delay: .32s; }

/* ---------- Signal flow visual ---------- */
.signal-wrap { position: relative; }
.signal-dot { fill: rgb(var(--cyan)); }
.flow-path { stroke: rgb(var(--primary) / .25); stroke-width: 1.5; fill: none; }
.flow-path.active { stroke: rgb(var(--primary)); }

@keyframes pulse-ring {
  0% { transform: scale(.6); opacity: .8; }
  100% { transform: scale(2.4); opacity: 0; }
}
.pulse-ring { transform-origin: center; animation: pulse-ring 2.4s ease-out infinite; }

@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.float-y { animation: float-y 7s ease-in-out infinite; }

@keyframes dash { to { stroke-dashoffset: -1000; } }
.dashflow { stroke-dasharray: 6 10; animation: dash 22s linear infinite; }

/* ---------- Bento ---------- */
.bento { display: grid; gap: 1rem; grid-template-columns: repeat(6, 1fr); }
.bento > * { grid-column: span 6; }
@media (min-width: 768px) {
  .bento > .col-3 { grid-column: span 3; }
  .bento > .col-2 { grid-column: span 2; }
  .bento > .col-4 { grid-column: span 4; }
}

/* ---------- Accordion (FAQ) ---------- */
.acc-item { border-bottom: 1px solid rgb(var(--border)); }
.acc-trigger { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.35rem 0; cursor: pointer; font-weight: 600; font-size: 1.05rem; color: rgb(var(--fg)); }
.acc-icon { flex: none; transition: transform .35s ease; color: rgb(var(--primary)); }
.acc-item.open .acc-icon { transform: rotate(45deg); }
.acc-panel { overflow: hidden; max-height: 0; transition: max-height .4s cubic-bezier(.2,.7,.2,1); }
.acc-body { padding-bottom: 1.35rem; color: rgb(var(--muted-fg)); line-height: 1.7; }

/* ---------- Form ---------- */
.field-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .5rem; color: rgb(var(--fg)); }
.field {
  width: 100%; padding: .85rem 1rem; border-radius: .75rem;
  background: rgb(var(--surface)); border: 1px solid rgb(var(--border)); color: rgb(var(--fg));
  font-size: 1rem; transition: border-color .25s ease, box-shadow .25s ease;
}
.field::placeholder { color: rgb(var(--muted-fg) / .8); }
.field:focus { outline: none; border-color: rgb(var(--primary)); box-shadow: 0 0 0 3px rgb(var(--ring) / .25); }

/* Range slider */
input[type="range"].slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: rgb(var(--muted)); outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%;
  background: rgb(var(--primary)); cursor: pointer; border: 4px solid rgb(var(--surface));
  box-shadow: 0 4px 12px -2px rgb(var(--primary) / .7); transition: transform .2s ease;
}
input[type="range"].slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"].slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: rgb(var(--primary)); cursor: pointer;
  border: 4px solid rgb(var(--surface)); box-shadow: 0 4px 12px -2px rgb(var(--primary) / .7);
}

/* ---------- Misc ---------- */
.divider-line { height: 1px; background: linear-gradient(90deg, transparent, rgb(var(--border)), transparent); }
.kbd { font-family: "JetBrains Mono", monospace; font-size: .8rem; padding: .15rem .45rem; border-radius: .4rem; background: rgb(var(--muted)); border: 1px solid rgb(var(--border)); }

.hover-rise { transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.hover-rise:hover { transform: translateY(-4px); }

/* Number ticker readout in compare widget */
.readout { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .marquee__track, .pulse-ring, .float-y, .dashflow { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .card:hover, .btn:hover, .hover-rise:hover { transform: none !important; }
}

/* Page-load gate to avoid FOUC of reveals before JS */
.js-loading .reveal { opacity: 0; }
.no-js .reveal { opacity: 1; transform: none; }
