/* Caregiver support needs survey — Riverside Regional Cancer Centre
   Mobile-first. Warm off-white, deep teal, sage, sand, one amber accent.
   No reds, no emoji, no countdowns. */

:root {
  --bg: #faf6f0;
  --surface: #fffdf9;
  --card: #f5ede0;
  --field: #fdf9f2;
  --ink: #2e3b39;
  --teal: #1f5a54;
  --teal-dark: #17443f;
  --sage: #7fa396;
  --sand: #e8dcc8;
  --amber: #d89b5a;
  --muted: #4f6963;
  --footer: #f3ebde;
  --warn: #8c6239;
  --pill-line: #c3d3cc;
  --radius: 16px;
  --shadow: 0 18px 44px rgba(46, 59, 57, 0.09);
  font-family: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  font-family: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 26px 24px 0;
  gap: 18px;
}

.screen > * {
  margin: 0;
}

/* --- Brand row ----------------------------------------------------------- */

.brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-name {
  align-self: center;
  color: var(--teal);
  font-size: 15px;
  font-weight: 600;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 34%, #cfe0d5 0 32%, transparent 33%),
    radial-gradient(circle at 68% 30%, #f0dcc0 0 30%, transparent 31%),
    radial-gradient(circle at 58% 68%, #d89b5a 0 26%, transparent 27%),
    radial-gradient(circle at 26% 72%, #9fc0b2 0 26%, transparent 27%),
    #f6efe3;
}

.hands {
  width: 76px;
  height: 62px;
  display: block;
}

.progress-track {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: var(--sand);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
  transition: width 220ms ease;
}

.progress-caption {
  font-size: 13px;
  color: var(--muted);
  margin: -10px 0 0;
}

/* --- Type ---------------------------------------------------------------- */

h1 {
  font-size: clamp(25px, 6.4vw, 30px);
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

h1:focus {
  outline: none;
}

h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.step {
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  margin: 0;
}

.lede {
  margin: 0;
  color: var(--ink);
}

.small,
.note {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.prompt {
  font-weight: 600;
  margin: 0;
}

.facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.facts li {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15.5px;
}

.facts strong {
  display: block;
  color: var(--teal);
  font-weight: 600;
}

/* --- Scale legend -------------------------------------------------------- */

.scale-key {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.scale-key span:nth-child(2) {
  text-align: center;
}

/* --- Statements ---------------------------------------------------------- */

.statement {
  border: 0;
  margin: 0;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  transition: outline-color 160ms ease, box-shadow 160ms ease;
}

.statement + .statement {
  margin-top: 14px;
}

.statement.is-missing {
  box-shadow: 0 0 0 2px var(--warn);
}

.statement-legend {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 0;
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.4;
}

.q-num {
  flex: none;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.scale-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.pill {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 1.5px solid var(--pill-line);
  border-radius: 12px;
  background: var(--field);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.pill:hover {
  border-color: var(--sage);
}

.pill-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pill-num {
  font-weight: 600;
}

.pill.is-selected {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.pill-check {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 11px;
  line-height: 1;
  color: #fff;
}

.pill:has(.pill-input:focus-visible) {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.pill-input:focus-visible + .pill-num {
  text-decoration: underline;
}

/* --- Buttons and actions ------------------------------------------------- */

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.actions .btn-primary {
  flex: 1;
}

.btn-primary,
.btn-outline,
.btn-ghost {
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  border-radius: 14px;
  min-height: 56px;
  padding: 0 20px;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--teal);
  border: 1.5px solid var(--teal);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.btn-outline {
  background: var(--field);
  border: 1.5px solid var(--sage);
  color: var(--teal);
  width: 100%;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--muted);
  min-height: 48px;
  padding: 0 8px;
}

.btn-ghost:hover {
  color: var(--teal);
}

.btn-primary:focus-visible,
.btn-outline:focus-visible,
.btn-ghost:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* --- Forms --------------------------------------------------------------- */

form {
  display: grid;
  gap: 16px;
}

label {
  font-weight: 600;
  font-size: 15.5px;
}

.field {
  display: grid;
  gap: 6px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  font: inherit;
  font-size: 16px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--pill-line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
}

textarea {
  min-height: 128px;
  resize: vertical;
}

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

.form-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7ecdf;
  border: 1.5px solid var(--warn);
  color: var(--warn);
  font-size: 15px;
  font-weight: 600;
}

.form-ok {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #e8f0ec;
  border: 1.5px solid var(--sage);
  color: var(--teal);
  font-size: 15px;
  font-weight: 600;
}

.warning {
  margin: 0;
  font-size: 13.5px;
  color: var(--warn);
}

/* --- Ranking and comment ------------------------------------------------- */

.rank-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  align-items: center;
  gap: 12px;
}

.rank-row label {
  font-size: 15px;
  color: var(--muted);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--sand);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.comment-block {
  display: grid;
  gap: 8px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
}

.counter {
  margin: 0;
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

.is-declined select {
  opacity: 0.55;
}

/* --- Distress ------------------------------------------------------------ */

.distress {
  border: 0;
  margin: 0;
  padding: 0;
}

.scale-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  gap: 10px;
}

.distress-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.distress .pill {
  width: 100%;
  height: 52px;
}

/* --- Thank you / panels -------------------------------------------------- */

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
}

.panel p,
.panel ul {
  margin: 0;
}

.panel ul {
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.panel-note {
  font-size: 14px;
  color: var(--muted);
}

/* --- Footer -------------------------------------------------------------- */

.anon-footer {
  margin: auto -24px 0;
  padding: 16px 24px 20px;
  background: var(--footer);
  border-top: 1px solid var(--sand);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* --- Results ------------------------------------------------------------- */

.surface-wide {
  max-width: 860px;
}

.results-head {
  display: grid;
  gap: 6px;
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.bar-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
}

.bar-name {
  font-weight: 600;
}

.bar-value {
  font-variant-numeric: tabular-nums;
  color: var(--teal);
  font-weight: 600;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--sand);
  overflow: hidden;
  margin: 4px 0 2px;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
}

.bar-fill.is-accent {
  background: var(--amber);
}

.bar-n {
  font-size: 12.5px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--sand);
  vertical-align: top;
}

th {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: #edf3ef;
  border: 1px solid var(--sage);
  color: var(--teal);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.tag.is-quiet {
  background: transparent;
  border-color: var(--pill-line);
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar .btn-primary,
.toolbar .btn-outline {
  width: auto;
  min-height: 48px;
  font-size: 15.5px;
}

/* --- Paper form ---------------------------------------------------------- */

.paper-wrap {
  background: var(--bg);
  padding: 20px 16px 40px;
  display: grid;
  gap: 16px;
  justify-items: center;
}

.paper-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 210mm;
  justify-content: space-between;
}

.paper-sheet {
  background: #fff;
  width: 100%;
  max-width: 210mm;
  padding: 16mm 14mm;
  box-shadow: 0 10px 30px rgba(46, 59, 57, 0.12);
  font-size: 10.5pt;
  line-height: 1.4;
  color: #1d1d1b;
}

.paper-sheet h1 {
  font-size: 20pt;
  margin: 4px 0 8px;
}

.paper-head p {
  margin: 0 0 10px;
}

.paper-eyebrow {
  font-size: 9pt;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #44544f;
}

.paper-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 8px 0;
  border-top: 1px solid #cfc6b6;
  border-bottom: 1px solid #cfc6b6;
  font-size: 10pt;
}

.paper-table {
  margin-top: 12px;
  font-size: 9.6pt;
}

.paper-table th,
.paper-table td {
  border-bottom: 1px solid #ded5c6;
  padding: 5px 6px;
}

.paper-table td:last-child,
.paper-table th:last-child {
  white-space: nowrap;
  text-align: right;
}

.paper-box {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 1px solid #6c7a75;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 7px;
}

.paper-area {
  margin-top: 14px;
}

.paper-area h2 {
  font-size: 11pt;
  margin: 0 0 4px;
}

.paper-lines {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
}

.paper-line {
  border-bottom: 1px solid #6c7a75;
  min-height: 20px;
}

.paper-foot {
  margin-top: 14px;
  padding-top: 6px;
  border-top: 1px solid #cfc6b6;
  font-size: 8.6pt;
  color: #44544f;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.paper-mode .anon-footer {
  display: none;
}

/* --- Screen-reader only -------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Wider screens ------------------------------------------------------- */

@media (max-width: 600px) {
  .paper-wrap {
    padding: 12px 8px 30px;
  }
  .paper-toolbar {
    max-width: 100%;
  }
  .paper-toolbar .btn-primary {
    width: auto;
    min-height: 48px;
    font-size: 15.5px;
  }
  .paper-sheet {
    padding: 8mm 6mm;
  }
  .paper-table {
    font-size: 8.4pt;
  }
  .paper-table td:last-child,
  .paper-table th:last-child {
    white-space: normal;
  }
  .paper-box {
    width: 11px;
    height: 11px;
    margin-left: 2px;
  }
}

@media (max-width: 360px) {
  .screen {
    padding: 20px 16px 0;
  }
  .anon-footer {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .statement {
    padding: 14px 12px;
  }
  .scale-row {
    gap: 8px;
  }
  .distress-grid {
    gap: 6px;
  }
  .rank-row {
    grid-template-columns: 104px 1fr;
    gap: 8px;
  }
}

@media (min-width: 760px) {
  body {
    padding: 28px 0;
  }
  .app {
    border-radius: 26px;
    overflow: hidden;
    min-height: calc(100vh - 56px);
  }
  .app.surface-wide {
    max-width: 900px;
  }
  .screen {
    padding: 32px 32px 0;
  }
  .anon-footer {
    margin: auto -32px 0;
    padding: 18px 32px 22px;
  }
}

/* --- Print: the A4 paper form ------------------------------------------- */

@page {
  size: A4;
  margin: 12mm;
}

@media print {
  body {
    background: #fff;
    padding: 0;
    font-size: 10pt;
  }
  .app {
    max-width: none;
    min-height: 0;
    box-shadow: none;
    border-radius: 0;
    background: #fff;
  }
  .paper-wrap {
    padding: 0;
    background: #fff;
    display: block;
  }
  .paper-toolbar,
  .anon-footer,
  .noscript {
    display: none !important;
  }
  .paper-sheet {
    box-shadow: none;
    max-width: none;
    width: auto;
    padding: 0;
  }
  .paper-table {
    page-break-inside: auto;
  }
  tr {
    page-break-inside: avoid;
  }
  .paper-sheet {
    font-size: 8.6pt;
    line-height: 1.28;
  }
  .paper-sheet h1 {
    font-size: 16pt;
    margin: 2px 0 4px;
  }
  .paper-head p {
    margin: 0 0 6px;
  }
  .paper-refs {
    padding: 5px 0;
    font-size: 8.5pt;
  }
  .paper-table {
    font-size: 8pt;
    margin-top: 6px;
  }
  .paper-table th,
  .paper-table td {
    padding: 2.5px 4px;
  }
  .paper-box {
    width: 12px;
    height: 12px;
    margin-left: 4px;
  }
  .paper-area {
    margin-top: 8px;
  }
  .paper-area h2 {
    font-size: 9.5pt;
    margin-bottom: 2px;
  }
  .paper-lines {
    gap: 4px;
  }
  .paper-line {
    min-height: 14px;
  }
  .paper-foot {
    margin-top: 8px;
    padding-top: 4px;
    font-size: 7.5pt;
  }
}
