/* Base layout for scored assessments; page-specific styles extend it. Shared typography and themes load last. */
h1 {
  margin: 24px 0;
  color: var(--accent-secondary);
  text-decoration: underline;
  text-decoration-color: var(--accent-primary);
  text-underline-offset: 6px;
}

h2 {
  margin: 0 0 10px;
  color: var(--accent-secondary);
}
h3 {
  margin: 20px 0 10px;
  color: var(--accent-secondary);
}
a {
  color: var(--accent-primary);
}

/* Shared panel appearance used by questions, results, and documentation. */
.card {
  margin: 14px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
}

.measure-switcher {
  display: grid;
  gap: 12px;
}
.helper-text,
.screening-note {
  color: var(--muted-text);
  line-height: 1.45;
}
.helper-text {
  margin: 4px 0 0;
}

/* Lay out adjacent answer buttons and allow them to wrap. */
.segmented-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.question-number {
  color: var(--accent-primary);
  margin-right: 7px;
}

/* Arrange the answer choices within a question. */
.response-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.response-option {
  position: relative;
  display: block;
}

/* Keep the actual radio control while styling the adjacent label as the visible choice. */
.response-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.response-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.response-option:hover span {
  border-color: var(--accent-secondary);
}
.response-option input:focus-visible + span {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}
.response-option input:checked + span {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--on-accent);
}

/* Group the current score and interpretation into a results area. */
.results-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.small-label {
  color: var(--accent-secondary);
  font-weight: 700;
}
.score-display,
.severity-display {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

/* Honor the hidden attribute that JavaScript toggles for the alert. */
.safety-alert[hidden] {
  display: none;
}

.safety-alert {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 14px;
  border: 2px solid var(--accent-secondary);
  border-radius: 20px;
  background: var(--surface-2);
}

/* Lay out interpretation ranges; the current class identifies the active band. */
.interpretation-table {
  display: grid;
  gap: 7px;
}
.interpretation-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}
.interpretation-row.current {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--on-accent);
}
.interpretation-range {
  font-weight: 700;
}

.output-style-row {
  margin-bottom: 12px;
}
.inline-option {
  display: inline-flex;
  align-items: center;
  margin: 8px 18px 0 0;
}

/* Size and style the note and free-text fields. */
textarea {
  width: 100%;
  min-height: 280px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text);
  font: 16px/1.5 var(--body-font);
  resize: vertical;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
#copy-status {
  color: var(--accent-secondary);
}

/* Smaller-screen adjustments: reduce columns and spacing to fit the available width. */
@media (max-width: 760px) {
  .response-grid {
    grid-template-columns: 1fr 1fr;
  }
  .results-summary {
    grid-template-columns: 1fr;
  }
}

/* Shared scored-tool introductions, prompts, navigation, and interpretation notices. */
.intro-card {
  display: grid;
  gap: 10px;
}
.intro-card p {
  margin: 0;
  line-height: 1.55;
}
.question-card {
  display: grid;
  gap: 14px;
}
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.information-alert {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid var(--accent-secondary);
  border-radius: 20px;
  background: var(--notice-surface);
  line-height: 1.5;
}
@media (max-width: 760px) {
  .section-nav {
    position: static;
  }
}
