/* ============================================================================
   site-chrome.css — the ONE stylesheet for shared site chrome: nav header,
   theme toggle, footer, the email-capture panel, and the button system those
   use. Linked by index.html, faq.html, benchmark.html (and any future page).

   CASCADE CONTRACT: this sheet is linked in <head> BEFORE each page's own
   inline <style>. So a page's surviving inline rule always wins a tie — this
   sheet can only FILL IN chrome rules a page no longer defines, never clobber
   a page-specific override. That ordering is what makes the de-duplication
   safe.

   Design tokens (:root / [data-theme]) deliberately stay in each page's inline
   <style> — CSS custom properties resolve by inheritance at use-time, not by
   stylesheet source order, so the var(--…) references below resolve fine
   against whatever each page defines. Values here mirror index.html (the
   canonical page); minor pre-existing drift on the sub-pages (nav bg opacity,
   nav max-width) is intentionally unified to index's values.
   ============================================================================ */

/* ========= NAV (sticky, frosted) =========
   Default = sub-page behavior: sticky + always visible (faq, benchmark, future
   pages with no hero). index.html owns a hero brand mark (#siteHeader); the
   `body:has(#siteHeader)` block below upgrades it to the fixed,
   hidden-until-scroll-past-hero nav. */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,250,247,0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}
[data-theme="dark"] .site-nav { background: rgba(12,13,15,0.78); }

/* index.html only: nav hides until the visitor scrolls past the hero logo.
   The IntersectionObserver in site-chrome.js toggles `.is-visible`. */
body:has(#siteHeader) .site-nav {
  position: fixed; left: 0; right: 0;
  transform: translateY(-110%);
  opacity: 0;
  transition: transform 280ms cubic-bezier(0.2, 0, 0.2, 1), opacity 220ms ease;
}
body:has(#siteHeader) .site-nav.is-visible { transform: translateY(0); opacity: 1; }

.nav-inner {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; margin: 0 auto;
  padding: 0.75rem 1.5rem;
  gap: 1.5rem;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.625rem;
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700;
  text-decoration: none; color: var(--text-primary);
  letter-spacing: -0.01em;
}
.nav-brand .nav-icon {
  width: 30px; height: 30px;
  flex-shrink: 0;
  display: block;
  /* PNG already includes baked-in rounded corners and Apple-spec shadow */
}
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a {
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 150ms ease;
}
.nav-links a:hover, .nav-links a.current { color: var(--text-primary); }
.nav-links a.current { font-weight: 600; }
.nav-cta { position: relative; display: flex; align-items: center; gap: 0.875rem; }
.nav-cta .ghost { font-size: 0.875rem; font-weight: 600; color: var(--color-primary-base); text-decoration: none; }
.nav-cta .ghost:hover { color: var(--color-primary-hover); }
/* Dual-tier nav pills (surface both plans up top) */
.nav-plan .np-unit { font-weight: 500; opacity: 0.85; font-size: 0.92em; margin-left: 0.15rem; }
@media (max-width: 760px) { .nav-links { display: none; } }
@media (max-width: 760px) { .nav-plan-ent { display: none; } }
/* On narrow phones, the Download ghost link crowds the Buy pill into a 2-line
   wrap. Drop it; the pill is the primary CTA anyway. */
@media (max-width: 480px) { .nav-cta .ghost { display: none; } }

/* ========= THEME TOGGLE ========= */
.theme-toggle {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 100;
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: transform 180ms ease, border-color 180ms ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--color-primary-base); }

/* ========= BUTTON SYSTEM (used by nav CTAs + email-capture) ========= */
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); font-family: var(--font-body); font-weight: 600; cursor: pointer; transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease; border: 0; text-decoration: none; }
.btn-primary { background: var(--color-primary-base); color: var(--color-on-primary); padding: 14px 28px; font-size: 0.9375rem; }
[data-theme="light"] .btn-primary { box-shadow: 0 1px 2px rgba(74,143,243,0.22), 0 2px 8px rgba(74,143,243,0.18); }
[data-theme="dark"] .btn-primary { box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:active { background: var(--color-primary-pressed); transform: translateY(1px); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-strong); padding: 14px 26px; font-size: 0.9375rem; box-shadow: var(--shadow-float); }
[data-theme="dark"] .btn-secondary { background: transparent; border-color: rgba(255,255,255,0.16); }
.btn-secondary:hover { border-color: var(--color-primary-base); }
.btn-pill-sm { padding: 0.5rem 0.875rem; font-size: 0.8125rem; border-radius: var(--radius-md); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border-strong); }
[data-theme="dark"] .btn-outline { border-color: rgba(255,255,255,0.18); }
.btn-outline:hover { border-color: var(--color-primary-base); color: var(--color-primary-base); }
/* Disabled Buy button — visible price, no action, until purchasing is live. */
.btn-disabled,
.btn-disabled:hover {
  background: var(--bg-surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ========= INLINE EMAIL CAPTURE (slide-open, no modal) =========
   Gates the free download behind an email. Uses a max-height reveal (child has
   overflow:hidden). On the nav it anchors as a small panel under the CTA. */
.email-capture {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  transition: max-height 340ms cubic-bezier(0.4,0,0.2,1),
              opacity 220ms ease, margin-top 340ms cubic-bezier(0.4,0,0.2,1);
}
/* max-height is a safe cap above the tallest panel (form or done state), not
   the exact height — overflow:hidden clips the slack while closed. */
.email-capture.is-open { max-height: 400px; opacity: 1; margin-top: 0.75rem; }
.email-capture:not(.is-open) { pointer-events: none; }
/* When an inline download panel is open (form OR the post-submit download
   state — is-open stays set through both), its trigger button is replaced by
   the panel, so hide it. Pure CSS keyed on the live panel state, so the button
   can never re-appear stacked above the form/download (the nav dropdown floats,
   so it's excluded). */
.intro-card:has(.email-capture.is-open) [data-download-trigger],
.card-pricing:has(.email-capture.is-open) [data-download-trigger] { display: none; }
/* Nav "Download" opens a small panel anchored under the nav CTA. */
.email-capture.ec-nav {
  position: absolute; top: calc(100% + 12px); right: 0;
  width: min(340px, 78vw);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  z-index: 1000;
}
.email-capture.ec-nav.is-open { margin-top: 0; }
.email-capture.ec-nav .ec-inner { padding: 1rem 1.125rem 1.125rem; }
.ec-prompt { font-size: 0.8125rem; line-height: 1.45; color: var(--text-secondary); margin: 0 0 0.625rem; }
.ec-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ec-input {
  flex: 1 1 160px; min-width: 0;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  -webkit-appearance: none; appearance: none;
}
[data-theme="dark"] .ec-input { background: var(--bg-surface-muted); }
.ec-input::placeholder { color: var(--text-muted); }
.ec-input:focus { outline: none; border-color: var(--color-primary-base); box-shadow: 0 0 0 3px rgba(74,143,243,0.18); }
.email-capture.is-error .ec-input { border-color: var(--status-critical); box-shadow: 0 0 0 3px rgba(229,72,77,0.16); }
.ec-submit { flex: 1 1 120px; white-space: nowrap; padding: 13px 18px; }
.ec-submit[disabled] { opacity: 0.6; cursor: default; }
.ec-msg { font-size: 0.75rem; line-height: 1.45; margin: 0.5rem 0 0; min-height: 1em; }
/* When there's no status text, the row reserves no space — otherwise an empty
   status line left a sloppy gap below the macOS-requirements caption in every
   panel. It re-expands (and is announced) only when a message is set. */
.ec-msg:empty { min-height: 0; margin-top: 0; }
.ec-msg.is-err { color: var(--status-critical); }
.ec-msg.is-ok { color: var(--status-success); }
/* Success state: the form is replaced in place by a download button. */
.ec-done { display: none; }
.email-capture.is-done .ec-form { display: none; }
.email-capture.is-done .ec-done { display: block; }
.ec-download { width: 100%; }
.ec-done-note { font-size: 0.75rem; line-height: 1.45; color: var(--text-muted); text-align: center; margin: 0.5rem 0 0; }
.ec-done-note::before { content: "✓ "; color: var(--status-success); font-weight: 700; }
/* System-requirements caption (shared with the pricing CTAs on index). */
.sysreq { font-family: var(--font-body); color: var(--text-muted); font-size: 0.72rem; letter-spacing: 0.03em; text-align: center; margin: 0.625rem 0 0; }
@media (prefers-reduced-motion: reduce) {
  .email-capture { transition: opacity 120ms ease; }
  .email-capture.is-open { max-height: 400px; }
}

/* ========= FOOTER ========= */
footer {
  padding: 3rem 1.5rem 3.5rem;
  background: var(--bg-base);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}
footer .container { max-width: 1120px; margin: 0 auto; }
footer .copyright {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0 0 1.5rem;
}
/* Dogcow centered; the Moof badge floats out to the right on hover via absolute
   positioning so its box doesn't push the dogcow off-center at rest. */
footer .dogcow-easter {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  opacity: 0.55;
  transition: opacity 240ms ease;
}
footer .dogcow-easter:hover { opacity: 1; }
footer .dogcow {
  width: 40px; height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}
footer .moof {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%) translateX(-6px);
  transition: opacity 200ms ease, transform 200ms ease;
}
footer .dogcow-easter:hover .moof { opacity: 1; transform: translateY(-50%) translateX(0); }
