/* Damp and mould letter — /damp-mould-letter/ (page-damp-letter.php only)
   Uses theme variables from global.css — no standalone values, no radius, no !important.
   Colours follow the mode: dark by default, light under html[data-theme="light"].
   ═══════════════════════════════════════════════ */

/* ── Layout: form, then the letter; side by side on wide screens ── */
.content > .gr-dl-intro + .gr-dl { margin-top: 28px; }
.gr-dl { display: grid; gap: 40px; align-items: start; }
@media (min-width: 1024px) {
  .gr-dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
  /* The letter stays in view while the form is filled in (clears the 68px sticky nav). */
  .gr-dl__output { position: sticky; top: 92px; max-height: calc(100vh - 112px); overflow-y: auto; }
}

/* ── Form ── */
.gr-dl__form { border-top: 3px solid var(--brand-ink); }
.gr-dl__group { border: 0; border-bottom: 1px solid var(--border); padding: 24px 0 26px; min-width: 0; }
.gr-dl__legend {
  float: left; width: 100%; padding: 0; margin: 0 0 14px;
  font-family: var(--serif); font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; color: var(--white);
}
.gr-dl__legend + * { clear: both; }
.gr-dl__opt-tag { font-family: var(--body); font-size: 0.85rem; font-weight: 400; letter-spacing: 0; color: var(--muted); }

.gr-dl__field { display: flex; flex-direction: column; gap: 6px; }
.gr-dl__field + .gr-dl__field, .gr-dl__opts + .gr-dl__field { margin-top: 18px; }
.gr-dl__field label { font-size: 0.95rem; font-weight: 600; color: var(--white); }
.gr-dl__field input,
.gr-dl__field textarea {
  width: 100%; padding: 12px 14px;
  background: var(--bg); border: 1px solid rgba(var(--ink-rgb),0.4); border-radius: 0;
  color: var(--white); font-family: inherit; font-size: 1rem; line-height: 1.5; /* ≥16px: prevents iOS focus-zoom */
  appearance: none; -webkit-appearance: none;
  transition: border-color 0.2s;
}
.gr-dl__field textarea { resize: vertical; min-height: 88px; }
.gr-dl__field input:focus,
.gr-dl__field textarea:focus { border-color: var(--brand-ink); }
.content .gr-dl__hint, .gr-dl__hint { font-size: 0.85rem; color: var(--muted); margin: 0; }
.gr-dl__opts + .gr-dl__hint { margin-top: 10px; }

/* Choice cards: the padding sits on the label, so the whole card is the click target. */
.gr-dl__opts { display: grid; gap: 8px; }
.gr-dl__opts--2 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gr-dl__opt {
  display: flex; align-items: flex-start; gap: 12px; min-height: 48px;
  padding: 13px 16px; cursor: pointer;
  border: 1px solid rgba(var(--ink-rgb),0.22); color: var(--white);
  font-size: 0.95rem; font-weight: 600; line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
}
.gr-dl__opt:hover { border-color: var(--border-hi); }
.gr-dl__opt:has(input:checked) { border-color: var(--brand-ink); background: var(--bg3); }
.gr-dl__opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.gr-dl__opt input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand-ink); }

/* ── Letter panel ── */
.gr-dl__output { border-top: 3px solid var(--brand-ink); padding-top: 22px; }
.gr-dl__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.content .gr-dl__title, .gr-dl__title { margin: 0; font-size: 1.5rem; }
.gr-dl__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.content .gr-dl__status, .gr-dl__status { flex-basis: 100%; min-height: 1.5em; margin: 0; font-size: 0.9rem; font-weight: 600; color: var(--accent); }

.content .gr-dl__missing, .gr-dl__missing,
.content .gr-dl__nation, .gr-dl__nation {
  margin: 12px 0 0; padding: 12px 16px; border: 1px solid var(--border-hi);
  font-size: 0.9rem; color: var(--white);
}
.content .gr-dl__missing, .gr-dl__missing { color: var(--muted); }

.gr-dl__letter {
  margin-top: 16px; padding: 28px 26px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere;
}
.content .gr-dl__letter p, .gr-dl__letter p { margin: 0 0 14px; color: var(--white); }
.content .gr-dl__letter p:last-child, .gr-dl__letter p:last-child { margin-bottom: 0; }
.content .gr-dl__letter ul, .gr-dl__letter ul { margin: 0 0 14px; padding-left: 20px; color: var(--white); }
.content .gr-dl__letter li, .gr-dl__letter li { margin-bottom: 4px; }
.gr-dl__lines { white-space: pre-line; }
.content .gr-dl__subject, .gr-dl__subject { font-weight: 700; }
.content .gr-dl__letter p.gr-dl__placeholder, .gr-dl__letter p.gr-dl__placeholder { color: var(--muted); }
@media (max-width: 600px) {
  .gr-dl__letter { padding: 20px 18px; }
}

/* Off-screen textarea for the copy fallback in older browsers. */
.gr-dl__clip { position: fixed; top: 0; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ── What happens next ── */
.content .gr-dl-next__list, .gr-dl-next__list { margin: 0; padding-left: 20px; }
.content .gr-dl-next__list li, .gr-dl-next__list li { margin-bottom: 10px; }
.content .gr-dl-next__more, .gr-dl-next__more { margin: 14px 0 0; font-weight: 600; }

/* ── Print: the letter only, dark ink on plain paper in either mode ── */
@media print {
  @page { margin: 20mm; }
  body { background: none; }
  body > *:not(main),
  .content > *:not(.gr-dl),
  .gr-dl > *:not(.gr-dl__output),
  .gr-dl__head, .gr-dl__missing, .gr-dl__nation { display: none; }
  .content { padding: 0; }
  .gr-dl { display: block; }
  .gr-dl__output { position: static; max-height: none; overflow: visible; border: 0; padding: 0; }
  .gr-dl__letter { margin: 0; padding: 0; background: none; border: 0; font-size: 11.5pt; }
  /* --on-lime is the theme's dark ink in both modes. */
  .content .gr-dl__letter p, .content .gr-dl__letter ul, .gr-dl__letter p, .gr-dl__letter ul { color: var(--on-lime); }
  .gr-dl__letter li { break-inside: avoid; }
}
