/* isas.css
 * Extra styling for isas.html; loaded after screening.css so these rules can override the shared base.
 * CSS controls appearance. JavaScript controls responses and generated notes.
 * Rules later in the file can override earlier rules with equal specificity.
 */

/* Links to major sections; the ISAS navigation stays in normal document flow. */
.section-nav {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.section-nav a {
  font-weight: 700;
}

/* Rows for behavior counts and main-form selections. */
.behavior-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.behavior-row,
.other-behavior-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 110px auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
}

.behavior-name {
  align-self: center;
  font-weight: 700;
}

input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

.main-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  white-space: nowrap;
}

.other-behavior-row {
  margin-top: 10px;
}

.information-alert {
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid var(--accent-secondary);
  border-radius: 20px;
  background: var(--surface-2);
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-grid label,
.other-behavior-row label,
.optional-statements label {
  display: grid;
  gap: 6px;
}

.choice-section {
  margin-top: 20px;
}

.response-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
}

/* Layout for individual self-injury function questions. */
.function-list {
  margin-top: 14px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface-2);
}

.function-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.function-item:first-child {
  border-top: 0;
}
.function-item-text {
  line-height: 1.4;
}
.function-item-number {
  color: var(--accent-primary);
  font-weight: 700;
}

.function-response {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.function-response label {
  position: relative;
}
.function-response input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.function-response span {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}
.function-response label:hover span {
  border-color: var(--accent-secondary);
}
.function-response input:focus-visible + span {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}
.function-response input:checked + span {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--on-accent);
}

.optional-statements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.short-textarea {
  min-height: 110px;
}

.isas-summary {
  margin-bottom: 16px;
}

/* Display function scores and their visual bars. */
.function-scores {
  display: grid;
  gap: 8px;
}
/* One function score row with its label, bar, and numeric result. */
.score-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr 56px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.score-name {
  font-weight: 700;
}
.score-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}
.score-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent-primary);
}
.score-value {
  text-align: right;
  font-weight: 700;
}

.score-row.score-0 {
  border-color: #4a7b58;
}
.score-row.score-1 {
  border-color: #73964b;
}
.score-row.score-2 {
  border-color: #a8943a;
}
.score-row.score-3 {
  border-color: #b57836;
}
.score-row.score-4 {
  border-color: #bc5f43;
}
.score-row.score-5 {
  border-color: #c74f55;
}
.score-row.score-6 {
  border-color: #e33f63;
}

.ranked-functions {
  display: grid;
  gap: 9px;
}
.ranked-function {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.ranked-function strong {
  color: var(--accent-primary);
}
.ranked-function p {
  margin: 5px 0 0;
  color: var(--muted-text);
  line-height: 1.4;
}

/* Smaller-screen adjustments: reduce columns and spacing to fit the available width. */
@media (max-width: 850px) {
  .optional-statements {
    grid-template-columns: 1fr;
  }
  .function-item {
    grid-template-columns: 1fr;
  }
}

/* Smaller-screen adjustments: reduce columns and spacing to fit the available width. */
@media (max-width: 620px) {
  .behavior-row,
  .other-behavior-row {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .score-row {
    grid-template-columns: 1fr 58px;
  }
  .score-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .score-value {
    grid-column: 2;
    grid-row: 1;
  }
}
