/* ============================================================
   READINESS DIAGNOSTICS — shared look for the scored diagnostics
   (readiness-diagnostic.js). Loaded after each page's own styles;
   uses the page's colour tokens (--dark-green, --gold-dark, ...).
   ============================================================ */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Intro: quick facts and how it works ---------- */
.rd-facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; list-style: none; margin: 1.6rem 0 0; padding: 0; font-size: 0.86rem; font-weight: 500; color: var(--text-muted); }
.rd-facts li { display: inline-flex; align-items: center; gap: 0.5rem; }
.rd-facts li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-dark); opacity: 0.8; }
.rd-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; list-style: none; margin: 0 0 2.4rem; padding: 0; counter-reset: rd-step; }
.rd-steps li {
  counter-increment: rd-step; position: relative; padding: 1.2rem 1.2rem 1.1rem 3.4rem;
  border: 1px solid rgba(145, 117, 81, 0.18); border-radius: 14px; background: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem; line-height: 1.5; color: var(--dark-green);
}
.rd-steps li::before {
  content: counter(rd-step); position: absolute; left: 1.1rem; top: 1.05rem; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-family: 'Playfair Display', serif; font-style: italic; font-size: 0.95rem;
  color: var(--gold-dark); border: 1px solid rgba(145, 117, 81, 0.45);
}
.rd-steps strong { display: block; font-weight: 600; margin-bottom: 0.15rem; }
.rd-steps span { color: var(--text-muted); font-size: 0.84rem; }

/* ---------- Draft banner (diagnostics awaiting the client's approval) ---------- */
.rd-draft {
  max-width: 900px; margin: 1rem auto 0; padding: 0.8rem 1.1rem; border-radius: 10px;
  background: rgba(124, 64, 72, 0.08); border: 1px dashed rgba(124, 64, 72, 0.45);
  color: #7C4048; font-size: 0.86rem; line-height: 1.5;
}

/* ---------- Progress, kept in view while answering ----------
   The page frame's overflow: hidden would stop it sticking; clip trims
   to the frame the same way without that side effect. */
@supports (overflow: clip) {
  .site-frame { overflow: clip; }
  /* Phones: the page's html/body overflow-x: hidden would do the same. */
  html, body { overflow-x: clip !important; }
}
.rd-progress {
  position: sticky; top: var(--rd-sticky-top, 92px); z-index: 5;
  display: flex; align-items: center; gap: 1rem; margin: 0 0 1.2rem; padding: 0.75rem 1.1rem;
  border-radius: 999px; background: rgba(250, 249, 246, 0.94); border: 1px solid rgba(145, 117, 81, 0.2);
  box-shadow: 0 10px 24px -18px rgba(12, 30, 20, 0.4);
}
.rd-progress-track { flex: 1; height: 4px; border-radius: 4px; background: rgba(145, 117, 81, 0.18); overflow: hidden; }
.rd-progress-track span { display: block; height: 100%; background: var(--gold-dark); transform-origin: left center; transform: scaleX(0); transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1); }
.rd-progress-text { flex-shrink: 0; font-size: 0.82rem; font-weight: 600; color: var(--dark-green); min-width: 7.5em; text-align: right; }
.rd-form.is-complete .rd-progress-track span { background: var(--dark-green); }

/* ---------- Questions ----------
   The card is drawn on the list item: a fieldset's border would run
   through its legend. */
.rd-questions { list-style: none; display: grid; gap: 1rem; margin: 0 0 1.8rem; padding: 0; }
.rd-q {
  border: 1px solid rgba(145, 117, 81, 0.16); border-radius: 14px; background: #ffffff;
  padding: 1.4rem 1.5rem 1.3rem; box-shadow: 0 4px 10px rgba(20, 46, 31, 0.04);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.rd-q fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.rd-q.is-answered { border-color: rgba(145, 117, 81, 0.36); }
.rd-q.is-missing { border-color: #9a4a4a; box-shadow: 0 0 0 3px rgba(154, 74, 74, 0.12); }
.rd-q legend { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0; margin-bottom: 1rem; width: 100%; }
.rd-q-num { font-family: 'Playfair Display', serif; font-style: italic; color: var(--gold-dark); font-size: 1.05rem; flex-shrink: 0; line-height: 1.6; }
.rd-q-body { display: flex; flex-direction: column; gap: 0.25rem; }
.rd-q-area { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-dark); }
.rd-q-text { font-size: 0.98rem; line-height: 1.6; color: var(--dark-green); font-weight: 500; }
.rd-tag-critical {
  display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: #7C4048; background: rgba(124, 64, 72, 0.1);
}
.rd-options { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-left: 2rem; }
.rd-option { position: relative; cursor: pointer; }
.rd-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rd-option span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0.5rem 1.05rem;
  border: 1px solid rgba(12, 30, 20, 0.18); border-radius: 999px; font-size: 0.86rem; color: var(--dark-green);
  background: rgba(255, 255, 255, 0.6); transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.rd-option input:checked + span { background: var(--dark-green); border-color: var(--dark-green); color: #FAF9F6; }
.rd-option--partly input:checked + span { background: #8A6A3E; border-color: #8A6A3E; }
.rd-option--gap input:checked + span { background: #7C4048; border-color: #7C4048; }
.rd-option input:focus-visible + span { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .rd-option:hover input:not(:checked) + span { border-color: var(--gold-dark); background: rgba(229, 198, 151, 0.18); }
}
.rd-submit-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 1rem; }
.rd-submit-row .btn-primary, .rd-actions .btn-primary { border: 0; cursor: pointer; font-family: inherit; }
.rd-error { display: none; margin-top: 0.9rem; color: #9a4a4a; font-size: 0.9rem; font-weight: 600; text-align: right; }
.rd-error.is-shown { display: block; }

/* ---------- Result ---------- */
.rd-result {
  margin-top: 2.6rem; padding: 2.4rem 2.2rem 2.2rem; border-radius: 20px;
  background: #ffffff; border: 1px solid rgba(145, 117, 81, 0.22); box-shadow: 0 30px 60px -42px rgba(12, 30, 20, 0.45);
}
.rd-result:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) {
  .rd-result.is-shown { animation: rd-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  .rd-result.is-shown #js-rd-dial-value { transition: stroke-dashoffset 1200ms cubic-bezier(0.16, 1, 0.3, 1) 200ms; }
}
@keyframes rd-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.rd-result-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2.2rem; align-items: center; margin-bottom: 1.8rem; }
.rd-dial { position: relative; width: 168px; height: 168px; }
.rd-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rd-dial circle { fill: none; stroke-width: 9; }
.rd-dial-track { stroke: rgba(145, 117, 81, 0.16); }
#js-rd-dial-value { stroke: var(--gold-dark); stroke-linecap: round; }
.rd-dial-text { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 58px; font-family: 'Playfair Display', serif; color: var(--dark-green); }
.rd-dial-text #js-rd-total { font-size: 3.2rem; line-height: 1; }
.rd-dial-text small { font-size: 1.05rem; color: var(--gold-dark); margin-left: 0.25rem; }
.rd-band { font-family: 'Playfair Display', serif; font-weight: 400; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.25; color: var(--dark-green); margin: 0.5rem 0 1rem; }
.rd-scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; list-style: none; margin: 0; padding: 0; }
.rd-scale li { padding-top: 0.55rem; border-top: 3px solid rgba(145, 117, 81, 0.18); font-size: 0.72rem; line-height: 1.35; color: var(--text-muted); }
.rd-scale li.is-current { border-top-color: var(--gold-dark); color: var(--dark-green); }
.rd-scale-range { display: block; font-weight: 700; letter-spacing: 0.04em; }
.rd-scale li.is-current .rd-scale-range { color: var(--gold-dark); }

.rd-warning { margin: 0 0 1.8rem; }
.rd-warning ul { margin: 0.6rem 0 0 1.1rem; font-size: 0.92rem; color: var(--dark-green); line-height: 1.7; }

.rd-columns { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 2rem; margin-bottom: 2rem; text-align: left; }
.rd-columns h3 { font-family: 'Playfair Display', serif; font-weight: 400; font-size: 1.2rem; color: var(--dark-green); margin-bottom: 0.9rem; }
.rd-areas { list-style: none; margin: 0; padding: 0; }
.rd-area { display: grid; grid-template-columns: minmax(0, 1fr) 52px 6.4em; align-items: center; gap: 0.7rem; padding: 0.55rem 0; border-bottom: 1px solid rgba(145, 117, 81, 0.12); font-size: 0.86rem; color: var(--dark-green); }
.rd-area-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.rd-area-meter { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.rd-area-meter i { height: 6px; border-radius: 3px; background: rgba(145, 117, 81, 0.16); }
.rd-area--in-place .rd-area-meter i { background: var(--dark-green); }
.rd-area--partly .rd-area-meter i:first-child { background: #8A6A3E; }
.rd-area-status { font-size: 0.76rem; font-weight: 600; text-align: right; color: var(--text-muted); }
.rd-area--gap .rd-area-status { color: #7C4048; }
.rd-area--in-place .rd-area-status { color: var(--dark-green); }

.rd-priorities { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.rd-priority { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 0.8rem; padding: 0.95rem 1rem; border-radius: 12px; background: rgba(250, 249, 246, 0.9); border: 1px solid rgba(145, 117, 81, 0.14); }
.rd-priority.is-critical { border-color: rgba(124, 64, 72, 0.35); background: rgba(124, 64, 72, 0.04); }
.rd-priority-rank { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: 'Playfair Display', serif; font-style: italic; color: var(--gold-dark); border: 1px solid rgba(145, 117, 81, 0.4); }
.rd-priority-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--dark-green); margin-bottom: 0.3rem; }
.rd-priority-tag { font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.12rem 0.5rem; border-radius: 999px; background: rgba(145, 117, 81, 0.14); color: var(--gold-dark); }
.rd-priority.is-critical .rd-priority-tag { background: rgba(124, 64, 72, 0.12); color: #7C4048; }
.rd-priority-text { font-size: 0.86rem; line-height: 1.6; color: var(--text-muted); }
.rd-priority-none { font-size: 0.92rem; color: var(--dark-green); }

.rd-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem; padding-top: 1.6rem; border-top: 1px solid rgba(145, 117, 81, 0.16); margin-bottom: 1rem; }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; padding: 1rem 1.6rem;
  border: 1px solid var(--dark-green); color: var(--dark-green); border-radius: 2px; text-decoration: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; transition: all 0.3s ease; text-align: center;
}
.btn-outline:hover { background: var(--dark-green); color: #FAF9F6; }
.btn-outline:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 3px; }
.rd-restart { display: block; margin: 0 auto; background: none; border: 0; color: var(--gold-dark); font: inherit; font-size: 0.86rem; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.rd-disclaimer { margin-top: 2rem; font-size: 0.86rem; line-height: 1.7; color: var(--text-muted); border-top: 1px solid rgba(145, 117, 81, 0.18); padding-top: 1.2rem; }

@media (max-width: 980px) { .rd-progress { --rd-sticky-top: 72px; } }
@media (max-width: 760px) {
  .rd-steps { grid-template-columns: 1fr; }
  .rd-columns { grid-template-columns: 1fr; }
  .rd-result-top { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 1.2rem; }
  .rd-scale { text-align: left; }
}
@media (max-width: 600px) {
  .rd-q { padding: 1.2rem 1.1rem 1.1rem; }
  .rd-options { padding-left: 0; }
  .rd-option, .rd-option span { width: 100%; }
  .rd-result { padding: 1.8rem 1.1rem 1.6rem; }
  .rd-scale { grid-template-columns: 1fr 1fr; row-gap: 0.7rem; }
  .rd-actions .btn-primary, .rd-actions .btn-outline, .rd-submit-row .btn-primary { width: 100%; }
  .rd-error { text-align: left; }
}

/* ---------- Download My Results: a printed / saved-as-PDF results sheet ---------- */
.rd-print { display: none; }
@media print {
  @page { margin: 15mm; }
  body { background: #fff !important; }
  body > *:not(.rd-print) { display: none !important; }
  .rd-print { display: block !important; color: #111; font: 10pt/1.5 'Montserrat', Arial, sans-serif; }
  .rd-print-head { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #917551; padding-bottom: 8px; margin-bottom: 14px; }
  .rd-print-head img { width: 34px; height: 34px; }
  .rd-print h1 { font: 400 16pt 'Playfair Display', Georgia, serif; margin: 0; }
  .rd-print h2 { font: 400 12.5pt 'Playfair Display', Georgia, serif; margin: 14px 0 6px; }
  .rd-print .rd-print-score { font: 400 24pt 'Playfair Display', Georgia, serif; margin: 4px 0; }
  .rd-print .rd-print-warning { border: 1.5px solid #917551; border-left-width: 4px; padding: 8px 10px; margin: 10px 0; }
  .rd-print table { width: 100%; border-collapse: collapse; margin-top: 6px; }
  .rd-print th, .rd-print td { text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding: 4px; font-size: 9pt; }
  .rd-print ol, .rd-print ul { list-style: revert; padding-left: 18px; margin: 4px 0; }
  .rd-print .rd-print-priorities li { margin-bottom: 4px; font-size: 9.5pt; }
  .rd-print .rd-print-foot { margin-top: 14px; font-size: 8.5pt; color: #555; }
}
