/* ═══════════════════════════════════════════
   THE RECIPROCAL — Survey (/survey/)
   Mobile first. Without JavaScript every screen is shown as one long form;
   with it (html.sv-js, set by survey.js) only the active screen is visible.
   ═══════════════════════════════════════════ */

.sv { max-width: 640px; margin: 0 auto; padding: 0 var(--gutter) 64px; min-height: calc(100vh - var(--nav-h) - 60px); }

/* ── Minimal pages: the logo bar scrolls away with the page; only the
   survey's progress bar stays fixed at the top ── */
body.rc-minimal { padding-top: 0; }
.rc-minimal .rc-nav { position: static; }
/* Anything scrolled into view (a field with an error) stops below the
   progress bar, and above the fixed Back/Next bar on a phone */
html:has(body.rc-minimal) { scroll-padding-top: 84px; scroll-padding-bottom: 96px; }

/* ── Progress ── */
/* Full width, solid page colour: nothing shows through while scrolling */
.sv-progress {
  position: sticky; top: 0; z-index: 30;
  margin: 0 calc(50% - 50vw); padding: 12px max(var(--gutter), calc(50vw - 320px + var(--gutter))) 8px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.sv-progress__bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.sv-progress__fill { display: block; height: 100%; width: 0; background: var(--gold-dark); transition: width .3s ease; }
.sv-progress__text { margin-top: 6px; font-size: .95rem; color: var(--muted); }

/* ── Screens ── */
.sv-step { padding: 22px 0 8px; }
.sv-step + .sv-step { border-top: 1px solid var(--line); }   /* no-JS: one long page */
.sv-js .sv-step { display: none; border-top: 0; }
.sv-js .sv-step.is-active { display: block; animation: sv-in .22s ease; }
@keyframes sv-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sv-js .sv-step.is-active { animation: none; } }

.sv-focus:focus { outline: none; }
.sv-focus:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 4px; }

/* No-JS: hide what only the script uses, and the endings (rendered as pages) */
.sv-progress, .sv-nav, .sv-start, .sv-kbd, .sv-card__key, .sv-step.sv-end { display: none; }
.sv-js .sv-progress:not([hidden]) { display: block; }
.sv-js .sv-nav { display: flex; }
.sv-js .sv-start { display: inline-flex; }
.sv-js .sv-nojs { display: none; }
.sv-js .sv-step.sv-end.is-active { display: block; }
/* No-JS: one submit at the bottom of the contact screen */
.sv-contact .sv-nav { display: flex; }
.sv-contact .sv-back { visibility: hidden; }
.sv-js .sv-contact .sv-back { visibility: visible; }

/* ── Intro ── */
.sv-intro h1 { font-size: clamp(2.2rem, 9vw, 3.2rem); line-height: 1.05; margin-bottom: 14px; }
.sv-intro__meta {
  display: inline-block; margin-bottom: 20px; padding: 4px 12px; border: 1px solid var(--gold-dark); border-radius: 3px;
  font-weight: 600; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dark);
}
.sv-intro p { font-weight: 300; margin-bottom: 14px; }
.sv-intro__sign { margin-top: 20px; }
.sv-intro__sign strong { font-weight: 600; color: var(--green); }
.sv-start { margin: 12px 0 18px; width: 100%; }
.sv-nojs { margin-top: 24px; padding: 16px 18px; background: var(--cream); border-left: 3px solid var(--gold); }
.sv-nojs h2 { font-size: 1.4rem; margin-bottom: 6px; }

/* ── Question ── */
.sv-q { font-size: clamp(1.6rem, 6.2vw, 2rem); line-height: 1.15; margin-bottom: 6px; }
.sv-q__num { color: var(--gold-dark); }
.sv-hint { font-weight: 300; color: var(--muted); margin-bottom: 4px; }
.sv-count { font-weight: 600; color: var(--green); }
.sv-step .rc-eyebrow { margin-bottom: 10px; }
.sv-options { margin-top: 14px; }

/* ── Option cards ── */
.sv-card {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 8px 44px 8px 14px; margin-bottom: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; line-height: 1.35; transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.sv-card:hover { border-color: var(--gold-dark); }
/* The input stays in the DOM for keyboard and screen readers, but invisible */
.sv-card input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sv-card:has(input:focus-visible) { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
.sv-card:has(input:checked) { border-color: var(--green); background: var(--cream); box-shadow: inset 0 0 0 1px var(--green); }
.sv-card:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.sv-card:has(input:disabled):hover { border-color: var(--line); }
.sv-card__label { font-size: 1.02rem; line-height: 1.3; color: var(--ink); }

/* Tick: circle for one choice, square for several */
.sv-card__tick {
  position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  border: 1.5px solid var(--line); border-radius: 50%; background: var(--white);
}
.sv-card:has(input[type="checkbox"]) .sv-card__tick { border-radius: 3px; }
.sv-card:has(input:checked) .sv-card__tick { border-color: var(--green); background: var(--green); }
.sv-card:has(input:checked) .sv-card__tick::after {
  content: ''; position: absolute; left: 5.5px; top: 2px; width: 6px; height: 10px;
  border: solid var(--cream); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Number key, only where there is a keyboard to press it */
@media (hover: hover) and (pointer: fine) {
  .sv-js .sv-card__key:not(:empty) {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 3px;
    font-weight: 600; font-size: .85rem; color: var(--muted);
  }
  .sv-js .sv-kbd { display: block; text-align: center; margin-top: 24px; }
}

/* "Other" text field: always visible without JS, only when chosen with it */
.sv-other { margin: -2px 0 10px; }
.sv-js .sv-other { display: none; }
.sv-js .sv-other.is-open { display: block; }

/* ── Inputs ── */
.sv-input {
  display: block; width: 100%; margin-top: 18px; padding: 14px 16px;
  font-family: var(--font-text); font-size: 1.15rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: 4px;
}
.sv-other .sv-input, .sv-other input { margin-top: 0; }
.sv-other input { display: block; width: 100%; padding: 14px 16px; font-family: var(--font-text); font-size: 1.1rem;
  background: var(--white); border: 1px solid var(--line); border-radius: 4px; }
textarea.sv-input { resize: vertical; min-height: 140px; line-height: 1.5; }
select.sv-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
.sv-input:focus, .sv-other input:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 3px var(--cream); }
.sv-input[aria-invalid="true"] { border-color: var(--error); }

/* ── Contact screen ── */
.sv-field { margin-top: 18px; }
.sv-field label {
  display: block; font-weight: 600; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--green);
}
.sv-field .sv-input { margin-top: 6px; }
.sv-consents { margin-top: 24px; }
.sv-card--check .sv-card__label { font-size: 1.05rem; }

/* ── Errors, small print ── */
.sv-error { min-height: 0; margin-top: 8px; font-weight: 600; color: var(--error); }
.sv-error:empty { display: none; }
.sv-alert { margin-top: 20px; padding: 14px 18px; border-left: 3px solid var(--error); background: var(--cream); font-weight: 600; color: var(--error); }
.sv-small { font-size: .95rem; font-weight: 300; color: var(--muted); }
.sv-small a { color: var(--green); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--gold); }

/* ── Back / Next ── */
.sv-nav { justify-content: space-between; align-items: center; gap: 16px; margin-top: 26px; }
.sv-back {
  background: none; border: 0; padding: 12px 4px; cursor: pointer;
  font-family: var(--font-text); font-weight: 600; font-size: .95rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.sv-back:hover { color: var(--green); }
.sv-next, .sv-submit { min-width: 140px; }
.sv-form.is-busy .sv-next, .sv-form.is-busy .sv-submit { opacity: .6; pointer-events: none; }

/* ── Section intro ── */
.sv-section-intro h2 { font-size: clamp(1.9rem, 7vw, 2.5rem); margin-bottom: 14px; }
.sv-section-intro__body p { font-weight: 300; margin-bottom: 12px; }
.sv-section-intro__body ul { margin: 0 0 14px 1.2em; font-weight: 300; }
.sv-section-intro__body li { margin-bottom: 6px; }
.sv-section-intro__body li::marker { color: var(--gold-dark); }

/* ── Endings ── */
.sv-end { text-align: center; padding-top: 56px; }
.sv-end img { margin: 0 auto 24px; }
.sv-end h1, .sv-end h2 { font-size: clamp(2rem, 8vw, 2.8rem); margin-bottom: 14px; }
.sv-end p { font-weight: 300; margin-bottom: 14px; }
.sv-end .btn { margin-top: 14px; }

@media (max-width: 420px) {
  .sv-next, .sv-submit { flex: 1; }
}

/* Next is always shown, and disabled until a required question is answered
   (survey.js). Choosing never moves on by itself. */
.sv-next:disabled { opacity: .4; cursor: not-allowed; }
.sv-next:disabled:hover { background: var(--green); border-color: var(--green); }

/* "Start over": small, under the progress text */
.sv-progress__text { display: inline-block; }
.sv-restart {
  float: right; margin-top: 6px; padding: 2px 0; background: none; border: 0; cursor: pointer;
  font-family: var(--font-text); font-size: .9rem; color: var(--muted);
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px;
}
.sv-restart:hover { color: var(--green); text-decoration-color: var(--gold); }

/* ── Many options on a wide screen: two columns, filled top to bottom, so
   the number keys still run in reading order (DOM order is unchanged) ── */
@media (min-width: 900px) {
  .sv:has(.sv-step.is-active .sv-options--cols) { max-width: 860px; }
  .sv-options--cols { display: grid; grid-auto-flow: column; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .sv-options--cols.sv-rows-4 { grid-template-rows: repeat(4, auto); }
  .sv-options--cols.sv-rows-5 { grid-template-rows: repeat(5, auto); }
  .sv-options--cols.sv-rows-6 { grid-template-rows: repeat(6, auto); }
  .sv:has(.sv-step.is-active .sv-options--cols) .sv-progress { padding-left: max(var(--gutter), calc(50vw - 430px + var(--gutter))); padding-right: max(var(--gutter), calc(50vw - 430px + var(--gutter))); }
}

/* ── Phone: Back/Next fixed at the bottom on every question and on the
   contact screen ── */
@media (max-width: 600px) {
  .sv-js .sv-step.is-active:is(.sv-question, .sv-contact) .sv-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: var(--paper); border-top: 1px solid var(--line);
  }
  /* Room below the last card (and the footer) so nothing hides behind it */
  body:has(.sv-step.is-active:is(.sv-question, .sv-contact)) {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

/* "Other" text field: a visible label, so the field also makes sense
   without JavaScript, where it is always shown */
.sv-other__label { display: block; margin: 2px 0 6px; font-size: .95rem; font-weight: 600; color: var(--green); }
.sv-intro__meta { margin: 10px 0 0; }
.sv-start { margin-top: 12px; }
