/* The portal's default design (D204): what an account with no design of its
   own gets. Mobile-first: one column the width of a phone, a centred card of
   at most 40rem from a tablet up. Light and dark follow the person's own
   setting. Text is 16px and up, so a phone never zooms into a control; tap
   targets are at least 44px; focus is always drawn. No inline style is used
   anywhere, since the portal's CSP allows none: the runtime changes a page
   only through `hidden` and `data-pt-*` attributes, which the rules below
   read. Neutral by design: the organisation's name heads the page, never
   Spectra's. */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;
  --pt-bg: #f4f4f1;
  --pt-card: #ffffff;
  --pt-ink: #1b1d20;
  --pt-muted: #565b63;
  --pt-line: #d3d6da;
  --pt-line-strong: #8a9099;
  --pt-field: #ffffff;
  --pt-accent: #1d5bb8;
  --pt-accent-hover: #174a96;
  --pt-accent-ink: #ffffff;
  --pt-error: #b02a20;
  --pt-error-bg: #fdf1f0;
  --pt-focus: #f2b705;
  --pt-focus-ring: #1b1d20;
  --pt-head: #ffffff;
  --pt-radius: 10px;
  --pt-radius-sm: 6px;
  --pt-space: 1rem;
  --pt-column: 40rem;
  --pt-target: 2.75rem;
  --pt-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --pt-bg: #121417;
    --pt-card: #1b1e22;
    --pt-ink: #eceef1;
    --pt-muted: #a8aeb6;
    --pt-line: #353a41;
    --pt-line-strong: #6f7680;
    --pt-field: #121417;
    --pt-accent: #7eb0ff;
    --pt-accent-hover: #a3c7ff;
    --pt-accent-ink: #0b1626;
    --pt-error: #ff8f85;
    --pt-error-bg: #2a1716;
    --pt-focus: #f2b705;
    --pt-focus-ring: #121417;
    --pt-head: #1b1e22;
  }
}

/* ── Base ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

/* `hidden` always wins: the runtime hides steps, fields and buttons by it. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--pt-bg);
  color: var(--pt-ink);
  font: 1rem/1.5 var(--pt-font);
  overflow-wrap: break-word;
}

h1, h2 { line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1875rem; margin: 0 0 0.5rem; }

a { color: var(--pt-accent); text-underline-offset: 0.15em; }
a:hover { color: var(--pt-accent-hover); }

:focus-visible {
  outline: 3px solid var(--pt-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--pt-focus-ring);
}

/* What only a screen reader reads. */
.pt-vh, .pt-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

/* ── The shell ──────────────────────────────────────────────────────────── */

.pt-skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--pt-card);
  border-radius: var(--pt-radius-sm);
  z-index: 1;
}
.pt-skip:focus { top: 0.5rem; }

.pt-head {
  background: var(--pt-head);
  border-bottom: 1px solid var(--pt-line);
}

.pt-head-in {
  max-width: var(--pt-column);
  margin: 0 auto;
  padding: 0.875rem var(--pt-space);
  min-height: 3.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}

.pt-org {
  margin: 0;
  font-weight: 650;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
}

.pt-head-in > .pt-org { flex: 1 1 auto; }

/* Who is signed in, and Sign out (D209). */
.pt-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.5rem;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--pt-muted);
}
.pt-who-address { color: var(--pt-ink); overflow-wrap: anywhere; }
.pt-quiet {
  background: transparent;
  color: var(--pt-accent);
  border: 0;
  padding: 0.5rem 0.25rem;
  text-decoration: underline;
  font-weight: 600;
}
.pt-quiet:hover { color: var(--pt-accent-hover); }

.pt-main {
  max-width: var(--pt-column);
  margin: 0 auto;
  padding: 0 0 3rem;
}
.pt-main:focus { outline: none; }

.pt-card {
  background: var(--pt-card);
  padding: 1.25rem var(--pt-space) 1.5rem;
  border-bottom: 1px solid var(--pt-line);
}

@media (min-width: 40rem) {
  .pt-main { padding: 1.5rem var(--pt-space) 4rem; }
  .pt-card {
    padding: 2rem 2.25rem 2.25rem;
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius);
  }
  h1 { font-size: 1.75rem; }
}

.pt-title:focus { outline: none; }

/* ── What the form says ─────────────────────────────────────────────────── */

.pt-intro { white-space: pre-line; margin: 0 0 1rem; }

.pt-display {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--pt-bg);
  border-radius: var(--pt-radius-sm);
}
.pt-display-item + .pt-display-item { margin-top: 0.625rem; }
.pt-display dt { font-weight: 600; }
.pt-display dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.pt-display ul { margin: 0; padding-left: 1.25rem; }
.pt-pairs { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0 0.75rem; }
.pt-pairs dt { font-weight: 400; color: var(--pt-muted); }

.pt-until { margin: 1.5rem 0 0; color: var(--pt-muted); font-size: 0.9375rem; }

/* ── The summary of a refused answer ────────────────────────────────────── */

.pt-summary {
  margin: 0 0 1.5rem;
  padding: 1rem 1.125rem;
  border: 3px solid var(--pt-error);
  border-radius: var(--pt-radius-sm);
  background: var(--pt-error-bg);
}
.pt-summary:focus { outline: 3px solid var(--pt-focus); }
.pt-summary h2 { font-size: 1.125rem; }
.pt-summary ul { margin: 0; padding-left: 1.25rem; }
.pt-summary a { color: var(--pt-error); font-weight: 600; }

/* ── Fields ─────────────────────────────────────────────────────────────── */

.pt-form { margin: 0; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.pt-field { margin: 0 0 1.5rem; }

.pt-label, .pt-legend {
  display: block;
  font-weight: 600;
  margin: 0 0 0.25rem;
  padding: 0;
}

.pt-opt { font-weight: 400; color: var(--pt-muted); }

.pt-help, .pt-when, .pt-guidance {
  margin: 0 0 0.375rem;
  color: var(--pt-muted);
  font-size: 0.9375rem;
}
.pt-when { font-style: italic; }
.pt-guidance { padding-left: 0.625rem; border-left: 3px solid var(--pt-line-strong); }

/* With the runtime, a field a `when` hides is hidden, so its words are not
   needed. */
html[data-pt-runtime] [data-pt-when-note] { display: none; }

.pt-error {
  margin: 0 0 0.375rem;
  color: var(--pt-error);
  font-weight: 600;
}

/* A field with a problem says so down its side as well as in words. */
.pt-field:has(> .pt-error:not([hidden])),
.pt-field:has(> label > [aria-invalid="true"]) {
  padding-left: 0.875rem;
  border-left: 4px solid var(--pt-error);
}

.pt-input {
  display: block;
  width: 100%;
  min-height: var(--pt-target);
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: inherit;
  background: var(--pt-field);
  border: 2px solid var(--pt-line-strong);
  border-radius: var(--pt-radius-sm);
}
.pt-input:focus-visible { border-color: var(--pt-ink); }
input.pt-input[type="number"], input.pt-input[type="date"] { max-width: 14rem; }
textarea.pt-input { min-height: 8rem; resize: vertical; }
select.pt-input[multiple] { min-height: 8rem; }
.pt-input[aria-invalid="true"] { border-color: var(--pt-error); }

/* ── Choices ────────────────────────────────────────────────────────────── */

.pt-choice-list { display: grid; gap: 0.25rem; }

.pt-choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--pt-target);
  padding: 0.25rem 0;
  font-weight: 400;
  cursor: pointer;
}
.pt-choice input {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  flex: none;
  accent-color: var(--pt-accent);
}
.pt-check > .pt-choice { font-weight: 600; }

/* ── Groups and lists ───────────────────────────────────────────────────── */

.pt-group-body {
  padding: 0.75rem 0 0 0.875rem;
  border-left: 3px solid var(--pt-line);
}
.pt-group-body > .pt-field:last-child { margin-bottom: 0; }

.pt-row {
  margin: 0 0 0.75rem;
  padding: 1rem;
  background: var(--pt-bg);
  border-radius: var(--pt-radius-sm);
}
.pt-row > .pt-field:last-of-type { margin-bottom: 1rem; }
.pt-row-title { margin: 0 0 0.75rem; font-weight: 600; color: var(--pt-muted); }

/* ── Steps ──────────────────────────────────────────────────────────────── */

.pt-step + .pt-step {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pt-line);
}
/* With the runtime one step is shown at a time. */
html[data-pt-runtime] .pt-step + .pt-step { margin-top: 0; padding-top: 0; border-top: 0; }

.pt-step-title { margin: 0 0 1.25rem; }
.pt-step-title:focus { outline: none; }
.pt-step-count {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--pt-muted);
}
.pt-step-name { display: block; }

.pt-step-nav {
  display: flex;
  flex-wrap: wrap-reverse;
  gap: 0.75rem;
  margin: 1.75rem 0 0;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

button {
  font: inherit;
  min-height: var(--pt-target);
  padding: 0.5rem 1.25rem;
  border-radius: var(--pt-radius-sm);
  cursor: pointer;
}

.pt-send, .pt-next {
  background: var(--pt-accent);
  color: var(--pt-accent-ink);
  border: 2px solid var(--pt-accent);
  font-weight: 650;
  width: 100%;
}
.pt-send:hover, .pt-next:hover { background: var(--pt-accent-hover); border-color: var(--pt-accent-hover); }

.pt-send-row { margin: 1.75rem 0 0; }

/* A draft's preview (D216): it says what it is, and its Send is off. */
.pt-preview {
  margin: 0 0 1.25rem;
  padding: 0.625rem 0.875rem;
  border: 1px dashed var(--pt-line-strong);
  border-radius: var(--pt-radius-sm);
  color: var(--pt-muted);
  font-size: 0.9375rem;
}
.pt-preview strong { color: var(--pt-ink); }
.pt-send:disabled { opacity: 0.55; cursor: not-allowed; }
.pt-send:disabled:hover { background: var(--pt-accent); border-color: var(--pt-accent); }

.pt-minor {
  background: transparent;
  color: var(--pt-accent);
  border: 2px solid var(--pt-line-strong);
  font-weight: 600;
}
.pt-minor:hover { border-color: var(--pt-accent); }
.pt-back { width: 100%; }
.pt-remove { margin-top: 0.25rem; }

@media (min-width: 40rem) {
  .pt-send, .pt-next, .pt-back { width: auto; }
  .pt-step-nav { flex-wrap: nowrap; }
  .pt-step-nav .pt-next { margin-left: auto; }
}

/* A send on its way: the runtime refuses a second one. */
.pt-form[data-pt-busy] .pt-send, .pt-form[data-pt-busy] .pt-next { opacity: 0.6; cursor: progress; }

/* The form's first button, so Enter sends rather than adding a row. */
.pt-default {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  padding: 0;
  border: 0;
}

/* ── Notices ────────────────────────────────────────────────────────────── */

.pt-notice p { margin: 0 0 0.75rem; }
.pt-notice[data-notice="done"] .pt-title::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 0.375rem;
  margin: 0 0 1rem;
  border-radius: 3px;
  background: var(--pt-accent);
}

/* ── Signing in (D208) ──────────────────────────────────────────────────── */

.pt-sign-in p { margin: 0 0 1rem; }
.pt-sign-in-other { color: var(--pt-muted); }
.pt-sign-in-form { margin: 1.25rem 0 0; }
.pt-sign-in-again { margin: 1rem 0 0; }
.pt-sign-in-again .pt-minor { width: 100%; }
.pt-error-text { color: var(--pt-error); font-weight: 600; }
input.pt-code {
  max-width: 10rem;
  font-size: 1.375rem;
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 40rem) {
  .pt-sign-in-again .pt-minor { width: auto; }
}

/* ── Lists of requests (D211) ───────────────────────────────────────────── */

.pt-who-list { font-weight: 600; padding: 0.5rem 0.25rem; }

.pt-list h2 { font-size: 1.125rem; margin: 1.75rem 0 0.5rem; }
.pt-list h3 { font-size: 1rem; margin: 1.25rem 0 0.375rem; color: var(--pt-muted); }
.pt-list-about, .pt-list-paged { color: var(--pt-muted); margin: 0 0 0.75rem; }
.pt-list-empty { color: var(--pt-muted); margin: 0; }
.pt-list-note {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--pt-focus);
  background: var(--pt-bg);
  border-radius: var(--pt-radius-sm);
}
.pt-list-sign-in {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--pt-bg);
  border-radius: var(--pt-radius-sm);
}
.pt-list-sign-in p { margin: 0 0 0.75rem; }
.pt-list-sign-in .pt-minor { width: 100%; }
.pt-list-older { margin: 1.5rem 0 0; font-weight: 600; }

.pt-requests { list-style: none; margin: 0; padding: 0; }
.pt-request { padding: 0.75rem 0; border-top: 1px solid var(--pt-line); }
.pt-request:first-child { border-top: 0; }
.pt-request-title { margin: 0 0 0.25rem; font-weight: 600; overflow-wrap: anywhere; }
/* An open request's title is its link: the whole line is a target. */
.pt-request-title a { display: inline-block; padding: 0.375rem 0; }
.pt-request-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  color: var(--pt-muted);
  font-size: 0.9375rem;
}
.pt-request-org { color: var(--pt-ink); }
.pt-request-by { overflow-wrap: anywhere; }

/* A request's state, said in words and marked by its border, never by
   colour alone. */
.pt-chip {
  display: inline-block;
  padding: 0.0625rem 0.5rem;
  border: 1px solid var(--pt-line-strong);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--pt-ink);
}
.pt-chip[data-state="open"] { border-color: var(--pt-accent); color: var(--pt-accent); }
.pt-chip[data-state="expired"], .pt-chip[data-state="cancelled"] { border-style: dashed; color: var(--pt-muted); }

.pt-answer { margin: 0.5rem 0 0; }
.pt-answer summary {
  cursor: pointer;
  color: var(--pt-accent);
  font-weight: 600;
  padding: 0.5rem 0;
  min-height: var(--pt-target);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.pt-answer-lines {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--pt-bg);
  border-radius: var(--pt-radius-sm);
}
.pt-answer-line + .pt-answer-line { margin-top: 0.5rem; }
.pt-answer-line dt { font-weight: 600; }
.pt-answer-line dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.pt-answer-line[data-depth="1"] { margin-left: 1rem; }
.pt-answer-line[data-depth="2"] { margin-left: 2rem; }
.pt-answer-line[data-depth="3"] { margin-left: 3rem; }

@media (min-width: 40rem) {
  .pt-list-sign-in .pt-minor { width: auto; }
}
