/* Family Toolkit Survey Styles — Garnet Families Brand */


:root {
  /* Brand palette */
  --color-primary:        #8f001a;                  /* Garnet */
  --color-primary-dark:   #6b0013;                  /* Garnet hover */
  --color-primary-focus:  rgba(143, 0, 26, 0.12);   /* Focus ring */
  --color-dark:           #001725;                  /* Deep navy — headings, dark text */
  --color-cream:          #FEF8E6;                  /* Warm cream — page bg, accents */
  --color-cream-hover:    #f5edcc;                  /* Hover on cream surfaces */

  /* Success / status (warm sage, not jarring green) */
  --color-success:        #4a7c3f;
  --color-success-bg:     #edf3ea;
  --color-success-border: #b2ccac;

  /* Neutrals */
  --color-text:           #313131;
  --color-text-muted:     #666;
  --color-text-light:     #888;
  --color-border:         #ddd5c4;                  /* Warm-tinted border */
  --color-bg-subtle:      #f9f4ec;                  /* Subtle warm tint for sections */
  --color-white:          #ffffff;

  /* Shape */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 9999px;

  /* Shadow */
  --shadow-card: 0 2px 16px rgba(0, 23, 37, 0.1);
  --shadow-hover: 0 4px 12px rgba(0, 23, 37, 0.14);
}

* {
  box-sizing: border-box;
}

/* ── Skip Navigation Link (WCAG 2.4.1) ──────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.5rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Screen-reader-only utility */
.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;
}

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: transparent;
  margin: 0;
  padding: 0;
}

.survey-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--color-white);
  padding: 30px 40px;
}

/* ── Intro Section ───────────────────────────────────── */

.intro-section {
  text-align: center;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.intro-section h1 {
  color: var(--color-dark);
  font-size: 1.8em;
  font-weight: 700;
  margin-bottom: 15px;
}

.intro-section p {
  color: var(--color-text-muted);
  font-size: 1em;
}

/* ── Question Sections ───────────────────────────────── */

.question-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.question-section.section-header {
  border-bottom: none;
  padding-bottom: 0;
}

.question-label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
  font-size: 1.05em;
}

.question-number {
  color: var(--color-primary);
  font-weight: 700;
}

/* ── Text Inputs ─────────────────────────────────────── */

.text-input,
.text-area {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1em;
  font-family: inherit;
  background: var(--color-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.text-area {
  resize: vertical;
  min-height: 100px;
}

/* ── Likert Matrix ───────────────────────────────────── */

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

.likert-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.likert-matrix th,
.likert-matrix td {
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--color-border);
}

.likert-matrix thead th {
  background: var(--color-cream);
  font-weight: 700;
  color: var(--color-dark);
  font-size: 0.85em;
}

.likert-matrix .statement-header {
  width: 30%;
}

.likert-matrix .statement {
  text-align: left;
  font-weight: 500;
  background: var(--color-bg-subtle);
}

.likert-matrix tbody tr:hover {
  background: var(--color-cream-hover);
}

/* Make the entire matrix cell tappable: hide the native radio, stretch it
   to fill the cell, and render a custom circle via ::after. Cells with a
   radio get min-height 44px (WCAG 2.5.5) and pointer cursor. */
.likert-matrix td:has(> input[type="radio"]) {
  position: relative;
  padding: 0;
  min-height: 44px;
  height: 44px;
  cursor: pointer;
}

.likert-matrix input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.likert-matrix td:has(> input[type="radio"])::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-text-light);
  border-radius: 50%;
  background: var(--color-white);
  pointer-events: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.likert-matrix td:has(> input[type="radio"]:checked)::after {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 4px var(--color-primary);
}

.likert-matrix td:has(> input[type="radio"]:focus-visible)::after {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.likert-matrix td:has(> input[type="radio"]):hover {
  background: var(--color-cream-hover);
}

/* ── Checkbox Group ──────────────────────────────────── */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}

.checkbox-item:hover {
  background: var(--color-cream-hover);
}

.conditional-field {
  margin-left: 30px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.conditional-field label {
  display: block;
  font-size: 0.9rem;
  color: var(--color-text-secondary, #555);
  margin-bottom: 4px;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ── Radio Group ──────────────────────────────────── */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radio-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  min-height: 44px;
}

.radio-item:hover {
  background: var(--color-cream-hover);
}

.radio-item input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ── Ranking List ────────────────────────────────────── */

.rank-container {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  padding: 15px;
}

.rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Fixed slot row — never moves; holds the position label + a draggable card */
.rank-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

/* Position label — anchored to the slot, not the card */
.rank-slot-number {
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9em;
  flex-shrink: 0;
}

/* Draggable card — moves between slots */
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding: 12px 15px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: box-shadow 0.2s;
}

.rank-item:hover {
  box-shadow: var(--shadow-hover);
}

.rank-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

/* Keyboard-grabbed state — visible indicator that this card is "held" */
.rank-item.keyboard-grabbed {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(143, 0, 26, 0.25);
  cursor: grabbing;
}

/* Highlight the target slot while a card is being dragged over it */
.rank-slot.drag-over .rank-item {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(143, 0, 26, 0.15);
}

.rank-text {
  flex: 1;
  font-size: 0.95em;
}

.rank-handle {
  color: var(--color-text-light);
  font-size: 1.2em;
  cursor: grab;
}

/* ── Submit Section ──────────────────────────────────── */

.submit-section {
  text-align: center;
  border-bottom: none;
  padding-top: 20px;
}

.submit-btn {
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  padding: 15px 40px;
  font-size: 1.1em;
  font-weight: 700;
  border-radius: var(--radius-pill);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.1s;
}

.submit-btn:hover {
  background: var(--color-primary-dark);
}

.submit-btn:active {
  transform: scale(0.98);
}

/* ── Recommendations Section ─────────────────────────── */

.recommendations-section {
  padding-top: 20px;
}

.recommendations-section h2 {
  color: var(--color-dark);
  text-align: center;
  font-weight: 700;
  margin-bottom: 30px;
}

.recommendation {
  margin-bottom: 20px;
}


/* Recommendation Cards */
.rec-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
}

.rec-card__header {
  margin-bottom: 14px;
}

.rec-card__tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-white);
  background-color: var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-bottom: 10px;
}

.rec-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 6px 0 0;
  color: var(--color-dark);
}

.rec-card__description {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--color-text-muted);
  margin: 0 0 16px;
}

.rec-card__highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rec-card__highlights li {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding-left: 22px;
  position: relative;
}

.rec-card__highlights li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

.rec-card__cta {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  transition: background 0.2s, color 0.2s;
}

.rec-card__cta:hover {
  background: var(--color-primary);
  color: var(--color-white);
}


.thank-you {
  text-align: center;
  margin-bottom: 30px;
  padding: 0;
  background: #ffffff;
  color: #000000;
}

.thank-you h3 {
  color: #000000;
  font-weight: 700;
  margin-bottom: 15px;
}

.thank-you p {
  color: #000000;
}

.thank-you a {
  color: var(--color-primary);
}

.download-btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 30px auto 0;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  padding: 12px 30px;
  font-size: 1em;
  font-weight: 700;
  border-radius: var(--radius-pill);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.2s;
}

.download-btn:hover {
  background: var(--color-primary-dark);
}

/* ── LTI Status Messages ─────────────────────────────── */

.lti-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: #2e5e25;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 500;
}

.lti-info {
  background: var(--color-cream);
  border: 1px solid var(--color-border);
  color: var(--color-dark);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 500;
}

.demographics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 15px 0;
}

.demo-field {
  display: flex;
  flex-direction: column;
}

.demo-field label {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  font-size: 0.95em;
}

.demo-select {
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95em;
  font-family: inherit;
  background: var(--color-white);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.demo-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.demo-note {
  color: var(--color-text-light);
  font-size: 0.85em;
  margin-top: 12px;
}

/* ── Feedback Section ────────────────────────────────── */

.feedback-section {
  background: var(--color-cream);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 25px;
}

.feedback-section h3 {
  color: var(--color-dark);
  margin-top: 0;
  margin-bottom: 12px;
  font-weight: 700;
}

.feedback-section > p {
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.feedback-field {
  margin-bottom: 20px;
}

.feedback-field label {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 10px;
  font-size: 0.95em;
}

.rating-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.rating-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95em;
}

.rating-item input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.submit-feedback-btn {
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  padding: 12px 30px;
  font-size: 1em;
  font-weight: 700;
  border-radius: var(--radius-pill);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.1s;
}

.submit-feedback-btn:hover {
  background: var(--color-primary-dark);
}

.submit-feedback-btn:active {
  transform: scale(0.98);
}

.feedback-thanks {
  color: var(--color-success);
  font-weight: 600;
  margin-top: 15px;
}

/* ── Focus Visible Rings (WCAG 2.4.7) ───────────────────── */

.rec-card__cta:focus-visible,
.submit-btn:focus-visible,
.download-btn:focus-visible,
.submit-feedback-btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* Radio and checkbox focus rings — the default browser outline is often
   suppressed by accent-color; ensure a visible garnet ring appears */
input[type="radio"]:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Rank item keyboard focus (also used by keyboard DnD — see C1) */
.rank-item:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── Touch Target Improvements (WCAG 2.5.5) ─────────────── */

/* Extend the clickable area of each choice label row to ≥ 44 px */
.checkbox-item {
  min-height: 44px;
}

/* Rating labels (feedback section) */
.rating-item {
  min-height: 44px;
  padding: 4px 0;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
  .survey-container {
    padding: 20px;
  }

  .likert-matrix {
    font-size: 0.8em;
  }

  .likert-matrix th,
  .likert-matrix td {
    padding: 8px 4px;
  }

  .likert-matrix .statement {
    min-width: 150px;
  }

  .demographics-grid {
    grid-template-columns: 1fr;
  }

  .rating-group {
    flex-direction: column;
    gap: 10px;
  }
}

/* Validation */
.question-section--error {
  border-left: 3px solid #c0392b;
  padding-left: 0.75rem;
}
.field-error {
  color: #c0392b;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

