/* ====================================================================
   WERM Limited (Water & Environmental Resource Management)
   Design system: navy ink from the WERM wordmark; red/blue accent pair
   drawn from the firm's own drainage drawings (red = foul sewer,
   blue = surface water). Report-figure treatment for photographs.
   ==================================================================== */

:root {
    --paper: #f8f9fb;
    --panel: #edf1f7;
    --card: #ffffff;
    --ink: #18223b;
    --muted: #4c5970;
    --navy: #26335f;
    --navy-deep: #161f3d;
    --line: #d8dee9;
    --foul: #b03a28;
    --surf: #33749c;
    --radius: 8px;
    --site-max: 1140px;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ==================== RESET / BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    line-height: 1.65;
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    overflow-wrap: break-word;
}

/* Touch devices: no sticky :hover states, no blue flash on tap */
@media (hover: none) {
    a, button {
        -webkit-tap-highlight-color: rgba(38, 51, 95, 0.12);
    }
}

img, svg {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, textarea {
    font: inherit;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.1rem, 4.2vw, 3.1rem); }
h2 { font-size: clamp(1.65rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }

p {
    margin: 0;
}

.container {
    width: min(100%, var(--site-max));
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3.5rem;
    padding: 0.7rem 1.1rem;
    background: var(--navy-deep);
    color: #fff;
    border-radius: var(--radius);
    z-index: 1000;
    font-weight: 600;
    transition: top 160ms ease;
}

.skip-link:focus {
    top: 1rem;
}

::selection {
    background: var(--navy);
    color: #fff;
}

/* ==================== TYPE UTILITIES ==================== */
.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--navy);
    margin-bottom: 0.9rem;
}

/* The two-systems rule: foul (red) over surface (blue) */
.rule-duo {
    display: block;
    width: 40px;
    margin-bottom: 1rem;
}

.rule-duo::before,
.rule-duo::after {
    content: '';
    display: block;
    height: 3px;
}

.rule-duo::before {
    background: var(--foul);
    margin-bottom: 3px;
}

.rule-duo::after {
    background: var(--surf);
}

.lead {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 40rem;
}

.lead a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.98rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn-primary {
    background: var(--navy);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--navy-deep);
}

.btn-outline {
    background: transparent;
    color: var(--navy);
    border-color: var(--navy);
}

.btn-outline:hover,
.btn-outline:focus-visible {
    background: var(--navy);
    color: #fff;
}

/* ==================== NAVBAR ==================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 999;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    transition: box-shadow 200ms ease;
}

.navbar.scrolled {
    box-shadow: 0 6px 24px rgba(22, 31, 61, 0.08);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    min-height: 76px;
    transition: min-height 250ms ease;
}

.navbar.scrolled .navbar-inner {
    min-height: 62px;
}

.navbar.scrolled .brand-logo {
    height: 1.5rem;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.brand-logo {
    height: 1.9rem;
    width: auto;
    transition: height 250ms ease;
}

.brand-sub {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 0.35rem;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 1.9rem;
}

.navbar-links a {
    font-weight: 500;
    font-size: 0.97rem;
    color: var(--ink);
    padding: 0.35rem 0;
    position: relative;
}

.navbar-links a:not(.nav-phone)::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: var(--navy);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 200ms ease;
}

.navbar-links a:not(.nav-phone):hover::after,
.navbar-links a:not(.nav-phone).active::after {
    transform: scaleX(1);
}

.navbar-links a.nav-phone {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    border: 1px solid var(--navy);
    border-radius: var(--radius);
    color: var(--navy);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: background 160ms ease, color 160ms ease;
}

.navbar-links a.nav-phone:hover,
.navbar-links a.nav-phone:focus-visible {
    background: var(--navy);
    color: #fff;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 200ms ease, opacity 200ms ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==================== SECTIONS ==================== */
.section {
    padding: 4.5rem 0;
}

.section--panel {
    background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M44 0H0V44' fill='none' stroke='%2326335f' stroke-opacity='0.045'/%3E%3C/svg%3E");
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.section-head {
    max-width: 44rem;
    margin-bottom: 2.5rem;
}

.section-head p {
    margin-top: 1rem;
    color: var(--muted);
    font-size: 1.05rem;
}

/* ==================== HERO ==================== */
.hero {
    position: relative;
    overflow: hidden;
    padding: 4.5rem 0 4rem;
    background: radial-gradient(60% 90% at 88% 10%, rgba(51, 116, 156, 0.08), transparent 70%),
                radial-gradient(50% 80% at 5% 95%, rgba(176, 58, 40, 0.05), transparent 70%);
}

.hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-bg svg {
    width: 100%;
    height: 100%;
    transform: translate(calc(var(--px, 0) * 12px), calc(var(--py, 0) * 8px)) scale(1.03);
    transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.bg-pipe {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 3 15;
}

.bg-pipe--surf {
    stroke: #33749c;
    stroke-opacity: 0.35;
}

.bg-pipe--foul {
    stroke: #b03a28;
    stroke-opacity: 0.28;
}

.hero-grid {
    position: relative;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 3.5rem;
    align-items: center;
}

.hero-copy h1 {
    max-width: 17ch;
}

.hero-copy .lead {
    margin-top: 1.4rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 2.2rem;
}

/* ==================== FIGURES (report style) ==================== */
.figure {
    margin: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.75rem;
}

/* width/height attributes are present on these images to reserve layout
   space; height:auto keeps them scaling by their own aspect ratio */
.figure img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.figure figcaption {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.7rem 0.35rem 0.15rem;
    line-height: 1.55;
}

/* ==================== CONTACTED / STEPS ==================== */
.contacted-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
    gap: 2.5rem;
    align-items: start;
}

.step-list {
    display: grid;
    gap: 1rem;
    margin: 2.2rem 0 0;
    padding: 0;
    list-style: none;
}

.contacted-grid .step-list {
    margin-top: 0;
}

.step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem 1.6rem;
}

.step-num {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--navy);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.15rem;
}

.step h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.step p {
    color: var(--muted);
    font-size: 0.98rem;
}

/* Verification card */
.verify-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 4px solid var(--navy);
    border-radius: var(--radius);
    padding: 1.8rem;
    position: sticky;
    top: 100px;
}

/* Below the contact details rather than beside a scrolling column */
.verify-card--inline {
    position: static;
    margin-top: 1.25rem;
}

.verify-card h3 {
    margin-bottom: 0.75rem;
}

.verify-card > p {
    color: var(--muted);
    font-size: 0.97rem;
}

.verify-list {
    list-style: none;
    margin: 1.3rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.9rem;
}

.verify-list li {
    position: relative;
    padding-left: 1.7rem;
    font-size: 0.97rem;
    color: var(--ink);
}

.verify-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.5;
}

.verify-list a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.verify-note {
    margin-top: 1.4rem;
    padding: 0.9rem 1rem;
    background: var(--panel);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--ink);
}

/* ==================== MISCONNECTION EXPLAINER ==================== */
.explain-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
    grid-template-areas:
        "copy photo"
        "diagram diagram";
    gap: 2.5rem 3rem;
    align-items: start;
}

.explain-copy {
    grid-area: copy;
}

.explain-photo {
    grid-area: photo;
}

.explain-grid .diagram-figure {
    grid-area: diagram;
    /* Let the figure shrink below the drawing's min-width so the
       scroll container engages instead of overflowing the page */
    min-width: 0;
    max-width: 100%;
}

.diagram {
    display: block;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
}

.explain-copy p {
    color: var(--muted);
    margin-top: 1rem;
    font-size: 1.02rem;
}

.explain-copy p strong {
    color: var(--ink);
}

.key-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    margin-top: 1.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.key-row span {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.key-swatch {
    width: 22px;
    height: 3px;
    display: inline-block;
}

.key-swatch--foul { background: var(--foul); }
.key-swatch--surf { background: var(--surf); }

.diagram-figure {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 0.9rem;
    margin: 0;
}

/* Two drawings of the same thing: landscape for wide screens, portrait for
   phones. Below ~700px the landscape labels scale under 10px, so it is
   swapped out rather than shrunk. */
.diagram--tall {
    display: none;
}

@media (max-width: 700px) {
    .diagram--wide {
        display: none;
    }

    .diagram--tall {
        display: block;
        max-width: 420px;
    }
}

.diagram text {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    fill: var(--muted);
}

.diagram .lbl-foul { fill: var(--foul); }
.diagram .lbl-surf { fill: var(--surf); }
.diagram .lbl-warn { fill: #fff; font-weight: 700; font-size: 12px; }

/* Wastewater visibly flows the wrong way down the misconnected pipe.
   Dash pattern is 6 5 (period 11); offset -22 = two periods per loop. */
@media (prefers-reduced-motion: no-preference) {
    .pipe-flow {
        animation: pipe-flow 1.6s linear infinite;
    }
}

@keyframes pipe-flow {
    to {
        stroke-dashoffset: -22;
    }
}

.diagram-figure figcaption {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.8rem;
    line-height: 1.55;
}


/* ==================== SERVICES ==================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.service-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.8rem;
}

.service-card h3 {
    margin-bottom: 0.6rem;
}

.service-card p {
    color: var(--muted);
    font-size: 0.98rem;
}

.service-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--navy);
    background: var(--panel);
    border-radius: 4px;
    padding: 0.3rem 0.55rem;
    margin-bottom: 1rem;
}

.services-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
    gap: 2.5rem;
    align-items: start;
}

/* ==================== FACTS BAND ==================== */
.facts-band {
    background: var(--navy-deep);
    color: #fff;
    padding: 4rem 0;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}

.fact strong {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2.5rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.fact p {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.97rem;
}

/* ==================== CTA PANEL ==================== */
.cta-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: var(--navy-deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M44 0H0V44' fill='none' stroke='%23ffffff' stroke-opacity='0.05'/%3E%3C/svg%3E");
    border-radius: var(--radius);
    padding: 2.6rem 2.8rem;
}

.cta-panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--foul) 0 50%, var(--surf) 50% 100%);
}

.cta-panel h2 {
    color: #fff;
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    max-width: 28ch;
}

.cta-panel p {
    color: rgba(255, 255, 255, 0.72);
    margin-top: 0.5rem;
}

.cta-panel .btn-primary {
    background: #fff;
    color: var(--navy);
}

.cta-panel .btn-primary:hover,
.cta-panel .btn-primary:focus-visible {
    background: var(--panel);
}

.cta-panel .btn-outline {
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
}

.cta-panel .btn-outline:hover,
.cta-panel .btn-outline:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

/* Support reference on the error page */
.error-ref {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-top: 0.75rem;
    overflow-wrap: anywhere;
}

/* ==================== ABOUT PAGE ==================== */
.page-hero {
    padding: 4rem 0 3rem;
    border-bottom: 1px solid var(--line);
}

.page-hero .lead {
    margin-top: 1.2rem;
}

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    gap: 3rem;
    align-items: start;
}

.about-copy h2 {
    margin-bottom: 1rem;
}

.about-copy h2:not(:first-child) {
    margin-top: 2.5rem;
}

.about-copy p {
    color: var(--muted);
    margin-top: 1rem;
    font-size: 1.02rem;
}

.about-copy ul {
    margin: 1.2rem 0 0;
    padding-left: 1.2rem;
    color: var(--muted);
    line-height: 1.85;
}

.about-copy li {
    margin-bottom: 0.5rem;
}

.values-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.value-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.value-item h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.value-item p {
    color: var(--muted);
    font-size: 0.94rem;
}

/* ==================== CONTACT PAGE ==================== */
.contact-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.contact-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.7rem;
}

.contact-card h3 {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.7rem;
}

.contact-card p,
.contact-card a {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.contact-card a:hover {
    color: var(--navy);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.contact-card .sub {
    display: block;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 0.4rem;
}

.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
    gap: 2.5rem;
    align-items: start;
}

.form-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.2rem;
}

.form-panel h2 {
    margin-bottom: 0.5rem;
}

.form-panel > p {
    color: var(--muted);
    margin-bottom: 1.6rem;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.form-panel > p.contact-note {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.contact-form {
    display: grid;
    gap: 1.1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
}

.form-group {
    display: grid;
    gap: 0.45rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--surf);
    box-shadow: 0 0 0 3px rgba(51, 116, 156, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 130px;
}

.text-danger {
    color: var(--foul);
    font-size: 0.85rem;
}

.alert {
    padding: 1rem 1.2rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    font-size: 0.97rem;
}

.alert-success {
    background: #eaf3ec;
    color: #1e4d2b;
    border: 1px solid #bcd8c3;
}

.contact-form .btn {
    justify-self: start;
}

/* ==================== FOOTER ==================== */
.site-footer {
    background: var(--navy-deep);
    color: rgba(255, 255, 255, 0.82);
    margin-top: 4rem;
}

.footer-main {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr);
    gap: 2.5rem;
    padding-top: 3.2rem;
    padding-bottom: 2.6rem;
}

.footer-logo {
    height: 1.7rem;
    width: auto;
    opacity: 0.95;
}

.footer-brand .tagline {
    font-family: var(--font-display);
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.5rem;
}

.footer-brand p {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 1rem;
    max-width: 34rem;
}

.footer-brand p.footer-legal {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.75rem;
}

.footer-col h3 {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 1rem;
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.footer-col a {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

.footer-col a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-col p {
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.footer-bottom .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-top: 1.2rem;
    padding-bottom: 1.4rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
}

/* Build credit: quieter than the copyright line beside it */
.footer-credit {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.38);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .hero-grid,
    .contacted-grid,
    .explain-grid,
    .services-layout,
    .about-grid,
    .contact-layout {
        grid-template-columns: 1fr;
    }

    /* Stack the explainer: copy, then the diagram, then the photo */
    .explain-grid {
        grid-template-areas:
            "copy"
            "diagram"
            "photo";
    }

    .verify-card {
        position: static;
    }

    .values-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .contact-cards {
        grid-template-columns: 1fr;
    }

    .footer-main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 820px) {
    .menu-toggle {
        display: flex;
    }

    .navbar-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: #fff;
        border-bottom: 1px solid var(--line);
        padding: 1rem 1.5rem 1.4rem;
        gap: 0.4rem;
        opacity: 0;
        transform: translateY(-10px);
        visibility: hidden;
        pointer-events: none;
        transition: opacity 240ms ease, transform 240ms ease, visibility 240ms;
    }

    .navbar-links.open {
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
    }

    .navbar-links a {
        padding: 0.7rem 0;
        font-size: 1.05rem;
    }

    .nav-phone {
        justify-content: center;
        margin-top: 0.5rem;
    }

    .hero {
        padding-top: 3rem;
    }

    /* On small screens the single column leaves no clear space for the
       background survey lines, so they end up running through the text */
    .hero-bg {
        display: none;
    }

    /* The crossed underline collides with the heading's next line once
       the type wraps tightly on small screens */
    .hl-mis::before,
    .hl-mis::after {
        display: none;
    }

    .section {
        padding: 3.25rem 0;
    }

    .facts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .services-grid,
    .form-grid,
    .values-row {
        grid-template-columns: 1fr;
    }

    .cta-panel {
        padding: 1.8rem;
    }

    .step {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .cta-panel h2 {
        max-width: none;
    }

    /* Menu links get a full-height tap target and can scroll if the
       viewport is short (landscape phones) */
    .navbar-links {
        max-height: calc(100dvh - 76px);
        overflow-y: auto;
        box-shadow: 0 12px 24px rgba(22, 31, 61, 0.1);
    }

    .navbar-links a {
        display: flex;
        align-items: center;
        min-height: 48px;
    }
}


/* ==================== PHONE ==================== */
@media (max-width: 600px) {
    html {
        scroll-padding-top: 84px;
    }

    .container {
        padding: 0 1.15rem;
    }

    h1 {
        font-size: clamp(1.8rem, 7.6vw, 2.3rem);
    }

    h2 {
        font-size: clamp(1.45rem, 6vw, 1.8rem);
    }

    .lead {
        font-size: 1.04rem;
    }

    .section {
        padding: 2.75rem 0;
    }

    .section-head {
        margin-bottom: 1.75rem;
    }

    .section-head p {
        font-size: 1rem;
    }

    .hero {
        padding: 2.25rem 0 2.75rem;
    }

    .hero-grid {
        gap: 2.25rem;
    }

    .hero-copy h1 {
        max-width: none;
    }

    /* Full-width actions: bigger targets and a predictable stacking order */
    .hero-actions,
    .cta-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
    }

    .hero-actions {
        margin-top: 1.6rem;
    }

    .page-hero {
        padding: 2.5rem 0 2rem;
    }

    /* The wordmark plus the full legal name is the header's whole job;
       tighten it so it still fits two lines beside the menu button */
    .navbar-inner {
        min-height: 66px;
        gap: 1rem;
    }

    .brand-logo {
        height: 1.6rem;
    }

    .brand-sub {
        font-size: 0.5rem;
        letter-spacing: 0.07em;
        margin-top: 0.3rem;
    }

    .eyebrow {
        font-size: 0.66rem;
        letter-spacing: 0.12em;
        margin-bottom: 0.7rem;
    }

    /* Uppercase mono captions run to four lines at this width; loosen the
       tracking constraint rather than the size */
    .figure figcaption,
    .diagram-figure figcaption {
        font-size: 0.65rem;
        letter-spacing: 0.04em;
    }

    .figure {
        padding: 0.55rem;
    }

    .step,
    .service-card,
    .value-item,
    .verify-card,
    .contact-card,
    .form-panel {
        padding: 1.35rem 1.25rem;
    }

    .diagram-figure {
        padding: 1rem 0.9rem 0.7rem;
    }

    .facts-band {
        padding: 2.75rem 0;
    }

    .fact strong {
        font-size: 1.7rem;
    }

    .cta-panel {
        padding: 1.5rem 1.35rem;
    }

    .key-row {
        gap: 0.6rem 1.2rem;
        margin-top: 1.3rem;
    }

    .footer-main {
        padding-top: 2.5rem;
        padding-bottom: 2rem;
    }

    .btn {
        padding: 0.9rem 1.4rem;
    }

    /* Keep inputs at 16px so iOS Safari does not zoom on focus */
    .form-control {
        font-size: 16px;
    }

    .contact-form .btn {
        justify-self: stretch;
    }
}


/* ==================== MOTION LAYER ==================== */
::selection {
    background: var(--navy);
    color: #fff;
}

/* Cross-fade between pages where the View Transitions API exists */
@view-transition {
    navigation: auto;
}

/* Twin-line scroll progress under the navbar: the two systems track the page */
.scroll-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    pointer-events: none;
}

.sp {
    display: block;
    height: 2px;
    transform: scaleX(var(--scroll-p, 0));
    transform-origin: left;
}

.sp--foul {
    background: var(--foul);
}

.sp--surf {
    background: var(--surf);
    transition: transform 180ms linear;
}

/* Crossed red/blue underline on the headline word */
.hl-mis {
    position: relative;
}

.hl-mis::before,
.hl-mis::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 2px;
    pointer-events: none;
}

.hl-mis::before {
    background: var(--foul);
    bottom: -2px;
    transform: rotate(-1deg);
}

.hl-mis::after {
    background: var(--surf);
    bottom: -7px;
    transform: rotate(1.2deg);
}

/* Drawing-sheet corner marks on photo figures */
.figure {
    position: relative;
}

.figure::before,
.figure::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
}

.figure::before {
    top: 5px;
    left: 5px;
    border-top: 2px solid rgba(38, 51, 95, 0.32);
    border-left: 2px solid rgba(38, 51, 95, 0.32);
}

.figure::after {
    top: 5px;
    right: 5px;
    border-top: 2px solid rgba(38, 51, 95, 0.32);
    border-right: 2px solid rgba(38, 51, 95, 0.32);
}

/* Diagram fix toggle */
.diagram-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.55rem 1.05rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--navy);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease;
}

.diagram-toggle:hover,
.diagram-toggle:focus-visible {
    background: #e2e9f3;
    border-color: var(--navy);
}

.mis-broken,
.mis-fixed {
    transition: opacity 450ms ease;
}

.mis-fixed {
    opacity: 0;
    pointer-events: none;
}

.diagram-figure.is-fixed .mis-broken {
    opacity: 0;
    pointer-events: none;
}

.diagram-figure.is-fixed .mis-fixed {
    opacity: 1;
}

.diagram .lbl-fix {
    fill: var(--navy);
}

/* Hover lift on cards */
.service-card,
.step,
.contact-card,
.value-item,
.figure,
.diagram-figure {
    transition: transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
}

.service-card:hover,
.step:hover,
.contact-card:hover,
.value-item:hover,
.figure:hover,
.diagram-figure:hover {
    transform: translateY(-3px);
    border-color: #b9c3d6;
    box-shadow: 0 14px 34px rgba(22, 31, 61, 0.09);
}

@media (prefers-reduced-motion: no-preference) {
    /* Hero entrance: one orchestrated moment on load */
    .hero-copy > * {
        animation: rise 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
    .hero-copy > *:nth-child(2) { animation-delay: 0.12s; }
    .hero-copy > *:nth-child(3) { animation-delay: 0.2s; }
    .hero-copy > *:nth-child(4) { animation-delay: 0.3s; }
    .hero-copy > *:nth-child(5) { animation-delay: 0.4s; }

    .hero-grid > .figure {
        animation: rise 750ms cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
    }

    /* Survey lines drifting behind the hero */
    .bg-pipe {
        animation: pipe-drift 26s linear infinite;
    }

    .bg-pipe--foul {
        animation-duration: 34s;
        animation-direction: reverse;
    }

    /* Rule-duo draws in when its section reveals */
    .revealed .rule-duo::before,
    .revealed .rule-duo::after {
        animation: draw-rule 550ms cubic-bezier(0.22, 1, 0.36, 1) both;
        transform-origin: left;
    }

    .revealed .rule-duo::after {
        animation-delay: 0.12s;
    }

    /* Pulse at the misconnection point */
    .pulse-ring {
        transform-box: fill-box;
        transform-origin: center;
        animation: pulse 2.4s ease-out infinite;
    }

    /* The crossed underline draws in after the hero entrance */
    .hl-mis::before {
        transform-origin: left;
        animation: draw-cross-a 600ms cubic-bezier(0.22, 1, 0.36, 1) 0.9s both;
    }

    .hl-mis::after {
        transform-origin: left;
        animation: draw-cross-b 600ms cubic-bezier(0.22, 1, 0.36, 1) 1.05s both;
    }
}

@keyframes draw-cross-a {
    from {
        transform: rotate(-1deg) scaleX(0);
    }
    to {
        transform: rotate(-1deg) scaleX(1);
    }
}

@keyframes draw-cross-b {
    from {
        transform: rotate(1.2deg) scaleX(0);
    }
    to {
        transform: rotate(1.2deg) scaleX(1);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes pipe-drift {
    to {
        stroke-dashoffset: -360;
    }
}

@keyframes draw-rule {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    70% {
        transform: scale(1.9);
        opacity: 0;
    }
    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}

/* Scroll reveals: .reveal is added by JS, so no-JS visitors see everything */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 650ms cubic-bezier(0.22, 1, 0.36, 1), transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.revealed {
    opacity: 1;
    transform: none;
}

/* Droplets travelling the diagram pipes (only where offset-path is supported) */
.drop {
    visibility: hidden;
}

@supports (offset-path: path("M0 0 L1 1")) {
    @media (prefers-reduced-motion: no-preference) {
        .drop {
            visibility: visible;
            opacity: 0;
            animation: travel linear infinite;
        }

        /* Landscape diagram */
        .drop--rain {
            offset-path: path("M110 150 L110 240 L690 240");
            animation-duration: 7s;
        }

        .drop--foul {
            offset-path: path("M200 150 L200 300 L690 300");
            animation-duration: 7.5s;
            animation-delay: 1.2s;
        }

        .drop--mis {
            offset-path: path("M280 150 L280 240 L690 240");
            animation-duration: 6s;
            animation-delay: 2.6s;
        }

        /* Corrected route shown by the "Show the fix" toggle */
        .drop--misfix {
            offset-path: path("M280 150 L280 180 L360 180 L360 300 L690 300");
            animation-duration: 6.5s;
            animation-delay: 1.8s;
        }

        /* Portrait diagram: same routes, portrait geometry */
        .drop--rain-t {
            offset-path: path("M60 130 L60 170 L246 170 L246 352");
            animation-duration: 7s;
        }

        .drop--foul-t {
            offset-path: path("M60 130 L60 230 L316 230 L316 420");
            animation-duration: 7.5s;
            animation-delay: 1.2s;
        }

        .drop--mis-t {
            offset-path: path("M60 130 L60 290 L246 290 L246 352");
            animation-duration: 6s;
            animation-delay: 2.6s;
        }

        .drop--misfix-t {
            offset-path: path("M60 130 L60 290 L316 290 L316 420");
            animation-duration: 6.5s;
            animation-delay: 1.8s;
        }
    }
}

@keyframes travel {
    0% {
        offset-distance: 0%;
        opacity: 0;
    }
    6% {
        opacity: 0.9;
    }
    92% {
        opacity: 0.9;
    }
    100% {
        offset-distance: 100%;
        opacity: 0;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
