/* Mr. Radon — Metro Detroit radon testing & mitigation
   Palette: instrument slate, measured teal, functional amber, geologic earth */

:root {
  --ink:      #16212E;
  --ink-soft: #3C4C5C;
  --paper:    #F6F9FA;
  --surface:  #FFFFFF;
  --signal:   #0E7C86;
  --signal-d: #0A5A61;
  --alert:    #8A5A06;
  --earth:    #6B5744;
  --earth-l:  #C9B99F;
  --rule:     #D3DCE1;
  --maxw:     68rem;
  --measure:  38rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

h1, h2, h3, h4, .ui, nav, button, .btn, .readout, table {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
}

h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 .6em; font-weight: 650; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); margin-top: 0; }
h3 { font-size: 1.2rem; font-weight: 600; }
p  { margin: 0 0 1.1em; max-width: var(--measure); }
ul, ol { max-width: var(--measure); padding-left: 1.2em; }
li { margin-bottom: .5em; }
a { color: var(--signal-d); text-underline-offset: .18em; }
a:hover { color: var(--ink); }
strong { font-weight: 600; }

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- masthead ---------- */
.masthead {
  background: var(--ink);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.masthead .wrap { display: flex; align-items: center; gap: 2rem; min-height: 4.25rem; }
.logo { display: inline-flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.logo .logo-mark { height: 2.05rem; width: auto; display: block; }
.logo:focus-visible { outline: 3px solid var(--signal); outline-offset: 4px; border-radius: 2px; }
@media (max-width: 54rem) { .logo .logo-mark { height: 1.8rem; } }
.masthead nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 1.35rem; font-size: .92rem; }
.masthead nav a { color: #C6D3DA; text-decoration: none; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: #fff; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; font-weight: 600; font-size: .98rem;
  padding: .78rem 1.35rem; border-radius: 4px; text-decoration: none; border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--signal); color: #fff; }
.btn-primary:hover { background: var(--signal-d); color: #fff; }
.btn-quiet { border-color: var(--rule); color: var(--ink); background: var(--surface); }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.5rem; }

/* ---------- placeholders to replace before launch ---------- */
.todo {
  border-bottom: 2px dashed var(--alert);
  color: var(--alert);
  font-weight: 600;
  white-space: nowrap;
}
.todo-note {
  background: #FDF6E7; border-left: 4px solid var(--alert);
  padding: .9rem 1.1rem; font-size: .95rem; margin: 0 0 2rem; max-width: var(--measure);
}
.todo-note p { margin: 0; }

/* ---------- hero ---------- */
.hero { background: var(--surface); border-bottom: 1px solid var(--rule); padding: 4rem 0 3rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.05fr); gap: 3.5rem; align-items: center; }
.hero h1 { max-width: 14ch; }
.hero p.lede { font-size: 1.17rem; color: var(--ink-soft); }
.section-diagram { width: 100%; height: auto; display: block; }

/* ---------- readout: the measured result ---------- */
.readout {
  background: var(--ink); color: #fff; padding: 2.75rem 0;
}
.readout .wrap { display: grid; grid-template-columns: auto auto 1fr; gap: 2.5rem; align-items: end; }
.reading { font-variant-numeric: tabular-nums; line-height: .9; }
.reading .val { display: block; font-size: clamp(2.6rem, 7vw, 4.2rem); font-weight: 700; letter-spacing: -0.04em; }
.reading .lab { display: block; font-size: .82rem; color: #93A6B2; margin-top: .6rem;
                font-weight: 500; line-height: 1.3; }
.reading.before .val { color: #E8B557; }
.reading.after  .val { color: #4FC3CE; }
.readout .note { font-family: "Source Serif 4", Georgia, serif; color: #C6D3DA; max-width: 30rem; font-size: .98rem; }
.readout .note p { margin: 0; max-width: none; }

/* ---------- sections ---------- */
section { padding: 3.5rem 0; }
.section-head { max-width: var(--measure); margin-bottom: 2rem; }
.on-surface { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

/* two-up service blocks (not uniform cards) */
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2.5rem; }
.service h3 { margin-bottom: .4rem; }
.service { border-top: 3px solid var(--signal); padding-top: 1rem; }
.service p { max-width: none; }

/* county data table */
table { width: 100%; border-collapse: collapse; font-size: .97rem; max-width: 34rem; }
caption { text-align: left; font-size: .9rem; color: var(--ink-soft); padding-bottom: .7rem; font-family: "Source Serif 4", Georgia, serif; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; width: 7rem; }
tr.high td.num { color: var(--alert); }

/* process — a genuine sequence, so it is numbered */
.steps { counter-reset: step; list-style: none; padding: 0; max-width: 46rem; }
.steps li {
  counter-increment: step; position: relative; padding-left: 3.2rem; margin-bottom: 1.6rem;
}
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -.1rem;
  font-family: Archivo, sans-serif; font-weight: 700; font-size: .95rem;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--signal); color: #fff;
  display: grid; place-items: center;
}
.steps h3 { margin-bottom: .2rem; }
.steps p { margin-bottom: 0; }

/* plain list of differentiators */
.points { list-style: none; padding: 0; max-width: 44rem; }
.points li { padding-left: 1.4rem; position: relative; margin-bottom: 1rem; }
.points li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: .55rem; height: .55rem; background: var(--signal); border-radius: 1px;
}

/* faq */
.faq { max-width: var(--measure); }
.faq details { border-bottom: 1px solid var(--rule); padding: .9rem 0; }
.faq summary { font-family: Archivo, sans-serif; font-weight: 600; cursor: pointer; font-size: 1.02rem; }
.faq details[open] summary { color: var(--signal-d); }
.faq details p { margin: .8rem 0 .2rem; }

/* cta band */
.cta { background: var(--signal-d); color: #fff; padding: 3.25rem 0; }
.cta h2 { color: #fff; }
.cta p { color: #D4ECEE; }
.cta a { color: #fff; text-decoration: underline; text-decoration-thickness: 2px;
          text-underline-offset: .2em; }
.cta a:hover { color: #CFEFF2; }
.cta .btn-primary { background: #fff; color: var(--signal-d); text-decoration: none; }
.cta .btn-primary:hover { background: var(--paper); color: var(--ink); }

/* article pages */
.article { background: var(--surface); }
.article .wrap { max-width: 46rem; }
.article h2 { margin-top: 2.4rem; }
.article .kicker { color: var(--ink-soft); font-size: 1.1rem; max-width: var(--measure); }
.source { font-size: .88rem; color: var(--ink-soft); }

/* footer */
footer { background: var(--ink); color: #93A6B2; padding: 2.75rem 0; font-size: .92rem; }
footer a { color: #C6D3DA; }
footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 2rem; }
footer h4 { color: #fff; font-size: .85rem; margin-bottom: .7rem; }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: .4rem; }
footer .fine { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #2A3845; font-size: .85rem; }
footer .fine p { max-width: none; margin: 0 0 .4rem; }

@media (max-width: 54rem) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .readout .wrap { grid-template-columns: auto auto; gap: 1.75rem; }
  .readout .note { grid-column: 1 / -1; }
  .masthead .wrap { flex-wrap: wrap; padding-top: .8rem; padding-bottom: .8rem; gap: .9rem 1.5rem; }
  .masthead nav { margin-left: 0; width: 100%; gap: .55rem .95rem; font-size: .86rem; }
}

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

/* ============================================================
   MOTION
   ============================================================ */

/* ---------- scroll reveal ---------- */
.reveal { transition: transform .55s cubic-bezier(.2,.7,.3,1); }
.js-motion .reveal { transform: translateY(14px); }
.js-motion .reveal.shown { transform: none; }
.reveal-d1 { transition-delay: .08s; } .reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; } .reveal-d4 { transition-delay: .32s; }

/* ---------- buttons get physical feedback ---------- */
.btn { transition: background-color .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease; }
.btn-primary { box-shadow: 0 1px 0 var(--signal-d); }
.btn:active { transform: translateY(1px); }
.masthead nav a { position: relative; transition: color .18s ease; }
.masthead nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.35rem; height: 2px;
  background: var(--signal); transform: scaleX(0); transform-origin: left; transition: transform .22s ease;
}
.masthead nav a:hover::after, .masthead nav a[aria-current="page"]::after { transform: scaleX(1); }

/* ---------- county bars ---------- */
td.bar-cell { width: 42%; padding-right: 0; }
.bar { height: .55rem; background: var(--signal); border-radius: 1px;
       width: var(--w); transition: width 1.1s cubic-bezier(.2,.8,.3,1); }
.js-motion tbody[data-bars]:not(.bars-run) .bar { width: 0; }
tr.high .bar { background: var(--alert); }
tbody.bars-run .bar { width: var(--w); }
tbody.bars-run tr:nth-child(2) .bar { transition-delay: .09s; }
tbody.bars-run tr:nth-child(3) .bar { transition-delay: .18s; }
tbody.bars-run tr:nth-child(4) .bar { transition-delay: .27s; }
tbody.bars-run tr:nth-child(5) .bar { transition-delay: .36s; }
tbody.bars-run tr:nth-child(6) .bar { transition-delay: .45s; }

/* ---------- hero: ambient soil gas drift ---------- */
@keyframes drift { 0% { opacity: 0; transform: translateY(6px); } 35% { opacity: .9; } 100% { opacity: 0; transform: translateY(-26px); } }
.hero .gas circle { animation: drift 3.6s ease-in-out infinite; }
.hero .gas circle:nth-child(2) { animation-delay: .5s; }
.hero .gas circle:nth-child(3) { animation-delay: 1.1s; }
.hero .gas circle:nth-child(4) { animation-delay: 1.7s; }
.hero .gas circle:nth-child(5) { animation-delay: 2.3s; }
.hero .gas circle:nth-child(6) { animation-delay: 2.9s; }

/* ---------- steps draw in ---------- */
.steps li { transition: transform .5s ease; }
.js-motion .steps li { transform: translateX(-10px); }
.js-motion .steps.shown li { transform: none; }
.steps.shown li:nth-child(2) { transition-delay: .12s; }
.steps.shown li:nth-child(3) { transition-delay: .24s; }
.steps.shown li:nth-child(4) { transition-delay: .36s; }

/* ============================================================
   ANIMATED SYSTEM DIAGRAM
   ============================================================ */
.sysfig { background: var(--ink); color: #fff; padding: 3.25rem 0; }
.sysfig h2 { color: #fff; }
.sysfig .section-head p { color: #AFC0CB; }
.sysfig-stage { position: relative; background: #0F1922; border-radius: 6px; overflow: hidden; }
.sysfig svg { display: block; width: 100%; height: auto; }

/* readout chip inside the figure */
.sysfig-reading {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(10,20,28,.82); border: 1px solid #2A3845; border-radius: 4px;
  padding: .55rem .8rem; font-family: Archivo, sans-serif; text-align: right;
  backdrop-filter: blur(3px);
}
.sysfig-reading .v { display: block; font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; color: #E8B557; transition: color .5s ease; }
.sysfig-reading.safe .v { color: #4FC3CE; }
.sysfig-reading .u { display: block; font-size: .68rem; color: #8FA3AF; margin-top: .3rem; letter-spacing: .01em; }

/* caption + controls */
.sysfig-caption { margin-top: 1.25rem; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: start; }
.sysfig-caption h3 { color: #fff; margin-bottom: .3rem; font-size: 1.08rem; }
.sysfig-caption p { color: #AFC0CB; margin: 0; max-width: 40rem; font-size: .98rem; }
.sysfig-controls { display: flex; align-items: center; gap: .5rem; }
.sysfig-controls button {
  background: transparent; border: 1px solid #39495A; color: #C6D3DA;
  border-radius: 3px; cursor: pointer; font-size: .82rem; font-weight: 600;
  padding: .4rem .6rem; transition: border-color .18s, color .18s, background-color .18s;
}
.sysfig-controls button:hover { border-color: var(--signal); color: #fff; }
.sysfig-dots { display: flex; gap: .35rem; }
.sysfig-dots button { width: 1.9rem; padding: .4rem 0; text-align: center; }
.sysfig-dots button[aria-current="true"] { background: var(--signal); border-color: var(--signal); color: #fff; }

/* stage visibility — driven by data-stage on the svg */
.sysfig svg .s-intrusion,
.sysfig svg .s-haze,
.sysfig svg .s-pit,
.sysfig svg .s-pipe,
.sysfig svg .s-fan,
.sysfig svg .s-field,
.sysfig svg .s-converge,
.sysfig svg .s-discharge,
.sysfig svg .s-crack { opacity: 0; transition: opacity .7s ease; }

.sysfig svg[data-stage="1"] .s-intrusion,
.sysfig svg[data-stage="1"] .s-haze,
.sysfig svg[data-stage="1"] .s-crack { opacity: 1; }

.sysfig svg[data-stage="2"] .s-pit,
.sysfig svg[data-stage="2"] .s-haze,
.sysfig svg[data-stage="2"] .s-crack { opacity: 1; }

.sysfig svg[data-stage="3"] .s-pit,
.sysfig svg[data-stage="3"] .s-pipe,
.sysfig svg[data-stage="3"] .s-fan,
.sysfig svg[data-stage="3"] .s-haze { opacity: 1; }

.sysfig svg[data-stage="4"] .s-pit,
.sysfig svg[data-stage="4"] .s-pipe,
.sysfig svg[data-stage="4"] .s-fan,
.sysfig svg[data-stage="4"] .s-field,
.sysfig svg[data-stage="4"] .s-converge { opacity: 1; }

.sysfig svg[data-stage="5"] .s-pit,
.sysfig svg[data-stage="5"] .s-pipe,
.sysfig svg[data-stage="5"] .s-fan,
.sysfig svg[data-stage="5"] .s-field,
.sysfig svg[data-stage="5"] .s-converge,
.sysfig svg[data-stage="5"] .s-discharge { opacity: 1; }

/* haze thins out as the system takes hold */
.sysfig svg[data-stage="4"] .s-haze rect { opacity: .5; }
.sysfig svg[data-stage="5"] .s-haze { opacity: 0; }

/* particle motion */
@keyframes seep   { 0% { opacity:0; transform: translateY(14px);} 25%{opacity:.95;} 100%{ opacity:0; transform: translateY(-46px);} }
@keyframes toPit  { 0% { opacity:0; } 20% { opacity:.95; } 100% { opacity:0; } }
@keyframes upPipe { 0% { opacity:0; transform: translateY(0);} 12%{opacity:1;} 88%{opacity:1;} 100%{ opacity:0; transform: translateY(-300px);} }
@keyframes puff   { 0% { opacity:0; transform: translateY(0) scale(.6);} 30%{opacity:.85;} 100%{ opacity:0; transform: translateY(-34px) scale(1.5);} }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes pulseField { 0%,100% { opacity:.18; } 50% { opacity:.4; } }

.sysfig svg[data-stage="1"] .s-intrusion circle { animation: seep 2.8s ease-in-out infinite; }
.sysfig svg .s-intrusion circle:nth-child(2){ animation-delay:.6s } 
.sysfig svg .s-intrusion circle:nth-child(3){ animation-delay:1.2s }
.sysfig svg .s-intrusion circle:nth-child(4){ animation-delay:1.8s }
.sysfig svg .s-intrusion circle:nth-child(5){ animation-delay:2.2s }

.sysfig svg[data-stage="4"] .s-converge circle,
.sysfig svg[data-stage="5"] .s-converge circle { animation: toPit 2.2s linear infinite; }
.sysfig svg .s-converge circle:nth-child(2){ animation-delay:.45s }
.sysfig svg .s-converge circle:nth-child(3){ animation-delay:.9s }
.sysfig svg .s-converge circle:nth-child(4){ animation-delay:1.35s }
.sysfig svg .s-converge circle:nth-child(5){ animation-delay:1.8s }

.sysfig svg[data-stage="5"] .s-up circle { animation: upPipe 2.4s linear infinite; }
.sysfig svg .s-up circle:nth-child(2){ animation-delay:.8s }
.sysfig svg .s-up circle:nth-child(3){ animation-delay:1.6s }

.sysfig svg[data-stage="5"] .s-discharge circle { animation: puff 2.4s ease-out infinite; }
.sysfig svg .s-discharge circle:nth-child(2){ animation-delay:.8s }
.sysfig svg .s-discharge circle:nth-child(3){ animation-delay:1.6s }

.sysfig svg[data-stage="3"] .fan-blades,
.sysfig svg[data-stage="4"] .fan-blades,
.sysfig svg[data-stage="5"] .fan-blades { animation: spin 1.1s linear infinite; transform-origin: 320px 112px; }

.sysfig svg[data-stage="4"] .field-ellipse,
.sysfig svg[data-stage="5"] .field-ellipse { animation: pulseField 3s ease-in-out infinite; }

/* manometer */
.mano { display: inline-block; vertical-align: middle; }
@keyframes manoL { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-1.5px);} }
.mano .fluid-l { animation: manoL 4s ease-in-out infinite; }

@media (max-width: 54rem) {
  .sysfig-caption { grid-template-columns: 1fr; gap: 1rem; }
  .sysfig-reading { top: .6rem; right: .6rem; padding: .4rem .6rem; }
  .sysfig-reading .v { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .steps li { opacity: 1 !important; transform: none !important; }
  .bar { width: var(--w) !important; }
  .sysfig svg * { animation: none !important; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* hero: gas moving up the pipe */
@keyframes flow { to { stroke-dashoffset: -40px; } }
.hero .pipe-flow { stroke-dasharray: 5 15; }
.js-motion .hero .pipe-flow { animation: flow 1.5s linear infinite; }
@media (prefers-reduced-motion: reduce) { .hero .pipe-flow { animation: none !important; } }

/* ============================================================
   FORMS
   ============================================================ */
.jobform { max-width: 40rem; margin-top: 2rem; }
.call-first { font-family: Archivo, sans-serif; font-size: 1.05rem; font-weight: 600; }
.hp { position: absolute; left: -9999px; }

.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.field { margin: 0 0 1.25rem; max-width: none; }
.field label { display: block; font-family: Archivo, sans-serif; font-size: .88rem;
               font-weight: 600; margin-bottom: .35rem; }
.req { color: var(--alert); }
.field input, .field select, .field textarea, .jobform textarea {
  width: 100%; padding: .65rem .7rem; font: inherit; font-size: 1rem;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--rule); border-radius: 4px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .jobform textarea:focus {
  outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(14,124,134,.16);
}
.field input:user-invalid, .jobform textarea:user-invalid { border-color: var(--alert); }
.field input:user-valid { border-color: var(--signal); }
.hint { display: block; font-size: .82rem; color: var(--ink-soft); margin-top: .3rem;
        font-family: "Source Serif 4", Georgia, serif; }

.jobform fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.jobform legend { font-family: Archivo, sans-serif; font-size: .88rem; font-weight: 600;
                  padding: 0; margin-bottom: .55rem; }
.choice { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .45rem;
          font-size: 1rem; cursor: pointer; }
.choice input { margin-top: .32rem; accent-color: var(--signal); flex: 0 0 auto; }
.field.inline { margin-top: .9rem; max-width: 15rem; }

.jobform button[type="submit"] { font-size: 1.05rem; padding: .85rem 1.6rem; }
.formnote { font-size: .85rem; color: var(--ink-soft); margin-top: .9rem; }

.narrow-center { max-width: 38rem; }

@media (max-width: 40rem) {
  .f-grid { grid-template-columns: 1fr; }
}

/* ---------- county map ---------- */
.mapfig { margin: 0 0 2rem; }
.county-map { width: 100%; max-width: 34rem; height: auto; display: block; }
.mapfig figcaption { font-size: .86rem; color: var(--ink-soft); margin-top: .7rem; max-width: 34rem; }
.county-map rect[fill="#0E7C86"] { transition: opacity .3s ease; }
.call-alt { font-weight: 500; font-size: .95rem; color: var(--ink-soft); }

@media (max-width: 40rem) {
  td.bar-cell, th:nth-child(2) { display: none; }
  table { max-width: none; }
  td.num { width: 5.5rem; }
}
