/* Study procedure diagram (methodology page): tabs pick a study type; each panel shows a summary
   row of the six steps on the status rail and each step's administrator and participant lanes.
   Lanes stack on narrow screens; on phones the step details fold (see process.js). */
.process-panel {
  --admin: #2d4a6b; --admin-bg: #f4f7fb;
  --participant: #8f531b; --participant-bg: #fcf7f1;
  --draft: #758291; --open: #2c7a54; --closed: #2f3b4c;
}
.prose .process-scope { margin-top: 10px; padding: 10px 14px; border-left: 3px solid #5b7869; border-radius: 0 8px 8px 0; background: #f3f6f1; font-size: 13.5px; line-height: 1.75; }
.process-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0 4px; font-size: 12px; }
.process-legend-states { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.process-legend-label { color: #56684f; font-weight: 600; margin-right: 2px; }
.process-role { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--admin); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1.7; }
.process-role.participant { background: var(--participant); }
.process-state { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid currentColor; border-radius: 6px; background: #fff; font-size: 11.5px; font-weight: 600; line-height: 1.75; }
.process-state::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.process-state[data-state="draft"] { color: var(--draft); }
.process-state[data-state="open"] { color: var(--open); }
.process-state[data-state="closed"] { color: var(--closed); }
.prose .process-subhead { margin: 26px 0 12px; font-size: 16px; line-height: 1.45; }

/* At-a-glance row: status bands over six steps, with the Delphi round looping back to step 2. */
.process-overview { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 10px; row-gap: 12px; margin: 16px 0 6px; padding: 14px 14px 12px; border: 1px solid #e4eadf; border-radius: 10px; background: #fafbf8; }
.process-band { grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--state); font-size: 11.5px; font-weight: 700; line-height: 1.4; text-align: center; }
.process-band::before { content: ''; align-self: stretch; height: 5px; border-radius: 3px; background: var(--state); }
.process-band[data-state="draft"] { grid-column: 1 / 2; }
.process-band[data-state="open"] { grid-column: 2 / 5; }
.process-band[data-state="closed"] { grid-column: 5 / 7; }
.process-band[data-state="draft"], .process-overview-step[data-state="draft"] { --state: var(--draft); }
.process-band[data-state="open"], .process-overview-step[data-state="open"] { --state: var(--open); }
.process-band[data-state="closed"], .process-overview-step[data-state="closed"] { --state: var(--closed); }
.process-overview-step { grid-row: 2; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.process-overview-mark { position: relative; display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--state); color: #fff; }
.process-overview-mark .process-icon { width: 22px; height: 22px; margin: 0; color: #fff; }
.process-overview-mark b { position: absolute; top: -5px; left: -5px; min-width: 20px; height: 20px; padding: 0 4px; border: 1.5px solid var(--state); border-radius: 10px; background: #fff; color: var(--state); font-size: 11px; line-height: 17px; }
.process-overview-title { max-width: 100%; font-size: 13px; font-weight: 700; line-height: 1.4; overflow-wrap: break-word; }
.process-overview-title .bi-alt { margin-top: 2px; font-size: .84em; font-weight: 500; line-height: 1.35; }
.process-overview-arrow { position: absolute; top: 22px; left: calc(50% + 29px); width: calc(100% - 48px); border-top: 2px solid #8f9c92; }
.process-overview-arrow::after { content: ''; position: absolute; right: -2px; top: -6px; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent #8f9c92; }
.process-overview-loop { grid-row: 3; grid-column: 2 / 7; position: relative; height: 22px; margin: 0 calc((100% - 40px) / 10); border: 2px dashed #8f9c92; border-top: 0; border-radius: 0 0 12px 12px; }
.process-overview-loop::before { content: ''; position: absolute; left: -7px; top: -9px; border-style: solid; border-width: 0 6px 9px; border-color: transparent transparent #8f9c92; }
/* The label sits under the loop so long translations can wrap without covering the line. */
.process-overview-loop-label { grid-row: 4; grid-column: 2 / 7; margin-top: -6px; color: #3f4f45; font-size: 11.5px; font-weight: 600; line-height: 1.5; text-align: center; }
.process-overview-loop-label i { display: none; }

/* Study-type tabs and the head of each type's panel. */
.process-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0 16px; }
.process-tabs[hidden], .process-type-panel[hidden] { display: none; }
.process-tabs [role="tab"], .process-type-panel { --type: #1e6c75; }
.process-tabs [data-kind="delphi"], .process-type-panel[data-kind="delphi"] { --type: #6a4c9c; }
.process-tabs [data-kind="ahp"], .process-type-panel[data-kind="ahp"] { --type: #846610; }
.process-tabs [role="tab"] { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 52px; padding: 8px 12px; border: 1px solid #cfd8cf; border-top: 3px solid var(--type); border-radius: 10px; background: #fff; color: #2f3d33; font: inherit; text-align: left; cursor: pointer; overflow-wrap: break-word; }
.process-tabs [role="tab"] .process-icon { flex: none; margin: 0; color: var(--type); }
.process-tabs [role="tab"] > span { min-width: 0; }
.process-tabs [role="tab"] b { display: block; font-size: 14px; line-height: 1.35; }
.process-tabs [role="tab"] small { display: block; margin-top: 1px; color: #56684f; font-size: 11.5px; line-height: 1.35; }
.process-tabs [role="tab"]:hover { background: #f6f8f4; }
.process-tabs [role="tab"][aria-selected="true"] { border-color: var(--type); background: var(--type); color: #fff; }
.process-tabs [role="tab"][aria-selected="true"] .process-icon, .process-tabs [role="tab"][aria-selected="true"] small { color: #fff; }
.process-tabs [role="tab"]:focus-visible { outline: 3px solid #e0a800; outline-offset: 2px; }
.process-type-panel { border-radius: 10px; }
/* Without the script every panel is shown in turn. */
.process-type-panel + .process-type-panel { margin-top: 34px; }
.process-type-head { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 10px 0 2px; }
.process-type-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--type); color: #fff; }
.process-type-icon .process-icon { margin: 0; color: #fff; }
.prose .process-type-head h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.process-type-head h3 .bi-alt { font-size: .74em; font-weight: 600; line-height: 1.4; }
.prose .process-type-sub { margin: 2px 0 0; color: #44544a; font-size: 12px; line-height: 1.5; }
.process-type-role { padding: 0 9px; border: 1px solid var(--type); border-radius: 999px; color: var(--type); font-size: 11.5px; font-weight: 700; line-height: 1.7; white-space: nowrap; }

/* Steps on a rail: marker, title, then the lanes (inside a fold that only phones close). */
.process-flow { list-style: none; margin: 0; padding: 0; }
.process-stage {
  position: relative; display: grid;
  grid-template-columns: 36px minmax(0, 148px) minmax(0, 1fr);
  column-gap: 12px; padding-bottom: 20px; break-inside: avoid;
}
.process-stage:last-child { padding-bottom: 0; }
.process-stage[data-state="draft"] { --rail: var(--draft); }
.process-stage[data-state="open"] { --rail: var(--open); }
.process-stage[data-state="closed"] { --rail: var(--closed); }
/* The rail joins each step marker to the next in the colour of the study status. */
.process-stage::before { content: ''; position: absolute; left: 16.5px; top: 36px; bottom: 0; width: 3px; border-radius: 2px; background: var(--rail); }
.process-stage:last-child::before { display: none; }
.process-marker { grid-column: 1; grid-row: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--rail); color: #fff; font-size: 15px; font-weight: 800; }
.process-head { grid-column: 2; grid-row: 1; min-width: 0; }
.prose .process-head h5 { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 6px; font-size: 16px; line-height: 1.45; letter-spacing: -.2px; overflow-wrap: break-word; }
.process-head h5 > span { min-width: 0; }
.process-icon { flex: none; margin-top: 1px; color: var(--rail); }
.process-head .bi-alt { font-size: .8em; font-weight: 600; line-height: 1.45; }
.process-stage > .process-fold { grid-column: 3; grid-row: 1; min-width: 0; }
.process-body { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; }

.process-lane { min-width: 0; padding: 10px 12px 11px; border: 1px solid #dfe5df; border-left: 4px solid var(--lane); border-radius: 8px; background: var(--lane-bg); overflow-wrap: break-word; }
.process-lane.admin { --lane: var(--admin); --lane-bg: var(--admin-bg); grid-column: 1; grid-row: 1; }
.process-lane.participant { --lane: var(--participant); --lane-bg: var(--participant-bg); grid-column: 3; grid-row: 1; }
.prose .process-lane p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.7; }
.process-lane .bi-alt { font-size: .9em; line-height: 1.6; }
.process-handoff { grid-column: 2; grid-row: 1; align-self: center; justify-self: center; display: flex; color: #6f7f74; }
.process-handoff[data-flow="to-admin"] svg { transform: scaleX(-1); }
.prose .process-note { grid-column: 1 / -1; grid-row: 2; position: relative; margin: 0; padding-left: 22px; color: #44544a; font-size: 12.5px; line-height: 1.7; }
.process-note::before { content: 'i'; position: absolute; left: 0; top: 2px; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #6f7f74; color: #fff; font: 700 10px/1 Georgia, serif; }
.prose .process-ui { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; font-size: 11.5px; line-height: 1.75; }
.process-path { display: inline-flex; flex-wrap: wrap; align-items: center; max-width: 100%; padding: 0 7px; border: 1px solid #cdd6cd; border-radius: 5px; background: #fff; color: #2f3d33; }
.process-path > span + span::before { content: '›'; margin: 0 5px; color: #7f8c82; }

/* Fold toggles exist for phones only; elsewhere every fold stays open. */
.process-fold-toggle { display: none; }

/* Medium screens: one column on the rail; the lane that acts first comes first. */
@media (max-width: 860px) {
  .process-stage { grid-template-columns: 36px minmax(0, 1fr); }
  .process-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
  .prose .process-head h5 { margin: 5px 0 0; }
  .process-stage > .process-fold { grid-column: 2; grid-row: 2; margin-top: 8px; }
  .process-body { grid-template-columns: minmax(0, 1fr); }
  .process-lane.admin { grid-column: 1; grid-row: 1; }
  .process-handoff { grid-column: 1; grid-row: 2; justify-self: start; align-items: center; justify-content: center; width: 34px; height: 22px; margin-left: 14px; }
  .process-handoff svg, .process-handoff[data-flow="to-admin"] svg { transform: rotate(90deg) scale(.75); }
  .process-lane.participant { grid-column: 1; grid-row: 3; }
  .process-stage[data-flow="to-admin"] .process-lane.participant { grid-row: 1; }
  .process-stage[data-flow="to-admin"] .process-lane.admin { grid-row: 3; }
  .prose .process-note { grid-column: 1; grid-row: 4; }
}

/* Phones: the summary becomes a short vertical chain, and details fold behind a toggle. */
@media (max-width: 760px) {
  .process-overview { grid-template-columns: minmax(0, 1fr); row-gap: 0; padding: 12px 12px 10px; }
  .process-band { display: none; }
  .process-overview-step { grid-row: auto; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: start; gap: 3px 10px; padding: 0 0 14px; text-align: left; }
  .process-overview-step:last-of-type { padding-bottom: 6px; }
  .process-overview-mark { grid-row: 1 / span 2; width: 38px; height: 38px; }
  .process-overview-mark .process-icon { width: 19px; height: 19px; }
  .process-overview-title { padding-top: 1px; }
  .process-overview-step .process-role { justify-self: start; max-width: 100%; overflow-wrap: break-word; }
  .process-overview-arrow { top: 41px; bottom: 2px; left: 18px; width: 0; border-top: 0; border-left: 2px solid #8f9c92; }
  .process-overview-arrow::after { right: auto; top: auto; bottom: -2px; left: -6px; border-width: 8px 5px 0; border-color: #8f9c92 transparent transparent; }
  .process-overview-loop { display: none; }
  .process-overview-loop-label { grid-row: auto; grid-column: 1; margin: 4px 0 0; padding: 6px 10px; border: 1px dashed #8f9c92; border-radius: 8px; text-align: left; }
  .process-overview-loop-label i { display: inline; margin-right: 6px; font-style: normal; font-weight: 800; }
  .process-overview-loop-label i::before { content: '↺ '; }
  .process-stage > .process-fold { margin-top: 4px; }
  .process-tabs [role="tab"] { flex-direction: column; justify-content: center; gap: 4px; padding: 8px 6px; text-align: center; }
  .process-tabs [role="tab"] b { font-size: 13px; }
  .process-tabs [role="tab"] small { display: none; }
  .process-type-head { grid-template-columns: 34px minmax(0, 1fr); }
  .process-type-role { grid-column: 2; justify-self: start; white-space: normal; }
  .process-fold-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 12px; border: 1px solid #c9d3c9; border-radius: 999px; background: #fff; color: #2f3d33; font-size: 12px; font-weight: 700; line-height: 1.4; cursor: pointer; list-style: none; }
  .process-fold-toggle::-webkit-details-marker { display: none; }
  .process-fold-toggle::after { content: ''; width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  .process-fold[open] > .process-fold-toggle { margin-bottom: 8px; }
  .process-fold[open] > .process-fold-toggle::after { margin-top: 3px; transform: rotate(-135deg); }
  .process-fold[open] .process-fold-closed, .process-fold:not([open]) .process-fold-open { display: none; }
}
/* Very narrow phones: a third of the width cannot hold "Country assessment", so the tabs stack. */
@media (max-width: 420px) {
  .process-tabs { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .process-tabs [role="tab"] { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 7px 12px; text-align: left; }
  .process-tabs [role="tab"] small { display: block; }
}
@media print {
  /* Panels normally print whole; this one is taller than a page, so break between steps instead. */
  .process-panel { break-inside: auto; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .process-overview, .process-stage { break-inside: avoid; }
  .process-tabs { display: none !important; }
  .process-fold-toggle { display: none !important; }
}
