/* Milk River Plumbing LLC: main stylesheet. Written fresh for this site.
   Topo-quadrangle world: milky paper, contour dividers, one copper dot. */

* { box-sizing: border-box; margin: 0; }

html, body { overflow-x: clip; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--size-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

::selection { background: var(--river); color: var(--panel); }

* { scrollbar-width: thin; scrollbar-color: var(--river) var(--paper); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--river); }

img { max-width: 100%; height: auto; display: block; }

svg[hidden] { display: none; }

.nw { white-space: nowrap; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; letter-spacing: 0.005em; }
h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

p { max-width: var(--measure); }

a { color: var(--river); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--river-deep); }

:focus-visible {
  outline: 2px solid var(--river);
  outline-offset: 3px;
}

.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 200;
  background: var(--ink); color: var(--panel);
  padding: 10px 16px; text-decoration: none;
}
.skip-link:focus { top: 8px; color: var(--panel); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--s-3); }

/* ---------- header: A36 bar-and-dot, all on one hairline ---------- */

.site-head {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--hairline);
}
.head-bar {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--s-3);
  min-height: var(--header-h);
  display: flex; align-items: center; gap: var(--s-3);
}
.wordmark {
  font-family: var(--display); font-weight: 600; font-size: 1.25rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  letter-spacing: 0.01em;
}
.wordmark:hover { color: var(--ink); }

/* the Hi-Line: 13 dots, each at its town's longitude */
.hiline {
  flex: 1 1 auto; position: relative; height: 12px; min-width: 220px;
  border-bottom: 1px solid var(--hairline);
  align-self: center; margin-bottom: 4px;
}
.hiline i {
  position: absolute; bottom: -3.5px; width: 7px; height: 7px;
  border: 1.5px solid var(--river); border-radius: 50%;
  background: var(--paper); transform: translateX(-50%);
}
.hiline i.here {
  width: 10px; height: 10px; bottom: -5px;
  background: var(--copper); border-color: var(--copper);
}

.site-nav { display: flex; align-items: center; gap: var(--s-3); }
.site-nav a {
  color: var(--ink); text-decoration: none; padding: 12px 2px;
  font-size: var(--size--1); letter-spacing: 0.04em;
  background: linear-gradient(var(--river), var(--river)) no-repeat left bottom / 0 2px;
  transition: background-size var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.site-nav a:hover { background-size: 100% 2px; }
.site-nav a[aria-current="page"] { background-size: 100% 2px; color: var(--river-deep); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--hairline);
  min-width: 44px; min-height: 44px; cursor: pointer; color: var(--ink);
  align-items: center; justify-content: center;
}
.nav-toggle svg { transition: transform var(--t-fast) var(--ease); }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

@media (max-width: 920px) {
  .hiline { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--paper); border-bottom: 1px solid var(--hairline);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--s-1) var(--s-3) var(--s-2);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 14px 4px; font-size: var(--size-0); }
}

/* ---------- hero: B3 panorama band, centered type ---------- */

.hero {
  position: relative; min-height: min(62vh, 640px); display: grid;
  overflow: clip;
}
.hero > picture, .hero > picture img, .hero > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(20,33,43,0.42) 0%, rgba(20,33,43,0.18) 45%, rgba(20,33,43,0.5) 100%);
}
.hero-inner {
  position: relative; z-index: 2; align-self: center; justify-self: center;
  text-align: center; color: var(--panel);
  padding: var(--s-12) var(--s-3);
  max-width: 46rem;
}
.hero-inner h1 { text-shadow: 0 1px 24px rgba(20,33,43,0.5); }
.hero-inner .lede {
  margin: var(--s-3) auto 0; font-size: var(--size-1);
  color: #E8ECEA; text-shadow: 0 1px 16px rgba(20,33,43,0.6);
}

/* C7: the single growing-underline text link */
.cta-link {
  display: inline-block; margin-top: var(--s-4);
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 1.4vw, 1.75rem);
  color: var(--panel); text-decoration: none;
  background: linear-gradient(var(--pale-copper), var(--pale-copper)) no-repeat left bottom / 0 3px;
  padding-bottom: 6px;
  transition: background-size var(--t-rise) var(--ease), color var(--t-fast) var(--ease);
}
.cta-link:hover, .cta-link:focus-visible { background-size: 100% 3px; color: #fff; }
html[data-anim] .cta-link.drawn { background-size: 100% 3px; }

.cta-link.on-paper {
  color: var(--river-deep);
  background-image: linear-gradient(var(--copper), var(--copper));
}
.cta-link.on-paper:hover { color: var(--ink); }

/* ambient: E5 drifting contour lines (CSS only, runs without JS) */
.ambient {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden;
}
.ambient svg { position: absolute; width: 220%; height: 100%; left: 0; top: 0; }
@media (prefers-reduced-motion: no-preference) {
  .ambient .drift-a { animation: drift 64s linear infinite; }
  .ambient .drift-b { animation: drift 88s linear infinite reverse; }
}
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- sections and D12 contour dividers ---------- */

.section { padding: var(--s-12) 0; }
.section.tight { padding: var(--s-8) 0; }

.contour-divider { max-width: var(--max); margin: 0 auto; padding: 0 var(--s-3); }
.contour-divider svg { display: block; width: 100%; height: 30px; }
.contour-divider path { stroke: var(--contour); fill: none; stroke-width: 1; }
.contour-divider path:nth-child(2) { stroke: var(--contour-faint); }

.kicker-line { color: var(--muted); font-size: var(--size--1); letter-spacing: 0.04em; }

/* work rows: alternating photo and copy on ruled ground, no cards */
.workrow {
  display: grid; grid-template-columns: 7fr 5fr; gap: var(--s-6);
  align-items: center; padding: var(--s-8) 0;
}
.workrow:nth-of-type(even) .workrow-photo { order: 2; }
.workrow-photo img { width: 100%; max-height: 540px; object-fit: cover; }
.workrow-copy h2 { margin-bottom: var(--s-2); }
.workrow-copy p { color: var(--muted); }
.workrow-copy .textlink {
  display: inline-block; margin-top: var(--s-2); text-decoration: none;
  color: var(--river-deep); font-weight: 600; font-size: var(--size--1); letter-spacing: 0.03em;
  background: linear-gradient(var(--copper), var(--copper)) no-repeat left bottom / 0 2px;
  padding: 8px 0; transition: background-size var(--t-fast) var(--ease);
}
.workrow-copy .textlink:hover { background-size: 100% 2px; }

@media (max-width: 780px) {
  .workrow { grid-template-columns: 1fr; gap: var(--s-3); padding: var(--s-6) 0; }
  .workrow:nth-of-type(even) .workrow-photo { order: 0; }
}

/* photos ease gently */
.photo-frame { overflow: clip; }
.photo-frame img { transition: transform 600ms var(--ease); }
.photo-frame:hover img { transform: scale(1.02); }

/* ---------- signature: the measured map ---------- */

.map-section h2 { margin-bottom: var(--s-1); }
.map-note { color: var(--muted); margin-bottom: var(--s-4); }
.map-grid {
  display: grid; grid-template-columns: 3fr 2fr; gap: var(--s-6);
  align-items: start;
}
#map {
  height: 460px; background: var(--panel);
  border: 1px solid var(--hairline);
}
.leaflet-container { font-family: var(--body); font-size: 13px; }
#map .leaflet-tile { filter: saturate(0.72) contrast(0.96); }
.town-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--river);
}
.base-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--copper); border: 2px solid var(--panel);
  box-shadow: 0 1px 3px rgba(20,33,43,0.35);
}
html[data-anim] .town-dot, html[data-anim] .base-dot {
  transform: scale(0); transition: transform var(--t-rise) var(--ease);
}
html[data-anim] .town-dot.in, html[data-anim] .base-dot.in { transform: scale(1); }

.townlist { list-style: none; padding: 0; }
.townlist li {
  display: flex; align-items: baseline; gap: var(--s-2);
  padding: 9px 0; border-bottom: 1px solid var(--hairline);
}
.townlist li:first-child { border-top: 1px solid var(--hairline); }
.townlist .town { flex: 0 0 auto; }
.townlist .leader { flex: 1 1 auto; border-bottom: 1px dotted var(--hairline); }
.townlist .mi { color: var(--muted); font-size: var(--size--1); }
.townlist .min { font-weight: 600; font-variant-numeric: tabular-nums; }
.map-fleetline { margin-top: var(--s-3); color: var(--muted); font-size: var(--size--1); max-width: none; }
.map-caveat { margin-top: var(--s-1); color: var(--muted); font-size: var(--size--1); max-width: none; }

@media (max-width: 900px) {
  .map-grid { grid-template-columns: 1fr; }
  #map { height: 380px; }
}

/* ---------- night bands: the outfit, the call band, footer ---------- */

.night { background: var(--night); color: var(--pale-silt); position: relative; overflow: clip; }
.night h2 { color: var(--panel); }
.night a { color: var(--pale-copper); }
.night a:hover { color: #EFC5A4; }
.night .inner { position: relative; z-index: 2; }

.ledger-lines { max-width: var(--max); margin: 0 auto; }
.ledger-lines .line {
  padding: var(--s-2) 0; border-bottom: 1px solid var(--hairline-night);
  display: flex; flex-wrap: wrap; gap: 4px var(--s-2); align-items: baseline;
  max-width: none;
}
.ledger-lines .line:first-of-type { border-top: 1px solid var(--hairline-night); }
.ledger-lines .fact { color: var(--panel); }
.ledger-lines .src { color: var(--pale-silt); font-size: var(--size--1); }

/* river band photo strip */
.riverband { position: relative; overflow: clip; }
.riverband img { width: 100%; height: clamp(260px, 40vh, 420px); object-fit: cover; }
.riverband figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: var(--s-6) var(--s-3) var(--s-3);
  background: linear-gradient(to top, rgba(20,33,43,0.62), transparent);
  color: var(--panel); text-align: center;
}
.riverband figcaption p { max-width: none; text-shadow: 0 1px 10px rgba(20,33,43,0.6); }

/* call band */
.callband { text-align: center; padding: var(--s-12) var(--s-3); }
.callband .phone-big {
  display: inline-block; margin-top: var(--s-3);
  font-family: var(--display); font-weight: 600; font-size: var(--size-phone);
  color: var(--panel); text-decoration: none; font-variant-numeric: tabular-nums;
  background: linear-gradient(var(--pale-copper), var(--pale-copper)) no-repeat left bottom / 0 4px;
  padding-bottom: 8px;
  transition: background-size var(--t-rise) var(--ease);
}
.callband .phone-big:hover, .callband .phone-big:focus-visible { background-size: 100% 4px; color: #fff; }
.callband .alt-line { margin: var(--s-2) auto 0; color: var(--pale-silt); font-size: var(--size--1); max-width: none; }

/* ---------- footer ---------- */

.site-foot { border-top: 1px solid var(--hairline-night); }
.foot-grid {
  max-width: var(--max); margin: 0 auto; padding: var(--s-8) var(--s-3);
  display: grid; grid-template-columns: 2fr 1fr 2fr; gap: var(--s-6);
}
.foot-grid h3 { color: var(--panel); font-size: var(--size-0); margin-bottom: var(--s-2); }
.foot-grid p, .foot-grid li { font-size: var(--size--1); max-width: none; }
.foot-grid ul { list-style: none; padding: 0; }
.foot-grid li a { display: inline-block; padding: 12px 0; text-decoration: none; }
.foot-grid li a:hover { text-decoration: underline; }
.foot-fine {
  border-top: 1px solid var(--hairline-night);
  padding: var(--s-3); text-align: center;
  color: var(--pale-silt); font-size: var(--size--1);
}
.foot-fine p { max-width: none; margin: 0 auto 4px; }
@media (max-width: 780px) {
  .foot-grid { grid-template-columns: 1fr; gap: var(--s-4); }
}

/* ---------- sticky mobile call bar ---------- */

.callbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: none; grid-template-columns: 1fr 1fr;
  background: var(--night); border-top: 1px solid var(--hairline-night);
  transition: transform var(--t-fast) var(--ease);
}
.callbar a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; text-decoration: none; font-weight: 600; font-size: var(--size--1);
  color: var(--panel);
}
.callbar a:first-child { background: var(--copper); color: #fff; }
.callbar a:first-child:hover { color: #fff; }
.callbar a:last-child { color: var(--pale-silt); }
.callbar a:last-child:hover { color: var(--panel); }
.callbar.hidden { transform: translateY(100%); }
@media (max-width: 780px) {
  .callbar { display: grid; }
  body { padding-bottom: 52px; }
}

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: var(--size--1); letter-spacing: 0.03em; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--hairline); border-radius: 0;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--river); box-shadow: 0 0 0 3px rgba(51,96,127,0.22);
}
textarea { min-height: 140px; resize: vertical; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { margin-top: var(--s-3); }
.submit-link {
  display: inline-block; background: none; border: none; cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 1.25rem; color: var(--river-deep);
  padding: 8px 0;
  background-image: linear-gradient(var(--copper), var(--copper));
  background-repeat: no-repeat; background-position: left bottom; background-size: 0 3px;
  transition: background-size var(--t-rise) var(--ease);
}
.submit-link:hover, .submit-link:focus-visible { background-size: 100% 3px; }
.form-msg {
  margin-top: var(--s-3); padding: var(--s-3);
  border-left: 3px solid var(--copper); background: var(--panel);
  display: none;
}
.form-msg.show { display: block; }
.form-msg a { font-weight: 600; }
@media (max-width: 680px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- contact page details ---------- */

.contact-grid { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s-8); align-items: start; }
.contact-facts .row { padding: var(--s-2) 0; border-bottom: 1px solid var(--hairline); }
.contact-facts .row:first-child { border-top: 1px solid var(--hairline); }
.contact-facts .k { font-size: var(--size--1); letter-spacing: 0.03em; color: var(--muted); }
.contact-facts .v { margin-top: 2px; }
.contact-facts .v a { text-decoration: none; }
.contact-facts .v a:hover { text-decoration: underline; }
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; gap: var(--s-6); }
}

/* ---------- page band (subpage heroes) ---------- */

.pageband { position: relative; overflow: clip; display: grid; min-height: 320px; }
.pageband > picture, .pageband > picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pageband::after { content: ""; position: absolute; inset: 0; background: var(--scrim); }
.pageband .pageband-inner {
  position: relative; z-index: 2; align-self: center; justify-self: center; text-align: center;
  color: var(--panel); padding: var(--s-12) var(--s-3);
}
.pageband p { text-shadow: 0 1px 14px rgba(20,33,43,0.6); max-width: none; margin-top: var(--s-2); }

/* ---------- scroll reveals (scoped to data-anim so no-JS renders complete) ---------- */

html[data-anim] .hero-inner > *,
html[data-anim] .pageband-inner > *,
html[data-anim] .hiline i { opacity: 0; }

html[data-anim] .reveal { opacity: 0; transform: translateY(16px); }
html[data-anim] .reveal.shown { opacity: 1; transform: none; transition: opacity var(--t-rise) var(--ease), transform var(--t-rise) var(--ease); }

html[data-anim] .townlist li { opacity: 0; transform: translateY(10px); }
html[data-anim] .townlist li.shown { opacity: 1; transform: none; transition: opacity var(--t-rise) var(--ease), transform var(--t-rise) var(--ease); }

html[data-anim] .contour-divider path { stroke-dasharray: 1400; stroke-dashoffset: 1400; }
html[data-anim] .contour-divider.shown path { stroke-dashoffset: 0; transition: stroke-dashoffset 1400ms var(--ease); }
html[data-anim] .contour-divider.shown path:nth-child(2) { transition-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
