/*
 * The single hand-written stylesheet for the learner surface (ADR-005: no CSS framework).
 *
 * Mobile-first: the rules below are written for a phone held at the till, and one
 * min-width query widens the layout on larger screens. Sizes are in rem so the page
 * respects the reader's own text size; nothing is pinned in px that a learner might need
 * to enlarge.
 *
 * NFR-05 (WCAG 2.1 AA, mobile-first) is the target. What this file does on purpose:
 * text and background stay near-black on near-white, focus is always visible and never
 * removed, tap targets are at least 44px high, and no colour is the only carrier of
 * meaning (right/wrong feedback carries a word as well as a tint). Full AA conformance
 * is not claimed here — see the accessibility note in the pull request.
 */

:root {
  --ink: #16181d;
  --ink-soft: #40454f;
  --paper: #ffffff;
  --paper-soft: #f2f3f5;
  --line: #9aa0aa;
  --accent: #0b4f8a;
  --accent-ink: #ffffff;
  --right: #10552f;
  --right-bg: #e6f2e9;
  --wrong: #8a1420;
  --wrong-bg: #fbeaec;
  --radius: 0.375rem;
}

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

html {
  font-size: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

/* Skip link: off-screen until focused, then pinned to the top-left. */
.skip {
  position: absolute;
  left: -100vw;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  z-index: 10;
}

.skip:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.chrome {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1rem;
}

footer.chrome {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.875rem;
  margin-top: 2rem;
}

.brand {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.chrome-nav a {
  display: inline-block;
  margin-right: 1rem;
  padding: 0.25rem 0;
  color: var(--accent);
}

.chrome-nav a[aria-current="true"] {
  font-weight: 600;
  text-decoration: none;
}

main {
  display: block;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0.5rem 0 1rem;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

h3 {
  font-size: 1.0625rem;
  margin: 0 0 0.25rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--accent);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
}

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

.module-list li {
  border-bottom: 1px solid var(--line);
}

.module-list a {
  display: block;
  padding: 0.875rem 0.25rem;
  min-height: 2.75rem;
}

.module-name {
  color: var(--ink-soft);
  font-weight: 600;
}

.field {
  margin: 0 0 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.hint {
  color: var(--ink-soft);
  font-size: 0.875rem;
  margin: 0 0 0.25rem;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

fieldset {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
}

legend {
  padding: 0;
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.4;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--paper-soft);
}

.choice input[type="radio"] {
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.125rem 0 0;
  flex: 0 0 auto;
}

.choice label {
  /* The label is the tap target as well as the name of the control. */
  min-height: 1.75rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin: 1rem 0 0;
}

input[type="submit"],
button {
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: var(--paper);
  color: var(--accent);
}

/* The sign-out control in the footer: a form control that reads as a quiet link. */
input[type="submit"].quiet {
  background: var(--paper);
  border-color: var(--line);
  color: var(--accent);
  font-weight: 400;
  padding: 0.5rem 0.75rem;
}

button:disabled,
input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}

.cta {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}

.notice {
  border-left: 4px solid var(--line);
  background: var(--paper);
  padding: 0.75rem;
  margin: 0 0 1rem;
}

.notice-error {
  border-left-color: var(--wrong);
  background: var(--wrong-bg);
  color: var(--wrong);
}

.notice-ok {
  border-left-color: var(--right);
  background: var(--right-bg);
  color: var(--right);
}

.feedback {
  border-left: 4px solid var(--line);
  padding: 0.75rem;
  margin: 1rem 0 0;
}

.feedback .verdict {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feedback-right {
  border-left-color: var(--right);
  background: var(--right-bg);
}

.feedback-wrong {
  border-left-color: var(--wrong);
  background: var(--wrong-bg);
}

.secret-value {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  word-break: break-all;
  background: var(--paper-soft);
  padding: 0.5rem;
  border-radius: var(--radius);
}

[hidden] {
  display: none !important;
}

@media (min-width: 40rem) {
  main {
    padding: 2rem 1.5rem 3rem;
  }

  h1 {
    font-size: 1.875rem;
  }

  .actions {
    flex-direction: row;
    align-items: center;
  }
}

/*
 * Administrator pages (lane 29). Tables are plain: a caption, column headers, no colour as the
 * only carrier of meaning. Wide tables scroll inside their own box rather than the page.
 */
table.data {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  background: var(--paper);
  margin: 1rem 0;
}

table.data caption {
  text-align: left;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

table.data th,
table.data td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

table.data th {
  background: var(--paper-soft);
}

form.inline {
  display: inline;
  margin: 0 0 0 0.5rem;
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

nav.tabs a {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

nav.tabs a[aria-current="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

fieldset {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
