/* ==========================================================================
   MedCUA · Contribute a workflow
   Hero, task criteria, the workflow form and its dialogs (review, worked
   example, confirm). Loaded after ../site.css and scoped to body.page-contribute.
   Class names generated by form.js and example-view.js are kept as they are:
   button, button-secondary, button-compact, button-text, item-row, step-card,
   evidence-row, choice-list, importance-tag, example-*, review-*, confirm-dialog.
   ========================================================================== */

.page-contribute {
  --control-line: #8190a5; /* field and checkbox outlines: 3.2:1 on white, 3.1:1 on --paper-2 (WCAG 1.4.11) */
  --field-line: var(--control-line);
  --field-line-hover: var(--ink-3);
  --field-radius: 10px;
  /* A solid 1px ring doubles the accent border to 2px, with a soft halo around it. */
  --focus-ring: 0 0 0 1px var(--blue-600), 0 0 0 4px color-mix(in srgb, var(--accent-500) 26%, transparent);
  /* Soft corner glow for tinted panels, derived from the accent scale so it follows the palette. */
  --accent-glow: color-mix(in srgb, var(--accent-200) 34%, transparent);
}

/* ---------- Buttons: the site .btn look for script-generated controls ---------- */
.page-contribute .button {
  --b-bg: var(--navy-900); --b-fg: #fff; --b-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem; flex-shrink: 0;
  min-height: 48px; padding: .7rem 1.3rem; border-radius: 999px;
  border: 1px solid var(--b-line); background: var(--b-bg); color: var(--b-fg);
  font-family: var(--font-sans); font-size: .95rem; font-weight: 550; line-height: 1.2; letter-spacing: -.005em;
  text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: 0 8px 20px -12px rgba(15, 23, 42, .5);
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.page-contribute .button:not(:disabled):hover { --b-bg: var(--blue-600); color: var(--b-fg); transform: translateY(-1px); }
.page-contribute .button svg { width: 16px; height: 16px; flex: none; transition: transform .2s var(--ease); }
.page-contribute .button:not(:disabled):hover svg { transform: translateX(2px); }
.page-contribute .button-secondary { --b-bg: #fff; --b-fg: var(--ink); --b-line: var(--line-2); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.page-contribute .button-secondary:not(:disabled):hover { --b-bg: #fff; --b-fg: var(--ink); --b-line: var(--blue-400); }
.page-contribute .button-compact { min-height: 38px; padding: .45rem .95rem; font-size: .875rem; }
.page-contribute :is(.button, .button-text, .btn):disabled { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }

.page-contribute .button-text {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 36px; padding: .4rem .75rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--blue-600);
  font-family: var(--font-sans); font-size: .875rem; font-weight: 560; line-height: 1.3; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.page-contribute .button-text:not(:disabled):hover { background: var(--blue-50); color: var(--blue-700); }
.page-contribute .button-text:is([data-action*="remove"], [data-action*="delete"]) { color: var(--ink-2); }
.page-contribute .button-text:is([data-action*="remove"], [data-action*="delete"]):not(:disabled):hover { background: #fdf0ef; color: #a1352b; }

.page-contribute .btn-down:hover svg { transform: translateY(2px); }
.page-contribute .text-link { color: var(--blue-600); text-decoration: underline; text-underline-offset: .2em; }
.page-contribute .text-link:hover { color: var(--blue-700); }
/* form.js writes both confirmations and errors into the same status elements, so they stay neutral. */
.page-contribute .status-message { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.page-contribute .status-message:empty { display: none; }
.page-contribute .preserve-lines { white-space: pre-wrap; }

/* ---------- Hero ---------- */
/* The breadcrumb starts at the same height as on the other inner pages (site.css gives .page-hero-inner
   --hero-top of top padding) and level with the worked-example card's eyebrow beside it. */
.page-contribute .contribute-hero {
  --hero-top: clamp(3.5rem, 7vw, 6rem);
  --card-pad: clamp(1.4rem, 2.6vw, 2.1rem);
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: start; gap: clamp(2.5rem, 6vw, 6rem);
  padding-block: calc(var(--hero-top) - var(--card-pad) - 1px) clamp(3.75rem, 7vw, 6rem);
}
.page-contribute .contribute-hero .page-hero-inner { max-width: 620px; padding-block: calc(var(--card-pad) + 1px) 0; }
/* The current page reads at --ink-2: --ink-3 drops to about 4.2:1 on the hero's tinted top band. */
.page-contribute .crumbs > span:last-child { color: var(--ink-2); }
.page-contribute .hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem 1.5rem; margin-top: .4rem; }
.page-contribute .hero-note { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .93rem; font-weight: 500; }
.page-contribute .hero-note svg { width: 18px; height: 18px; flex: none; color: var(--blue-600); }

/* Worked example card */
.page-contribute .example-bar {
  position: relative; display: grid; gap: 1rem; align-content: start; justify-items: start;
  padding: var(--card-pad);
  border: 1px solid rgba(15, 23, 42, .09); border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .6), 0 2px 6px rgba(15, 23, 42, .05), 0 40px 80px -42px rgba(15, 23, 42, .38);
}
.page-contribute .example-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; }
.page-contribute .example-bar-meta { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.page-contribute .example-bar-title { color: var(--navy-900); font-size: clamp(1.6rem, 2.4vw, 2rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.08; }
.page-contribute .example-bar-copy { max-width: 46ch; color: var(--ink-2); font-size: .98rem; }
.page-contribute .example-preview { width: 100%; margin-top: .35rem; }
.page-contribute .example-preview-head {
  display: flex; justify-content: space-between; padding-bottom: .5rem; border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.page-contribute .example-preview ol { list-style: none; display: grid; }
.page-contribute .example-preview li {
  display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; align-items: baseline; gap: .65rem;
  padding: .56rem 0; border-bottom: 1px solid var(--line);
  font-size: .9rem; line-height: 1.45;
}
.page-contribute .example-preview .n { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); }
.page-contribute .example-preview .t { color: var(--ink); }
.page-contribute .example-preview .e {
  display: inline-flex; align-items: center; gap: .45rem; min-width: 2.2rem; justify-content: flex-end;
  font-family: var(--font-mono); font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.page-contribute .example-preview .e::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.page-contribute .example-preview .e.is-none { color: var(--ink-3); }
.page-contribute .example-preview .e.is-none::before { background: var(--line-2); }
.page-contribute .example-open { margin-top: .35rem; }

/* ---------- Task criteria ---------- */
.page-contribute .criteria-section { padding-block: clamp(4.5rem, 8vw, 7.5rem); }
.page-contribute .criteria-section .section-head { margin-bottom: clamp(2.25rem, 4vw, 3.25rem); }
.page-contribute .criteria { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.page-contribute .criterion {
  display: grid; gap: .55rem; align-content: start;
  padding: 1.5rem 1.5rem 1.65rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper);
}
.page-contribute .criterion-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.page-contribute .criterion-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--blue-50); color: var(--blue-600); box-shadow: inset 0 0 0 1px var(--blue-100); }
.page-contribute .criterion-icon svg { width: 22px; height: 22px; }
.page-contribute .criterion .num { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; color: var(--ink-3); }
.page-contribute .criterion p { color: var(--ink-2); font-size: .96rem; }

/* ---------- Form area ---------- */
.page-contribute .form-area { padding-block: clamp(3.5rem, 7vw, 6.5rem) clamp(4.5rem, 8vw, 7.5rem); border-top: 1px solid var(--line); }
.page-contribute .collection-shell { width: min(920px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.page-contribute :is(.form-alert, .submission-result) {
  margin-bottom: 1rem; padding: 1rem 1.15rem; border: 1px solid var(--blue-100); border-radius: 14px;
  background: var(--blue-50); color: var(--navy-900); font-size: .95rem;
}

.page-contribute #task-form {
  display: grid; gap: 2.25rem;
  padding: clamp(1.4rem, 4.2vw, 3.25rem);
  border: 1px solid var(--line); border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 30px 70px -42px rgba(15, 23, 42, .3);
  scroll-margin-top: .5rem;
}

.page-contribute .form-intro { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem; }
.page-contribute .form-intro .eyebrow { display: flex; margin-bottom: .75rem; }
.page-contribute .form-intro h2 { margin-bottom: .55rem; color: var(--navy-900); font-size: clamp(1.75rem, 3vw, 2.3rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.08; }
.page-contribute .draft-status {
  display: inline-flex; align-items: center; gap: .55rem; max-width: 34ch;
  padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2);
  color: var(--ink-2); font-size: .8rem; line-height: 1.4;
}
/* Neutral dot: the same pill shows "saving", "saved" and "unavailable" messages from form.js. */
.page-contribute .draft-status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
/* Without JavaScript the form cannot add steps or options, save, or open the review (a plain submit would put
   the fields in the URL). The card then shows only its heading and the noscript notice with the email route. */
html:not(.js) .page-contribute .example-open,
html:not(.js) .page-contribute #task-form > :not(.form-intro, noscript),
html:not(.js) .page-contribute .form-intro :is(.small, .draft-status) { display: none; }
html:not(.js) .page-contribute #task-form { gap: 1.5rem; }
.page-contribute #task-form .form-alert { margin-bottom: 0; }

.page-contribute .form-section { padding-top: 2.25rem; border-top: 1px solid var(--line); }
.page-contribute .section-title { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: 1.5rem; }
.page-contribute .section-number {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin-top: -.2rem;
  border-radius: 50%; background: var(--blue-50); color: var(--blue-600); box-shadow: inset 0 0 0 1px var(--blue-100);
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .02em;
}
.page-contribute .section-icon svg { width: 17px; height: 17px; }
.page-contribute .section-title h2 { color: var(--navy-900); font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.page-contribute .section-title p { max-width: 62ch; margin-top: .3rem; }
.page-contribute .required-marker { color: var(--blue-600); font-weight: 600; }
.page-contribute .optional {
  display: inline-block; margin-left: .45rem; padding: .06rem .45rem; vertical-align: .14em;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-family: var(--font-mono); font-size: .62rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; line-height: 1.45; color: var(--ink-3);
}

/* Fields */
.page-contribute .field-stack { display: grid; gap: 1.35rem; }
.page-contribute .field { display: flex; flex-direction: column; gap: .5rem; min-width: 0; color: var(--ink); }
.page-contribute .field > span { color: var(--navy-900); font-size: .92rem; font-weight: 560; line-height: 1.45; }
.page-contribute :is(.field, .item-row, .evidence-row) :is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, select) {
  display: block; width: 100%; min-width: 0; margin: 0;
  padding: .74rem .95rem; border: 1px solid var(--field-line); border-radius: var(--field-radius);
  background-color: #fff; color: var(--ink);
  font-family: var(--font-sans); font-size: 1rem; font-weight: 400; line-height: 1.5;
  text-overflow: ellipsis; /* long placeholders end in an ellipsis on narrow phones instead of a hard cut */
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.page-contribute :is(.field, .item-row, .evidence-row) :is(input:not([type="checkbox"]), textarea, select):hover { border-color: var(--field-line-hover); }
/* The transparent outline only shows in forced-colors mode, where borders and shadows are repainted. */
.page-contribute :is(.field, .item-row, .evidence-row) :is(input:not([type="checkbox"]), textarea, select):focus {
  outline: 2px solid transparent; outline-offset: 1px; border-color: var(--blue-600); box-shadow: var(--focus-ring);
}
.page-contribute :is(.field, .item-row, .evidence-row) :is(input, textarea):user-invalid { border-color: #b42318; }
.page-contribute :is(.field, .item-row, .evidence-row) :is(input, textarea):user-invalid:focus { box-shadow: 0 0 0 1px #b42318, 0 0 0 4px rgba(180, 35, 24, .16); }
.page-contribute ::placeholder { color: var(--ink-3); opacity: 1; }
.page-contribute textarea { resize: vertical; min-height: 5.25rem; }
.page-contribute .field select {
  appearance: none; -webkit-appearance: none; padding-right: 2.5rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23475569' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 16px 16px;
}
.page-contribute .contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.page-contribute .affiliation-field { grid-column: 1 / -1; }

/* Data availability and other choice chips */
.page-contribute .data-availability { display: grid; gap: .6rem; min-width: 0; margin: .25rem 0 0; padding: 0; border: 0; }
.page-contribute .data-availability legend { padding: 0 0 .15rem; color: var(--navy-900); font-size: .92rem; font-weight: 560; line-height: 1.45; }
.page-contribute .data-availability .field { margin-top: .35rem; }
.page-contribute .choice-list { display: flex; flex-wrap: wrap; gap: .55rem; }
.page-contribute .choice-list label {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 42px; padding: .5rem 1rem .5rem .8rem;
  border: 1px solid var(--line-2); border-radius: 999px; background: #fff;
  color: var(--ink-2); font-size: .9rem; font-weight: 500; line-height: 1.35; cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.page-contribute .choice-list label:hover { border-color: var(--field-line-hover); color: var(--ink); }
.page-contribute .choice-list label:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); color: var(--navy-900); }
.page-contribute .choice-list label:has(input:focus-visible) { border-color: var(--blue-600); box-shadow: var(--focus-ring); }
.page-contribute .choice-list input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 18px; height: 18px; margin: 0; padding: 0;
  border: 1.5px solid var(--control-line); border-radius: 5px; background: #fff;
  cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.page-contribute .choice-list input[type="checkbox"]:checked {
  border-color: var(--blue-600);
  background: var(--blue-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 10.5 3.2 3.2L15 7'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}
/* The whole chip carries the focus ring; the checkbox's own outline stays for forced-colors mode only. */
.page-contribute .choice-list input[type="checkbox"]:focus-visible { outline: 2px solid transparent; outline-offset: 2px; border-radius: 5px; }

/* Tools and modalities */
.page-contribute .setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); column-gap: 1rem; row-gap: 0; }
.page-contribute .setup-column {
  display: grid; grid-row: span 4; grid-template-rows: subgrid; align-content: start; min-width: 0;
  padding: 1.25rem 1.25rem 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--paper-2);
}
.page-contribute .setup-column h3 { color: var(--navy-900); font-size: 1rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.4; }
.page-contribute .setup-column > p { margin: .2rem 0 .9rem; }
.page-contribute .item-list { display: grid; gap: .6rem; align-content: start; }
.page-contribute .item-row { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.page-contribute .item-row .field { flex: 1; }
.page-contribute .item-row .button-text { flex: none; }
/* A lone tool or modality cannot be removed: hide its disabled control instead of showing a dead button. */
.page-contribute .item-row .button-text:disabled { display: none; }
.page-contribute .add-control { justify-self: start; margin-top: .7rem; margin-left: -.75rem; }

/* Steps and evidence */
.page-contribute .evidence-guide {
  display: grid; gap: .85rem; margin-bottom: 1.5rem; padding: 1.15rem 1.3rem;
  border: 1px solid var(--blue-100); border-radius: 16px;
  background: radial-gradient(420px 160px at 100% 0%, var(--accent-glow), transparent 70%), var(--blue-50);
}
.page-contribute .evidence-guide dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1.25rem; font-size: .95rem; line-height: 1.5; }
.page-contribute .evidence-guide dt {
  display: inline-flex; align-items: center; gap: .5rem; padding-top: .15rem;
  font-family: var(--font-mono); font-size: .66rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-700);
}
.page-contribute .evidence-guide dt::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500); }
.page-contribute .evidence-guide dt:nth-of-type(2)::before { background: var(--signal); }
.page-contribute .evidence-guide dd { color: var(--navy-900); font-weight: 500; }
.page-contribute .evidence-guide p { padding-top: .85rem; border-top: 1px solid var(--blue-100); color: var(--ink-2); }

.page-contribute .step-list { display: grid; gap: .9rem; margin-bottom: 1.1rem; }
.page-contribute .step-card { min-width: 0; padding: 1.15rem 1.35rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--paper-2); }
.page-contribute .step-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 34px; margin-bottom: .85rem; }
.page-contribute .step-header h3 {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-600);
}
.page-contribute .step-header h3::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--blue-600); }
.page-contribute .step-actions { display: flex; align-items: center; gap: .3rem; }
/* With a single step every control is disabled, so the group is hidden until there is something to reorder. */
.page-contribute .step-actions:not(:has(button:not(:disabled))) { display: none; }
.page-contribute .step-actions .button-text:is([data-action="move-up"], [data-action="move-down"]) {
  width: 34px; height: 34px; min-height: 34px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink-2); font-size: .95rem;
}
.page-contribute .step-actions .button-text:is([data-action="move-up"], [data-action="move-down"]):not(:disabled):hover { border-color: var(--blue-400); background: #fff; color: var(--blue-600); }
.page-contribute .step-actions [data-action="remove-step"] { min-height: 34px; padding: .35rem .7rem; }
.page-contribute .step-context { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 .25rem; }
.page-contribute .step-context:empty { display: none; }
.page-contribute .step-context fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.page-contribute .step-context legend { margin-bottom: .55rem; padding: 0; color: var(--navy-900); font-size: .85rem; font-weight: 560; }
.page-contribute .step-context .choice-list label { min-height: 36px; padding: .35rem .85rem .35rem .65rem; font-size: .85rem; }
.page-contribute .evidence-list { display: grid; }
.page-contribute .evidence-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 11rem auto; align-items: start; gap: .75rem;
  margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line-2);
}
.page-contribute .evidence-row .field { gap: .4rem; }
.page-contribute .evidence-row .field > span { font-size: .84rem; }
.page-contribute .evidence-row .field:first-child > span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: .5rem; border-radius: 50%; background: var(--signal); vertical-align: .12em; }
.page-contribute .evidence-row textarea { min-height: 4.75rem; }
.page-contribute .evidence-row > .button-text { margin-top: 2.05rem; }
.page-contribute .step-card .add-control { margin-top: .75rem; }

/* Finish, status and draft tools */
.page-contribute .form-finish {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 1.5rem;
  padding: 1.1rem 1.1rem 1.1rem 1.5rem; border: 1px solid var(--blue-100); border-radius: 18px;
  background:
    radial-gradient(520px 200px at 100% 0%, var(--accent-glow), transparent 70%),
    linear-gradient(160deg, var(--accent-50), color-mix(in srgb, var(--accent-100) 40%, #fff));
}
.page-contribute .form-finish p { color: var(--ink-2); font-size: .95rem; }
/* A plain white notice with an ink bar: it has to read right for "Draft loaded." and "Please enter your name." alike. */
.page-contribute :is(#form-status, #send-status):not(:empty) {
  position: relative; padding: .8rem 1rem .8rem 1.4rem; border: 1px solid var(--line-2); border-radius: 12px;
  background: #fff; color: var(--ink); box-shadow: var(--shadow-sm);
}
.page-contribute :is(#form-status, #send-status):not(:empty)::before {
  content: ""; position: absolute; left: .6rem; top: .75rem; bottom: .75rem; width: 3px; border-radius: 3px; background: var(--ink);
}
.page-contribute #task-form > #form-status { margin-top: -1.25rem; }
.page-contribute .draft-tools { margin-top: -1rem; }
.page-contribute .draft-tools summary {
  display: inline-flex; align-items: center; gap: .6rem; list-style: none;
  margin-left: -.6rem; padding: .45rem .8rem .45rem .7rem; border-radius: 999px;
  color: var(--ink-2); font-size: .9rem; font-weight: 550; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.page-contribute .draft-tools summary::-webkit-details-marker { display: none; }
.page-contribute .draft-tools summary::before {
  content: ""; flex: none; width: 6px; height: 6px; margin-right: .1rem;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s var(--ease);
}
.page-contribute .draft-tools[open] summary::before { transform: translateY(-2px) rotate(45deg); }
.page-contribute .draft-tools summary:hover { background: var(--paper-2); color: var(--ink); }
.page-contribute .draft-actions { display: flex; flex-wrap: wrap; gap: .55rem; padding: .85rem 0 .75rem; }

/* ---------- Dialogs ---------- */
.page-contribute :is(#review-dialog, #example-dialog, .confirm-dialog) {
  margin: auto; border: 1px solid var(--line); background: #fff; color: var(--ink);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .06), 0 40px 100px -30px rgba(15, 23, 42, .45);
}
.page-contribute :is(#review-dialog, #example-dialog, .confirm-dialog)::backdrop {
  background: rgba(15, 23, 42, .28);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
@media screen {
  .page-contribute:has(:is(#example-dialog, #review-dialog)[open]) { overflow: hidden; }
}

.page-contribute .close-dialog {
  position: relative; flex: none; width: 40px; height: 40px; min-height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink-2);
  font-size: 0; line-height: 1;
}
.page-contribute .close-dialog::before,
.page-contribute .close-dialog::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.6px; border-radius: 2px; background: currentColor;
}
.page-contribute .close-dialog::before { transform: translate(-50%, -50%) rotate(45deg); }
.page-contribute .close-dialog::after { transform: translate(-50%, -50%) rotate(-45deg); }
.page-contribute .close-dialog:not(:disabled):hover { border-color: var(--line-2); background: var(--paper-2); color: var(--ink); }

/* Review */
.page-contribute #review-dialog {
  width: min(860px, calc(100vw - 2rem)); max-height: calc(100dvh - 3rem);
  padding: clamp(1.35rem, 3.5vw, 2.25rem); border-radius: 24px;
  overflow-y: auto; overscroll-behavior: contain;
}
.page-contribute .review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-contribute .review-heading .eyebrow { display: flex; margin-bottom: .55rem; }
.page-contribute .review-heading h2 { color: var(--navy-900); font-size: clamp(1.5rem, 3vw, 1.95rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
.page-contribute #review-content { font-size: .95rem; line-height: 1.65; overflow-wrap: anywhere; }
.page-contribute #review-content h3 { margin: 1.6rem 0 .55rem; color: var(--navy-900); font-size: 1.12rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.35; }
.page-contribute #review-content h4 { margin: 1rem 0 .35rem; font-weight: 600; }
.page-contribute #review-content :is(p, dl, ul, ol) { margin-bottom: .75rem; }
.page-contribute #review-content :is(ul, ol) { padding-left: 1.3rem; list-style: revert; }
.page-contribute #review-content .review-contributor {
  margin-bottom: 0; padding: .95rem 1.15rem; border: 1px solid var(--blue-100); border-radius: 14px;
  background: var(--blue-50); color: var(--ink-2);
}
.page-contribute .review-contributor strong { color: var(--navy-900); font-weight: 600; }
.page-contribute #review-content dl {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: .55rem 1.5rem;
  margin-top: 1rem; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2);
}
.page-contribute #review-content dt { padding-top: .2rem; font-family: var(--font-mono); font-size: .66rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.page-contribute #review-content dd { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.page-contribute #review-content .review-steps { list-style: none; display: grid; gap: .6rem; padding: 0; counter-reset: review-step; }
.page-contribute #review-content .review-steps > li {
  position: relative; margin: 0; padding: .85rem 1.1rem .9rem 3.3rem; counter-increment: review-step;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.page-contribute #review-content .review-steps > li::before {
  content: counter(review-step, decimal-leading-zero);
  position: absolute; left: 1.1rem; top: .98rem;
  font-family: var(--font-mono); font-size: .74rem; font-weight: 500; color: var(--blue-600);
}
.page-contribute .review-steps > li > strong { color: var(--navy-900); font-weight: 600; }
.page-contribute #review-content .review-steps li p { margin: .15rem 0 0; }
.page-contribute #review-content .review-steps li ul { list-style: none; display: grid; gap: .45rem; margin: .6rem 0 0; padding: .6rem 0 0; border-top: 1px dashed var(--line-2); }
.page-contribute #review-content .review-steps li ul li { margin: 0; }
.page-contribute .review-steps li ul .importance-tag { margin-right: .5rem; }
.page-contribute .review-comments { margin-top: 1.25rem; padding-top: .25rem; border-top: 1px solid var(--line); }
.page-contribute .review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1.75rem 0 1.1rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.page-contribute #review-dialog > .small { color: var(--ink-2); }
.page-contribute #review-dialog > .small + .small { margin-top: .35rem; }
.page-contribute #send-status:not(:empty) { margin-top: .9rem; }

.page-contribute .importance-tag {
  display: inline-flex; align-items: center; flex: none; vertical-align: .1em;
  padding: .1rem .5rem; border: 1px solid var(--blue-100); border-radius: 999px; background: var(--blue-50); color: var(--blue-700);
  font-family: var(--font-mono); font-size: .64rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; line-height: 1.5;
  white-space: nowrap;
}

/* Worked example */
.page-contribute #example-dialog {
  width: min(1180px, calc(100vw - 2rem)); max-height: calc(100dvh - 3rem);
  padding: 0; border-radius: 24px; overflow-y: auto; overscroll-behavior: contain;
}
.page-contribute .example-dialog-heading {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 1.25rem 1.05rem 1.9rem; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.page-contribute .example-dialog-heading h2 { color: var(--navy-900); font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.page-contribute .example-dialog-body { padding: 1.6rem 1.9rem 1.9rem; line-height: 1.6; }
.page-contribute .example-subtitle { margin-bottom: 1.4rem; color: var(--ink-2); font-size: 1.08rem; }
.page-contribute .example-details {
  display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: .55rem 1.5rem;
  padding: 1.05rem 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); font-size: .93rem;
}
.page-contribute .example-details dt { padding-top: .2rem; font-family: var(--font-mono); font-size: .66rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.page-contribute .example-details dd { color: var(--ink); }
.page-contribute .example-guidance {
  margin: 1.25rem 0; padding: .9rem 1.15rem; border-left: 3px solid var(--blue-600); border-radius: 0 12px 12px 0;
  background: var(--blue-50); color: var(--ink-2); font-size: .9rem;
}
.page-contribute .example-table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.page-contribute .example-table { width: calc(100% + 2px); margin: -1px; table-layout: fixed; border-collapse: collapse; font-size: .86rem; line-height: 1.55; }
.page-contribute .example-table-caption { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.page-contribute .example-table :is(th, td) { padding: .8rem; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: break-word; }
.page-contribute .example-table thead th {
  padding-block: .7rem; background: var(--paper-2);
  font-family: var(--font-mono); font-size: .62rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.page-contribute .example-table tbody th { color: var(--navy-900); font-weight: 600; }
.page-contribute .example-table tbody td { color: var(--ink); }
.page-contribute .example-table tbody td:nth-child(2), .page-contribute .example-table tbody td:nth-child(3) { color: var(--ink-2); }
/* Widths leave room for the longest header ("Application") and tag ("Essential") down to the 901px card switch */
.page-contribute .example-col-step { width: 21%; }
.page-contribute .example-col-app { width: 13%; }
.page-contribute .example-col-data { width: 13%; }
.page-contribute .example-col-evidence { width: 39%; }
.page-contribute .example-col-importance { width: 14%; }
.page-contribute .example-mobile-steps { display: none; }
.page-contribute .example-result {
  margin-top: 1.25rem; padding: 1rem 1.2rem; border: 1px solid var(--blue-100); border-radius: 14px;
  background: radial-gradient(420px 160px at 100% 0%, var(--accent-glow), transparent 70%), var(--blue-50);
}
.page-contribute .example-result h3 { margin-bottom: .35rem; font-family: var(--font-mono); font-size: .66rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-700); }
.page-contribute .example-result p { color: var(--navy-900); font-weight: 500; }
.page-contribute .example-reference { margin-top: 1rem; color: var(--ink-2); overflow-wrap: anywhere; }
.page-contribute .example-reference strong { color: var(--ink); font-weight: 600; }
.page-contribute .example-end { display: flex; justify-content: flex-end; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }

/* Confirm (created by form.js) */
.page-contribute .confirm-dialog { width: min(460px, calc(100vw - 2rem)); padding: 1.6rem 1.6rem 1.4rem; border-radius: 20px; line-height: 1.6; }
.page-contribute .confirm-dialog p { color: var(--navy-900); font-size: 1.02rem; font-weight: 500; }
.page-contribute .confirm-dialog .review-actions { justify-content: flex-end; margin: 1.35rem 0 0; padding-top: 0; border-top: 0; }

/* ---------- Responsive ---------- */
/* Even columns on smaller laptops so the card's step rows stay on one line and the card stays compact. */
@media (max-width: 1180px) {
  .page-contribute .contribute-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2.5rem, 5vw, 4rem); }
}

@media (max-width: 1100px) {
  .page-contribute .criteria { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Once the 920px form card would sit just inside the gutters, it takes the full shell so its edges line up. */
@media (max-width: 1060px) {
  .page-contribute .collection-shell { width: min(var(--shell), 100% - 2 * var(--gutter)); }
}

@media (max-width: 960px) {
  .page-contribute .contribute-hero { grid-template-columns: 1fr; gap: 2.75rem; padding-top: var(--hero-top); }
  .page-contribute .contribute-hero .page-hero-inner { padding-top: 0; }
  .page-contribute .example-bar { width: 100%; max-width: 620px; }
}

@media (max-width: 900px) {
  /* The worked example switches from the table to step cards */
  .page-contribute .example-table-wrap { display: none; }
  .page-contribute .example-mobile-steps { display: grid; gap: .7rem; }
  .page-contribute .example-step { padding: 1rem 1.05rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
  .page-contribute .example-step h3 { color: var(--navy-900); font-size: .98rem; font-weight: 600; line-height: 1.4; }
  .page-contribute .example-step-context { margin: .3rem 0 .7rem; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .04em; color: var(--ink-2); }
  .page-contribute .example-step ul { list-style: none; display: grid; }
  .page-contribute .example-step li { margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--line-2); font-size: .88rem; }
  .page-contribute .example-step li:first-child { margin-top: 0; }
  .page-contribute .example-step li p { margin-bottom: .4rem; color: var(--ink); }
  .page-contribute .example-step > p.small { color: var(--ink-2); }
}

@media (max-width: 780px) {
  .page-contribute #example-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); border-radius: 18px; }
  .page-contribute .example-dialog-heading { padding: .8rem .8rem .8rem 1.15rem; }
  .page-contribute .example-dialog-heading h2 { font-size: 1.06rem; }
  .page-contribute .example-dialog-body { padding: 1.1rem 1.1rem 1.25rem; }
  .page-contribute .example-subtitle { font-size: 1rem; }
  .page-contribute .example-details { grid-template-columns: 1fr; gap: .1rem; padding: .9rem 1rem; }
  .page-contribute .example-details dd { margin-bottom: .55rem; }
  .page-contribute .example-details dd:last-child { margin-bottom: 0; }
}

@media (max-width: 640px) {
  .page-contribute .contribute-hero { padding-bottom: 3.25rem; gap: 2.25rem; }
  /* On phones the card is a short teaser: the step preview repeats what the example dialog shows. */
  .page-contribute .example-preview { display: none; }

  .page-contribute .criteria-section { padding-block: 3.5rem; }
  .page-contribute .criteria { grid-template-columns: 1fr; gap: .75rem; }
  .page-contribute .criterion { grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "icon title" "icon text"; column-gap: 1rem; row-gap: .25rem; padding: 1.15rem 1.2rem 1.25rem; }
  .page-contribute .criterion-top { grid-area: icon; align-self: start; margin: 0; }
  .page-contribute .criterion-top .num { display: none; }
  .page-contribute .criterion h3 { grid-area: title; align-self: center; font-size: 1.12rem; }
  .page-contribute .criterion p { grid-area: text; font-size: .94rem; }

  .page-contribute .form-area { padding-block: 2.5rem 3.5rem; }
  .page-contribute #task-form { gap: 1.85rem; padding: 1.4rem 1.1rem 1.5rem; border-radius: 20px; }
  .page-contribute .form-intro { flex-direction: column; align-items: flex-start; gap: .9rem; }
  .page-contribute .draft-status { max-width: none; }
  .page-contribute .form-section { padding-top: 1.85rem; }
  .page-contribute .section-title { gap: .75rem; margin-bottom: 1.25rem; }
  .page-contribute .contact-grid { grid-template-columns: 1fr; gap: 1.1rem; }
  .page-contribute .data-availability .choice-list label { width: 100%; border-radius: 12px; }
  .page-contribute .setup-grid { grid-template-columns: 1fr; grid-template-rows: none; row-gap: .85rem; }
  .page-contribute .setup-column { display: block; grid-row: auto; padding: 1.1rem 1rem .9rem; }
  .page-contribute .setup-column > p { margin-bottom: .8rem; }
  .page-contribute .evidence-guide { padding: 1rem 1.05rem; }
  .page-contribute .evidence-guide dl { grid-template-columns: 1fr; gap: .15rem; }
  .page-contribute .evidence-guide dd { margin-bottom: .45rem; }
  .page-contribute .step-card { padding: 1rem .95rem 1rem; }
  .page-contribute .step-context { grid-template-columns: 1fr; }
  .page-contribute .evidence-row { grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; }
  .page-contribute .evidence-row > .field:first-child { grid-column: 1 / -1; }
  .page-contribute .form-finish { flex-direction: column; align-items: stretch; padding: 1.1rem; text-align: center; }
  .page-contribute .form-finish .button { width: 100%; }
  .page-contribute .draft-actions .button { flex: 1 1 auto; }

  .page-contribute #review-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); padding: 1.25rem 1.1rem; border-radius: 18px; }
  .page-contribute #review-content dl { grid-template-columns: 1fr; gap: .1rem; }
  .page-contribute #review-content dd { margin-bottom: .55rem; }
  .page-contribute #review-content .review-steps > li { padding-left: 2.9rem; }
  .page-contribute #review-content .review-steps > li::before { left: .95rem; }
  .page-contribute .review-actions .button { flex: 1 0 auto; }

  /* Temporary guard, as on Team and Projects: site.css lost its ≤640px footer rule (that media block is
     left open), so the shared footer squeezes three link columns onto a phone. Delete once site.css is repaired. */
  .page-contribute .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* This page's own motion (the long in-page jump to the form, the criteria reveal, control transitions)
   honours reduced motion here too: site.css's reduced-motion block currently sits inside an unclosed
   media block, as on Team and Projects. Harmless duplication once site.css is repaired. */
@media (prefers-reduced-motion: reduce) {
  html:has(> body.page-contribute) { scroll-behavior: auto; }
  html.js .page-contribute [data-reveal] { opacity: 1; transform: none; transition: none; }
  .page-contribute *, .page-contribute *::before, .page-contribute *::after {
    transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .page-contribute .choice-list input[type="checkbox"] { appearance: auto; -webkit-appearance: auto; }
  .page-contribute .close-dialog { font-size: 1.4rem; }
  .page-contribute .close-dialog::before, .page-contribute .close-dialog::after { display: none; }
}

/* ---------- Print: the form, or the open dialog only ---------- */
@media print {
  .page-contribute { background: #fff; color: #000; }
  .page-contribute :is(.site-header, .site-footer, .skip-link, .page-hero, .criteria-section, .draft-tools, .draft-status, .form-finish, .button, .button-text, #form-status) { display: none !important; }
  .page-contribute .form-area { padding: 0; border: 0; background: #fff; }
  .page-contribute .collection-shell { width: 100%; max-width: none; margin: 0; }
  .page-contribute #task-form { gap: .6rem; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .page-contribute :is(.form-section, .step-card, .setup-column) { break-inside: avoid; box-shadow: none; }
  .page-contribute :is(input, textarea, select) { border-color: #aaa !important; color: #000 !important; box-shadow: none !important; }
  /* An open dialog (e.g. "Print / save PDF" opens the review) prints on its own as plain, flowing content.
     Selectors repeat the dialog IDs so they outrank the screen rules above. */
  .page-contribute:has(dialog[open]) > :not(dialog) { display: none !important; }
  .page-contribute :is(#review-dialog, #example-dialog, .confirm-dialog)[open] {
    position: absolute; inset: 0 auto auto 0; width: 100%; max-width: none; height: auto; max-height: none !important;
    margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: visible;
  }
  .page-contribute :is(#review-dialog, #example-dialog, .confirm-dialog)::backdrop { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .page-contribute dialog :is(.close-dialog, .review-actions),
  .page-contribute dialog > .small { display: none !important; }
  .page-contribute .example-dialog-heading { position: static; padding-inline: 0; border-bottom: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .page-contribute .example-dialog-body { padding-inline: 0; }
  .page-contribute :is(.review-steps > li, .example-step, .example-table tbody, .example-result) { break-inside: avoid; }
}
