/* site-05-sioux-city-floor-refinishing -- 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 {
  --color-primary: #1d4e6b;
  --color-primary-dark: #123648;
  --color-accent: #1f7a5c; /* white-on-accent 5.25:1, accent-on-alt-bg 4.87:1 (WCAG AA) */
  --color-text: #202830;
  --color-text-muted: #56626c;
  --color-bg: #ffffff;
  --color-bg-alt: #f3f7f8;
  --color-border: #dbe3e6;
  --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: #185f49; 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: #7fd9b6; 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; }
.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); } }

.card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--color-text);
  background: #fff;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: 0 10px 24px rgba(0,0,0,0.08); transform: translateY(-2px); color: var(--color-text); }
.card :is(h2, h3) { margin-bottom: 0.4em; color: var(--color-primary-dark); }
.card h2 { font-size: 1.15rem; }
.card p { color: var(--color-text-muted); font-size: 0.95rem; }
.card-link { color: var(--color-accent); font-weight: 700; font-size: 0.9rem; }

/* 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);
  border-radius: 8px;
  font-family: inherit;
  background: #fff;
}
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.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: #e3f3ec; color: #1c5c3f; }
.quote-form-message.is-error { background: #fbe9e9; color: #8a2c2c; }

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

.site-footer {
  background: var(--color-primary-dark);
  color: #dbe6ea;
  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); } }

.footer-col h3, .footer-col h4 { color: #fff; }
.footer-col ul { list-style: none; padding: 0; margin: 0 0 0.5em; }
.footer-col a { color: #b9d0d8; 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: #7fd9b6; }

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