/* O caminho real das compras. Fonts are kept with the site (SIL Open Font License, see the
   OFL files next to them); nothing is loaded from other domains. */
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); }

:root {
  --bg: #F4EFE3;
  --surface: #FFFCF5;
  --surface-2: #F9F4E8;
  --ink: #0B1220;
  --muted: #4B5468;
  --line: #DCD3BF;
  --gold: #85560A;
  --gold-mark: #C28A2B;
  --btn: #0B1220;
  --btn-ink: #F4EFE3;
  --dev: #A4471A;
  --bar: #2F5D8A;
  --bar-soft: #C9D6E3;
  --mark: #F7E7C2;
  --head: #EDE6D6;
  --focus: #C28A2B;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --surface: #121B2E; --surface-2: #17213A; --ink: #EEE8DB; --muted: #AAB3C5; --line: #2A3754;
    --gold: #E8B04B; --gold-mark: #E8B04B; --btn: #E8B04B; --btn-ink: #0B1220;
    --dev: #F2A274; --bar: #86AEF2; --bar-soft: #2C3E5E; --mark: #3A3220; --head: #1A2540; --focus: #E8B04B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --surface: #121B2E; --surface-2: #17213A; --ink: #EEE8DB; --muted: #AAB3C5; --line: #2A3754;
  --gold: #E8B04B; --gold-mark: #E8B04B; --btn: #E8B04B; --btn-ink: #0B1220;
  --dev: #F2A274; --bar: #86AEF2; --bar-soft: #2C3E5E; --mark: #3A3220; --head: #1A2540; --focus: #E8B04B;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.55 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; line-height: 1.1; letter-spacing: 0; }
h3, h4 { line-height: 1.25; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--btn); color: var(--btn-ink); padding: 10px 14px; border-radius: 8px; z-index: 10; text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }
.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .86em; }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 6px; flex-wrap: wrap; }
.brand { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: url("../img/qpc-mark.svg") center / cover no-repeat; flex: none; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.intro { padding-top: 18px; padding-bottom: 14px; }
.intro h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin: 0 0 12px; }
.lead { font-size: 1.06rem; max-width: 72ch; margin: 0 0 10px; }
.notice { display: inline-block; margin: 6px 0 0; padding: 6px 12px; border: 1px dashed var(--gold-mark); border-radius: 18px; color: var(--muted); font-size: .92rem; }
.page-nav ul { list-style: none; margin: 0; padding: 4px 0 14px; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.page-nav a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: .92rem; min-height: 36px; }
.page-nav a:hover { border-color: var(--muted); }

/* controls */
button, select, input { font: inherit; color: inherit; }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 44px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.ghost { background: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--gold-mark); flex: none; }

/* blocks */
main { padding: 10px 0 56px; }
main:focus { outline: none; }
.status { color: var(--muted); }
.status:empty { display: none; }
.block { padding: 28px 0 8px; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.block:last-of-type { border-bottom: 0; }
.block h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin: 0 0 14px; }
.block h3 { font-size: 1.1rem; margin: 22px 0 10px; }
.block-body > p { max-width: 75ch; }
.note { color: var(--muted); font-size: .92rem; max-width: 75ch; }

/* summary */
.tiles { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.tile-value { font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile-label { color: var(--muted); font-size: .92rem; }
.tile.warn .tile-value { color: var(--dev); }
.expected { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 10px; margin-top: 14px; }
.chips { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.chips li { display: inline-flex; align-items: center; gap: 4px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: .92rem; }
.chip.dev { border-color: var(--dev); border-style: dashed; }
.sep { color: var(--muted); }

/* process map */
.map-grid { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
.map-grid > * { min-width: 0; }
.map-figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.map { display: block; width: 100%; height: auto; }
.map .node rect { fill: var(--surface-2); stroke: var(--ink); stroke-width: 1.4; }
.map .node.dev rect { stroke: var(--dev); stroke-dasharray: 5 3; }
.map .node-name { font: 600 12.5px "Hanken Grotesk", system-ui, sans-serif; fill: var(--ink); text-anchor: middle; }
.map .node-count { font: 400 10.5px "Hanken Grotesk", system-ui, sans-serif; fill: var(--muted); text-anchor: middle; font-variant-numeric: tabular-nums; }
.map .edge-line { fill: none; stroke: var(--ink); stroke-linecap: round; }
.map .edge-head { fill: var(--ink); }
.map .edge.dev .edge-line { stroke: var(--dev); stroke-dasharray: 6 4; stroke-linecap: butt; }
.map .edge.dev .edge-head { fill: var(--dev); }
.map .label-bg { fill: var(--surface); fill-opacity: .94; stroke: var(--line); stroke-width: .8; }
.map .label-text { font: 600 11px "Hanken Grotesk", system-ui, sans-serif; fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums; }
.map .label.dev .label-text { fill: var(--dev); }
.legend { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; font-size: .94rem; }
.legend li { display: flex; gap: 10px; align-items: center; }
.legend svg { flex: none; }
.legend .exp { stroke: var(--ink); }
.legend .dev { stroke: var(--dev); stroke-dasharray: 6 4; }

/* tables */
details { margin: 14px 0; }
summary { cursor: pointer; font-weight: 600; padding: 10px 0; color: var(--gold); }
summary:hover { text-decoration: underline; }
.table-scroll { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 8px 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 8px 12px; font-weight: 650; border-bottom: 1px solid var(--line); }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--head); font-weight: 650; vertical-align: bottom; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.num { white-space: nowrap; }
tbody th { font-weight: 600; min-width: 10em; }
td.slow { background: var(--mark); font-weight: 700; }
tr.hl td, tr.hl th { background: var(--mark); }
.flag { color: var(--dev); font-weight: 800; margin-right: 4px; }

/* variants */
.variants { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.variant { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; }
.variant-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0 0 6px; }
.variant-rank { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.variant-count { font-weight: 650; }
.badge { font-size: .8rem; font-weight: 650; padding: 1px 9px; border-radius: 999px; border: 1px solid currentColor; color: var(--gold); }
.bar { height: 8px; border-radius: 4px; background: var(--bar-soft); overflow: hidden; margin: 0 0 8px; }
.bar > span { display: block; height: 100%; width: var(--w, 0%); background: var(--bar); border-radius: 4px; }
.variant .note { margin: 6px 0 0; }

/* deviations */
.dev-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dev-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--dev); border-radius: var(--radius); padding: 4px 16px 6px; min-width: 0; }
.dev-card h3 { margin-top: 12px; }
.dev-card p { margin: 0 0 8px; }
.dev-big { font-size: 1.5rem; font-weight: 700; color: var(--dev); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.dev-share { font-weight: 600; }
.dev-conf { color: var(--muted); font-size: .9rem; }

/* waits */
.stages { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: 820px; }
.stage-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.stage-name { font-weight: 650; }
.stage-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.stage-def { color: var(--muted); font-size: .9rem; margin: 0 0 4px; }
.track { position: relative; height: 12px; background: var(--bar-soft); border-radius: 6px; }
.track > .fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); background: var(--bar); border-radius: 6px; }
.track > .tick { position: absolute; top: -3px; bottom: -3px; left: var(--p, 0%); width: 3px; margin-left: -1px; background: var(--ink); border-radius: 2px; }
.stage.slowest .fill { background: var(--dev); }
.stage.choice .stage-def { margin-bottom: 0; }
.findings { margin: 16px 0 0; padding-left: 1.2em; max-width: 75ch; }
.findings li { margin-bottom: 6px; }

/* payments */
.pay-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 820px; }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 20px 0 60px; color: var(--muted); font-size: .9rem; }
.foot p { margin: 0 0 6px; max-width: 80ch; }

/* narrow screens */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .map-grid { grid-template-columns: minmax(0, 1fr); }
  .map-figure { max-width: 600px; }
}
@media (max-width: 760px) {
  .dev-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .tiles, .pay-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 1.35rem; }
  .map-figure { padding: 4px; }
}
@media print {
  .toolbar, .page-nav, .skip { display: none; }
  details > * { display: block; }
}
