/* WaterProfile Local — colour encodes the USGS hardness class and nothing else. */

:root {
  --paper: #EEF4F6;
  --card: #FFFFFF;
  --ink: #16252E;
  --ink-soft: #44616E;
  --water: #175F78;
  --water-deep: #0F4457;
  --rule: #C6D7DD;

  --soft: #2E9FB0;
  --moderate: #C9A227;
  --hard: #D9772F;
  --veryhard: #A33B22;

  --wrap: 1060px;
  --measure: 68ch;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --display: "Familjen Grotesk", system-ui, sans-serif;
  --body: "Newsreader", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1A20;
    --card: #15262E;
    --ink: #E6EEF1;
    --ink-soft: #A3BAC3;
    --water: #6FC3DA;
    --water-deep: #9BD8E8;
    --rule: #2B4451;
    --soft: #44BACB;
    --moderate: #DFBD4A;
    --hard: #EE9050;
    --veryhard: #D55A3C;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

h1, h2, h3, .brand, nav, .button, th, .pill, figcaption, .band-name, .sr-val, .legend-note, legend, .hint, .crumb, .util-meta, .axis-note {
  font-family: var(--display);
}

h1 { font-size: clamp(1.85rem, 1.35rem + 2.2vw, 2.95rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 .5em; max-width: 24ch; font-weight: 700; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem); line-height: 1.2; letter-spacing: -0.012em; margin: 2.4em 0 .6em; font-weight: 600; max-width: 34ch; }
h3 { font-size: 1.1rem; line-height: 1.25; margin: 1.8em 0 .4em; font-weight: 600; }
main p, main li { max-width: var(--measure); }
main > p, main > ul, main > ol { margin: 0 0 1.1em; }
.lede { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); line-height: 1.5; color: var(--ink-soft); max-width: 60ch; }

a { color: var(--water); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--water-deep); }
:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: .5em .8em; z-index: 10; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--card); }
.site-header .wrap { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; align-items: center; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.02rem; letter-spacing: -0.015em; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; gap: 2px; width: 18px; }
.brand-mark i { display: block; height: 3px; border-radius: 2px; }
.brand-mark .b-soft { background: var(--soft); }
.brand-mark .b-mod { background: var(--moderate); }
.brand-mark .b-hard { background: var(--hard); }
.brand-mark .b-very { background: var(--veryhard); width: 60%; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .95rem; }
.site-header nav a { color: var(--ink-soft); text-decoration: none; }
.site-header nav a:hover { color: var(--water); text-decoration: underline; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 4rem; padding: 1.6rem 0 2.4rem; background: var(--card); }
.site-footer p { max-width: 78ch; }
.small, .site-footer .small { font-size: .88rem; line-height: 1.5; color: var(--ink-soft); }

main { padding-top: 2.2rem; }

/* ---------- hero ---------- */
.hero-section { margin-bottom: 2rem; }
.hero-text h1 { max-width: 30ch; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }

.button {
  display: inline-block; font-weight: 600; font-size: .98rem;
  padding: .66em 1.05em; border-radius: 3px; border: 1.5px solid var(--water);
  background: var(--water); color: var(--paper); text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--water-deep); border-color: var(--water-deep); color: var(--paper); }
.button.secondary { background: transparent; color: var(--water); }
.button.secondary:hover { background: color-mix(in srgb, var(--water) 10%, transparent); color: var(--water-deep); }

/* ---------- the bold element: classified hardness scale ---------- */
/* One shared grid: band strip, every row and the axis use identical columns so
   the four USGS bands line up exactly with the plotted track. */
.scale-figure { margin: 2rem 0 2.6rem; --rail-name: 0rem; --rail-meta: 0rem; --rail-gap: 0rem; }
.scale-bands, .scale-row, .scale-axis-row {
  display: grid;
  grid-template-columns: var(--rail-name) minmax(0, 1fr) var(--rail-meta);
  column-gap: var(--rail-gap);
  padding-left: .45rem; padding-right: .45rem;
}
/* Narrow screens stack: the rails collapse, so the strip spans the full width. */
.scale-bands, .scale-axis-row { grid-template-columns: minmax(0, 1fr); }
.rail-spacer { display: none; }


.scale-bands { padding-top: 0; padding-bottom: 0; }
.bands-inner { display: grid; grid-template-columns: repeat(4, 1fr); }
.band { padding: .3rem .3rem .35rem; border-left: 1px solid var(--rule); line-height: 1.15; min-width: 0; }
.band:last-child { border-right: 1px solid var(--rule); }
.band-name { display: block; font-size: .74rem; font-weight: 600; line-height: 1.2; }
.band .band-name-full { display: none; }
.band .band-name-short { display: block; }
@media (min-width: 760px) {
  .band-name { font-size: .78rem; }
  .band { padding-left: .45rem; padding-right: .45rem; }
  .band .band-name-full { display: block; }
  .band .band-name-short { display: none; }
}
.band-range { display: block; font-size: .72rem; color: color-mix(in srgb, var(--ink-soft) 90%, var(--ink)); font-family: var(--mono); }
.band-soft { background: color-mix(in srgb, var(--soft) 22%, transparent); }
.band-moderate { background: color-mix(in srgb, var(--moderate) 22%, transparent); }
.band-hard { background: color-mix(in srgb, var(--hard) 22%, transparent); }
.band-veryhard { background: color-mix(in srgb, var(--veryhard) 22%, transparent); }

.scale-rows { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.scale-row {
  align-items: center; row-gap: .1rem;
  padding-top: .42rem; padding-bottom: .42rem;
  grid-template-areas: "name name name" "track track track" "meta meta meta";
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  max-width: none;
}
.scale-row:last-child { border-bottom: 0; }
.scale-row.is-current { background: color-mix(in srgb, var(--water) 9%, transparent); }
.sr-name { grid-area: name; font-size: .92rem; font-weight: 600; min-width: 0; }
.sr-name a { text-decoration: none; }
.sr-name a:hover { text-decoration: underline; }
.sr-track { grid-area: track; position: relative; display: block; height: 18px; min-width: 0; }
.sr-track::before { content: ""; position: absolute; inset: 8px 0 auto; height: 2px; background: color-mix(in srgb, var(--rule) 70%, transparent); }
.sr-range { position: absolute; top: 4px; height: 10px; min-width: 3px; border-radius: 5px; opacity: .5; }
.sr-dot { position: absolute; top: 2px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid var(--paper); }
.sr-val { grid-area: meta; font-size: .86rem; font-family: var(--mono); white-space: nowrap; }
.sr-val b { font-family: var(--mono); }
.sr-gpg { color: var(--ink-soft); }
.sr-class { grid-area: meta; font-size: .8rem; justify-self: end; font-weight: 600; }

.scale-axis-row { padding-top: .15rem; }
.scale-axis { position: relative; height: 1.35rem; min-width: 0; }
.scale-axis span { position: absolute; transform: translateX(-50%); font-size: .74rem; font-family: var(--mono); color: var(--ink-soft); }
.scale-axis span:first-child { transform: none; }
.scale-axis span:last-child { transform: translateX(-100%); }

@media (min-width: 760px) {
  /* --rail-meta must equal val + class + one gap so the band strip and the plotted track share identical geometry. */
  .scale-figure { --rail-name: 11rem; --rail-meta: 18.25rem; --rail-gap: .75rem; }
  .rail-spacer { display: block; }
  .scale-bands, .scale-axis-row { grid-template-columns: var(--rail-name) minmax(0, 1fr) var(--rail-meta); }
  .scale-row {
    grid-template-columns: var(--rail-name) minmax(0, 1fr) 10rem 7.5rem;
    grid-template-areas: "name track val class";
  }
  .sr-val { grid-area: val; }
  .sr-class { grid-area: class; justify-self: start; }
}
.axis-note { font-size: .78rem; color: var(--ink-soft); margin: .1rem 0 .7rem; max-width: 70ch; }
figcaption { font-size: .88rem; color: var(--ink-soft); line-height: 1.5; max-width: 76ch; }

/* single-utility SVG figure */
.util-scale { margin: 1.6rem 0 2rem; }
.util-scale-svg { display: block; width: 100%; max-width: 580px; height: auto; margin-bottom: .6rem; }
.util-scale-svg .band-fill { opacity: .28; }
.util-scale-svg .band-fill.is-current { opacity: .62; }
.util-scale-svg .band-soft { fill: var(--soft); }
.util-scale-svg .band-moderate { fill: var(--moderate); }
.util-scale-svg .band-hard { fill: var(--hard); }
.util-scale-svg .band-veryhard { fill: var(--veryhard); }
.util-scale-svg .band-label { font-family: var(--display); font-size: 7.5px; fill: var(--ink); opacity: .75; }
.util-scale-svg .band-label.is-current { opacity: 1; font-weight: 700; }
.util-scale-svg .tick-line { stroke: var(--rule); stroke-width: 1; }
.util-scale-svg .tick-label { font-family: var(--mono); font-size: 7.5px; fill: var(--ink-soft); }
.util-scale-svg .range-fill { opacity: .55; }
.util-scale-svg .dot-stem { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 2; opacity: .5; }
.util-scale-svg .dot-label { font-family: var(--mono); font-size: 11px; font-weight: 700; fill: var(--ink); }
.util-scale-svg .scale-cap { font-family: var(--display); font-size: 10.5px; font-weight: 600; fill: var(--ink); }
.util-scale-svg .scale-sub { font-family: var(--display); font-size: 8px; fill: var(--ink-soft); }
.util-scale-svg .cls-soft { fill: var(--soft); }
.util-scale-svg .cls-moderate { fill: var(--moderate); }
.util-scale-svg .cls-hard { fill: var(--hard); }
.util-scale-svg .cls-veryhard { fill: var(--veryhard); }

/* Below 640px the single-utility figure is drawn at roughly 1:1, so its
   lettering is sized in CSS pixels rather than scaled-up viewBox units. */
@media (max-width: 640px) {
  .util-scale-svg .band-label { font-size: 11.5px; }
  .util-scale-svg .tick-label { font-size: 11px; }
  .util-scale-svg .dot-label { font-size: 12.5px; }
  .util-scale-svg .scale-cap { font-size: 12.5px; }
  .util-scale-svg .scale-sub { font-size: 11px; }
}

/* class colour tokens shared by chart, pills and inline text */
.cls-soft { background: var(--soft); }
.cls-moderate { background: var(--moderate); }
.cls-hard { background: var(--hard); }
.cls-veryhard { background: var(--veryhard); }
.cls-text-soft { color: color-mix(in srgb, var(--soft) 67%, var(--ink)); }
.cls-text-moderate { color: color-mix(in srgb, var(--moderate) 57%, var(--ink)); }
.cls-text-hard { color: color-mix(in srgb, var(--hard) 69%, var(--ink)); }
.cls-text-veryhard { color: color-mix(in srgb, var(--veryhard) 82%, var(--ink)); }
svg .cls-text-soft { fill: color-mix(in srgb, var(--soft) 67%, var(--ink)); }
svg .cls-text-moderate { fill: color-mix(in srgb, var(--moderate) 57%, var(--ink)); }
svg .cls-text-hard { fill: color-mix(in srgb, var(--hard) 69%, var(--ink)); }
svg .cls-text-veryhard { fill: color-mix(in srgb, var(--veryhard) 82%, var(--ink)); }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1em .45em; border: 1px solid currentColor; border-radius: 2px; white-space: nowrap; }

/* ---------- tables ---------- */
.table-wrap { max-width: 100%; overflow-x: auto; margin: 1.1rem 0 1.6rem; border: 1px solid var(--rule); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; vertical-align: top; padding: .55rem .7rem; border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }
thead th { font-size: .85rem; font-weight: 600; background: color-mix(in srgb, var(--water) 9%, transparent); border-bottom: 1.5px solid var(--rule); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { width: 11rem; font-weight: 600; color: var(--ink-soft); }
td { font-variant-numeric: tabular-nums; }
.url-cell { font-family: var(--mono); font-size: .78rem; word-break: break-all; }
.url-cell a { word-break: break-all; }

code { font-family: var(--mono); font-size: .88em; background: color-mix(in srgb, var(--water) 10%, transparent); padding: .1em .32em; border-radius: 2px; }
.formula { font-size: .93rem; color: var(--ink-soft); max-width: 76ch; }

/* ---------- content blocks ---------- */
blockquote.quote-figure { margin: 1.2rem 0 1.5rem; padding: .9rem 1rem; border-left: 4px solid var(--water); background: var(--card); }
blockquote.quote-figure p { margin: 0; font-family: var(--mono); font-size: .88rem; line-height: 1.55; max-width: none; }
blockquote.quote-figure cite { display: block; margin-top: .55rem; font-family: var(--display); font-size: .82rem; font-style: normal; color: var(--ink-soft); }

.caveat { border: 1.5px solid var(--hard); border-left-width: 5px; background: color-mix(in srgb, var(--hard) 8%, var(--card)); padding: .9rem 1rem; margin: 1.2rem 0 1.6rem; }
.caveat p { margin: 0 0 .7rem; max-width: 74ch; }
.caveat p:last-child { margin-bottom: 0; }

.cta { border-top: 2px solid var(--water); border-bottom: 1px solid var(--rule); background: var(--card); padding: 1rem 1.1rem 1.15rem; margin: 2rem 0; }
.cta-title { font-family: var(--display); font-weight: 700; font-size: 1.1rem; margin: 0 0 .35rem; }
.cta p { margin: 0 0 .8rem; max-width: 68ch; }

.features, .post-list, .util-list, .near-list, .inline-list, .notes, .steps { padding-left: 0; }
.features, .post-list, .util-list, .near-list { list-style: none; margin: 1.2rem 0 1.8rem; display: grid; gap: 1.1rem; }
.features li, .post-list li, .util-list li, .near-list li { max-width: 74ch; }
.features h3, .post-card h2 { margin: 0 0 .25rem; }
.features p, .post-card p { margin: 0; }
.util-list li, .near-list li { display: grid; gap: .1rem; padding-bottom: .9rem; border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); }
.util-list li > a, .near-list li > a { font-family: var(--display); font-weight: 600; }
.util-meta { font-size: .9rem; font-family: var(--mono); }
.inline-list { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .6rem 0 1.4rem; }
.notes, .steps { margin: 1rem 0 1.6rem; padding-left: 1.3rem; }
.notes li, .steps li { margin-bottom: .6rem; max-width: 74ch; }
.steps { list-style: decimal; }
.notes { list-style: square; }

.tool-cards { display: grid; gap: 1.2rem; margin: 1.2rem 0 1.8rem; }
@media (min-width: 760px) { .tool-cards { grid-template-columns: 1fr 1fr; } }
.tool-card { border: 1px solid var(--rule); border-top: 3px solid var(--water); background: var(--card); padding: 1rem 1.1rem 1.1rem; }
.tool-card h3 { margin-top: 0; }
.tool-card p { max-width: none; }

.crumb { font-size: .88rem; color: var(--ink-soft); margin: 0 0 .8rem; }
.post-header .hero { display: block; width: 100%; height: auto; max-width: 100%; margin: 1.4rem 0; border: 1px solid var(--rule); }

.faq details { border-bottom: 1px solid var(--rule); padding: .3rem 0; }
.faq summary { cursor: pointer; }
.faq summary h3 { display: inline; margin: 0; font-size: 1.02rem; }
.faq p { margin: .3rem 0 .9rem; }
.author-box, .related { border-top: 1px solid var(--rule); margin-top: 2.4rem; padding-top: .6rem; }

/* ---------- tools ---------- */
.tool { border: 1px solid var(--rule); background: var(--card); padding: 0 0 1rem; margin: 1.6rem 0 2rem; }
.tool fieldset { border: 0; border-bottom: 1px solid var(--rule); margin: 0; padding: 1rem 1.1rem 1.15rem; }
/* float:left makes a multi-line legend flow inside the fieldset instead of straddling its edge. */
.tool legend { float: left; width: 100%; font-weight: 600; font-size: .95rem; padding: 0; }
.legend-note { display: block; font-weight: 400; font-size: .82rem; color: var(--ink-soft); max-width: 62ch; margin-top: .15rem; }
.assumptions { background: color-mix(in srgb, var(--moderate) 8%, transparent); }
.grid-inputs { display: grid; gap: .9rem 1.2rem; margin-top: .8rem; clear: both; }
@media (min-width: 620px) { .grid-inputs { grid-template-columns: 1fr 1fr; } }
.tool label { display: grid; gap: .25rem; font-family: var(--display); font-size: .92rem; font-weight: 600; max-width: none; }
.tool input {
  font: inherit; font-family: var(--mono); font-weight: 400; font-size: 1rem;
  padding: .45em .55em; border: 1.5px solid var(--rule); border-radius: 2px;
  background: var(--paper); color: var(--ink); width: 100%; min-width: 0;
}
.tool input:focus-visible { border-color: var(--water); }
.hint { font-family: var(--body); font-weight: 400; font-size: .83rem; line-height: 1.45; color: var(--ink-soft); }
.tool-out { display: block; padding: 1rem 1.1rem; }
.out-head { font-family: var(--display); font-size: 1.08rem; margin: 0 0 .5rem; max-width: 62ch; }
.out-table { font-size: .9rem; margin-top: .5rem; }
.out-table th { width: auto; white-space: normal; }
.out-table td { font-family: var(--mono); font-size: .86rem; }
.muted { color: var(--ink-soft); font-size: .86rem; }
.tool-actions { display: flex; flex-wrap: wrap; gap: .6rem; padding: 0 1.1rem; }

@media print {
  .site-header nav, .tool-actions, .cta, .site-footer .small { display: none; }
  body { background: #fff; color: #000; }
  .tool, .table-wrap { border-color: #999; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
