/* Strategy tools: the /strategy hub and its demos. Builds on /style.css. */

:root {
  --build: #2f6fc9;
  --ally: #17845d;
  --partner: #b8481c;
  --buy: #946200;
  --build-soft: rgba(57, 135, 229, 0.13);
  --ally-soft: rgba(25, 158, 112, 0.13);
  --partner-soft: rgba(217, 89, 38, 0.12);
  --buy-soft: rgba(201, 133, 0, 0.14);
  --risk-low: #17845d;
  --risk-mid: #946200;
  --risk-high: #c0392b;
  --risk-high-soft: rgba(192, 57, 43, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --build: #6aa6f0;
    --ally: #4fcf9c;
    --partner: #f08a5d;
    --buy: #e0b04a;
    --build-soft: rgba(106, 166, 240, 0.16);
    --ally-soft: rgba(79, 207, 156, 0.14);
    --partner-soft: rgba(240, 138, 93, 0.14);
    --buy-soft: rgba(224, 176, 74, 0.14);
    --risk-low: #4fcf9c;
    --risk-mid: #e0b04a;
    --risk-high: #ff8a80;
    --risk-high-soft: rgba(255, 138, 128, 0.16);
  }
}
:root[data-theme="dark"] {
    --build: #6aa6f0;
    --ally: #4fcf9c;
    --partner: #f08a5d;
    --buy: #e0b04a;
    --build-soft: rgba(106, 166, 240, 0.16);
    --ally-soft: rgba(79, 207, 156, 0.14);
    --partner-soft: rgba(240, 138, 93, 0.14);
    --buy-soft: rgba(224, 176, 74, 0.14);
    --risk-low: #4fcf9c;
    --risk-mid: #e0b04a;
    --risk-high: #ff8a80;
    --risk-high-soft: rgba(255, 138, 128, 0.16);
  }


.is-build { --mode: var(--build); --mode-soft: var(--build-soft); }
.is-ally { --mode: var(--ally); --mode-soft: var(--ally-soft); }
.is-partner { --mode: var(--partner); --mode-soft: var(--partner-soft); }
.is-buy { --mode: var(--buy); --mode-soft: var(--buy-soft); }

/* Page frame */

.tool { max-width: 72rem; margin: 0 auto; padding: 0.5rem 1rem 3rem; }
.tool .lead { max-width: 46rem; margin-top: 0.75rem; }
.tool h3 { margin: 0 0 0.5rem; font-size: 1.125rem; }
.tool h4 { margin: 1.25rem 0 0.25rem; font-size: 1rem; }
.tool .card p { margin: 0.5rem 0 0; }

.crumbs { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.875rem; }
.crumbs a { color: var(--muted); }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.fineprint { max-width: 46rem; margin: 0.75rem 0 0; color: var(--muted); font-size: 0.875rem; }
.tool .hint { color: var(--muted); font-size: 0.875rem; }
.notice { margin-top: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

.step { margin-top: 3rem; }
.step-title { display: flex; align-items: center; gap: 0.6rem; }
.num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.9375rem;
  font-weight: 700;
}
.section-lead { max-width: 46rem; margin: 0 0 1rem; }

.tool .theory {
  margin: 0.75rem 0 1rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.tool .theory strong { color: var(--fg); }
.tool .theory.wide { max-width: 52rem; background: var(--surface); }

/* Hub */

.steps3 { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.steps3 li { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; align-items: start; }
.steps3 h3 { margin: 0.125rem 0 0; }
.steps3 p { grid-column: 2; margin: 0; }

.tool-card { display: flex; flex-direction: column; }
.tool .tool-card .actions { justify-content: flex-start; margin-top: auto; padding-top: 1.25rem; }
.tool .card.muted { background: transparent; border-style: dashed; }
.route-key { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin: 0.75rem 0 0; padding: 0; font-size: 0.875rem; }
.route-key li { display: inline-flex; align-items: center; gap: 0.4rem; }

.cta {
  margin-top: 3rem;
  padding: 2.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
}
.cta > p { max-width: 38rem; margin: 0.5rem auto 0; }
.cta .actions { justify-content: center; margin: 1.25rem auto 0; }

/* Demo: picking a capability */

.picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.swatch { display: inline-block; flex: none; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--mode, var(--muted)); }
.cap-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 1.25rem; margin-top: 1rem; }
.cap-edit .field { flex: 0 1 24rem; margin: 0; }
.cap-edit .link-button { padding-bottom: 0.6rem; }
.chip.add { border-style: dashed; color: var(--accent); font-weight: 600; }
.link-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }

.tool button:focus-visible, .tool input:focus-visible, .tool summary:focus-visible, .tool .pt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool input[type="text"], .tool input[type="number"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font: inherit;
}

/* Demo: the workbench */

.workbench { display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 1.5rem; }
.workbench > div { display: grid; gap: 1rem; min-width: 0; }

.tool fieldset { min-width: 0; margin: 0 0 0.75rem; padding: 0; border: 0; }
.tool legend { margin-bottom: 0.25rem; padding: 0; font-weight: 600; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.75rem; padding: 0.35rem 0; }
.range label { font-size: 0.9375rem; }
.range output { font-weight: 700; font-variant-numeric: tabular-nums; }
.range input { grid-column: 1 / -1; width: 100%; margin: 0.2rem 0 0; accent-color: var(--accent); }

.link-button { padding: 0; background: none; border: 0; color: var(--accent); font: inherit; font-size: 0.875rem; text-decoration: underline; cursor: pointer; }

.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.25rem; padding: 0.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.seg button { padding: 0.5rem 0.25rem; background: transparent; border: 0; border-radius: 7px; color: var(--fg); font: inherit; font-size: 0.875rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-weight: 600; }

.risk-low { --risk: var(--risk-low); }
.risk-mid { --risk: var(--risk-mid); }
.risk-high { --risk: var(--risk-high); }
.meter { margin-top: 1rem; }
.meter-top { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9375rem; }
.meter-top strong { color: var(--risk); }
.meter-bar { position: relative; height: 0.6rem; margin-top: 0.35rem; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.meter-fill { width: 0; height: 100%; background: var(--risk); border-radius: 999px; transition: width 0.2s ease; }
.meter-mark { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--fg); opacity: 0.6; }

.adjust { margin-top: 1rem; }
.adjust summary { cursor: pointer; color: var(--accent); font-weight: 600; }

.verdict { border-left: 6px solid var(--mode, var(--border)); }
.tool .verdict .verdict-kicker { margin: 0; color: var(--muted); font-size: 0.875rem; }
.tool .verdict .verdict-mode { margin: 0.125rem 0 0; color: var(--mode); font-size: clamp(1.6rem, 4vw, 2.25rem); font-weight: 700; line-height: 1.2; }
.tool .verdict .verdict-say { font-size: 1.0625rem; }
.tool .verdict .verdict-note { color: var(--muted); }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0 0; padding: 0; }
.pill { padding: 0.2rem 0.65rem; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; font-size: 0.8125rem; }

.chart { display: block; width: 100%; height: auto; margin-top: 0.75rem; overflow: visible; }
.chart text { font-family: inherit; }
.tick { fill: var(--muted); font-size: 12px; }
.axis-title { fill: var(--muted); font-size: 12px; }
.quad.q-build { fill: var(--build-soft); }
.quad.q-ally { fill: var(--ally-soft); }
.quad.q-partner { fill: var(--partner-soft); }
.quad.q-buy { fill: var(--buy-soft); }
.quad.on.q-build { stroke: var(--build); stroke-width: 2; }
.quad.on.q-ally { stroke: var(--ally); stroke-width: 2; }
.quad.on.q-partner { stroke: var(--partner); stroke-width: 2; }
.quad.on.q-buy { stroke: var(--buy); stroke-width: 2; }
.quad-label { fill: var(--muted); font-size: 13px; font-weight: 600; }
.pt { cursor: pointer; }
.pt .dot { fill: var(--mode); stroke: var(--surface); stroke-width: 2; }
.pt .ring { fill: none; stroke: var(--mode); stroke-width: 2; }
.pt:hover .dot, .pt:focus-visible .dot { stroke: var(--fg); stroke-width: 3; }
.pt-label { fill: var(--fg); font-size: 12px; pointer-events: none; }
.pt-label.sel { font-size: 13px; font-weight: 700; }
.ghost { fill: none; stroke: var(--mode); stroke-width: 2; stroke-dasharray: 3 3; }
.ghost-line { stroke: var(--mode); stroke-width: 2; stroke-dasharray: 5 4; }
.ghost-head { fill: var(--mode); }

.key { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin: 0.75rem 0 0; padding: 0; color: var(--muted); font-size: 0.8125rem; }
.key li { display: inline-flex; align-items: center; gap: 0.4rem; }
.key i { display: inline-block; width: 1.5rem; border-top: 3px solid var(--accent); }
.key i.internal { border-top: 3px dashed var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.tile { display: grid; gap: 0.15rem; padding: 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile .l, .tile .s { color: var(--muted); font-size: 0.8125rem; }
.tile .v { color: var(--mode); font-weight: 700; }

.checklist { list-style: none; display: grid; gap: 0.4rem; margin: 0.25rem 0 0; padding: 0; }
.checklist li { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.5rem; padding-left: 1.4rem; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--mode); font-weight: 700; }
.req { padding: 0.05rem 0.5rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.req.now { background: var(--risk-high-soft); border-color: transparent; color: var(--risk-high); }
.clock { list-style: none; display: grid; gap: 0.5rem; margin: 0.25rem 0 0; padding: 0; }
.clock li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.75rem; }
.clock .when { color: var(--mode); font-weight: 700; }

/* Demo: business case and overview */

.money { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.field { display: grid; gap: 0.25rem; margin-top: 0.75rem; }
.field label { font-size: 0.9375rem; }

.tw { overflow-x: auto; margin-top: 1rem; }
.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data th, .data td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data th { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.data .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data tr.sel td { background: var(--surface); }
.overview { min-width: 46rem; }
.case-table .n { white-space: normal; }
.case-table th[scope="row"] { min-width: 7rem; }
.mode-tag { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; white-space: nowrap; }
.mode-tag::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--mode); }
.name-btn { padding: 0; background: none; border: 0; color: var(--accent); font: inherit; text-align: left; text-decoration: underline; cursor: pointer; }
.flip { color: var(--muted); font-size: 0.875rem; }

.series-contractor { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.series-internal { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 4; }
.gridline { stroke: var(--border); }
.zero { stroke: var(--fg); stroke-opacity: 0.55; stroke-dasharray: 3 3; }
.end-label { fill: var(--fg); font-size: 12px; font-weight: 700; }

@media (max-width: 56rem) {
  .workbench, .money { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 30rem) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .clock li { grid-template-columns: 4.5rem 1fr; }
}
