/* audit/style.css -----------------------------------------------------------
   Shared styling for the Okanagan Lake Water Audit.

   The palette is LIFTED VERBATIM from the outlook site (web/index.html), not
   re-picked. Those hues were validated with a contrast + colour-vision-deficiency
   checker rather than chosen by eye, and re-picking them here would silently
   discard that work while looking identical to a sighted reviewer on a good
   monitor. Two sites in one family should also not disagree about what blue is.

   PRINT IS A FIRST-CLASS TARGET, not an afterthought. The whole point of the
   handout page is that a utility manager prints it and puts it in front of a
   council, so print rules live beside the screen rules and are maintained with
   them -- not bolted on at the end where they rot. */

:root{
  color-scheme: light;
  --surface-0:#f7f7f5; --surface-1:#fcfcfb; --surface-2:#eeeeea;
  --text-primary:#0b0b0b; --text-secondary:#52514e; --text-muted:#77756e;
  --rule:#dddcd6;
  --s1:#2a78d6;        /* water in / gain */
  --s2:#eb6834;        /* water out / loss */
  --s3:#0a9494;        /* third series */
  --band:#c9c8c2;
  --accent:#4a3aa7;
  --warn-bg:#fdf6e6; --warn-bd:#eda100;
  --gap-bg:#f0eff3; --gap-bd:#a9a4c4;
  --sc1:#5590cc; --sc2:#35709f; --sc3:#1f4f7d; --sc4:#0e3152;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --surface-0:#141413; --surface-1:#1a1a19; --surface-2:#232321;
    --text-primary:#ffffff; --text-secondary:#c3c2b7; --text-muted:#9a998f;
    --rule:#33332f;
    --s1:#3987e5; --s2:#d95926; --s3:#14a3a3;
    --band:#4a4a45;
    --accent:#9085e9;
    --warn-bg:#2a2313; --warn-bd:#c98500;
    --gap-bg:#201f26; --gap-bd:#6e698c;
    --sc1:#2f7ad0; --sc2:#5698da; --sc3:#7fb0e4; --sc4:#a8c8ee;
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --surface-0:#141413; --surface-1:#1a1a19; --surface-2:#232321;
  --text-primary:#ffffff; --text-secondary:#c3c2b7; --text-muted:#9a998f;
  --rule:#33332f;
  --s1:#3987e5; --s2:#d95926; --s3:#14a3a3;
  --band:#4a4a45;
  --accent:#9085e9;
  --warn-bg:#2a2313; --warn-bd:#c98500;
  --gap-bg:#201f26; --gap-bd:#6e698c;
  --sc1:#2f7ad0; --sc2:#5698da; --sc3:#7fb0e4; --sc4:#a8c8ee;
}

*{box-sizing:border-box}
body{
  margin:0; background:var(--surface-0); color:var(--text-primary);
  font:16px/1.6 ui-sans-serif,-apple-system,"Segoe UI",Inter,Roboto,Helvetica,Arial,sans-serif;
  -webkit-text-size-adjust:100%;
}
.wrap{max-width:1000px;margin:0 auto;padding:0 20px 80px}
a{color:var(--accent)}
h1{font-size:clamp(26px,4.2vw,38px);line-height:1.15;letter-spacing:-.022em;margin:8px 0 6px}
h2{font-size:clamp(19px,2.6vw,24px);line-height:1.25;letter-spacing:-.015em;margin:38px 0 8px}
h3{font-size:17px;margin:26px 0 6px;letter-spacing:-.01em}
p{max-width:74ch}
.lede{font-size:clamp(17px,2.1vw,19px);color:var(--text-secondary);max-width:70ch;margin:0 0 4px}
.kicker{font-size:12px;letter-spacing:.09em;text-transform:uppercase;color:var(--text-muted);
  font-weight:600;margin:0 0 4px}

/* --- masthead + nav ------------------------------------------------------ */
header.site{border-bottom:1px solid var(--rule);background:var(--surface-1);margin-bottom:26px}
header.site .wrap{padding-top:16px;padding-bottom:0}
.brand{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.brand .mark{font-weight:700;letter-spacing:-.02em;font-size:15px}
.brand .org{font-size:13px;color:var(--text-muted)}
nav.site{display:flex;gap:2px;flex-wrap:wrap;margin-top:14px}
nav.site a{
  display:block;padding:9px 13px;font-size:14.5px;text-decoration:none;
  color:var(--text-secondary);border-bottom:2px solid transparent;font-weight:500;
}
nav.site a:hover{color:var(--text-primary);background:var(--surface-2)}
nav.site a[aria-current="page"]{color:var(--text-primary);border-bottom-color:var(--accent);font-weight:650}

/* --- figure furniture ---------------------------------------------------- */
.figtitle{font-size:17px;font-weight:650;line-height:1.3;margin:26px 0 2px;letter-spacing:-.01em}
.figsub{font-size:13.5px;color:var(--text-secondary);margin:0 0 10px;max-width:74ch}
.figsrc{font-size:12.5px;color:var(--text-muted);margin:4px 0 26px;max-width:78ch}
.figcap{color:var(--text-secondary);font-size:13.5px;margin:6px 0 22px;max-width:72ch}

/* A chart must scroll inside its OWN box. Letting the page scroll sideways drags
   the prose with it, which is the failure this container exists to prevent. */
.chart{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.chart svg{display:block;min-width:660px;width:100%;height:auto}
.tablewrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}

/* --- tiles --------------------------------------------------------------- */
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px;margin:20px 0}
.tile{background:var(--surface-1);border:1px solid var(--rule);border-radius:10px;padding:14px 15px}
.tile .k{font-size:11.5px;letter-spacing:.07em;text-transform:uppercase;color:var(--text-muted);font-weight:600}
.tile .n{font-size:clamp(21px,3vw,29px);font-weight:650;letter-spacing:-.02em;line-height:1.15;
  font-variant-numeric:tabular-nums;white-space:nowrap;margin-top:3px}
.tile .sub{font-size:12.5px;color:var(--text-secondary);margin-top:3px}

/* --- tables -------------------------------------------------------------- */
table{width:100%;border-collapse:collapse;font-size:14px;margin-top:14px}
th,td{text-align:right;padding:7px 9px;border-bottom:1px solid var(--rule);
  font-variant-numeric:tabular-nums;vertical-align:top}
th:first-child,td:first-child{text-align:left}
th{font-size:12px;letter-spacing:.05em;text-transform:uppercase;color:var(--text-muted);
  font-weight:600;border-bottom:1.5px solid var(--rule);white-space:nowrap}
tbody tr:hover{background:var(--surface-2)}
td.na{color:var(--text-muted);font-style:italic}
caption{text-align:left;font-size:12px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--text-muted);font-weight:600;padding-bottom:6px}

/* --- callouts ------------------------------------------------------------ */
.note{background:var(--warn-bg);border:1px solid var(--warn-bd);border-left-width:4px;
  border-radius:8px;padding:12px 14px;margin:20px 0;font-size:14.5px}
.note p{margin:0;max-width:none}
.note p + p{margin-top:8px}
/* A DATA GAP is not a warning -- it is a finding. Giving it its own neutral
   treatment keeps the amber box meaning "be careful", which it stops meaning if
   every caveat on the page is amber. */
.gap{background:var(--gap-bg);border:1px solid var(--gap-bd);border-left-width:4px;
  border-radius:8px;padding:12px 14px;margin:20px 0;font-size:14.5px}
.gap p{margin:0;max-width:none}
.tag{display:inline-block;font-size:11px;letter-spacing:.04em;text-transform:uppercase;
  font-weight:650;padding:2px 6px;border-radius:4px;border:1px solid var(--rule);
  background:var(--surface-2);color:var(--text-secondary);white-space:nowrap}
.tag.req{border-color:var(--gap-bd);color:var(--text-secondary)}
.tag.ok{border-color:var(--s3);color:var(--s3)}

/* --- controls ------------------------------------------------------------ */
.controls{display:flex;gap:18px;flex-wrap:wrap;align-items:flex-end;margin:18px 0 6px;
  background:var(--surface-1);border:1px solid var(--rule);border-radius:10px;padding:14px 15px}
.ctl{display:flex;flex-direction:column;gap:5px}
.ctl label{font-size:12px;letter-spacing:.06em;text-transform:uppercase;
  color:var(--text-muted);font-weight:600}
.ctl select,.ctl input[type=range]{font:inherit;font-size:14.5px}
.ctl select{padding:6px 8px;border:1px solid var(--rule);border-radius:6px;
  background:var(--surface-0);color:var(--text-primary)}
button.act{font:inherit;font-size:14px;font-weight:600;padding:8px 14px;border-radius:7px;
  border:1px solid var(--rule);background:var(--surface-2);color:var(--text-primary);cursor:pointer}
button.act:hover{border-color:var(--accent);color:var(--accent)}
button.act:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0 0 0 0);white-space:nowrap;border:0}
footer.site{border-top:1px solid var(--rule);margin-top:50px;padding-top:18px;
  font-size:13px;color:var(--text-muted)}

/* --- print --------------------------------------------------------------- */
@media print{
  /* Force the light palette. A dark-mode print is a solid black page: it empties
     the toner and is unreadable on paper, and the browser will not warn anyone. */
  :root{
    --surface-0:#fff; --surface-1:#fff; --surface-2:#f2f2f0;
    --text-primary:#000; --text-secondary:#333; --text-muted:#555; --rule:#bbb;
  }
  body{background:#fff;color:#000;font-size:11pt}
  header.site nav.site, .noprint{display:none !important}
  header.site{border-bottom:1px solid #bbb;margin-bottom:14px}
  .wrap{max-width:none;padding:0}
  .chart{overflow:visible}
  .chart svg{min-width:0;width:100%}
  a{color:#000;text-decoration:none}
  h2{page-break-after:avoid}
  table{page-break-inside:avoid}
  .note,.gap{page-break-inside:avoid;border-left-width:3px}
  /* Backgrounds are stripped by default in print, which turns the amber caveat
     box into an invisible one. Ask for them, and keep a border so the box still
     reads if the browser refuses. */
  .note,.gap,.tile{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  @page{margin:14mm}
}
