/* ---------------------------------------------------------------------------
   Dynapt Assessment — Brand Book v2 palette
   Blue #142554 · Green #32B44A · Highlight #80C342 · Gray #BABFBE
   Subtitle Blue #2D6380 · Body #333333
--------------------------------------------------------------------------- */

:root {
  --dynapt-blue: #142554;
  --dynapt-green: #32b44a;
  --dynapt-highlight: #80c342;
  --dynapt-gray: #babfbe;
  --subtitle-blue: #2d6380;
  --body: #333333;

  --surface: #ffffff;
  --canvas: #f5f6f8;
  --stripe: #f2f2f2;
  --border: #d9dce2;
  --border-strong: #b6bcc7;
  --muted: #5c6472;

  --danger: #b3261e;
  --danger-bg: #fdecea;
  --success: #1e7b32;

  --radius: 8px;
  --shadow-sm: 0 1px 2px rgb(20 37 84 / 8%);
  --shadow-md: 0 4px 16px rgb(20 37 84 / 10%);
  --font: Arial, "Helvetica Neue", Helvetica, sans-serif;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--body);
  background: var(--canvas);
}

h1,
h2,
h3 {
  font-weight: 700;
  color: var(--dynapt-blue);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--subtitle-blue);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--subtitle-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--dynapt-blue);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* --- Layout -------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 4px solid var(--dynapt-green);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  height: 40px;
  width: auto;
}

.site-header__meta {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: right;
}

.site-header__meta strong {
  color: var(--dynapt-blue);
  display: block;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  margin-bottom: 1.5rem;
}

.card--narrow {
  max-width: 520px;
  margin-inline: auto;
}

.lede {
  color: var(--subtitle-blue);
  font-style: italic;
  margin-top: -0.25rem;
}

.meta-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}
.meta-list li {
  padding: 0.25rem 0 0.25rem 1.25rem;
  position: relative;
}
.meta-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--dynapt-green);
}

/* --- Form fields --------------------------------------------------------- */

.field {
  margin-bottom: 1.25rem;
}

.field > label {
  display: block;
  font-weight: 700;
  color: var(--dynapt-blue);
  margin-bottom: 0.35rem;
}

.field__hint {
  display: block;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  font: inherit;
  color: var(--body);
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:hover,
input[type="email"]:hover {
  border-color: var(--subtitle-blue);
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--dynapt-blue);
  box-shadow: 0 0 0 3px rgb(45 99 128 / 25%);
}

/* Error state only after the user has interacted, per :user-invalid. */
input:user-invalid,
input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
}

input:user-invalid ~ .error-msg,
input.is-invalid ~ .error-msg,
.error-msg.is-shown {
  display: flex;
}

.error-msg {
  display: none;
  gap: 0.4rem;
  align-items: flex-start;
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.35rem;
  font-weight: 700;
}

.error-msg::before {
  content: "!";
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.15em;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background: var(--dynapt-blue);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: #1c3272;
}

.btn--secondary {
  background: transparent;
  color: var(--dynapt-blue);
  border-color: var(--border-strong);
}
.btn--secondary:hover:not(:disabled) {
  border-color: var(--dynapt-blue);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--block {
  display: block;
  width: 100%;
}

/* --- Alerts -------------------------------------------------------------- */

.alert {
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  border-left: 4px solid;
}

.alert:empty {
  display: none;
}

.alert--error {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #7a1b15;
}

.alert--info {
  background: #eef4f7;
  border-color: var(--subtitle-blue);
  color: #22485c;
}

.alert--success {
  background: #eaf7ec;
  border-color: var(--dynapt-green);
  color: #16601f;
}

/* --- Assessment ---------------------------------------------------------- */

.progress {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.progress__inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.progress__bar {
  flex: 1;
  height: 8px;
  background: var(--stripe);
  border-radius: 99px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--dynapt-green);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.part {
  margin-bottom: 2.5rem;
}

.part__header {
  border-left: 5px solid var(--dynapt-green);
  padding: 0.25rem 0 0.25rem 0.9rem;
  margin-bottom: 1.5rem;
}

.part__header h2 {
  margin: 0;
}

.part__instructions {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0.35rem 0 0;
}

.question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  scroll-margin-top: 5rem;
}

.question.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-bg);
}

.question__legend {
  margin-bottom: 0.85rem;
}

.question__title {
  display: flex;
  gap: 0.25rem;
  align-items: baseline;
}

.question__number {
  display: inline-block;
  min-width: 2.25rem;
  font-weight: 700;
  color: var(--dynapt-green);
}

.question__heading {
  font-weight: 700;
  color: var(--dynapt-blue);
}

.question__scenario {
  white-space: pre-line;
  color: var(--body);
  background: var(--stripe);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin: 0.65rem 0;
  font-size: 0.9375rem;
}

.question__prompt {
  font-weight: 700;
  color: var(--dynapt-blue);
  margin: 0.5rem 0 0;
}

.question__rule {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.question__rule[data-state="ok"] {
  color: var(--success);
  font-weight: 700;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.options {
  display: grid;
  gap: 0.4rem;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.option:hover {
  border-color: var(--subtitle-blue);
  background: #fafbfc;
}

.option:has(input:checked) {
  border-color: var(--dynapt-green);
  background: #f3fbf4;
}

.option:has(input:focus-visible) {
  outline: 3px solid var(--subtitle-blue);
  outline-offset: 2px;
}

.option input {
  margin: 0.25rem 0 0;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--dynapt-green);
  flex: 0 0 auto;
}

.option__key {
  font-weight: 700;
  color: var(--dynapt-blue);
  margin-right: 0.35rem;
}

/* Likert questions read better as a compact row on wide screens. */
.options--likert {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.options--likert .option {
  grid-template-columns: auto 1fr;
  font-size: 0.9375rem;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  box-shadow: 0 -2px 12px rgb(20 37 84 / 8%);
}

.submit-bar__inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.submit-bar__status {
  font-size: 0.9375rem;
  color: var(--muted);
}

.site-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer .grecaptcha-note {
  margin: 0.5rem 0 0;
}

/* Hide the floating reCAPTCHA badge; the required attribution is in the
   footer text instead, per Google's branding guidance. */
.grecaptcha-badge {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .progress,
  .submit-bar,
  .btn {
    display: none;
  }
}
