/* The four steps of the 90-day plan (ui/shell/ninety-day-plan-steps.js).
 * Pills, buttons, notes and the label/value list come from styles.css; only the layout of the cards lives here.
 * The cards sit below the context bar and the chapter bar, never between them (module-nav-flush).
 *
 * Desktop: four cards in one row; the open detail panel is a second grid row under all four.
 * Mobile: the cards are stacked and the panel follows the card it belongs to.
 */
.ndp-steps { max-width: 1240px; margin: 0 auto; padding: 24px 24px 8px; }
.ndp-steps[hidden] { display: none; }
.ndp-steps-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.ndp-steps-head-text { min-width: 0; }
.ndp-steps-title { margin: 0 0 4px; font-family: var(--font-display); font-size: 1.25rem; }
.ndp-steps-head p { margin: 0; }
.ndp-steps-close {
  flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text-muted);
}
.ndp-steps-close:hover { background: var(--accent-light); color: var(--text); }
.ndp-steps-close:focus-visible { outline: 2px solid var(--teal-green); outline-offset: 2px; }

/* Cards */
.ndp-sc-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.ndp-sc-item { display: contents; }
.ndp-sc {
  grid-row: 1; position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0;
  padding: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
}
.ndp-sc:hover { border-color: var(--teal-green); }
.ndp-sc.is-open { border-color: var(--teal-green); box-shadow: 0 0 0 1px var(--teal-green); }
.ndp-sc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ndp-sc-num {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 50%; background: var(--teal-green-bg); color: #0f766e; font-weight: 700; font-size: 14px;
}
.ndp-sc-title { margin: 4px 0 0; font-family: var(--font-display); font-size: 1rem; line-height: 1.3; }
/* The title is the real button of the card. Its ::after covers the whole card, so a click anywhere on the card
   (except on the action button, which sits above it) opens or closes the details of that step. */
.ndp-sc-pick {
  margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.ndp-sc-pick::after { content: ""; position: absolute; inset: 0; border-radius: 12px; cursor: pointer; }
.ndp-sc-pick:focus-visible { outline: none; }
.ndp-sc-pick:focus-visible::after { outline: 2px solid var(--teal-green); outline-offset: 2px; }
.ndp-sc-lead { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); }
/* Footer of the card: last successful completion. */
.ndp-sc-done { margin: 0; padding-top: 2px; font-size: 12px; }
/* Room for a two-line reason, so the buttons of all four cards stay on one line. */
.ndp-sc-action { margin-top: auto; padding-top: 6px; min-height: 84px; display: flex; flex-direction: column; justify-content: flex-start; gap: 6px; }
.ndp-sc .ndp-sc-main { position: relative; z-index: 1; width: 100%; margin: 0; justify-content: center; min-height: 32px; }
.ndp-sc-why { margin: 0; font-size: 12px; line-height: 1.4; }
.ndp-sc-fail { margin: 0; font-size: 12px; line-height: 1.4; color: #b91c1c; }
.ndp-sc-main:focus-visible, .ndp-sp-close:focus-visible { outline: 2px solid var(--teal-green); outline-offset: 2px; }

/* Order only: the arrow shows the usual order, not a dependency (steps 2 and 3 do not wait for each other). */
.ndp-sc-item:not(:last-child) .ndp-sc::after {
  content: "›"; position: absolute; top: 20px; right: -16px; width: 16px; text-align: center;
  font-size: 20px; line-height: 1; color: var(--text-muted); pointer-events: none;
}

/* Progress while a step runs */
.ndp-sc-progress { display: flex; flex-direction: column; gap: 4px; }
.ndp-sc-bar { display: block; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.ndp-sc-bar > span { display: block; height: 100%; background: var(--teal-green); border-radius: 3px; }
.ndp-sc-bar--wait > span { width: 40%; animation: ndp-sc-wait 1.4s ease-in-out infinite; }
@keyframes ndp-sc-wait { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .ndp-sc-bar--wait > span { animation: none; width: 100%; opacity: .5; } }

/* Detail panel: one row under all cards, with a pointer to the chosen card */
.ndp-sp {
  grid-column: 1 / -1; grid-row: 2; position: relative; margin-top: 4px; scroll-margin-top: 150px;
  padding: 20px 28px 22px; background: var(--bg-card); border: 1px solid var(--teal-green); border-radius: 12px;
  box-shadow: 0 8px 24px -16px rgba(15, 23, 42, .25);
}
.ndp-sp::before {
  content: ""; position: absolute; top: -7px; width: 12px; height: 12px; background: var(--bg-card);
  border-top: 1px solid var(--teal-green); border-left: 1px solid var(--teal-green); transform: rotate(45deg);
  left: calc((100% - 48px) / 4 * var(--ndp-sp-col, .5) + 16px * var(--ndp-sp-gap, 0) - 6px);
}
.ndp-sp[data-step="1"] { --ndp-sp-col: .5; --ndp-sp-gap: 0; }
.ndp-sp[data-step="2"] { --ndp-sp-col: 1.5; --ndp-sp-gap: 1; }
.ndp-sp[data-step="3"] { --ndp-sp-col: 2.5; --ndp-sp-gap: 2; }
.ndp-sp[data-step="4"] { --ndp-sp-col: 3.5; --ndp-sp-gap: 3; }
.ndp-sp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light);
}
.ndp-sp-title { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--font-display); font-size: 1.15rem; line-height: 1.3; }
.ndp-sp-num {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 50%; background: var(--teal-green-bg); color: var(--teal-green); font-size: 14px; font-weight: 700;
}
/* "Step n" is for screen readers; the number circle shows it visually. */
.ndp-sp-kicker { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ndp-sp-close {
  flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text-muted);
}
.ndp-sp-close:hover { background: var(--accent-light); color: var(--text); }

.ndp-sp-body { display: flex; flex-direction: column; gap: 20px; }
.ndp-sp-intro { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.ndp-sp-headline { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text); }
.ndp-sp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ndp-sp-meta .ndp-muted { font-size: 12px; }
.ndp-sp-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--teal-green-bg); color: var(--teal-green); font-size: 12px; font-weight: 600;
}
.ndp-sp-badge::before { content: "\2713"; font-weight: 700; }

/* Two columns: stored result left, its review right. */
.ndp-sp-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: start; }
.ndp-sp-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ndp-sp-col--side { padding-left: 32px; border-left: 1px solid var(--border-light); }
.ndp-sp-section,
.ndp-sp .ndp-step-input > .ndp-subhead:first-child {
  margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
}

/* Key figures: a quiet table with hairlines. */
.ndp-sp .ndp-step-facts {
  grid-template-columns: minmax(130px, 38%) 1fr; gap: 0; margin: 0;
  padding: 2px 16px; border-radius: 10px; background: var(--ui-bg-soft); border: 1px solid var(--border-light);
}
.ndp-sp .ndp-step-facts dt, .ndp-sp .ndp-step-facts dd { padding: 9px 0; border-bottom: 1px solid var(--border-light); }
.ndp-sp .ndp-step-facts dt:nth-last-of-type(1), .ndp-sp .ndp-step-facts dd:last-child { border-bottom: 0; }
.ndp-sp .ndp-step-facts dt { font-size: 12.5px; }
.ndp-sp .ndp-step-facts dd { font-size: 14px; font-weight: 500; line-height: 1.45; }

/* Input check (step 1) and the conditions for generating (step 4). */
.ndp-step-input { display: flex; flex-direction: column; gap: 4px; }
.ndp-sp .ndp-step-input .ndp-lead { margin: 4px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }
.ndp-sp .ndp-input-group { margin: 14px 0 0; font-size: 11px; }
.ndp-sp .ndp-check { padding: 12px 0; }
.ndp-sp .ndp-check-body { flex-direction: column; gap: 4px; }
.ndp-sp .ndp-check-msg { font-size: 14px; line-height: 1.5; color: var(--text); }
.ndp-sp .ndp-check-fix { font-size: 13px; }
.ndp-step-gen { display: flex; flex-direction: column; gap: 12px; }
.ndp-step-gen .ndp-ready-grid { margin-top: 4px; }

/* Footer: stored files left, the step's action right. */
.ndp-sp-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding-top: 14px; border-top: 1px solid var(--border-light);
}
.ndp-sp-actions { display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-left: auto; }
.ndp-sp-actions p { margin: 0; font-size: 12.5px; }
.ndp-sp-actions .btn { margin: 0; }
.ndp-sp .ndp-ok-note { margin: 0; }

/* Content of the panel */
.ndp-step-list h5, .ndp-step-note h5 { margin: 0 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.ndp-step-list ul, .ndp-step-artifacts ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.ndp-step-note { border-left: 3px solid var(--border); padding: 8px 0 8px 14px; }
.ndp-step-note p { margin: 0; font-size: 13.5px; }
.ndp-step-note--update { border-color: #f59e0b; background: #fffbeb; padding-right: 12px; border-radius: 0 8px 8px 0; }
.ndp-step-note--error { border-color: #ef4444; background: #fef2f2; padding-right: 12px; border-radius: 0 8px 8px 0; }
.ndp-step-artifacts summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.ndp-step-error { margin: 0 0 12px; color: #b91c1c; font-size: 13px; }

/* With a plan on screen the cards fold into one line */
.ndp-steps-fold { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); padding: 10px 16px; }
.ndp-steps-fold > summary { cursor: pointer; }
.ndp-steps-fold[open] > summary { margin-bottom: 12px; }

/* Mobile: cards under each other, the panel directly under its card */
@media (max-width: 980px) {
  .ndp-steps { padding: 16px 16px 8px; }
  .ndp-sc-row { display: flex; flex-direction: column; gap: 12px; }
  .ndp-sc-item { display: flex; flex-direction: column; gap: 8px; }
  .ndp-sc { grid-row: auto; }
  .ndp-sp { grid-row: auto; margin-top: 0; padding: 16px; }
  .ndp-sp::before { display: none; }
  .ndp-sp-grid { grid-template-columns: 1fr; gap: 20px; }
  .ndp-sp-col--side { padding-left: 0; border-left: 0; padding-top: 20px; border-top: 1px solid var(--border-light); }
  .ndp-sp-actions { flex-direction: column; align-items: flex-start; margin-left: 0; }
  .ndp-sc-item:not(:last-child) .ndp-sc::after {
    content: ""; top: 100%; right: auto; left: 29px; width: 2px; height: 12px; background: var(--border);
  }
  .ndp-sc-item.is-open:not(:last-child) .ndp-sc::after { display: none; }
  .ndp-sc-action { min-height: 0; }
  .ndp-sc .ndp-sc-main { width: auto; align-self: flex-start; }
}
