/* The Pool & Spa Water Handbook — field-manual design system
   Custom CSS only. No layout framework: the fleet's recurring nav-overflow
   failures all originate in framework navbars with flex-shrink:0, and every
   flex container here sets min-width:0 and is allowed to wrap. */

:root{
  --ink:#14212b;
  --ink-soft:#3d4f5c;
  --muted:#61707c;
  --paper:#ffffff;
  --surface:#f2f7fa;
  --surface-2:#e6eff5;
  --primary:#0b5c8a;
  --primary-dark:#073d5c;
  --primary-deep:#052b41;
  --accent:#1c8ea8;
  --callout:#f6c85f;
  --callout-bg:#fdf6e3;
  --warn-bg:#fdf0ec;
  --warn-edge:#c8552f;
  --rule:#d7e3ea;
  --rule-strong:#b6ccd8;
  --measure:44rem;
  --wide:76rem;
  --radius:3px;
  --shadow:0 1px 2px rgba(20,33,43,.06),0 8px 24px -12px rgba(20,33,43,.18);
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:17px;
  line-height:1.68;
  overflow-x:hidden;
}
img{max-width:100%;height:auto;display:block}
a{color:var(--primary);text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}
a:hover{color:var(--primary-dark);text-decoration-thickness:2px}

/* ---------- header / nav ---------- */
.site-head{
  position:sticky;top:0;z-index:50;
  background:var(--paper);
  border-bottom:1px solid var(--rule);
}
.head-inner{
  max-width:var(--wide);margin:0 auto;padding:.65rem 1.25rem;
  display:flex;flex-wrap:wrap;align-items:baseline;gap:.4rem 1.5rem;
  min-width:0;
}
.brand{
  min-width:0;flex:0 1 auto;
  font-family:"Spectral",Georgia,"Times New Roman",serif;
  font-weight:600;font-size:1.12rem;letter-spacing:-.01em;
  color:var(--ink);text-decoration:none;line-height:1.2;
  border-left:3px solid var(--primary);padding-left:.6rem;
}
.brand:hover{color:var(--primary);text-decoration:none}
.brand small{display:block;font-family:"Inter",system-ui,sans-serif;font-weight:400;font-size:.62rem;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-top:.15rem}
.site-nav{min-width:0;flex:1 1 auto}
.site-nav ul{
  list-style:none;margin:0;padding:0;
  display:flex;flex-wrap:wrap;gap:.15rem 1.1rem;
  justify-content:flex-start;min-width:0;
}
@media (min-width:900px){.site-nav ul{justify-content:flex-end}}
.site-nav li{min-width:0}
.site-nav a{
  display:inline-block;padding:.2rem 0;
  font-size:.83rem;font-weight:500;letter-spacing:.03em;
  color:var(--ink-soft);text-decoration:none;
  border-bottom:2px solid transparent;
}
.site-nav a:hover,.site-nav a[aria-current="page"]{color:var(--primary);border-bottom-color:var(--primary)}

/* ---------- hero ----------
   The image is shown at full opacity; legibility comes from a gradient scrim
   layered above it, not from fading the photograph out. */
.hero{position:relative;background:var(--primary-deep);overflow:hidden;isolation:isolate}
.hero-media{position:relative;width:100%}
.hero-media img{
  width:100%;height:clamp(15rem,38vw,25rem);object-fit:cover;
  display:block;
}
.hero-media::after{
  content:"";position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(5,43,65,.62) 0%,rgba(5,43,65,.30) 34%,rgba(5,43,65,.72) 72%,rgba(5,43,65,.94) 100%);
}
.hero-body{
  position:absolute;left:0;right:0;bottom:0;z-index:2;
  max-width:var(--wide);margin:0 auto;
  padding:1.6rem 1.25rem 1.8rem;color:#fff;
}
.hero-body .eyebrow{color:#a9d6e8;text-shadow:0 1px 3px rgba(0,0,0,.45)}
.hero h1{color:#fff;margin:.35rem 0 0;max-width:22ch;text-shadow:0 2px 10px rgba(0,0,0,.4)}
.hero p.sub{
  color:#e2eff6;max-width:54ch;margin:.75rem 0 0;font-size:1rem;line-height:1.55;
  text-shadow:0 1px 6px rgba(0,0,0,.5);
}
.hero.compact .hero-media img{height:clamp(13rem,30vw,20rem)}
/* Fallback: if the hero image fails to load, the title still sits on the deep
   background rather than on nothing. */
.hero-media img:not([src]){background:var(--primary-deep)}
@media (max-width:760px){
  .hero-body{position:static;background:var(--primary-deep);padding:1.5rem 1.25rem 1.7rem}
  .hero-media img{height:clamp(11rem,42vw,15rem)}
  .hero h1,.hero p.sub,.hero-body .eyebrow{text-shadow:none}
}

/* ---------- layout ---------- */
.wrap{max-width:var(--wide);margin:0 auto;padding:0 1.25rem}
main{display:block;padding-bottom:3.5rem}
.prose{max-width:var(--measure);margin:0 auto;padding-top:2.4rem}
.prose.wide{max-width:58rem}

/* ---------- typography ---------- */
h1,h2,h3,h4{
  font-family:"Spectral",Georgia,"Times New Roman",serif;
  font-weight:600;line-height:1.2;color:var(--ink);
  letter-spacing:-.012em;
}
h1{font-size:clamp(1.85rem,4.4vw,2.7rem);margin:0 0 1rem}
h2{font-size:clamp(1.32rem,2.7vw,1.62rem);margin:2.6rem 0 .7rem;padding-top:1.1rem;border-top:1px solid var(--rule)}
h3{font-size:1.1rem;margin:1.9rem 0 .5rem;color:var(--primary-dark)}
.prose > h2:first-of-type{border-top:none;padding-top:0}
p{margin:0 0 1.05rem}
.lede{font-size:1.13rem;line-height:1.6;color:var(--ink-soft);border-left:3px solid var(--callout);padding-left:1.1rem;margin-bottom:1.8rem}
.eyebrow{
  font-size:.68rem;font-weight:600;letter-spacing:.15em;text-transform:uppercase;
  color:var(--accent);margin:0 0 .1rem;font-family:"Inter",system-ui,sans-serif;
}
strong{font-weight:650}
em{font-style:italic}

ul,ol{margin:0 0 1.15rem;padding-left:1.35rem}
li{margin:0 0 .5rem}
ol{counter-reset:none}
ul.idx{list-style:none;padding-left:0;margin-bottom:1.4rem}
ul.idx li{
  padding:.65rem 0 .65rem 1.6rem;border-bottom:1px solid var(--rule);
  margin:0;position:relative;
}
ul.idx li::before{
  content:"";position:absolute;left:0;top:1.15rem;
  width:.5rem;height:.5rem;border:1.5px solid var(--accent);border-radius:50%;
}
ul.idx li a{font-weight:600}
ul.check{list-style:none;padding-left:0}
ul.check li{
  position:relative;padding-left:1.9rem;margin-bottom:.65rem;
}
ul.check li::before{
  content:"";position:absolute;left:0;top:.42rem;
  width:1rem;height:1rem;border:1.5px solid var(--rule-strong);border-radius:2px;background:var(--paper);
}
ul.formulas{list-style:none;padding-left:0}
ul.formulas li{
  background:var(--surface);border-left:3px solid var(--primary);
  padding:.6rem .9rem;margin-bottom:.5rem;border-radius:0 var(--radius) var(--radius) 0;
}
p.formula{
  background:var(--surface);border-left:3px solid var(--primary);
  padding:.8rem 1rem;margin:1.2rem 0;border-radius:0 var(--radius) var(--radius) 0;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.94rem;
}
p.callout{
  background:var(--callout-bg);border-left:4px solid var(--callout);
  padding:.95rem 1.1rem;margin:1.5rem 0;border-radius:0 var(--radius) var(--radius) 0;
}
p.warn,.warn{
  background:var(--warn-bg);border-left:4px solid var(--warn-edge);
  padding:.95rem 1.1rem;margin:1.5rem 0;border-radius:0 var(--radius) var(--radius) 0;
  font-size:.96rem;
}
li > p.warn{margin:.7rem 0}

/* ---------- figures ---------- */
figure{margin:2rem 0}
figure img{
  width:100%;border-radius:var(--radius);
  border:1px solid var(--rule);box-shadow:var(--shadow);
}
figcaption{
  font-size:.82rem;color:var(--muted);margin-top:.55rem;
  padding-left:.1rem;border-left:2px solid var(--rule);padding-left:.7rem;
}

/* ---------- tables ---------- */
.table-wrap{
  overflow-x:auto;-webkit-overflow-scrolling:touch;
  margin:1.6rem 0;border:1px solid var(--rule);border-radius:var(--radius);
  background:var(--paper);
}
table{border-collapse:collapse;width:100%;min-width:33rem;font-size:.92rem}
caption{
  caption-side:top;text-align:left;padding:.75rem .9rem;
  font-size:.7rem;font-weight:600;letter-spacing:.13em;text-transform:uppercase;
  color:var(--muted);background:var(--surface);border-bottom:1px solid var(--rule);
}
th,td{padding:.6rem .9rem;text-align:left;vertical-align:top;border-bottom:1px solid var(--rule)}
thead th{
  background:var(--surface-2);color:var(--primary-dark);
  font-weight:650;font-size:.8rem;letter-spacing:.02em;
  border-bottom:2px solid var(--rule-strong);
}
tbody tr:last-child td{border-bottom:none}
tbody tr:nth-child(even){background:#fafcfd}
td:nth-child(n+2){font-variant-numeric:tabular-nums}

/* ---------- footer ---------- */
.site-foot{
  background:var(--primary-deep);color:#c4dbe7;
  padding:2.8rem 0 2rem;margin-top:3rem;font-size:.9rem;
}
.site-foot a{color:#d8ecf5;text-decoration:none;border-bottom:1px solid rgba(216,236,245,.28)}
.site-foot a:hover{color:#fff;border-bottom-color:#fff}
.foot-grid{
  display:flex;flex-wrap:wrap;gap:1.8rem 2.6rem;min-width:0;
  padding-bottom:1.8rem;border-bottom:1px solid rgba(255,255,255,.13);
}
.foot-col{flex:1 1 14rem;min-width:0}
.foot-col h2{
  font-family:"Inter",system-ui,sans-serif;
  font-size:.68rem;letter-spacing:.15em;text-transform:uppercase;
  color:#7fb4cd;margin:0 0 .7rem;border:none;padding:0;font-weight:600;
}
.foot-col ul{list-style:none;padding:0;margin:0}
.foot-col li{margin:0 0 .38rem;line-height:1.45}
.foot-note{padding-top:1.4rem;color:#8fb6c8;font-size:.82rem;max-width:60rem}
.foot-note p{margin:0 0 .55rem}

/* ---------- 404 ---------- */
.notfound{text-align:center;padding:5rem 1.25rem 4rem;max-width:38rem;margin:0 auto}
.notfound .code{
  font-family:"Spectral",Georgia,serif;font-size:4.5rem;line-height:1;
  color:var(--rule-strong);margin:0 0 .5rem;
}

/* ---------- safeguard: nothing is hidden waiting on JS ---------- */
[data-aos]{opacity:1 !important;transform:none !important}

@media (max-width:640px){
  body{font-size:16px}
  .prose{padding-top:1.8rem}
  h2{margin-top:2.1rem}
  .hero-body{padding:2.4rem 1.25rem 2rem}
}
@media print{
  .site-head,.site-foot,.hero img{display:none}
  body{font-size:11pt}
}
