/*
  Willo, Direction B "Willow ledger": tokens, base frame, header, footer and shared form styles.
  Redesign PR 1 (2026-11-17, branch eli-redesign-foundation). Loaded from templates/main.html
  after the Google Fonts stylesheet, the only stylesheet every page shares. Bootstrap and
  fixes.css were removed in the cleanup PR (branch eli-redesign-cleanup); the "Reset" section
  below keeps the element defaults the pages were built on.

  Rules for anyone editing this file:
  - Tokens are prefixed --w-. Components use w- class names; there is no framework underneath.
  - Page CSS lives in static/styles/pages/<group>.css, scoped by the page-<url name> class.
  - Nothing here may target #chart, .cba-board, .cba-plot, .cba-card, svg, rect or g: the step 5
    board and the results chart keep their geometry in their templates.
  - The PDF (results_pdf.html) does not load this file; its styles stay inline.
*/

/* ---------- Tokens ---------- */

:root {
  /* colour (contrast ratios beside each token; full table in the redesign previews README on draft PR #8) */
  --w-willow: #1E3A2A;       /* the frame: header, footer, primary buttons */
  --w-willow-2: #2C5440;     /* hover on green, links, focus ring */
  --w-willow-deep: #15291E;  /* pressed */
  --w-on-willow: #F4F7F2;    /* text on green, 11.47:1 */
  --w-leaf: #BFD9B0;         /* secondary text and outlines on green, 8.13:1 */
  --w-page: #FFFFFF;
  --w-strip: #E7EFE5;        /* instruction strips, success messages */
  --w-field: #F2F6F1;        /* field ground */
  --w-line: #D5DED6;         /* soft ledger rule */
  --w-field-rule: #5E6E62;   /* field bottom rule, 4.95:1 on the field */
  --w-ink: #18211B;
  --w-ink-2: #4D5A50;        /* secondary text, 7.26:1 on white */
  --w-advantage: #CFE8A9;    /* the method's lime green */
  --w-danger: #9B2C2C;       /* 7.53:1 on white */
  --w-danger-bg: #F7EBEA;
  --w-focus: #2C5440;

  /* type */
  --w-font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --w-font-body: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --w-t-sm: 0.875rem;
  --w-t-base: 1.0625rem;
  --w-t-md: 1.25rem;
  --w-t-lg: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --w-t-xl: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  --w-t-xxl: clamp(2rem, 1rem + 4.6vw, 4.75rem);

  /* space, 8px base */
  --w-s1: 8px;
  --w-s2: 12px;
  --w-s3: 16px;
  --w-s4: 24px;
  --w-s5: 40px;
  --w-s6: 64px;
  --w-s7: 96px;

  /* shape */
  --w-radius: 6px;
  --w-radius-field: 4px 4px 0 0;
  --w-tap: 48px;
  --w-tap-min: 44px;
  --w-page-max: 1160px;
  --w-measure: 66ch;

  /* rules and borders */
  --w-rule: 1px solid var(--w-line);           /* between ledger rows */
  --w-rule-strong: 2px solid var(--w-ink);     /* under a table head, between sections */
  --w-rule-total: 3px double var(--w-ink);     /* under totals */
  --w-border-btn: 1.5px solid var(--w-willow);
}

/* ---------- Reset ---------- */

/* The element defaults every page was built on, taken from Bootstrap 5.2.3's reboot
   (MIT licence, (c) The Bootstrap Authors) when Bootstrap was removed, with its variables
   written out. Change these only with before and after screenshots of every page. */

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

@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

hr { margin: 1rem 0; color: inherit; border: 0; border-top: 1px solid; opacity: 0.25; }

h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 0.5rem; font-weight: 500; line-height: 1.2; }
h1 { font-size: calc(1.375rem + 1.5vw); }
h2 { font-size: calc(1.325rem + 0.9vw); }
h3 { font-size: calc(1.3rem + 0.6vw); }
h4 { font-size: calc(1.275rem + 0.3vw); }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }
@media (min-width: 1200px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.75rem; }
  h4 { font-size: 1.5rem; }
}

p { margin-top: 0; margin-bottom: 1rem; }
abbr[title] { text-decoration: underline dotted; cursor: help; text-decoration-skip-ink: none; }
address { margin-bottom: 1rem; font-style: normal; line-height: inherit; }
ol, ul { padding-left: 2rem; }
ol, ul, dl { margin-top: 0; margin-bottom: 1rem; }
ol ol, ul ul, ol ul, ul ol { margin-bottom: 0; }
dt { font-weight: 700; }
dd { margin-bottom: 0.5rem; margin-left: 0; }
blockquote { margin: 0 0 1rem; }
b, strong { font-weight: bolder; }
small { font-size: 0.875em; }
mark { padding: 0.1875em; background-color: #fff3cd; }
sub, sup { position: relative; font-size: 0.75em; line-height: 0; vertical-align: baseline; }
sub { bottom: -0.25em; }
sup { top: -0.5em; }

a { text-decoration: underline; }
a:not([href]):not([class]), a:not([href]):not([class]):hover { color: inherit; text-decoration: none; }

pre, code, kbd, samp { font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 1em; }
pre { display: block; margin-top: 0; margin-bottom: 1rem; overflow: auto; font-size: 0.875em; }
code { font-size: 0.875em; color: #d63384; word-wrap: break-word; }
figure { margin: 0 0 1rem; }
img, svg { vertical-align: middle; }

table { caption-side: bottom; border-collapse: collapse; }
caption { padding-top: 0.5rem; padding-bottom: 0.5rem; color: #6c757d; text-align: left; }
th { text-align: inherit; text-align: -webkit-match-parent; }
thead, tbody, tfoot, tr, td, th { border-color: inherit; border-style: solid; border-width: 0; }

label { display: inline-block; }
button { border-radius: 0; }
button:focus:not(:focus-visible) { outline: 0; }
input, button, select, optgroup, textarea { margin: 0; font-family: inherit; font-size: inherit; line-height: inherit; }
button, select { text-transform: none; }
[role=button] { cursor: pointer; }
select { word-wrap: normal; }
select:disabled { opacity: 1; }
button, [type=button], [type=reset], [type=submit] { -webkit-appearance: button; }
button:not(:disabled), [type=button]:not(:disabled), [type=reset]:not(:disabled), [type=submit]:not(:disabled) { cursor: pointer; }
::-moz-focus-inner { padding: 0; border-style: none; }
textarea { resize: vertical; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
legend { float: left; width: 100%; padding: 0; margin-bottom: 0.5rem; font-size: calc(1.275rem + 0.3vw); line-height: inherit; }
@media (min-width: 1200px) {
  legend { font-size: 1.5rem; }
}
legend + * { clear: left; }
::-webkit-inner-spin-button { height: auto; }
[type=search] { outline-offset: -2px; -webkit-appearance: textfield; }
::-webkit-search-decoration { -webkit-appearance: none; }
::-webkit-file-upload-button { font: inherit; -webkit-appearance: button; }
::file-selector-button { font: inherit; -webkit-appearance: button; }
output { display: inline-block; }
iframe { border: 0; }
summary { display: list-item; cursor: pointer; }
progress { vertical-align: baseline; }
[hidden] { display: none !important; }

/* ---------- Base ---------- */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--w-page);
  color: var(--w-ink);
  font-family: var(--w-font-body);
  font-size: var(--w-t-base);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--w-font-head);
  font-weight: 600;
  line-height: 1.2;
  color: inherit;
}

a {
  color: var(--w-willow-2);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--w-willow); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--w-focus); outline-offset: 3px; }
.w-on-green :focus-visible { outline-color: var(--w-leaf); }

/* ---------- Page frame ---------- */

/* main.html: header, then .w-main (messages and the page), then the footer. */
.w-main { flex: 1 0 auto; }

.w-wrap,
.content-wrapper {
  width: auto;
  max-width: var(--w-page-max);
  margin: 0 auto;
  padding-left: var(--w-s3);
  padding-right: var(--w-s3);
}
@media (min-width: 768px) {
  .w-wrap,
  .content-wrapper { padding-left: var(--w-s5); padding-right: var(--w-s5); }
}
.content-wrapper { padding-top: var(--w-s4); padding-bottom: var(--w-s6); }

/* ---------- Messages ---------- */

.w-messages {
  list-style: none;
  max-width: var(--w-page-max);
  margin: var(--w-s4) auto 0;
  padding: 0 var(--w-s3);
  display: grid;
  gap: var(--w-s1);
  text-align: left;            /* login and delete put text-center on <body> */
}
@media (min-width: 768px) { .w-messages { padding: 0 var(--w-s5); } }

.w-message {
  margin: 0;
  padding: var(--w-s2) var(--w-s3);
  background: var(--w-strip);
  border-left: 4px solid var(--w-willow);
  border-radius: 0 var(--w-radius) var(--w-radius) 0;
  color: var(--w-ink);
  font-weight: 600;
}
.w-message--error { background: var(--w-danger-bg); border-left-color: var(--w-danger); }
.w-message--warning { border-left-color: var(--w-ink-2); }

/* ---------- Header ---------- */

.w-head {
  background: var(--w-willow);
  color: var(--w-on-willow);
  text-align: left;            /* login and delete put text-center on <body> */
}
.w-head__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--w-s4);
  min-height: 80px;
  padding-top: var(--w-s1);
  padding-bottom: var(--w-s1);
}
.w-brand {
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  text-decoration: none;
}

/* Crop a logo PNG to its artwork without touching the file. --x --y --w --h is the artwork box
   and --iw the image width, all in source pixels; --size is the rendered height. */
.w-crop { display: block; overflow: hidden; height: var(--size); width: calc(var(--size) * var(--w) / var(--h)); flex: none; }
.w-crop picture { display: block; }
.w-crop img {
  display: block;
  max-width: none;
  width: calc(var(--iw) / var(--w) * 100%);
  height: auto;
  margin-left: calc(var(--x) / var(--w) * -100%);
  margin-top: calc(var(--y) / var(--w) * -100%);
}
.w-art-leaf-word { --iw: 520; --x: 101; --y: 64; --w: 325; --h: 335; }  /* NEWLOGOWILLO-520 */
.w-flat-white img { filter: brightness(0) invert(1); }
.w-brand .w-crop { --size: 64px; }

/* Menu button, phones only. The script in navbar.html toggles aria-expanded on the button and
   .is-open on the menu; Escape closes it. From 768px up the links always show. */
.w-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--w-tap);
  height: var(--w-tap);
  padding: 0;
  margin-right: -8px;
  border: 1.5px solid var(--w-leaf);
  border-radius: var(--w-radius);
  background: transparent;
  color: var(--w-on-willow);
}
.w-menu-btn svg { width: 28px; height: 28px; }
.w-menu-btn:hover { background: var(--w-willow-2); }
.w-menu-btn:focus-visible { outline: 3px solid var(--w-leaf); outline-offset: 3px; }

.w-menu { flex-basis: 100%; flex-grow: 1; align-items: center; }
.w-links { list-style: none; margin: 0; padding: 0; }
.w-links a {
  display: flex;
  align-items: center;
  min-height: var(--w-tap);
  color: var(--w-on-willow);
  font-weight: 600;
  text-decoration: none;
}
.w-links a:hover { color: var(--w-on-willow); text-decoration: underline; }
.w-links a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

@media (max-width: 767.98px) {
  .w-menu:not(.is-open) { display: none; }
  .w-head__bar { min-height: 72px; }
  .w-brand .w-crop { --size: 56px; }
  .w-menu .w-links { margin-top: var(--w-s1); border-top: 1px solid var(--w-willow-2); }
  .w-menu .w-links li { border-bottom: 1px solid var(--w-willow-2); }
  .w-menu .w-btn { margin: var(--w-s3) 0 var(--w-s2); }
}

@media (min-width: 768px) {
  .w-head__bar { flex-wrap: nowrap; }
  .w-menu-btn { display: none; }
  .w-menu { display: flex; flex-basis: auto; flex-grow: 0; }
  .w-links { display: flex; align-items: center; }
  .w-links a { padding: 0 var(--w-s2); }
  .w-menu .w-btn { margin-left: var(--w-s2); }
}

/* ---------- Footer ---------- */

.w-foot {
  background: var(--w-willow);
  color: var(--w-on-willow);
  text-align: left;
}
.w-foot__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--w-s4);
  padding-top: var(--w-s3);
  padding-bottom: var(--w-s3);
}
.w-foot ul {
  list-style: none;
  margin: 0 0 0 calc(-1 * var(--w-s2));
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.w-foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--w-tap);
  padding: 0 var(--w-s2);
  color: var(--w-on-willow);
  font-size: var(--w-t-sm);
  font-weight: 600;
}
.w-foot a:hover { color: var(--w-on-willow); }
.w-foot p { margin: 0; font-size: var(--w-t-sm); color: var(--w-leaf); }

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

/* Our own button, for markup written for the redesign. */
.w-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--w-tap);
  padding: 0 var(--w-s4);
  border: var(--w-border-btn);
  border-radius: var(--w-radius);
  background: var(--w-page);
  color: var(--w-willow);
  font: 600 var(--w-t-base)/1.2 var(--w-font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.w-btn:hover { background: var(--w-field); color: var(--w-willow); }
.w-btn--sm { padding: 0 var(--w-s3); font-size: var(--w-t-sm); }
.w-on-green .w-btn { background: transparent; border-color: var(--w-leaf); color: var(--w-on-willow); }
.w-on-green .w-btn:hover { background: var(--w-willow-2); color: var(--w-on-willow); }

/* Main action: filled willow. */
.w-btn--primary { background: var(--w-willow); border-color: var(--w-willow); color: var(--w-on-willow); }
.w-btn--primary:hover { background: var(--w-willow-2); border-color: var(--w-willow-2); color: var(--w-on-willow); }
.w-btn--primary:active { background: var(--w-willow-deep); border-color: var(--w-willow-deep); }

.w-btn--lg { min-height: 56px; padding: 0 var(--w-s5); font-size: var(--w-t-md); }
@media (max-width: 599.98px) {
  .w-btn--lg { padding: 0 var(--w-s4); font-size: var(--w-t-base); }
}

/* Delete and Remove: red underlined text with a full tap target, never a red block. */
.w-link-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--w-tap-min);
  min-height: var(--w-tap-min);
  padding: 0 var(--w-s1);
  border: 0;
  border-radius: var(--w-radius);
  background: none;
  color: var(--w-danger);
  font: 600 var(--w-t-sm)/1 var(--w-font-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Fields ---------- */

label {
  font-weight: 600;
  color: var(--w-ink);
}
label:has(input[type="radio"], input[type="checkbox"]) { font-weight: 400; }

/* Ledger entry: pale green ground, a firm bottom rule. .w-input (full width; templates and
   forms.py put it on their fields) and the bare inputs Django renders with {{ form }} share it. */
.w-input {
  display: block;
  width: 100%;
  font-weight: 400;
  background-clip: padding-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .w-input { transition: none; }
}
.w-input,
form input:is([type="text"], [type="email"], [type="password"], [type="number"], [type="url"], [type="tel"], [type="search"], [type="emails"]),
form select,
form textarea {
  font-family: var(--w-font-body);
  font-size: var(--w-t-base);
  line-height: 1.4;
  color: var(--w-ink);
  background-color: var(--w-field);
  border: 0;
  border-bottom: 2px solid var(--w-field-rule);
  border-radius: var(--w-radius-field);
  min-height: var(--w-tap);
  padding: var(--w-s1) var(--w-s2);
  font-variant-numeric: tabular-nums;
}
textarea.w-input,
form textarea { min-height: 6rem; }
.w-input::placeholder,
form input::placeholder,
form textarea::placeholder { color: var(--w-field-rule); opacity: 1; }

.w-input:focus,
form input:is([type="text"], [type="email"], [type="password"], [type="number"], [type="url"], [type="tel"], [type="search"], [type="emails"]):focus,
form select:focus,
form textarea:focus {
  outline: none;
  color: var(--w-ink);
  background-color: var(--w-page);
  border-bottom-color: var(--w-willow);
  box-shadow: 0 2px 0 0 var(--w-willow);
}
.w-input:focus-visible,
form input:focus-visible,
form select:focus-visible,
form textarea:focus-visible { outline: 3px solid var(--w-focus); outline-offset: 2px; }

.w-input[readonly] { background-color: var(--w-strip); border-bottom-style: dashed; }

/* Selects draw their own arrow, so every browser shows the same one. A multiple select has none. */
select.w-input,
form select:not([multiple]) {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2318211B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  -webkit-appearance: none;
  appearance: none;
}
select[multiple].w-input,
form select[multiple] { background-image: none; padding-right: var(--w-s2); }

input[type="radio"],
input[type="checkbox"] { accent-color: var(--w-willow); }

/* Radio groups that Django renders (step 4): a full tap target per choice. */
form label:has(> input[type="radio"]) { min-height: var(--w-tap-min); }

.helptext { color: var(--w-ink-2); font-size: var(--w-t-sm); }

.errorlist {
  list-style: none;
  margin: var(--w-s1) 0;
  padding: 0;
  color: var(--w-danger);
  font-weight: 600;
}
