
/* ============================================================
   Site stylesheet (supplied): tokens, base, shared components.
   Dark is the site default. Light follows the OS setting or an
   explicit data-theme="light".
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
*:where(:not(:root)) { margin: 0; padding: 0; }

.page-content {
  padding: 50px 150px 50px;
  max-width: 1600px;
  margin-inline: auto;
  width: 100%;
}

:root {
  --rust:        #c45c2a;
  --rust-light:  #e07040;
  --rust-dim:    #7a3a1a;
  --rust-faint:  rgba(196,92,42,0.08);
  --amber:       #d4a843;
  --bg:          #0c0b09;
  --bg-surface:  #131210;
  --bg-raised:   #1a1917;
  --bg-card:     #161513;
  --bg-hover:    rgba(196,92,42,0.08);
  --bg-active:   rgba(196,92,42,0.14);
  --line:        rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.13);
  --text:        #ede8e0;
  --text-mid:    #9a9088;
  --text-dim:    #5a5550;
  --mono:        'DM Mono', ui-monospace, Menlo, Consolas, monospace;
  --serif:       'DM Serif Display', Georgia, serif;
  --sans:        'DM Sans', system-ui, sans-serif;
  --t:           0.15s ease;
  --input-bg:    rgba(0,0,0,0.35);
  --err:         #e07070;
  --err-bg:      rgba(224,112,112,0.06);
  --err-line:    rgba(224,112,112,0.3);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --rust:        #c45c2a;
    --rust-light:  #a84820;
    --rust-dim:    #d4825a;
    --rust-faint:  rgba(196,92,42,0.10);
    --amber:       #b8860b;
    --bg:          #f5f2ee;
    --bg-surface:  #ede9e3;
    --bg-raised:   #e4dfd7;
    --bg-card:     #eae6e0;
    --bg-hover:    rgba(196,92,42,0.08);
    --bg-active:   rgba(196,92,42,0.14);
    --line:        rgba(0,0,0,0.08);
    --line-strong: rgba(0,0,0,0.15);
    --text:        #1a1714;
    --text-mid:    #4a4540;
    --text-dim:    #6f665e;
    --input-bg:    rgba(0,0,0,0.04);
    --err:         #b03a3a;
    --err-bg:      rgba(176,58,58,0.06);
    --err-line:    rgba(176,58,58,0.35);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --rust:        #c45c2a;
  --rust-light:  #a84820;
  --rust-dim:    #d4825a;
  --rust-faint:  rgba(196,92,42,0.10);
  --amber:       #b8860b;
  --bg:          #f5f2ee;
  --bg-surface:  #ede9e3;
  --bg-raised:   #e4dfd7;
  --bg-card:     #eae6e0;
  --bg-hover:    rgba(196,92,42,0.08);
  --bg-active:   rgba(196,92,42,0.14);
  --line:        rgba(0,0,0,0.08);
  --line-strong: rgba(0,0,0,0.15);
  --text:        #1a1714;
  --text-mid:    #4a4540;
  --text-dim:    #6f665e;
  --input-bg:    rgba(0,0,0,0.04);
  --err:         #b03a3a;
  --err-bg:      rgba(176,58,58,0.06);
  --err-line:    rgba(176,58,58,0.35);
  color-scheme: light;
}

html, body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); }
::-webkit-scrollbar-thumb:hover { background: var(--rust-dim); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-content { animation: fadeUp 0.3s ease both; }

.page-title {
  font-family: var(--serif) !important;
  font-size: clamp(26px, 3.5vw, 40px) !important;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 12px;
  line-height: 1.15;
  text-wrap: balance;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 48px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.section-head-title { font-family: var(--serif); font-size: 26px; font-weight: 400; color: var(--text); }
.section-head-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  margin-left: auto;
  text-align: right;
}

.home-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust-dim);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-section-label::after { content: ''; flex: 1; height: 1px; background: var(--line); max-width: 120px; }
.home-rule { width: 100%; max-width: 400px; height: 2px; background: var(--rust); margin-bottom: 32px; }
.contributors-subtitle { font-size: 15px; font-style: italic; color: var(--text-mid); margin-bottom: 28px; line-height: 1.6; max-width: 62ch; }

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t), border-color var(--t), color var(--t);
  white-space: nowrap;
}
.btn-primary { background: var(--rust); border: 1px solid var(--rust); color: #fff; }
.btn-primary:hover { background: var(--rust-light); border-color: var(--rust-light); }
.btn-ghost { background: none; border: 1px solid var(--line-strong); color: var(--text-mid); }
.btn-ghost:hover { color: var(--text); border-color: var(--rust-dim); background: var(--rust-faint); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.sm-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t);
  resize: vertical;
  min-height: 140px;
}
.sm-textarea:focus { border-color: var(--rust-dim); }
.sm-textarea::placeholder { color: var(--text-dim); }

.hs-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--text-mid);
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.hs-btn:hover { border-color: var(--text-dim); color: var(--text); }
.hs-btn[aria-selected="true"] { background: var(--bg-active); border-color: var(--rust); color: var(--rust-light); }

.contributors-stats { display: flex; border: 1px solid var(--line-strong); margin-top: 28px; overflow: hidden; }
.stat-cell { flex: 1; padding: 16px 12px; text-align: center; border-right: 1px solid var(--line); background: var(--bg-surface); min-width: 0; }
.stat-cell:last-child { border-right: none; }
.stat-num { font-family: var(--serif); font-size: 24px; color: var(--rust-light); display: block; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 13px; font-style: italic; color: var(--text-mid); margin-top: 2px; display: block; }

/* ============================================================
   Survey-specific, built from the tokens above
   ============================================================ */
:focus-visible { outline: 2px solid var(--rust-light); outline-offset: 2px; }
.survey { max-width: 800px; min-width: 0; }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 10px 0; margin-bottom: 8px; }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; }
.tabs { display: flex; gap: 6px; }
.count { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mid); font-variant-numeric: tabular-nums; }
.track { height: 3px; background: var(--line-strong); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--rust); transition: width .25s ease; }

.notice {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  color: var(--rust-light);
  background: var(--rust-faint);
  border: 1px solid rgba(196,92,42,0.2);
  border-left: 2px solid var(--rust-dim);
  padding: 10px 14px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.notice.error { color: var(--err); background: var(--err-bg); border-color: var(--err-line); border-left-color: var(--err); }

.sec { display: flex; flex-direction: column; gap: 12px; }
.q { background: var(--bg-card); border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.q-title { display: flex; gap: 12px; align-items: baseline; font-size: 16px; font-weight: 500; color: var(--text); line-height: 1.45; }
.qn { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--rust-light); flex: none; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; gap: 14px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--line); background: var(--bg-surface); cursor: pointer; color: var(--text-mid); transition: border-color var(--t), background var(--t), color var(--t); }
.opt:hover { border-color: var(--rust-dim); background: var(--bg-hover); color: var(--text); }
.opt:has(input:checked) { border-color: var(--rust); background: var(--bg-active); color: var(--text); }
.opt:has(input:focus-visible) { outline: 2px solid var(--rust-light); outline-offset: 2px; }
.opt span { min-width: 0; overflow-wrap: anywhere; }
.opt input { appearance: none; -webkit-appearance: none; flex: none; width: 11px; height: 11px; margin: 7px 3px 0 3px; border: 1px solid var(--text-dim); background: var(--input-bg); transform: rotate(45deg); cursor: pointer; transition: background var(--t), border-color var(--t); }
.opt input:checked { background: var(--rust); border-color: var(--rust); }
.opt input:focus-visible { outline: none; }
.clear { align-self: flex-start; background: none; border: 0; color: var(--text-dim); font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: underline; cursor: pointer; }
.clear:hover { color: var(--text-mid); }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; color: var(--text-mid); }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin-top: 3px; border: 1px solid var(--line-strong); background: var(--input-bg); cursor: pointer; position: relative; transition: border-color var(--t), background var(--t); }
.check input:checked { background: var(--bg-active); border-color: var(--rust); }
.check input:checked::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 10px; color: var(--rust-light); line-height: 1; }
.check input:disabled { opacity: .5; cursor: not-allowed; }
.hint { font-size: 13px; color: var(--text-dim); }

.actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 32px; }
.done { margin-top: 32px; padding: 32px; background: var(--bg-raised); border: 1px solid var(--line-strong); border-top: 2px solid var(--rust); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; max-width: 560px; }
.done h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--text); }
.done p { color: var(--text-mid); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.row-between h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; }
.res-q { margin-top: 32px; display: flex; flex-direction: column; gap: 10px; }
.res-q h3 { font-size: 15px; font-weight: 500; line-height: 1.45; }
.res-q h3 .qn { margin-right: 10px; }
.res-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: end; }
.res-row .lbl { min-width: 0; overflow-wrap: anywhere; font-size: 14px; color: var(--text-mid); }
.res-row .num { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; color: var(--text-mid); }
.res-row .tr { grid-column: 1 / -1; height: 5px; background: var(--bg-raised); }
.res-row .fl { height: 100%; background: var(--rust); }
.res-meta { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.comments { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.comment { background: var(--bg-surface); border: 1px solid var(--line); border-left: 2px solid var(--rust-dim); padding: 12px 16px; }
.comment .who { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rust-dim); margin-bottom: 4px; }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-mid); }
.empty { margin-top: 28px; padding: 20px; border: 1px dashed var(--line-strong); color: var(--text-dim); }

@media (max-width: 860px) {
  .page-content { padding: 28px 20px 60px; }
  .section-head { padding-top: 36px; flex-wrap: wrap; }
  .section-head-label { margin-left: 0; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .page-content, .fill { animation: none; transition: none; }
}

/* Server-rendered form additions */
.sm-input {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t);
}
.sm-input:focus { border-color: var(--rust-dim); }
.sm-label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mid); margin-bottom: 5px; }
.clear[hidden] { display: none; }
.rsn-field { display: flex; flex-direction: column; }
.skip { position: absolute; left: -9999px; }

[hidden] { display: none !important; }
