/* ------------------------------------------------------------------
   case-study.css — project case-study pages
   ------------------------------------------------------------------ */

/* --- Top bar -------------------------------------------------------- */

.case-topbar {
  border-top: 1px solid var(--line-strong);
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}

.case-back {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 10.5px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.case-back:hover {
  color: var(--red);
}

.case-back-square {
  width: 8px;
  height: 8px;
  background: var(--red);
}

.case-count {
  font: 500 10.5px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray);
}

/* --- Hero ------------------------------------------------------------ */

.case-hero {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 3vw, 36px);
  align-items: flex-start;
}

.case-hero-main {
  flex: 1 1 420px;
}

.case-kicker {
  display: inline-block;
  padding: 4px 9px;
  background: var(--red);
  color: var(--paper);
  font: 700 9.5px var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.case-title {
  margin: 12px 0 0;
  font-weight: 900;
  font-size: clamp(34px, 5.2vw, 54px);
  line-height: .94;
  letter-spacing: -.045em;
  text-transform: uppercase;
  max-width: 520px;
}

.case-repo {
  margin-top: 10px;
  font: 500 11px var(--mono);
  letter-spacing: .04em;
  color: var(--gray-faint);
}

.case-stat-banner {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: var(--red);
  color: var(--paper-red);
  padding: 16px 20px;
  box-shadow: 5px 5px 0 0 var(--ink);
}

.case-stat-number {
  font-weight: 900;
  font-size: clamp(40px, 6vw, 52px);
  line-height: .88;
  letter-spacing: -.05em;
}

.case-stat-text {
  flex: 1 1 220px;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
}

/* --- Spec sheet ------------------------------------------------------ */

.spec-sheet {
  flex: 0 1 306px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  padding: 0 0 12px;
}

.spec-head {
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font: 700 9.5px var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
}

.spec-rows {
  padding: 12px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--mono);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 7px;
}

.spec-key {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-faint);
}

.spec-val {
  font-size: 11.5px;
  text-align: right;
  line-height: 1.5;
}

.spec-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.spec-btn {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  font: 600 10px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all .14s;
}

.spec-btn--solid {
  background: var(--ink);
  color: var(--paper);
}

.spec-btn--solid:hover {
  background: var(--red);
  color: var(--paper);
}

.spec-btn--outline {
  border: 1.5px solid var(--ink);
  color: var(--ink);
}

.spec-btn--outline:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--paper-teal);
}

/* --- Sections -------------------------------------------------------- */

.case-abstract {
  margin-top: clamp(24px, 3.4vw, 32px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2.6vw, 26px);
}

.case-abstract-label {
  flex: 0 0 130px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding-top: 4px;
}

.case-abstract-label::before {
  content: "";
  display: block;
  width: 34px;
  height: 5px;
  background: var(--red);
  margin-bottom: 9px;
}

.case-abstract-text {
  margin: 0;
  flex: 1 1 420px;
  font-weight: 400;
  font-size: clamp(15px, 1.7vw, 16.5px);
  line-height: 1.62;
  color: var(--text);
  max-width: 660px;
  text-wrap: pretty;
}

.case-section {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2.6vw, 26px);
  padding-top: 18px;
}

.case-section--strong {
  border-top: 3px solid var(--ink);
}

.case-section--first {
  margin-top: clamp(28px, 4vw, 34px);
}

.case-section--light {
  border-top: 1px solid var(--line-strong);
}

.case-section-label {
  flex: 0 0 130px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.case-section-num {
  display: inline-block;
  padding: 3px 7px;
  background: var(--ink);
  color: var(--paper);
  margin-bottom: 8px;
}

.case-section-body {
  flex: 1 1 420px;
}

.case-prose {
  margin: 0;
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  max-width: 640px;
  text-wrap: pretty;
}

.case-split {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(18px, 2.6vw, 30px);
  align-items: flex-start;
}

.case-split > .case-prose {
  flex: 1 1 260px;
}

/* --- Figures --------------------------------------------------------- */

.fig-frame {
  margin: 0;
  border: 1.5px solid var(--ink);
  padding: 6px;
  background: var(--surface);
}

.fig-frame--hero {
  margin-top: 26px;
}

.fig-frame--inline {
  margin-top: 16px;
  padding: 5px;
}

.fig-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  padding: 12px;
  background: #e3e1db;
  border: 1.5px dashed rgba(0, 0, 0, .35);
  color: var(--gray-mid);
  font: 500 11px/1.6 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.fig-placeholder--hero {
  height: clamp(200px, 32vw, 310px);
}

.fig-placeholder--inline {
  height: clamp(150px, 22vw, 190px);
}

.fig-caption {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
}

.fig-caption--tight {
  margin-top: 7px;
}

.fig-tag {
  font: 700 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--red);
}

.fig-text {
  font: 500 11.5px var(--mono);
  color: var(--gray);
}

/* --- Inline charts --------------------------------------------------- */

.chart-panel {
  flex: 1 1 300px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  padding: 12px 12px 8px;
}

.chart-panel svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font: 500 9.5px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-legend-note {
  margin-left: auto;
}

.legend-swatch-line {
  width: 12px;
  height: 2px;
  background: var(--teal);
}

.legend-swatch-line--thick {
  height: 3px;
  background: var(--red);
}

/* Results bar chart */

.case-results {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 3vw, 34px);
  align-items: flex-end;
}

.bar-chart-wrap {
  flex: 1 1 280px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(14px, 2.4vw, 26px);
  height: 150px;
  border-bottom: 3px solid var(--ink);
}

.bar-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
}

.bar {
  flex: 1;
  border: 1.5px solid var(--ink);
  border-bottom: none;
}

.bar--baseline { background: #cfcdc7; }
.bar--tsfm { background: var(--red); }

.bar-labels {
  display: flex;
  gap: clamp(14px, 2.4vw, 26px);
  margin-top: 7px;
}

.bar-label {
  flex: 1;
  font: 600 10px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-mid);
  text-align: center;
}

.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
  font: 500 10px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray);
}

.bar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch-box {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--ink);
}

.legend-swatch-box--baseline { background: #cfcdc7; }
.legend-swatch-box--tsfm { background: var(--red); }

/* Results table */

.metrics-table-wrap {
  flex: 1 1 260px;
}

.metrics-table {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0 16px;
}

.metrics-th {
  font: 600 9px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-faint);
  padding-bottom: 7px;
  border-bottom: 3px solid var(--ink);
}

.metrics-th--num {
  text-align: right;
}

.metrics-th--accent {
  color: var(--red);
}

.metrics-name {
  padding: 9px 0;
  border-bottom: 1px solid rgba(0, 0, 0, .16);
  font-weight: 500;
  font-size: 13.5px;
}

.metrics-val {
  padding: 9px 0;
  border-bottom: 1px solid rgba(0, 0, 0, .16);
  font: 400 12.5px var(--mono);
  text-align: right;
  color: var(--gray-dim);
}

.metrics-val--mid {
  font-weight: 500;
  color: var(--ink);
}

.metrics-val--win {
  font-weight: 700;
  color: var(--red);
}

/* --- Lessons block ---------------------------------------------------- */

.case-lessons {
  margin-top: 30px;
  background: var(--teal);
  color: #eef5f5;
  padding: clamp(20px, 3vw, 26px) clamp(20px, 3vw, 30px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2.6vw, 26px);
  box-shadow: 5px 5px 0 0 var(--ink);
}

.case-lessons-label {
  flex: 0 0 130px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--teal-pale);
}

.case-lessons-label::before {
  content: "";
  display: block;
  width: 34px;
  height: 5px;
  background: var(--teal-pale);
  margin-bottom: 9px;
}

.case-lessons-text {
  margin: 0;
  flex: 1 1 380px;
  font-weight: 400;
  font-size: clamp(15px, 1.7vw, 16px);
  line-height: 1.6;
  max-width: 620px;
  text-wrap: pretty;
}

/* --- Foot nav ---------------------------------------------------------- */

.case-footnav {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line-strong);
  padding-top: 14px;
  font: 700 10.5px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.case-footnav a {
  text-decoration: none;
  color: var(--ink);
}

.case-footnav-back:hover {
  color: var(--red);
}

.case-footnav-next {
  display: flex;
  align-items: center;
  gap: 8px;
}

.case-footnav-next:hover {
  color: var(--teal);
}

.case-footnav-next-square {
  width: 8px;
  height: 8px;
  background: var(--teal);
}
