/* Questionnaire hub — PageTap */

.q-hub[hidden],
.q-form-section[hidden] {
  display: none !important;
}

/* ── Hub layout ── */
.q-hub {
  min-height: calc(100vh - 76px);
  display: grid;
  align-items: center;
  padding: 80px 6vw 100px;
}

.q-hub-inner {
  max-width: 680px;
}

.q-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.q-eyebrow span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
}

.q-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.04em;
  margin: 0 0 18px;
  color: var(--ink);
}

.q-subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 520px;
  margin: 0;
}

/* ── Card grid ── */
.q-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 48px;
}

.q-card {
  display: block;
  padding: 28px 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
  cursor: pointer;
}

.q-card:hover,
.q-card:focus-visible {
  border-color: var(--purple);
  box-shadow: 0 4px 20px rgba(101, 87, 232, .10);
  outline: none;
}

.q-card:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

.q-card-label {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  font-weight: 500;
  margin: 0 0 6px;
  letter-spacing: -.02em;
}

.q-card-version {
  font-size: .68rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  margin: 0 0 10px;
  letter-spacing: .03em;
}

.q-card-summary {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.q-card-sections {
  font-size: .72rem;
  color: var(--purple-dark);
  font-family: ui-monospace, monospace;
  margin-top: 14px;
  font-weight: 700;
}

/* ── Form section ── */
.q-form-section {
  padding: 40px 6vw 80px;
  min-height: calc(100vh - 76px);
}

.q-form-inner {
  max-width: 780px;
  margin: 0 auto;
}

.q-form-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.q-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 18px;
  transition: color .15s ease;
}

.q-back-btn:hover,
.q-back-btn:focus-visible {
  color: var(--purple-dark);
  outline: none;
}

.q-back-btn:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
  border-radius: 2px;
}

.q-form-title {
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -.03em;
}

.q-form-version {
  font-size: .72rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  margin: 0;
  letter-spacing: .03em;
}

/* ── Progress ── */
.q-progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  font-size: .75rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.q-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--paper-2);
  overflow: hidden;
}

.q-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--purple);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ── Section nav tabs ── */
.q-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.q-tab-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.q-tab-btn:hover {
  border-color: var(--purple);
  color: var(--ink);
}

.q-tab-btn[aria-selected="true"] {
  border-color: var(--purple);
  background: var(--purple);
  color: white;
}

.q-tab-btn:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

/* ── Section content ── */
.q-section {
  display: none;
  padding: 24px 0 12px;
}

.q-section.q-active {
  display: block;
}

.q-section-title {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 24px;
  color: var(--ink);
  letter-spacing: -.02em;
}

.q-field {
  margin-bottom: 28px;
}

.q-field label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.q-field label .q-required-mark {
  color: var(--purple-dark);
  font-weight: 800;
  margin-left: 2px;
}

.q-field .q-field-id {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  letter-spacing: .03em;
  margin-bottom: 8px;
}

.q-field input[type="text"],
.q-field textarea,
.q-field select {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: .92rem;
  font-family: inherit;
  line-height: 1.55;
  transition: border-color .15s ease;
}

.q-field input[type="text"]:focus,
.q-field textarea:focus,
.q-field select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(101, 87, 232, .10);
}

.q-field textarea {
  min-height: 120px;
  resize: vertical;
}

.q-field .q-field-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 4px;
}

.q-field .q-field-id-inline {
  font-size: .68rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  letter-spacing: .03em;
  margin-top: 4px;
}

/* Required error state */
.q-field input:invalid,
.q-field textarea:invalid,
.q-field select:invalid {
  border-color: var(--purple-dark);
}

/* ── Checkboxes ── */
.q-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.q-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  font-size: .88rem;
}

.q-checkbox-item:hover {
  border-color: var(--purple);
}

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

.q-checkbox-item input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

/* ── Navigation buttons ── */
.q-nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.q-nav-buttons .button {
  font-size: .82rem;
  padding: 10px 18px;
}

#q-prev { order: -1; }

/* ── Required field error ── */
.q-required-error {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff8f0;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 600;
}

.q-required-error[hidden] { display: none; }

/* ── Print (A4) ── */
@media print {
  @page {
    size: A4;
    margin: 18mm 16mm;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .q-back-btn,
  .q-section-nav,
  .q-nav-buttons,
  .q-progress-bar,
  .skip-link,
  #q-hub-section {
    display: none !important;
  }

  .q-form-header {
    display: block !important;
    margin: 0 0 18pt;
    padding: 0 0 10pt;
    border-bottom: 2px solid #111;
  }

  #q-form-section {
    display: block !important;
    padding: 0;
    min-height: auto;
  }

  .q-form-inner {
    max-width: 100%;
  }

  .q-form-title,
  .q-section-title,
  .q-field label {
    color: black;
  }

  .q-form-version {
    color: #444;
  }

  .q-section {
    display: block !important;
    page-break-inside: avoid;
    margin-bottom: 24pt;
    padding: 0;
  }

  .q-field {
    margin-bottom: 18pt;
    page-break-inside: avoid;
  }

  .q-field input[type="text"],
  .q-field textarea,
  .q-field select {
    border: none;
    border-bottom: 1px solid #999;
    border-radius: 0;
    background: transparent;
    padding: 4px 0;
    font-size: 11pt;
    color: black;
  }

  .q-field textarea {
    min-height: 60pt;
  }

  .q-checkbox-item {
    border: 1px solid #999;
    border-radius: 4px;
    font-size: 10pt;
  }

  .q-field-id,
  .q-field-id-inline {
    font-size: 8pt;
    color: #666;
  }

  .q-required-mark {
    color: #333;
  }

  .q-form-header h2 {
    font-size: 16pt;
  }
}

/* ── Narrow mobile ── */
@media (max-width: 640px) {
  .q-hub {
    padding: 60px 5vw 60px;
  }

  .q-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .q-card {
    padding: 20px 18px;
  }

  .q-form-section {
    padding: 24px 5vw 60px;
  }

  .q-form-inner {
    padding: 0;
  }

  .q-section-nav {
    gap: 4px;
  }

  .q-tab-btn {
    padding: 6px 10px;
    font-size: .72rem;
  }

  .q-field input[type="text"],
  .q-field textarea,
  .q-field select {
    font-size: 16px; /* Prevents iOS zoom */
  }

  .q-checkbox-group {
    grid-template-columns: 1fr;
  }

  .q-nav-buttons {
    flex-direction: column;
  }

  .q-nav-buttons .button {
    width: 100%;
    text-align: center;
  }

  #q-prev { order: 0; }
}

/* ── Keyboard focus visible ── */
@media (prefers-reduced-motion: reduce) {
  .q-progress-fill,
  .q-card,
  .q-tab-btn {
    transition: none;
  }
}
