/* Greenvalley 2027 design tokens: shared by the public site (site.css) and the ERP (erp.css).
   Every text pair below was checked to WCAG AA (4.5:1) in light and dark; see docs/DESIGN-SYSTEM.md. */

/* SIL Open Font License. Hosted locally: no third-party font requests. */
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2"); font-style: normal; font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin.woff2") format("woff2"); font-style: normal; font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  /* colour: light */
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --ink: #0f2a2b;
  --muted: #4a5e5e;
  --line: #d6e1de;          /* decorative dividers only */
  --field: #6e8584;         /* input borders: 3:1 against white */
  --teal: #0e7c7b;          /* primary action, links */
  --teal-deep: #0b3b3c;     /* header, footer, hero panels */
  --teal-tint: #e1f1ef;
  --gold: #e0a526;          /* accents and fills; text only on --teal-deep */
  --gold-tint: #fbf1d8;
  --blue: #2563a8;          /* information */
  --paid: #1e7f4f; --paid-tint: #e3f3ea;
  --due: #b3261e;  --due-tint: #fdecea;
  --warn: #8a5a00; --warn-tint: #fdf3dc;
  --on-teal: #ffffff;
  --on-strong: #ffffff;      /* text on paid/due/blue fills */
  --teal-text: #0a6463;      /* teal text on tinted backgrounds */
  --paid-text: #186a41;
  --focus: #0e7c7b;

  /* type */
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --t-xs: .8125rem; --t-sm: .9375rem; --t-md: 1.0625rem; --t-lg: 1.25rem; --t-xl: 1.5rem; --t-2xl: 2rem; --t-3xl: clamp(2.25rem, 1.6rem + 2.6vw, 3.75rem);

  /* space, shape, depth, motion */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --radius: 14px; --radius-sm: 8px; --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(15, 42, 43, .06), 0 10px 28px -18px rgba(15, 42, 43, .35);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --dur: 180ms;
  --tap: 44px;
}

/* Dark: chosen by the system setting, or by the stored toggle (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1718; --surface: #122426; --surface-2: #17302f; --ink: #e7f0ee; --muted: #a7bdba; --line: #24403f; --field: #6f8f8c;
    --teal: #4cc3bf; --teal-deep: #081313; --teal-tint: #133a39; --gold: #f0c14b; --gold-tint: #3a3014; --blue: #7db2e8;
    --paid: #5ccb8f; --paid-tint: #12352a; --due: #ff8a80; --due-tint: #3d1a18; --warn: #f0c14b; --warn-tint: #3a3014;
    --on-teal: #0b1718; --on-strong: #0b1718; --teal-text: #4cc3bf; --paid-text: #5ccb8f; --focus: #4cc3bf; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1718; --surface: #122426; --surface-2: #17302f; --ink: #e7f0ee; --muted: #a7bdba; --line: #24403f; --field: #6f8f8c;
  --teal: #4cc3bf; --teal-deep: #081313; --teal-tint: #133a39; --gold: #f0c14b; --gold-tint: #3a3014; --blue: #7db2e8;
  --paid: #5ccb8f; --paid-tint: #12352a; --due: #ff8a80; --due-tint: #3d1a18; --warn: #f0c14b; --warn-tint: #3a3014;
  --on-teal: #0b1718; --on-strong: #0b1718; --teal-text: #4cc3bf; --paid-text: #5ccb8f; --focus: #4cc3bf; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* Base shared by both apps */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color: var(--ink); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-md)/1.6 var(--font-body); font-variant-numeric: tabular-nums; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-underline-offset: .2em; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0 0 var(--s3); }
p { margin: 0 0 var(--s4); max-width: 68ch; }
::selection { background: var(--gold-tint); color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s3); top: -80px; z-index: 50; padding: var(--s2) var(--s4); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); font-weight: 700; }
.skip:focus { top: var(--s3); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s5); border-radius: 999px; border: 1.5px solid var(--teal); background: var(--teal); color: var(--on-teal); font: 700 var(--t-sm)/1 var(--font-body); text-decoration: none; cursor: pointer; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 160ms var(--ease); }
.btn:active { transform: scale(.97); }
.btn-ghost { background: transparent; color: var(--teal); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0f2a2b; }
.btn-sm { min-height: 36px; padding: 0 var(--s4); }
@media (hover: hover) and (pointer: fine) { .btn:hover { filter: brightness(1.08); } .btn-ghost:hover { background: var(--teal-tint); filter: none; } }
label { display: block; font-weight: 700; font-size: var(--t-sm); margin: 0 0 var(--s1); }
input, select, textarea { width: 100%; min-height: var(--tap); padding: var(--s2) var(--s3); font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--field); border-radius: var(--radius-sm); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); outline: 2px solid transparent; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--due); }
.field { margin-bottom: var(--s4); }
.hint { font-size: var(--t-xs); color: var(--muted); margin: var(--s1) 0 0; }
.error-text { font-size: var(--t-xs); color: var(--due); font-weight: 700; margin: var(--s1) 0 0; }

/* Status: never colour alone, always a word */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 700; background: var(--surface-2); color: var(--ink); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-paid { background: var(--paid-tint); color: var(--paid-text); }
.pill-due { background: var(--due-tint); color: var(--due); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-info { background: var(--teal-tint); color: var(--teal-text); }

.notice { padding: var(--s3) var(--s4); border-radius: var(--radius-sm); margin-bottom: var(--s4); border: 1px solid; }
.notice-ok { background: var(--paid-tint); border-color: var(--paid); color: var(--ink); }
.notice-error { background: var(--due-tint); border-color: var(--due); color: var(--ink); }
.notice-info { background: var(--teal-tint); border-color: var(--teal); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: background-color 120ms linear, color 120ms linear, border-color 120ms linear; }
  .btn:active { transform: none; }
  input, select, textarea { transition: border-color 120ms linear; }
}
