/* Shared shell for the static tool pages: the main-site identity (light theme, DM Sans / Red Hat Display,
   orange #e4572e on navy #121842) applied on top of each page's own inline styles.
   Loaded LAST in <head> so these values win. Change the palette here, once, for all tool pages.
   The header markup is scripts/templates/nv-site-header.html (synced by scripts/sync-tools-shell.mjs). */

:root {
  --dk:  #f2f2f2;   /* page background */
  --dk2: #ffffff;   /* cards and panels */
  --dk3: #e3e6f1;   /* borders, inputs, soft panels */
  --or:  #b83d1a;
  --or2: #9a3115;
  --yl:  #7d5200;
  --yl2: #664300;
  /* Accents are deliberately dark enough to be used both as text on the light page and as a fill behind light text */
  --lb:  #0c6285;
  --lb2: #094e6b;
  --gr:  #086646;
  --tx:  #121842;   /* main text */
  --tx2: #555b75;   /* muted text */
  --nv-dk:  #f2f2f2;
  --nv-dk2: #ffffff;
  --nv-dk3: #e3e6f1;
  --nv-or:  #b83d1a;
  --nv-yl:  #7d5200;
  --nv-lb:  #0c6285;
  --nv-gr:  #086646;
  --nv-tx:  #121842;
  --nv-tx2: #555b75;
  --nv-sans: 'DM Sans', system-ui, sans-serif;
  --nvs-navy: #121842;
  --nvs-orange: #e4572e;
  --nvs-orange-btn: #c9431f; /* white text on this orange: 4.9:1 (on --nvs-orange it is 3.7:1) */
  --nvs-orange-btn-hover: #a83717;
}

html { background: var(--dk); }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--dk);
  color: var(--tx);
}
h1, h2, h3, h4 { font-family: 'Red Hat Display', 'DM Sans', system-ui, sans-serif; }

/* ---- Site header (mirrors the main site) ---- */
.nv-site-header {
  position: sticky; top: 0; z-index: 1000;
  background: #fff;
  box-shadow: 0 2px 14px rgba(18, 24, 66, .08);
  font-family: 'DM Sans', system-ui, sans-serif;
  grid-column: 1 / -1;
}
.nv-sh-inner {
  max-width: 1200px; margin: 0 auto; padding: 8px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nv-sh-logo { display: inline-flex; align-items: center; }
.nv-sh-logo img { height: 52px; width: auto; display: block; }
.nv-sh-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.nv-sh-list > li { position: relative; }
.nv-sh-list a {
  display: block; padding: 10px 14px; border-radius: 8px;
  color: var(--nvs-navy); text-decoration: none; font-weight: 500; font-size: 17px;
}
.nv-sh-list a:hover, .nv-sh-list a:focus-visible { color: #c9431f; }
.nv-sh-list a[aria-current="page"] { color: #c9431f; }
.nv-sh-list a.nv-sh-store {
  background: var(--nvs-orange-btn); color: #fff; font-weight: 700; border-radius: 999px; padding: 12px 24px; margin-left: 8px;
}
.nv-sh-list a.nv-sh-store:hover, .nv-sh-list a.nv-sh-store:focus-visible { background: var(--nvs-orange-btn-hover); color: #fff; }
.nv-sh-has-sub > a::after { content: "\25BE"; margin-left: 6px; font-size: .8em; }
.nv-sh-sub {
  list-style: none; margin: 0; padding: 8px; position: absolute; top: 100%; left: 0; min-width: 220px;
  background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(18, 24, 66, .16);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s;
}
.nv-sh-has-sub:hover > .nv-sh-sub, .nv-sh-has-sub:focus-within > .nv-sh-sub { opacity: 1; visibility: visible; transform: none; }
.nv-sh-sub a { font-size: 15px; white-space: nowrap; }
.nv-sh-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nv-sh-toggle span { display: block; width: 24px; height: 3px; margin: 5px 0; background: var(--nvs-navy); border-radius: 2px; }

@media (max-width: 900px) {
  .nv-sh-toggle { display: block; }
  .nv-sh-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff;
    box-shadow: 0 12px 24px rgba(18, 24, 66, .14); padding: 8px 20px 16px;
  }
  .nv-sh-menu.is-open { display: block; }
  .nv-sh-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nv-sh-sub { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding: 0 0 0 14px; }
  .nv-sh-list a.nv-sh-store { margin: 8px 0 0; text-align: center; }
}

/* ---- Title band (the page's own H1 and subtitle) ---- */
.nv-tool-hero { background: var(--nvs-navy); color: #fff; grid-column: 1 / -1; }
.nv-tool-hero-inner {
  max-width: 1200px; margin: 0 auto; padding: 26px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.nv-tool-hero .tool-title-header { margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.2; color: #fff; }
.nv-tool-hero .tool-subtitle { margin: 0; color: #d4d9ea; font-size: 16px; max-width: 760px; }
.nv-tool-hero .header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: auto; justify-content: flex-end; }
.nv-tool-hero .header-link, .nv-tool-hero .btn-contact-header, .nv-tool-hero .btn-store-header {
  font-family: 'DM Sans', system-ui, sans-serif; font-weight: 700; font-size: 15px; text-decoration: none;
  border-radius: 999px; padding: 10px 20px; transition: background .15s;
}
.nv-tool-hero .header-link { color: #fff; background: rgba(255, 255, 255, .14); }
.nv-tool-hero .header-link:hover { background: rgba(255, 255, 255, .26); }
.nv-tool-hero .btn-contact-header { color: #fff; background: var(--nvs-orange-btn); }
.nv-tool-hero .btn-contact-header:hover { background: var(--nvs-orange-btn-hover); }
.nv-tool-hero .btn-store-header { color: var(--nvs-navy); background: #f7b733; }
.nv-tool-hero .btn-store-header:hover { background: #e0a120; }
@media (max-width: 700px) { .nv-tool-hero .header-actions { width: 100%; justify-content: flex-start; } }

/* ---- Contrast fixes found by docs/science/pipeline/contrast_audit (shared patterns) ---- */
.nv-cs-header, .nv-cs-hd { color: #a8381a; }
.btn-primary { color: #fff; }
.opt-val { color: #094e6b; }
.opt-lbl { color: #4a506b !important; opacity: 1 !important; }
/* Cluster accent colours that were written as light pastels for the dark theme: keep the hue, make it readable on light backgrounds */
.metric-val, .score-val, .interp-label, .dim-badge, .q-num, .opt-num { filter: brightness(.68) saturate(1.1); }
/* Buttons filled with a cluster accent that is a light pastel: darken the fill (the label stays white) */
.btn-primary, .btn-export { background-image: linear-gradient(rgba(0, 0, 0, .38), rgba(0, 0, 0, .38)); }
/* Title band: the only button is the workbook link; Contact is a quiet text link */
.nv-tool-hero .btn-contact-header { background: transparent; color: #d4d9ea; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.nv-tool-hero .btn-contact-header:hover { background: transparent; color: #fff; }
