/* site-01-green-bay-gutter-pros -- mobile-first, no framework, no JS. */
/* The colour palette in :root is copied from the reference site; change the --color-*
   variables per site so the portfolio does not look identical. */

:root {
  /* Charcoal slate / safety-orange palette (Stage build): deliberately distinct from the
     portfolio's other sites (site-02's blue-teal, site-03's walnut/amber) -- a gutter/exterior-
     appropriate pairing. Contrast checked against WCAG AA (4.5:1 for text, 3:1 for UI-component
     borders): white-on-primary 11.5:1, white-on-primary-dark 15.8:1, white-on-accent 6.3:1,
     accent-on-bg-alt 5.8:1, text-muted-on-bg 6.2:1, border-strong-on-bg 3.6:1, footer text
     (#cdd6d8) on primary-dark 10.7:1, footer link (#eda05f) on primary-dark 7.4:1. */
  --color-primary: #2f3b40;
  --color-primary-dark: #1c2427;
  --color-accent: #a04409;
  --color-text: #20282b;
  --color-text-muted: #54646b;
  --color-bg: #ffffff;
  --color-bg-alt: #f2f5f5;
  --color-border: #d7dee0;
  --color-border-strong: #7c8a8f; /* form inputs and other interactive-element borders need 3:1, not just decorative ones */
  --radius: 10px;
  --max-width: 1180px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  font-size: 1rem;
}

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

a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--color-primary-dark); }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; color: var(--color-primary-dark); }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 4vw, 1.7rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: 0.35em; }

.container, .header-inner, .footer-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* -------------------------------------------------- Header / Nav -------- */

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  position: relative;
}
.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  text-decoration: none;
  line-height: 1.2;
  margin-right: auto;
}
.logo-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary-dark);
  text-decoration: none;
  padding: 0.5em 0.7em;
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  min-height: 44px;
}
.phone-icon { font-size: 1.1em; }

/* Keyboard-accessible CSS-only toggle: the checkbox stays in the tab order and
   is only visually hidden (display:none would remove it from keyboard and
   screen-reader access). Space toggles it; the label is the visible hamburger. */
.nav-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.nav-toggle-input:focus-visible + .nav-toggle-label {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.nav-toggle-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  order: 3;
}
.nav-toggle-label span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--color-primary-dark);
}

.site-nav {
  flex-basis: 100%;
  order: 4;
  max-height: 0;
  overflow: hidden;
  /* Closed menu links must not be tabbable while invisible. */
  visibility: hidden;
  transition: max-height 0.25s ease, visibility 0s linear 0.25s;
}
/* Phone/tablet open state: cap the menu at the visible screen (minus the
   ~8rem logo/phone/hamburger rows above it) and let it scroll internally, so
   an expanded Service Areas list -- and the Call button below it -- are always
   reachable even though the header is sticky. */
@media (max-width: 899px) {
  .nav-toggle-input:checked ~ .site-nav {
    max-height: calc(100vh - 9.5rem);
    max-height: calc(100dvh - 9.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: visible;
    transition: max-height 0.25s ease, visibility 0s;
  }
}
.site-nav > ul {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.site-nav a {
  display: block;
  padding: 0.7em 0.4em;
  text-decoration: none;
  color: var(--color-text);
  border-radius: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.site-nav a:hover, .site-nav a.active { background: var(--color-bg-alt); color: var(--color-primary-dark); }

.site-nav .nav-cta { margin-top: 0.5rem; }
.btn-phone-nav {
  background: var(--color-accent) !important;
  color: #fff !important;
  border-radius: var(--radius);
  justify-content: center;
  font-weight: 700;
  text-decoration: none !important;
}

.has-dropdown details { border-bottom: 1px solid var(--color-border); }
.has-dropdown summary {
  padding: 0.7em 0.4em;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  list-style: none;
}
.has-dropdown summary::-webkit-details-marker { display: none; }
.has-dropdown summary::after { content: "▾"; margin-left: 0.4em; }
.dropdown-panel { padding: 0.25rem 0 0.75rem 0.75rem; }
.dropdown-panel ul { list-style: none; margin: 0; padding: 0; }
.dropdown-panel a { padding: 0.5em 0.4em; }
.areas-grid { display: block; }
.areas-grid li { break-inside: avoid; }
.view-all { display: inline-flex; font-weight: 600; color: var(--color-accent); }

/* Desktop nav */
@media (min-width: 900px) {
  .header-inner { flex-wrap: nowrap; }
  .nav-toggle-label { display: none; }
  .nav-toggle-input { display: none; }
  .site-nav {
    flex-basis: auto;
    order: 2;
    max-height: none;
    overflow: visible;
    visibility: visible;
    margin-left: auto;
  }
  .site-nav > ul { flex-direction: row; align-items: center; gap: 0.2rem; }
  .site-nav a { padding: 0.5em 0.7em; }
  .header-phone { display: none; }
  .logo { order: 1; }

  .has-dropdown { position: relative; }
  .has-dropdown details { border-bottom: none; }
  .has-dropdown summary { border-radius: 6px; }
  .has-dropdown summary:hover { background: var(--color-bg-alt); }
  .dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    padding: 0.75rem;
    min-width: 240px;
    z-index: 60;
  }
  .areas-panel { width: 460px; left: auto; right: 0; }
  .areas-grid { column-count: 3; column-gap: 1rem; }
  .dropdown-panel .view-all { margin-top: 0.5rem; padding-left: 0.4em; }
}

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

main { display: block; }

.hero {
  position: relative;
  background: var(--color-bg-alt);
  overflow: hidden;
}
.hero-image { min-height: 220px; }
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) 1rem;
}
.hero-subhead { font-size: 1.1rem; color: var(--color-text-muted); max-width: 60ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7em 1.4em;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: #7d3607; color: #fff; }
.btn-phone-hero { background: var(--color-primary); color: #fff; }
.btn-phone-hero:hover { background: var(--color-primary-dark); color: #fff; }

.trust-strip {
  background: var(--color-primary-dark);
  color: #fff;
  padding: 1.25rem 0;
}
.trust-strip .container, .trust-strip { padding-left: 1rem; padding-right: 1rem; }
.trust-strip ul {
  list-style: none;
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.trust-strip li { position: relative; padding-left: 1.4em; }
.trust-strip li::before { content: "✓"; position: absolute; left: 0; color: #eda05f; font-weight: 700; }
.trust-strip a { color: #fff; }

@media (min-width: 700px) {
  .trust-strip ul { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .trust-strip ul { grid-template-columns: repeat(4, 1fr); }
}

.content-section, .page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-3) 1rem;
}
.content-section h2 { margin-top: 0; }

.page-hero { padding-top: var(--space-3); }
.page-hero p { color: var(--color-text-muted); font-size: 1.05rem; }
/* Call + Request-a-quote, repeated under the H1 of every service/area/article/hub page (not
   just the homepage), so a visitor never has to scroll past a long page to find them. */
.quick-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.btn-sm { min-height: 40px; padding: 0.55em 1.1em; font-size: 0.92rem; }
.content-body { margin-top: var(--space-2); }
.content-body :is(h2, h3, h4) { margin-top: 1.4em; }
.content-body h2 { font-size: clamp(1.25rem, 3.5vw, 1.5rem); }
.related-reading h2 { font-size: 1.15rem; }

.page-image, .hero-image {
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding: 1rem;
  margin: 1rem 0;
}
.image-placeholder-label::before { content: "🖼  "; }

/* Real fetched photos (scripts/fetch_images.py) override the placeholder-box
   styling above -- same class names so no markup change was needed. */
.page-image.loaded-photo, .hero-image.loaded-photo {
  display: block;
  border: none;
  padding: 0;
  width: 100%;
  height: 260px;
  object-fit: cover;
}
.hero-image.loaded-photo { height: 320px; }

/* Phones: keep the hero photo short and the hero text tight so the Call / Get a
   Quote buttons land above the fold on first load (the sticky header already
   takes ~8rem of a phone screen). */
@media (max-width: 559px) {
  .hero-image.loaded-photo { height: 160px; margin: 0.75rem 0 0; }
  .hero-inner { padding-top: var(--space-2); padding-bottom: var(--space-3); }
  .hero-inner h1 { margin-bottom: 0.4em; }
  .hero-subhead { margin-bottom: 0; }
  .hero-cta { margin-top: 1rem; }
  /* Tighter side padding lets both buttons share one row at 375px (they wrapped
     onto two rows before, pushing Get a Quote below the fold on 667px phones);
     flex-grow fills the row, and they still wrap to full width on narrower screens. */
  .hero-cta .btn { flex: 1 1 auto; padding-left: 1em; padding-right: 1em; }
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* The card itself is a div, not a link (site-build a11y fix): only the heading is the real
   link, so the accessible name of each card link is just its title, and there is no
   redundant "Learn more" stop for keyboard/screen-reader users. */
.card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--color-text);
  background: #fff;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  position: relative;
}
.card:hover { box-shadow: 0 10px 24px rgba(0,0,0,0.08); transform: translateY(-2px); }
.card :is(h2, h3) { margin-bottom: 0.4em; color: var(--color-primary-dark); font-size: 1.15rem; }
.card :is(h2, h3) a { color: inherit; text-decoration: none; }
/* Stretched-link technique: the heading link's hit area covers the whole card, so a click
   anywhere on the card still follows it, without making the whole card an <a>. */
.card :is(h2, h3) a::after { content: ""; position: absolute; inset: 0; }
.card :is(h2, h3) a:hover, .card :is(h2, h3) a:focus-visible { text-decoration: underline; }
.card p { color: var(--color-text-muted); font-size: 0.95rem; }
.card-link { color: var(--color-accent); font-weight: 700; font-size: 0.9rem; pointer-events: none; }

/* Homepage "Services overview" numbered list rendered as cards */
.services-overview ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) { .services-overview ol { grid-template-columns: repeat(2, 1fr); } }
.services-overview ol li {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: #fff;
}

.cta-band {
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: var(--space-3) auto;
  max-width: var(--max-width);
}
.cta-band p { margin: 0; font-size: 1.05rem; font-weight: 600; }
.cta-band a { color: #fff; text-decoration: underline; }

.related-reading {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.area-index-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem 1rem;
}
@media (min-width: 640px) { .area-index-list { grid-template-columns: repeat(3, 1fr); } }
.area-index-list a { display: block; padding: 0.4em 0; }
.area-index-note { margin-top: 1.5rem; color: var(--color-text-muted); font-size: 0.95rem; }

/* ------------------------------------------------------- Quote form ---- */

.quote-form-section {
  background: var(--color-bg-alt);
  padding: var(--space-4) 1rem;
  margin-top: var(--space-4);
}
.quote-form-inner { max-width: 640px; margin: 0 auto; }
.quote-form-inner h2 { margin-bottom: 0.3em; }

.quote-form { margin-top: 1rem; }
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (min-width: 560px) { .form-row { grid-template-columns: 1fr 1fr; } }

.quote-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.quote-form input, .quote-form select, .quote-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3em;
  padding: 0.7em 0.75em;
  min-height: 44px;
  font-size: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  font-family: inherit;
  background: #fff;
}
.quote-form input:focus, .quote-form select:focus, .quote-form textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.quote-form .cf-turnstile { margin: 0.75rem 0; }

.quote-form .btn-primary {
  width: 100%;
  border: none;
  font-size: 1.05rem;
  margin-top: 0.5rem;
  cursor: pointer;
}
@media (min-width: 560px) { .quote-form .btn-primary { width: auto; } }

.quote-form-message {
  margin-top: 1rem;
  padding: 0.9em 1em;
  border-radius: 8px;
  font-weight: 600;
}
.quote-form-message.is-success { background: #e3f0ea; color: #1c5c3f; }
.quote-form-message.is-error { background: #fbe9e9; color: #8a2c2c; }

/* -------------------------------------------------------------- Footer - */

.site-footer {
  background: var(--color-primary-dark);
  color: #cdd6d8;
  margin-top: var(--space-4);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  padding-top: var(--space-4);
  padding-bottom: var(--space-3);
}
@media (min-width: 640px) { .footer-inner { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .footer-inner { grid-template-columns: repeat(4, 1fr); } }

/* The footer's brand name and group labels are styled like headings but are <p> elements
   (site-build a11y fix): a page's heading outline should describe its content, not restart
   at the footer, and the quote-form section right above the footer already ends in an <h2>. */
.footer-col .footer-heading { color: #fff; font-weight: 700; margin: 0 0 0.6em; }
.footer-col .footer-brand { font-size: 1.17rem; }
.footer-col .footer-group { font-size: 1rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0 0 0.5em; }
.footer-col a { color: #eda05f; text-decoration: none; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-col .view-all { display: inline-block; margin-top: 0.4em; font-weight: 700; color: #eda05f; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #a9b8bc;
}

/* --- Added in Stage 5.0 (page builders) --- */

/* Pipe tables from content files: scroll sideways on phones instead of breaking the layout.
   The wrapper is a focusable, labeled region (tabindex + aria-label, set by build.py) so
   keyboard users can scroll it and screen readers announce it as a table region -- and it
   gets a visible focus ring, since it's one of the few focusable non-native elements. Each
   table's own min-width is set inline by build.py from its column count (render_table()), not
   here: a 2-3 column table gets none and wraps to fit; wider comparison tables keep a
   min-width so their columns stay legible instead of being crushed. */
.table-wrap { overflow-x: auto; margin: 1rem 0; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.content-body table, .content-section table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.content-body th, .content-body td, .content-section th, .content-section td {
  border: 1px solid var(--color-border); padding: 0.5em 0.7em; text-align: left; vertical-align: top;
}
.content-body thead th, .content-section thead th { background: var(--color-bg-alt); color: var(--color-primary-dark); }
/* The first cell of each body row is a <th scope="row"> (the row's label -- a species, town,
   year-built band or cost item); pin it so it stays visible while the rest of a wide table
   scrolls sideways. */
.content-body tbody th[scope="row"], .content-section tbody th[scope="row"] {
  background: #fff; font-weight: 600; color: var(--color-text); position: sticky; left: 0;
}
.content-body thead th:first-child, .content-section thead th:first-child { position: sticky; left: 0; z-index: 1; }

/* The generated service list at the end of every area page. */
.area-services { margin-top: var(--space-4); padding: var(--space-3); background: var(--color-bg-alt); border-radius: var(--radius); }
.area-services h2 { margin-top: 0; font-size: 1.15rem; }
.area-services ul { margin: 0 0 var(--space-2); padding-left: 1.2rem; }
.area-services p { margin: 0; }

/* Group headings on the area and blog hubs. */
.index-page > h2 { margin-top: var(--space-4); font-size: 1.25rem; }
