/* Factory house style: Material Design 3 in plain CSS (no component library).
   Reference: https://m3.material.io (colour roles, type scale, shape, elevation, components, layout).
   Font: Roboto Flex, self-hosted (fonts/, SIL Open Font License), so no requests go to Google. A site sets its own
   palette by overriding the --md-sys-color-* roles in its site.css (see the site's DESIGN.md). */

@font-face {
  font-family: "Roboto Flex"; font-style: normal; font-weight: 400 600; font-stretch: 100%; font-display: swap;
  src: url(fonts/roboto-flex-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colour roles (baseline green; sites override) */
  --md-sys-color-primary: #1f6b52;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #a8f2d0;
  --md-sys-color-on-primary-container: #002116;
  --md-sys-color-secondary: #4c6358;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #cee9da;
  --md-sys-color-on-secondary-container: #092016;
  --md-sys-color-tertiary: #3e6374;
  --md-sys-color-tertiary-container: #c2e8fc;
  --md-sys-color-on-tertiary-container: #001f2a;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;
  --md-sys-color-warning-container: #ffdea6;   /* not an M3 role; used for "partial" and caveats */
  --md-sys-color-on-warning-container: #271900;
  --md-sys-color-surface: #f5fbf6;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #eff5f0;
  --md-sys-color-surface-container: #e9efea;
  --md-sys-color-surface-container-high: #e4eae5;
  --md-sys-color-surface-container-highest: #dee4df;
  --md-sys-color-on-surface: #171d1a;
  --md-sys-color-on-surface-variant: #404944;
  --md-sys-color-outline: #707974;
  --md-sys-color-outline-variant: #bfc9c2;
  --md-sys-color-inverse-surface: #2c322e;
  --md-sys-color-inverse-on-surface: #ecf2ed;

  /* Type: M3 baseline typeface (Roboto), as the variable Roboto Flex */
  --md-ref-typeface-brand: "Roboto Flex", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-ref-typeface-plain: "Roboto Flex", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Shape */
  --md-sys-shape-xs: 4px; --md-sys-shape-sm: 8px; --md-sys-shape-md: 12px; --md-sys-shape-lg: 16px;
  --md-sys-shape-xl: 28px; --md-sys-shape-full: 9999px;

  /* Elevation */
  --md-sys-elevation-1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --md-sys-elevation-2: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.3);

  --md-motion-standard: cubic-bezier(.2, 0, 0, 1);
  --page-max: 1200px;
  --page-margin: 24px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 88px; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface);
  font: 400 16px/24px var(--md-ref-typeface-plain); letter-spacing: .5px;   /* body large */
}
a { color: var(--md-sys-color-primary); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-margin); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--md-sys-color-surface-container-lowest); padding: 8px 12px; border-radius: var(--md-sys-shape-sm); }

/* Type scale (M3 type roles) */
.display-sm, h1 { font: 400 36px/44px var(--md-ref-typeface-brand); letter-spacing: 0; margin: 0 0 16px; }
.headline-sm, h2 { font: 400 24px/32px var(--md-ref-typeface-brand); letter-spacing: 0; margin: 48px 0 12px; }
.title-lg, h3 { font: 400 22px/28px var(--md-ref-typeface-brand); letter-spacing: 0; margin: 24px 0 8px; }
.title-md { font: 500 16px/24px var(--md-ref-typeface-plain); letter-spacing: .15px; }
.body-lg { font: 400 16px/24px var(--md-ref-typeface-plain); letter-spacing: .5px; }
.body-md, .body-sm { font: 400 14px/20px var(--md-ref-typeface-plain); letter-spacing: .25px; }
.label-lg { font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; }
.label-md { font: 500 12px/16px var(--md-ref-typeface-plain); letter-spacing: .5px; }
.on-variant { color: var(--md-sys-color-on-surface-variant); }
@media (min-width: 840px) { .display-sm, h1 { font-size: 45px; line-height: 52px; } }   /* display medium on expanded windows */

/* Top app bar */
.top-app-bar { background: var(--md-sys-color-surface); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.top-app-bar .wrap { display: flex; align-items: center; gap: 8px 28px; min-height: 64px; flex-wrap: wrap; }
.brand { flex: none; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--md-sys-color-on-surface); font: 500 20px/28px var(--md-ref-typeface-brand); }
.brand svg { width: 32px; height: 32px; flex: none; }
.top-app-bar nav { display: flex; gap: 0; flex-wrap: wrap; margin-left: auto; align-self: stretch; }
.top-app-bar nav a { position: relative; display: flex; align-items: center; color: var(--md-sys-color-on-surface-variant); text-decoration: none;
  font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .1px; padding: 0 16px; min-height: 48px; }
.top-app-bar nav a:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); color: var(--md-sys-color-on-surface); }
.top-app-bar nav a[aria-current="page"] { color: var(--md-sys-color-primary); }
.top-app-bar nav a[aria-current="page"]::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--md-sys-color-primary); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 24px; border-radius: var(--md-sys-shape-full);
  font: 500 14px/20px var(--md-ref-typeface-plain); letter-spacing: .01em; text-decoration: none; border: 0; cursor: pointer;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); transition: box-shadow .2s var(--md-motion-standard); }
.btn:hover { box-shadow: var(--md-sys-elevation-1); text-decoration: none; }
.btn.tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn.outlined { background: transparent; color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); }
.btn.outlined:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); box-shadow: none; }
.btn.text { background: transparent; color: var(--md-sys-color-primary); padding: 0 12px; }
.btn.text:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); box-shadow: none; }

/* Cards */
.card { background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-md); padding: 16px; }
.card.filled { background: var(--md-sys-color-surface-container-highest); border-color: transparent; }
.card.elevated { border-color: transparent; box-shadow: var(--md-sys-elevation-1); background: var(--md-sys-color-surface-container-low); }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--md-sys-shape-sm);
  border: 1px solid var(--md-sys-color-outline-variant); font: 500 14px/20px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface-variant); background: transparent; white-space: nowrap; }
label.chip { cursor: pointer; user-select: none; }
label.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.chip:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
label.chip:has(input:checked) { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-color: transparent; padding-left: 8px; }
label.chip:has(input:checked)::before { content: ""; width: 18px; height: 18px; flex: none;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat; }
label.chip:has(input:focus-visible) { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; background: var(--md-sys-color-surface-container-lowest); border-radius: var(--md-sys-shape-md); overflow: hidden; border: 1px solid var(--md-sys-color-outline-variant); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--md-sys-color-outline-variant); vertical-align: top; }
tr:last-child > * { border-bottom: 0; }
thead th { background: var(--md-sys-color-surface-container); font: 500 14px/20px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface-variant); }

/* Form fields (outlined) */
.field { display: block; font: 500 12px/16px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface-variant); margin: 10px 0; }
.field select, .field input[type=number] { display: block; width: 100%; margin-top: 4px; height: 56px; padding-left: 16px; padding: 0 12px; font: 400 16px/24px var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-xs); }
.field select:focus, .field input:focus { outline: 2px solid var(--md-sys-color-primary); border-color: transparent; }
input[type=range] { accent-color: var(--md-sys-color-primary); }

/* Footer */
.site-footer { margin-top: 64px; background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); padding: 32px 0 40px; font-size: 14px; line-height: 20px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0; }

@media (max-width: 1000px) {
  .top-app-bar nav { margin: 0 -10px 4px; overflow-x: auto; flex-wrap: nowrap; width: calc(100% + 20px); scrollbar-width: none; }
  .top-app-bar nav a { white-space: nowrap; }
}
@media (max-width: 599px) {   /* compact window class */
  :root { --page-margin: 16px; }
  .top-app-bar .wrap { min-height: 56px; padding-top: 8px; padding-bottom: 0; }
  .display-sm, h1 { font-size: 28px; line-height: 36px; }   /* headline medium */

  .headline-sm, h2 { margin-top: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
