/* ============================================
   Transformations page (projects.html)
   Editorial case-study system: one structure for every case,
   a sticky facts column, inline SVG diagrams.
   Builds on the tokens and components in style.css.
   ============================================ */

/* --- Page header --- */
.tx-hero h1 { max-width: 22ch; }
.tx-hero .lead { max-width: 46rem; margin-bottom: 0; }

/* --- Jump index --- */
.tx-index {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) minmax(0, 0.9fr);
  gap: 2rem 3rem;
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.tx-index__title,
.tx-key__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.tx-index ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tx-index__group--supporting ol {
  columns: 2;
  column-gap: 2.5rem;
}

.tx-index li {
  break-inside: avoid;
  border-top: 1px solid var(--color-border-light);
}

.tx-index a {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.tx-index a:hover { color: var(--color-accent); }

.tx-index__num {
  flex: 0 0 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.9;
  color: var(--color-accent);
}

/* --- Accountability key --- */
.tx-key {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-light);
}

.tx-key dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 2rem;
  max-width: 54rem;
  margin: 0;
}

.tx-key dt { margin-bottom: 0.375rem; }

.tx-key dd {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* --- Accountability badges --- */
.tx-badge {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid currentColor;
  border-radius: 4px;
}

/* In the facts column, long labels wrap inside the column instead of running past it. */
.tx-meta .tx-badge { white-space: normal; }

.tx-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tx-badge--designed {
  color: var(--color-primary);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.tx-badge--led {
  color: var(--color-accent);
  background: var(--color-accent-glow);
  border-color: var(--color-accent-border);
}

.tx-badge--team {
  color: var(--color-blue);
  background: rgba(74, 158, 255, 0.08);
  border-color: rgba(74, 158, 255, 0.35);
}

.tx-badge--sponsored {
  color: var(--color-purple);
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.35);
}

.tx-badge--contributed {
  color: var(--color-text-secondary);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.tx-badge--practice {
  color: var(--color-text-muted);
  border-style: dashed;
  border-color: var(--color-text-muted);
}

/* --- Section heads --- */
.tx-section-head {
  max-width: 46rem;
  margin-bottom: 1rem;
}

.tx-section-head h2 { margin-bottom: 0.75rem; }
.tx-section-head p { margin-bottom: 0; }

/* --- Case study --- */
.tx-case {
  padding: 4rem 0;
  border-top: 1px solid var(--color-border);
  scroll-margin-top: 80px;
}

.tx-case:last-child { padding-bottom: 1rem; }

.tx-case__head {
  max-width: 52rem;
  margin-bottom: 2.5rem;
}

.tx-case__kicker {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.tx-case__num { color: var(--color-text-muted); }

.tx-case__title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  margin-bottom: 0.875rem;
}

.tx-case__dek {
  max-width: 44rem;
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.tx-case__grid {
  display: grid;
  grid-template-columns: 15rem minmax(0, 46rem);
  gap: 4rem;
  align-items: start;
}

/* Facts column */
.tx-meta {
  position: sticky;
  top: 96px;
}

.tx-meta__facts { margin: 0; }

.tx-meta__item {
  padding: 0.75rem 0;
  border-top: 1px solid var(--color-border);
}

.tx-meta__item:first-child { border-top-color: var(--color-accent-border); }

.tx-meta dt,
.tx-figures__label--mono {
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.tx-meta dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text);
}

.tx-meta__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tx-meta__list li + li { margin-top: 0.25rem; }

.tx-figures {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 1rem 0 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}

.tx-figures__value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-accent);
}

.tx-figures__label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.tx-meta__note {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.tx-meta__back {
  display: inline-block;
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.tx-meta__back:hover { color: var(--color-accent); }

/* Narrative column */
.tx-story { margin: 0; }

.tx-story__row { padding-bottom: 1.875rem; }
.tx-story__row:last-child { padding-bottom: 0; }

.tx-story dt {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.tx-story dt::before {
  content: "";
  flex: 0 0 1.25rem;
  height: 1px;
  background: var(--color-accent-border);
}

.tx-story dd { margin: 0; }

.tx-story dd p {
  margin-bottom: 0.75rem;
  line-height: 1.75;
}

.tx-story dd p:last-child { margin-bottom: 0; }

.tx-story__row--outcome dd p { color: var(--color-text); }

.tx-story__row--capability dd {
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius);
}

.tx-story__row--capability dd p { color: var(--color-text); }

.tx-lessons {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tx-lessons li {
  font-weight: 600;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 1px solid var(--color-accent-border);
  font-family: var(--font-heading);
  font-size: 1.1875rem;
  font-style: normal;
  line-height: 1.6;
  color: var(--color-text);
}

.tx-lessons li + li { margin-top: 0.875rem; }

.tx-tags { margin-bottom: 0.5rem; }
.tx-tags .skill-tag:hover { cursor: default; }

.tx-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.tx-links .btn--ghost {
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
  font-size: 0.8125rem;
}

/* Compact variant: supporting work and earlier foundations */
.tx-case--compact { padding: 3rem 0; }
.tx-case--compact .tx-case__head { margin-bottom: 1.75rem; }
.tx-case--compact .tx-case__title { font-size: clamp(1.35rem, 2.4vw, 1.625rem); margin-bottom: 0; }
.tx-case--compact .tx-meta { position: static; }
.tx-case--compact .tx-figures__value { font-size: 1.375rem; }

.tx-case--compact .tx-story {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.5rem;
}

.tx-case--compact .tx-story__row { padding-bottom: 1.375rem; }

.tx-case--compact .tx-story__row--lessons,
.tx-case--compact .tx-story__row--tech { grid-column: 1 / -1; }

.tx-case--compact .tx-story dd p { font-size: 0.9375rem; line-height: 1.7; }
.tx-case--compact .tx-lessons li { font-size: 1.0625rem; }

/* --- Diagrams --- */
.tx-figure.diagram {
  margin: 1.5rem 0 0.25rem;
  padding: 1.5rem 1.5rem 1.125rem;
}

.tx-figure svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.tx-figure .diagram__caption {
  margin-top: 1.125rem;
  padding-top: 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  letter-spacing: 0.01em;
  text-transform: none;
  text-align: left;
}

.tx-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.tx-figure .tx-svg--narrow,
.tx-figure .tx-svg--narrow-lg { display: none; }

.tx-figure .tx-svg--narrow,
.tx-figure .tx-svg--narrow-lg { max-width: 400px; }

/* SVG vocabulary (colours come from the site tokens) */
/* Base text styles sit on the <svg> so classes on <g> groups can override them. */
.tx-figure svg {
  font-family: var(--font-body);
  font-size: 13px;
  fill: var(--color-text);
}

.tx-figure .d-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.tx-figure .d-title { font-size: 15px; font-weight: 600; }
.tx-figure .d-strong { font-weight: 600; }
.tx-figure .d-sec { fill: var(--color-text-secondary); }
.tx-figure .d-muted { fill: var(--color-text-muted); }
.tx-figure .d-acc { fill: var(--color-accent); }
.tx-figure .d-bgfill { fill: var(--color-bg-dark); }

.tx-figure .d-box {
  fill: var(--color-surface);
  stroke: var(--color-text-muted);
  stroke-opacity: 0.45;
  stroke-width: 1;
}

.tx-figure .d-box--acc {
  fill: var(--color-surface-elevated);
  stroke: var(--color-accent);
  stroke-opacity: 1;
  stroke-width: 1.5;
}

.tx-figure .d-band {
  fill: var(--color-accent-glow);
  stroke: var(--color-accent-border);
  stroke-width: 1;
}

.tx-figure .d-line {
  fill: none;
  stroke: var(--color-text-muted);
  stroke-opacity: 0.6;
  stroke-width: 1.25;
}

.tx-figure .d-line--dash { stroke-dasharray: 4 4; }

.tx-figure .d-line--acc {
  fill: none;
  stroke: var(--color-accent);
  stroke-opacity: 1;
  stroke-width: 1.5;
}

.tx-figure .d-grid {
  stroke: var(--color-text-muted);
  stroke-opacity: 0.16;
  stroke-width: 1;
}

.tx-figure .d-gate {
  fill: var(--color-accent);
  stroke: var(--color-bg-dark);
  stroke-width: 3;
}

.tx-figure .d-bar--sig { fill: var(--color-accent); }
.tx-figure .d-bar--sup { fill: var(--color-text-muted); }

.tx-figure .d-role {
  fill: var(--color-surface-elevated);
  stroke: var(--color-text-muted);
  stroke-opacity: 0.35;
}

.tx-figure .d-role--now { stroke: var(--color-accent); stroke-opacity: 1; }

/* --- Closing --- */
.tx-cta .lead { max-width: 36rem; margin: 0 auto 2rem; }

/* --- Responsive --- */
@media (max-width: 1099px) {
  .tx-case__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    max-width: 46rem;
  }

  .tx-meta {
    position: static;
    padding: 0.25rem 1.25rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
  }

  .tx-meta__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.5rem;
  }

  .tx-meta__item:nth-child(n + 3) { grid-column: 1 / -1; }

  .tx-meta__item,
  .tx-meta__item:first-child { border-top: none; }

  .tx-figures {
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 1rem 1.5rem;
  }

  .tx-meta__back { display: none; }
}

@media (max-width: 1024px) {
  .tx-index { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .tx-key dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tx-figure .tx-svg--wide-lg { display: none; }
  .tx-figure .tx-svg--narrow-lg { display: block; }
}

@media (max-width: 860px) {
  .tx-figure .tx-svg--wide { display: none; }
  .tx-figure .tx-svg--narrow { display: block; }
  .tx-pair { grid-template-columns: minmax(0, 1fr); }
  .tx-figure .tx-pair svg { max-width: 360px; }
}

@media (max-width: 640px) {
  .tx-case { padding: 3rem 0; }
  .tx-case__head { margin-bottom: 1.75rem; }
  .tx-case__dek { font-size: 1.0625rem; }
  .tx-case--compact .tx-story { grid-template-columns: minmax(0, 1fr); }
  .tx-lessons li { font-size: 1.0625rem; }
  .tx-index__group--supporting ol { columns: 1; }
  .tx-key dl { grid-template-columns: minmax(0, 1fr); }
  .tx-figures__value { font-size: 1.375rem; }
}

@media (max-width: 560px) {
  .tx-figure.diagram {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 1rem 0.625rem 0.75rem;
    border-radius: var(--radius);
  }

  .tx-figure .diagram__caption { padding-left: 0.375rem; padding-right: 0.375rem; }
  .tx-meta { padding-left: 1rem; padding-right: 1rem; }
  .tx-meta__facts { gap: 0 1rem; }
}

@media (max-width: 380px) {
  .tx-figure .d-mono { font-size: 13px; }
}

@media print {
  .tx-meta { position: static; }
  .tx-figure .tx-svg--wide, .tx-figure .tx-svg--wide-lg { display: block !important; }
  .tx-figure .tx-svg--narrow, .tx-figure .tx-svg--narrow-lg { display: none !important; }
}
