/* Stage 1–4 reviewer walkthrough refinement · v0.92 */

@media (min-width: 981px) {
  /* Stage 2: one readable sidewall candidate, video left and reasoning right. */
  .stage2-sidewall-layout {
    grid-template-columns: minmax(0, 1.68fr) minmax(330px, .82fr) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    column-gap: clamp(28px, 3vw, 54px) !important;
    align-items: stretch !important;
  }
  .stage2-sidewall-layout .stage2-page-heading { grid-column: 1 / -1 !important; }
  .stage2-sidewall-frame { grid-column: 1; grid-row: 2; width: 100% !important; max-width: none !important; min-height: 0 !important; height: min(48vh, 520px); }
  .stage2-sidewall-evidence {
    grid-column: 2; grid-row: 2; align-self: start !important; min-height: 0; height: min(48vh, 520px);
    padding: 2px 0 0 26px; border-left: 1px solid rgba(45, 53, 45, .18); border-top: 0 !important;
    display: grid; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto auto minmax(190px, 1fr) auto !important; gap: 18px;
  }
  .stage2-sidewall-evidence > header { grid-column: 1 !important; grid-row: 1 !important; padding-bottom: 16px; }
  .stage2-sidewall-evidence > header strong { font-size: 15px !important; }
  .stage2-sidewall-logic { grid-column: 1 !important; grid-row: 2 !important; display: grid !important; grid-template-columns: 1fr !important; gap: 0 !important; }
  .stage2-sidewall-logic li {
    grid-template-columns: 32px 1fr auto !important; min-height: 56px; padding: 12px 0 !important;
    border-right: 0 !important; border-bottom: 1px solid rgba(45, 53, 45, .12);
  }
  .stage2-sidewall-logic span { font-size: 11px !important; line-height: 1.3; }
  .stage2-sidewall-logic b, .stage2-sidewall-logic em { font-size: 8px !important; }
  .stage2-sidewall-evidence .stage2-chart-wrap { grid-column: 1 !important; grid-row: 3 !important; width: 100% !important; min-height: 190px !important; border-top: 0 !important; padding-top: 0 !important; }
  .stage2-sidewall-evidence .stage2-window-key { grid-column: 1 !important; grid-row: 4 !important; align-self: end; padding-top: 12px; }
  .stage2-sidewall-evidence .stage2-window-key span { font-size: 7px !important; }

  /* Stage 3: abstract rule animation and real evidence share equal visual weight. */
  .stage3-rule-layout, .stage3-frontwall-layout {
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    column-gap: clamp(24px, 2.5vw, 44px) !important;
  }
  .stage3-rule-layout .stage3-page-heading, .stage3-frontwall-layout .stage3-page-heading { grid-column: 1 / -1 !important; }
  .stage3-rule-guide, .stage3-video-evidence {
    grid-row: 2; min-width: 0; height: min(49vh, 500px); margin: 0; align-self: center;
    position: relative; overflow: hidden; border: 1px solid rgba(35, 42, 35, .55); border-radius: 5px; background: #eef0eb;
    box-shadow: 0 24px 54px rgba(25, 31, 25, .1);
  }
  .stage3-rule-guide { grid-column: 1; }
  .stage3-video-evidence { grid-column: 2 !important; }
  .stage3-rule-guide__video, .stage3-video-evidence > video { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
  .stage3-rule-guide__video { object-position: 50% 50%; }
  .stage3-rule-guide figcaption, .stage3-video-evidence figcaption {
    position: absolute; z-index: 5; right: 0; bottom: 0; left: 0; height: 42px; padding: 0 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    color: rgba(255,255,255,.78); background: rgba(17, 22, 17, .82); backdrop-filter: blur(9px);
    font: 720 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em;
  }
  .stage3-rule-guide figcaption b, .stage3-video-evidence figcaption b { color: #fae557; font-size: 8px; }
  .stage3-evidence-strip, .stage3-interval-checks {
    grid-column: 2 !important; grid-row: 3 !important; min-height: 72px !important; margin-top: 12px !important;
  }
  .stage3-edge-next { z-index: 12; }
}

/* Stage 4: a single, legible source → layers → output pipeline. */
.stage4-compose {
  position: relative; min-height: calc(100vh - 66px); padding: clamp(78px, 8vh, 108px) clamp(28px, 5vw, 82px) 52px;
  border-top: 1px solid rgba(39, 46, 39, .16); background: #f5f6f1;
}
.stage4-compose__header { max-width: 1500px; margin: 0 auto clamp(32px, 4vh, 48px); display: flex; align-items: end; justify-content: space-between; gap: 48px; }
.stage4-compose__header h2 { margin: 5px 0 0; font-size: clamp(38px, 4vw, 64px); line-height: .94; letter-spacing: -.055em; }
.stage4-compose__header > p { max-width: 520px; margin: 0; color: #697169; font-size: 14px; line-height: 1.55; }
.stage4-compose__pipeline { max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .58fr) minmax(0, 1fr); gap: clamp(22px, 2.4vw, 40px); align-items: center; }
.stage4-compose__media { position: relative; min-width: 0; aspect-ratio: 16 / 10; margin: 0; overflow: hidden; border: 1px solid rgba(31, 38, 31, .68); border-radius: 7px; background: #cfd3ca; box-shadow: 0 25px 58px rgba(27, 33, 27, .12); }
.stage4-compose__media video, .stage4-compose__media canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.stage4-compose__media canvas { z-index: 2; pointer-events: none; }
.stage4-compose__media figcaption { position: absolute; z-index: 4; right: 0; bottom: 0; left: 0; height: 42px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.72); background: rgba(15,20,15,.82); font: 740 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .07em; }
.stage4-compose__media figcaption b { color: #fae557; }
.stage4-compose__layers { position: relative; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.stage4-compose__layers::before, .stage4-compose__layers::after { content: ""; position: absolute; top: 50%; width: 34px; height: 2px; background: #d4bd17; }
.stage4-compose__layers::before { left: -38px; }.stage4-compose__layers::after { right: -38px; }
.stage4-compose__layers > .section-kicker { margin-bottom: 14px; }
.stage4-compose__layers ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid rgba(37,44,37,.18); }
.stage4-compose__layers li { display: grid; grid-template-columns: 13px 1fr 22px; gap: 12px; align-items: center; min-height: 63px; padding: 10px 0; border-bottom: 1px solid rgba(37,44,37,.14); opacity: .42; transform: translateX(-5px); transition: opacity 320ms ease, transform 420ms cubic-bezier(.2,.8,.2,1); }
.stage4-compose__layers li.is-active { opacity: 1; transform: none; }
.stage4-compose__layers li i { width: 9px; height: 9px; border: 1px solid #858d85; border-radius: 50%; transition: background 260ms ease, box-shadow 260ms ease; }
.stage4-compose__layers li.is-active i { border-color: #c5ae00; background: #fae557; box-shadow: 0 0 0 5px rgba(250,229,87,.18); }
.stage4-compose__layers li span { display: grid; gap: 5px; }.stage4-compose__layers li strong { font-size: 12px; line-height: 1.1; }.stage4-compose__layers li small, .stage4-compose__layers li em { color: #767e76; font: normal 700 7px/1.25 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.stage4-compose__action { width: 100%; min-height: 62px; margin-bottom: 17px; padding: 10px 14px; display: grid; grid-template-columns: 24px 1fr; align-items: center; column-gap: 10px; border: 1px solid #bdaa17; border-radius: 7px; background: #fae557; color: #242924; text-align: left; cursor: pointer; transition: transform 220ms ease, background 220ms ease, box-shadow 220ms ease; }
.stage4-compose__action:hover { transform: translateY(-2px); background: #ffec55; box-shadow: 0 12px 25px rgba(122,107,0,.13); }.stage4-compose__action strong, .stage4-compose__action small { grid-column: 2; }.stage4-compose__action strong { font-size: 12px; }.stage4-compose__action small { margin-top: 4px; color: #68611c; font-size: 8px; }
.stage4-compose__action.is-processing .stage4-process-spinner { animation: stage4Spin .8s linear infinite; }.stage4-compose__action.is-complete { border-color: #4b7d68; background: #edf6f1; }
@keyframes stage4Spin { to { transform: rotate(360deg); } }
.stage4-compose__verdict { position: absolute; z-index: 3; top: 18px; right: 18px; display: grid; gap: 4px; padding: 10px 12px; border-left: 3px solid #fae557; border-radius: 3px; background: rgba(18,23,18,.82); color: #fff; backdrop-filter: blur(8px); }
.stage4-compose__verdict small { color: rgba(255,255,255,.62); font: 700 7px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }.stage4-compose__verdict strong { font-size: 11px; }
.stage4-compose__readout { max-width: 1500px; margin: 24px auto 0; display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid rgba(37,44,37,.16); }
.stage4-compose__readout span { min-height: 60px; padding: 13px 18px; display: grid; gap: 7px; border-right: 1px solid rgba(37,44,37,.12); }.stage4-compose__readout span:last-child { border-right: 0; }.stage4-compose__readout small { color: #7a827a; font: 700 7px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .09em; }.stage4-compose__readout b { font-size: 12px; }
.stage4-compose__next { position: absolute; top: 52%; right: 0; width: 50px; height: 116px; display: flex; align-items: center; justify-content: center; gap: 0; overflow: hidden; border-radius: 12px 0 0 12px; background: #e6cf31; color: #232823; text-decoration: none; transform: translateX(25px); opacity: .28; pointer-events: none; transition: width 330ms cubic-bezier(.2,.8,.2,1), transform 330ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease; }
.stage4-compose__next.is-ready { opacity: 1; pointer-events: auto; animation: stage4Nudge 2s ease-in-out infinite; }.stage4-compose__next.is-ready:hover { width: 188px; transform: none; animation: none; }.stage4-compose__next span { width: 0; overflow: hidden; white-space: nowrap; font-size: 10px; font-weight: 760; transition: width 330ms ease; }.stage4-compose__next:hover span { width: 120px; }.stage4-compose__next svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
@keyframes stage4Nudge { 0%,100% { transform: translateX(25px); } 50% { transform: translateX(18px); } }

@media (max-width: 980px) {
  .stage4-compose { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .stage4-compose__next.is-ready, .stage4-compose__action.is-processing .stage4-process-spinner { animation: none; }
}
