/* Ingress, "What does your roof need?" panel: the result layout at 1,024px and above, 21 November 2026.
   Loaded after ingress-which.css and ingress-roof-drawing.css. Existing tokens only.
   The panel carries data-layout="questions" or "result". Below 1,024px nothing here applies and the
   20 November build stands. */

/* The summary line exists in the markup at every width but only shows in the result layout */
.rl-summary { display: none; }

@media (min-width: 1024px) {
  .wk[data-layout="result"] .wk-grid { display: block; }

  /* 1. Summary line: the four answers as one sentence, in the answered-line style, with "Change an answer" */
  .wk[data-layout="result"] .rl-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--grey-rule); border-bottom: 1px solid var(--grey-rule); }
  .rl-summary .a { font-size: var(--body-size); line-height: 24px; font-weight: 500; }
  .rl-summary button { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; line-height: 24px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
  .rl-summary button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* The answered rows and questions fold away under the summary; "Change an answer" unfolds them */
  .wk[data-layout="result"] .wk-qs { display: none; }
  .wk[data-layout="result"].is-changing .wk-qs { display: flex; margin-top: var(--space-1); }
  .wk[data-layout="result"].is-changing .rl-summary { border-bottom: 0; }

  /* 2. The result card at full panel width: drawing left (40 per cent), text right, actions along the foot */
  .wk[data-layout="result"] .wk-result.rn { margin-top: var(--space-4); padding: 0; min-height: 0;
    display: grid; grid-template-columns: 2fr 3fr; grid-template-areas: "draw text" "foot foot"; }
  .wk[data-layout="result"] .rd-area { grid-area: draw; height: auto; min-height: 220px; margin: 0; padding: var(--space-4) var(--space-3);
    border-bottom: 0; border-right: 1px solid var(--grey-rule); display: flex; flex-direction: column; justify-content: center; gap: var(--space-2); }
  .wk[data-layout="result"] .rd-area svg { height: auto; }
  .wk[data-layout="result"] .rd-area .rd-note { position: static; order: 2; }      /* "First, a look" beneath the section */
  .wk[data-layout="result"] .wk-body { grid-area: text; padding: var(--space-4); gap: 0; }
  .wk[data-layout="result"] .wk-title { margin-bottom: var(--space-1); }
  .wk[data-layout="result"] .wk-block.worth.is-absent { display: none; }       /* no reserved space in this layout */
  .wk[data-layout="result"] .wk-block { margin-top: var(--space-2); padding-top: var(--space-2); }
  .wk[data-layout="result"] .wk-block:first-child { margin-top: 0; padding-top: 0; }

  /* 3. Actions in a row along the foot, then the consent line */
  .wk[data-layout="result"] .rl-foot { grid-area: foot; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--grey-rule); }
  .wk[data-layout="result"] .rl-foot .wk-actions { margin-top: 0; flex-wrap: nowrap; }
  .wk[data-layout="result"] .rl-foot .wk-use { margin-top: var(--space-2) !important; }
}

/* Below 1,024px the foot sits inside the card's text flow as built */
@media (max-width: 1023px) { .rl-foot { margin-top: var(--space-2); } }

/* ---------- Transition (Code adds the classes in order; see the note) ---------- */
@media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
  .wk.is-folding .wk-qs { animation: rl-fold 200ms ease-in both; }
  .wk.is-expanding .wk-result.rn { animation: rl-grow 240ms cubic-bezier(0.4, 0, 0.2, 1) both; }
  .wk.is-expanding .wk-body, .wk.is-expanding .rl-foot { animation: rl-fill 300ms ease-out 1640ms both; }
}
@keyframes rl-fold { to { opacity: 0; transform: translateY(-8px); } }
@keyframes rl-grow { from { clip-path: inset(0 0 0 55%); } to { clip-path: inset(0 0 0 0); } }
@keyframes rl-fill { from { opacity: 0; } to { opacity: 1; } }

/* Fit within 600px at 1,280: the title one step down, tighter block spacing, a wider text column (drawing 37.5 per cent) */
@media (min-width: 1024px) {
  .wk[data-layout="result"] .wk-result.rn { grid-template-columns: 3fr 5fr; }
  .wk[data-layout="result"] .wk-title { font-size: var(--statement-size); line-height: var(--statement-line); margin-bottom: 4px; }
  .wk[data-layout="result"] .wk-body { padding: var(--space-3) var(--space-4); }
  .wk[data-layout="result"] .wk-block { margin-top: 12px; padding-top: 12px; }
  .wk[data-layout="result"] .rl-foot { padding: var(--space-2) var(--space-4) var(--space-3); }
  .wk[data-layout="result"] .rl-foot .wk-use { margin-top: var(--space-1) !important; }
}
