:root {
  color-scheme: light dark;
  /* Brand tokens — synced with assets/scss/_variables_project.scss and
     _styles_project.scss (rescile brand colours, homepage-synced). */
  --page: #fcfcfc;      /* smoke-white */
  --surface: #ffffff;   /* white */
  --ink: #111827;       /* dark-grey */
  --muted: #66676b;     /* medium-grey */
  --line: #ededed;      /* fade-grey */
  --hover: #f2f2f2;     /* light-grey */
  --focus: #0069a6;     /* secondary / link */
  --accent: #003060;    /* primary (rescile navy) */
  /* Map accent roles (see build-landscape.py): brand blue/amber plus the
     semantic cyan/green hues that have no brand equivalent. */
  --amber: #a0522d;     /* bloody — light-mode accent orange */
  --cyan: #0891b2;
  --green: #059669;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background: var(--page);
  color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f172a;
  --surface: #1e293b;
  --ink: #f9fafb;
  --muted: rgba(249, 250, 251, 0.75);
  --line: #334155;
  --hover: #334155;
  --focus: #60a5fa;
  --accent: #3b82f6;
  --amber: #ffa500;
  --cyan: #00e5ff;
  --green: #10b981;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f172a;
    --surface: #1e293b;
    --ink: #f9fafb;
    --muted: rgba(249, 250, 251, 0.75);
    --line: #334155;
    --hover: #334155;
    --focus: #60a5fa;
    --accent: #3b82f6;
    --amber: #ffa500;
    --cyan: #00e5ff;
    --green: #10b981;
  }
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, select, input { color: var(--ink); }
a { text-underline-offset: 3px; }
a:not([data-card]) { color: var(--focus); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, #viewport:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
/* Option A — "drafting plate": hairline rules, corner ticks, brand navy as
   structural ink. No card backgrounds on chrome; the map plate is the frame. */
.masthead { padding: 16px 32px 12px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: transparent; }
.identity { display: flex; gap: 14px; align-items: center; min-width: 0; }
.identity > svg { flex: 0 0 auto; }
h1 { font-size: 22px; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 4px; font-weight: 700; }
h1 span { font-size: 13px; font-weight: 500; letter-spacing: .02em; color: var(--muted); white-space: nowrap; }
.thesis { margin: 2px 0 0; color: var(--muted); font-size: 10.5px; font-weight: 600; line-height: 1.5; text-transform: uppercase; letter-spacing: .08em; }
.thesis strong { color: var(--accent); font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 24px; font-size: 13px; }
.theme-control { display: flex; gap: 8px; align-items: center; color: var(--muted); }
select { background: var(--surface); border: 1px solid var(--line); padding: 8px; border-radius: 0; }
.download { color: var(--ink); font-weight: 600; text-decoration: none; }
.download span { margin-left: 8px; }
main { padding: 0 32px; }
.flows { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.flow-hint { margin: 0 0 20px; color: var(--muted); font-size: 11px; }
.docs-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.docs-link span { margin-left: 8px; }
/* Flow tabs: borderless text tabs; pressed = 2px underline in the flow's color. */
.flows button { position: relative; padding: 10px 4px; border: 0; border-radius: 0; background: none; font-size: 13px; font-weight: 500; color: var(--muted); }
.flows button::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 8px; }
.flows [data-flow="model"]::before { background: var(--accent); }
.flows [data-flow="deliver"]::before { background: var(--amber); }
.flows [data-flow="integrate"]::before { background: var(--cyan); }
.flows [data-flow="operate"]::before { background: var(--green); }
.flows button:hover { color: var(--ink); }
.flows button[aria-pressed="true"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px var(--ink); }
.flows [data-flow="model"][aria-pressed="true"] { box-shadow: inset 0 -2px var(--accent); }
.flows [data-flow="deliver"][aria-pressed="true"] { box-shadow: inset 0 -2px var(--amber); }
.flows [data-flow="integrate"][aria-pressed="true"] { box-shadow: inset 0 -2px var(--cyan); }
.flows [data-flow="operate"][aria-pressed="true"] { box-shadow: inset 0 -2px var(--green); }
/* The map plate: drafting-plate frame in brand accent + corner ticks. */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; position: relative; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 0; overflow: hidden; background: var(--surface); }
.workspace::before, .workspace::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; z-index: 2; }
.workspace::before { top: -1px; left: -1px; border-top: 3px solid var(--accent); border-left: 3px solid var(--accent); }
.workspace::after { bottom: -1px; right: -1px; border-bottom: 3px solid var(--accent); border-right: 3px solid var(--accent); }
.map-shell { min-width: 0; }
.map-toolbar { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
#path-status { margin: 0; font-size: 12px; font-weight: 600; }
#path-status span { color: var(--muted); font-weight: 400; }
.zoom-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.zoom-controls button { border: 1px solid var(--line); border-radius: 0; background: none; min-width: 30px; height: 30px; padding: 0 8px; }
.zoom-controls button:hover { border-color: var(--accent); color: var(--accent); }
#zoom-level { font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; font-size: 11px; min-width: 42px; text-align: center; }
#viewport { height: min(72vh, 900px); min-height: 480px; position: relative; touch-action: none; cursor: grab; overflow: hidden; }
#viewport.dragging { cursor: grabbing; }
#viewport > svg { display: block; width: 100%; height: 100%; user-select: none; }
#viewport [data-card] { cursor: pointer; }
#viewport [data-card]:focus-visible { outline: none; }
#viewport [data-card]:focus-visible [data-surface] { stroke: var(--focus); stroke-width: 3; stroke-opacity: 1; }
@media (hover: hover) {
  #viewport [data-card]:hover [data-surface] { stroke-opacity: .8; }
}
#viewport [data-card][data-selected] [data-surface] { stroke-opacity: 1; }
#minimap { position: absolute; right: 12px; bottom: 12px; width: 132px; height: 93px; border: 1px solid var(--line); border-radius: 4px; background: var(--page); opacity: .92; pointer-events: auto; cursor: crosshair; }
#minimap-view { position: absolute; border: 1.5px solid var(--focus); border-radius: 2px; background: color-mix(in srgb, var(--focus) 15%, transparent); }
.map-caption { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.load-message { color: var(--muted); padding: 24px; }
#load-error { padding: 12px 20px; line-height: 1.6; }
/* Inspector: ruled margin notes instead of a boxed card. */
.inspector { border-left: 1px solid var(--line); padding: 20px; max-height: calc(min(72vh, 900px) + 100px); overflow-y: auto; scrollbar-width: thin; background: transparent; }
.inspector-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; margin: 0; }
#reset { border: 0; padding: 4px 0 4px 8px; background: none; color: var(--focus); font-size: 11px; }
.detail-area { color: var(--muted); font-size: 11px; margin: 28px 0 10px; }
h2 { font-size: 24px; font-weight: 600; letter-spacing: -.035em; line-height: 1.2; margin: 0 0 16px; }
#detail-description { font-size: 13px; line-height: 1.7; color: var(--muted); margin-bottom: 20px; }
#detail-extra ul, #detail-extra ol { padding-left: 18px; font-size: 12px; line-height: 1.65; }
#detail-extra li { margin: 8px 0; }
#detail-extra ol.steps { list-style: decimal; padding-left: 22px; }
#detail-extra ol.steps button { border: 0; background: none; padding: 2px 4px; margin: 0 0 0 -4px; border-radius: 4px; font-size: 12px; line-height: 1.65; text-align: left; color: var(--ink); }
#detail-extra ol.steps button:hover { background: var(--hover); }
#detail-extra ol.steps button[aria-pressed="true"] { background: var(--hover); font-weight: 600; box-shadow: inset 0 -2px var(--accent); }
#capability-list mark { background: color-mix(in srgb, var(--focus) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.boundary { border-left: 2px solid var(--amber); padding: 4px 0 4px 12px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.doc-link { display: inline-block; margin: 8px 0 12px; font-size: 12px; }
.capability-search { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.capability-search label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
#search { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--surface); padding: 10px 12px; font-size: 12px; }
#result-count { font-size: 11px; color: var(--muted); min-height: 14px; }
#capability-list { list-style: none; padding: 0; margin: 0; }
#capability-list button { border: 0; background: none; border-radius: 4px; width: 100%; text-align: left; padding: 9px 8px; font-size: 12px; }
#capability-list button[aria-pressed="true"] { background: var(--hover); font-weight: 600; }
button:hover, #capability-list button:hover { background: var(--hover); }
.flows button:hover, #reset:hover { background: none; }
.lead { margin: 24px 0 14px; font-size: 28px; font-weight: 700; letter-spacing: -.035em; line-height: 1.15; color: var(--accent); }
footer { border-top: 1px solid var(--line); padding: 16px 32px 24px; color: var(--muted); font-size: 11px; line-height: 1.7; display: flex; justify-content: space-between; gap: 24px; background: transparent; }
footer p { margin: 0; max-width: 580px; }
.noscript { padding: 20px 32px; }
@media (min-width: 1900px) { .workspace { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 280px; }
  .inspector { padding: 16px; }
  #path-status span { display: none; }
}
@media (max-width: 800px) {
  .masthead { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .workspace::before, .workspace::after { width: 10px; height: 10px; border-width: 2px; }
  .header-actions { width: 100%; justify-content: space-between; }
  main { padding: 0 16px; }
  .lead { font-size: 22px; margin: 16px 0 10px; }
  .thesis { font-size: 12px; }
  h1 span { white-space: normal; }
  .flows { gap: 6px; }
  .flows button { font-size: 12px; padding: 8px 4px; }
  .flows button::before { margin-right: 6px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  #viewport { height: auto; min-height: 0; aspect-ratio: 1600 / 1128; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); max-height: none; padding: 20px; }
  #capability-list { columns: 2; column-gap: 12px; }
  #capability-list li { break-inside: avoid; }
  .map-toolbar { padding: 10px; gap: 8px; }
  .map-caption { font-size: 10px; }
  footer { flex-direction: column; gap: 12px; padding: 20px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, a { transition: background-color .12s ease; }
}

/* Print: the fitted map only, forced light theme (D4). */
@media print {
  .masthead, .lead, .flows, .flow-hint, .map-toolbar, .map-caption, .inspector, footer, .noscript, #load-error, #minimap { display: none !important; }
  main { padding: 0; }
  .workspace { display: block; border: 0; background: none; }
  #viewport { height: auto; min-height: 0; aspect-ratio: 1600 / 1128; cursor: default; }
  :root { color-scheme: light; }
  #viewport > svg { color-scheme: light !important; }
}
