/* Case study pages — shared layout. Loaded after styles.css. */

.case-hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
.case-hero .case-tag {
  padding: 0;
  border-radius: 0;
  background: none;
  margin-bottom: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.case-hero .tag-word {
  padding-bottom: 0.2em;
  background: linear-gradient(var(--copper-mid), var(--copper-mid)) right bottom / 34% 2px no-repeat;
}
.case-hero h1 {
  max-width: 28ch;
  margin: 0.9rem 0 1.1rem;
}
.case-hero .hero-lead {
  max-width: 84ch;
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
  max-width: 680px;
}
.case-fact {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 0.75rem 0.9rem;
}
.case-fact span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper-mid);
  margin-bottom: 0.3rem;
}
.case-fact strong {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .case-facts { grid-template-columns: 1fr; }
}

.cs-hero-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  align-items: center;
}
.cs-hero-layout > div:first-child {
  position: relative;
  z-index: 1;
}
.cs-hero-layout .case-facts { max-width: none; }
@media (max-width: 900px) {
  .cs-hero-layout { grid-template-columns: 1fr; }
  .cs-hero-visual { margin-left: 0; height: 280px; }
}
.cs-hero-visual {
  position: relative;
  height: 460px;
  margin-left: 10%;
  background: none;
  border: 0;
  pointer-events: none;
}
.cs-visual-caption { display: none; }
#chaosToGridCanvas,
#calendarGridCanvas,
#severityTriageCanvas,
.cs-hero-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  border-radius: 16px;
}

.case-section {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  position: relative;
  z-index: 2;
}
.case-section + .case-section {
  border-top: 1px solid var(--border-subtle);
}
.case-section h2 {
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  max-width: 24ch;
}
.case-section h2 + .case-subhead { margin-top: 1.75rem; }
.case-subhead {
  margin: 2.75rem 0 1rem;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  max-width: 32ch;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.case-section .section-desc {
  max-width: 84ch;
  line-height: 1.7;
}
.case-body {
  max-width: 84ch;
  color: var(--text-secondary);
  line-height: 1.75;
}
.case-body + .case-body { margin-top: 1rem; }
.case-story {
  margin-top: 1.25rem;
  font-size: 1.05rem;
}
.case-bridge {
  margin: 1.75rem 0 0;
  max-width: 84ch;
}
.case-section h2.case-gap-ask {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: start;
  width: max-content;
  max-width: none;
  margin: 1.25rem 0 0;
  text-align: left;
  color: inherit;
  opacity: 1;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.25;
  white-space: nowrap;
}
.case-gap-why {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: start;
  max-width: 84ch;
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.55;
}
.problem-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.85fr);
  gap: 1.5rem 2.75rem;
  align-items: center;
  margin-top: 1.25rem;
}
.problem-split .case-story {
  margin-top: 0;
  max-width: none;
}
.problem-split .case-quote {
  margin: 0;
}
@media (max-width: 820px) {
  .problem-split { grid-template-columns: 1fr; }
}
.case-quote {
  margin: 2rem 0 0;
  max-width: 36ch;
  padding: 0.35rem 0 0.35rem 1.4rem;
  border-left: 3px solid var(--copper-mid);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
}

/* Questions the team could not answer */
.case-questions {
  --q-dot: #B85D3B;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.85rem;
  max-width: 60ch;
}
.case-questions li {
  position: relative;
  padding-left: 2rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}
.case-questions li::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.48em;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--q-dot);
  box-shadow: 0 0 0 0.3rem color-mix(in srgb, var(--q-dot) 16%, transparent);
}
.problem-split,
.outcome-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 2.5rem 3rem;
  align-items: center;
  margin-top: 1.25rem;
}
.problem-split > .case-body { margin: 0; max-width: none; }
.problem-split > .case-questions,
.outcome-split > .case-questions { margin: 0; max-width: none; }
.outcome-lead { text-align: center; }
.outcome-lead .section-kicker { display: block; }
.outcome-lead h2 { margin: 0.4rem 0 0; }
@media (max-width: 860px) {
  .problem-split,
  .outcome-split { grid-template-columns: 1fr; gap: 1.25rem; }
  .outcome-lead { text-align: left; }
}
.case-questions li:nth-child(2) { --q-dot: #2D6659; }
.case-questions li:nth-child(3) { --q-dot: #57AFA2; }
.case-questions li:nth-child(4) { --q-dot: #9BACA6; }
.roll-points {
  max-width: none;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.roll-points li {
  font-weight: 450;
  color: var(--text-secondary);
  padding: 1rem 1.15rem 1rem 2.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: var(--bg-card);
}
.roll-points li::before { left: 1.05rem; top: 1.35rem; }
.roll-points li strong { color: var(--text-primary); }
.roll-points li:nth-child(5) { --q-dot: #C47A4A; grid-column: 1 / -1; justify-self: center; width: calc(50% - 0.425rem); }
@media (max-width: 720px) {
  .roll-points { grid-template-columns: 1fr; }
  .roll-points li:nth-child(5) { width: auto; }
}

/* Comparison table */
.compare-wrap {
  margin-top: 1.75rem;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--bg-card);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 560px;
}
.compare-table th,
.compare-table td {
  text-align: left;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  line-height: 1.45;
}
.compare-table thead th {
  background: var(--bg-surface);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.compare-table thead th:last-child { color: var(--patina-moss); }
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table td:first-child { font-weight: 600; }
.compare-table tbody td:nth-child(2) {
  font-size: 0.82rem;
  font-style: italic;
}
.compare-table tbody td:nth-child(2) .no { font-style: normal; }
.compare-table td:last-child {
  color: var(--patina-deep);
  font-weight: 600;
}
.compare-table .yes,
.compare-table .no,
.compare-table .meh {
  font-weight: 700;
}
.compare-table .yes { color: var(--patina-mid); }
.compare-table .no { color: var(--copper-mid); }
.compare-table .meh { color: var(--text-muted); }
[data-theme="dark"] .compare-table td:last-child { color: var(--patina-light); }
.compare-table.is-plain td:last-child { color: var(--text-secondary); font-weight: 400; }
.compare-table.is-plain thead th:last-child { color: var(--text-muted); }

/* Last-column cells with a screenshot preview */
.compare-table td[data-shot] {
  cursor: zoom-in;
  outline: none;
}
.compare-table td[data-shot]::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.62em;
  margin-left: 0.45em;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: 0.35;
  vertical-align: -0.05em;
  transition: opacity 0.15s ease;
}
.compare-table td[data-shot]:hover,
.compare-table td[data-shot]:focus-visible {
  background: color-mix(in srgb, var(--patina-mid) 7%, transparent);
}
.compare-table td[data-shot]:hover::after,
.compare-table td[data-shot]:focus-visible::after { opacity: 0.9; }

.shot-tip {
  position: fixed;
  z-index: 80;
  width: max-content;
  max-width: min(168px, calc(100vw - 24px));
  padding: 0.35rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
  color: #1c1c1a;
  box-shadow: 0 18px 48px rgba(20, 20, 18, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}
.shot-tip.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.shot-tip.is-pair { max-width: min(220px, calc(100vw - 24px)); }
.shot-tip-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  max-height: 4.5rem;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.shot-tip-media img {
  display: none;
  width: auto;
  max-width: 100%;
  max-height: 4.5rem;
  height: auto;
  object-fit: contain;
}
.shot-tip.has-image .shot-tip-media img { display: block; }
.shot-tip.is-pair .shot-tip-media {
  gap: 0.35rem;
  max-height: none;
  background: #fff;
  align-items: flex-start;
  justify-content: center;
}
.shot-tip.is-pair .shot-tip-media img {
  height: 4.2rem;
  width: auto;
  max-width: none;
  max-height: none;
  border-radius: 6px;
  background: #fff;
  object-fit: fill;
}
.shot-tip.is-pair .shot-tip-caption { max-width: 12.5rem; }
.shot-tip.has-image .shot-tip-empty { display: none; }
.shot-tip-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1.5px dashed var(--border-copper);
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--copper-mid) 4%, transparent) 14px 15px);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.shot-tip-empty b {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper-mid);
}
.shot-tip-caption {
  margin: 0.3rem 0.15rem 0.05rem;
  max-width: 9.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  color: #1c1c1a;
  text-align: center;
}

/* System-of-record strip: A → gap → B */
.record-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.record-node {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  text-align: center;
}
.record-node strong { display: block; font-size: 1rem; }
.record-node span { font-size: 0.82rem; color: var(--text-muted); }
.record-node.is-gap {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 0.35rem;
  color: var(--copper-deep);
}
.record-node.is-gap strong {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.record-node.is-gap span {
  display: block;
  margin-top: 0.2rem;
  color: var(--copper-mid);
}
.record-node.is-gap::before,
.record-node.is-gap::after {
  content: "";
  display: block;
  width: 1px;
  height: 16px;
  margin: 0.35rem auto;
  background: repeating-linear-gradient(
    to bottom,
    var(--copper-mid) 0 3px,
    transparent 3px 6px
  );
}
.record-node.is-target {
  border-color: var(--border-patina);
  box-shadow: inset 0 0 0 1px var(--border-patina);
}
.record-link {
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, var(--copper-bright), var(--patina-mid));
  border-radius: 2px;
}
.record-strip.has-ask { row-gap: 0; }
@media (max-width: 760px) {
  .record-strip { grid-template-columns: 1fr; }
  .record-link { width: 2px; height: 22px; margin: 0 auto; }
  .record-strip.has-ask .case-gap-ask {
    grid-column: 1;
    grid-row: auto;
    order: 4;
    white-space: normal;
    width: min(16rem, 100%);
  }
  .record-strip.has-ask .record-link:last-of-type { order: 5; }
  .record-strip.has-ask .record-node.is-target { order: 6; }
}

/* Demo block */
#demo-calendar.sandbox-frame {
  min-height: 980px;
}

.demo-mobile { display: none; }
@media (max-width: 760px) {
  .sandbox-frame,
  .sandbox-toolbar button { display: none; }
  .demo-mobile {
    display: block;
    margin: 0;
    padding: 2.25rem 1.25rem;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
  }
}

.demo-hint {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Feature rows: copy + media slot */
.feature-list {
  display: grid;
  gap: clamp(2rem, 4vw, 3.25rem);
  margin-top: 2rem;
}
.feature-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
}
.feature-row:nth-child(even) .feature-copy { order: 2; }
.feature-row:not(:has(.media-slot)) { grid-template-columns: minmax(0, 42rem); }
.feature-row:not(:has(.media-slot)) .feature-copy { order: 0; }
@media (max-width: 860px) {
  .feature-row { grid-template-columns: 1fr; }
  .feature-row:nth-child(even) .feature-copy { order: 0; }
}
.feature-num {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--copper-mid);
}
.feature-copy h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0.35rem 0 0.75rem;
}
.feature-copy p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Media placeholder — swap the inner label for <img> or <video> when ready */
.media-slot {
  margin: 0;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  border: 1.5px dashed var(--border-copper);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--copper-mid) 4%, transparent) 14px 15px),
    var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
  overflow: hidden;
}
.media-slot img,
.media-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.media-slot:has(img, video) {
  aspect-ratio: auto;
  border-style: solid;
  border-color: var(--border-subtle);
  background: var(--bg-card);
  padding: 0;
}
.media-slot:has(img, video) img,
.media-slot:has(img, video) video {
  height: auto;
  border-radius: 0;
}
.media-slot:has(img, video) .media-slot-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.media-slot-label {
  max-width: 34ch;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.media-slot-label b {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper-mid);
  margin-bottom: 0.35rem;
}

/* Smaller capability grid (no media) */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-top: 2rem;
}
.mini-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
}
.mini-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.3rem 0 0.4rem;
}
.mini-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Benefits list */
.benefit-list {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}
.benefit-list li {
  border-left: 3px solid var(--patina-mid);
  padding: 0.35rem 0 0.35rem 1rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.benefit-list strong { color: var(--text-primary); }

/* Before → after */
.before-after {
  margin-top: 1.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-card);
}
.ba-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.95rem;
}
.ba-row:last-child { border-bottom: 0; }
.ba-row.ba-head {
  background: var(--bg-surface);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ba-row > :first-child { color: var(--text-muted); }
.ba-row > :last-child { color: var(--patina-deep); font-weight: 600; }
[data-theme="dark"] .ba-row > :last-child { color: var(--patina-light); }
.ba-arrow { color: var(--copper-mid); font-weight: 700; }
@media (max-width: 640px) {
  .ba-row {
    gap: 0.45rem;
    padding: 0.7rem 0.75rem;
    font-size: 0.82rem;
  }
  .ba-row.ba-head { font-size: 0.62rem; letter-spacing: 0.04em; }
}

/* Mantra bar: 1 Severity · 2 Priority · 3 Rank, above the simulator */
.model-mantra-bar {
  --mm-bg: #F4F1EC;
  --mm-line: rgba(43, 61, 55, 0.11);
  --mm-ink: #3E4D48;
  --mm-strong: #2B3D37;
  --mm-num-bg: #2B3D37;
  --mm-num-ink: #FAF8F5;
  --mm-accent: #C86D44;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.1rem;
  padding: 0.85rem 1.25rem;
  margin: 1.5rem auto 1.5rem;
  background: var(--mm-bg);
  border: 1px solid var(--mm-line);
  border-radius: 12px;
  font-size: 0.94rem;
  color: var(--mm-ink);
}
[data-theme="dark"] .model-mantra-bar {
  --mm-bg: var(--bg-surface);
  --mm-line: var(--border-subtle);
  --mm-ink: var(--text-secondary);
  --mm-strong: var(--text-primary);
  --mm-num-bg: var(--patina-mid);
  --mm-num-ink: #0F1815;
  --mm-accent: var(--copper-bright);
}
.mantra-item { display: inline-flex; align-items: center; gap: 0.45rem; }
.mantra-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mm-num-bg);
  color: var(--mm-num-ink);
  font-size: 0.68rem;
  font-weight: 700;
}
.mantra-item strong { color: var(--mm-strong); font-weight: 700; }
.mantra-divider { color: var(--mm-accent); font-weight: 700; }
@media (max-width: 640px) {
  .model-mantra-bar { flex-direction: column; align-items: flex-start; }
  .mantra-divider { display: none; }
}

.outcome-views {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0 2.25rem;
}
.outcome-view {
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.15rem 1.25rem 0.4rem;
  background: var(--bg-card);
}
.outcome-view h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  line-height: 1.35;
}
.outcome-view ul {
  margin: 0;
  padding: 0 0 0.6rem 1.1rem;
}
.outcome-view li {
  margin: 0 0 0.7rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.outcome-view li span { color: inherit; }

/* Outcome placeholders */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-top: 1.75rem;
}
.outcome-card {
  border: 1.5px dashed var(--border-patina);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  background: var(--bg-card);
}
.outcome-card strong {
  display: block;
  font-size: 1.6rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.outcome-card span { font-size: 0.88rem; color: var(--text-secondary); }

/* Next cases */
.case-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-top: 1.5rem;
}
.case-next a {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-radius: 18px;
  padding: 1.2rem 1.3rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.case-next a:hover {
  border-color: var(--border-copper);
  transform: translateY(-2px);
}
.case-next span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper-mid);
}
.case-next strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.05rem;
  line-height: 1.35;
}
.case-cta {
  --cta-fill: #F6F4EF;
  --cta-border: rgba(214, 211, 209, 0.8); /* stone-200 / 80 */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.75rem;
  margin-bottom: 2.75rem;
  padding: 2rem;
  border: 1px solid var(--cta-border);
  border-radius: 12px;
  background: var(--cta-fill);
  box-shadow: none;
}
[data-theme="dark"] .case-cta {
  --cta-fill: var(--bg-surface);
  --cta-border: var(--border-subtle);
}
.case-cta > div:first-child { max-width: 42rem; }
@media (min-width: 768px) {
  .case-cta > div:first-child { flex: 1 1 auto; }
}
.case-cta h2 {
  margin: 0.3rem 0 0.6rem;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  max-width: none; /* the column (42rem) sets the measure, not .case-section h2's 24ch */
  text-wrap: balance;
}
.case-cta p {
  margin: 0;
  max-width: 52ch;
  color: var(--text-secondary);
}
.case-cta-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  flex-shrink: 0;
  width: 100%;
}

/* Buttons use the site-wide .btn-copper / .btn-secondary pills (styles.css) */
.case-cta .btn-copper,
.case-cta .btn-secondary { justify-content: center; white-space: nowrap; }

@media (min-width: 640px) {
  .case-cta-actions { flex-direction: row; align-items: center; width: auto; }
}
@media (min-width: 768px) {
  .case-cta {
    flex-direction: row;
    align-items: flex-end; /* buttons sit on the text block's bottom edge, not floating mid-card */
    justify-content: space-between;
    gap: 3rem;
    padding: 2.5rem;
  }
  /* Side by side: buttons stack so the heading gets the width it needs for two lines */
  .case-cta-actions { flex-direction: column; align-items: stretch; min-width: 15rem; }
}

/* —— Severity triage calculator —— */
.triage {
  margin-top: 1.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.triage-presets {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.triage-presets button { white-space: nowrap; flex: 0 0 auto; padding: 0.38rem 0.7rem; font-size: 0.78rem; }
.triage-presets > span {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 0.25rem;
}
.triage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 980px) {
  .triage-grid { grid-template-columns: 1fr; }
}
.triage-step {
  padding: 1.25rem 1.35rem 1.5rem;
  border-right: 1px solid var(--border-subtle);
}
.triage-step:last-child { border-right: 0; }
@media (max-width: 980px) {
  .triage-step { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .triage-step:last-child { border-bottom: 0; }
}
.triage-step > h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.triage-step > h3 span:first-child {
  color: var(--copper-mid);
  margin-right: 0.35rem;
}
.triage-field { margin-bottom: 0.95rem; }
.triage-step:first-child .triage-field { margin-bottom: calc(0.95rem + 6px); }
.triage-field.is-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.triage-field.is-row > p { margin-bottom: 0; }
.chip-group button { white-space: nowrap; }
.chip-group.seg {
  flex-wrap: nowrap;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface);
}
.chip-group.seg button {
  border: 0;
  background: transparent;
  padding: 0.28rem 0.8rem;
  font-size: 0.76rem;
}
.chip-group.seg:not(.seg-full) button { min-width: 3rem; text-align: center; }
.chip-group.seg.seg-full {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
}
.chip-group.seg.seg-full button {
  padding: 0.32rem 0.2rem;
  font-size: 0.74rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.triage-field > p {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip-group button,
.triage-presets button,
.triage-btn,
.yn-list button {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip-group button:hover,
.triage-presets button:hover,
.triage-btn:hover,
.yn-list button:hover { border-color: var(--border-copper); }
.chip-group button[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--patina-deep), var(--patina-mid));
  color: #fff;
  border-color: transparent;
}
.triage-presets button[aria-pressed="true"] {
  background: var(--copper-soft);
  border-color: var(--border-copper);
  color: var(--copper-deep);
}
[data-theme="dark"] .triage-presets button[aria-pressed="true"] { color: var(--copper-sheen); }

.sev-result {
  --sev-c: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 14px;
  color: #fff;
  background: var(--sev-c);
}
.sev-result[data-sev="1"] { --sev-c: #8E2A1A; }
.sev-result[data-sev="2"] { --sev-c: var(--copper-mid); }
.sev-result[data-sev="3"] { --sev-c: var(--patina-moss); }
.sev-result[data-sev="4"] { --sev-c: var(--patina-mid); }
.sev-result[data-sev="0"] { background: transparent; color: var(--copper-mid); border: 1.5px dashed var(--border-copper); }
.sev-result-code { font-size: 1.55rem; font-weight: 800; letter-spacing: 0.02em; line-height: 1.1; }
.sev-name { font-weight: 600; font-size: 0.88rem; opacity: 0.92; }
.sev-reasons {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.1rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-secondary);
}
.sev-reasons li { font-weight: 500; }
.sev-reasons li + li::before {
  content: "·";
  margin: 0 0.5em;
  color: var(--text-muted);
  font-weight: 700;
}
.sev-reasons li.warn { color: var(--copper-deep); font-weight: 600; }
[data-theme="dark"] .sev-reasons li.warn { color: var(--copper-sheen); }

.prio-details { margin-top: 0.85rem; }
.prio-details > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.prio-details > summary::-webkit-details-marker { display: none; }
.prio-details > summary::after { content: " ▾"; display: inline-block; transition: transform 0.15s ease; }
.prio-details[open] > summary::after { transform: rotate(180deg); }
.prio-details > summary:hover { color: var(--copper-mid); }

.yn-list {
  list-style: disc;
  margin: 0.55rem 0 0 1.15rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.yn-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 600;
}
.yn-list button .yn-yes { display: none; }
.yn-list button[aria-pressed="true"] .yn-no { display: none; }
.yn-list button[aria-pressed="true"] .yn-yes { display: inline; }
.yn-list button[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--patina-deep), var(--patina-mid));
  color: #fff;
  border-color: transparent;
}

.prio-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  margin-top: 0.55rem;
  line-height: 1.15;
}
.prio-matrix th,
.prio-matrix td {
  border: 1px solid var(--border-subtle);
  padding: 0.16rem 0.3rem;
  text-align: center;
}
.prio-matrix th {
  background: var(--bg-surface);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.7rem;
}
.prio-matrix td.is-hit {
  background: var(--copper-soft);
  color: var(--copper-deep);
  font-weight: 800;
  box-shadow: inset 0 0 0 2px var(--copper-mid);
}
[data-theme="dark"] .prio-matrix td.is-hit { color: var(--copper-sheen); }
.prio-out {
  font-size: 0.9rem;
  margin-top: 0.75rem;
  color: var(--text-secondary);
}
.prio-out strong { color: var(--text-primary); }

.context-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
}
.context-label { font-size: 0.82rem; font-weight: 700; line-height: 1.2; }
.context-row small { font-size: 0.72rem; color: var(--text-muted); }
.ctx-stepper {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-card);
}
.ctx-stepper button {
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.ctx-stepper button:hover:not(:disabled) { background: var(--copper-soft); color: var(--copper-deep); }
.ctx-stepper button:disabled { opacity: 0.35; cursor: default; }
.ctx-stepper [data-out="rank"] {
  min-width: 2.4rem;
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--copper-deep);
}
[data-theme="dark"] .ctx-stepper [data-out="rank"] { color: var(--copper-sheen); }
.backlog-stack {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}
.backlog-stack li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
}
.backlog-stack li:not(.is-mine) { opacity: 0.55; }
.backlog-stack li.is-mine {
  border-color: var(--border-copper);
  background: var(--copper-soft);
  box-shadow: 0 0 0 1px var(--border-copper);
}
.backlog-pos {
  font-weight: 800;
  color: var(--text-muted);
  width: 1.2rem;
}
.backlog-title { font-weight: 600; line-height: 1.3; }
.backlog-header {
  display: flex;
  justify-content: space-between;
  padding: 0 0.75rem 0.35rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.code-legend { cursor: help; }
.tri-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.tri-code .c-dot { opacity: 0.45; }
.is-mine .tri-code { border-color: var(--border-copper); }
.is-mine .tri-code .c-rank { color: var(--copper-mid); font-weight: 800; }
.triage-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  line-height: 1.45;
}

.case-callout {
  margin-top: 1.25rem;
  border-left: 3px solid var(--copper-mid);
  padding: 0.6rem 0 0.6rem 1rem;
  color: var(--text-secondary);
  max-width: 70ch;
  line-height: 1.6;
}
.case-callout strong { color: var(--copper-deep); }
.case-callout p + p { margin-top: 0.45rem; }
[data-theme="dark"] .case-callout strong { color: var(--copper-sheen); }

/* Priority section: matrix beside the rationale */
.pr-split {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  margin-top: 1.75rem;
}
.pr-split > .compare-wrap { margin-top: 0; }
.pr-split .compare-table { min-width: 0; }
.pr-split .compare-table td[colspan] { text-align: center; }
.pr-why { padding-top: 0.4rem; }
.pr-why .case-subhead { margin: 0 0 0.85rem; max-width: none; }
.pr-why p { color: var(--text-secondary); line-height: 1.6; }
@media (max-width: 860px) {
  .pr-split { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* Rank queue demo (section 03) */
.rank-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 2.25rem;
  align-items: center;
  margin-top: 1.75rem;
}
.rank-layout > .rank-demo { margin-top: 0; }
.rank-layout > .case-callout { margin-top: 0; max-width: none; }
@media (max-width: 980px) {
  .rank-layout { grid-template-columns: 1fr; gap: 1.25rem; }
}
.rank-demo {
  margin-top: 1.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--bg-card);
  overflow: hidden;
}
.rank-demo-header,
.rd-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1.6fr) 6.5rem 12rem 7rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.1rem;
}
.rank-demo-header {
  background: var(--bg-surface);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.rd-row { border-top: 1px solid var(--border-subtle); font-size: 0.9rem; }
.rd-col-pos { font-weight: 800; color: var(--text-muted); }
.rd-col-ticket { font-weight: 600; }
.rd-col-base { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-muted); font-size: 0.82rem; }
.rd-col-ctx { display: inline-flex; align-items: center; gap: 0.15rem; }
.rd-col-ctx button {
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.rd-col-ctx button:hover:not(:disabled) { border-color: var(--border-copper); color: var(--copper-deep); }
.rd-col-ctx button:disabled { opacity: 0.35; cursor: default; }
.rd-col-ctx span { min-width: 1rem; text-align: center; font-weight: 800; font-size: 0.85rem; }
.rd-col-result {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--copper-deep);
}
[data-theme="dark"] .rd-col-result { color: var(--copper-sheen); }
.rank-demo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.rd-reset {
  flex: 0 0 auto;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.rd-reset:hover { border-color: var(--border-copper); }
@media (max-width: 760px) {
  .rank-demo-header { display: none; }
  .rank-demo-header, .rd-row { grid-template-columns: 1.5rem 1fr auto; }
  .rd-col-base { display: none; }
  .rd-col-result { grid-column: 2; }
  .rank-demo-footer { flex-direction: column; align-items: flex-start; }
}


/* —— Severity reference: 4 compact tiers, hard rule, facilitation note —— */
.sev-reference-section {
  --sr-bg: #FAF8F5;
  --sr-ink: #2B3D37;
  --sr-body: #4E5E59;
  --sr-text: #3E4D48;
  --sr-muted: #6E7D78;
  --sr-accent: #C86D44;
  --sr-card: #FFFFFF;
  --sr-line: rgba(43, 61, 55, 0.11);
  --sr-line-soft: rgba(43, 61, 55, 0.07);
  --sr-dot: #9AA6A2;
  --sr-rule-bg: #F4F1EC;
  --sr-rule-badge: #FFF4EE;
  --sr-sev1: #A8382B;
  --sr-sev2: #C86D44;
  --sr-sev3: #388C7E;
  --sr-sev4: #8A9994;
  position: relative;
  z-index: 2;
  padding: 4.5rem 1.5rem;
  background-color: var(--sr-bg);
  border-top: 1px solid var(--sr-line-soft);
}
[data-theme="dark"] .sev-reference-section {
  --sr-bg: var(--bg-surface);
  --sr-ink: var(--text-primary);
  --sr-body: var(--text-secondary);
  --sr-text: var(--text-secondary);
  --sr-muted: var(--text-muted);
  --sr-accent: var(--copper-bright);
  --sr-card: var(--bg-card);
  --sr-line: var(--border-subtle);
  --sr-line-soft: var(--border-subtle);
  --sr-dot: var(--text-muted);
  --sr-rule-bg: var(--bg-card);
  --sr-rule-badge: var(--copper-soft);
  --sr-sev1: #D1584A;
  --sr-sev2: var(--copper-bright);
  --sr-sev3: var(--patina-mid);
  --sr-sev4: #7C8985;
}

.sev-ref-container { max-width: 1080px; margin: 0 auto; }
.sev-ref-header { max-width: 660px; margin-bottom: 2.25rem; }

.sev-reference-section .sev-kicker {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sr-accent);
}
.sev-reference-section .sev-heading {
  max-width: none;
  margin: 0 0 0.75rem;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--sr-ink);
}
.sev-lead { margin: 0; font-size: 0.98rem; line-height: 1.6; color: var(--sr-body); }
.sev-lead strong { font-weight: 600; color: var(--sr-ink); }

.sev-cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.sev-reference-section .sev-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem 1.15rem;
  background: var(--sr-card);
  border: 1px solid var(--sr-line);
  border-top: 3px solid var(--sr-muted);
  border-radius: 12px;
}
.sev-reference-section .sev-card.is-sev1 { border-top-color: var(--sr-sev1); }
.sev-reference-section .sev-card.is-sev2 { border-top-color: var(--sr-sev2); }
.sev-reference-section .sev-card.is-sev3 { border-top-color: var(--sr-sev3); }
.sev-reference-section .sev-card.is-sev4 { border-top-color: var(--sr-sev4); }

.sev-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--sr-line-soft);
}
.sev-badge {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sr-ink);
}
.sev-label { font-size: 0.75rem; font-weight: 600; text-align: right; color: var(--sr-muted); }

.sev-reference-section .sev-examples {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sev-examples li {
  position: relative;
  padding-left: 0.95rem;
  font-size: 0.84rem;
  line-height: 1.48;
  color: var(--sr-text);
}
.sev-examples li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--sr-dot);
}

.sev-guardrail-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 1rem 1.35rem;
  background: var(--sr-rule-bg);
  border: 1px solid var(--sr-line);
  border-left: 3px solid var(--sr-accent);
  border-radius: 0 12px 12px 0;
}
.guardrail-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.65rem;
  background: var(--sr-rule-badge);
  border: 1px solid color-mix(in srgb, var(--sr-accent) 35%, transparent);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--sr-accent);
}
.guardrail-text { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--sr-text); }
.guardrail-text strong { color: var(--sr-ink); }

.sev-facilitation-note {
  max-width: 74ch;
  margin: 1.25rem 0 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--sr-muted);
}

@media (max-width: 960px) {
  .sev-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .sev-reference-section { padding: 3.25rem 1.25rem; }
  .sev-cards-grid { grid-template-columns: 1fr; }
  .sev-guardrail-box { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}
