/* Site chrome: theme toggle, masthead, top nav, footer. */
/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  bottom: 1.15rem;
  right: 1.15rem;
  z-index: 200;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--blue); color: var(--blue); }
.theme-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- Cover / masthead ---------- */
.masthead {
  background: linear-gradient(160deg, var(--navy) 0%, #0a2436 100%);
  color: #fff;
  padding: 5.8rem 0 3.4rem;
}
:root[data-theme="dark"] .masthead { background: linear-gradient(160deg, #0d2434 0%, #060f16 100%); }
.masthead-inner { max-width: var(--content-max); margin: 0 auto; padding: 0 1.5rem; }
.masthead h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: #fff;
  margin: 0 0 0.9rem;
}
.masthead .lede {
  font-size: 1.13rem;
  color: rgba(255,255,255,0.82);
  max-width: 640px;
  margin: 0;
}
.masthead a {
  color: inherit;
  border-bottom-color: rgba(255,255,255,0.55);
}
.masthead a:hover {
  opacity: 1;
  border-bottom-color: #fff;
}

/* ---------- Index cover page ---------- */
/* The cover fills the viewport: the hero flexes to absorb spare height, so
   the contents grid and footer anchor to the bottom edge like a real cover. */
body.cover-page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.cover-page .doc-footer {
  width: 100%;
  margin-top: 0;
}
.cover-page .cover-band {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  /* Navy under the hero, easing to page bg as the photo dissolves. */
  background:
    linear-gradient(
      180deg,
      #0d3049 0%,
      #0a2436 42%,
      color-mix(in srgb, #0a2436 45%, var(--bg)) 62%,
      var(--bg) 88%,
      var(--bg) 100%
    );
}
:root[data-theme="dark"] .cover-page .cover-band {
  background:
    linear-gradient(
      180deg,
      #0d2434 0%,
      #060f16 42%,
      color-mix(in srgb, #060f16 45%, var(--bg)) 62%,
      var(--bg) 88%,
      var(--bg) 100%
    );
}
.cover-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  /* Soften the photo itself toward the bottom so it dissolves into the page. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 38%,
    rgba(0, 0, 0, 0.55) 62%,
    rgba(0, 0, 0, 0.18) 82%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 38%,
    rgba(0, 0, 0, 0.55) 62%,
    rgba(0, 0, 0, 0.18) 82%,
    transparent 100%
  );
}
.cover-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 49% 38%;
  opacity: 0;
  filter: saturate(0.75) contrast(1.05);
  /* Soft ease-out: decelerates gently so the reveal feels subtle, not snappy. */
  transition: opacity 500ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cover-bg img.is-loaded { opacity: 0.34; }
:root[data-theme="dark"] .cover-bg img.is-loaded { opacity: 0.22; }
.cover-page .cover-masthead {
  position: relative;
  z-index: 1;
  overflow: visible;
  min-height: 0;
  flex: 1 0 auto;
  display: flex;
  align-items: flex-end;
  padding: 5.6rem 0 3.8rem;
  /* Keep a navy wash over the photo in the hero, but leave the bottom open
     so the image can continue into the contents section. The top-left radial
     sheen echoes the inner pages' 160deg light-to-dark masthead gradient. */
  background:
    radial-gradient(
      110% 130% at 0% 0%,
      rgba(76, 130, 172, 0.34) 0%,
      rgba(76, 130, 172, 0.12) 38%,
      rgba(76, 130, 172, 0) 62%
    ),
    linear-gradient(
      180deg,
      rgba(8, 28, 42, 0.42) 0%,
      rgba(8, 28, 42, 0.28) 55%,
      rgba(8, 28, 42, 0.08) 100%
    );
}
:root[data-theme="dark"] .cover-page .cover-masthead {
  background:
    radial-gradient(
      110% 130% at 0% 0%,
      rgba(58, 108, 148, 0.30) 0%,
      rgba(58, 108, 148, 0.10) 38%,
      rgba(58, 108, 148, 0) 62%
    ),
    linear-gradient(
      180deg,
      rgba(4, 12, 18, 0.45) 0%,
      rgba(4, 12, 18, 0.28) 55%,
      rgba(4, 12, 18, 0.06) 100%
    );
}
/* Aligns to the same content container as the card grid below (the width
   override lets .masthead-inner's auto margins keep working as a flex item). */
.cover-masthead-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  animation: cover-rise 0.7s ease-out both;
}
.cover-eyebrow {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(197, 211, 59, 0.92);
}
.cover-page .cover-masthead h1 {
  font-size: clamp(2.4rem, 4.8vw, 3.7rem);
  margin-bottom: 0.85rem;
  text-shadow: 0 1px 24px rgba(0, 0, 0, 0.25);
}
.cover-page .cover-masthead .lede {
  font-size: 1.13rem;
  line-height: 1.55;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.88);
}
.cover-page-body {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  margin: -2.1rem 0 0;
  padding: 1.5rem 0 2.8rem;
  /* Semi-opaque so the fading photo still reads underneath. */
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, rgba(255, 255, 255, 0.35));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
:root[data-theme="dark"] .cover-page-body {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-top-color: color-mix(in srgb, var(--border) 80%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.cover-page-body-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.cover-contents-label,
.cover-group-label {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: cover-rise 0.55s ease-out both;
  animation-delay: 0.12s;
}
.cover-contents-label::after,
.cover-group-label::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}
.cover-group-label {
  margin-top: 1.6rem;
  animation-delay: 0.28s;
}
.cover-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.cover-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  animation: cover-rise 0.55s ease-out both;
  animation-delay: calc(0.08s * var(--cover-i, 0) + 0.12s);
}
.cover-card:hover {
  opacity: 1;
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(13, 48, 73, 0.08), 0 10px 28px rgba(13, 48, 73, 0.1);
}
.cover-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.cover-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 10px;
  background: var(--blue-pale);
  color: var(--blue);
  flex: none;
}
.cover-card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
.cover-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}
.cover-card-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--navy-ink);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.cover-card-blurb {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-muted);
}
.cover-card-arrow {
  color: var(--ink-muted);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}
.cover-card:hover .cover-card-arrow {
  color: var(--blue);
  transform: translateX(3px);
}
/* Reference pages: quieter, more compact cards under their group label. */
.cover-card-compact {
  padding: 0.85rem 1.05rem;
  gap: 0.85rem;
}
.cover-card-compact .cover-card-icon {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 8px;
}
.cover-card-compact .cover-card-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}
.cover-card-compact .cover-card-title { font-size: 0.98rem; }
.cover-card-compact .cover-card-blurb { font-size: 0.85rem; }
@keyframes cover-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 720px) {
  .cover-card-grid { grid-template-columns: 1fr; }
  .cover-page .cover-masthead {
    padding: 5.2rem 0 3.4rem;
  }
}
.quantix-logo-link {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-radius: 6px;
  padding: 0.32rem 0.55rem;
  line-height: 0;
  border-bottom: none;
}
.quantix-logo-link img,
.quantix-logo-link svg { display: block; height: 18px; width: auto; }

/* ---------- Sticky top nav ---------- */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.top-nav.scrolled {
  background: var(--bg);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 2px rgba(13,48,73,0.08);
}
.top-nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.top-nav .quantix-logo-link {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-radius: 6px;
  padding: 0.28rem 0.5rem;
  line-height: 0;
  border-bottom: none;
  flex: none;
}
.top-nav .quantix-logo-link img,
.top-nav .quantix-logo-link svg { display: block; height: 15px; width: auto; }
.top-nav-credit {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}
.top-nav-credit .agency {
  color: #ff8a76;
  font-weight: 700;
  border-bottom: none;
  text-decoration: none;
}
.top-nav-credit .agency:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.top-nav.scrolled .top-nav-credit { color: var(--ink-muted); }
.top-nav.scrolled .top-nav-credit .agency { color: var(--red); }
.top-nav.scrolled .top-nav-credit .agency:hover { color: var(--red); }
.top-nav-selects {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.top-nav-select-wrap { min-width: 0; }
.top-nav select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  font-size: 0.83rem;
  color: #fff;
  background-color: rgba(20,45,64,0.55);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23ffffff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 10px 7px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  padding: 0.38rem 1.7rem 0.38rem 0.55rem;
  cursor: pointer;
  max-width: 100%;
}
.top-nav select option {
  color: var(--ink);
  background: var(--bg);
  font-weight: 400;
}
/* Shared hierarchy for page + section dropdowns. Native <option>
   styling is limited; color/weight/indent are the reliable levers. */
.top-nav select option.nav-top-option {
  font-weight: 600;
  color: var(--ink);
}
.top-nav select option.nav-group-label {
  font-weight: 700;
  color: var(--ink-muted);
  font-style: normal;
}
.top-nav select option.sub-option {
  padding-left: 1.4rem;
  color: var(--ink-muted);
  font-size: 0.95em;
  font-weight: 400;
}
.top-nav.scrolled select {
  color: var(--ink);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2352697a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  border-color: var(--border);
}
#pageNav {
  width: max-content;
  max-width: min(16rem, 42vw);
}
#sectionNav {
  width: 11.5rem;
  max-width: min(11.5rem, 32vw);
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Footer ---------- */
.doc-footer {
  max-width: var(--content-max);
  margin: 3rem auto 0;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.doc-footer .agency {
  color: var(--red);
  font-weight: 700;
  border-bottom: none;
  text-decoration: none;
}
.doc-footer .agency:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

