/* =====================================================================
   Shared chrome for every public page (landing, pricing, book demo, signup,
   resources and the guides): design tokens, the sticky header and the footer.

   Loaded on all pages with <body class="public-page ...">, after
   landing-unicorn.css, so one header/footer definition applies everywhere and
   the pages cannot drift apart again.

   Tokens: light is the base set, dark overrides it. theme-init.js always sets
   html[data-theme] before paint, so there is no flash.
   ===================================================================== */

/* ---------- 1a. Tokens: light (base) ---------- */
body.public-page {
  --ap-page: #f5f8ff;
  --ap-glow: radial-gradient(900px 520px at 88% -8%, rgba(37, 99, 235, 0.10), transparent 70%);
  --ap-card-bg: #ffffff;
  --ap-border: rgba(15, 23, 42, 0.10);
  --ap-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
  --ap-shadow-lift: 0 10px 28px rgba(15, 23, 42, 0.10);

  --ap-heading: #0b1220;
  --ap-body: #334155;
  --ap-muted: #5b6785;

  --ap-fill: rgba(15, 23, 42, 0.045);
  --ap-fill-strong: rgba(15, 23, 42, 0.08);
  --ap-line: rgba(15, 23, 42, 0.09);

  --ap-accent: #2563eb;
  --ap-accent-2: #3b82f6;
  /* Gradient used behind white text: both stops must pass 4.5:1 against white. */
  --ap-accent-grad: linear-gradient(135deg, #1d4ed8, #2563eb);
  --ap-accent-deep: #1d4ed8;
  --ap-link: #1d4ed8;
  --ap-tint: rgba(37, 99, 235, 0.08);
  --ap-tint-soft: rgba(37, 99, 235, 0.05);
  --ap-tint-line: rgba(37, 99, 235, 0.30);

  --ap-amber: #b45309;
  --ap-amber-tint: rgba(180, 83, 9, 0.10);
  --ap-green: #047857;
  --ap-green-solid: #10b981;

  --ap-nav-bg: rgba(255, 255, 255, 0.86);
  --ap-on-accent: #ffffff;
  --ap-ease: 170ms ease;
  --ap-radius-card: 16px;
  --ap-radius-btn: 12px;
  --ap-nav-h: 76px;

  --ap-toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
  --ap-check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* ---------- 1b. Tokens: dark ---------- */
html[data-theme="dark"] body.public-page {
  --ap-page: #070b1a;
  --ap-glow:
    radial-gradient(900px 520px at 88% -8%, rgba(37, 99, 235, 0.16), transparent 70%),
    radial-gradient(760px 480px at -6% 104%, rgba(139, 124, 255, 0.10), transparent 70%);
  --ap-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  --ap-border: rgba(255, 255, 255, 0.09);
  --ap-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --ap-shadow-lift: 0 14px 38px rgba(0, 0, 0, 0.45);

  --ap-heading: #eaf0ff;
  --ap-body: #c3ccea;
  --ap-muted: #8b97b8;

  --ap-fill: rgba(255, 255, 255, 0.05);
  --ap-fill-strong: rgba(255, 255, 255, 0.09);
  --ap-line: rgba(255, 255, 255, 0.09);

  --ap-link: #8fbaff;
  --ap-tint: rgba(37, 99, 235, 0.18);
  --ap-tint-soft: rgba(37, 99, 235, 0.10);
  --ap-tint-line: rgba(96, 165, 250, 0.42);

  --ap-amber: #fbbf24;
  --ap-amber-tint: rgba(251, 191, 36, 0.14);
  --ap-green: #34d399;

  --ap-nav-bg: rgba(7, 11, 26, 0.78);

  --ap-toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

/* ---------- 2. Header: identical on every public page ---------- */
body.public-page .ul-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--ap-border);
  border-radius: 0;
  background: var(--ap-nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

/* Same width rule as the landing page's .ul-container, so the bar spans the
   window identically on every page instead of being capped on some of them. */
body.public-page .ul-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: calc(100% - (var(--ul-edge-gap, 22px) * 2));
  max-width: none;
  height: var(--ap-nav-h);
  min-height: var(--ap-nav-h);
  margin: 0 auto;
  padding: 0;
}

/* landing-unicorn.css floats this same element as a rounded card (border, own
   background, drop shadow) on top of the header bar, so you see a box inside a
   box. Flatten it to one bar whose only edge is the header's bottom line. The
   second selector is needed to outweigh that file's html[data-theme="dark"]
   rule; the first covers the moment before theme-init.js sets the attribute. */
body.public-page .ul-header-inner,
html[data-theme] body.public-page .ul-header-inner {
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

/* Brand: the real logo on a rounded tile, plus the wordmark and subtitle. */
body.public-page .ul-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  text-decoration: none;
}

body.public-page .ul-brand-mark {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 11px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18);
}

body.public-page .ul-brand-copy {
  display: grid;
  gap: 1px;
  color: var(--ap-heading);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

body.public-page .ul-brand-copy small {
  color: var(--ap-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Centre links */
body.public-page .ul-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
}

body.public-page .ul-nav-link {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--ap-radius-btn);
  color: var(--ap-body);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ap-ease), color var(--ap-ease), border-color var(--ap-ease);
}

body.public-page .ul-nav-link:hover {
  background: var(--ap-fill);
  color: var(--ap-heading);
}

body.public-page .ul-nav-link.active,
body.public-page .ul-nav-link[aria-current="page"] {
  background: var(--ap-tint);
  border-color: var(--ap-tint-line);
  color: var(--ap-link);
  font-weight: 600;
}

/* Right-hand actions */
body.public-page .ul-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

body.public-page .ul-header-actions .ul-btn,
body.public-page .ul-theme-toggle.auth-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--ap-radius-btn);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ap-ease), border-color var(--ap-ease), filter var(--ap-ease);
}

/* Theme toggle: the label text is set by JS (textContent), so the icon comes
   from CSS rather than a child element. */
body.public-page .ul-theme-toggle.auth-theme-toggle {
  border: 1px solid var(--ap-border);
  background: var(--ap-card-bg);
  color: var(--ap-body);
  border-radius: 999px;
  cursor: pointer;
}

body.public-page .ul-theme-toggle.auth-theme-toggle::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--ap-toggle-icon) center / contain no-repeat;
  mask: var(--ap-toggle-icon) center / contain no-repeat;
}

body.public-page .ul-header-actions .ul-btn-ghost {
  border: 1px solid var(--ap-border);
  background: var(--ap-card-bg);
  color: var(--ap-heading);
}

body.public-page .ul-header-actions .ul-btn-ghost:hover {
  background: var(--ap-fill);
}

body.public-page .ul-header-actions .ul-btn-primary {
  border: 1px solid transparent;
  background: var(--ap-accent-grad);
  color: var(--ap-on-accent);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

body.public-page .ul-header-actions .ul-btn-primary:hover {
  filter: brightness(1.07);
}

/* Hamburger */
body.public-page .ul-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-btn);
  background: var(--ap-card-bg);
  cursor: pointer;
}

body.public-page .ul-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ap-heading);
}

body.public-page .ul-mobile-panel {
  display: grid;
  gap: 8px;
  width: calc(100% - (var(--ul-edge-gap, 22px) * 2));
  max-width: none;
  margin: 0 auto;
  padding: 12px 0 18px;
  border-top: 1px solid var(--ap-border);
  background: var(--ap-nav-bg);
}

body.public-page .ul-mobile-panel[hidden] {
  display: none;
}

body.public-page .ul-mobile-nav {
  display: grid;
  gap: 4px;
}

body.public-page .ul-mobile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- 3. Footer: identical on every public page ---------- */
/* Two markup variants exist: .footer (most pages) and .ul-footer (landing). */
body.public-page .footer,
body.public-page .ul-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: calc(100% - (var(--ul-edge-gap, 22px) * 2));
  max-width: none;
  margin: 0 auto;
  padding: 24px 0;
  color: var(--ap-muted);
  font-size: 14px;
  line-height: 1.6;
}

body.public-page .footer,
body.public-page .ul-footer {
  border-top: 1px solid var(--ap-border);
  background: none;
}

body.public-page .ul-footer {
  margin-top: 0;
  padding: 0;
}

body.public-page .footer a,
body.public-page .ul-footer a {
  color: var(--ap-muted);
  text-decoration: none;
}

body.public-page .footer a:hover,
body.public-page .ul-footer a:hover {
  color: var(--ap-link);
  text-decoration: underline;
}

body.public-page .footer-links,
body.public-page .ul-footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

body.public-page .footer-social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.public-page .footer-social-link svg {
  width: 16px;
  height: 16px;
}

/* ---------- 4. Focus + responsive ---------- */
body.public-page .ul-header a:focus-visible,
body.public-page .ul-header button:focus-visible,
body.public-page .footer a:focus-visible,
body.public-page .ul-footer a:focus-visible {
  outline: 2px solid var(--ap-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (max-width: 900px) {
  body.public-page .ul-header-inner {
    gap: 12px;
  }
  body.public-page .ul-header-actions {
    margin-left: auto;
    gap: 8px;
  }
  body.public-page .ul-nav {
    display: none;
  }
  body.public-page .ul-menu-toggle {
    display: inline-flex;
  }
  body.public-page .ul-header-actions .ul-login-desktop {
    display: none;
  }
}

@media (max-width: 600px) {
  body.public-page {
    --ap-nav-h: 68px;
  }
  body.public-page .ul-header {
    padding-top: 0;
  }
  body.public-page .ul-header-inner,
  html[data-theme] body.public-page .ul-header-inner {
    width: calc(100% - 32px);
    padding: 0;
  }
  body.public-page .ul-brand {
    gap: 8px;
    min-width: 0;
  }
  body.public-page .ul-brand-copy {
    display: grid;
    font-size: 20px;
  }
  body.public-page .ul-brand-copy small {
    display: none;
  }
  body.public-page .ul-menu-toggle,
  body.public-page .ul-theme-toggle.auth-theme-toggle {
    flex: 0 0 44px;
    border-radius: var(--ap-radius-btn);
    touch-action: manipulation;
  }
  body.public-page .ul-mobile-panel {
    width: calc(100% - 32px);
    max-height: calc(100dvh - var(--ap-nav-h));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* Keep the burger reachable: the trial button lives in the mobile panel, and
     the theme toggle becomes icon-only (its aria-label still names it). */
  body.public-page .ul-header-actions .ul-btn-primary {
    display: none;
  }
  body.public-page .ul-theme-toggle.auth-theme-toggle {
    display: inline-flex;
    width: 44px;
    padding: 0;
    font-size: 0;
  }
  body.public-page .ul-theme-toggle.auth-theme-toggle::before {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: currentColor;
  }
}

@media (max-width: 768px) {
  body.public-page .footer,
  body.public-page .ul-footer-inner {
    padding-top: 18px;
    padding-bottom: 18px;
  }
  body.public-page .ul-mobile-actions {
    grid-template-columns: 1fr;
  }
}
