/* assets/site-shell.css
   Shared header, Tools menu, mobile menu and footer for every NonQMNate.com page.
   Markup is generated by scripts/sync-nav.py; behavior is in assets/site-shell.js.
   Every rule is scoped to .sh-* classes and sets its layout explicitly, so older
   per-page `nav {}` / `footer {}` styles can't leak in. */

:root {
  --sh-navy: #0b1f3a;
  --sh-navy-deep: #071426;
  --sh-ink: #040d1a;
  --sh-gold: #f5a623;
  --sh-text: rgba(255,255,255,0.82);
  --sh-text-strong: #ffffff;
  --sh-text-muted: rgba(255,255,255,0.68);
  --sh-line: rgba(255,255,255,0.1);
  --sh-focus-light: #1460aa;
}

/* ---------- Skip link + focus ---------- */
.sh-skip {
  position: absolute; left: 16px; top: -100px; z-index: 1000;
  background: var(--sh-gold); color: var(--sh-navy); font: 700 14px/1 'Inter', sans-serif;
  padding: 12px 16px; border-radius: 8px; text-decoration: none;
}
.sh-skip:focus { top: 12px; outline: 2px solid var(--sh-navy); outline-offset: 2px; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sh-focus-light);
  outline-offset: 2px;
}
.sh-header :focus-visible, .sh-footer :focus-visible {
  outline: 2px solid var(--sh-gold) !important;
  outline-offset: 2px;
}
#main-content:focus { outline: none; }

/* ---------- Header bar ---------- */
.sh-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,31,58,0.98);
  border-bottom: 1px solid rgba(245,166,35,0.25);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  line-height: 1.4;
}
.sh-header[data-sticky="false"] { position: relative; }
.sh-header nav.sh-nav {
  position: static; top: auto; z-index: auto; height: 64px; margin: 0 auto; max-width: 1244px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 32px; background: none; border: 0; backdrop-filter: none; box-shadow: none;
}
.sh-header a { text-decoration: none; }
.sh-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; flex-shrink: 0; }
.sh-brand img { display: block; height: 34px; width: auto; }
.sh-brand-text { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.sh-brand-text b { font-weight: 800; font-size: 15px; color: #fff; letter-spacing: 0.2px; }
.sh-brand-text i { font-style: normal; font-weight: 700; font-size: 10px; color: var(--sh-gold); letter-spacing: 2.5px; }

.sh-links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.sh-links > li { position: relative; margin: 0; padding: 0; list-style: none; }
.sh-links > li > a, .sh-dd-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  font: 600 13px/1 'Inter', sans-serif; letter-spacing: 0.04em; color: var(--sh-text);
  background: none; border: 0; border-radius: 8px; cursor: pointer; transition: color 0.2s;
}
.sh-links > li > a:hover, .sh-dd-toggle:hover { color: var(--sh-text-strong); }
.sh-links > li > a[aria-current="page"], .sh-dd-toggle.is-current { color: var(--sh-gold); }
.sh-dd-toggle svg { width: 10px; height: 10px; transition: transform 0.2s; }
.sh-dd-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.sh-links > li > a.sh-btn-outline {
  margin-left: 6px; min-height: 40px; padding: 0 14px; color: #fff;
  border: 1.5px solid rgba(255,255,255,0.3); border-radius: 7px;
}
.sh-links > li > a.sh-btn-outline:hover { border-color: rgba(255,255,255,0.6); }
.sh-links > li > a.sh-btn-gold {
  min-height: 40px; padding: 0 18px; color: var(--sh-navy); background: var(--sh-gold);
  font-weight: 700; border-radius: 7px;
}
.sh-links > li > a.sh-btn-gold:hover { opacity: 0.9; }

/* ---------- Tools menu (desktop) ---------- */
.sh-dd-menu {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: 620px; max-width: calc(100vw - 32px); z-index: 200;
  background: var(--sh-navy-deep); border: 1px solid rgba(245,166,35,0.22); border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0,0,0,0.45); padding: 16px;
}
.sh-dd-menu[hidden] { display: none; }
.sh-dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.sh-dd-group { margin: 0; min-width: 0; }
.sh-dd-group.is-wide { grid-column: 1 / -1; }
.sh-dd-label {
  margin: 6px 10px 6px; font: 700 10px/1.2 'Inter', sans-serif; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--sh-gold);
}
.sh-dd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sh-dd-group.is-wide .sh-dd-list { grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.sh-dd-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 9px;
  color: var(--sh-text); min-height: 44px; transition: background 0.15s;
}
.sh-dd-item:hover { background: rgba(255,255,255,0.06); }
.sh-dd-item[aria-current="page"] { background: rgba(245,166,35,0.1); }
.sh-dd-item strong { display: block; font: 600 14px/1.3 'Inter', sans-serif; color: #fff; }
.sh-dd-item small { display: block; margin-top: 3px; font: 400 12px/1.45 'Inter', sans-serif; color: var(--sh-text-muted); }
.sh-ic {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(245,166,35,0.12); color: var(--sh-gold);
}
.sh-ic svg { width: 20px; height: 20px; }
.sh-dd-all {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px;
  margin-top: 10px; padding: 0 12px; border-top: 1px solid var(--sh-line);
  font: 600 13px/1 'Inter', sans-serif; color: var(--sh-gold);
}
.sh-dd-all:hover { color: #ffc75a; }

/* ---------- Mobile menu ---------- */
.sh-burger {
  display: none; width: 44px; height: 44px; padding: 0; margin-right: -8px;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.sh-burger span { display: block; width: 22px; height: 2px; background: rgba(255,255,255,0.9); border-radius: 2px; transition: transform 0.25s, opacity 0.25s; }
.sh-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sh-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sh-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.sh-mobile {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 99;
  max-height: calc(100vh - 64px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--sh-navy-deep); border-bottom: 2px solid rgba(245,166,35,0.3);
  padding: 8px 16px 20px;
}
.sh-mobile[hidden] { display: none; }
.sh-mobile a { text-decoration: none; }
.sh-m-top, .sh-m-list { list-style: none; margin: 0; padding: 0; }
.sh-m-top a, .sh-m-list a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 8px;
  font: 600 15px/1.3 'Inter', sans-serif; color: var(--sh-text);
  border-bottom: 1px solid var(--sh-line);
}
.sh-m-top a[aria-current="page"], .sh-m-list a[aria-current="page"] { color: var(--sh-gold); }
.sh-m-list .sh-ic { width: 30px; height: 30px; }
.sh-m-label {
  margin: 18px 8px 4px; font: 700 10px/1.2 'Inter', sans-serif; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--sh-gold);
}
.sh-m-ctas { display: grid; gap: 10px; margin-top: 18px; }
.sh-m-ctas a {
  display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 8px;
  font: 700 15px/1 'Inter', sans-serif;
}
.sh-m-ctas .sh-btn-outline { color: #fff; border: 1.5px solid rgba(255,255,255,0.3); }
.sh-m-ctas .sh-btn-gold { color: var(--sh-navy); background: var(--sh-gold); }

@media (max-width: 960px) {
  .sh-header nav.sh-nav { padding: 0 16px; }
  .sh-links { display: none; }
  .sh-burger { display: flex; }
}
@media (min-width: 961px) {
  .sh-mobile { display: none !important; }
}

/* ---------- Footer ---------- */
footer.sh-footer {
  display: block; margin: 0; padding: 48px 32px 32px; border: 0;
  background: var(--sh-ink); border-top: 1px solid rgba(255,255,255,0.05);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  text-align: left; color: var(--sh-text);
}
.sh-footer a { text-decoration: none; }
.sh-footer-inner { max-width: 1180px; margin: 0 auto; }
.sh-footer-top { display: flex; align-items: flex-start; gap: 40px; }
.sh-footer-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sh-footer-blurb { margin: 0; font-size: 14px; line-height: 1.6; color: var(--sh-text-muted); }
.sh-footer nav {
  position: static; top: auto; z-index: auto; height: auto; margin: 0; padding: 0;
  background: none; border: 0; box-shadow: none; backdrop-filter: none; display: block;
}
.sh-footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 22px; }
.sh-footer-links li { margin: 0; padding: 0; list-style: none; }
.sh-footer-links a {
  display: inline-flex; align-items: center; min-height: 36px;
  font: 500 13px/1.4 'Inter', sans-serif; color: rgba(255,255,255,0.78); transition: color 0.2s;
}
.sh-footer-links a:hover, .sh-footer-links a[aria-current="page"] { color: #fff; }
.sh-footer-top .sh-brand img { height: 30px; }
.sh-footer-fine {
  margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--sh-line);
  font-size: 12px; line-height: 1.7; color: rgba(255,255,255,0.62);
}
.sh-footer-fine strong { color: rgba(255,255,255,0.85); }

@media (max-width: 760px) {
  footer.sh-footer { padding: 40px 16px 28px; }
  .sh-footer-top { flex-direction: column; gap: 16px; }
  .sh-footer-links { gap: 0 18px; }
  .sh-footer-links a { min-height: 44px; }
}

/* ---------- Editorial page header (tool pages) ----------
   Applies to pages whose .page-hero wraps a .page-hero-inner (tools, Tools hub, 404). */
.page-hero:has(> .page-hero-inner) {
  text-align: left !important;
  padding: 64px 32px 56px !important;
  background: linear-gradient(160deg, #061325 0%, #0b1f3a 55%, #0d2847 100%) !important;
}
.page-hero:has(> .page-hero-inner)::before { background: radial-gradient(ellipse at 85% 0%, rgba(245,166,35,0.08) 0%, transparent 55%) !important; }
.page-hero:has(> .page-hero-inner) > .page-hero-inner { max-width: 1180px !important; margin: 0 auto !important; }
.page-hero:has(> .page-hero-inner) .breadcrumb { font-size: 12px; color: rgba(255,255,255,0.6) !important; margin-bottom: 28px !important; }
.page-hero:has(> .page-hero-inner) .breadcrumb a { color: rgba(255,255,255,0.75) !important; }
.page-hero:has(> .page-hero-inner) .breadcrumb span { color: rgba(255,255,255,0.35) !important; margin: 0 6px; }
.page-hero:has(> .page-hero-inner) .breadcrumb a { text-decoration: none; }
.page-hero:has(> .page-hero-inner) .page-hero-badge {
  display: flex !important; align-items: center; gap: 12px; width: auto;
  background: none !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important;
  color: var(--sh-gold) !important; font-size: 11px !important; font-weight: 700 !important;
  letter-spacing: 0.16em !important; text-transform: uppercase; margin-bottom: 18px !important;
}
.page-hero:has(> .page-hero-inner) .page-hero-badge::before { content: ""; width: 28px; height: 1px; background: var(--sh-gold); flex-shrink: 0; }
.page-hero:has(> .page-hero-inner) .page-hero-title {
  font-family: 'Playfair Display', Georgia, serif !important; font-weight: 700 !important;
  font-size: clamp(36px, 5.6vw, 64px) !important; line-height: 1.05 !important;
  letter-spacing: -0.01em; color: #fff; max-width: 15ch; margin: 0 0 18px !important;
}
.page-hero:has(> .page-hero-inner) .page-hero-title em { font-style: italic; color: var(--sh-gold); }
.page-hero:has(> .page-hero-inner) .page-hero-sub {
  max-width: 560px !important; margin: 0 !important; text-align: left;
  font-size: 16px !important; line-height: 1.65 !important; color: rgba(255,255,255,0.72) !important;
}
/* Tool page bodies share the header's 1180px content column. */
#main-content:has(> .page-hero > .page-hero-inner) > .main { max-width: 1244px !important; padding-left: 32px !important; padding-right: 32px !important; }
.calc-layout { max-width: 1180px; margin-left: auto; margin-right: auto; }
#main-content > .filter-bar { padding-left: max(32px, calc((100% - 1180px) / 2)) !important; padding-right: 32px !important; }
@media (max-width: 600px) {
  #main-content:has(> .page-hero > .page-hero-inner) > .main { padding-left: 16px !important; padding-right: 16px !important; }
  #main-content > .filter-bar { padding-left: 16px !important; padding-right: 16px !important; }
}
@media (max-width: 600px) {
  .page-hero:has(> .page-hero-inner) { padding: 40px 16px 40px !important; }
  #main-content > section:has(> .calc-layout) { padding-left: 16px !important; padding-right: 16px !important; }
  .page-hero:has(> .page-hero-inner) .breadcrumb { margin-bottom: 20px !important; }
}

/* ---------- Form accessibility helpers (Phase 3) ---------- */
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.form-error {
  margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: #fce9eb; color: #8f2430;
  font: 600 14px/1.5 'Inter', sans-serif; text-align: left;
}
.form-error[hidden] { display: none; }
[tabindex="-1"]:focus { outline: none; }
.signup-fine { margin: 8px 0 0; font: 400 11px/1.5 'Inter', sans-serif; color: #6b7280; }
.signup-fine a { color: inherit; text-decoration: underline; }
.signup-popup-dismiss { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 767px) {
  /* 16px stops iOS from zooming into fields; Studio's exact-PDF overlay keeps its own sizes. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not(.pdf-input), select, textarea { font-size: 16px !important; }
  #modeToggle button, .btn-next, .btn-back, .signup-popup-btn, #brief-search-clear, .lss-zoom button, .lss-bar .btn, #subscribe-btn { min-height: 44px; }
  #brief-search-clear { min-width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .sh-header *, .sh-footer * { transition: none !important; }
}
@media print {
  .sh-skip, .sh-header, .sh-footer { display: none !important; }
}
