/* ============================================================
   Maine Plumbing Code Guide — shared stylesheet
   Palette:
     --ink       #1B2431  cold slate (near-black blue)
     --frost     #EEF2F4  pale ice
     --paper     #FAFBFC  page ground
     --copper    #B4632C  copper pipe
     --copper-hi #D98A4B  polished copper highlight
     --brass     #8C6A2F  valve brass (muted, captions)
     --pipe-grey #97A3AE  galvanized grey
   Type:
     Display: "Bricolage Grotesque" — sturdy, characterful
     Body:    "Public Sans" — plainspoken, legible
     Mono:    "IBM Plex Mono" — code citations
   ============================================================ */

:root {
  --ink: #1B2431;
  --ink-soft: #37424F;
  --frost: #EEF2F4;
  --paper: #FAFBFC;
  --copper: #B4632C;
  --copper-hi: #D98A4B;
  --brass: #8C6A2F;
  --pipe-grey: #97A3AE;
  --rule: #D5DDE2;
  --maxw: 1080px;
  --rail: 26px; /* x-position of the copper supply line */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

h1, h2, h3, h4 {
  font-family: "Bricolage Grotesque", "Public Sans", sans-serif;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.01em;
}

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

code, .cite {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.86em;
  background: var(--frost);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- header / nav ---------- */
header.site {
  background: var(--ink);
  color: #fff;
  border-bottom: 4px solid var(--copper);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: #fff;
}
.brand svg { display: block; }
.brand-name {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.brand-sub {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  color: var(--copper-hi);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
nav.main { margin-left: auto; }
nav.main ul {
  list-style: none;
  display: flex;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
nav.main a {
  display: block;
  padding: 0.45rem 0.7rem;
  color: #CBD5DD;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  border-radius: 4px;
}
nav.main a:hover { color: #fff; background: rgba(255,255,255,0.08); }
nav.main a[aria-current="page"] {
  color: #fff;
  background: var(--copper);
}

/* ---------- hero ---------- */
.hero {
  background:
    linear-gradient(160deg, var(--ink) 0%, #24313F 60%, #2C3B4C 100%);
  color: #E8EEF2;
  padding: 3.5rem 1.5rem 3rem;
  position: relative;
  overflow: hidden;
}
.hero::after { /* faint pipe grid in the background */
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 84px 84px;
  pointer-events: none;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; position: relative; z-index: 1; }
.hero .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper-hi);
  margin: 0 0 0.8rem;
}
.hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4.5vw, 3.1rem);
  margin: 0 0 1rem;
  max-width: 21ch;
  font-weight: 700;
}
.hero p.lede {
  font-size: 1.1rem;
  max-width: 62ch;
  color: #C6D2DA;
  margin: 0;
}
.hero .code-tags { margin-top: 1.6rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.code-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(217,138,75,0.55);
  color: var(--copper-hi);
  border-radius: 999px;
  background: rgba(0,0,0,0.25);
}

/* ---------- main layout with copper supply-line rail ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  position: relative;
}
/* the supply line: a copper run down the left of the content */
main.railed { padding-left: calc(1.5rem + var(--rail) + 26px); }
main.railed::before {
  content: "";
  position: absolute;
  left: var(--rail);
  top: 3.2rem;
  bottom: 2rem;
  width: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--copper-hi), var(--copper) 30%, #8F4E22 100%);
  box-shadow: inset -1.5px 0 0 rgba(0,0,0,0.25), inset 1.5px 0 0 rgba(255,255,255,0.35);
}
section.run { position: relative; margin-bottom: 3.2rem; }
/* fitting: a tee joint where each section taps off the main line */
.fitting {
  position: absolute;
  /* section content starts at main padding (1.5rem + rail + 26px); pull the
     fitting back so its center lands on the rail's center line */
  left: calc(-1 * (1.5rem + var(--rail) + 26px) + var(--rail) + 3px - 10px);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--copper-hi), var(--copper) 55%, #7E441D);
  box-shadow: 0 1px 2px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.4);
  margin-top: 0.35rem;
}
.fitting::after { /* branch stub toward the section heading */
  content: "";
  position: absolute;
  left: 18px; top: 7px;
  width: 34px; height: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--copper-hi), var(--copper));
}

section.run > h2 {
  font-size: 1.55rem;
  margin: 0 0 0.4rem;
  scroll-margin-top: 1rem;
}
.section-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 0.35rem;
}
section.run h3 { font-size: 1.12rem; margin: 1.6rem 0 0.4rem; }
section.run p { max-width: 70ch; }
section.run ul, section.run ol { max-width: 68ch; padding-left: 1.3rem; }
section.run li { margin-bottom: 0.45rem; }

/* ---------- components ---------- */
.callout {
  border-left: 5px solid var(--copper);
  background: #FBF3EC;
  padding: 1rem 1.2rem;
  border-radius: 0 6px 6px 0;
  max-width: 70ch;
  margin: 1.4rem 0;
}
.callout.frost { border-left-color: var(--pipe-grey); background: var(--frost); }
.callout .callout-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.25rem;
}

table.spec {
  border-collapse: collapse;
  width: 100%;
  max-width: 860px;
  margin: 1.4rem 0;
  font-size: 0.93rem;
}
table.spec caption {
  caption-side: top;
  text-align: left;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  padding-bottom: 0.5rem;
}
table.spec th {
  text-align: left;
  background: var(--ink);
  color: #fff;
  padding: 0.55rem 0.8rem;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
}
table.spec td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.spec tr:nth-child(even) td { background: var(--frost); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.1rem;
  margin: 1.6rem 0;
}
.card {
  border: 1px solid var(--rule);
  border-top: 4px solid var(--copper);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(27,36,49,0.05);
}
.card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.card p { font-size: 0.92rem; margin: 0 0 0.6rem; color: var(--ink-soft); }
.card a.more {
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.card a.more::after { content: " →"; }

.timeline { list-style: none; padding: 0; margin: 1.6rem 0; max-width: 760px; }
.timeline li {
  position: relative;
  padding: 0 0 1.4rem 2rem;
  border-left: 3px solid var(--rule);
  margin-left: 0.5rem;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -9px; top: 0.25rem;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--copper-hi), var(--copper) 60%, #7E441D);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4);
}
.timeline .t-date {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--brass);
  display: block;
  text-transform: uppercase;
}
.timeline .t-title { font-weight: 700; font-family: "Bricolage Grotesque", sans-serif; }
.timeline p { margin: 0.25rem 0 0; font-size: 0.94rem; max-width: 62ch; }

.disclaimer {
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1rem;
  max-width: 78ch;
}

/* ---------- footer ---------- */
footer.site {
  background: var(--ink);
  color: #AEBAC4;
  border-top: 4px solid var(--copper);
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.6rem;
  font-size: 0.86rem;
}
.footer-inner h4 {
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}
.footer-inner ul { list-style: none; margin: 0; padding: 0; }
.footer-inner li { margin-bottom: 0.35rem; }
.footer-inner a { color: #CBD5DD; text-decoration: none; }
.footer-inner a:hover { color: var(--copper-hi); text-decoration: underline; }
.footer-legal {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: #7E8B96;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  main.railed { padding-left: 1.5rem; }
  main.railed::before, .fitting { display: none; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  nav.main { margin-left: 0; }
}
