/* Shared layout for the pest, flooring and bath pages. Each page sets its
   own colors and type on body[data-page]; the layout never changes. */

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Big Shoulders Display";
  src: url("/assets/big-shoulders-display.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --radius: 8px;
}

body[data-page="pest"] {
  color-scheme: dark;
  --bg: #07090d;
  --surface: #0e131b;
  --ink: #f4efe6;
  --muted: #a3acba;
  --line: rgba(244, 239, 230, 0.14);
  --field-bg: rgba(244, 239, 230, 0.06);
  --field-edge: rgba(244, 239, 230, 0.45);
  --accent: #ff7a33;
  --accent-hover: #ff9a62;
  --accent-ink: #07090d;
  --error: #ffb38a;
  --focus: #f4efe6;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
}

body[data-page="flooring"] {
  color-scheme: light;
  --bg: #f6efe4;
  --surface: #fffcf7;
  --ink: #2b1d12;
  --muted: #5f4b3a;
  --line: #e3d5c1;
  --field-bg: #fffcf7;
  --field-edge: #a8916f;
  --accent: #f4b400;
  --accent-hover: #e2a400;
  --accent-ink: #1d1206;
  --error: #a3260f;
  --focus: #1f5fbf;
  --display: var(--serif);
}

body[data-page="bath"] {
  color-scheme: light;
  --bg: #f6f4ec;
  --surface: #ffffff;
  --ink: #17392f;
  --muted: #4c6359;
  --line: #cfdbd2;
  --field-bg: #ffffff;
  --field-edge: #8fa79a;
  --accent: #17392f;
  --accent-hover: #0f2a22;
  --accent-ink: #ffffff;
  --error: #a3260f;
  --focus: #1f5fbf;
  --display: var(--sans);
}

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

/* The hidden attribute must win over display rules below (form, done, errors). */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
}

a { color: inherit; }

a:focus-visible, .input:focus-visible, .submit:focus-visible, .done:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Brand bar */

.bar {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px max(20px, env(safe-area-inset-left)) 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand img, .brand svg { width: 28px; height: 28px; border-radius: 6px; }

/* Hero: copy and form, then the picture. Side by side from 900px. */

.hero {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px max(20px, env(safe-area-inset-left)) 48px;
  display: grid;
  gap: 40px;
  align-content: start;
}

.copy { max-width: 520px; }

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 10vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

body[data-page="pest"] h1 {
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(48px, 14vw, 96px);
  line-height: 0.9;
  letter-spacing: 0;
}

body[data-page="pest"] h1 span { color: var(--accent); }

.lede {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.4;
  max-width: 34ch;
  text-wrap: pretty;
}

.tags {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* The form */

.lead { margin-top: 24px; }

.lead-form { display: grid; gap: 12px; }

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem;
  gap: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--field-edge);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  font: 400 17px/1 var(--sans);
}

.input[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }

.error, .form-error {
  margin: 0;
  color: var(--error);
  font-size: 15px;
  line-height: 1.4;
}

.error { margin-top: -4px; }

.form-error a { font-weight: 600; white-space: nowrap; }

.submit {
  position: relative;
  height: 56px;
  margin-top: 4px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 18px/1 var(--sans);
  cursor: pointer;
}

.submit[aria-busy="true"] { cursor: progress; opacity: 0.85; }

.submit[aria-busy="true"]::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .submit[aria-busy="true"]::after { animation-duration: 2s; }
}

@media (hover: hover) and (pointer: fine) {
  .submit:hover { background: var(--accent-hover); }
  .alt a:hover, .foot a:hover { text-decoration-thickness: 2px; }
}

.consent {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.done {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.done p { margin: 0; font-size: 18px; }

.done .done-title { margin-bottom: 4px; font-size: 22px; font-weight: 700; }

.alt {
  margin: 20px 0 0;
  font-size: 17px;
}

.alt a { font-weight: 700; white-space: nowrap; text-underline-offset: 3px; }

/* The picture */

.art { margin: 0; }

.art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.art figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

body[data-page="pest"] .art img { max-width: 520px; margin: 0 auto; }

/* Flooring has no photo: plank lines drawn in CSS, so no claim rides on an image. */
.planks {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: #c39762 url("/assets/planks.svg") center / cover no-repeat;
}

/* Footer */

.foot {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px max(20px, env(safe-area-inset-left)) 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.foot p { margin: 0 0 4px; max-width: 70ch; }

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
    align-items: center;
    gap: 64px;
    padding-top: 24px;
    padding-bottom: 72px;
  }
  .lede { font-size: 20px; }
}
