/* OpenWorldEngineer: the concrete frame artifact page (artifacts-concrete.html, assets/art/concrete.js). Builds on
   styles.css (tokens, .card, .seg, .select, .tip) and adds only cc- classes.

   Colours of the 3D frame (read by the JS at mount and on every theme change):
   - utilization: one blue ramp from the dataviz reference palette (steps 300-400-500-600-700 on the light view,
     flipped to 600-500-400-300-150 on the dark view, so high utilization is always the strongest contrast; both pass
     the validator's ordinal checks against their view background, light end >= 2.27:1), with the
     status "critical" red for members over the limit (and a label in the legend and tooltip, never colour alone);
   - change from starter: the site's validated diverging map (cadview.css --cad-dev-*): blue arm for a smaller
     section, orange-red arm for a larger one, neutral grey for unchanged. */

.cc {
  container-type: inline-size;
  --cc-view: var(--bg);
  --cc-ground: var(--rule);
  --cc-outline: var(--ink);
  --cc-halo: var(--accent);       /* the hovered or stepped-to member */
  --cc-util-1: #6DA7EC; --cc-util-2: #3987E5; --cc-util-3: #256ABF; --cc-util-4: #184F95; --cc-util-5: #0D366B;
  --cc-over: #D03B3B;
  --cc-mid: #CACCD0;
  --cc-neg-1: #72AAE9; --cc-neg-2: #4687D8; --cc-neg-3: #245BAB;
  --cc-pos-1: #EF9369; --cc-pos-2: #E25C26; --cc-pos-3: #AF2E13;
  --cc-vp-h: clamp(440px, calc(100svh - 240px), 760px);
  display: grid; gap: 16px; min-width: 0; color: var(--ink); font-size: var(--fs-ui);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cc {
    --cc-util-1: #184F95; --cc-util-2: #256ABF; --cc-util-3: #3987E5; --cc-util-4: #6DA7EC; --cc-util-5: #B7D3F6;
    --cc-mid: #5E6165;
    --cc-neg-1: #5185C7; --cc-neg-2: #67A5EA; --cc-neg-3: #9ECDF9;
    --cc-pos-1: #C46446; --cc-pos-2: #F5793A; --cc-pos-3: #FFB578;
  }
}
:root[data-theme="dark"] .cc {
  --cc-util-1: #184F95; --cc-util-2: #256ABF; --cc-util-3: #3987E5; --cc-util-4: #6DA7EC; --cc-util-5: #B7D3F6;
  --cc-mid: #5E6165;
  --cc-neg-1: #5185C7; --cc-neg-2: #67A5EA; --cc-neg-3: #9ECDF9;
  --cc-pos-1: #C46446; --cc-pos-2: #F5793A; --cc-pos-3: #FFB578;
}
.cc-head p { max-width: 80ch; }
.cc-quiet { margin: 0; padding: 18px 0; color: var(--muted); }

/* picker: building, design, attempt; then whose design it is and its numbers */
.cc-pick { display: grid; gap: 14px; padding: 16px 18px 18px; min-width: 0; }
.cc-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.cc-field { display: grid; gap: 4px; min-width: 0; }
.cc-k { font-size: 0.75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cc-select { max-width: 100%; }
.cc-segsub { color: var(--muted); font-weight: 500; }
.cc-seg button[aria-checked="true"] .cc-segsub { color: var(--ink-2); }
.cc-aseg { flex-wrap: wrap; }
.cc-aseg button { display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; padding: 4px 8px; line-height: 1.15; }
.cc-run-n { font-weight: 640; }
.cc-run-r { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-aseg button.is-nodata, .cc-aseg button.is-same {
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--rule-strong) 55%, transparent) 5px 6px);
}
.cc-trial { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; padding-top: 14px; border-top: 1px solid var(--rule); }
.cc-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.cc-name { font-family: var(--font-mono); font-size: 1.0625rem; font-weight: 640; letter-spacing: -0.03em; line-height: 1.35; }
.cc-sub { font-size: var(--fs-small); color: var(--muted); }
.cc-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); font-weight: 560; color: var(--ink-2); }
.cc-link:hover { color: var(--link-hover); }
.cc-ico { display: inline-flex; }
.cc-ico svg { width: 13px; height: 13px; }
.cc-stats { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 26px; }
.cc-stat { display: grid; gap: 1px; min-width: 0; }
.cc-stat-v { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 660; letter-spacing: -0.03em; line-height: 1.15; }
.cc-stat-k { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); }
.cc-stat-s { font-size: 0.75rem; color: var(--muted); }
.cc-note { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.cc-ne { font-family: var(--font-mono); font-weight: 700; color: var(--accent-ink); }  /* re-run differs from the graded run */

/* viewer card: colour switch and tools, the viewport with the legend under it, the cost panel beside */
.cc-viewer { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 12px; }
.cc-vhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; }
.cc-field-inline { display: flex; align-items: center; gap: 10px; }
.cc-seg { padding: 2px; }
.cc-seg button { padding: 5px 11px; font-size: 0.8125rem; }
.cc-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 11px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); cursor: pointer;
  color: var(--ink-2); font-size: 0.8125rem; font-weight: 560; line-height: 1.2; white-space: nowrap;
}
.cc-tool:hover { border-color: var(--accent); color: var(--ink); }
.cc-tool svg { width: 14px; height: 14px; flex: none; }
.cc-body { display: grid; grid-template-columns: minmax(0, 2.5fr) minmax(250px, 1fr); gap: 12px 18px; min-width: 0; }
.cc-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cc-vp {
  position: relative; height: var(--cc-vp-h); min-width: 0; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--cc-view);
}
.cc-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.cc-canvas:active { cursor: grabbing; }
.cc-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.cc-tag {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 0; pointer-events: none;
  background: color-mix(in srgb, var(--cc-view) 82%, transparent); font-size: 0.75rem; font-weight: 600; color: var(--ink-2);
}
.cc-loading { position: absolute; right: 10px; top: 10px; padding: 3px 10px; border-radius: 0; background: var(--sheet); border: 1px solid var(--rule); font-size: 0.75rem; color: var(--muted); }
.cc-empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; padding: 24px; text-align: center; pointer-events: none; }
.cc-empty b { font-weight: 640; color: var(--ink); }
.cc-empty span { max-width: 36ch; margin-inline: auto; font-size: var(--fs-small); line-height: 1.45; color: var(--muted); }

.cc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 20px; font-size: var(--fs-small); color: var(--muted); }
.cc-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.cc-lk { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); }
.cc-li { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; }
.cc-sw { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 0; }
.cc-ramp { display: inline-grid; gap: 2px; width: clamp(140px, 24cqi, 240px); }
.cc-ramp-bar { display: block; height: 10px; border-radius: 0; }
.cc-ramp-t { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-steps { display: inline-flex; align-items: flex-start; gap: 2px; }
.cc-step { display: inline-grid; justify-items: center; gap: 2px; min-width: 22px; }
.cc-step .cc-sw { width: 22px; height: 10px; border-radius: 0; }
.cc-step span { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--muted); white-space: nowrap; min-height: 1em; }
.cc-hint { margin: 0; font-size: 0.75rem; color: var(--muted); }

/* the side panel: cost breakdown with change bars, form sets, global checks */
.cc-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 4px 2px; font-size: var(--fs-small); }
.cc-side-t { font-size: 0.8125rem; font-weight: 650; color: var(--ink); }
.cc-costs { display: grid; gap: 0; }
.cc-crow {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto 6.2em; gap: 2px 10px; align-items: baseline;
  padding: 6px 0 9px; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums;
}
.cc-chead { padding: 0 0 4px; font-size: 0.6875rem; font-weight: 600; color: var(--muted); }
.cc-crow .r { text-align: right; }
.cc-ck { color: var(--ink-2); }
.cc-cv { font-family: var(--font-mono); color: var(--ink); }
.cc-cd { font-family: var(--font-mono); color: var(--muted); font-size: 0.75rem; }
.cc-ctot { border-bottom: 0; font-weight: 640; }
.cc-ctot .cc-ck { color: var(--ink); }
.cc-dbar { position: absolute; left: 0; right: 0; bottom: 2px; height: 4px; }
.cc-dbar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--rule-strong); }
.cc-dbar i { position: absolute; top: 0; bottom: 0; border-radius: 0; }
.cc-dbar i.neg { background: var(--cc-neg-2); }
.cc-dbar i.pos { background: var(--cc-pos-2); }
.cc-side-n { margin: 0; color: var(--muted); line-height: 1.45; }
.cc-checks { display: grid; gap: 4px; margin-top: 4px; }
.cc-check { display: grid; grid-template-columns: minmax(0, 1fr) auto 7.4em; gap: 10px; align-items: baseline; font-variant-numeric: tabular-nums; }
.cc-check .cc-cv { text-align: right; }
.cc-cu { font-size: 0.75rem; color: var(--muted); }
.cc-check.is-over .cc-cu { color: var(--warn-ink); font-weight: 600; }
.cc-warn { margin: 0; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--warn-wash); color: var(--warn-ink); line-height: 1.45; }

@container (max-width: 860px) {
  .cc-body { grid-template-columns: minmax(0, 1fr); }
  .cc-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 24px; }
  .cc-side > .cc-side-t:first-child { grid-column: 1 / -1; }
}
@container (max-width: 560px) {
  .cc { --cc-vp-h: clamp(360px, 64svh, 520px); }
  .cc-pick { padding: 14px; }
  .cc-row > .cc-field { flex: 1 1 100%; }
  .cc-row .select { width: 100%; }
  .cc-row .seg { display: flex; }
  .cc-row .seg button { flex: 1; min-width: 0; padding-inline: 6px; overflow-wrap: anywhere; }
  .cc-row .cc-aseg button { flex: 1 1 calc(25% - 2px); }
  .cc-viewer { padding: 10px; }
  .cc-vhead .cc-field-inline { flex: 1 1 100%; flex-wrap: wrap; gap: 4px 10px; }
  .cc-vhead .cc-seg { display: flex; width: 100%; }
  .cc-vhead .cc-seg button { flex: 1; padding-inline: 6px; }
  .cc-stats { gap: 10px 18px; }
  .cc-stat-v { font-size: 1.125rem; }
  .cc-side { display: flex; }
}

/* a task page's frame (concrete.js EMBED): the design's numbers head the viewer card, beside its tools */
.embed .cc-vhead { align-items: flex-start; padding: 2px 2px 4px; }
