/* ──────────────────────────────────────────────────────────────────────────
   Aethel intake – shared form styles
   Used by: consent, demographics, health-questionnaire, assessment-setup
   ────────────────────────────────────────────────────────────────────── */
:root {
  --bg: #F4F3EE;
  --bg-2: #EDEBE3;
  --surface: #FFFFFF;
  --ink: #111114;
  --ink-2: #2A2A2E;
  --mute: #6E6E76;
  --rule: rgba(17,17,20,0.10);
  --rule-strong: rgba(17,17,20,0.22);
  --accent: #2A6F4D;
  --accent-soft: rgba(42,111,77,0.10);
  --danger: #C0392B;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); min-height: 100vh; }
body {
  font-family: 'Manrope', 'Helvetica Neue', Helvetica, sans-serif;
  font-weight: 400; font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
  position: relative; z-index: 0;
}

/* ── Ambient background: subtle grid + floating green dots ──────── */
body.with-bg::before {
  content: '';
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(17,17,20,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17,17,20,0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
}
body.with-bg::after {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(52% 38% at 50% 48%, rgba(244,243,238,0.72) 0%, rgba(244,243,238,0.32) 50%, rgba(244,243,238,0) 80%);
  pointer-events: none;
}
.bg-light {
  position: fixed; width: 10px; height: 10px;
  background: radial-gradient(circle, rgba(120,120,120,0.60) 0%, rgba(120,120,120,0.20) 50%, transparent 75%);
  border-radius: 50%; pointer-events: none; opacity: 0.7;
  z-index: -1;
}
.bg-light-1 { top: 16%; left: -12px; animation: bgMoveH 14s linear infinite, bgGlow 3.2s ease-in-out infinite; }
.bg-light-2 { top: 66%; left: -12px; animation: bgMoveH 12s linear infinite, bgGlow 2.6s ease-in-out infinite;
  animation-delay: 3s, 1s; }
.bg-light-3 { top: -12px; left: 24%; animation: bgMoveV 13s linear infinite, bgGlow 3.4s ease-in-out infinite;
  animation-delay: 2s, 0.4s; }
.bg-light-4 { bottom: -12px; left: 74%; animation: bgMoveVU 14s linear infinite, bgGlow 2.8s ease-in-out infinite;
  animation-delay: 1.5s, 0.8s; }
@keyframes bgMoveH  { 0% { left: -12px; } 100% { left: calc(100% + 12px); } }
@keyframes bgMoveV  { 0% { top: -12px; }  100% { top: calc(100% + 12px); } }
@keyframes bgMoveVU { 0% { bottom: -12px; } 100% { bottom: calc(100% + 12px); } }
@keyframes bgGlow {
  0%, 75%, 100% {
    background: radial-gradient(circle, rgba(120,120,120,0.60) 0%, rgba(120,120,120,0.20) 50%, transparent 75%);
    box-shadow: 0 0 0 rgba(34,197,94,0);
    opacity: 0.7; transform: scale(1);
  }
  18%, 55% {
    background: radial-gradient(circle, #22c55e 0%, rgba(34,197,94,0.75) 50%, rgba(34,197,94,0.10) 75%);
    box-shadow: 0 0 18px rgba(34,197,94,0.70), 0 0 36px rgba(34,197,94,0.35);
    opacity: 1; transform: scale(1.35);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bg-light { animation: none !important; opacity: 0.35; }
}

/* Keep content above the ambient layers */
header.bar, main, footer, .progress-wrap { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Header ───────────────────────────────────────────────────────── */
header.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 36px;
}
header.bar .mark {
  font-family: 'Newsreader', Georgia, serif; font-style: italic;
  font-weight: 400; font-size: 22px; letter-spacing: -0.005em; color: var(--ink);
}
header.bar .step {
  font-size: 11px; font-weight: 600; color: var(--mute);
  letter-spacing: 0.14em; text-transform: uppercase;
  white-space: nowrap;
}

/* ── Progress strip ───────────────────────────────────────────────── */
.progress-wrap { padding: 0 36px 0; max-width: 760px; width: 100%; margin: 4px auto 0; }
.progress-segs { display: flex; gap: 4px; }
.progress-segs .seg {
  flex: 1; height: 3px; border-radius: 100px;
  background: var(--rule); transition: background 0.3s ease;
}
.progress-segs .seg.active { background: var(--ink); }
.progress-segs .seg.done   { background: var(--accent); }
.progress-label {
  font-size: 11px; font-weight: 600; color: var(--mute);
  letter-spacing: 0.14em; text-transform: uppercase;
  text-align: right; margin-top: 8px;
}

/* ── Main ─────────────────────────────────────────────────────────── */
main {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 16px 36px 80px;
  opacity: 0; transform: translateY(8px);
  animation: fadeIn 600ms cubic-bezier(.22,.61,.36,1) 80ms forwards;
}
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }
.container { width: 100%; max-width: 720px; }

/* ── Typography ───────────────────────────────────────────────────── */
.page-head { text-align: center; margin: 12px 0 32px; }
h1 {
  font-family: 'Newsreader', Georgia, serif; font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 2.7rem); line-height: 1.12;
  letter-spacing: -0.018em; margin-bottom: 10px;
}
h1 em { font-style: italic; color: var(--ink-2); }
.lede {
  font-size: 15px; color: var(--mute); max-width: 520px;
  margin: 0 auto; line-height: 1.6;
}

/* ── Card ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 28px 28px 24px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--mute);
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

/* ── Question groups ──────────────────────────────────────────────── */
.q-group { margin-bottom: 22px; }
.q-group:last-child { margin-bottom: 0; }
.q-label {
  display: block; font-size: 15px; font-weight: 600; color: var(--ink);
  margin-bottom: 6px; line-height: 1.4;
}
.q-label .req { color: var(--danger); margin-left: 2px; font-weight: 500; }
.q-hint { font-size: 13px; color: var(--mute); margin-bottom: 10px; line-height: 1.5; }
.q-err { font-size: 13px; color: var(--danger); margin-top: 7px; display: none; }
.q-err.show { display: block; }

/* ── Inputs / selects / textarea ──────────────────────────────────── */
.q-input, .q-select, .q-textarea {
  width: 100%; padding: 12px 14px;
  font-family: 'Manrope', sans-serif; font-size: 15px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--surface); color: var(--ink); outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  appearance: none;
}
.q-input:focus, .q-select:focus, .q-textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(17,17,20,0.06);
}
.q-input:hover, .q-select:hover, .q-textarea:hover { border-color: var(--rule-strong); }
.q-input.narrow { max-width: 180px; }
.q-input.tiny { max-width: 110px; }
.q-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.q-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236E6E76' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px; cursor: pointer;
}

/* ── Grid helper ──────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Radio pills ──────────────────────────────────────────────────── */
.pills { display: flex; flex-direction: column; gap: 8px; }
.pills.horiz { flex-direction: row; flex-wrap: wrap; }
.pill {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface); border: 1.5px solid var(--rule);
  border-radius: 12px; cursor: pointer;
  font-size: 14.5px; color: var(--ink); line-height: 1.4;
  transition: border-color 0.18s ease, background 0.18s ease;
  user-select: none; -webkit-tap-highlight-color: transparent; position: relative;
}
.pill:hover { border-color: var(--rule-strong); }
.pill input[type="radio"], .pill input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.pill .ind {
  flex-shrink: 0; width: 18px; height: 18px;
  border: 2px solid var(--rule-strong); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.18s ease;
}
.pill.checkbox .ind { border-radius: 5px; }
.pill .ind::after {
  content: ''; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
  opacity: 0; transform: scale(0.4);
  transition: opacity 0.15s ease, transform 0.18s cubic-bezier(.22,.61,.36,1);
}
.pill.checkbox .ind::after {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--accent);
}
.pill.selected { border-color: var(--ink); background: #FCFBF7; }
.pill.selected .ind { border-color: var(--accent); }
.pill.selected .ind::after { opacity: 1; transform: scale(1); }
.pill .body { flex: 1; }
.pill .body strong { font-weight: 600; }
.pill .body .sub { display: block; font-size: 13px; color: var(--mute); margin-top: 2px; font-weight: 400; }

/* ── Chips ────────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 14px; cursor: pointer;
  border: 1.5px solid var(--rule); border-radius: 100px;
  background: var(--surface); color: var(--ink-2);
  font-size: 13.5px; font-weight: 500;
  font-family: inherit;
  transition: all 0.18s ease;
}
.chip:hover { border-color: var(--rule-strong); }
.chip.selected { background: var(--ink); color: #FCFBF7; border-color: var(--ink); }

/* ── Slider ───────────────────────────────────────────────────────── */
.slider-wrap { margin-top: 4px; }
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-val {
  font-size: 17px; font-weight: 600;
  color: var(--ink); min-width: 28px; text-align: center; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.slider-val.unset { color: var(--rule-strong); }
.slider-anchors {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; color: var(--mute); line-height: 1.4;
}
.anchor-r { text-align: right; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1;
  height: 4px; border-radius: 100px; outline: none; cursor: pointer;
  background: var(--rule);
}
input[type="range"].touched {
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill, 50%), var(--rule) var(--fill, 50%), var(--rule) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  background: var(--ink); border-radius: 50%; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform 0.14s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; background: var(--ink);
  border: none; border-radius: 50%; cursor: pointer;
}

/* ── Measurement field (height/weight) ───────────────────────────── */
.meas {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--surface); padding-right: 6px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.meas:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(17,17,20,0.06); }
.meas .meas-fields { flex: 1; display: flex; align-items: center; min-width: 0; }
.meas input[type="number"] {
  border: none; outline: none; background: transparent;
  padding: 12px 6px 12px 14px;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--ink); min-width: 0; width: 100%;
  -moz-appearance: textfield;
}
.meas input[type="number"]::-webkit-outer-spin-button,
.meas input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.meas .unit { font-size: 12px; font-weight: 600; color: var(--mute); letter-spacing: 0.04em; flex-shrink: 0; }
.unit-switch {
  display: inline-flex; background: #F1EFE7;
  border-radius: 100px; padding: 3px; flex-shrink: 0;
  margin-left: 6px;
}
.unit-switch button {
  border: none; background: transparent;
  padding: 5px 12px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--mute);
  border-radius: 100px; transition: all 0.15s ease;
  letter-spacing: 0.02em;
}
.unit-switch button:hover { color: var(--ink); }
.unit-switch button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
}

/* ── Condition cards (used in health questionnaire) ──────────────── */
.cond-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.cond-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px; cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--rule);
  border-radius: 14px; transition: all 0.18s ease;
  position: relative;
}
.cond-card:hover { border-color: var(--rule-strong); }
.cond-card.selected { border-color: var(--ink); background: #FCFBF7; }
.cond-card input { position: absolute; opacity: 0; pointer-events: none; }
.cond-card .ind {
  flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px;
  border: 2px solid var(--rule-strong); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s ease;
}
.cond-card .ind::after {
  content: ''; width: 10px; height: 10px;
  background: var(--accent); border-radius: 3px;
  opacity: 0; transform: scale(0.4);
  transition: opacity 0.15s ease, transform 0.18s cubic-bezier(.22,.61,.36,1);
}
.cond-card.selected .ind { border-color: var(--accent); }
.cond-card.selected .ind::after { opacity: 1; transform: scale(1); }
.cond-card .body { flex: 1; min-width: 0; }
.cond-card .name { font-weight: 600; font-size: 15px; color: var(--ink); }
.cond-card .sub { font-size: 13px; color: var(--mute); margin-top: 3px; line-height: 1.4; }

/* ── RBDSQ rows ──────────────────────────────────────────────────── */
.rbd-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.rbd-row:last-child { border-bottom: none; padding-bottom: 0; }
.rbd-row .txt { flex: 1; font-size: 14.5px; color: var(--ink); line-height: 1.5; }
.rbd-row .yn { display: flex; gap: 6px; flex-shrink: 0; }
.rbd-row .yn label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--rule); border-radius: 100px;
  background: var(--surface); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.18s ease;
}
.rbd-row .yn label:hover { border-color: var(--rule-strong); }
.rbd-row .yn label.selected { background: var(--ink); color: #FCFBF7; border-color: var(--ink); }
.rbd-row .yn input { position: absolute; opacity: 0; pointer-events: none; }
@media (max-width: 540px) {
  .rbd-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ── Conditional reveal ──────────────────────────────────────────── */
.cond-reveal { display: none; }
.cond-reveal.show { display: block; }

/* ── CTA ─────────────────────────────────────────────────────────── */
.cta-wrap { text-align: center; margin-top: 28px; }
.cta {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--bg);
  padding: 16px 34px; border-radius: 100px;
  font-size: 15px; font-weight: 500; letter-spacing: -0.005em;
  border: none; cursor: pointer;
  transition: transform 0.28s cubic-bezier(.22,.61,.36,1), background 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 1px 0 rgba(17,17,20,0.20), 0 12px 32px -16px rgba(17,17,20,0.40);
}
.cta:hover:not(:disabled) { transform: translateY(-2px); background: var(--ink-2); box-shadow: 0 1px 0 rgba(17,17,20,0.25), 0 18px 40px -16px rgba(17,17,20,0.45); }
.cta:disabled { background: rgba(17,17,20,0.18); color: rgba(255,255,255,0.85); cursor: not-allowed; box-shadow: none; }
.cta .arr { transition: transform 0.28s cubic-bezier(.22,.61,.36,1); }
.cta:hover:not(:disabled) .arr { transform: translateX(4px); }
.cta.ghost {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--rule-strong);
  box-shadow: none;
}
.cta.ghost:hover:not(:disabled) { background: rgba(17,17,20,0.04); border-color: var(--ink); }

.hint { font-size: 13px; color: var(--mute); margin-top: 12px; min-height: 18px; }

/* ── Success banner ──────────────────────────────────────────────── */
.success {
  background: var(--accent-soft); border: 1px solid rgba(42,111,77,0.20);
  color: var(--accent); padding: 14px 18px; border-radius: 12px;
  margin-bottom: 14px; text-align: center; font-size: 14px;
  display: none;
}
.success.show { display: block; }

/* ── Footer ──────────────────────────────────────────────────────── */
footer { padding: 24px 36px; color: var(--mute); font-size: 12px; text-align: center; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  header.bar { padding: 18px 20px; }
  header.bar .mark { font-size: 19px; }
  .progress-wrap { padding: 0 20px; }
  main { padding: 12px 20px 60px; }
  .card { padding: 20px 18px; border-radius: 16px; }
  h1 { font-size: 1.8rem; }
  .pills.horiz { flex-direction: column; }
  .cta { padding: 14px 28px; font-size: 14px; width: 100%; justify-content: center; }
}
