/* Participant pages (join. host). Small and self-contained: no panel CSS, no external fonts.
   Palette from the logo: navy ink, mint accent; text colours meet WCAG AA on their backgrounds
   (ink on paper 11.5:1, accent on paper 5.2:1, white on primary 12.9:1). Works from 360 px. */

:root {
  --paper: #f2f2ee;
  --card: #fbfbf8;
  --ink: #1c3446;
  --muted: #4c5e6a;           /* 6.0:1 on paper */
  --rule: #d6d9d3;
  --accent: #2a7060;          /* links, focus */
  --mint: #6fbfa5;            /* decoration only, never text */
  --mint-soft: #dcefe7;
  --primary: #1c3446;
  --primary-ink: #ffffff;
  --fail: #a3261a;
  --fail-soft: #f6d8d3;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", "Noto Sans", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1b24;
    --card: #172a37;
    --ink: #e4ece9;
    --muted: #a9b8b4;
    --rule: #263b48;
    --accent: #7fd1b6;
    --mint-soft: #1b3a36;
    --primary: #6fbfa5;
    --primary-ink: #0f1b24;
    --fail: #ef8a7c;
    --fail-soft: #43201b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 1.5rem 0 .75rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
a { color: var(--accent); text-underline-offset: .15em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--card); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }

.masthead { background: var(--card); border-bottom: 3px solid var(--mint); }
.masthead-inner {
  max-width: 42rem; margin: 0 auto; padding: .75rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
}
.logo { width: 48px; height: 48px; flex: none; }
.titles { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; }
.site { font-size: .875rem; color: var(--muted); }
.study { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.lang-switch { display: flex; gap: .25rem; }
.lang-switch a {
  display: inline-block; min-height: 44px; padding: .55rem .6rem; border-radius: 3px;
  font-size: .9375rem; text-decoration: none; color: var(--ink);
}
.lang-switch a[aria-current] { background: var(--mint-soft); font-weight: 600; text-decoration: underline; }
.progress-slot { max-width: 42rem; margin: 0 auto; padding: 0 1rem; }
.progress-slot:empty { display: none; }
.progress-slot ol { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0; padding: .5rem 0; font-size: .875rem; color: var(--muted); }
.progress-slot [aria-current] { color: var(--ink); font-weight: 600; text-decoration: underline; }

.page { display: block; max-width: 42rem; margin: 0 auto; padding: .5rem 1rem 2.5rem; }
.page:focus { outline: none; }

label { display: block; font-weight: 600; margin: 1rem 0 .25rem; }
input[type=text], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; max-width: 100%; padding: .6rem .7rem; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--muted); border-radius: 3px;
}
input[type=checkbox], input[type=radio] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.help { color: var(--muted); font-size: .9375rem; margin: .25rem 0 0; }
.button, button {
  display: inline-block; min-height: 44px; margin-top: 1.25rem; padding: .65rem 1.25rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--primary-ink); background: var(--primary); border: 0; border-radius: 3px;
}
.errorlist, .error { color: var(--fail); font-weight: 600; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0; }
.notice { background: var(--mint-soft); border-left: 4px solid var(--accent); padding: .75rem 1rem; }
.notice.fail { background: var(--fail-soft); border-left-color: var(--fail); }

.colophon {
  max-width: 42rem; margin: 0 auto; padding: 1rem 1rem 2rem;
  border-top: 1px solid var(--rule); color: var(--muted); font-size: .875rem;
}
.colophon p { margin: .25rem 0; }

/* Consent document (consent/_document.html) */
.consent-items { border: 1px solid var(--rule, #ccd); padding: .75rem 1rem; margin: 1rem 0; }
.consent-items .check { margin: .5rem 0; }
.consent-items input[type="checkbox"] { width: 1.25rem; height: 1.25rem; margin-right: .5rem; vertical-align: middle; }
.consent-items .req { font-weight: 600; }

/* Registration flow (registration/public/*.html) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.progress-text { margin: 0; padding: .5rem 0; font-size: .875rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.actions form { margin: 0; }
.actions .back { display: inline-block; min-height: 44px; margin-top: 1.25rem; padding: .65rem 0; }
button.secondary, .button.secondary {
  color: var(--ink); background: var(--card); border: 2px solid var(--primary); padding: .55rem 1.1rem;
}
.reg-question, .reg-field { border: 1px solid var(--rule); border-radius: 3px; padding: .5rem 1rem .75rem; margin: 1rem 0; }
.reg-question legend, .reg-field legend { font-weight: 600; padding: 0 .25rem; }
.check { margin: .5rem 0; }
.check label { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; margin: 0; min-height: 44px; padding-top: .55rem; }
.check input { flex: none; margin-top: .2rem; }
.req { font-weight: 400; color: var(--muted); }
.reg-pid strong, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15em; letter-spacing: .05em; overflow-wrap: anywhere; }
.resume { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); }
.resume p { margin: 0; }
[aria-invalid="true"] { border-color: var(--fail); border-width: 2px; }
p.error { margin: .25rem 0; }

/* Instrument runner (instruments/public/*.html) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stimulus { margin: 2.5rem 0 1.5rem; text-align: center; font-family: var(--serif); font-size: 2.25rem; overflow-wrap: anywhere; }
.ld-answer { border: 0; padding: 0; margin: 0; }
.ld-answer legend { font-weight: 600; }
.ld-answer .actions button { min-width: 7rem; }
.key { font-weight: 400; }
.question { border: 1px solid var(--rule); border-radius: 3px; padding: .5rem 1rem .75rem; margin: 1rem 0; }
.question legend { font-weight: 600; padding: 0 .25rem; }
/* Legend inside the box: a floated legend never sits on the fieldset border, and wraps cleanly at 360 px. */
.reg-question > legend, .reg-field > legend, .question > legend, .consent-items > legend {
  float: left; width: 100%; box-sizing: border-box; padding: 0; margin: 0 0 .5rem; color: var(--ink); overflow-wrap: anywhere;
}
.reg-question > legend + *, .reg-field > legend + *, .question > legend + *, .consent-items > legend + * { clear: both; }
.matrix-row { border: 0; padding: 0; margin: .5rem 0; }
.likert-points { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0 1rem; }
.likert-points .check { margin: .25rem 0; }
@media (max-width: 30em) { .likert-points { grid-template-columns: 1fr; } }
.anchor { color: var(--muted); }
.citation { color: var(--muted); font-size: .9375rem; overflow-wrap: anywhere; }
input[type=week] { width: 100%; max-width: 100%; padding: .6rem .7rem; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--muted); border-radius: 3px; }
/* flow runner: timed steps */
.timer { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.5rem; font-weight: 600; }
.log-entries { padding-left: 1.25rem; }
.log-entries li { margin: .25rem 0; overflow-wrap: anywhere; }
.timed-area:fullscreen { background: var(--card); padding: 1.5rem; overflow: auto; }

/* My Study portal (R2c-1) */
.portal-tabs ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0; padding: .5rem 0; }
.portal-tabs a { display: inline-block; min-height: 44px; padding: .65rem .25rem; }
.portal-tabs a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-thickness: 3px; }
.portal-pid { margin: 1rem 0 0; color: var(--muted); }
.portal-facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.portal-facts dt { font-weight: 600; }
.portal-facts dd { margin: 0; }
.portal-links li { margin: .5rem 0; }
.portal-signout { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.portal-tasks, .portal-files { list-style: none; padding: 0; }
.portal-tasks li, .portal-files li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.portal-tasks form { margin: 0; }
.portal-files .name { font-weight: 600; overflow-wrap: anywhere; }
.portal-files .meta { color: var(--muted); }
input[type=file] { display: block; max-width: 100%; margin: .25rem 0 1rem; font: inherit; }
.portal-withdraw { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
