/* Cardona CT Lab :: Case Sidebar
 * A full-height context rail beside a live tool, for pages where the running
 * UI is the artifact. Reframes the tool as a case study (built for / friction /
 * core system / inspect for) plus proof metrics, instead of a top banner.
 *
 * Token-driven (--c-*), so Day / Night / HC all resolve. Fits the app-shell:
 * the rail is a flex column that scrolls internally like the input/output
 * panels, so the page itself never scrolls at desktop width.
 * Accent edge squared per the portfolio accent-edge rule (left accent stays 0).
 */

.case-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.case-rail {
  width: 288px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  border-left: 2px solid var(--c-indigo);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 18px;
}

.case-rail-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.case-rail-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--c-text);
}

.case-kind {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-indigo);
  background: var(--c-indigodim);
  border: 1px solid var(--c-indigo);
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}

.case-facts { display: flex; flex-direction: column; }

.case-fact { padding: 12px 0; border-top: 1px solid var(--c-border); }
.case-fact:first-child { border-top: 0; padding-top: 4px; }

.case-fact-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 5px;
}

.case-fact p {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-body);
}

.case-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}

.case-metric {
  flex: 1 1 74px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.case-metric-value {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  margin-bottom: 2px;
}

.case-metric-label {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.35;
  color: var(--c-muted);
}

.case-tool {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tablet and below: the rail becomes a top band, facts flow in two columns,
   and the whole layout scrolls as one column so nothing is ever cropped. */
@media (max-width: 980px) {
  .case-layout { flex-direction: column; overflow-y: auto; }
  .case-rail {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--c-border);
    padding: 16px;
  }
  .case-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    margin-top: 8px;
  }
  .case-fact { border-top: 0; padding: 8px 0; }
  .case-fact:first-child { padding-top: 8px; }
  .case-tool { overflow: visible; }
  .case-tool .tool-body { min-height: 78vh; }
}

@media (max-width: 600px) {
  /* base.html makes .tool-body an overflow-y:auto column at <=600px; drop the
     tablet 78vh min-height at the same breakpoint so it does not become a fixed
     inner scroll pane nested in the case-layout scroll (a double scrollbar in
     the 561-600px band). */
  .case-tool .tool-body { min-height: 0; }
}

@media (max-width: 560px) {
  .case-facts { grid-template-columns: 1fr; }
}
