/* ============================================================
   LeadGen AI — Layout chrome
   Announce bar, navbar + mega menu, mesh + gridlines bg,
   bento grid, steps, footer, hero, logo row, CTA.
   ============================================================ */

/* ---------- ANNOUNCEMENT BAR ---------- */
.dx .announce {
  position: relative;
  z-index: 60;
  border-bottom: 1px solid var(--line);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}
.dx .announce-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 28px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  text-align: center;
}
.dx .announce a {
  color: var(--orange);
  border-bottom: 1px solid var(--orange-tint);
}
.dx .announce a:hover { border-color: var(--orange); }

/* Live "X claimed · Y left" pill — populated by navbar.js from
   /api/platform/pro-seats. Pulses gently while seats remain, flips to
   orange under 10, and to a static "sold out" badge at 0. */
.dx .announce-seats {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--success-tint);
  color: var(--success);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.dx .announce-seats [data-pro-claimed],
.dx .announce-seats [data-pro-remaining] { font-weight: 600; }
.dx .announce-seats .announce-sep { opacity: 0.55; }
.dx .announce-seats .announce-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: announce-pulse 1.8s ease-in-out infinite;
}
.dx .announce.almost-gone .announce-seats {
  background: var(--orange-tint);
  color: var(--orange);
}
.dx .announce.almost-gone .announce-seats .announce-dot {
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange-glow);
}
.dx .announce.sold-out .announce-seats {
  background: rgba(255, 77, 77, 0.12);
  color: var(--danger);
}
.dx .announce.sold-out .announce-seats .announce-dot {
  background: var(--danger);
  animation: none;
  box-shadow: none;
}
@keyframes announce-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
@media (max-width: 720px) {
  .dx .announce-inner { gap: 10px; flex-wrap: wrap; }
}

/* ---------- NAV ---------- */
.dx .nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: transparent;
  transition: background 200ms var(--ease), border-color 200ms var(--ease),
              backdrop-filter 200ms var(--ease);
  border-bottom: 1px solid transparent;
}
.dx .nav.scrolled {
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--line);
}
.dx.light .nav.scrolled,
.dx[data-theme="light"] .nav.scrolled {
  background: rgba(250, 250, 249, 0.78);
}
.dx .nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  height: 100%;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.dx .nav-logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.dx .nav-logo-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--orange), var(--violet));
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05) inset;
}
.dx .nav-links {
  display: flex; align-items: center; gap: 4px;
  justify-self: center;
}
.dx .nav-link {
  position: relative;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--fg-muted);
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  transition: color 160ms var(--ease);
}
.dx .nav-link:hover { color: var(--fg); }
/* Active-link indicator — orange dot under the label so the current
   route is obvious at a glance (the old `color: var(--fg)` alone was
   indistinguishable from a casual hover). */
.dx .nav-link.active { color: var(--fg); }
.dx .nav-link.active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 2px;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange-glow);
}
.dx .nav-actions { display: flex; align-items: center; gap: 8px; justify-self: end; }

/* ---------- MEGA MENU ---------- */
.dx .mega {
  position: absolute;
  top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: min(720px, 92vw);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: 0 32px 64px -16px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  /* Hover-out GRACE PERIOD ── 200ms before the mega starts fading
     out and 200ms before it loses pointer-events. That delay gives
     the cursor time to cross the 8px gap below the trigger and
     land on a menu item without the menu closing under it. When the
     cursor reaches the mega, its descendants trigger ancestor :hover
     and the rule below cancels these delays (transition-delay: 0s). */
  transition:
    opacity        180ms var(--ease) 200ms,
    transform      180ms var(--ease) 200ms,
    pointer-events    0s              200ms;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
  z-index: 80;
}
/* Invisible "bridge" over the 8px visual gap between trigger and
   menu. Because this pseudo-element is a descendant of .mega which
   is a descendant of .nav-link.has-mega, hovering it propagates
   :hover up the ancestor chain and keeps the menu open during the
   traversal. `pointer-events: auto` overrides the parent's `none`
   while closed so the bridge still captures the mouse. */
.dx .nav-link.has-mega .mega::before {
  content: '';
  position: absolute;
  top: -14px; left: 0; right: 0;
  height: 14px;
  pointer-events: auto;
}
.dx .nav-link.has-mega:hover .mega,
.dx .nav-link.has-mega:focus-within .mega,
.dx .nav-link.has-mega.open .mega {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  /* No grace delay on OPEN — react instantly to hover-in. */
  transition-delay: 0s;
}
/* When click-to-pinned via JS, give the trigger a subtle indicator
   so users can tell the menu will stay open until they click out.
   Caret rotation also follows the menu state on hover / focus so the
   visual stays in sync with the panel (it used to only rotate on the
   click-pinned `.open` state, leaving the caret flat while hover
   already opened the panel — a visible inconsistency). */
.dx .nav-link.has-mega.open,
.dx .nav-link.has-mega:hover,
.dx .nav-link.has-mega:focus-within { color: var(--fg); }
.dx .nav-link.has-mega.open > svg,
.dx .nav-link.has-mega:hover > svg,
.dx .nav-link.has-mega:focus-within > svg { transform: rotate(180deg); }
.dx .nav-link.has-mega > svg {
  transition: transform 200ms var(--ease);
}
.dx .mega-section {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 12px 10px 6px;
}
.dx .mega-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px;
  border-radius: 8px;
  transition: background 140ms var(--ease);
}
.dx .mega-item:hover { background: var(--bg-elev-2); }
.dx .mega-item-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  color: var(--fg-muted);
}
.dx .mega-item:hover .mega-item-icon { color: var(--orange); border-color: var(--orange-tint); }
.dx .mega-item-title { font-size: 13px; color: var(--fg); font-weight: 500; }
.dx .mega-item-desc  { font-size: 12px; color: var(--fg-dim); margin-top: 2px; line-height: 1.4; }

/* ---------- HERO MESH ----------
   Two-layer animation: the whole mesh slowly drifts (dx-mesh) AND
   the orange aura breathes in and out (dx-breathe) so the page
   feels alive instead of statically gradient-painted. */
.dx .mesh {
  position: absolute; inset: -10% -10% auto -10%;
  height: 90%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 60% at 18% 20%, var(--mesh-orange) 0%, transparent 60%),
    radial-gradient(50% 50% at 82% 12%, var(--mesh-violet) 0%, transparent 60%),
    radial-gradient(40% 40% at 50% 80%, var(--mesh-orange) 0%, transparent 60%);
  filter: blur(40px);
  opacity: 0.9;
  animation:
    dx-mesh    18s ease-in-out infinite alternate,
    dx-breathe  6s ease-in-out infinite;
}

/* ---------- GRID LINES (subtle bg pattern) ---------- */
.dx .gridlines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at top, rgba(0,0,0,0.4), transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at top, rgba(0,0,0,0.4), transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- BENTO ---------- */
.dx .bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(160px, auto);
  gap: 12px;
}
.dx .bento > .b {
  position: relative;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  overflow: hidden;
  transition: border-color 200ms var(--ease), transform 240ms var(--ease);
}
.dx .bento > .b:hover {
  border-color: var(--line-bright);
  transform: translateY(-2px);
}
.dx .bento .b-wide  { grid-column: span 4; grid-row: span 2; }
.dx .bento .b-tall  { grid-column: span 2; grid-row: span 2; }
.dx .bento .b-half  { grid-column: span 3; }
.dx .bento .b-third { grid-column: span 2; }
.dx .bento .b-quart { grid-column: span 3; }

.dx .b-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 12px;
}
.dx .b-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.dx .b-body { color: var(--fg-muted); font-size: 14px; line-height: 1.55; }

@media (max-width: 900px) {
  .dx .bento { grid-template-columns: repeat(2, 1fr); }
  .dx .bento .b-wide, .dx .bento .b-tall, .dx .bento .b-half,
  .dx .bento .b-third, .dx .bento .b-quart {
    grid-column: span 2; grid-row: auto;
  }
}

/* ---------- STEPS ---------- */
.dx .steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.dx .step {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 240px;
  position: relative;
}
.dx .step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
}
.dx .step-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.dx .step-body  { color: var(--fg-muted); font-size: 14px; }
.dx .step-art {
  margin-top: auto;
  height: 80px;
  border-radius: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}
@media (max-width: 900px) { .dx .steps { grid-template-columns: 1fr; } }

/* ---------- HERO LAYOUT ---------- */
.dx .hero {
  position: relative;
  padding: 96px 0 120px;
  overflow: hidden;
}
.dx .hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 980px) {
  .dx .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .dx .hero { padding: 56px 0 80px; }
}

/* ---------- LOGO ROW ---------- */
.dx .logo-row {
  display: flex; align-items: center; gap: 40px; flex-wrap: wrap;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.dx .logo-row .logo-item {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg-dim);
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 200ms var(--ease);
}
.dx .logo-row .logo-item:hover { color: var(--fg); }
.dx .logo-row .logo-item svg { width: 18px; height: 18px; }

/* ---------- CTA SECTION ---------- */
.dx .cta {
  position: relative;
  margin: 0;
  padding: 96px 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(50% 80% at 50% 50%, rgba(255,92,26,0.18) 0%, transparent 70%),
    radial-gradient(40% 60% at 20% 30%, rgba(124,58,237,0.16) 0%, transparent 70%),
    var(--bg-inset);
}
.dx .cta-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  position: relative; z-index: 1;
  padding: 0 28px;
}

/* ---------- FOOTER ---------- */
.dx .footer {
  border-top: 1px solid var(--line);
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(255,92,26,0.04) 0%, transparent 60%),
    var(--bg);
  padding: 80px 0 32px;
  font-size: 14px;
}
.dx .footer-grid {
  display: grid;
  /* Brand column slightly wider to fit the tagline + newsletter form;
     the four nav columns sit on equal 1fr tracks so labels align cleanly. */
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1.4fr;
  gap: 32px 28px;
  align-items: start;
}
.dx .footer-col { min-width: 0; }
.dx .footer-col .nav-logo-img { height: 24px; }
.dx .footer-col h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 16px;
  font-weight: 500;
}
.dx .footer-col a {
  display: block;
  padding: 5px 0;
  color: var(--fg-muted);
  font-size: 13.5px;
  transition: color 160ms var(--ease);
}
.dx .footer-col a:hover { color: var(--fg); }

/* ── Auth-aware footer + navbar links ──────────────────────────
   Default state = signed out. The .user-authed class on <html> is
   set synchronously by the theme-boot inline script in api.py based
   on whether localStorage.user has an api_key, so the right set of
   links renders on the first paint — no flash. Pattern is shared
   between footer (block links) and navbar (inline-flex buttons). */
.dx .footer  [data-when="signed-in"]              { display: none; }
.dx.user-authed .footer  [data-when="signed-in"]  { display: block; }
.dx.user-authed .footer  [data-when="signed-out"] { display: none; }

.dx .nav-actions [data-when="signed-in"]              { display: none; }
.dx.user-authed .nav-actions [data-when="signed-in"]  { display: inline-flex; }
.dx.user-authed .nav-actions [data-when="signed-out"] { display: none; }

/* ── Tier-aware copy ────────────────────────────────────────
   .tier-only-{starter|pro|gold} spans are stamped on pages
   where the same UI surface needs different copy per tier (e.g.
   the homepage "tier active" badge). <html data-tier> is set
   synchronously by the theme-boot inline script in api.py and
   kept in sync by core.js applyAuthState(), so the right copy
   renders on first paint — no flash, no race. Fallback when no
   data-tier is set yet: show the starter variant. */
.tier-only { display: none; }
html:not([data-tier]) .tier-only-starter,
html[data-tier="starter"] .tier-only-starter,
html[data-tier="pro"] .tier-only-pro,
html[data-tier="gold"] .tier-only-gold { display: inline; }
.dx .footer-col p,
.dx .footer-col form { margin: 0; }
.dx .footer-col form { margin-top: 4px; }
.dx .footer-bottom {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  color: var(--fg-dim);
  font-size: 12.5px;
  font-family: var(--font-mono);
}
.dx .status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--success-tint);
  color: var(--success);
  border-radius: 100px;
  font-size: 11.5px;
}
.dx .status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
/* Footer theme switcher — two segmented icon buttons (sun = light,
   moon = dark) grouped next to the © line. Click handling lives in
   /static/js/theme-float.js (delegated on [data-theme-set]); active
   button is reflected via aria-pressed="true". */
.dx .footer-bottom-left {
  display: inline-flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.dx .footer-theme-switch {
  display: inline-flex; align-items: center;
  padding: 2px;
  background: var(--bg-dim, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.dx .footer-theme-btn {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  padding: 0;
  background: transparent;
  color: var(--fg-dim);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms cubic-bezier(0.16,1,0.3,1),
              background 160ms cubic-bezier(0.16,1,0.3,1);
}
.dx .footer-theme-btn svg { width: 14px; height: 14px; pointer-events: none; }
.dx .footer-theme-btn:hover { color: var(--fg); }
.dx .footer-theme-btn[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}
.dx .footer-theme-btn:focus-visible {
  outline: 2px solid var(--accent, var(--fg));
  outline-offset: 2px;
}
@media (max-width: 1100px) {
  .dx .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px 24px;
  }
  /* On medium screens, the brand + newsletter column wraps under the rest */
  .dx .footer-grid > .footer-col:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    padding-top: 24px;
    margin-top: 8px;
    max-width: 480px;
  }
}
@media (max-width: 700px) {
  .dx .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
  .dx .footer-grid > .footer-col:first-child { grid-column: 1 / -1; }
  .dx .footer-grid > .footer-col:last-child  { grid-column: 1 / -1; }
}

/* ---------- MOBILE NAV BEHAVIOR ---------- */
@media (max-width: 900px) {
  .dx .nav-links { display: none; }
  .dx .nav-burger { display: inline-flex; }
  .dx .nav-actions .btn-secondary { display: none; }
  .dx .nav-inner { grid-template-columns: 1fr auto; }

  /* Burger-open full-screen overlay menu */
  .dx .nav-links.mobile-open {
    display: flex; flex-direction: column;
    position: fixed; inset: var(--nav-h) 0 0 0;
    background: var(--bg);
    padding: 24px 28px;
    gap: 4px;
    z-index: 70;
    align-items: stretch;
  }
  .dx .nav-links.mobile-open .nav-link {
    padding: 14px 12px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
}
