/* ============================================================
   Survey form — extends story.css.

   Same editorial dark palette as the rest of the site, but this is
   the one page on it that people TYPE into, so the priorities are
   different: large hit targets, obvious focus rings, and a visible
   answered/unanswered state so nobody has to hunt for what they
   missed.
   ============================================================ */

[data-story="survey"] {
  --accent: #3f9d8f;
  --accent-2: #7fd4c4;
  --accent-dim: rgba(63, 157, 143, .14);
  /* Caption tone. --ink-3/--ink-4 measure ~3.5:1 and ~2.1:1 here, which fails
     WCAG AA for small text — and on a form the small text is the instructions. */
  --ink-cap: #968f85;
}

/* ---------- Header ---------- */
.sv-head {
  padding: 16vh 0 7vh; position: relative; overflow: hidden;
}
.sv-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(55% 45% at 12% 8%, var(--accent-dim), transparent 70%),
    radial-gradient(45% 40% at 90% 75%, rgba(184, 137, 43, .09), transparent 70%);
}
.sv-head .standfirst { max-width: 37rem; }

.sv-facts {
  display: flex; flex-wrap: wrap; gap: 10px 30px; margin: 34px 0 26px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.3px;
  text-transform: uppercase; color: var(--ink-cap);
}
.sv-facts b {
  display: block; font-family: var(--serif); font-size: 1.7rem;
  font-weight: 600; letter-spacing: -.03em; color: var(--accent-2);
  text-transform: none; margin-bottom: 2px;
  font-variant-numeric: lining-nums;
}
.sv-privacy {
  max-width: 37rem; font-size: .92rem; line-height: 1.62; color: var(--ink-2);
  padding: 16px 18px; border-left: 2px solid var(--line);
  background: rgba(244, 241, 236, .022);
}

/* ---------- Sticky progress rail ---------- */
.sv-rail {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 11, 12, .93);
  backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--line-2);
  padding: 11px 0;
}
.sv-rail-inner {
  display: flex; align-items: center; gap: 18px;
}
.sv-bar {
  flex: 1; height: 3px; background: rgba(244, 241, 236, .07);
  border-radius: 2px; overflow: hidden;
}
.sv-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease;
}
.sv-rail-txt {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--ink-cap); white-space: nowrap;
}
.sv-rail-txt b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Sections ---------- */
.sv-section { padding: 7vh 0; border-top: 1px solid var(--line-2); }
.sv-section:first-of-type { border-top: none; }

.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; margin-bottom: 8px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line-2);
}
.sec-label {
  font-family: var(--serif); font-size: clamp(1.4rem, 3.2vw, 2.05rem);
  font-weight: 600; letter-spacing: -.026em; color: var(--ink);
}
.sec-count {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--ink-cap); white-space: nowrap;
}

.theme-head {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.9px;
  text-transform: uppercase; color: var(--accent-2);
  margin: 46px 0 4px; padding-top: 18px;
  border-top: 1px solid var(--line-2);
}
.theme-head:first-child { margin-top: 26px; border-top: none; padding-top: 0; }

/* ---------- One question ---------- */
.q {
  border: none; margin: 0; padding: 30px 0;
  border-bottom: 1px solid var(--line-2);
}
.q:last-child { border-bottom: none; }

.q-head { display: flex; gap: 14px; align-items: baseline; }
.q-num {
  font-family: var(--mono); font-size: 11px; letter-spacing: .5px;
  color: var(--ink-4); padding-top: 4px;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.q-text {
  font-family: var(--serif); font-size: 1.19rem; font-weight: 600;
  line-height: 1.34; letter-spacing: -.015em; margin: 0;
  color: var(--ink); text-wrap: pretty;
}
.q-req, .q-opt {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 1.2px;
  text-transform: uppercase; margin-left: 9px; padding: 2px 6px;
  border-radius: 2px; vertical-align: 2px; font-weight: 500;
  white-space: nowrap;
}
.q-req { color: #f0b0a0; background: rgba(200, 86, 63, .16); }
.q-opt { color: var(--ink-cap); background: rgba(244, 241, 236, .05); }

.q-hint, .q-note {
  margin: 9px 0 0 33px; font-size: .845rem; line-height: 1.55;
  color: var(--ink-cap);
}
.q-note {
  font-style: italic; padding-left: 11px;
  border-left: 2px solid var(--line-2); color: var(--ink-2);
}

/* ---------- Options ---------- */
.opts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 2px; margin: 18px 0 0 33px;
}
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px; cursor: pointer;
  background: rgba(244, 241, 236, .022);
  border: 1px solid transparent;
  transition: background .16s, border-color .16s;
}
.opt:hover { background: rgba(244, 241, 236, .05); }

/* The native input stays in the DOM and focusable — only visually replaced, so
   keyboard and screen-reader behaviour is the browser's, not a reimplementation. */
.opt input {
  position: absolute; opacity: 0; width: 1px; height: 1px;
  margin: 0; pointer-events: none;
}
.opt-box {
  width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid var(--ink-4); background: transparent;
  transition: border-color .16s, background .16s;
  position: relative;
}
.opt input[type="radio"] + .opt-box { border-radius: 50%; }
.opt input[type="checkbox"] + .opt-box { border-radius: 3px; }

.opt input:checked + .opt-box {
  border-color: var(--accent-2); background: var(--accent);
}
.opt input:checked + .opt-box::after {
  content: ""; position: absolute; inset: 0;
  background-repeat: no-repeat; background-position: center;
  /* Check mark drawn in CSS so no icon font or SVG request is needed. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%230b0b0c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.4l3 3 6-6.4'/%3E%3C/svg%3E");
}
.opt input[type="radio"]:checked + .opt-box::after {
  background-image: none;
  inset: 3.5px; border-radius: 50%; background: #0b0b0c;
}

/* Focus must be unmistakable: this is the only page where people tab through
   dozens of controls in sequence. */
.opt input:focus-visible + .opt-box {
  outline: 2px solid var(--accent-2); outline-offset: 3px;
}
.opt:has(input:focus-visible) {
  background: rgba(63, 157, 143, .09); border-color: var(--accent);
}
.opt:has(input:checked) {
  background: rgba(63, 157, 143, .07); border-color: rgba(63, 157, 143, .35);
}
.opt-text { font-size: .935rem; line-height: 1.45; color: var(--ink-2); }
.opt:has(input:checked) .opt-text { color: var(--ink); }

/* ---------- Text inputs ---------- */
.q-input {
  display: block; width: 100%; max-width: 34rem; margin: 18px 0 0 33px;
  padding: 13px 15px; font: 400 .95rem var(--sans); color: var(--ink);
  background: rgba(244, 241, 236, .03);
  border: 1px solid var(--line); border-radius: 2px;
  transition: border-color .16s, background .16s;
}
.q-input::placeholder { color: var(--ink-4); }
.q-input:focus {
  outline: none; border-color: var(--accent-2);
  background: rgba(63, 157, 143, .06);
}
.q-other { max-width: 30rem; margin-top: 10px; }

/* ---------- Validation ---------- */
.q-error {
  margin: 12px 0 0 33px; font-size: .855rem; color: #f0b0a0;
  font-weight: 500;
}
.q.invalid { background: rgba(200, 86, 63, .045); }
.q.invalid .opt-box { border-color: #c8563f; }

/* Answered questions get a quiet marker, so scanning for gaps is easy. */
.q.answered .q-num { color: var(--accent-2); }
.q.answered .q-num::after { content: " ✓"; }

/* ---------- Submit ---------- */
.sv-submit {
  padding: 9vh 0 11vh; border-top: 1px solid var(--line-2);
  background: rgba(244, 241, 236, .018);
}
.sv-submit-inner {
  display: grid; grid-template-columns: 1fr auto; gap: 36px;
  align-items: center;
}
.sv-submit-h {
  font-family: var(--serif); font-size: clamp(1.5rem, 3.6vw, 2.3rem);
  font-weight: 600; letter-spacing: -.026em; margin: 0 0 12px;
}
.sv-submit-p {
  color: var(--ink-2); max-width: 40rem; margin: 0;
  font-size: .97rem; line-height: 1.6;
}
.sv-submit-p b { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .sv-submit-inner { grid-template-columns: 1fr; }
  .sec-head { flex-direction: column; gap: 6px; }
  .opts, .q-input, .q-hint, .q-note, .q-error { margin-left: 0; }
}

#svSubmit[disabled] { opacity: .55; cursor: progress; }

/* ---------- Status messages ---------- */
.sv-status {
  margin-top: 30px; padding: 20px 22px; border-radius: 2px;
  font-size: .95rem; line-height: 1.6;
  border: 1px solid var(--line); border-left-width: 2px;
}
.sv-status b { font-weight: 600; }
.sv-status.err {
  border-left-color: #c8563f; background: rgba(200, 86, 63, .07);
  color: #f0c4b8;
}
.sv-status.ok {
  border-left-color: var(--accent); background: rgba(63, 157, 143, .08);
  color: #b8e6dc;
}
.sv-status a { color: var(--accent-2); }
.sv-status .retry {
  display: inline-block; margin-top: 14px; padding: 9px 16px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.3px;
  text-transform: uppercase; color: var(--ink);
  border: 1px solid var(--line); background: transparent; cursor: pointer;
}
.sv-status .retry:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* ---------- Thank-you state ---------- */
.sv-done { padding: 18vh 0; text-align: left; }
.sv-done h2 {
  font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600; letter-spacing: -.03em; margin: 0 0 20px;
}
.sv-done p { color: var(--ink-2); max-width: 38rem; font-size: 1.03rem; line-height: 1.68; }
.sv-done-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px; }

.foot-simple {
  padding: 5vh 0 8vh; border-top: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 11px; letter-spacing: .8px;
  color: var(--ink-cap);
}
.foot-simple .wrap { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.foot-simple a { color: var(--ink-2); text-decoration: none; }
.foot-simple a:hover { color: var(--ink); }
