/* ============================================================
   Phoenix Torch — case-study.css (v3 editorial system)
   Loads after home.css; styles the case-study page sections.
   ============================================================ */

/* ---------- Labels & headlines ---------- */
.cs-label {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 14px; line-height: 18px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.02em;
  margin-bottom: 26px;
}
.cs-headline { font-weight: 500; letter-spacing: -2.1px; text-wrap: balance; }
.cs-headline em { font-style: normal; font-weight: 500; color: var(--blue); }
.section--blue .cs-headline em, .cs-narrative--dark .cs-headline em, .cs-pipeline .cs-headline em { color: var(--paper); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 8px; }
.cs-headline--hero { font-size: 72px; line-height: 80px; letter-spacing: -2.5px; max-width: 1040px; }
.cs-headline--section { font-size: 48px; line-height: 56px; letter-spacing: -1.7px; max-width: 820px; margin-bottom: 40px; }

/* ---------- Hero ---------- */
.cs-hero { position: relative; padding: 96px 0 85px; background: var(--paper); border-bottom: 1px solid var(--hair); }
.cs-hero .cs-label { color: var(--blue); }
.cs-hero__subtitle { margin-top: 32px; font-size: 24px; line-height: 31px; max-width: 760px; }
.cs-hero__meta {
  display: flex; flex-wrap: wrap; gap: 24px 64px;
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--hair);
}
.cs-hero__meta-item { display: flex; flex-direction: column; gap: 8px; }
.cs-hero__meta-label { font-size: 13px; line-height: 17px; font-weight: 500; text-transform: uppercase; color: var(--icon); }
.cs-hero__meta-value { font-size: 20px; line-height: 26px; font-weight: 500; }

/* ---------- Narrative sections ---------- */
.cs-narrative { position: relative; padding: 85px 0; }
.cs-narrative--light { background: var(--paper); color: var(--ink); }
.cs-narrative--dark, .cs-pipeline, .section--blue, .cs-cta-footer { background: var(--blue); color: var(--paper); }
.cs-narrative--light + .cs-narrative--light { border-top: 1px solid var(--hair); }
.cs-narrative__body { max-width: 720px; font-size: 20px; line-height: 30px; }
.cs-narrative__body p + p { margin-top: 20px; }
.cs-body-dark { max-width: 720px; font-size: 20px; line-height: 30px; margin-top: 40px; }
.cs-headline + .cs-body-dark { margin-top: 0; margin-bottom: 40px; }
.cs-closer { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--hair); font-size: 24px; line-height: 32px; max-width: 760px; }
.cs-closer strong { font-weight: 500; }

/* Stacked blue sections get a paper-35 hairline between them */
.cs-narrative--dark + .cs-pipeline, .cs-pipeline + .section--blue, .section--blue + .section--blue, .cs-narrative--dark + .section--blue { border-top: 1px solid rgba(245,243,237,0.35); }

/* On blue, hairlines go paper-35 */
.section--blue, .cs-pipeline, .cs-narrative--dark { --hair: rgba(245,243,237,0.35); --icon: rgba(245,243,237,0.7); }

/* ---------- Pipeline diagram ---------- */
.cs-pipeline { padding: 85px 0; }
.cs-pipeline__grid { display: grid; grid-template-columns: 230px 40px 1fr 56px 290px; align-items: stretch; }
.cs-pipeline__grid > div:first-child, .cs-pipeline__grid > div:nth-child(3), .cs-pipeline__grid > div:last-child { display: flex; flex-direction: column; }
.cs-pipeline__col-label { font-size: 13px; line-height: 17px; font-weight: 500; text-transform: uppercase; text-align: center; margin-bottom: 20px; color: rgba(245,243,237,0.75); }

.psrc-stack { display: flex; flex-direction: column; justify-content: space-between; flex: 1; gap: 8px; }
.cs-pipeline__grid--cpg .psrc-stack { justify-content: flex-start; gap: 12px; }
.psrc {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--paper); position: relative;
  opacity: 0; transform: translateX(-16px); animation: psrcIn 500ms var(--ease-out) forwards;
}
.psrc:nth-child(2){animation-delay:.1s}.psrc:nth-child(3){animation-delay:.2s}.psrc:nth-child(4){animation-delay:.3s}.psrc:nth-child(5){animation-delay:.4s}
@keyframes psrcIn { to { opacity: 1; transform: none; } }
.psrc__icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 500; letter-spacing: 0.02em; }
.psrc__name { font-size: 14px; line-height: 18px; font-weight: 500; }
.psrc__sub { font-size: 12px; line-height: 16px; color: #5c5d59; }
.psrc__preview { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--blue); white-space: nowrap; text-transform: uppercase; }

.pconn { display: flex; align-items: center; justify-content: center; height: 100%; align-self: stretch; }
.pconn svg { width: 40px; height: 100%; min-height: 300px; overflow: visible; }
.pconn__line { stroke: rgba(245,243,237,0.7); stroke-dasharray: 6 4; stroke-linecap: round; animation: dashFlow 1.2s linear infinite; }
.pconn polygon { fill: var(--paper) !important; }
@keyframes dashFlow { to { stroke-dashoffset: -20; } }

.peng { background: var(--paper); color: var(--ink); border: 1px solid var(--paper); padding: 20px 24px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.peng__step { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid #A4A59F; }
.peng__step:first-child { border-top: 0; }
.peng__step-num { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--ink); font-size: 12px; font-weight: 500; }
.peng__step-name { font-size: 16px; line-height: 20px; font-weight: 500; }
.peng__step-desc { font-size: 13px; line-height: 17px; color: #5c5d59; }
.peng__step-check { margin-left: auto; color: var(--blue); font-size: 16px; opacity: 0; animation: checkIn 300ms ease forwards; }
.peng__step:nth-child(3) .peng__step-check{animation-delay:.8s}.peng__step:nth-child(5) .peng__step-check{animation-delay:1.2s}.peng__step:nth-child(7) .peng__step-check{animation-delay:1.6s}.peng__step:nth-child(9) .peng__step-check{animation-delay:2s}
@keyframes checkIn { to { opacity: 1; } }
.peng__arrow { display: none; }

.pconn-out { display: flex; align-items: center; justify-content: center; height: 100%; align-self: stretch; }
.pconn-out svg { width: 56px; height: 100%; min-height: 180px; overflow: visible; }
.pconn-out__shaft { stroke: var(--paper); stroke-width: 2; stroke-dasharray: 8 5; stroke-linecap: round; animation: dashFlow 1.2s linear infinite; }
.pconn-out__head { fill: var(--paper); }
.pconn-out__glow { display: none; }

.pout { display: flex; flex-direction: column; gap: 16px; flex: 1; justify-content: space-between; }
.pout__card { background: var(--paper); color: var(--ink); border: 1px solid var(--paper); padding: 24px; min-height: 240px; opacity: 0; transform: translateX(16px); animation: poutIn 500ms var(--ease-out) forwards; }
.pout__card:nth-child(2){animation-delay:1.6s}.pout__card:nth-child(3){animation-delay:2.4s}
@keyframes poutIn { to { opacity: 1; transform: none; } }
.pout__card-title { font-size: 14px; line-height: 18px; font-weight: 500; text-transform: uppercase; margin-bottom: 14px; }
.pout__card-detail { font-size: 14px; line-height: 20px; color: #5c5d59; }
.pout__card-detail + div, .pout__card > div + div:not(.pout__stat-row) { margin-top: 10px; }
.pout__stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; line-height: 18px; padding: 7px 0; border-bottom: 1px solid #A4A59F; }
.pout__stat-row:last-child { border-bottom: 0; }
.pout__stat-val { font-weight: 500; color: var(--blue); }
.pout__stat-val--warn { font-weight: 500; color: var(--ink); }
.pout__badge { display: inline-block; font-size: 11px; font-weight: 500; text-transform: uppercase; padding: 2px 6px; border: 1px solid currentColor; }
.pout__badge--ready { color: var(--blue); }
.pout__badge--review { color: var(--ink); }
.pout table { width: 100%; font-size: 12px; border-collapse: collapse; }
.pout th { text-align: left; padding: 4px 0; font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: #5c5d59; border-bottom: 1px solid #A4A59F; }
.pout td { padding: 5px 0; border-bottom: 1px solid rgba(164,165,159,0.4); }
.pout th:nth-child(2), .pout th:nth-child(3), .pout td:nth-child(2), .pout td:nth-child(3) { text-align: right; }
.pout th:last-child, .pout td:last-child { text-align: center; }
.pout tr:last-child td { border-bottom: 0; }
.pout__sub { color: #5c5d59; font-size: 12px; }
.pout__ready { margin-top: 12px; font-size: 12px; font-weight: 500; color: var(--blue); }

.cs-pipeline__footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px 64px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--hair); }
.cs-pipeline__footer-stat { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: rgba(245,243,237,0.8); }
.cs-pipeline__footer-stat strong { font-size: 20px; font-weight: 500; color: var(--paper); }

/* Guardrails (CPG) */
.guardrails { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--hair); max-width: 760px; }
.guardrails__title { font-size: 14px; line-height: 18px; font-weight: 500; text-transform: uppercase; margin-bottom: 16px; }
.guardrails__item { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--hair); font-size: 18px; line-height: 26px; }
.guardrails__item strong { font-weight: 500; }
.guardrails__check { flex-shrink: 0; }

/* ---------- Phases (How we worked) ---------- */
.phase-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.phase-grid--4 { grid-template-columns: repeat(4, 1fr); }
.phase { background: var(--paper); color: var(--ink); padding: 24px; display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--ink); }
.phase--live { border-top-color: var(--blue); }
.phase__step { font-size: 13px; line-height: 17px; font-weight: 500; text-transform: uppercase; color: #5c5d59; }
.phase--live .phase__step { color: var(--blue); }
.phase__name { font-size: 20px; line-height: 26px; font-weight: 500; }
.phase__desc { font-size: 15px; line-height: 22px; color: #3f403e; }

/* ---------- Before / after ---------- */
.psbs { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.psbs__header { font-size: 14px; line-height: 18px; font-weight: 500; text-transform: uppercase; padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--paper); }
.psbs__row { font-size: 18px; line-height: 26px; padding: 10px 0; border-bottom: 1px solid var(--hair); margin: 0; }
.psbs__row--bad { color: rgba(245,243,237,0.72); }
.psbs__row--good { color: var(--paper); }
.psummary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 48px; }
.psummary__card { background: var(--paper); color: var(--ink); padding: 24px; }
.psummary__val { font-size: 42px; line-height: 48px; font-weight: 600; letter-spacing: -0.88px; }
.psummary__val--good { color: var(--ink); }
.psummary__label { margin-top: 8px; font-size: 14px; line-height: 20px; color: #5c5d59; }

/* ---------- Recap / impact cards (paper sections) ---------- */
.cs-recap { padding: 85px 0; background: var(--paper); color: var(--ink); border-top: 1px solid var(--hair); }
.cs-recap__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cs-recap__card { position: relative; background: var(--paper); border: 1px solid var(--hair); padding: 40px 28px 36px; display: flex; flex-direction: column; }
.cs-recap__card--featured { border-color: var(--ink); }
.cs-recap__badge { position: absolute; top: -1px; left: 28px; transform: translateY(-50%); background: var(--blue); color: var(--paper); font-size: 12px; line-height: 16px; font-weight: 500; text-transform: uppercase; padding: 4px 8px; }
.cs-recap__icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--icon); color: var(--ink); font-size: 14px; margin-bottom: 20px; }
.cs-recap__icon--teal { color: var(--blue); border-color: var(--blue); }
.cs-recap__card-label { font-size: 13px; line-height: 17px; font-weight: 500; text-transform: uppercase; color: #5c5d59; margin-bottom: 10px; }
.cs-recap__card-title { font-size: 26px; line-height: 32px; font-weight: 500; letter-spacing: -0.3px; margin-bottom: 20px; }
.cs-recap__list { font-size: 16px; line-height: 24px; flex: 1; }
.cs-recap__list strong { font-weight: 500; }
.cs-recap__list-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); }
.cs-recap__list-icon { flex-shrink: 0; margin-top: 2px; }
.cs-recap__list-icon--x { color: var(--icon); }
.cs-recap__stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--hair); }
.cs-recap__stat-label { font-size: 16px; }
.cs-recap__stat-val { font-size: 26px; line-height: 30px; font-weight: 500; color: var(--blue); letter-spacing: -0.3px; white-space: nowrap; }
.cs-recap__use-desc { font-size: 17px; line-height: 25px; }
.cs-recap__kv { padding: 10px 0; border-top: 1px solid var(--hair); }
.cs-recap__kv-label { font-size: 12px; line-height: 16px; font-weight: 500; text-transform: uppercase; color: #5c5d59; }
.cs-recap__kv-desc { font-size: 17px; line-height: 24px; margin-top: 2px; }
.cs-notfor { margin-top: 32px; max-width: 760px; padding: 24px 28px; border: 1px solid var(--hair); }
.cs-notfor__title { font-size: 13px; line-height: 17px; font-weight: 500; text-transform: uppercase; margin-bottom: 8px; color: #5c5d59; }
.cs-notfor p { font-size: 17px; line-height: 25px; }

/* ---------- Calculator ---------- */
.calc { max-width: 860px; }
.calc__controls { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.calc__label { display: block; font-size: 16px; line-height: 22px; margin-bottom: 12px; }
.calc__label strong { font-weight: 500; color: var(--blue); }
.calc input[type="range"] { width: 100%; accent-color: var(--blue); }
.calc__results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.calc__res { border: 1px solid var(--hair); padding: 24px; }
.calc__res-val { font-size: 42px; line-height: 48px; font-weight: 500; letter-spacing: -0.88px; color: var(--blue); }
.calc__res-label { margin-top: 6px; font-size: 14px; line-height: 20px; color: #5c5d59; }
.calc__note { margin-top: 16px; font-size: 14px; line-height: 20px; color: #5c5d59; }

/* ---------- CTA band ---------- */
.cs-cta-footer { padding: 85px 0; }
.cs-cta-footer__card { display: flex; }
.cs-cta-footer__inner { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 32px 48px; width: 100%; }
.cs-cta-footer__label { font-size: 14px; line-height: 18px; font-weight: 500; text-transform: uppercase; margin-bottom: 20px; }
.cs-cta-footer__text { font-size: 36px; line-height: 44px; font-weight: 500; letter-spacing: -1px; max-width: 760px; }
.cs-cta-footer__text em { font-style: normal; font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 8px; }
.cs-cta-footer .btn--dark:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .cs-headline--hero { font-size: 60px; line-height: 66px; }
  .cs-pipeline__grid { grid-template-columns: 200px 36px 1fr 48px 250px; }
  .phase-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .cs-pipeline__grid { grid-template-columns: 1fr; gap: 24px; }
  .pconn, .pconn-out { display: none; }
  .psrc, .pout__card { opacity: 1; transform: none; animation: none; }
  .peng__step-check { opacity: 1; animation: none; }
  .psrc-stack { justify-content: flex-start; }
  .cs-recap__grid { grid-template-columns: 1fr; }
  .psbs { grid-template-columns: 1fr; gap: 24px; }
  .psummary { grid-template-columns: 1fr 1fr; }
  .phase-grid, .phase-grid--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .cs-hero { padding: 48px 0 60px; }
  .cs-headline--hero { font-size: 40px; line-height: 44px; letter-spacing: -1.4px; }
  .cs-headline--section { font-size: 32px; line-height: 38px; letter-spacing: -1.1px; margin-bottom: 28px; }
  .cs-hero__subtitle { font-size: 19px; line-height: 26px; margin-top: 20px; }
  .cs-hero__meta { gap: 20px 32px; margin-top: 36px; }
  .cs-narrative, .cs-recap, .cs-pipeline, .cs-cta-footer, .section--blue { padding: 60px 0; }
  .cs-narrative__body, .cs-body-dark { font-size: 17px; line-height: 25px; }
  .cs-closer { font-size: 20px; line-height: 27px; }
  .phase-grid, .phase-grid--4, .psummary, .calc__controls, .calc__results { grid-template-columns: 1fr; }
  .cs-cta-footer__text { font-size: 26px; line-height: 32px; }
  .cs-cta-footer__inner { align-items: flex-start; }
}
@media print {
  .nav, .btn, .footer { display: none; }
  .psrc, .pout__card { opacity: 1; transform: none; animation: none; }
  .peng__step-check { opacity: 1; animation: none; }
}
