/* HSEP case study page styles (projects/hsep/), scoped under .hsep-case-study. Chart colors validated against the #0a0f1e surface. */

.hsep-case-study {
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.72);
  --hsep-surface: #0a0f1e;
  --hsep-accent: #0bceaf;            /* site accent teal, sequential single-hue charts */
  --hsep-activation: #0a9e85;        /* darkened teal, validated vs orange for categorical pair */
  --hsep-completion: #d95926;        /* orange, "completion" series */
  --hsep-status-serious: #ec835a;    /* status color, flagged low-scoring items only, always with a label */
  --hsep-panel-bg: rgba(255, 255, 255, 0.035);
  --hsep-panel-border: rgba(255, 255, 255, 0.09);
  --hsep-track: rgba(255, 255, 255, 0.06);
  padding-top: 100px;
  padding-bottom: clamp(56px, 10vw, 96px);
  min-height: 100vh;
}

.hsep-case-study p {
  opacity: 1;
}

.hsep-case-study__inner {
  max-width: min(880px, calc(100vw - 32px));
  margin: 0 auto;
}

.hsep-case-study__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: clamp(24px, 4vw, 40px);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
}

.hsep-case-study__back:hover {
  color: var(--hsep-accent);
  text-decoration: none;
}

/* ---------- Hero ---------- */

.hsep-hero {
  margin-bottom: clamp(48px, 7vw, 80px);
  padding: clamp(8px, 2vw, 16px) 0 clamp(8px, 2vw, 24px);
}

.hsep-hero__kicker {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hsep-accent);
}

.hsep-hero__title {
  margin: 0 0 18px;
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.12;
  color: var(--text-primary);
}

.hsep-hero__lead {
  font-size: clamp(1.02rem, 1.6vw, 1.15rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.hsep-hero__rule {
  margin: clamp(24px, 4vw, 32px) 0;
  border: none;
  border-top: 1px solid var(--hsep-panel-border);
}

.hsep-hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.hsep-hero__stats--inset {
  margin-top: 20px;
}

.hsep-stat {
  padding: 16px;
  background: var(--hsep-panel-bg);
  border: 1px solid var(--hsep-panel-border);
  border-radius: var(--radius-md, 12px);
}

.hsep-stat__value {
  display: block;
  font-family: "Fraunces", serif;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
}

.hsep-stat__label {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ---------- Callout sections ---------- */

.hsep-callout {
  margin-bottom: clamp(40px, 6vw, 64px);
}

.hsep-callout__kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hsep-accent);
}

.hsep-callout__title {
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  color: var(--text-primary);
}

.hsep-callout__body {
  color: var(--text-secondary);
  line-height: 1.65;
}

.hsep-callout__body + .hsep-callout__body {
  margin-top: 12px;
}

.hsep-callout__body strong {
  color: var(--text-primary);
}

.hsep-callout__body a,
.hsep-timeline__text a,
.hsep-sources__list a {
  color: var(--hsep-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.hsep-callout__body a:hover,
.hsep-timeline__text a:hover,
.hsep-sources__list a:hover {
  color: var(--text-primary);
}

.hsep-callout__body--note {
  margin-top: 14px;
  font-size: 0.85rem;
}

.hsep-callout__title--sub {
  font-size: 1.2rem;
}

/* ---------- Photo ---------- */

.hsep-photo {
  margin: clamp(28px, 4vw, 40px) 0;
}

.hsep-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--hsep-panel-border);
}

.hsep-photo figcaption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ---------- Cliff chart (hero column chart) ---------- */

.hsep-cliff {
  margin: 20px 0 24px;
  padding: clamp(20px, 3vw, 28px);
  background: var(--hsep-panel-bg);
  border: 1px solid var(--hsep-panel-border);
  border-radius: var(--radius-lg, 16px);
}

.hsep-cliff__title {
  margin: 0 0 16px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.hsep-cliff__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hsep-cliff__row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.hsep-cliff__row-label {
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.hsep-cliff__row-track {
  position: relative;
  display: block;
  height: 22px;
  background: var(--hsep-track);
  border-radius: 5px;
  overflow: hidden;
}

.hsep-cliff__row-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--hsep-accent);
  border-radius: 5px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.hsep-cliff__row--zero .hsep-cliff__row-fill {
  background: var(--hsep-status-serious);
  width: 1.5% !important;
}

.hsep-cliff__row-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
}

.hsep-cliff__annotation {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--hsep-panel-border);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.hsep-cliff__annotation strong {
  color: var(--hsep-status-serious);
}

/* ---------- Line chart (activation vs completion, day over day) ---------- */

.hsep-linechart {
  width: 100%;
  margin-top: 24px;
}

.hsep-linechart__svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.hsep-linechart__grid {
  stroke: var(--hsep-panel-border);
  stroke-width: 1;
}

.hsep-linechart__axis-label {
  fill: var(--text-secondary);
  font-size: 11px;
}

.hsep-linechart__line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hsep-linechart__line--activation {
  stroke: var(--hsep-activation);
}

.hsep-linechart__line--completion {
  stroke: var(--hsep-completion);
}

.hsep-linechart__dot {
  stroke: var(--hsep-surface);
  stroke-width: 2;
}

.hsep-linechart__dot--activation {
  fill: var(--hsep-activation);
}

.hsep-linechart__dot--completion {
  fill: var(--hsep-completion);
}

.hsep-linechart__value-label {
  fill: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}

.hsep-legend {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.hsep-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hsep-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hsep-legend__swatch--activation {
  background: var(--hsep-activation);
}

.hsep-legend__swatch--completion {
  background: var(--hsep-completion);
}

/* ---------- Horizontal bar chart (weakest survey items) ---------- */

.hsep-barchart {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.hsep-barchart__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 40%);
  align-items: center;
  gap: 12px;
}

.hsep-barchart__label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hsep-barchart__track {
  position: relative;
  flex: 1 1 auto;
  min-width: 60px;
  height: 10px;
  background: var(--hsep-track);
  border-radius: 6px;
  overflow: hidden;
}

.hsep-barchart__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--hsep-accent);
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.hsep-barchart__row--flag .hsep-barchart__fill {
  background: var(--hsep-status-serious);
}

.hsep-barchart__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.hsep-barchart__pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 3.4ch;
  text-align: right;
}

.hsep-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hsep-surface);
  background: var(--hsep-status-serious);
  border-radius: 999px;
}

/* ---------- Chart figure ---------- */

.hsep-chart {
  margin: 24px 0 0;
}

.hsep-photo--hero {
  margin: clamp(24px, 4vw, 36px) 0 0;
}

.hsep-callout__body--spaced {
  margin-top: 20px;
}

/* ---------- Partner table ---------- */

.hsep-table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  background: var(--hsep-panel-bg);
  border: 1px solid var(--hsep-panel-border);
  border-radius: var(--radius-lg, 16px);
}

.hsep-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.hsep-table__caption {
  caption-side: top;
  padding: 16px 18px 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hsep-accent);
}

.hsep-table th,
.hsep-table td {
  padding: 12px 18px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--hsep-panel-border);
}

.hsep-table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.hsep-table tbody th {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ---------- Pipeline flow ---------- */

.hsep-flow {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  counter-reset: hsep-flow;
}

.hsep-flow__step {
  position: relative;
  padding: 14px 16px;
  background: var(--hsep-panel-bg);
  border: 1px solid var(--hsep-panel-border);
  border-radius: var(--radius-md, 12px);
  counter-increment: hsep-flow;
}

.hsep-flow__step::before {
  content: counter(hsep-flow, decimal-leading-zero);
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--hsep-accent);
}

.hsep-flow__name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
}

.hsep-flow__detail {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* ---------- Shutdown timeline ---------- */

.hsep-timeline {
  list-style: none;
  margin: 20px 0 24px;
  padding: 0 0 0 20px;
  border-left: 2px solid var(--hsep-panel-border);
}

.hsep-timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.hsep-timeline__item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--hsep-accent);
  box-shadow: 0 0 0 3px var(--hsep-surface);
}

.hsep-timeline__item--alert::before {
  background: var(--hsep-status-serious);
}

.hsep-timeline__date {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.hsep-timeline__text {
  color: var(--text-secondary);
}

/* ---------- Sources ---------- */

.hsep-sources__list {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---------- Footer credit ---------- */

.hsep-case-study .page-credits {
  margin-top: clamp(40px, 6vw, 64px);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .hsep-hero__stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .hsep-barchart__row {
    grid-template-columns: 1fr;
  }

  .hsep-barchart__meta {
    justify-content: flex-start;
  }

  .hsep-cliff__row {
    grid-template-columns: 52px minmax(0, 1fr) 36px;
  }

  .hsep-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hsep-timeline__item {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  /* Stack partner table rows as cards */
  .hsep-table {
    min-width: 0;
  }

  .hsep-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .hsep-table tr,
  .hsep-table th,
  .hsep-table td {
    display: block;
  }

  .hsep-table tbody tr {
    padding: 12px 0;
    border-top: 1px solid var(--hsep-panel-border);
  }

  .hsep-table tbody th,
  .hsep-table td {
    padding: 2px 18px;
    border-top: none;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hsep-cliff__row-fill,
  .hsep-barchart__fill {
    transition: none;
  }
}
