/* ============================================================
   TrafficCore — landing layout & components
   ============================================================ */

/* ---- background canvas (fixed, scroll-reactive) ---- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.page { position: relative; z-index: 1; }

/* ---- scroll-morph stage ---- */
.scrolly { position: relative; height: 420vh; }
.scrolly-sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; }
#morph-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scrolly-overlay { position: absolute; inset: 0; display: flex; align-items: center; }
.scrolly-overlay .wrap { width: 100%; }
.phase {
  position: absolute; top: 50%; left: var(--gut);
  width: min(560px, calc(100% - 2 * var(--gut)));
  opacity: 0; transform: translateY(calc(-50% + 26px));
  transition: opacity .6s var(--ease), transform .7s var(--ease-out); pointer-events: none;
}
.phase.on { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
.phase .eyebrow { margin-bottom: 16px; }
.phase h1 { font-size: clamp(38px, 5.2vw, 66px); letter-spacing: -0.035em; }
.phase h1 .grad {
  background: linear-gradient(100deg, var(--accent), color-mix(in oklch, var(--accent) 55%, #7c5cfc));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.phase h2 { font-size: clamp(30px, 4.4vw, 52px); letter-spacing: -0.03em; max-width: 13ch; }
.phase .lede { font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); max-width: 42ch; margin-top: 22px; }
.phase-badge {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 8px 7px 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-2); box-shadow: var(--shadow-1); margin-bottom: 26px;
}
.phase-badge b { color: var(--ink); font-weight: 580; }
.phase-badge .pill { font-size: 11px; font-weight: 620; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.phase-cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.phase-meta { display: flex; gap: 28px; margin-top: 36px; flex-wrap: wrap; }
.phase-meta .m-num { font-size: 25px; font-weight: 660; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.phase-meta .m-lab { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.phase .pipe { display: flex; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); }
.phase .pipe b { color: var(--accent); font-weight: 600; }
.phase .pipe .arr { color: var(--ink-3); }

.scrolly-bar-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--line); z-index: 3; }
#scrolly-bar { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.scroll-hint { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-3);
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.scroll-hint .mouse { width: 22px; height: 34px; border: 1.6px solid var(--ink-3); border-radius: 12px; position: relative; }
.scroll-hint .mouse::after { content: ""; position: absolute; top: 6px; left: 50%; width: 3px; height: 6px;
  border-radius: 2px; background: var(--ink-3); transform: translateX(-50%); animation: wheel 1.6s var(--ease) infinite; }
@keyframes wheel { 0%{opacity:0;transform:translate(-50%,0)} 40%{opacity:1} 100%{opacity:0;transform:translate(-50%,10px)} }

@media (max-width: 760px){
  .scrolly { height: 360vh; }
  .scrolly-overlay { align-items: flex-end; }
  .phase { width: auto; left: var(--gut); right: var(--gut); top: auto; bottom: 64px;
    text-align: center; transform: translateY(20px); }
  .phase.on { transform: none; }
  .phase .lede, .phase h2 { margin-inline: auto; }
  .phase-cta, .phase-meta, .phase .pipe { justify-content: center; }
  .scroll-hint { display: none; }
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gut); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 22px; border-radius: 999px;
  font-size: 15px; font-weight: 560; letter-spacing: -0.01em;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .18s var(--ease), background .2s, box-shadow .25s, border-color .2s, color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 6px 18px -6px var(--accent-glow); }
.btn-primary:hover { box-shadow: 0 2px 6px rgba(0,0,0,.16), 0 12px 30px -8px var(--accent-glow);
  transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink-3); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 54px; padding: 0 28px; font-size: 16.5px; }

/* ---- nav ---- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 68px; display: flex; align-items: center;
  transition: background .35s var(--ease), border-color .35s, backdrop-filter .35s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom-color: var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 24px; width: 100%; max-width: none; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 680;
  font-size: 18px; letter-spacing: -0.03em; margin-right: 4px; flex: none; white-space: nowrap; }
.brand .glyph { width: 26px; height: 26px; flex: none; }
.nav-links { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.nav-links a {
  font-size: 14.5px; font-weight: 480; color: var(--ink-2); white-space: nowrap;
  padding: 8px 12px; border-radius: 9px; transition: color .15s, background .15s; line-height: 1;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; white-space: nowrap; }

.theme-btn {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--line-2); color: var(--ink-2);
  transition: background .2s, color .2s, border-color .2s, transform .3s var(--ease);
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-btn .i-moon { display: block; }
}
@media (max-width: 1080px){ .nav-links a { padding: 8px 9px; font-size: 14px; } }
@media (max-width: 920px){ .nav-links { display: none; } }
@media (max-width: 460px){ .nav-right .btn-ghost { display: none; } }

/* ---- generic section ---- */
section { position: relative; }
.sec-pad { padding-block: clamp(72px, 11vh, 132px); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 580; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px;
}
.eyebrow::before { content: ""; width: 18px; height: 1.5px; background: var(--accent-line); }
.sec-head h2 { font-size: clamp(30px, 4vw, 46px); max-width: 16ch; }
.sec-head p { color: var(--ink-2); font-size: clamp(17px, 1.4vw, 19px); max-width: 54ch; margin-top: 16px; }

/* ---- HERO ---- */
.hero { padding-top: 150px; padding-bottom: clamp(60px,9vh,110px); min-height: 100svh;
  display: flex; align-items: center; }
.hero-inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; width: 100%; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 8px 7px 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-2); box-shadow: var(--shadow-1); margin-bottom: 26px;
}
.hero-badge b { color: var(--ink); font-weight: 580; }
.hero-badge .pill { font-size: 11px; font-weight: 620; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.hero h1 { font-size: clamp(40px, 5.6vw, 70px); letter-spacing: -0.035em; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), color-mix(in oklch, var(--accent) 55%, #7c5cfc));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); max-width: 46ch; margin-top: 24px; }
.hero-cta { display: flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 26px; margin-top: 38px; flex-wrap: wrap; }
.hero-meta .m-num { font-size: 26px; font-weight: 660; letter-spacing: -0.03em; }
.hero-meta .m-lab { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* hero canvas mount (in-flow visual) */
.hero-visual { position: relative; aspect-ratio: 1/1; width: 100%; }
.hero-visual canvas { width: 100%; height: 100%; display: block; }
.hero-visual .hv-caption {
  position: absolute; left: 0; bottom: 4px; font-size: 12.5px; color: var(--ink-3);
  font-family: var(--font-mono); letter-spacing: -0.02em;
}

/* ---- stats ticker ---- */
.stats { border-block: 1px solid var(--line); background: var(--bg-2); }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); }
.stat { padding: 40px 28px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat .s-num { font-size: clamp(32px, 4vw, 50px); font-weight: 680; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 2px; }
.stat .s-suf { color: var(--accent); }
.stat .s-lab { color: var(--ink-2); font-size: 14.5px; margin-top: 8px; }
@media (max-width: 820px){ .stats-grid { grid-template-columns: repeat(2,1fr); }
  .stat:nth-child(2){border-right:0} .stat:nth-child(1),.stat:nth-child(2){border-bottom:1px solid var(--line)} }

/* ---- flow (how it works) ---- */
.flow-stage { position: relative; margin-top: 56px; border-radius: var(--r-xl);
  border: 1px solid var(--line); background:
    linear-gradient(var(--surface), var(--surface));
  box-shadow: var(--shadow-2); overflow: hidden; }
.flow-stage::before { content:""; position:absolute; inset:0;
  background-image: radial-gradient(var(--grid-line) 1px, transparent 1px);
  background-size: 26px 26px; opacity:.5; mask-image: radial-gradient(120% 100% at 50% 0,#000,transparent 78%); }
.flow-canvas { position: relative; display: block; width: 100%; height: 380px; }
.flow-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-top: 30px; }
.flow-step { padding: 22px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); transition: transform .5s var(--ease-out), opacity .5s, border-color .3s; }
.flow-step .fs-k { font-family: var(--font-mono); font-size: 12px; color: var(--accent); font-weight: 600; }
.flow-step h4 { font-size: 19px; margin: 10px 0 7px; }
.flow-step p { font-size: 14.5px; color: var(--ink-2); }

/* reveal util */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"]{transition-delay:.08s} .reveal[data-d="2"]{transition-delay:.16s}
.reveal[data-d="3"]{transition-delay:.24s} .reveal[data-d="4"]{transition-delay:.32s}

/* ---- features grid ---- */
.feat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-top: 52px; }
.feat {
  padding: 28px; border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: transform .3s var(--ease), box-shadow .3s, border-color .3s;
}
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.feat .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px; }
.feat .ic svg { width: 22px; height: 22px; }
.feat h3 { font-size: 19px; }
.feat p { color: var(--ink-2); font-size: 14.8px; margin-top: 9px; }
.feat .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.feat .tag { font-size: 12px; font-family: var(--font-mono); color: var(--ink-3);
  padding: 4px 9px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.feat.wide { grid-column: span 2; }
@media (max-width: 920px){ .feat-grid{grid-template-columns:1fr 1fr} .feat.wide{grid-column:span 2} }
@media (max-width: 620px){ .feat-grid{grid-template-columns:1fr} .feat.wide{grid-column:auto} }

/* ---- pinned product showcase ---- */
.showcase { position: relative; }
.showcase-track { position: relative; height: 380vh; }
.showcase-sticky { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; overflow: hidden; }
.sc-inner { display: grid; grid-template-columns: .82fr 1.18fr; gap: 48px; align-items: center; width: 100%; }
.sc-copy { position: relative; }
.sc-steps { display: flex; flex-direction: column; gap: 6px; margin-top: 26px; }
.sc-item { padding: 16px 18px; border-radius: var(--r-md); border: 1px solid transparent; cursor: default;
  transition: background .35s var(--ease), border-color .35s; }
.sc-item .si-k { display:flex; align-items:center; gap:10px; font-size: 13px; color: var(--ink-3); font-family: var(--font-mono); }
.sc-item h4 { font-size: 19px; margin: 7px 0 0; color: var(--ink-2); transition: color .3s; }
.sc-item p { font-size: 14px; color: var(--ink-3); margin-top: 6px; max-height: 0; overflow: hidden;
  opacity: 0; transition: max-height .4s var(--ease), opacity .35s, margin .4s; }
.sc-item.active { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); }
.sc-item.active h4 { color: var(--ink); }
.sc-item.active p { max-height: 80px; opacity: 1; }
.sc-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); transition: background .3s, box-shadow .3s; }
.sc-item.active .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.sc-screens { position: relative; aspect-ratio: 16/10.4; }
.sc-screen { position: absolute; inset: 0; opacity: 0; transform: translateY(26px) scale(.985);
  transition: opacity .55s var(--ease-out), transform .55s var(--ease-out); pointer-events: none; }
.sc-screen.active { opacity: 1; transform: none; }

@media (max-width: 940px){
  .sc-inner{ grid-template-columns: 1fr; gap: 26px; }
  .showcase-track{ height: auto; }
  .showcase-sticky{ position: static; height: auto; padding-block: 80px; }
  .sc-screens{ margin-top: 8px; }
}

/* ---- payout models ---- */
.models { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-top: 50px; }
.model { padding: 24px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); position: relative; overflow: hidden; }
.model.feat-on { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow-2); }
.model .m-tag { font-family: var(--font-mono); font-size: 12px; color: var(--accent); font-weight: 600; }
.model h4 { font-size: 22px; margin: 10px 0 8px; }
.model p { font-size: 14px; color: var(--ink-2); }
.model .m-ex { margin-top: 16px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3);
  padding-top: 14px; border-top: 1px dashed var(--line-2); }
@media (max-width:900px){ .models{grid-template-columns:1fr 1fr} }
@media (max-width:560px){ .models{grid-template-columns:1fr} }

/* ---- integrations / postback strip ---- */
.integr { display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; }
.code-card { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-2);
  background: var(--surface); }
.code-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); }
.code-bar .dots { display: flex; gap: 6px; }
.code-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.code-bar .ttl { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); margin-left: 6px; }
.code-body { padding: 18px 18px 20px; font-family: var(--font-mono); font-size: 13px; line-height: 1.85;
  color: var(--ink-2); overflow-x: auto; }
.code-body .ln { white-space: pre; }
.code-body .k { color: var(--accent); }
.code-body .s { color: color-mix(in oklch, #1f8a5b 70%, var(--ink)); }
.code-body .c { color: var(--ink-3); }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip { font-size: 13px; padding: 8px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-2); }
@media (max-width: 880px){ .integr{ grid-template-columns: 1fr; gap: 30px; } }

/* ---- final CTA ---- */
.cta-final { position: relative; overflow: hidden; border-radius: var(--r-xl); margin-block: 30px;
  padding: clamp(48px,7vw,90px); text-align: center; border: 1px solid var(--accent-line);
  background:
    radial-gradient(120% 140% at 50% -20%, var(--accent-soft), transparent 60%),
    var(--surface); box-shadow: var(--shadow-2); }
.cta-final h2 { font-size: clamp(30px,4.2vw,50px); max-width: 18ch; margin: 0 auto; }
.cta-final p { color: var(--ink-2); font-size: 18px; margin: 18px auto 0; max-width: 50ch; }
.cta-final .hero-cta { justify-content: center; margin-top: 34px; }

/* ---- footer ---- */
.foot { border-top: 1px solid var(--line); margin-top: 30px; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding-block: 56px 36px; }
.foot h5 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 0 14px; font-weight: 600; }
.foot a { display: block; color: var(--ink-2); font-size: 14.5px; padding: 5px 0; transition: color .15s; }
.foot a:hover { color: var(--ink); }
.foot .desc { color: var(--ink-2); font-size: 14.5px; max-width: 30ch; margin-top: 14px; }
.foot-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 22px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13.5px; }
@media (max-width: 760px){ .foot-grid{ grid-template-columns: 1fr 1fr; } }

/* ---- responsive hero ---- */
@media (max-width: 940px){
  .hero-inner{ grid-template-columns: 1fr; gap: 30px; }
  .hero-visual{ order: -1; max-width: 460px; margin-inline: auto; }
  .hero{ padding-top: 120px; min-height: auto; }
}

/* mini-UI mock primitives (for product screens) */
.mock { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.mock-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); }
.mock-top .mt-dots{ display:flex; gap:6px } .mock-top .mt-dots i{ width:10px;height:10px;border-radius:50%;background:var(--line-2) }
.mock-top .mt-title{ font-size:13px; font-weight:560; color: var(--ink-2); }
.mock-top .mt-right{ margin-left:auto; display:flex; gap:8px; align-items:center }
.mock-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.kpi { padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg); }
.kpi .kl{ font-size:11.5px; color: var(--ink-3) } .kpi .kv{ font-size:21px; font-weight:660; margin-top:4px; font-variant-numeric:tabular-nums }
.kpi .kd{ font-size:11px; margin-top:3px } .kpi .up{ color:#1f9d57 } .kpi .down{ color:#d4604f }
.chart { flex:1; min-height: 120px; border-radius: var(--r-md); border:1px solid var(--line); background: var(--bg);
  position: relative; overflow:hidden; }
.t-row{ display:grid; gap:10px; padding:11px 14px; align-items:center; border-bottom:1px solid var(--line); font-size:13px }
.t-row.head{ color: var(--ink-3); font-size:11.5px; text-transform:uppercase; letter-spacing:.03em; font-weight:600 }
.badge{ font-size:11px; font-family:var(--font-mono); padding:3px 8px; border-radius:6px; font-weight:600 }
.badge.ok{ background: color-mix(in oklch,#1f9d57 18%,transparent); color:#1f9d57 }
.badge.pause{ background: var(--accent-soft); color: var(--accent) }
.badge.warn{ background: color-mix(in oklch,#d4904f 20%,transparent); color:#c47a32 }
.mini-mono{ font-family:var(--font-mono); font-size:12.5px }
