/* ============================================================
   AdRelay — design tokens. No hardcoded colors outside :root.
   ============================================================ */
:root {
  /* palette — warm-charcoal base, single electric accent */
  --bg:            #0c0d10;
  --bg-elev:       #131419;
  --bg-elev-2:     #181a21;
  --line:          #23262f;
  --line-soft:     #1b1d24;
  --text:          #f2f3f5;
  --text-soft:     #aeb2bd;
  --text-mute:     #6f7480;
  --accent:        #6ee7a8;        /* signal green — "data flowing" */
  --accent-ink:    #052016;
  --accent-soft:   rgba(110,231,168,0.12);
  --accent-line:   rgba(110,231,168,0.30);
  --warn:          #f0b75f;
  --danger:        #ef6f6f;

  /* type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* fluid type scale */
  --fs-xs:   0.78rem;
  --fs-sm:   0.9rem;
  --fs-base: 1rem;
  --fs-md:   1.12rem;
  --fs-lg:   clamp(1.25rem, 1rem + 1.1vw, 1.6rem);
  --fs-xl:   clamp(1.7rem, 1.1rem + 2.6vw, 2.6rem);
  --fs-2xl:  clamp(2.5rem, 1.4rem + 4.8vw, 4.6rem);

  /* spacing scale */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --sp-9: 96px; --sp-10: 128px;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --maxw: 1120px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow:    0 18px 48px -22px rgba(0,0,0,0.8);
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ambient background grain + radial glow, GPU-friendly */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 78% -8%, var(--accent-soft), transparent 60%),
    radial-gradient(700px 480px at 8% 4%, rgba(110,231,168,0.05), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

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

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-5); position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--accent-line); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 600; letter-spacing: -0.02em; font-size: var(--fs-md); }
.brand .mark { width: 26px; height: 26px; }
.nav-links { display: flex; align-items: center; gap: var(--sp-6); }
.nav-links a { color: var(--text-soft); font-size: var(--fs-sm); transition: color .18s var(--ease); }
.nav-links a:hover { color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-sans); font-weight: 560; font-size: var(--fs-sm);
  padding: 11px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .16s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--accent) 88%, white); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text-mute); }

/* ---------- hero ---------- */
.hero { padding: clamp(64px, 9vw, 132px) 0 clamp(48px, 7vw, 88px); }
.hero h1 {
  font-size: var(--fs-2xl);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 620;
  max-width: 16ch;
  margin: var(--sp-5) 0 var(--sp-5);
}
.hero h1 .hl { color: var(--accent); }
.hero .lede { font-size: var(--fs-lg); color: var(--text-soft); max-width: 54ch; font-weight: 400; line-height: 1.5; }

/* signup form */
.signup { margin-top: var(--sp-7); max-width: 520px; }
.field-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.field {
  flex: 1 1 240px;
  display: flex; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 14px; min-height: 50px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-sans); font-size: var(--fs-md);
}
.field input::placeholder { color: var(--text-mute); }
.signup .btn-primary { min-height: 50px; padding-inline: 24px; }
.opts { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); flex-wrap: wrap; }
.opts select {
  flex: 1 1 200px; appearance: none;
  background: var(--bg-elev) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236f7480' stroke-width='1.5'/></svg>") no-repeat right 14px center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-soft); font-family: var(--font-sans); font-size: var(--fs-sm);
  padding: 12px 36px 12px 14px; cursor: pointer; min-height: 46px;
}
.opts select:focus { outline: none; border-color: var(--accent-line); }
.form-note { margin-top: var(--sp-4); color: var(--text-mute); font-size: var(--fs-sm); display: flex; align-items: center; gap: var(--sp-2); }
.form-msg { margin-top: var(--sp-4); font-size: var(--fs-sm); min-height: 1.2em; }
.form-msg.good { color: var(--accent); }
.form-msg.bad  { color: var(--danger); }

.count-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text-soft); margin-top: var(--sp-6);
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-elev);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---------- section shell ---------- */
section { position: relative; z-index: 1; }
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-head { max-width: 60ch; margin-bottom: var(--sp-8); }
.section-head h2 { font-size: var(--fs-xl); letter-spacing: -0.03em; line-height: 1.1; margin-top: var(--sp-4); font-weight: 600; }
.section-head p { color: var(--text-soft); font-size: var(--fs-md); margin-top: var(--sp-4); }

/* ---------- pain points ---------- */
.pains { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-5); }
.pain {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-6);
  position: relative; overflow: hidden;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.pain:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.pain .idx { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-mute); letter-spacing: 0.1em; }
.pain h3 { font-size: var(--fs-lg); margin: var(--sp-4) 0 var(--sp-3); letter-spacing: -0.02em; font-weight: 580; }
.pain p { color: var(--text-soft); font-size: var(--fs-base); }
.pain .tag { display: inline-block; margin-top: var(--sp-4); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--warn); border: 1px solid var(--line); padding: 4px 9px; border-radius: 6px; }

/* ---------- how it works ---------- */
.how { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: var(--sp-8); align-items: center; }
.steps { display: flex; flex-direction: column; gap: var(--sp-5); }
.step { display: flex; gap: var(--sp-4); }
.step .n {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-sm);
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.step h4 { font-size: var(--fs-md); font-weight: 560; margin-bottom: var(--sp-1); letter-spacing: -0.01em; }
.step p { color: var(--text-soft); font-size: var(--fs-sm); }

/* code card with equal aspect, scales cleanly */
.code-card {
  background: var(--bg-elev-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.code-bar { display: flex; align-items: center; gap: var(--sp-2); padding: 12px var(--sp-5); border-bottom: 1px solid var(--line); }
.code-bar .c { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.code-bar .file { margin-left: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-mute); }
.code-card pre { margin: 0; padding: var(--sp-5); overflow-x: auto; }
.code-card code { font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.75; color: var(--text-soft); white-space: pre; }
.code-card .k { color: var(--accent); }
.code-card .s { color: var(--warn); }
.code-card .c2 { color: var(--text-mute); }
.code-card .o { color: var(--text); }

/* ---------- platform / value strip ---------- */
.value { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.value .v { border-top: 1px solid var(--line); padding-top: var(--sp-5); }
.value .v .big { font-size: var(--fs-xl); font-weight: 620; letter-spacing: -0.03em; }
.value .v .lbl { color: var(--text-soft); font-size: var(--fs-sm); margin-top: var(--sp-2); }

/* ---------- CTA band ---------- */
.cta {
  border: 1px solid var(--accent-line); border-radius: var(--radius-lg);
  background:
    radial-gradient(700px 300px at 50% -40%, var(--accent-soft), transparent 70%),
    var(--bg-elev);
  padding: clamp(40px, 6vw, 72px); text-align: center;
}
.cta h2 { font-size: var(--fs-xl); letter-spacing: -0.03em; font-weight: 620; max-width: 22ch; margin: 0 auto var(--sp-4); }
.cta p { color: var(--text-soft); max-width: 50ch; margin: 0 auto var(--sp-6); }
.cta form { display: flex; gap: var(--sp-3); max-width: 460px; margin: 0 auto; flex-wrap: wrap; }
.cta .field { flex: 1 1 220px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line-soft); padding: var(--sp-7) 0; margin-top: var(--sp-8); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; color: var(--text-mute); font-size: var(--fs-sm); }
.footer .brand { font-size: var(--fs-base); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .pains { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; gap: var(--sp-7); }
  .value { grid-template-columns: 1fr; gap: var(--sp-4); }
  .nav-links a:not(.btn) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
