/* ==========================================================================
   Quant Prime · v2 shared styles (site rebuild, Nov 2026)
   Load AFTER every existing stylesheet. Every class is prefixed "qp-" so
   nothing here can restyle the old markup on pages not yet rebuilt.
   Theme: follows data-theme on <html> (set by /assets/theme-toggle.js).
   ========================================================================== */

:root,
html[data-theme="dark"] {
  --qp-bg:        #0a0a0f;
  --qp-bg-2:      #0e0e14;
  --qp-panel:     #111117;
  --qp-line:      #1d1d25;
  --qp-line-2:    #262630;
  --qp-text:      #ecebe6;
  --qp-text-2:    #b9b6ae;
  --qp-muted:     #9a978f;
  --qp-dim:       #85827a;
  --qp-gold:      #c9a84c;
  --qp-gold-hi:   #e3c46a;
  --qp-on-gold:   #0a0a0f;
  --qp-header-bg: rgba(10,10,15,0.86);
  --qp-footer-bg: #08080c;
  --qp-btn-bg:    #121218;
  --qp-shimmer:   linear-gradient(135deg, #f0d78c, #c9a84c, #a8862f);
  --qp-premium:   linear-gradient(90deg, #c9a84c, #8fc29a 55%, #4ecdc4);
  --qp-gutter:    clamp(24px, 3.4vw, 72px);
  --qp-max:       1680px;
  --qp-font:      Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --qp-mono:      "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --qp-header-h:  81px;
}
html[data-theme="light"] {
  --qp-bg:        #f7f6f2;
  --qp-bg-2:      #f1efe9;
  --qp-panel:     #ffffff;
  --qp-line:      #e4e1d8;
  --qp-line-2:    #d6d2c6;
  --qp-text:      #15151a;
  --qp-text-2:    #3d3b36;
  --qp-muted:     #5f5c55;
  --qp-dim:       #75726a;
  --qp-gold:      #a8862f;
  --qp-gold-hi:   #8f7124;
  --qp-on-gold:   #0a0a0f;
  --qp-header-bg: rgba(247,246,242,0.86);
  --qp-footer-bg: #efede7;
  --qp-btn-bg:    #ffffff;
}

/* ---------- Guard: old site CSS must not leak into the v2 header/footer ---------- */
.qp-header, .qp-footer { line-height: 1.5; text-align: left; }
.qp-header a, .qp-footer a { border: 0; }
.qp-header .qp-btn, .qp-header .qp-btn-ghost { border: 1px solid transparent; }
.qp-header .qp-btn-ghost { border-color: var(--qp-line-2); }
.qp-footer h4 { text-transform: none; }

/* the header element itself: some old pages reuse the class name .qp-header for their own blocks */
html body header.qp-header { display: block; margin: 0; padding: 0; gap: 0; flex-wrap: nowrap; justify-content: normal; align-items: normal; }

/* ---------- Page-to-page: no flash, smooth crossfade ---------------------------------
   The theme and signed-in state are set by a tiny script in each page's <head> before
   anything is drawn. Browsers that support cross-document view transitions (Chrome, Edge,
   Safari 18.2+) crossfade between pages and keep the header still; others switch as normal. */
html { background: var(--qp-bg); }
@view-transition { navigation: auto; }
.qp-header { view-transition-name: qp-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
/* signed in: hide Log in / Start trial straight away and hold the Dashboard button's place */
html.qp-auth-in .qp-header .qp-auth-out { display: none !important; }
@media (min-width: 1101px) {
  html.qp-auth-in .qp-header-actions .qp-avatar-slot:empty { display: inline-flex; }
  html.qp-auth-in .qp-header-actions .qp-avatar-slot:empty::before {
    content: "Dashboard"; display: inline-flex; align-items: center; justify-content: center; padding: 12px 20px; border-radius: 12px;
    border: 1px solid var(--qp-line-2); font-family: var(--qp-font); font-size: 15px; font-weight: 500; line-height: 1.2; color: var(--qp-text);
  }
}

/* ---------- Header ---------------------------------------------------------- */
.qp-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;   /* fixed like the old nav, so existing page spacing still fits */
  border-bottom: 1px solid var(--qp-line);
  font-family: var(--qp-font);
}
/* blur sits on a background layer: a backdrop-filter on .qp-header itself would trap the full-screen menu inside the bar */
.qp-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--qp-header-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.qp-header *, .qp-footer * { box-sizing: border-box; }
.qp-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px 32px; padding: 18px var(--qp-gutter);
}
.qp-header-left { display: flex; align-items: center; gap: 40px; min-width: 0; }
.qp-logo {
  font-family: var(--qp-mono); font-weight: 500; font-size: 15px;   /* 500: the weight every page loads (600 would be faked) */
  letter-spacing: 0.18em; color: var(--qp-text); text-decoration: none; white-space: nowrap;
}
.qp-logo span { color: var(--qp-gold); }
.qp-nav-links { display: flex; gap: 30px; font-size: 15px; }
.qp-nav-links a { color: var(--qp-text-2); text-decoration: none; transition: color .2s; }
.qp-nav-links a:hover, .qp-nav-links a[aria-current="page"] { color: var(--qp-text); }
.qp-nav-links a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--qp-gold); padding-bottom: 4px; }
.qp-header-actions { display: flex; align-items: center; gap: 12px; }

/* theme toggle injected by /assets/theme-toggle.js into .qp-header-actions */
.qp-header #qp-theme-toggle {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--qp-line-2);
  background: var(--qp-btn-bg); color: var(--qp-text-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  position: static; margin: 0;
}

/* avatar (logged in; filled by /js/site-auth.js) */
.qp-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--qp-shimmer); color: var(--qp-on-gold); font-family: var(--qp-font); font-weight: 700; font-size: 16px;
  text-decoration: none; transition: transform .2s, box-shadow .2s;
}
.qp-avatar:hover { transform: scale(1.06); box-shadow: 0 6px 22px rgba(201,168,76,0.3); color: var(--qp-on-gold); }
.qp-avatar-slot:not([hidden]) { display: inline-flex; }

/* menu button + full-screen menu (opened by main.js toggling .open on #navMenu, .active on #navDropdown) */
.qp-header .qp-menu-btn {
  display: none; width: 44px; height: 44px; border-radius: 12px; padding: 0;
  border: 1px solid var(--qp-line-2); background: var(--qp-btn-bg); color: var(--qp-text);
  align-items: center; justify-content: center; cursor: pointer;
}
.qp-menu-btn .qp-i-close, .qp-menu-btn.active .qp-i-open { display: none; }
.qp-menu-btn.active .qp-i-close { display: block; }
.qp-header-inner { position: relative; z-index: 2; }   /* bar sits above the menu panel */
.qp-header .qp-menu {
  position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 1;   /* panel runs under the bar, so no page can peek through a gap */
  padding-top: calc(var(--qp-header-h, 73px) + 12px) !important;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: 12px var(--qp-gutter) calc(28px + env(safe-area-inset-bottom));
  touch-action: pan-y;
  background: var(--qp-bg); overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.qp-header .qp-menu.open { opacity: 1; visibility: visible; transform: none; transition: opacity .22s ease, transform .22s ease; }
.qp-menu-links { display: flex; flex-direction: column; }
.qp-menu-links a {
  display: flex; align-items: baseline; gap: 16px; padding: 18px 0;
  font-size: clamp(28px, 8vw, 40px); font-weight: 400; letter-spacing: -0.02em;
  color: var(--qp-text); text-decoration: none; border-bottom: 1px solid var(--qp-line);
}
.qp-menu-links a span { font-family: var(--qp-mono); font-size: 12px; letter-spacing: .14em; color: var(--qp-gold); }
.qp-menu-links a[aria-current="page"] { color: var(--qp-gold); }
.qp-menu-foot { display: flex; flex-direction: column; gap: 12px; }
.qp-menu-foot .qp-btn { width: 100%; }
.qp-menu-note { margin: 4px 0 0; text-align: center; font-size: 13px; color: var(--qp-dim); }
.qp-menu-account a {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px;
  border: 1px solid var(--qp-line-2); background: var(--qp-panel); color: var(--qp-text); text-decoration: none; font-size: 16px;
}
.qp-menu-account a em { margin-left: auto; font-style: normal; color: var(--qp-gold); }

/* ---------- Buttons ---------------------------------------------------------- */
.qp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; font-family: var(--qp-font);
  font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none;
  white-space: nowrap; cursor: pointer; border: 1px solid transparent;
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.qp-btn:hover { transform: translateY(-1px); }
.qp-btn-gold    { background: #c9a84c; color: var(--qp-on-gold); }
.qp-btn-gold:hover { box-shadow: 0 10px 34px rgba(201,168,76,0.28); color: var(--qp-on-gold); }
.qp-btn-premium { background: var(--qp-premium); color: var(--qp-on-gold); }
.qp-btn-premium:hover { box-shadow: 0 10px 34px rgba(110,200,170,0.24); color: var(--qp-on-gold); }
.qp-btn-ghost   { background: transparent; color: var(--qp-text); border-color: var(--qp-line-2); font-weight: 500; }
.qp-btn-ghost:hover { border-color: var(--qp-gold); color: var(--qp-text); }
.qp-btn-lg { padding: 18px 30px; font-size: 17px; border-radius: 14px; }
.qp-btn .qp-short { display: none; }

/* ---------- Text helpers (used by rebuilt pages) ------------------------------ */
.qp-wrap    { max-width: var(--qp-max); margin: 0 auto; padding-left: var(--qp-gutter); padding-right: var(--qp-gutter); box-sizing: border-box; }
.qp-eyebrow { font-family: var(--qp-mono); font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--qp-dim); }
.qp-text-gold     { color: var(--qp-gold); }
.qp-text-shimmer  { background: var(--qp-shimmer); -webkit-background-clip: text; background-clip: text; color: transparent; }
.qp-text-premium  { background: var(--qp-premium); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Footer ---------------------------------------------------------- */
.qp-footer { background: var(--qp-footer-bg); border-top: 1px solid var(--qp-line); font-family: var(--qp-font); color: var(--qp-text); }
.qp-footer-inner { max-width: var(--qp-max); margin: 0 auto; padding: 72px var(--qp-gutter) 40px; }
.qp-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.qp-footer-brand { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.qp-footer-brand p { margin: 0; max-width: 380px; font-size: 15px; line-height: 1.6; color: var(--qp-muted); }
.qp-footer-col { display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.qp-footer-col h4 { margin: 0 0 4px; font-family: var(--qp-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.18em; color: var(--qp-dim); }
.qp-footer-col a { color: var(--qp-text-2); text-decoration: none; }
.qp-footer-col a:hover { color: var(--qp-gold); }
.qp-footer-legal { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--qp-line); display: flex; flex-direction: column; gap: 12px; font-size: 13px; line-height: 1.6; color: var(--qp-dim); }
.qp-footer-legal p { margin: 0; }

/* ---------- Footer hardening -------------------------------------------------
   Several pages still carry old inline footer rules (gold links, centred text,
   44px tap padding, white background). These selectors outrank all of them. */
html body footer.qp-footer {
  background: var(--qp-footer-bg) !important; border-top: 1px solid var(--qp-line) !important;
  padding: 0 !important; margin: 0 !important; text-align: left !important; color: var(--qp-text) !important;
}
html body footer.qp-footer p { max-width: none; margin: 0; padding: 0; text-align: left; line-height: 1.6; }
html body footer.qp-footer a { display: inline; min-height: 0; padding: 0; margin: 0; line-height: 1.5; border: 0; background: none; text-decoration: none; }
html body footer.qp-footer .qp-logo { display: inline-block; color: var(--qp-text); font-size: 15px; }
html body footer.qp-footer .qp-logo span { color: var(--qp-gold); }
html body footer.qp-footer .qp-footer-col a { display: block; padding: 3px 0; font-size: 15px; color: var(--qp-text-2); }
html body footer.qp-footer .qp-footer-col a:hover { color: var(--qp-gold); }
html body footer.qp-footer .qp-footer-brand p { max-width: 380px; font-size: 15px; color: var(--qp-muted); }
html body footer.qp-footer .qp-footer-legal p { font-size: 13px; color: var(--qp-dim); }

/* ---------- Pages whose own top spacing was sized for the old, shorter nav ----------
   (until each page is rebuilt): push their first block clear of the fixed v2 header */
html body > .terms-container { padding-top: calc(var(--qp-header-h) + 48px); }

/* ---------- Page title block (matches Pricing and Calculators) -------------------
   <section class="qp-ptitle" id="main-content"> eyebrow · h1 (second line on the gradient) · intro */
html body section.qp-ptitle { position: relative; overflow: hidden; margin: 0; padding: var(--qp-header-h) 0 0; text-align: center; background: var(--qp-bg); border: 0; font-family: var(--qp-font); }
.qp-ptitle::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(900px 420px at 50% 0%, rgba(201,168,76,0.10), transparent 70%); }
.qp-ptitle-inner { position: relative; max-width: 1100px; margin: 0 auto; padding: clamp(48px, 8vh, 96px) var(--qp-gutter) clamp(40px, 6vh, 64px); display: flex; flex-direction: column; align-items: center; gap: 22px; }
.qp-ptitle .qp-eyebrow { color: var(--qp-dim); margin: 0; }
html body .qp-ptitle h1 { margin: 0; font-family: var(--qp-font); font-weight: 400; font-size: clamp(44px, 5.2vw, 84px); line-height: 1.02; letter-spacing: -0.035em; color: var(--qp-text); text-transform: none; }
html body .qp-ptitle p { margin: 0; max-width: 760px; font-size: 19px; line-height: 1.6; color: var(--qp-text-2); }
@media (max-width: 700px) {
  .qp-ptitle-inner { padding-top: 36px; padding-bottom: 32px; gap: 16px; }
  html body .qp-ptitle h1 { font-size: clamp(36px, 10.5vw, 48px); }
  html body .qp-ptitle p { font-size: 17px; }
}

/* ---------- Narrow screens: safe fallback until the mobile pass ------------- */
@media (min-width: 1101px) {
  .qp-header .qp-menu { display: none; }
}
@media (max-width: 1100px) {
  .qp-nav-links, .qp-header .qp-login, .qp-header-actions .qp-avatar-slot { display: none; }   /* phone/tablet: account lives in the menu */
  .qp-header .qp-menu-btn { display: inline-flex; }
  html:has(#navMenu.open), body:has(#navMenu.open) { overflow: hidden; overscroll-behavior: none; }   /* plus the JS lock in site-auth.js for iOS */
  body:has(#navMenu.open) #qp-support-widget { display: none; }   /* chat bubble would cover the menu buttons */
}
@media (max-width: 760px) {
  .qp-footer-inner { padding-top: 48px; padding-bottom: 32px; }
  .qp-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
  .qp-footer-brand { grid-column: 1 / -1; gap: 12px; }
  .qp-footer-col { gap: 8px; }
  .qp-footer-legal { margin-top: 36px; padding-top: 22px; }
}
@media (max-width: 480px) {
  :root { --qp-header-h: 69px; }
  .qp-header-inner { padding: 14px 16px; gap: 10px; }
  .qp-logo { font-size: 14px; letter-spacing: 0.16em; }
  .qp-header-actions { gap: 8px; }
  .qp-header-actions .qp-btn { padding: 10px 14px; font-size: 14px; }
  .qp-header #qp-theme-toggle, .qp-header .qp-menu-btn { width: 40px; height: 40px; }
  .qp-avatar { width: 36px; height: 36px; font-size: 15px; }
  .qp-btn .qp-long { display: none; }
  .qp-btn .qp-short { display: inline; }
}
/* short phones (iPhone SE and similar): six menu links fit without scrolling */
@media (max-width: 1100px) and (max-height: 700px) {
  .qp-menu-links a { padding: 10px 0; font-size: clamp(26px, 7vw, 30px); }
  .qp-header .qp-menu { gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .qp-btn, .qp-nav-links a, .qp-avatar, .qp-header .qp-menu, .qp-header .qp-menu.open { transition: none; }
  .qp-btn:hover { transform: none; }
}
