/* =====================================================================
   Martyn's Law Self-Assessment / workbook styling.

   Shares its typeface and palette with the public website (assets/css/site.css)
   so moving between the marketing pages and the application does not feel like
   crossing into a different product. Inter is self-hosted — the same file the
   website preloads — so app pages make no third-party font request either.
   ===================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/InterVariable-latin.woff2") format("woff2");
}

:root {
  /* Martyn's Law Workbook brand — blue palette. Green/red are kept below for
     STATUS meaning only (complete = green, out-of-scope / error = red). */
  --ml-primary:       #6fabd9;   /* Steel Blue — soft/decorative accent (light) */
  --ml-primary-dark:  #3e6a93;   /* Slate Blue */
  --ml-primary-soft:  #e9eef5;   /* Light Gray-blue — soft fills */
  /* Accessible brand blue for anything with text on it, link text, and UI
     indicators (focus rings, control borders): Slate Blue is 5.6:1 on white,
     Navy ~15:1 → WCAG 2.2 AA. (Var name kept for compatibility.) */
  --ml-green-strong:      #3e6a93;   /* Slate Blue — buttons / links / focus */
  --ml-green-strong-dark: #17324D;   /* Navy — hover / dark (matches the website) */
  --ml-ink:           #17324D;   /* Navy — headings, matching the website */
  --ml-muted:         #5F6B73;   /* Secondary text, matching the website */
  --ml-border:        #DCE4EE;   /* Blue-grey border, matching the website */
  --ml-oos-bg:        #fde6e6;
  --ml-oos-ink:       #8a1f1f;
  --ml-std-bg:        #e2f0ff;
  --ml-std-ink:       #0b3d7a;
  --ml-enh-bg:        #e6f4ea;
  --ml-enh-ink:       #145c30;
}

body.ml-body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  color: #263238;
  background: #F7F9FB;
  margin: 0;
  line-height: 1.6;
}

.ml-body h1, .ml-body h2, .ml-body h3, .ml-body h4 {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  color: var(--ml-ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ml-top {
  background: #fff;
  border-bottom: 1px solid var(--ml-border);
  padding: .9rem 0;
}
.ml-top .ml-brand {
  font-family: "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  color: var(--ml-ink);
  text-decoration: none;
  font-size: 1.05rem;
}
.ml-top .ml-brand .dot { color: var(--ml-primary); }
.ml-top nav a {
  color: var(--ml-muted);
  text-decoration: none;
  margin-left: 1.25rem;
  font-size: .95rem;
}
.ml-top nav a:hover { color: var(--ml-green-strong); }

.ml-wrap { max-width: 860px; margin: 0 auto; padding: 2rem 1rem 4rem; }

.ml-card {
  background: #fff;
  border: 1px solid var(--ml-border);
  border-radius: 10px;
  padding: 1.75rem;
  margin: 1.25rem 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.ml-progress { margin-bottom: 1.5rem; }
.ml-progress-bar {
  background: var(--ml-border);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.ml-progress-bar > span {
  display: block;
  height: 100%;
  background: var(--ml-green-strong);
  transition: width .3s ease;
}
.ml-progress-text {
  font-size: .85rem;
  color: var(--ml-muted);
  margin-top: .35rem;
}

.ml-question {
  font-size: 1.35rem;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  color: var(--ml-ink);
  margin-bottom: .75rem;
}
.ml-help {
  color: var(--ml-muted);
  font-size: .95rem;
  margin-bottom: 1.25rem;
  padding: .75rem 1rem;
  background: var(--ml-primary-soft);
  border-left: 4px solid var(--ml-primary);
  border-radius: 4px;
}

/* "Not yet in force" notice – informational amber banner. */
.ml-notice {
  color: #7a5200;
  background: #fff6e0;
  border-left: 4px solid #e0a300;
  border-radius: 4px;
  padding: .75rem 1rem;
  font-size: .95rem;
  margin: 0 0 1.25rem;
}
.ml-notice strong { color: #6b4700; }

.ml-choices { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0 1.5rem; }
.ml-choice {
  /* Behave as a full-width card whether rendered as <label> or <button>. */
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 1rem 1.15rem;
  border: 1px solid var(--ml-border);
  border-radius: 10px;
  background: #f6f8fc;        /* very soft off-white with a hint of blue */
  color: var(--ml-ink);
  font: inherit;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
  transition: all .15s ease;
  /* Reset the default iOS/Android button chrome so these aren't painted
     as system-blue buttons on mobile. */
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.ml-choice:hover { border-color: var(--ml-green-strong); background: #eaf1fb; }
.ml-choice:focus-visible {
  border-color: var(--ml-green-strong); background: #eaf1fb;
  outline: 3px solid var(--ml-green-strong); outline-offset: 2px;
}
.ml-choice input {
  position: absolute;
  opacity: 0;
}
.ml-choice.selected,
.ml-choice:has(input:checked) {
  border-color: var(--ml-green-strong);
  box-shadow: inset 0 0 0 1px var(--ml-green-strong);
  background: var(--ml-primary-soft);
  color: var(--ml-ink);
}
/* Title sits on its own line, bold, with a clear gap above the description. */
.ml-choice strong {
  display: block;
  margin: 0 0 .35rem 0;
  font-family: "Montserrat", "Open Sans", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ml-ink);
}
.ml-choice-desc {
  display: block;
  color: var(--ml-muted);
  font-weight: 400;
  font-size: .95rem;
}

.ml-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }

.btn-arx,
.ml-body .btn-primary {
  background: var(--ml-green-strong);
  border-color: var(--ml-green-strong);
  color: #fff;
  padding: .6rem 1.4rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  border: 2px solid var(--ml-green-strong);
  cursor: pointer;
}
.btn-arx:hover,
.ml-body .btn-primary:hover {
  background: var(--ml-green-strong-dark);
  border-color: var(--ml-green-strong-dark);
  color: #fff;
}
.btn-arx-outline {
  background: #fff;
  color: var(--ml-ink);
  border: 2px solid var(--ml-border);
  padding: .6rem 1.4rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.btn-arx-outline:hover { border-color: var(--ml-green-strong); color: var(--ml-green-strong); }

.ml-field { margin: 1rem 0; }
.ml-field label { display: block; font-weight: 600; color: var(--ml-ink); margin-bottom: .35rem; }
.ml-field input, .ml-field textarea, .ml-field select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid #8a8f86;   /* 3.3:1 on white → visible control boundary (1.4.11) */
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.ml-field input:focus, .ml-field textarea:focus, .ml-field select:focus {
  outline: 2px solid var(--ml-green-strong);
  outline-offset: 1px;
  border-color: var(--ml-green-strong);
}
/* Small helper line beneath a field (not the boxed .ml-help callout). */
.ml-fieldhint {
  display: block;
  margin-top: .35rem;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--ml-muted);
}

.ml-result {
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  margin: 1.5rem 0;
  font-size: 1.05rem;
}
.ml-result h2 { margin-top: 0; }
.ml-result.oos { background: var(--ml-oos-bg); color: var(--ml-oos-ink); border-left: 6px solid #c62828; }
.ml-result.oos h2 { color: var(--ml-oos-ink); }
.ml-result.std { background: var(--ml-std-bg); color: var(--ml-std-ink); border-left: 6px solid #1565c0; }
.ml-result.std h2 { color: var(--ml-std-ink); }
.ml-result.enh { background: var(--ml-enh-bg); color: var(--ml-enh-ink); border-left: 6px solid #2e7d32; }
.ml-result.enh h2 { color: var(--ml-enh-ink); }

.ml-badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.ml-badge.oos { background: var(--ml-oos-bg); color: var(--ml-oos-ink); }
.ml-badge.std { background: var(--ml-std-bg); color: var(--ml-std-ink); }
.ml-badge.enh { background: var(--ml-enh-bg); color: var(--ml-enh-ink); }
.ml-badge.unk { background: #eee; color: #555; }

.ml-errors {
  background: var(--ml-oos-bg);
  color: var(--ml-oos-ink);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.ml-table { width: 100%; border-collapse: collapse; background: #fff; margin-top: 1rem; }
.ml-table th, .ml-table td { padding: .55rem .8rem; text-align: left; border-bottom: 1px solid var(--ml-border); vertical-align: middle; }
.ml-table th { background: #f3f6f1; color: var(--ml-ink); font-weight: 600; }
.ml-table td.ml-nowrap, .ml-table th.ml-nowrap { white-space: nowrap; }
.ml-table td.ml-num { font-variant-numeric: tabular-nums; color: var(--ml-muted); }

footer.ml-foot {
  color: var(--ml-muted);
  font-size: .85rem;
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--ml-border);
  background: #fff;
}
footer.ml-foot a { color: var(--ml-green-strong); }

/* ---------------------------------------------------------------------
   Info "i" icon next to a question, and the modal popup it opens.
   --------------------------------------------------------------------- */
.ml-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  margin-left: .4rem;
  padding: 0;
  vertical-align: middle;
  background: var(--ml-green-strong);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.ml-info-btn:hover { background: var(--ml-green-strong-dark); transform: scale(1.08); }
.ml-info-btn:focus-visible { outline: 3px solid var(--ml-green-strong); outline-offset: 2px; }

.ml-help-more {
  color: var(--ml-green-strong);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.ml-help-more:hover { text-decoration: underline; }

.ml-modal[hidden] { display: none; }
.ml-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.ml-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 20, .55);
  backdrop-filter: blur(2px);
}
.ml-modal-dialog {
  position: relative;
  background: #fff;
  max-width: 640px;
  width: 100%;
  max-height: calc(100vh - 2.5rem);
  overflow: auto;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  padding: 1.75rem 1.75rem 1.25rem;
  border-top: 6px solid var(--ml-primary);
}
.ml-modal-close {
  position: absolute;
  top: .5rem;
  right: .75rem;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ml-muted);
  cursor: pointer;
  border-radius: 50%;
}
.ml-modal-close:hover { color: var(--ml-ink); background: #f1f3ef; }

.ml-modal-body h3 {
  font-family: "Montserrat", sans-serif;
  color: var(--ml-ink);
  margin: 0 0 .5rem;
}
.ml-modal-body p { color: #444; margin: .5rem 0; }
.ml-modal-body ul,
.ml-modal-body ol { color: #444; padding-left: 1.25rem; margin: .5rem 0 .75rem; }
.ml-modal-body li { margin-bottom: .25rem; }
.ml-modal-body blockquote {
  margin: .75rem 0;
  padding: .75rem 1rem;
  border-left: 4px solid var(--ml-primary);
  background: var(--ml-primary-soft);
  color: var(--ml-ink);
  border-radius: 0 6px 6px 0;
}
.ml-modal-body blockquote p { margin: .25rem 0; }
.ml-modal-body a { color: var(--ml-green-strong); font-weight: 600; }

.ml-modal-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

body.ml-modal-open { overflow: hidden; }

/* Print stylesheet for the PDF report */
@media print {
  body.ml-body { background: #fff; }
  .ml-top, footer.ml-foot, .ml-no-print, .ml-modal, .ml-info-btn { display: none !important; }
  .ml-wrap { max-width: none; padding: 0; }
  .ml-card { border: none; box-shadow: none; padding: 0; }
}

/* Consistent, high-contrast keyboard focus indicator across the app
   (WCAG 2.2 — 2.4.7 Focus Visible, 1.4.11 Non-text Contrast). Mouse users
   don't see it (:focus-visible); it never removes focus styling. */
a:focus-visible,
button:focus-visible,
.btn-arx:focus-visible,
.btn-arx-outline:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--ml-green-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Neutralise the browser's yellow autofill background so filled fields
   match the app's field styling (login, sign-in, forms). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--ml-ink);
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
          box-shadow: 0 0 0 1000px #fff inset;
  caret-color: var(--ml-ink);
  transition: background-color 9999s ease-in-out 0s;
}

/* Form controls size within their container (no overflow); makes width:100%
   line up field edges. */
.ml-field input, .ml-field textarea, .ml-field select { box-sizing: border-box; } /* ml-field controls */
