/* Styles used only on the EcoWise "How it works" page
   (/ecowise/how-it-works/). Load after shared.css and ecowise.css —
   the report card, tags and uplift bar are reused from ecowise.css. */

/* ---- Dark shell ---- */
/* The hero and journey are separate bands: the hero carries the same
   radial gradient as the main EcoWise hero, the journey sits on solid
   forest-1 behind a hairline seam. */
.hiw-dark { color: var(--cream); }
.hiw-dark .hero-nav .logo { font-family: var(--serif); font-weight: 640; font-size: 22px; letter-spacing: -0.02em; color: var(--cream); text-decoration: none; display: inline-flex; align-items: center; gap: 0.5em; }
.hiw-dark .logo .logo-ai { color: var(--lime); font-style: italic; font-weight: 560; }

/* ---- Hero ---- */
.hiw-hero { padding: 40px 0 76px; text-align: center; background: radial-gradient(125% 125% at 50% 36%, var(--forest-1) 0%, var(--forest-2) 80%); }
.hiw-eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #7FA78D; margin: 0 0 18px; }
.hiw-title { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; line-height: 1.05; font-size: clamp(40px, 6.4vw, 68px); color: var(--cream); margin: 0 auto; text-wrap: balance; text-shadow: 0 8px 36px rgba(2, 14, 8, 0.55); }
.hiw-title .accent { color: var(--lime); font-style: italic; }
.hiw-lede { font-size: clamp(16px, 2.2vw, 19px); color: var(--sage); max-width: 46ch; margin: 22px auto 0; line-height: 1.6; }
.hiw-ctas { margin-top: 34px; display: flex; align-items: center; justify-content: center; gap: 26px; }

/* ---- Journey (scroll-driven) ---- */
.journey { padding: 36px 0 96px; scroll-margin-top: 12px; background: var(--forest-1); border-top: 1px solid rgba(159, 195, 170, 0.16); }
.j-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: clamp(40px, 6vw, 88px); align-items: start; }
.j-sticky { grid-column: 2; grid-row: 1; position: sticky; top: 24px; height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; }
.j-steps { grid-column: 1; grid-row: 1; }
.j-step { min-height: 74vh; display: flex; flex-direction: column; justify-content: center; padding: 44px 0; }
.j-step:first-child { min-height: 56vh; }
.j-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: #7FA78D; margin: 0; }
.j-h { font-family: var(--serif); font-weight: 560; letter-spacing: -0.015em; font-size: clamp(26px, 3vw, 36px); line-height: 1.12; color: var(--cream); margin: 10px 0 0; }
.j-h .accent { color: var(--lime); font-style: italic; }
.j-body { font-size: 17px; color: var(--sage); max-width: 46ch; margin: 16px 0 0; line-height: 1.65; }
.j-body strong { color: var(--cream); font-weight: 600; }
.j-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; max-width: 46ch; }
.j-list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline; font-size: 16px; color: var(--sage); line-height: 1.55; }
.j-list strong { color: var(--cream); font-weight: 600; }
.j-dot { width: 10px; height: 10px; border-radius: 50%; transform: translateY(1px); }
.j-dot-perf { background: #3ECF9B; }
.j-dot-ml { background: #8F82F0; }
.j-dot-ctx { background: #F0A05A; }
.j-stat { margin-top: 30px; }
.j-num { display: block; font-family: var(--serif); font-weight: 560; font-size: 46px; line-height: 1; color: var(--lime); font-variant-numeric: tabular-nums; }
.j-cap { display: block; margin-top: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #7FA78D; }

/* Step dimming — applied only when the scroll engine is running (html.js) */
.js .j-step { opacity: 0.35; transition: opacity 0.45s ease; }
.js .j-step.active { opacity: 1; }

/* Report card reveal (card markup reuses report-card styles from ecowise.css) */
.j-card { margin-top: 30px; max-width: 520px; }
.j-card .report-meta { white-space: nowrap; }
.js .j-card { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
.js .j-step.active .j-card { opacity: 1; transform: none; }
.js .j-card .report-row { animation-play-state: paused; }
.js .j-step.active .j-card .report-row { animation-play-state: running; }
.j-card .report-row:nth-child(1) { animation-delay: 0.3s; }
.j-card .report-row:nth-child(2) { animation-delay: 0.65s; }
.j-card .report-row:nth-child(3) { animation-delay: 1s; }
.j-note { margin: 14px 0 0; font-size: 13px; color: #7FA78D; }

/* ---- Pipeline diagram ---- */
.pipe { display: block; }
.pipe-v { width: 100%; max-width: 400px; height: auto; max-height: 100%; }
.pipe-h { display: none; width: 100%; max-width: 460px; margin: 0 auto; height: auto; }
.pipe .stroke { fill: none; stroke: #9FC3AA; stroke-width: 1.6; stroke-linecap: round; }
.pipe .thin { stroke-width: 1.1; }
.pipe .key { fill: #9FC3AA; opacity: 0.85; }
.pipe .nlabel { fill: #9FC3AA; font: 600 10px var(--sans); letter-spacing: 0.09em; text-anchor: middle; }
.pipe .tlab { font: 600 9.5px var(--sans); letter-spacing: 0.07em; text-anchor: middle; }
.pipe .node { opacity: 0.34; transition: opacity 0.5s ease, filter 0.5s ease; }
.pipe .flow { fill: none; stroke: #9FC3AA; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 3 7; opacity: 0.22; transition: opacity 0.5s ease; }

/* Active node for each stage */
.stage-1 .node-1, .stage-2 .node-2, .stage-3 .node-3, .stage-4 .node-4, .stage-5 .node-5 { opacity: 1; filter: drop-shadow(0 0 16px rgba(198, 242, 90, 0.28)); }
.stage-1 .node-1 .stroke, .stage-2 .node-2 .stroke, .stage-4 .node-4 .stroke, .stage-5 .node-5 .stroke { stroke: var(--lime); }
.stage-1 .node-1 .nlabel, .stage-2 .node-2 .nlabel, .stage-4 .node-4 .nlabel, .stage-5 .node-5 .nlabel { fill: var(--lime); }
.stage-1 .node-1 .key { fill: var(--lime); }
/* Visited nodes keep a mid weight so progress reads at a glance */
.stage-2 .node-1,
.stage-3 .node-1, .stage-3 .node-2,
.stage-4 .node-1, .stage-4 .node-2, .stage-4 .node-3,
.stage-5 .node-1, .stage-5 .node-2, .stage-5 .node-3, .stage-5 .node-4 { opacity: 0.66; }
/* The flow segment feeding the active node carries the only motion */
.stage-2 .flow-2, .stage-3 .flow-3, .stage-4 .flow-4, .stage-5 .flow-5 { stroke: var(--lime); opacity: 1; animation: pipeflow 0.9s linear infinite; }
.stage-3 .flow-2,
.stage-4 .flow-2, .stage-4 .flow-3,
.stage-5 .flow-2, .stage-5 .flow-3, .stage-5 .flow-4 { opacity: 0.5; }
@keyframes pipeflow { to { stroke-dashoffset: -10; } }
/* Mobile: current step name under the horizontal pipeline */
.pipe-h .mlabel { fill: var(--lime); font: 600 10.5px var(--sans); letter-spacing: 0.14em; text-anchor: middle; opacity: 0; transition: opacity 0.35s ease; }
.stage-1 .mlabel-1, .stage-2 .mlabel-2, .stage-3 .mlabel-3, .stage-4 .mlabel-4, .stage-5 .mlabel-5 { opacity: 1; }

/* ---- Detail cards ---- */
.hiw-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 44px; }
.hiw-step { background: #fff; border: 1px solid var(--hairline); border-radius: 16px; padding: 22px; }
.hiw-step .n { font-family: var(--serif); font-weight: 560; font-size: 24px; color: var(--sage); }
.hiw-step h3 { font-family: var(--serif); font-weight: 560; font-size: 18px; color: var(--forest-1); margin: 6px 0; }
.hiw-step p { font-size: 14px; color: var(--ink-soft); margin: 0; line-height: 1.55; }
.clock { display: inline-block; margin-top: 14px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: #1d5c49; background: #ddf0e5; border-radius: 999px; padding: 3px 10px; }
.hiw-step.t1 { border-top: 3px solid #3ECF9B; }
.hiw-step.t2 { border-top: 3px solid #8F82F0; }
.hiw-step.t3 { border-top: 3px solid #F0A05A; }

/* ---- Closing CTA ---- */
/* A dark forest-1 band, so the cream detail section ends cleanly
   before the forest-2 footer. */
.hiw-cta { background: var(--forest-1); }
.hiw-cta .content { text-align: center; }
.hiw-cta .eyebrow { color: var(--sage); }
.hiw-cta h2 { color: var(--cream); }
.hiw-cta .lede { color: var(--sage); margin-left: auto; margin-right: auto; }
.hiw-cta .pill { margin-top: 36px; }
.hiw-cta + .footer { border-top: 1px solid rgba(159, 195, 170, 0.15); }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  /* Single column: the diagram becomes a slim horizontal strip pinned to
     the top of the screen while the steps scroll beneath it. */
  .j-grid { display: block; }
  .j-sticky { position: sticky; top: 0; z-index: 6; height: auto; display: block; margin: 0 calc(50% - 50vw); padding: 14px calc(50vw - 50%) 10px; background: rgba(18, 53, 36, 0.94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(159, 195, 170, 0.16); }
  .pipe-v { display: none; }
  .pipe-h { display: block; }
  .j-step { min-height: 0; padding: 56px 0; }
  .j-step:first-child { min-height: 0; padding-top: 40px; }
  .hiw-ctas { flex-direction: column; gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pipe .node, .pipe .flow, .pipe-h .mlabel { transition: none; animation: none !important; }
  .js .j-step, .js .j-card { transition: none; }
}
