/* ==========================================================
   Quantik guide pages on synthetik.au, v2 dark design.
   Loaded after /assets/v2/site-v2.css, which supplies the page base,
   header (.v2-head), footer (.v2-foot), skip link and focus ring.
   This file styles the guide layout (sidebar, sub-nav, pager) and the
   article content: q-* blocks and the d-* tokens used by the SVG diagrams.
   Used only by how-it-works, risk-modelling, user-guide and examples.
   The v2 landing (quantik/index.html) does not load it.
   ========================================================== */

:root {
  --q-bg: #0d0d0f;
  --q-card: #161618;
  --q-card-2: #1c1c1f;
  --q-ink: #f5f5f7;
  --q-ink-soft: #d2d2d7;
  --q-ink-2: #a1a1a6;
  --q-ink-fine: #8e8e93;
  --q-line: rgba(255, 255, 255, 0.08);
  --q-line-card: rgba(255, 255, 255, 0.06);
  --q-line-strong: rgba(255, 255, 255, 0.16);
  --q-link: #2997ff;
  --q-accent: #2bcbba;
  --q-accent-light: #8be8de;
  --q-accent-soft: rgba(43, 203, 186, 0.1);
  --q-amber: #e0a526;
  --q-risk: #ff7a6b;
  --q-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --q-head: 69px; /* measured from .v2-head by quantik.js */
  color-scheme: dark;
}

/* ---------- Guide sub-nav (the guide pages' own links, below the site header) ---------- */
.q-subnav {
  border-bottom: 1px solid var(--q-line);
  background: var(--q-bg);
  padding: 0 24px;
}
.q-subnav-in {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
}
.q-subnav-title {
  font-family: var(--q-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--q-accent);
  white-space: nowrap;
  padding-right: 14px;
  border-right: 1px solid var(--q-line-strong);
}
.q-subnav-links {
  display: flex;
  gap: 2px 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.q-subnav-links::-webkit-scrollbar { display: none; }
.q-subnav-links a {
  color: var(--q-ink-2);
  text-decoration: none;
  font-size: 14px;
  padding: 14px 8px;
  white-space: nowrap;
}
.q-subnav-links a:hover { color: #ffffff; }
.q-subnav-links a[aria-current="page"] { color: #ffffff; font-weight: 600; box-shadow: inset 0 -2px 0 var(--q-accent); }

.q-sidebar-btn {
  display: none;
  align-items: center;
  gap: 8px;
  flex: none;
  appearance: none;
  background: transparent;
  color: var(--q-ink);
  font: 600 14px Inter, -apple-system, "Segoe UI", sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 980px;
  padding: 7px 14px 7px 12px;
  cursor: pointer;
}
.q-sidebar-btn:hover { border-color: #ffffff; }
.q-sidebar-btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- Layout: sidebar + article ---------- */
.q-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 56px;
}
.q-sidebar {
  position: sticky;
  top: var(--q-head);
  align-self: start;
  max-height: calc(100vh - var(--q-head));
  overflow-y: auto;
  padding: 40px 4px 48px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.q-sidebar-close { display: none; }
.q-sidebar__section { margin-bottom: 28px; }
.q-sidebar__label {
  display: block;
  font-family: var(--q-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--q-accent);
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--q-line);
}
.q-sidebar__link {
  display: flex;
  align-items: baseline;
  padding: 6px 8px 6px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--q-ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
}
.q-sidebar__link:hover { color: #ffffff; background: rgba(255, 255, 255, 0.04); border-left-color: var(--q-line-strong); }
.q-sidebar__link[aria-current="true"] { color: #ffffff; font-weight: 600; border-left-color: var(--q-accent); background: var(--q-accent-soft); }
.q-sidebar__num {
  display: inline-block;
  flex: none;
  min-width: 34px;
  font-family: var(--q-mono);
  font-size: 11px;
  color: var(--q-ink-fine);
}
.q-sidebar__link[aria-current="true"] .q-sidebar__num { color: var(--q-accent); }

.q-main { padding: 40px 0 96px; min-width: 0; }
.q-content { max-width: 780px; min-width: 0; }

.q-backdrop { display: none; }

/* ---------- Article typography ---------- */
.q-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  font-family: var(--q-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--q-ink-fine);
}
.q-breadcrumb a, .q-content .q-breadcrumb a { color: var(--q-ink-2); text-decoration: none; }
.q-breadcrumb a:hover { color: #ffffff; }
.q-breadcrumb .sep { color: rgba(255, 255, 255, 0.28); }
.q-breadcrumb .current { color: var(--q-accent); }

.q-eyebrow, .q-content .q-eyebrow {
  margin: 0 0 12px;
  font-family: var(--q-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--q-accent);
}

.q-content h1 {
  margin: 0 0 18px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--q-ink);
}
.q-content h2 {
  margin: 64px 0 18px;
  padding-top: 40px;
  border-top: 1px solid var(--q-line);
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--q-ink);
  scroll-margin-top: calc(var(--q-head) + 8px);
}
.q-content h3 {
  margin: 36px 0 12px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--q-ink);
  scroll-margin-top: calc(var(--q-head) + 16px);
}
.q-content p { margin: 0 0 18px; font-size: 17px; line-height: 1.65; color: var(--q-ink-2); }
.q-content .q-lede { font-size: 20px; line-height: 1.55; color: var(--q-ink-soft); margin-bottom: 26px; }
.q-content strong { color: var(--q-ink); font-weight: 600; }
.q-content em { color: var(--q-ink-soft); }
.q-content ul, .q-content ol { margin: 0 0 22px; padding-left: 24px; color: var(--q-ink-2); font-size: 17px; }
.q-content li { margin-bottom: 8px; line-height: 1.6; padding-left: 4px; }
.q-content ul li::marker { color: var(--q-accent); }
.q-content ol li::marker { color: var(--q-ink-fine); font-family: var(--q-mono); font-size: 0.85em; }
.q-content sub { font-size: 0.7em; }

.q-content a { color: var(--q-link); text-decoration: underline; text-decoration-color: rgba(41, 151, 255, 0.4); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.q-content a:hover { text-decoration-color: var(--q-link); }

.q-content code {
  font-family: var(--q-mono);
  font-size: 0.84em;
  padding: 0.12em 0.4em;
  background: var(--q-card-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--q-accent-light);
  overflow-wrap: anywhere;
}
.q-content pre {
  margin: 22px 0 26px;
  padding: 18px 20px;
  background: var(--q-card-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.q-content pre code { padding: 0; background: none; border: 0; border-radius: 0; font-size: inherit; color: var(--q-ink-soft); overflow-wrap: normal; }

.q-placeholder {
  display: inline-block;
  font-family: var(--q-mono);
  font-size: 0.78em;
  color: var(--q-ink-2);
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0.05em 0.5em;
}

/* ---------- Tables: hairline rows, mono muted header, no zebra ---------- */
.q-table-wrap { overflow-x: auto; margin: 24px 0 30px; -webkit-overflow-scrolling: touch; }
.q-content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.q-content caption { text-align: left; font-size: 13px; color: var(--q-ink-fine); padding-bottom: 10px; caption-side: top; }
.q-content thead th {
  text-align: left;
  padding: 10px 14px 10px 0;
  font-family: var(--q-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--q-ink-fine);
  border-bottom: 1px solid var(--q-line-strong);
  white-space: nowrap;
  vertical-align: bottom;
}
.q-content tbody td, .q-content tbody th {
  padding: 13px 14px 13px 0;
  border-bottom: 1px solid var(--q-line);
  vertical-align: top;
  text-align: left;
  line-height: 1.5;
  color: var(--q-ink-2);
}
.q-content tbody th { color: var(--q-ink); font-weight: 600; }
.q-content thead th:last-child, .q-content tbody td:last-child { padding-right: 0; }
.q-content td.num, .q-content th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-content thead th.num { padding-left: 14px; }
.q-content tbody td.num { padding-left: 14px; }
.q-content tr.q-row-hl td, .q-content tr.q-row-hl th { color: var(--q-ink); font-weight: 700; background: var(--q-accent-soft); }
.q-content tr.q-row-hl > :first-child { padding-left: 12px; box-shadow: inset 2px 0 0 var(--q-accent); }
.q-content tbody th[rowspan] { border-right: 1px solid var(--q-line); }
.q-content tbody td[rowspan] { border-left: 1px solid var(--q-line); padding-left: 14px; }
/* ribbon icons are drawn for a light ribbon: give them a light chip */
.q-content td img { vertical-align: -3px; background: #f5f5f7; border-radius: 4px; padding: 1px; box-sizing: content-box; }

/* ---------- Callouts ---------- */
.q-callout {
  margin: 26px 0;
  padding: 18px 22px;
  background: var(--q-card);
  border: 1px solid var(--q-line-card);
  border-left: 3px solid var(--q-accent);
  border-radius: 16px;
}
.q-callout__label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--q-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--q-accent);
}
.q-callout p, .q-callout ul { font-size: 16px; }
.q-callout p:last-child, .q-callout ul:last-child { margin-bottom: 0; }
.q-callout li:last-child { margin-bottom: 0; }
.q-callout--warning { border-left-color: var(--q-amber); }
.q-callout--warning .q-callout__label { color: var(--q-amber); }
.q-callout--risk { border-left-color: var(--q-risk); }
.q-callout--risk .q-callout__label { color: var(--q-risk); }
.q-callout--formula { border-left-color: #8e9bff; }
.q-callout--formula .q-callout__label { color: #8e9bff; }

/* ---------- Pipeline steps ---------- */
.q-content ol.q-flow {
  list-style: none;
  padding: 0;
  margin: 28px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}
.q-content ol.q-flow li {
  margin: 0;
  padding: 18px 20px 20px;
  background: var(--q-card);
  border: 1px solid var(--q-line-card);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.q-flow__num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--q-accent);
  color: var(--q-ink);
  font-family: var(--q-mono);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.q-flow strong { display: block; font-size: 17px; color: var(--q-ink); }
.q-flow span:not(.q-flow__num) { display: block; font-size: 15px; line-height: 1.5; color: var(--q-ink-2); }

/* ---------- Stats ---------- */
.q-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
  margin: 24px 0 28px;
}
.q-stat {
  position: relative;
  padding: 20px 18px 18px;
  background: var(--q-card);
  border: 1px solid var(--q-line-card);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  container-type: inline-size; /* the value scales with the card, so $54,117,750 stays on one line */
}
.q-stat::before { content: ""; width: 28px; height: 4px; border-radius: 2px; background: var(--q-ink-fine); margin-bottom: 8px; }
.q-stat--teal::before { background: var(--q-accent); }
.q-stat--amber::before { background: var(--q-amber); }
.q-stat--brick::before { background: var(--q-risk); }
.q-stat__label { font-family: var(--q-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--q-ink-fine); }
.q-stat__value { font-size: 21px; font-size: clamp(17px, 14cqi, 26px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--q-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-stat__note { font-size: 14px; line-height: 1.45; color: var(--q-ink-2); }

/* ---------- Link cards (user guide) ---------- */
.q-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.q-content a.q-card, .q-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: var(--q-card);
  border: 1px solid var(--q-line-card);
  border-radius: 18px;
  color: var(--q-ink);
  text-decoration: none;
  transition: border-color .2s;
}
.q-content a.q-card:hover { border-color: rgba(255, 255, 255, 0.25); }
.q-card__num { font-family: var(--q-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; color: var(--q-accent); }
.q-card__title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.q-card__desc { font-size: 14px; line-height: 1.5; color: var(--q-ink-2); }

/* ---------- Figures and diagrams ---------- */
.q-figure { margin: 28px 0 32px; }
.q-figure > svg {
  display: block;
  width: 100%;
  height: auto;
  padding: 18px 16px;
  background: var(--q-card);
  border: 1px solid var(--q-line-card);
  border-radius: 18px;
  fill: var(--q-ink-soft); /* default for any unclassed text */
}
.q-figure img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: #ffffff; }
.q-figure figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--q-ink-fine); }
.q-figure text { font-family: Inter, -apple-system, "Segoe UI", sans-serif; }
/* generated illustrations are light art: invert with the hue turned back, so teal stays teal */
.q-figure.q-art img { border: 0; border-radius: 18px; background: none; filter: invert(1) hue-rotate(180deg) brightness(0.9); }

/* SVG tokens on dark: neutral chrome + product teal; amber = P90, coral = risk events */
.d-ink { fill: var(--q-ink); }
.d-soft { fill: var(--q-ink-soft); }
.d-muted { fill: var(--q-ink-2); }
.d-line { stroke: rgba(255, 255, 255, 0.34); }
.d-grid { stroke: rgba(255, 255, 255, 0.1); }
.d-box { fill: var(--q-card-2); stroke: rgba(255, 255, 255, 0.26); }
.d-box-accent { fill: rgba(43, 203, 186, 0.14); stroke: var(--q-accent); }
.d-accent { fill: var(--q-accent); }
.d-accent-dark { fill: var(--q-accent-light); }
.d-stroke-accent { stroke: var(--q-accent); fill: none; }
.d-stroke-dark { stroke: var(--q-ink-fine); fill: none; }
.d-stroke-ink { stroke: var(--q-ink-soft); fill: none; }
.d-stroke-amber { stroke: var(--q-amber); fill: none; }
.d-stroke-brick { stroke: var(--q-risk); fill: none; }
.d-amber { fill: var(--q-amber); }
.d-brick { fill: var(--q-risk); }
.d-charcoal { fill: #c7c7cc; }

/* ---------- Pager ---------- */
.q-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--q-line); }
.q-content a.q-pager__link, .q-pager__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 22px;
  background: var(--q-card);
  border: 1px solid var(--q-line-card);
  border-radius: 18px;
  color: var(--q-ink);
  text-decoration: none;
  transition: border-color .2s;
}
.q-content a.q-pager__link:hover { border-color: rgba(255, 255, 255, 0.25); }
.q-pager__dir { font-family: var(--q-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--q-ink-fine); }
.q-pager__title { font-size: 17px; font-weight: 600; }
.q-pager__link--next { grid-column: 2; text-align: right; align-items: flex-end; }

/* ---------- Narrow screens: sidebar becomes a drawer ---------- */
@media (max-width: 960px) {
  html { scroll-padding-top: calc(var(--q-head) + 62px); }
  .q-subnav { position: sticky; top: var(--q-head); z-index: 35; background: rgba(13, 13, 15, 0.92); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); }
  .q-subnav-title { display: none; }
  .q-sidebar-btn { display: inline-flex; }
  .q-subnav-links a { padding: 15px 7px; }
  .q-content h2, .q-content h3 { scroll-margin-top: calc(var(--q-head) + 64px); }

  .q-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .q-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(320px, 86vw);
    max-height: none;
    padding: 16px 18px 40px;
    background: var(--q-card);
    border-right: 1px solid var(--q-line-strong);
    box-shadow: 20px 0 60px -20px rgba(0, 0, 0, 0.8);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .25s ease, visibility 0s linear .25s;
  }
  .q-sidebar[data-open="true"] { transform: none; visibility: visible; transition: transform .25s ease; }
  .q-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 14px auto;
    width: 40px;
    height: 40px;
    appearance: none;
    background: transparent;
    color: var(--q-ink);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
  }
  .q-sidebar-close:hover { border-color: #ffffff; }
  .q-sidebar-close svg { width: 18px; height: 18px; }
  .q-backdrop[data-open="true"] { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.6); }
  .q-main { padding-top: 32px; }
}

@media (max-width: 640px) {
  .q-subnav { padding: 0 16px; }
  .q-shell { padding: 0 16px; }
  .q-main { padding: 28px 0 72px; }
  .q-content p, .q-content ul, .q-content ol { font-size: 16px; }
  .q-content .q-lede { font-size: 18px; }
  .q-content h2 { margin-top: 48px; padding-top: 32px; }
  .q-content table { font-size: 14px; }
  .q-content thead th, .q-content tbody td, .q-content tbody th { padding-right: 12px; }
  /* diagrams keep a readable size: below 560px wide they scroll sideways inside the figure */
  .q-figure:has(> svg) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .q-figure > svg { min-width: 560px; padding: 12px 10px; border-radius: 14px; }
  .q-callout { padding: 16px 18px; }
  .q-pager { grid-template-columns: 1fr; }
  .q-pager__link--next { grid-column: 1; }
}

@media print {
  .v2-head, .q-subnav, .q-sidebar, .v2-foot, .q-pager { display: none; }
  .q-shell { display: block; }
}
