/* Design tokens and element defaults.
   Components in site.css and admin.css use only these tokens: no hex colour
   outside this file (tests/test_templates.py checks). Change the look by
   changing tokens, in both the light block and the dark block.

   Choose the palette from the place and the people: sample colours from the
   organisation's own photos and printed material, pick ONE accent for
   primary buttons, and check every text colour against its background at
   WCAG AA (4.5:1 body, 3:1 large text and focus rings) in both schemes. */

:root {
  --color-bg: #f4f5f3;
  --color-band: #e6e9e5;        /* quiet bands behind sections */
  --color-surface: #ffffff;
  --color-text: #1a1f1d;
  --color-muted: #4f5753;
  --color-border: #c9cfcb;
  --color-brand: #23413b;       /* header and footer bands */
  --color-on-brand: #f4f5f3;
  --color-link: #1d5a50;
  --color-accent: #9c3a1e;      /* the one accent: primary buttons only (each organisation overrides it below) */
  --color-accent-hover: #7f2c14;
  /* The two organisations' accents, both available on every page (the landing shows both cards). */
  --accent-outdoors: #b3331f;          /* coral: a reef colour, placeholder until the brand assets arrive */
  --accent-outdoors-hover: #8f2817;
  --accent-foundation: #4f6b2a;        /* moss: placeholder until the brand assets arrive */
  --accent-foundation-hover: #3d5420;
  --color-on-accent: #ffffff;
  --color-focus: #a85600;
  --color-focus-on-dark: #ffc857;
  --color-notice-bg: #e3efe9;
  --color-error: #9e2a1c;
  --color-error-bg: #fbeae6;

  /* Type: system stacks until the project chooses (at most two families,
     self-hosted woff2 in static/fonts/, never a font CDN). Scale: a major
     third (1.25) from 18px on phones. */
  --font-heading: Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", system-ui, Arial, sans-serif;
  --text-sm: 1rem;
  --text-base: 1.125rem;   /* 18px on phones */
  --text-lg: 1.3125rem;
  --text-xl: 1.625rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;
  --leading-body: 1.6;
  --leading-heading: 1.2;
  --measure: 66ch;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --gutter: 16px;
  --max-width: 72rem;
  --tap-target: 44px;

  /* Shape */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --border-width: 1px;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.10), 0 3px 10px rgb(0 0 0 / 0.05);
}

@media (min-width: 768px) {
  :root {
    --text-base: 1.1875rem;  /* 19px on desktop */
    --text-2xl: 2.25rem;
    --text-3xl: 3rem;
    --gutter: 24px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121816;
    --color-band: #18201d;
    --color-surface: #1c2623;
    --color-text: #e8ede9;
    --color-muted: #aab5af;
    --color-border: #34443f;
    --color-brand: #0f231f;
    --color-on-brand: #e8ede9;
    --color-link: #8fd0c4;
    --color-accent: #eb8468;
    --color-accent-hover: #f39d85;
    --color-on-accent: #121816;
    --accent-outdoors: #f0896f;
    --accent-outdoors-hover: #f5a38e;
    --accent-foundation: #a9c97c;
    --accent-foundation-hover: #bdd794;
    --color-focus: #ffc857;
    --color-focus-on-dark: #ffc857;
    --color-notice-bg: #1f3a33;
    --color-error: #f19a86;
    --color-error-bg: #3a1f1a;
    --shadow-card: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

/* Per-organisation accents (data-org on <html>, set by app/hosts.py). The
   header and footer band shifts with it: ocean for the shop, moss for the
   Foundation. Every pair below passes WCAG AA against the surfaces above
   (tests/test_landing.py checks). */
html[data-org="outdoors"] {
  --color-accent: var(--accent-outdoors);
  --color-accent-hover: var(--accent-outdoors-hover);
  --color-link: #a52d1b;
  --color-brand: #1b3a44;
}
html[data-org="foundation"] {
  --color-accent: var(--accent-foundation);
  --color-accent-hover: var(--accent-foundation-hover);
  --color-link: #3e5a1f;
  --color-brand: #2f3d26;
}
@media (prefers-color-scheme: dark) {
  html[data-org="outdoors"] { --color-link: #f4a58f; --color-brand: #0e242b; }
  html[data-org="foundation"] { --color-link: #b9d58f; --color-brand: #1c2615; }
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--leading-heading);
  margin: 0 0 var(--space-4);
}
h1 { font-size: var(--text-3xl); line-height: 1.1; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

p, ul, ol, address { margin: 0 0 var(--space-4); }
address { font-style: normal; white-space: pre-line; }

a { color: var(--color-link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; height: auto; display: block; }

/* Focus: one visible ring everywhere; pale on the dark bands. */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.site-header :focus-visible, .admin-header :focus-visible, .site-footer :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 10;
}
.skip-link:focus { top: var(--space-2); }

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--gutter); }
.container.prose > * { max-width: var(--measure); }
.lead { font-size: var(--text-lg); }

.site-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-lg);
  color: inherit;
  text-decoration: none;
  line-height: var(--leading-heading);
  max-width: 14em;
}

/* Buttons: one radius, one accent. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-5);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button--primary { background: var(--color-accent); color: var(--color-on-accent); }
.button--primary:hover { background: var(--color-accent-hover); }
.button--secondary { background: transparent; color: var(--color-link); border-color: currentColor; }
.button--wide { width: 100%; }

/* Menu that collapses on phones without JavaScript: a checkbox and label. */
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nav-toggle-label {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-4);
  border: 2px solid currentColor;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
}
.nav-toggle:focus-visible + .nav-toggle-label { outline: 3px solid var(--color-focus-on-dark); outline-offset: 3px; }
.nav-list { display: none; list-style: none; margin: 0; padding: 0; }
.nav-toggle:checked ~ .nav-list { display: block; }
.nav-link {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: var(--space-2);
  color: inherit;
  font-size: var(--text-lg);
  text-decoration: none;
}
.nav-link[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.3em; }

@media (min-width: 768px) {
  .nav-toggle-label { display: none; }
  .nav-list, .nav-toggle:checked ~ .nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
  }
  .nav-link { min-height: var(--tap-target); font-size: var(--text-base); }
}

/* Notices and forms (public forms and the admin) */
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-notice-bg);
  border-left: 4px solid var(--color-brand);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-5);
}
.form { max-width: 40rem; }
.field { margin: 0 0 var(--space-5); }
.field label { display: block; font-weight: 700; line-height: 1.35; margin-bottom: var(--space-1); }
.field input[type="text"], .field input[type="password"], .field input[type="email"],
.field input[type="tel"], .field input[type="url"], .field textarea {
  display: block;
  width: 100%;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.field--check { display: flex; align-items: center; gap: var(--space-3); }
.field--check input { width: 28px; height: 28px; margin: 0; flex: none; }
.field--check label { margin: 0; font-weight: 400; }
.help { color: var(--color-muted); font-size: var(--text-sm); margin: 0 0 var(--space-2); }
.form-error, .field-error {
  color: var(--color-error);
  background: var(--color-error-bg);
  border-left: 4px solid var(--color-error);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-weight: 700;
}
.field--error input, .field--error textarea { border-color: var(--color-error); }
