/* QuantaMRP results viewer: Carbon Design System base with the Belvenar Analytics brand.
   Follows the Carbon direction of Dec 2026: Carbon "white" theme for the page body and "g100"
   (Gray 100) for the header, the hero bands and the footer; IBM Blue 60 as the primary action
   colour; Sky and Turquoise as sparing accents (the three-square motif); Carbon icons; flat fills
   only (no gradients, glows or shadows, and no single coloured accent line on one border of a
   tile). Recorded in specs/001-results-viewer/research.md (R4, R5, R10).

   Hand-written instead of loading @carbon/styles: the site needs a small part of Carbon, and a
   stylesheet of about 10 KB keeps every page light (plan.md performance goals). The values
   below are Carbon tokens (colour, type, spacing, breakpoints). */

/* ---- Fonts (IBM Plex, SIL Open Font License 1.1, see /fonts/OFL.txt) ---- */
/* Latin 1 subsets. The "Pi" file only covers arrows (U+2190 to U+21FF), so it is downloaded
   only on pages that show a route such as "D → A → B". */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/IBMPlexSans-Regular-Pi.woff2") format("woff2"); unicode-range: U+2190-21FF; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("/fonts/IBMPlexSans-Bold-Latin1.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2"); }

:root {
  /* Carbon white theme (page body) */
  --background: #FFFFFF;
  --layer: #F4F4F4;            /* tiles, table headers */
  --layer-hover: #E8E8E8;
  --border-subtle: #E0E0E0;
  --border-strong: #8D8D8D;
  --text-primary: #161616;
  --text-secondary: #525252;
  --link: #0F62FE;             /* Blue 60, 4.95:1 on white */
  --link-hover: #0043CE;       /* Blue 70 */
  --focus: #0F62FE;

  /* Carbon g100 theme (header, hero, footer) */
  --g100-background: #161616;
  --g100-layer: #262626;
  --g100-border: #393939;
  --g100-text-primary: #F4F4F4;
  --g100-text-secondary: #C6C6C6;
  --g100-link: #78A9FF;        /* Blue 40, 7.7:1 on #161616 */

  /* Accents, used sparingly (motif, highlights) */
  --blue-60: #0F62FE;
  --sky: #78A9FF;
  --turquoise: #47DBD9;

  /* Status colours, always paired with text and an icon */
  --success-bg: #A7F0BA; --success-text: #0E6027;   /* Green 20 / Green 80 */
  --error-bg: #FFD7D9;   --error-text: #A2191F;     /* Red 20 / Red 80 */
  --warning-bg: #FCF4D6; --warning-text: #684E00;   /* Yellow 10 / Yellow 70 */
  --info-bg: #EDF5FF;    --info-text: #0043CE;      /* Blue 10 / Blue 70 */

  --font-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", Menlo, Consolas, "Courier New", monospace;

  /* Carbon spacing scale */
  --spacing-02: 0.25rem;
  --spacing-03: 0.5rem;
  --spacing-04: 0.75rem;
  --spacing-05: 1rem;
  --spacing-06: 1.5rem;
  --spacing-07: 2rem;
  --spacing-08: 2.5rem;
  --spacing-09: 3rem;
  --spacing-10: 4rem;
}

/* ---- Base ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  /* Long words (file paths) break only when they would overflow. "break-word" never shrinks
     table columns to one letter per line, unlike "anywhere". */
  overflow-wrap: break-word;
}
/* Carbon grid: 1584 px max width, 1 rem margins on phones, 2 rem from the md breakpoint. */
.container { max-width: 99rem; margin-inline: auto; padding-inline: var(--spacing-05); }
@media (min-width: 42rem) { .container { padding-inline: var(--spacing-07); } }

h1, h2, h3 { font-weight: 700; line-height: 1.25; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; margin-bottom: var(--spacing-05); }
h3 { font-size: 1.25rem; margin-bottom: var(--spacing-03); }
p { margin-bottom: var(--spacing-05); max-width: 75ch; }
strong { font-weight: 600; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
code, .mono { font-family: var(--font-mono); font-size: 0.9375rem; }
ul.plain { list-style: none; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-03);
}
.caption, .helper { font-size: 0.875rem; color: var(--text-secondary); }
/* Mission ids are case sensitive: never upper-case them with the eyebrow. */
.eyebrow code { text-transform: none; letter-spacing: 0; }

/* Carbon icons, written inline by the build with fill="currentColor" */
.icon { width: 1.25rem; height: 1.25rem; flex: none; vertical-align: -0.2em; }
.icon-lg { width: 2rem; height: 2rem; }
.heading-with-icon { display: flex; align-items: center; gap: var(--spacing-04); }
.heading-with-icon .icon { width: 1.75rem; height: 1.75rem; color: var(--blue-60); }

/* Three-square motif: Blue 60, Sky, Turquoise */
.motif { display: inline-flex; gap: 4px; margin-bottom: var(--spacing-05); }
.motif i { display: block; width: 12px; height: 12px; }
.motif i:nth-child(1) { background: var(--blue-60); }
.motif i:nth-child(2) { background: var(--sky); }
.motif i:nth-child(3) { background: var(--turquoise); }

/* ---- Header (g100) ---- */
.site-header { background: var(--g100-background); color: var(--g100-text-primary); border-bottom: 1px solid var(--g100-border); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--spacing-03) var(--spacing-06); min-height: 4rem; padding-block: var(--spacing-03); }
.brand { display: flex; align-items: center; gap: var(--spacing-04); color: var(--g100-text-primary); text-decoration: none; }
.brand:hover { color: var(--g100-text-primary); }
.brand img { height: 3rem; width: auto; display: block; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand .product { font-weight: 700; font-size: 1.125rem; }
.brand .company { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--g100-text-secondary); }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--spacing-02); }
.site-nav a { display: block; padding: var(--spacing-03) var(--spacing-05); color: var(--g100-text-secondary); text-decoration: none; border-bottom: 3px solid transparent; }
.site-nav a:hover { background: var(--g100-layer); color: var(--g100-text-primary); }
/* Carbon header: the current page is marked by a bar under its name */
.site-nav a[aria-current="page"] { color: var(--g100-text-primary); border-bottom-color: var(--blue-60); }

/* ---- Hero band (g100) ---- */
.hero { background: var(--g100-background); color: var(--g100-text-primary); padding-block: var(--spacing-09) var(--spacing-10); }
.hero a { color: var(--g100-link); }
.hero .eyebrow, .hero .helper { color: var(--g100-text-secondary); }
.hero h1 { font-size: 2.625rem; margin-bottom: var(--spacing-03); }
.hero .subtitle { font-size: 1.25rem; color: var(--g100-text-secondary); margin-bottom: var(--spacing-05); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--spacing-07); }
@media (min-width: 66rem) {
  .hero-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1px; background: var(--g100-border); border: 1px solid var(--g100-border); }
.stat { background: var(--g100-layer); padding: var(--spacing-05); }
.stat dt { font-family: var(--font-mono); font-size: 0.875rem; color: var(--g100-text-secondary); display: flex; align-items: center; gap: var(--spacing-03); }
.stat dd { font-family: var(--font-mono); font-size: 1.5rem; margin-top: var(--spacing-03); }

/* ---- Sections ---- */
main section.band { padding-block: var(--spacing-09); border-bottom: 1px solid var(--border-subtle); }
main section.band:last-child { border-bottom: none; }
.lead { font-size: 1.125rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--spacing-07); }
@media (min-width: 66rem) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

/* Inline notification (Carbon "info" low contrast), flat fill, no border accent */
.notification { display: flex; gap: var(--spacing-04); background: var(--info-bg); color: var(--text-primary); padding: var(--spacing-05); margin-bottom: var(--spacing-06); }
.notification .icon { color: var(--info-text); margin-top: 0.15rem; }
.notification p { margin-bottom: 0; max-width: none; }

/* ---- Tags (Carbon tag): text + icon + colour, never colour alone ---- */
.tag {
  display: inline-flex; align-items: center; gap: var(--spacing-02);
  font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.5rem;
  padding: 0 var(--spacing-03); border-radius: 1rem; white-space: nowrap;
}
.tag .icon { width: 1rem; height: 1rem; }
.tag-valid { background: var(--success-bg); color: var(--success-text); }
.tag-invalid { background: var(--error-bg); color: var(--error-text); }
.tag-weak { background: var(--warning-bg); color: var(--warning-text); }
.tag-scenario { background: var(--info-bg); color: var(--info-text); white-space: normal; }
.tag-neutral { background: var(--border-subtle); color: var(--text-primary); }
.hero .tag-scenario { background: #002D9C; color: #D0E2FF; }   /* Blue 80 / Blue 20 on dark */
.none { color: var(--text-secondary); }

/* ---- Facts list (label / value) ---- */
dl.facts { display: grid; grid-template-columns: minmax(8rem, 40%) minmax(0, 1fr); gap: var(--spacing-03) var(--spacing-05); }
dl.facts dt { color: var(--text-secondary); font-size: 0.875rem; padding-top: 0.15rem; }
dl.facts dd { font-family: var(--font-mono); font-size: 0.9375rem; }

/* ---- Tiles and result cards (Carbon tile: flat layer fill) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr)); gap: var(--spacing-05); }
.tile { background: var(--layer); padding: var(--spacing-05); }
.tile h3 { display: flex; align-items: center; gap: var(--spacing-03); }
.tile h3 .icon { color: var(--blue-60); }
.no-route { font-family: var(--font-mono); color: var(--text-secondary); }

/* Mission tiles on the missions list: the whole tile is the link */
.mission-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: var(--spacing-05); }
a.mission-tile { display: flex; flex-direction: column; gap: var(--spacing-03); background: var(--layer); padding: var(--spacing-05); color: var(--text-primary); text-decoration: none; min-height: 13rem; }
a.mission-tile:hover { background: var(--layer-hover); color: var(--text-primary); }
a.mission-tile .title { font-size: 1.25rem; font-weight: 700; }
a.mission-tile .route-line { color: var(--text-secondary); }
a.mission-tile .open { margin-top: auto; color: var(--link); display: flex; align-items: center; gap: var(--spacing-03); }
.status-tiles { display: grid; gap: var(--spacing-05); }
.status-tile h3 { font-size: 1rem; }
.status-tile p { margin-bottom: var(--spacing-04); }
.status-row { display: flex; flex-wrap: wrap; gap: var(--spacing-03); align-items: center; font-size: 0.875rem; }

/* ---- Data tables (Carbon data table) ---- */
.table-wrap { overflow-x: auto; margin-bottom: var(--spacing-05); }
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; color: var(--text-secondary); font-size: 0.875rem; padding-bottom: var(--spacing-03); }
th { background: var(--border-subtle); text-align: left; font-weight: 600; padding: var(--spacing-04) var(--spacing-05); vertical-align: bottom; }
td { padding: var(--spacing-04) var(--spacing-05); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
tbody tr:hover { background: var(--layer); }
td.num, th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
td.route { font-family: var(--font-mono); white-space: nowrap; }

/* ---- Scenario graph (inline SVG drawn by the build) ---- */
figure.graph { border: 1px solid var(--border-subtle); background: var(--background); }
figure.graph svg { width: 100%; height: auto; display: block; }
figure.graph figcaption { font-size: 0.875rem; color: var(--text-secondary); padding: var(--spacing-03) var(--spacing-05) var(--spacing-05); }
.tile figure.graph { margin-bottom: var(--spacing-05); }
.g-bg { fill: #FFFFFF; }
/* g-edge: graph lines; g-key: the sample lines of the legend. Same terrain patterns. */
.g-edge, .g-key { stroke: #6F6F6F; stroke-width: 2; fill: none; }
.t-asphalt { stroke-dasharray: none; }
.t-flooring { stroke-dasharray: 10 4; }
.t-ice { stroke-dasharray: 2 4; }
.t-sandy_loam { stroke-dasharray: 12 4 2 4; }
.t-snow { stroke-dasharray: 6 6; }
.g-edge.blocked { stroke: #C6C6C6; }
.g-blocked-mark { stroke: #DA1E28; stroke-width: 2.5; }
.g-dir { fill: #6F6F6F; }
.g-route { stroke: #0F62FE; stroke-width: 7; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.g-route-arrow { fill: #001D6C; }
.g-node { fill: #FFFFFF; stroke: #161616; stroke-width: 1.5; }
.g-node.start { stroke: #198038; stroke-width: 4; }
.g-node.end { stroke: #161616; stroke-width: 4; }
.g-node.waypoint { stroke: #8A3800; stroke-width: 3; stroke-dasharray: 4 3; }
.g-text { fill: #161616; font-family: var(--font-mono); font-size: 15px; }
.g-small { fill: #525252; font-family: var(--font-sans); font-size: 13px; }
/* A white outline behind small labels keeps them readable where they cross a line. */
.g-small, .g-label { paint-order: stroke; stroke: #FFFFFF; stroke-width: 4px; stroke-linejoin: round; }
.g-label { fill: #0043CE; font-family: var(--font-mono); font-size: 14px; }

/* ---- Seed switch (Carbon content switcher) ---- */
.seed-switch { display: none; margin-bottom: var(--spacing-06); }
/* seeds.js adds the class "js" to <html>. Without JavaScript the switch stays hidden and
   all three seed sections stay visible, one after the other. */
.js .seed-switch { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--text-primary); }
.seed-switch button {
  font: inherit; font-family: var(--font-mono);
  background: var(--background); color: var(--text-primary);
  border: none; border-right: 1px solid var(--text-primary);
  padding: var(--spacing-03) var(--spacing-06); cursor: pointer;
}
.seed-switch button:last-child { border-right: none; }
.seed-switch button:hover { background: var(--layer-hover); }
.seed-switch button[aria-pressed="true"] { background: var(--text-primary); color: var(--background); }
.seed-section { margin-bottom: var(--spacing-07); }
.js .seed-section[hidden] { display: none; }

/* ---- Landing page ---- */
ol.steps { padding-left: 1.25rem; }
ol.steps li { margin-bottom: var(--spacing-04); color: var(--g100-text-secondary); }
ol.steps strong { color: var(--g100-text-primary); }
.headline-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.headline-value { font-family: var(--font-mono); font-size: 2.25rem; line-height: 1.2; margin-bottom: var(--spacing-04); }
ul.checklist { padding-left: 1.25rem; }
ul.checklist li, ul.explore li { margin-bottom: var(--spacing-04); max-width: 75ch; }
.explore li { font-size: 1.125rem; }

/* ---- Sources ---- */
.sources li { display: flex; gap: var(--spacing-03); align-items: baseline; margin-bottom: var(--spacing-03); }
.sources .icon { color: var(--text-secondary); }

/* ---- Footer (g100) ---- */
.site-footer { background: var(--g100-background); color: var(--g100-text-secondary); padding-block: var(--spacing-09); font-size: 0.875rem; }
.site-footer a { color: var(--g100-link); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--spacing-07); }
@media (min-width: 42rem) { .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.site-footer img { height: 3.5rem; width: auto; display: block; margin-bottom: var(--spacing-04); }
.site-footer p { margin-bottom: var(--spacing-03); }
.site-footer .footer-title { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--g100-text-primary); margin-bottom: var(--spacing-04); }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: var(--spacing-03); }

/* ---- Phones ---- */
@media (max-width: 42rem) {
  .hero h1 { font-size: 2rem; }
  .stat dd { font-size: 1.25rem; }
  h2 { font-size: 1.5rem; }
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dd { margin-bottom: var(--spacing-03); }
  th, td { padding: var(--spacing-03); }
}
