/* === TOKENS ===
   Heart Pine (deep East Texas timber brown): header/nav, dominant dark
   Artesian Blue (genuine, cool, groundwater-associated): primary accent/CTA
   Iron Stain (muted, real East Texas well-water iron tone): minor accent only
   Clearwell (cool light neutral, not another warm cream): background
   Differentiation note: avoids the #A2-A8 rust/clay band (Fort Smith, Macon,
   Springfield all cluster there), avoids navy-as-header (Fort Smith, Amarillo
   both use it), avoids green-as-header (Springfield), avoids warm cream bg
   (Fort Smith, Macon, Springfield all warm cream) and avoids amber-as-primary
   (Amarillo). See palette-signature-registry.md.
*/
:root {
  --pine:       #2b2118;
  --pine-dark:  #3a2c20;
  --artesian:      #1f6fa0;
  --artesian-dark: #175a82;
  --iron:       #8a5a3f;
  --line:       #d7dbdc;
  --text:       #1e2325;
  --bg:         #f3f5f6;
  --card-bg:    #ffffff;
  --max-w:      880px;
  --radius:     4px;
  --font-display: 'Rubik', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--text); line-height: 1.7;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--artesian); }
a:hover { color: var(--artesian-dark); }

/* === TYPOGRAPHY === */
h1, h2, h3 {
  font-family: var(--font-display); font-weight: 800;
  line-height: 1.2; color: var(--pine);
}
h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.4rem; color: var(--pine); }
p  { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.35rem; }
strong { font-weight: 700; }
.mono { font-family: var(--font-mono); }

/* === LAYOUT === */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.content-area { max-width: var(--max-w); margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }

/* === SIGNATURE DEVICE: well-cap divider ===
   A row of small circular "well cap bolt" marks, echoing a wellhead cap seal,
   used as the section-break device across every page. */
.section-divider {
  border: none; height: 18px; margin: 2.5rem 0 2rem;
  background-image: radial-gradient(circle, var(--artesian) 2.5px, transparent 2.5px);
  background-position: center;
  background-repeat: repeat-x;
  background-size: 24px 100%;
  opacity: 0.5;
}

/* === HEADER === */
.site-header { background: var(--pine); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.25rem; max-width: var(--max-w); margin: 0 auto;
}
.logo {
  color: white; font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 800; text-decoration: none; line-height: 1.2;
}
.logo span { display: block; font-size: 0.68rem; font-weight: 400; opacity: .75; letter-spacing: .05em; font-family: var(--font-body); }
.header-phone { color: #9fd0ea; font-weight: 700; font-size: 1.02rem; text-decoration: none; font-family: var(--font-mono); }
.header-phone:hover { color: white; }
.nav-toggle { display: none; background: none; border: none; color: white; font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 0 0.25rem; }

/* === NAV === */
.site-nav { background: rgba(0,0,0,.25); }
.nav-list { display: flex; list-style: none; max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; flex-wrap: wrap; }
.nav-list > li > a { display: block; padding: 0.55rem 0.85rem; color: rgba(255,255,255,.85); text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
.nav-list > li > a:hover { color: white; }
.nav-cta > a { background: var(--artesian); color: white !important; border-radius: var(--radius); margin: 0.3rem 0.4rem; padding: 0.4rem 1rem !important; }
.nav-cta > a:hover { background: var(--artesian-dark) !important; }

/* === HERO === */
.hero { position: relative; height: 440px; overflow: hidden; }
.hero-img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(43,33,24,.92) 0%, rgba(43,33,24,.62) 55%, rgba(43,33,24,.2) 100%);
  display: flex; align-items: center;
}
.hero-content { padding: 0 1.25rem; max-width: 640px; margin: 0 auto; width: 100%; }
.hero h1 { color: white; margin-bottom: 0.75rem; max-width: 640px; }
.hero-sub { color: rgba(255,255,255,.85); margin-bottom: 1.25rem; font-size: 1.05rem; max-width: 560px; }
.btn-cta {
  display: inline-block; background: var(--artesian); color: white;
  padding: 0.8rem 1.75rem; border-radius: var(--radius);
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  text-decoration: none;
}
.btn-cta:hover { background: var(--artesian-dark); color: white; }

/* === SUPPORTING PAGE IMAGE === */
.page-image { width: 100%; height: 320px; object-fit: cover; border-radius: 6px; margin: 1.25rem 0; }
@media (max-width: 640px) {
  .hero { height: 360px; }
  .hero-content { padding: 0 1.25rem; }
  .page-image { height: 220px; }
}

/* === PAGE HEADER (non-home) === */
.page-header { background: var(--pine); padding: 2.5rem 1.25rem 2rem; }
.page-header h1 { color: white; max-width: var(--max-w); margin: 0 auto; }

/* === SECTION SUBHEAD === */
p.subhead { font-weight: 700; color: var(--pine); margin-bottom: 0.25rem; font-size: 1rem; }

/* === TABLE === */
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 400px; }
th { background: var(--pine); color: white; padding: 0.6rem 0.85rem; text-align: left; font-family: var(--font-display); font-size: 0.9rem; }
td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.92rem; }
td:first-child { font-family: var(--font-body); }
tr:nth-child(even) td { background: #eaedee; }

/* === FAQ ACCORDION === */
.faq-section { margin-top: 0.5rem; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  padding: 1rem 0; cursor: pointer; font-weight: 700; color: var(--pine);
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; font-family: var(--font-display); font-size: 0.98rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.4rem; color: var(--artesian); flex-shrink: 0; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { padding: 0 0 1rem; }

/* === SERVICE LINK CARDS === */
.service-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; margin: 1.5rem 0; }
.service-link-card {
  display: block; background: var(--card-bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 1rem 1.1rem; text-decoration: none; color: var(--text);
}
.service-link-card:hover { border-color: var(--artesian); }
.service-link-card strong { display: block; font-family: var(--font-display); color: var(--pine); margin-bottom: 0.25rem; font-size: 1rem; }
.service-link-card span { font-size: 0.85rem; color: var(--text); opacity: 0.8; }

/* === TROUBLE SORTER (signature device) === */
.sorter-wrapper { background: var(--card-bg); border: 1px solid var(--line); border-radius: 8px; padding: 1.75rem; margin: 1.5rem 0; }
.sorter-controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; margin-bottom: 1.25rem; }
.sorter-field label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--pine); margin-bottom: 0.35rem; }
.sorter-field select { width: 100%; padding: 0.55rem; border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--font-body); background: white; }
.sorter-result { padding: 1.25rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.sorter-badge {
  display: inline-block; font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
  padding: 0.3rem 0.75rem; border-radius: 999px; margin-bottom: 0.75rem; letter-spacing: 0.03em;
}
.sorter-badge.urgent   { background: #f5d9d3; color: #7a2a17; }
.sorter-badge.soon     { background: #fde8c8; color: #7a4a0a; }
.sorter-badge.routine  { background: #d9ead9; color: #1e4620; }
.sorter-cause { font-size: 1rem; margin-bottom: 0; }
.sorter-cta { text-align: center; margin-top: 1.25rem; }

/* === QUOTE FORM === */
.quote-form { background: var(--card-bg); border: 1px solid var(--line); border-radius: 6px; padding: 2rem; margin-top: 1.5rem; }
.quote-form .form-title { font-family: var(--font-display); font-size: 1.3rem; color: var(--pine); margin-bottom: 1.25rem; }
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 700; font-size: 0.875rem; margin-bottom: 0.3rem; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 0.6rem 0.75rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem; background: white;
}
.form-row textarea { min-height: 90px; resize: vertical; }
.form-submit {
  width: 100%; padding: 0.8rem; border: none; border-radius: var(--radius); cursor: pointer;
  background: var(--artesian); color: white;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
}
.form-submit:hover { background: var(--artesian-dark); }
.form-submit:disabled { opacity: .65; cursor: not-allowed; }
.form-msg { margin-top: 0.85rem; padding: 0.75rem; border-radius: var(--radius); display: none; font-size: 0.95rem; }
.form-msg.success { background: #d9ead9; color: #1e4620; display: block; }
.form-msg.error   { background: #f5d9d3; color: #7a2a17; display: block; }

/* === FOOTER === */
.site-footer { background: var(--pine); color: rgba(255,255,255,.8); padding: 3rem 1.25rem 1rem; margin-top: 3rem; }
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 2rem; max-width: var(--max-w); margin: 0 auto 2rem;
}
.footer-col strong { color: white; display: block; margin-bottom: 0.6rem; font-family: var(--font-display); font-size: 1rem; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.3rem; }
.footer-col a { color: rgba(255,255,255,.7); text-decoration: none; font-size: 0.875rem; }
.footer-col a:hover { color: white; }
.footer-col p { font-size: 0.875rem; margin-bottom: 0.4rem; }
.footer-phone { color: #9fd0ea !important; font-weight: 700 !important; font-size: 1rem !important; font-family: var(--font-mono); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15); padding-top: 1.1rem;
  text-align: center; font-size: 0.8rem; color: rgba(255,255,255,.45);
  max-width: var(--max-w); margin: 0 auto;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; }
  .site-nav.open { display: block; }
  .nav-list { flex-direction: column; padding: 0.5rem 0; }
  .nav-list > li > a { padding: 0.7rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  .nav-cta > a { margin: 0.5rem 1.5rem; display: block; text-align: center; }
  .sorter-controls { grid-template-columns: 1fr; }
}

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181b; --text: #e5e9ea; --card-bg: #1d2225;
    --line: #33393c;
  }
  .quote-form, .sorter-wrapper, .service-link-card { background: var(--card-bg); border-color: var(--line); }
  .sorter-field label { color: #8fc2df; }
  .form-row input, .form-row select, .form-row textarea, .sorter-field select { background: #14181b; border-color: var(--line); color: var(--text); }
  td { border-color: var(--line); }
  tr:nth-child(even) td { background: #1a1e21; }
  .faq-item { border-color: var(--line); }
  h2, h3, .service-link-card strong { color: #8fc2df; }
  .page-header h1, .hero h1, .footer-col strong { color: white; }
  .quote-form .form-title { color: white; }
  .faq-item summary { color: #8fc2df; }
  .hero { background: linear-gradient(135deg, #171b1d 0%, #2b2118 55%, #33393c 140%); }
  .sorter-badge.urgent  { background: #4a2016; color: #f3b7a4; }
  .sorter-badge.soon    { background: #4a3410; color: #f3d29a; }
  .sorter-badge.routine { background: #16341c; color: #a9d6ae; }
}
