/* ============================================================
   Scrollytelling — "Produto em Construção" (home) e
   "Decisão em foco" (dossiês). Sticky stage + steps sincronizados
   pelo scroll. Reskin completo dos mecanismos da v1 no sistema
   visual do dossiê: cantos retos, papel/tinta/verde, mono.
   ============================================================ */

/* ---------- Mecânica compartilhada do palco sticky ---------- */
.stage-frame {
  position: sticky;
  top: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .08);
}
[data-theme="dark"] .stage-frame { box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-top strong { color: var(--accent); font-size: 11px; }
.stage-progress {
  position: relative;
  height: 2px;
  margin-top: 14px;
  background: var(--line);
  overflow: hidden;
}
.stage-progress i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--grad-evolucao);
  transform: scaleX(var(--stage-progress, 0));
  transform-origin: left;
  transition: transform .15s linear;
}

/* ---------- Steps list (build-steps / decision-story-steps) ---------- */
.stage-steps { list-style: none; padding: 0; margin: 0; }
.stage-step {
  min-height: clamp(300px, 46vh, 440px);
  display: flex;
  align-items: center;
  gap: 22px;
  border-top: 1px solid var(--line);
  opacity: .28;
  transform: translateY(18px);
  transition: opacity .4s ease, transform .5s ease;
}
.stage-step:last-child { border-bottom: 1px solid var(--line); }
.stage-step.is-active { opacity: 1; transform: none; }
.stage-step.is-complete { opacity: .5; transform: none; }
.stage-step > span {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 4px;
  transition: color .3s;
  flex-shrink: 0;
}
.stage-step.is-active > span { color: var(--accent); }
.stage-step h3, .stage-step h4 {
  font-weight: 700;
  font-stretch: 112%;
  font-size: clamp(22px, 2.6vw, 32px);
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0 0 12px;
}
.stage-step p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 46ch;
}

@media (prefers-reduced-motion: reduce) {
  .stage-step, .stage-progress i { transition: none !important; }
}

/* ============================================================
   Build-story — "Produto em construção" (home §03)
   ============================================================ */
.build-layout {
  display: grid;
  grid-template-columns: minmax(380px, .92fr) minmax(340px, 1.08fr);
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
  margin-top: 40px;
}
.build-stage { height: 560px; }
.product-canvas {
  position: relative;
  height: 462px;
  margin-top: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.canvas-toolbar {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}
.canvas-toolbar i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); opacity: .3; }
.canvas-toolbar i:first-child { background: var(--accent); opacity: 1; }
.canvas-toolbar span { margin-left: 7px; letter-spacing: .04em; }

.build-layer {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 54px;
  bottom: 20px;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  filter: blur(2px);
  transition: opacity .55s ease, transform .6s cubic-bezier(.2, .75, .2, 1), filter .5s ease;
}
.build-layer.is-built { opacity: 1; transform: none; filter: none; }
.layer-label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.layer-problem {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.layer-problem blockquote {
  margin: 0 0 22px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -.02em;
}
.problem-signals { display: flex; gap: 7px; flex-wrap: wrap; }
.problem-signals span {
  font-family: var(--mono);
  font-size: 9px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.layer-flow {
  top: 150px;
  bottom: auto;
  display: grid;
  grid-template-columns: 1fr 26px 1fr 26px 1fr;
  align-items: center;
}
.flow-node {
  padding: 12px 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}
.layer-flow > i { height: 1px; background: var(--accent); position: relative; }
.layer-flow > i::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  transform: rotate(45deg);
}
.layer-flow > b { grid-column: 3; width: 1px; height: 44px; background: var(--line); justify-self: center; }
.flow-exception {
  grid-column: 3;
  margin-top: 10px;
  padding: 10px 6px;
  border: 1px dashed var(--muted);
  background: var(--paper);
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

.layer-structure {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.wire-sidebar { background: var(--paper-2); padding: 14px 8px; }
.wire-sidebar i { display: block; height: 5px; background: var(--line); margin-bottom: 11px; }
.wire-sidebar i:first-child { background: var(--accent); }
.wire-content { padding: 12px; position: relative; }
.wire-content > span { display: block; width: 42%; height: 7px; background: var(--line); margin-bottom: 12px; }
.wire-content > strong { display: block; width: 68%; height: 14px; background: var(--ink); opacity: .12; margin-bottom: 18px; }
.wire-content > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wire-content > div i { display: block; height: 70px; border: 1px solid var(--line); }
.wire-content button {
  display: block; margin: 16px 0 0 auto; width: 70px; height: 20px;
  border: 1px solid var(--ink); background: var(--ink);
}
.structure-note {
  position: absolute; right: 12px; bottom: 8px;
  font-family: var(--mono); font-size: 8px; color: var(--muted);
}

.layer-priority {
  left: auto; width: 190px; top: 60px; bottom: auto;
  padding: 16px; border: 1px solid var(--line); background: var(--paper);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .08);
}
[data-theme="dark"] .layer-priority { box-shadow: 0 14px 30px rgba(0, 0, 0, .4); }
.priority-tag, .later-tag {
  display: inline-block; padding: 5px 8px;
  font-family: var(--mono); font-size: 8px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--accent); color: var(--accent);
}
.later-tag { border-color: var(--line); color: var(--muted); margin-top: 12px; }
.priority-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.priority-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.priority-row b { height: 5px; flex: 1; background: var(--line); }

.layer-prototype {
  display: grid; grid-template-columns: 78px 1fr;
  border: 1px solid var(--line); background: var(--paper); overflow: hidden;
}
.prototype-nav { background: var(--ink); padding: 18px 10px; }
.prototype-nav span { display: block; width: 20px; height: 20px; background: var(--accent); margin-bottom: 20px; }
.prototype-nav i { display: block; height: 5px; background: var(--paper); opacity: .3; margin-bottom: 12px; }
.prototype-main { padding: 22px 20px; }
.prototype-main small {
  font-family: var(--mono); font-size: 8px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.prototype-main > strong { display: block; width: 60%; height: 15px; background: var(--ink); opacity: .12; margin: 10px 0 20px; }
.prototype-main > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prototype-main > div i { display: block; height: 82px; border: 1px solid var(--line); background: var(--paper-2); }
.prototype-main button {
  float: right; margin-top: 18px; padding: 8px 14px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
}

.layer-handoff {
  top: auto; bottom: 20px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--ink); color: var(--paper);
}
.layer-handoff div { display: flex; gap: 9px; flex-wrap: wrap; }
.layer-handoff span { font-family: var(--mono); font-size: 8px; color: var(--paper); opacity: .7; }
.layer-handoff strong { font-family: var(--mono); font-size: 9px; font-weight: 600; }

/* Coreografia de recuo: cada camada anterior se afasta e esmaece
   conforme uma nova assume o centro do palco — evita acúmulo visual. */
.build-story[data-step="2"] .layer-problem,
.build-story[data-step="3"] .layer-problem,
.build-story[data-step="4"] .layer-problem,
.build-story[data-step="5"] .layer-problem,
.build-story[data-step="6"] .layer-problem { opacity: .1; transform: scale(.86) translateY(-60px); }
.build-story[data-step="3"] .layer-flow,
.build-story[data-step="4"] .layer-flow { opacity: .2; transform: translateY(-90px) scale(.9); }
.build-story[data-step="5"] .layer-flow,
.build-story[data-step="6"] .layer-flow,
.build-story[data-step="5"] .layer-structure,
.build-story[data-step="6"] .layer-structure,
.build-story[data-step="5"] .layer-priority,
.build-story[data-step="6"] .layer-priority { opacity: 0; transform: scale(.94); }
.build-story[data-step="4"] .layer-structure { transform: translateX(-16px); right: 66px; }
.build-story[data-step="6"] .layer-prototype { bottom: 68px; }
.build-story[data-step="6"] .product-canvas { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }

@media (max-width: 1000px) {
  .build-layout { grid-template-columns: 1fr; gap: 40px; }
  .build-stage { position: sticky; top: 72px; height: 400px; z-index: 4; background: color-mix(in srgb, var(--paper-2) 97%, transparent); backdrop-filter: blur(14px); box-shadow: 0 12px 34px rgba(0, 0, 0, .1); }
  [data-theme="dark"] .build-stage { box-shadow: 0 12px 34px rgba(0, 0, 0, .5); }
  .product-canvas { height: 306px; }
  .build-layer { top: 40px; bottom: 14px; }
  .layer-problem { padding: 18px; }
  .layer-problem blockquote { font-size: 17px; }
  .layer-flow { top: 100px; }
  .layer-priority { width: 150px; top: 40px; }
  .stage-steps { position: relative; z-index: 1; }
  .stage-step { min-height: clamp(260px, 42vh, 360px); padding: 0 0 0 4px; }
}
@media (max-width: 700px) {
  .build-stage { height: 330px; top: 66px; padding: 12px; }
  .product-canvas { height: 262px; }
  .canvas-toolbar { height: 26px; }
  .build-layer { left: 12px; right: 12px; top: 34px; bottom: 12px; }
  .layer-problem { padding: 14px; }
  .layer-problem blockquote { font-size: 15px; margin-bottom: 14px; }
  .problem-signals span { font-size: 8px; padding: 5px 7px; }
  .layer-flow { top: 82px; grid-template-columns: 1fr 18px 1fr 18px 1fr; }
  .flow-node { font-size: 7px; padding: 8px 3px; }
  .layer-structure { grid-template-columns: 42px 1fr; padding: 8px; gap: 8px; }
  .wire-content { padding: 6px; }
  .wire-content > div i { height: 44px; }
  .layer-priority { width: 120px; top: 30px; padding: 10px; }
  .layer-prototype { grid-template-columns: 54px 1fr; }
  .prototype-main { padding: 14px; }
  .prototype-main > div i { height: 44px; }
  .layer-handoff { left: 12px; right: 12px; bottom: 12px; padding: 8px 10px; }
  .layer-handoff span { font-size: 6px; }
  .layer-handoff strong { font-size: 7px; }
  .stage-step { min-height: clamp(230px, 38vh, 300px); }
  .stage-step h3, .stage-step h4 { font-size: 24px; }
}

/* ============================================================
   Decision-story — "Decisão em foco" (dossiês)
   ============================================================ */
.decision-layout {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(340px, 1.05fr);
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
  margin-top: 40px;
}
.decision-stage { height: 500px; }
.decision-scene-area {
  position: relative;
  height: 400px;
  margin-top: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.decision-scene {
  position: absolute;
  inset: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(.98);
  pointer-events: none;
  transition: opacity .45s ease, transform .55s cubic-bezier(.2, .75, .2, 1), visibility 0s .45s;
}
.decision-scene.is-active {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
  transition-delay: .06s, 0s, 0s;
}
.decision-scene > p {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 12px;
}
.decision-scene > h4 {
  font-weight: 700; font-stretch: 112%; font-size: clamp(21px, 2.4vw, 28px);
  letter-spacing: -.025em; line-height: 1.1; margin: 0 0 26px; max-width: 30ch;
}
.decision-scene > small {
  display: block; margin-top: 18px;
  font-family: var(--mono); font-size: 10px; color: var(--muted); line-height: 1.5;
}
.decision-figcaption {
  margin: 12px 0 0; padding: 0 2px;
  font-family: var(--mono); font-size: 11px; color: var(--muted); min-height: 16px;
}

/* Reusable scene primitives — restyled tokens, generalized across all 4 dossiês */
.scene-list { border-top: 1px solid var(--line); }
.scene-list > span {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px;
}
.scene-list > span i { font-style: normal; font-size: 9px; color: var(--muted); }
.scene-list > span.critical { border-left: 2px solid var(--coral); padding-left: 10px; }
.scene-list > span.critical i { color: var(--coral-ink); }

.scene-chain {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.scene-chain span, .scene-chain strong {
  padding: 11px 12px; border: 1px solid var(--line); background: var(--paper-2);
  font-family: var(--mono); font-size: 10px; text-align: center;
}
.scene-chain strong { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
.scene-chain i { font-style: normal; font-size: 12px; color: var(--accent); }

.scene-compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.scene-compare > div { padding: 18px; border: 1px solid var(--line); background: var(--paper-2); min-height: 120px; }
.scene-compare small { font-family: var(--mono); font-size: 9px; text-transform: uppercase; color: var(--muted); }
.scene-compare strong { display: block; font-size: 30px; font-weight: 700; margin: 14px 0; }
.scene-compare span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.scene-compare > i { font-style: normal; color: var(--accent); font-size: 20px; }
.scene-range { height: 14px; margin: 26px 0 20px; background: linear-gradient(90deg, var(--line) 0 28%, var(--accent) 28% 75%, var(--line) 75%); position: relative; }
.scene-range b { position: absolute; top: -4px; left: 68%; width: 3px; height: 22px; background: var(--coral); }

.scene-hub { text-align: center; }
.scene-hub > strong { display: inline-block; padding: 14px 26px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.scene-hub > i { display: block; width: 1px; height: 30px; margin: 0 auto; background: var(--accent); font-style: normal; }
.scene-hub > div { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.scene-hub > div span { padding: 10px 12px; border: 1px solid var(--line); background: var(--paper-2); font-family: var(--mono); font-size: 9px; }

.scene-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scene-cards > div { padding: 12px; border: 1px solid var(--line); background: var(--paper-2); }
.scene-cards b { display: block; font-family: var(--mono); font-size: 10px; font-weight: 600; margin-bottom: 12px; }
.scene-cards i { display: block; height: 6px; background: var(--line); margin-top: 8px; font-style: normal; }
.scene-banner { margin-top: 14px; padding: 10px; background: var(--ink); color: var(--paper); text-align: center; font-family: var(--mono); font-size: 9px; }

.scene-converge { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; text-align: center; }
.scene-converge > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.scene-converge span { padding: 10px 8px; border: 1px solid var(--line); background: var(--paper-2); font-family: var(--mono); font-size: 9px; }
.scene-converge > i { font-style: normal; color: var(--accent); font-size: 16px; }
.scene-converge > strong { padding: 16px 12px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 9px; line-height: 1.7; font-weight: 600; }
.scene-converge > span.verified { border-color: var(--accent); background: none; color: var(--accent); }

.scene-stack { text-align: center; }
.scene-stack > span { display: inline-block; padding: 11px 18px; border: 1px solid var(--line); background: var(--paper-2); font-family: var(--mono); font-size: 10px; }
.scene-stack > i { display: block; margin: 10px auto; color: var(--accent); font-style: normal; font-size: 14px; }
.scene-stack > div { display: flex; flex-direction: column; gap: 6px; align-items: center; margin: 10px 0; }
.scene-stack > div b { padding: 9px 14px; border: 1px dashed var(--line); font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--muted); }
.scene-stack > strong { display: inline-block; padding: 12px 20px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 10px; font-weight: 600; }

.scene-branch { text-align: center; }
.scene-branch > span { display: inline-block; padding: 10px 16px; border: 1px solid var(--line); background: var(--paper-2); font-family: var(--mono); font-size: 10px; }
.scene-branch > i { display: block; width: 1px; height: 20px; margin: 8px auto; background: var(--line); font-style: normal; }
.scene-branch > div { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.scene-branch strong { padding: 14px 10px; border: 1px solid var(--accent); color: var(--accent); font-family: var(--mono); font-size: 9px; font-weight: 600; }
.scene-branch b { font-family: var(--mono); font-size: 9px; color: var(--muted); font-style: normal; }

.scene-table { border: 1px solid var(--line); background: var(--paper-2); padding: 16px; }
.scene-table > div { display: grid; grid-template-columns: 1.3fr .8fr .8fr; gap: 8px; }
.scene-table b { font-family: var(--mono); font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.scene-table > span { display: block; height: 26px; margin-top: 8px; border-top: 1px solid var(--line); background: linear-gradient(90deg, var(--line) 0 40%, transparent 40% 52%, var(--line) 52% 70%, transparent 70% 80%); }
.scene-table small { display: block; margin-top: 14px; font-family: var(--mono); font-size: 9px; color: var(--muted); }

@media (max-width: 1000px) {
  .decision-layout { grid-template-columns: 1fr; gap: 32px; }
  .decision-stage { position: sticky; top: 72px; height: 380px; z-index: 4; background: color-mix(in srgb, var(--paper-2) 97%, transparent); backdrop-filter: blur(14px); box-shadow: 0 12px 34px rgba(0, 0, 0, .1); }
  [data-theme="dark"] .decision-stage { box-shadow: 0 12px 34px rgba(0, 0, 0, .5); }
  .decision-scene-area { height: 300px; }
  .stage-steps.decision-steps { position: relative; z-index: 1; }
}
@media (max-width: 700px) {
  .decision-stage { top: 66px; height: 320px; padding: 12px; }
  .decision-scene-area { height: 256px; }
  .decision-scene { padding: 20px; }
  .decision-scene > h4 { font-size: 20px; margin-bottom: 16px; }
  .scene-cards { gap: 6px; }
  .scene-cards > div { padding: 8px; }
  .scene-compare > div { padding: 12px; min-height: 90px; }
  .scene-compare strong { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .build-layer, .decision-scene { transition: none !important; }
}
