/* ==========================================================================
   Shared styles — landing page, survey, dashboard.
   Editorial monochrome (fashion-appropriate) with a single warm accent.
   Light and dark are both authored; dark follows the OS unless [data-theme]
   is stamped on <html>.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg:            #faf8f5;
  --surface:       #ffffff;
  --surface-2:     #f3f0ea;
  --ink:           #16150f;
  --ink-2:         #56534b;
  --muted:         #8b8779;
  --line:          #e4e0d6;
  --line-strong:   #c9c3b5;
  --accent:        #8a5a3c;
  --accent-ink:    #ffffff;
  --focus:         #2a78d6;
  /* One declaration rather than three: color-scheme is set in every theme
     block, so light-dark() resolves correctly in the media query and the
     explicit [data-theme] override without repeating the pair. */
  --warn:          light-dark(#a8641a, #e0a45c);

  /* chart roles — the validated dataviz palette, light steps */
  --series-1:      #2a78d6;
  --series-2:      #eb6834;
  --series-3:      #1baf7a;
  --grid:          #e1e0d9;
  --baseline:      #c3c2b7;

  --radius:        4px;
  --maxw:          68rem;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg:          #131211;
    --surface:     #1c1a18;
    --surface-2:   #252220;
    --ink:         #f7f5f0;
    --ink-2:       #b8b3a8;
    --muted:       #8b8779;
    --line:        #2f2c28;
    --line-strong: #443f39;
    --accent:      #c98a68;
    --accent-ink:  #16150f;

    --series-1:    #3987e5;
    --series-2:    #d95926;
    --series-3:    #199e70;
    --grid:        #2c2c2a;
    --baseline:    #383835;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #131211;
  --surface:     #1c1a18;
  --surface-2:   #252220;
  --ink:         #f7f5f0;
  --ink-2:       #b8b3a8;
  --muted:       #8b8779;
  --line:        #2f2c28;
  --line-strong: #443f39;
  --accent:      #c98a68;
  --accent-ink:  #16150f;

  --series-1:    #3987e5;
  --series-2:    #d95926;
  --series-3:    #199e70;
  --grid:        #2c2c2a;
  --baseline:    #383835;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  /* clip, never hidden: `hidden` on one axis forces the other to `auto` and
     silently kills every position:sticky on the page. */
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 1em; }
a  { color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 42rem; }

/* --- header ------------------------------------------------------------- */

.site-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  font-size: 0.85rem; text-decoration: none;
}
.head-actions { display: flex; gap: 0.5rem; align-items: center; }

.theme-toggle {
  background: none; border: 1px solid var(--line-strong); color: var(--ink-2);
  border-radius: var(--radius); padding: 0.35rem 0.6rem; cursor: pointer;
  font: inherit; font-size: 0.8rem;
}
.theme-toggle:hover { background: var(--surface-2); }

/* --- hero --------------------------------------------------------------- */

.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2rem, 5vw, 3.5rem); }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.72rem;
  color: var(--muted); font-weight: 600; margin-bottom: 1.25rem;
}
.hero p.lede { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--ink-2); max-width: 34em; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; align-items: center; }

.btn {
  font: inherit; font-weight: 500; cursor: pointer;
  padding: 0.8rem 1.4rem; border-radius: var(--radius);
  border: 1px solid transparent; text-decoration: none;
  /* Centred and allowed to wrap. A long label in a full-width cell was
     spilling past the button edge because inline-flex left it start-aligned
     with nowhere to break. */
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; text-align: center; line-height: 1.3;
  min-height: 2.9rem; text-wrap: balance;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 40%, transparent);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .btn, input, textarea, select { transition: none; }
  .btn-primary:hover { transform: none; }
}

.meta-note { font-size: 0.85rem; color: var(--muted); }

/* --- value grid --------------------------------------------------------- */

.grid-3 {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 3rem 0;
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem;
}
.card h3 { margin-bottom: 0.4rem; }
.card p { margin: 0; color: var(--ink-2); font-size: 0.94rem; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

/* --- survey ------------------------------------------------------------- */

.survey { padding: 2rem 0 5rem; }

.progress-shell {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); padding: 1rem 0 0.85rem;
  border-bottom: 1px solid var(--line); margin-bottom: 2.5rem;
}
.progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem;
}
.progress-track { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-bar {
  height: 100%; background: var(--accent); border-radius: 2px;
  width: 0%; transition: width 240ms ease;
}

.step { display: none; }
.step.is-active { display: block; animation: rise 240ms ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .step.is-active { animation: none; }
  .progress-bar { transition: none; }
}

.step-title { margin-bottom: 0.25rem; }
.step-intro { color: var(--ink-2); margin-bottom: 2.25rem; }

.q { margin-bottom: 2.25rem; }
.q-label { display: block; font-weight: 500; margin-bottom: 0.15rem; }
.q-help { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
.q-required::after { content: " *"; color: var(--accent); }

/* Every text-like control, listed explicitly.
   `password` and `date` were missing here, which is why the signup form had a
   styled email box sitting directly above a raw browser-default password box.
   Anything with a caret in it belongs in this list. */
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="search"], input[type="tel"],
input[type="number"], input[type="url"], textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 0.65rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* Native select needs its arrow back once appearance is normalised by the
   border rule above; drawn rather than imported so it inherits the ink colour
   and stays correct in both themes. */
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1.05rem center, right 0.75rem center;
  background-size: 0.32rem 0.32rem, 0.32rem 0.32rem;
  background-repeat: no-repeat;
  padding-right: 2rem;
}
/* The calendar picker button is invisible against a dark surface otherwise. */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.55;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
  }
}
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
textarea { min-height: 6.5rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }

.opts { display: grid; gap: 0.5rem; }
.opts.cols-2 { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

.opt {
  display: flex; align-items: flex-start; gap: 0.65rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.7rem 0.85rem; cursor: pointer; background: var(--surface);
}
.opt:hover { border-color: var(--ink-2); }
.opt input { margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }
.opt span { font-size: 0.94rem; }
.opt:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.other-input { margin-top: 0.5rem; }

.q-error { color: #d03b3b; font-size: 0.85rem; margin-top: 0.5rem; display: none; }
.q.has-error .q-error { display: block; }
.q.has-error .opt, .q.has-error input[type="text"],
.q.has-error input[type="email"], .q.has-error textarea { border-color: #d03b3b; }

.nav-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-top: 1.5rem; border-top: 1px solid var(--line);
}

.consent {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.5rem;
  font-size: 0.9rem; color: var(--ink-2);
}
.consent p:last-child { margin: 0; }

.done { text-align: center; padding: 4rem 0; }
.done .tick {
  width: 3rem; height: 3rem; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center;
  margin: 0 auto 1.5rem; font-size: 1.4rem;
}

.banner {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 0.7rem 1rem; font-size: 0.87rem; margin-bottom: 1.5rem;
}

/* Something the person needs to act on — an expired confirmation link, not a
   status note. Colour is a second signal here, never the only one: the text
   always says what happened and what to do next. */
.banner-warn {
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border-color: var(--warn);
}

/* --- dashboard ---------------------------------------------------------- */

.dash-head { padding: 2rem 0 1.5rem; }
.tiles {
  display: grid; gap: 1rem; margin-bottom: 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
}
.tile-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin-bottom: 0.35rem;
}
.tile-value { font-size: 2rem; font-weight: 600; line-height: 1; }
.tile-sub { font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; }

.charts { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr)); }
.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem 1.4rem 1.4rem;
}
.chart-title { font-size: 0.98rem; font-weight: 600; margin-bottom: 0.1rem; }
.chart-sub { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.1rem; }

/* horizontal bars: thin marks, rounded data-end, direct value labels */
.bars { display: grid; gap: 0.6rem; }
.bar-row { display: grid; grid-template-columns: minmax(7rem, 38%) 1fr auto; gap: 0.75rem; align-items: center; }
.bar-name { font-size: 0.86rem; color: var(--ink-2); }
.bar-track { background: var(--surface-2); border-radius: 2px; height: 14px; overflow: hidden; }
.bar-fill {
  height: 100%; background: var(--series-1);
  border-radius: 0 4px 4px 0; min-width: 2px;
  transition: width 400ms ease;
}
.bar-value { font-size: 0.84rem; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: right; }

.quotes { display: grid; gap: 0.9rem; }
.quote {
  border-left: 2px solid var(--accent); padding: 0.15rem 0 0.15rem 0.9rem;
  font-size: 0.92rem; color: var(--ink-2);
}
.quote cite { display: block; font-style: normal; font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
table.data th, table.data td {
  text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line);
}
table.data th { color: var(--muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
table.data td { font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

.empty { color: var(--muted); font-size: 0.9rem; padding: 1.5rem 0; text-align: center; }

.site-foot {
  border-top: 1px solid var(--line); margin-top: 4rem; padding: 2rem 0 3rem;
  font-size: 0.84rem; color: var(--muted);
}
.site-foot a { color: var(--ink-2); }

.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;
}
