/*
 * Minimal, dependency-free stylesheet.
 *
 * This is a secure core, not a design system - the application built on it will
 * bring its own skin. What is here is the accessibility floor the kit treats as
 * a quality bar rather than a nicety (stacks/static-site/LAYOUT.md):
 * visible focus, AA contrast, real form labels, 44px touch targets.
 *
 * Every colour pair below has been COMPUTED against WCAG AA, not eyeballed.
 * The ratios are recorded in docs/ACCESSIBILITY.md; re-run that check if you
 * change a token. Note .btn-quiet sets an explicit background even though it is
 * transparent - a button with no background lets the browser's ButtonFace
 * default bleed through, which has shipped a near-invisible button twice on
 * other builds in this kit.
 */

:root {
  --ink: #16191d;
  --ink-quiet: #4a5058;
  --paper: #ffffff;
  --paper-alt: #f4f6f8;
  /* Two border tokens, because WCAG treats them differently:
     --line is decorative (table rules, section dividers) and has no minimum;
     --line-strong bounds an INTERACTIVE control and must clear 3:1 against both
     surfaces it sits on (1.4.11 Non-text Contrast). The first draft used --line
     for input borders and measured 1.53:1 - a real failure the computed check
     caught and the eye did not. */
  --line: #cbd2d9;
  --line-strong: #7d8791;   /* 3.65:1 on paper, 3.37:1 on paper-alt */
  --brand: #0b4f9c;
  --brand-dark: #08386e;
  --warn-bg: #fff4e0;
  --warn-ink: #6b4300;
  --error-bg: #fdeceb;
  --error-ink: #8a1c14;
  --ok-bg: #e8f5ec;
  --ok-ink: #14562b;
  --radius: 6px;
  --wrap: 44rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Skip link: present for keyboard users, out of the way for everyone else.
   It must be the first focusable element on the page. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 0; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper-alt);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.site-header nav { display: flex; align-items: center; gap: 1rem; }
.who { color: var(--ink-quiet); }
.inline-form { display: inline; margin: 0; }

main { padding: 2rem 1.25rem 3rem; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 0.75rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
p { margin: 0 0 1rem; }
.hint { color: var(--ink-quiet); }

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* Never remove the outline - style it. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

form.stack label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
form.stack p { margin: 0 0 1.1rem; }
form.stack input[type="text"],
form.stack input[type="email"],
form.stack input[type="password"],
form.stack select {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
form.stack .helptext, form.stack ul.errorlist {
  display: block;
  margin: 0.3rem 0 0;
  padding: 0;
  font-size: 0.9rem;
}
form.stack .helptext { color: var(--ink-quiet); }
form.stack ul.errorlist { list-style: none; color: var(--error-ink); }

.btn {
  display: inline-block;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);   /* explicit, always */
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--paper); }

.btn-quiet {
  background: transparent;    /* explicit: stops the UA ButtonFace default showing through */
  border-color: var(--line-strong);
  color: var(--brand);
}
.btn-quiet:hover { background: var(--paper-alt); color: var(--brand-dark); }

.flash {
  border-left: 4px solid;
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.flash-info, .flash-debug { background: var(--paper-alt); border-color: var(--brand); color: var(--ink); }
.flash-success { background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.flash-warning { background: var(--warn-bg); border-color: var(--warn-ink); color: var(--warn-ink); }
.flash-error { background: var(--error-bg); border-color: var(--error-ink); color: var(--error-ink); }

table { border-collapse: collapse; width: 100%; }
caption { text-align: left; color: var(--ink-quiet); padding-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0;
  color: var(--ink-quiet);
  font-size: 0.9rem;
}

/* Available to screen readers, invisible on screen. Not display:none, which
   removes it from the accessibility tree along with everything else. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The idle veil. Covers the viewport so nothing previously displayed remains
   visible once the session has ended (requirement 28). */
#session-veil {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#session-veil[hidden] { display: none; }
.veil-card { text-align: center; max-width: 28rem; padding: 2rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
