/* NMD Plumbing
   Cast-iron ink, porcelain white and one cold-line blue for anything you can tap.
   The logo's "nmd" pipe is the only ornament; icons share its even stroke and round bends. */

:root {
  --white: #ffffff;
  --porcelain: #eef2f3;
  --iron: #1b252c;
  --steel: #55626a;
  --line: #d3dadd;
  --water: #1f5bd1;
  --water-deep: #17469f;
  --water-light: #9dbaff;
  --error: #b42318;
  --ok: #17663a;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.85rem, 1.4rem + 1.9vw, 2.75rem);
  --step-4: clamp(2.6rem, 1.6rem + 4.4vw, 5rem);

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 72px;
  --callbar-h: 0px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--white);
  color: var(--iron);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  padding-bottom: var(--callbar-h);
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--water); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--water); outline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

h1, h2 { font-weight: 800; font-stretch: 125%; line-height: 1.02; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 112%; line-height: 1.25; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 100; background: var(--iron); color: var(--white); padding: 10px 16px; }
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 20px; border: 2px solid transparent; border-radius: 8px;
  font-weight: 600; font-size: 1rem; line-height: 1.1; font-stretch: 106%;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn--large { padding: 17px 26px; font-size: var(--step-0); }
.btn--primary { background: var(--water); color: var(--white); }
.btn--primary:hover { background: var(--water-deep); }
.btn--quiet { border-color: var(--iron); color: var(--iron); background: transparent; }
.btn--quiet:hover { background: var(--iron); color: var(--white); }
.btn--on-dark { border-color: var(--white); color: var(--white); }
.btn--on-dark:hover { background: var(--white); color: var(--iron); }
.link-strong { font-weight: 600; white-space: nowrap; }

/* ---------------------------------------------------------------- header */

.site-header { position: sticky; top: 0; z-index: 50; background: var(--white); border-bottom: 1px solid var(--line); }
.site-header__bar { display: flex; align-items: center; gap: 28px; height: var(--header-h); }

.logo { display: inline-flex; align-items: flex-end; gap: 10px; color: var(--iron); text-decoration: none; }
.logo__mark { width: auto; height: 34px; overflow: visible; }
.logo__mark path { fill: none; stroke: currentColor; stroke-width: 35; }
.logo__word { font-weight: 800; font-stretch: 112%; font-size: 0.95rem; letter-spacing: 0.04em; line-height: 0.9; text-transform: uppercase; }
.logo--stacked { flex-direction: column; align-items: flex-start; gap: 12px; }
.logo--stacked .logo__mark { height: 56px; }

.nav { margin-left: auto; }
.nav__list { display: flex; gap: 26px; }
.nav__list a { color: var(--iron); text-decoration: none; font-weight: 500; font-size: 0.975rem; padding-block: 6px; }
.nav__list a:hover, .nav__list a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--water); text-decoration-thickness: 3px; text-underline-offset: 8px; }
.nav__call { display: none; }
.header-call { padding: 10px 16px; }
.nav-toggle { display: none; }

@media (max-width: 1000px) {
  .site-header__bar { gap: 16px; }
  .header-call { margin-left: auto; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 10px; padding: 10px 4px 10px 8px;
    background: none; border: 0; font-weight: 600; cursor: pointer;
  }
  .nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { display: block; width: 20px; height: 2px; background: currentColor; position: relative; }
  .nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle__bars::before { top: -6px; }
  .nav-toggle__bars::after { top: 6px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { top: 0; transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { top: 0; transform: rotate(-45deg); }

  .nav {
    display: none; position: fixed; inset: var(--header-h) 0 0 0; margin: 0;
    background: var(--white); padding: 24px var(--gutter) 40px; overflow-y: auto;
  }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__list li { border-bottom: 1px solid var(--line); }
  .nav__list a { display: block; padding: 16px 0; font-size: var(--step-2); font-weight: 700; font-stretch: 112%; }
  .nav__call { display: inline-flex; align-items: center; gap: 10px; margin-top: 28px; font-weight: 700; font-size: var(--step-1); text-decoration: none; }
}
@media (max-width: 560px) {
  .header-call { display: none; }
  .nav-toggle { margin-left: auto; }
}

/* ---------------------------------------------------------------- hero */

.hero { position: relative; overflow: hidden; padding-top: clamp(48px, 8vw, 104px); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: clamp(32px, 5vw, 72px); align-items: end; }
.hero__copy { padding-bottom: clamp(84px, 9vw, 120px); }
.hero h1 { max-width: 11ch; }
.hero__lede { margin-top: 28px; max-width: 36rem; font-size: var(--step-1); line-height: 1.5; color: var(--steel); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero__art { justify-self: end; width: 100%; max-width: 440px; }

/* The pipe draws itself in once on load: the lead-in from the screen edge at a steady speed, then the
   letters, easing off at the end of the "d". main.js fits the lead-in to the screen and sets both durations. */
.pipe-run { width: 100%; height: auto; overflow: visible; }
.pipe-run path { fill: none; stroke: var(--iron); stroke-width: 35; stroke-dasharray: 1 1; }
@media (prefers-reduced-motion: no-preference) {
  /* fill-mode "both" holds the hidden first frame through the delay */
  .pipe-run .pipe-run__lead { animation: lay-pipe var(--lead-dur, 0.7s) linear 0.25s both; }
  .pipe-run .pipe-run__mark { animation: lay-pipe var(--mark-dur, 1.5s) cubic-bezier(0.4, 0.4, 0.55, 1) calc(0.25s + var(--lead-dur, 0.7s)) both; }
}
@keyframes lay-pipe { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

@media (max-width: 760px) {
  .hero { padding-top: 28px; }
  .hero__grid { grid-template-columns: 1fr; gap: 0; }
  .hero__art { order: -1; max-width: 168px; margin-bottom: 32px; }
  .hero__copy { padding-bottom: 0; }
  .hero__lede { margin-top: 20px; }
  .hero__actions { margin-top: 28px; }
  .hero__actions .btn { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- sections */

.section { padding-block: clamp(64px, 9vw, 120px); }
.section--tint { background: var(--porcelain); }
.section--flush-top { padding-top: 0; }
.section-head { max-width: 44rem; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head p { margin-top: 16px; font-size: var(--step-1); line-height: 1.5; color: var(--steel); }
.section-head--split { max-width: none; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; }

.page-head { padding-block: clamp(44px, 7vw, 88px) clamp(32px, 4vw, 48px); }
.page-head p { margin-top: 20px; max-width: 40rem; font-size: var(--step-1); line-height: 1.5; color: var(--steel); }
.page-head--404 { padding-bottom: clamp(80px, 12vw, 160px); }

/* services: a 2 by 2 schedule */
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 2px solid var(--iron); }
.service { padding: 36px 0 40px; border-bottom: 1px solid var(--line); }
.service:nth-child(odd) { padding-right: clamp(24px, 4vw, 56px); border-right: 1px solid var(--line); }
.service:nth-child(even) { padding-left: clamp(24px, 4vw, 56px); }
.service__icon { width: 48px; height: 48px; color: var(--water); margin-bottom: 20px; }
.service p { margin-top: 10px; color: var(--steel); max-width: 34rem; }
@media (max-width: 760px) {
  .services { grid-template-columns: 1fr; }
  .service:nth-child(n) { padding: 28px 0 32px; border-right: 0; }
  .service__icon { width: 40px; height: 40px; margin-bottom: 16px; }
}

/* belief + process */
.process { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 7vw, 112px); align-items: start; }
.belief p { font-size: var(--step-3); font-weight: 700; font-stretch: 118%; line-height: 1.12; letter-spacing: -0.01em; text-indent: -0.42em; }
.belief p::before { content: "\201C"; }
.belief p::after { content: "\201D"; }
.steps { margin-top: 32px; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); column-gap: 8px; padding-block: 22px; border-top: 1px solid var(--line); }
.steps li::before { content: counter(step); grid-row: span 2; font-size: var(--step-2); font-weight: 800; font-stretch: 125%; line-height: 1.1; color: var(--water); }
.steps p { margin-top: 6px; color: var(--steel); }
@media (max-width: 860px) { .process { grid-template-columns: 1fr; } }

/* service areas */
.areas { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.areas p { margin-top: 16px; font-size: var(--step-1); color: var(--steel); max-width: 26rem; }
.areas__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; border-top: 2px solid var(--iron); }
.areas__list li { padding-block: 14px; border-bottom: 1px solid var(--line); font-size: var(--step-2); font-weight: 700; font-stretch: 112%; line-height: 1.25; }
@media (max-width: 760px) {
  .areas { grid-template-columns: 1fr; }
  .areas__list { column-gap: 20px; }
  .areas__list li { font-size: var(--step-1); }
}

/* faq */
.faq { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.faq__list { border-top: 2px solid var(--iron); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding-block: 22px; cursor: pointer; list-style: none;
  font-size: var(--step-1); font-weight: 600; font-stretch: 106%; line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 18px; height: 18px;
  background: linear-gradient(var(--water), var(--water)) center / 100% 2.5px no-repeat, linear-gradient(var(--water), var(--water)) center / 2.5px 100% no-repeat;
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 24px; color: var(--steel); max-width: 40rem; }
@media (max-width: 760px) { .faq { grid-template-columns: 1fr; } }

/* dark call band */
.callout { background: var(--iron); color: var(--white); padding-block: clamp(56px, 8vw, 96px); }
.callout :focus-visible, .site-footer :focus-visible { outline-color: var(--water-light); }
.callout__inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px 48px; }
.callout h2 { max-width: 14ch; }
.callout__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; }
.callout__phone { color: var(--white); font-size: var(--step-3); font-weight: 800; font-stretch: 125%; text-decoration: none; white-space: nowrap; }
.callout__phone:hover { text-decoration: underline; text-decoration-color: var(--water-light); }

/* ---------------------------------------------------------------- projects */

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 48px 28px; }
.project__link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.project__photo { aspect-ratio: 4 / 3; margin-bottom: 18px; background: var(--porcelain); overflow: hidden; display: grid; place-items: center; }
.project__photo img { width: 100%; height: 100%; object-fit: cover; }
.project__photo--empty { align-content: center; gap: 12px; color: #a9b5bb; font-size: var(--step--1); }
.project__photo--empty .icon { width: 72px; height: 72px; }
.project__photo--empty span { color: var(--steel); }
.project__tag { align-self: flex-start; font-size: 0.8125rem; font-weight: 600; color: var(--water); margin-bottom: 6px; }
.project__tag--sample { color: var(--steel); border: 1.5px dashed #a9b5bb; border-radius: 4px; padding: 1px 8px; }
.project__title { font-size: var(--step-1); }
.project__link:hover .project__title { text-decoration: underline; text-decoration-color: var(--water); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
.project__meta { margin-top: 4px; font-size: 0.9375rem; color: var(--steel); }
.project__summary { margin-top: 10px; font-size: 1rem; line-height: 1.55; }
.projects-empty { font-size: var(--step-1); color: var(--steel); max-width: 40rem; }
.filters-empty { margin-top: 8px; color: var(--steel); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.filter {
  padding: 9px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--white);
  font-size: 0.9375rem; font-weight: 500; cursor: pointer;
}
.filter span { color: var(--steel); margin-left: 4px; }
.filter:hover { border-color: var(--iron); }
.filter[aria-pressed="true"] { background: var(--iron); border-color: var(--iron); color: var(--white); }
.filter[aria-pressed="true"] span { color: #b9c5cb; }

/* project detail */
.project-dialog {
  width: min(1120px, 100vw - 32px); max-width: none; max-height: calc(100dvh - 32px);
  padding: 0; border: 0; background: var(--white); color: var(--iron);
}
.project-dialog::backdrop { background: rgb(27 37 44 / 0.72); }
.project-dialog__inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); min-height: min(640px, calc(100dvh - 32px)); }
.project-dialog__close {
  position: absolute; top: 12px; right: 12px; z-index: 2; padding: 9px 14px;
  background: var(--white); border: 1.5px solid var(--line); border-radius: 8px; font-weight: 600; cursor: pointer;
}
.project-dialog__close:hover { border-color: var(--iron); }
.project-dialog__media { display: flex; flex-direction: column; background: var(--porcelain); }
.project-dialog__figure { flex: 1; display: grid; place-items: center; align-content: center; gap: 4px; padding: 24px; min-height: 280px; }
.project-dialog__img { max-height: calc(100dvh - 200px); width: auto; object-fit: contain; }
.project-dialog__figure.is-empty { color: #a9b5bb; }
.project-dialog__figure.is-empty .icon { width: 120px; height: 120px; }
.project-dialog__caption { margin-top: 12px; font-size: 0.9375rem; color: var(--steel); text-align: center; }
.project-dialog__nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px 20px; }
.project-dialog__nav button { padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--white); font-weight: 600; cursor: pointer; }
.project-dialog__nav button:hover { border-color: var(--iron); }
.project-dialog__count { font-size: 0.9375rem; color: var(--steel); }
.project-dialog__body { display: flex; flex-direction: column; align-items: flex-start; padding: 64px 36px 36px; overflow-y: auto; }
.project-dialog__tag { font-size: 0.8125rem; font-weight: 600; color: var(--water); }
.project-dialog__title { margin-top: 6px; font-size: var(--step-2); }
.project-dialog__meta { margin-top: 8px; color: var(--steel); }
.project-dialog__summary { margin-top: 20px; }
.project-dialog__details { margin: 20px 0 0; border-top: 1px solid var(--line); align-self: stretch; }
.project-dialog__details li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
.project-dialog__details:empty { display: none; }
.project-dialog__body .btn { margin-top: auto; }
.project-dialog__summary + .project-dialog__details + .btn, .project-dialog__summary + .btn { margin-top: 32px; }
@media (max-width: 860px) {
  .project-dialog { width: 100vw; max-height: none; height: 100dvh; margin: 0; }
  .project-dialog__inner { grid-template-columns: 1fr; min-height: 100%; }
  .project-dialog__figure { padding: 56px 12px 12px; min-height: 240px; }
  .project-dialog__img { max-height: 56dvh; }
  .project-dialog__body { padding: 24px var(--gutter) 40px; overflow: visible; }
}

/* ---------------------------------------------------------------- contact */

.contact { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); gap: clamp(40px, 7vw, 104px); align-items: start; }
.contact__call { border-top: 2px solid var(--iron); padding-top: 24px; }
.contact__call h2 { font-size: var(--step-1); font-stretch: 112%; font-weight: 700; }
.contact__call h2 + * { margin-top: 8px; }
.contact__call p { color: var(--steel); }
.contact__call p + h2 { margin-top: 36px; }
.contact__phone { display: inline-block; font-size: var(--step-3); font-weight: 800; font-stretch: 125%; text-decoration: none; line-height: 1.1; margin-bottom: 10px; }
.contact__phone:hover { text-decoration: underline; }

.quote-form { border-top: 2px solid var(--iron); padding-top: 24px; }
.quote-form h2 { font-size: var(--step-1); font-stretch: 112%; font-weight: 700; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.field label { font-size: 0.9375rem; font-weight: 600; }
.optional { font-weight: 400; color: var(--steel); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid #aab6bc; border-radius: 6px; background: var(--white);
  font-size: 1rem; line-height: 1.4;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--water); }
.field [aria-invalid="true"] { border-color: var(--error); }
.field__error { font-size: 0.875rem; color: var(--error); }
.field--trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.quote-form .btn { margin-top: 6px; }
.form-status { margin-top: 16px; font-weight: 500; max-width: 36rem; }
.form-status.is-error { color: var(--error); }
.form-status.is-ok { color: var(--ok); }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } .quote-form .btn { width: 100%; } }

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

.site-footer { background: var(--iron); color: #c9d2d7; border-top: 1px solid rgb(255 255 255 / 0.12); font-size: 0.975rem; }
.site-footer a { color: var(--white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 40px; padding-block: 64px 48px; }
.footer-brand .logo { color: var(--white); }
.footer-brand p { margin-top: 20px; max-width: 18rem; }
.site-footer h2 { font-size: 0.975rem; font-stretch: 100%; font-weight: 600; letter-spacing: 0; color: var(--white); margin-bottom: 10px; }
.site-footer li + li { margin-top: 6px; }
.footer-phone { font-size: var(--step-1); font-weight: 800; font-stretch: 118%; margin-bottom: 6px; }
.footer-bottom { padding-block: 20px 28px; border-top: 1px solid rgb(255 255 255 / 0.12); font-size: 0.875rem; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; gap: 32px; } }

/* phone bar on small screens */
.callbar { display: none; }
@media (max-width: 760px) {
  :root { --callbar-h: 64px; }
  .callbar {
    display: grid; grid-template-columns: 1.6fr 1fr; position: fixed; inset: auto 0 0 0; z-index: 60;
    height: calc(var(--callbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--iron); box-shadow: 0 -1px 0 rgb(255 255 255 / 0.1);
  }
  .callbar a { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-stretch: 106%; color: var(--white); text-decoration: none; }
  .callbar a:hover { text-decoration: none; }
  .callbar__call { background: var(--water); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
