:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #fffdfa;
  --panel-soft: #f2eee6;
  --border: #d8d0c2;
  --text: #172235;
  --muted: #68717c;
  --accent: #173b63;
  --gold: #b58b2a;
  --gold-soft: #f4ecd9;
  --success: #2f6b4f;
  --danger: #a83d3d;
  --shadow: 0 14px 34px rgba(23, 34, 53, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(180deg, #fbfaf6 0, #f7f4ee 320px, #f4f0e8 100%);
  color: var(--text);
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px 20px 64px;
}

.page-header {
  padding: 18px 0 28px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
legend {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(36px, 7vw, 68px);
  line-height: 0.98;
}

.lede {
  max-width: 800px;
  margin: 20px 0 0;
  color: #4e5c6c;
  font-size: clamp(19px, 2.6vw, 27px);
  line-height: 1.38;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  margin: 28px 0 22px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.intro-panel h2,
.submit-panel h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.survey-intro {
  display: grid;
  gap: 10px;
}

.survey-intro p,
.section-description,
.question-help,
.privacy-note,
.form-status {
  color: var(--muted);
  line-height: 1.55;
}

.survey-intro p {
  margin: 0;
}

.survey-facts {
  display: grid;
  align-content: start;
  gap: 10px;
}

.survey-facts span {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbf8f1;
  color: #5f584d;
  font-size: 14px;
  line-height: 1.35;
}

.progress-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 8px;
  margin: 0 0 22px;
  border-radius: 999px;
  background: rgba(216, 208, 194, 0.65);
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.branch-notice {
  position: sticky;
  top: 10px;
  z-index: 9;
  max-height: 0;
  margin: -10px 0 0;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eef4f8;
  color: #173b63;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease, max-height 180ms ease, margin 180ms ease, padding 180ms ease, border-color 180ms ease;
}

.branch-notice.is-visible {
  max-height: 96px;
  margin: -8px 0 18px;
  padding: 10px 14px;
  border-color: rgba(23, 59, 99, 0.18);
  opacity: 1;
  transform: translateY(0);
}

.branch-revealed {
  animation: branchReveal 320ms ease;
}

@keyframes branchReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.survey-form,
.survey-root {
  display: grid;
  gap: 22px;
}

.survey-section {
  display: grid;
  gap: 16px;
  scroll-margin-top: 30px;
}

.section-heading {
  padding: 18px 0 12px;
  border-bottom: 2px solid var(--gold);
}

.section-step {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
}

.section-description {
  max-width: 760px;
  margin: 10px 0 0;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-block {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

legend {
  float: left;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

legend + * {
  clear: both;
}

.question-help {
  margin: 0;
}

.question-control {
  display: grid;
  gap: 10px;
}

.choice-list {
  display: grid;
  gap: 9px;
}

.choice-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdfa;
  cursor: pointer;
}

.choice-item:hover,
.choice-item:focus-within {
  border-color: var(--gold);
  background: #fffaf0;
}

.choice-item input {
  width: auto;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.other-text {
  grid-column: 2;
  margin-top: 2px;
}

input,
textarea,
button {
  font: inherit;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(181, 139, 42, 0.26);
  outline-offset: 2px;
  border-color: var(--gold);
}

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

.matrix-grid {
  display: grid;
  gap: 8px;
  min-width: 720px;
}

.matrix-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(var(--matrix-columns, 4), minmax(116px, 1fr));
  gap: 8px;
}

.matrix-cell {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdfa;
  text-align: center;
  font-size: 14px;
}

.matrix-label {
  place-items: center start;
  text-align: left;
  font-weight: 700;
}

.matrix-cell input {
  width: auto;
  accent-color: var(--accent);
}

.question-error {
  display: none;
  margin: 2px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.question-block.has-error {
  border-color: rgba(168, 61, 61, 0.62);
}

.question-block.has-error .question-error {
  display: block;
}

.submit-panel {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.privacy-note {
  margin: 0;
  padding: 13px 15px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: var(--gold-soft);
  color: #513f16;
}

.turnstile-slot:empty {
  display: none;
}

.form-status {
  min-height: 24px;
  margin: 0;
}

.form-status[data-tone="success"] {
  color: var(--success);
}

.form-status[data-tone="danger"] {
  color: var(--danger);
}

button {
  width: fit-content;
  min-width: 160px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.04);
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.is-hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .branch-notice,
  .branch-revealed,
  .progress-bar {
    animation: none;
    transition: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 24px 14px 48px;
  }

  .intro-panel {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .question-block,
  .submit-panel {
    padding: 18px;
  }

  .choice-item {
    padding: 11px 12px;
  }

  .branch-notice.is-visible {
    margin-bottom: 14px;
    font-size: 13px;
  }
}
