/* ═══════════════════════════════════════════════════════════════════
   mobile-premium.css — Phase 1 of mobile-first programme
   Loaded last so it can override site.css + site-v2-supplemental.css
   on small viewports without affecting desktop.

   Sections:
     1. Mobile typography (16px body, 16px inputs to prevent iOS zoom)
     2. Tap target minimums (44×44 per Apple HIG)
     3. iOS safe-area + touch feedback
     4. Hamburger button + nav drawer
     5. Slim cookie bar
     6. Sticky dual CTA bar (Cost Calc + Find a Roofer)
     7. Spacing reserves so content isn't hidden behind the sticky bar
   ═══════════════════════════════════════════════════════════════════ */

/* ── Hamburger button — hidden on desktop, visible on mobile ── */
.mb-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--line-2, #e5e7eb);
  border-radius: 12px;
  color: var(--ink, #111827);
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  transition: background .15s, transform .1s;
}
.mb-nav-toggle:active { transform: scale(.96); background: var(--line, #f3f4f6); }

/* ── Hamburger + drawer visible/active only below 769px ── */
@media (max-width: 768px) {
  .mb-nav-toggle { display: inline-flex; }
}

/* Drawer panel (mounted always; toggled via .is-open) ────────────── */
.mb-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  pointer-events: none;
}
.mb-drawer.is-open { visibility: visible; pointer-events: auto; }
.mb-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0);
  transition: background .2s ease;
}
.mb-drawer.is-open .mb-drawer__backdrop { background: rgba(15, 23, 42, .42); }
.mb-drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(360px, 88vw);
  background: #ffffff;
  box-shadow: -12px 0 40px rgba(15, 23, 42, .25);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom)) 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.mb-drawer.is-open .mb-drawer__panel { transform: translateX(0); }
.mb-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.mb-drawer__title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3, #6b7280);
}
.mb-drawer__close {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 12px;
  color: var(--ink, #111827); cursor: pointer;
}
.mb-drawer__close:active { background: var(--line, #f3f4f6); transform: scale(.96); }

.mb-drawer__primary { display: grid; gap: 10px; margin-bottom: 22px; }
.mb-drawer__cta {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: 16px;
  font-weight: 600; font-size: 16px;
  min-height: 56px;
  transition: transform .1s, background .15s;
}
.mb-drawer__cta:active { transform: scale(.98); }
.mb-drawer__cta--primary { background: var(--primary, #0f1e2f); color: #fff; }
.mb-drawer__cta--primary:hover { background: var(--primary-deep, #0a1623); color: #fff; }
.mb-drawer__cta--secondary { background: var(--brand, #f97316); color: #fff; }
.mb-drawer__cta--secondary:hover { background: var(--brand-deep, #ea580c); color: #fff; }
.mb-drawer__cta svg { flex: 0 0 22px; }

.mb-drawer__nav { margin-bottom: 18px; }
.mb-drawer__nav h3 {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3, #6b7280);
  margin: 0 0 8px;
}
.mb-drawer__nav ul { list-style: none; padding: 0; margin: 0; }
.mb-drawer__nav li { margin: 0; }
.mb-drawer__nav a {
  display: flex; align-items: center;
  padding: 12px 8px;
  min-height: 44px;
  font-size: 16px; font-weight: 500;
  color: var(--ink, #111827);
  border-radius: 10px;
}
.mb-drawer__nav a:active { background: var(--line, #f3f4f6); }
.mb-drawer__nav--minor a { font-size: 14.5px; color: var(--ink-2, #4b5563); font-weight: 400; }

/* Lock body scroll while drawer is open */
body.mb-drawer-open { overflow: hidden; }

/* ═══════════════ Slim cookie bar ═══════════════ */
.cookie-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 998;
  background: rgba(15, 23, 42, .96);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cookie-bar__inner {
  max-width: 1152px; margin: 0 auto;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
}
.cookie-bar__msg {
  margin: 0; font-size: 13.5px; line-height: 1.4;
  color: rgba(255, 255, 255, .82);
  flex: 1 1 200px; min-width: 0;
}
.cookie-bar__link { color: #93c5fd; text-decoration: underline; }
.cookie-bar__actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-bar__form { margin: 0; }
.cookie-bar__btn {
  padding: 9px 16px;
  font-size: 13.5px; font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  min-height: 38px;
  cursor: pointer;
  transition: transform .1s, background .15s;
}
.cookie-bar__btn:active { transform: scale(.96); }
.cookie-bar__btn--ghost {
  background: transparent;
  color: rgba(255, 255, 255, .85);
  border-color: rgba(255, 255, 255, .25);
}
.cookie-bar__btn--ghost:hover { background: rgba(255, 255, 255, .08); }
.cookie-bar__btn--primary {
  background: var(--brand, #f97316);
  color: #fff;
}
.cookie-bar__btn--primary:hover { background: var(--brand-deep, #ea580c); }

@media (max-width: 480px) {
  .cookie-bar { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .cookie-bar__inner { gap: 8px; }
  .cookie-bar__msg { font-size: 12.5px; flex-basis: 100%; order: -1; }
  .cookie-bar__actions { width: 100%; }
  .cookie-bar__form { flex: 1; }
  .cookie-bar__btn { width: 100%; min-height: 40px; }
}

/* ═══════════════ Sticky dual CTA bar ═══════════════ */
.mb-cta-bar {
  display: none; /* default; shown on mobile only */
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 999;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
  gap: 10px;
}
.mb-cta-bar__btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 600; font-size: 15px;
  letter-spacing: -.005em;
  text-align: center;
  transition: transform .12s ease, background .15s, box-shadow .15s;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 2px 8px rgba(15, 23, 42, .06);
}
.mb-cta-bar__btn:active { transform: scale(.97); }
.mb-cta-bar__btn--primary {
  background: var(--brand, #f97316);
  color: #ffffff;
}
.mb-cta-bar__btn--primary:hover { background: var(--brand-deep, #ea580c); color: #fff; }
.mb-cta-bar__btn--secondary {
  background: #ffffff;
  color: var(--primary, #0f1e2f);
  border: 1px solid var(--line-2, #e5e7eb);
}
.mb-cta-bar__btn--secondary:hover { background: var(--bg, #fafaf7); color: var(--primary-deep, #0a1623); }
.mb-cta-bar__icon { flex: 0 0 22px; }
.mb-cta-bar__label { white-space: nowrap; }

/* Show CTA bar on mobile only */
@media (max-width: 768px) {
  .mb-cta-bar { display: flex; }

  /* When cookie bar is present, stack CTA bar above it */
  body.has-cookie-bar .mb-cta-bar { bottom: 72px; }
  body.has-cookie-bar .mb-cta-bar { padding-bottom: 10px; }

  /* Reserve space at bottom of every page so content
     isn't hidden under the sticky CTA bar */
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  body.has-cookie-bar { padding-bottom: calc(72px + 72px + env(safe-area-inset-bottom)); }
}

/* ═══════════════ Global mobile typography + tap targets ═══════════════ */
@media (max-width: 768px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { font-size: 16px; line-height: 1.55; }
  p, li, td, th, dd { font-size: 16px; line-height: 1.55; }

  /* 16px on form fields prevents iOS auto-zoom on focus */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="url"],
  input[type="password"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Tap target minimums for interactive elements */
  .nav-links a,
  .nav-cta a,
  .nav-cta button,
  a.btn, button.btn,
  a.pill, span.pill,
  a.chip,
  .footer-inner a,
  .footer-bottom a,
  .legal a,
  .breadcrumbs a,
  .popular a,
  .sort-row a, .sort-row button,
  .pager a, .pager button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Body padding-bottom for the sticky CTA bar applied above */
}

/* ── Tap feedback (cards & buttons) ────────────────────────── */
@media (max-width: 768px) and (hover: none) {
  a.card,
  .card,
  .lp-nearby-card,
  .roofer-card,
  .listing-card,
  button:not(:disabled),
  .btn {
    transition: transform .12s ease, opacity .12s ease;
  }
  a.card:active,
  .card:active,
  .lp-nearby-card:active,
  .roofer-card:active,
  .listing-card:active {
    transform: scale(.985);
  }
  button:active:not(:disabled),
  .btn:active {
    transform: scale(.97);
  }
}

/* ── iOS safe-area for the standard footer too ── */
@media (max-width: 768px) {
  footer { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Suppress 300ms tap delay where supported ── */
html { touch-action: manipulation; }

/* ── Prevent text from looking unfocused when iOS auto-shrinks ── */
@media (max-width: 480px) {
  h1 { line-height: 1.15; }
  h2 { line-height: 1.2; }
}

/* ═══════════════ Home: mobile inline "Or use Cost Calculator" CTA ═══════════════ */
.mb-or-calc { display: none; }
@media (max-width: 768px) {
  .mb-or-calc {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px auto 8px;
    padding: 12px 14px;
    border: 1px solid var(--line-2, #e5e7eb);
    background: #ffffff;
    border-radius: 16px;
    max-width: 640px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .04), 0 12px 28px -16px rgba(15, 23, 42, .12);
    transition: transform .12s ease, border-color .15s, box-shadow .15s;
  }
  .mb-or-calc:active { transform: scale(.985); }
  .mb-or-calc__icon {
    width: 44px; height: 44px; flex: 0 0 44px;
    display: grid; place-items: center;
    background: var(--brand-tint, #fff5e8);
    color: var(--brand, #f97316);
    border-radius: 12px;
  }
  .mb-or-calc__text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .mb-or-calc__text strong {
    font-size: 15.5px; font-weight: 700;
    color: var(--ink, #111827);
    letter-spacing: -.005em;
  }
  .mb-or-calc__text small {
    font-size: 13px;
    color: var(--ink-3, #6b7280);
  }
  .mb-or-calc__chev { color: var(--ink-3, #6b7280); flex: 0 0 20px; }
}

/* ═══════════════ Phase 2 ═══════════════ */

/* ── Town / county SEO intro: collapsible on mobile ─────────────── */
/* Desktop default: body visible, summary hidden (no JS, no `open` attr needed) */
.seo-intro { margin: 0; }
.seo-intro > .seo-intro__summary { display: none; }
@media (min-width: 769px) {
  .seo-intro > .seo-intro__body { display: block !important; }
  .seo-intro > .seo-intro__summary { display: none !important; }
}
/* Mobile: collapsed by default, summary is the tap-to-expand row */
@media (max-width: 768px) {
  .seo-intro {
    background: #ffffff;
    border: 1px solid var(--line-2, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
  }
  .seo-intro > .seo-intro__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    min-height: 48px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink-2, #4b5563);
    cursor: pointer;
    list-style: none;
    user-select: none;
  }
  .seo-intro > .seo-intro__summary::-webkit-details-marker { display: none; }
  .seo-intro > .seo-intro__summary::after {
    content: '';
    width: 10px; height: 10px;
    border-right: 2px solid var(--ink-3, #6b7280);
    border-bottom: 2px solid var(--ink-3, #6b7280);
    transform: rotate(45deg);
    transition: transform .2s ease;
  }
  .seo-intro[open] > .seo-intro__summary::after { transform: rotate(-135deg); }
  .seo-intro > .seo-intro__body {
    padding: 4px 16px 16px;
    border-top: 1px solid var(--line, #f3f4f6);
    background: #fff;
    border-radius: 0;
  }
  .seo-intro > .seo-intro__body { font-size: 15px !important; line-height: 1.55 !important; color: var(--ink-2, #4b5563); }
}

/* ── Reusable inline cost-calc CTA (town/county/blog/search empty) ─ */
.mb-inline-calc { display: none; }
@media (max-width: 768px) {
  .mb-inline-calc {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 16px;
    padding: 14px 14px;
    border: 1px solid var(--brand, #f97316);
    background: linear-gradient(135deg, #fff5e8 0%, #ffffff 100%);
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(249, 115, 22, .05), 0 14px 30px -16px rgba(249, 115, 22, .25);
    transition: transform .12s ease;
  }
  .mb-inline-calc:active { transform: scale(.985); }
  .mb-inline-calc__icon {
    width: 44px; height: 44px; flex: 0 0 44px;
    display: grid; place-items: center;
    background: var(--brand, #f97316);
    color: #ffffff;
    border-radius: 12px;
  }
  .mb-inline-calc__text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .mb-inline-calc__text strong {
    font-size: 15.5px; font-weight: 700;
    color: var(--ink, #111827);
    letter-spacing: -.005em;
  }
  .mb-inline-calc__text small {
    font-size: 13px;
    color: var(--ink-2, #4b5563);
  }
  .mb-inline-calc__chev { color: var(--brand, #f97316); flex: 0 0 20px; }
}

/* ── Listing detail sticky Call+Quote bar ───────────────────────── */
.li-actionbar {
  display: none; /* mobile-only */
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 999;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .98);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .10);
  gap: 10px;
}
.li-actionbar__btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -.005em;
  text-align: left;
  transition: transform .12s ease, background .15s;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 2px 8px rgba(15, 23, 42, .06);
}
.li-actionbar__btn:active { transform: scale(.97); }
.li-actionbar__btn--call {
  background: var(--brand, #f97316);
  color: #ffffff;
}
.li-actionbar__btn--call:hover { background: var(--brand-deep, #ea580c); color: #fff; }
.li-actionbar__btn--quote {
  background: var(--primary, #0f1e2f);
  color: #ffffff;
}
.li-actionbar__btn--quote:hover { background: var(--primary-deep, #0a1623); color: #fff; }
.li-actionbar__icon { flex: 0 0 22px; }
.li-actionbar__label { display: flex; flex-direction: column; gap: 0; line-height: 1.1; min-width: 0; }
.li-actionbar__label-top { font-size: 14.5px; font-weight: 700; }
.li-actionbar__label-bottom { font-size: 11.5px; opacity: .82; font-weight: 500; }

@media (max-width: 768px) {
  .li-actionbar { display: flex; }
  /* Listing pages reserve space at the bottom */
  body.has-li-actionbar { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  body.has-li-actionbar.has-cookie-bar { padding-bottom: calc(72px + 72px + env(safe-area-inset-bottom)); }
  body.has-li-actionbar .cookie-bar { bottom: 72px; }
}

/* ── Search results: slim mobile cards (override search.ejs scoped) ── */
@media (max-width: 720px) {
  /* Suppress the dark "mark" banner — wastes vertical space on mobile */
  .srp-card .mark {
    min-height: 0 !important;
    padding: 8px 14px !important;
    border-radius: 0;
  }
  .srp-card .mark .mark-eyebrow {
    font-size: 10px;
    letter-spacing: .14em;
    opacity: .8;
  }
  /* Town name in the banner → use it as a small kicker, not a giant headline */
  .srp-card .mark .mark-town {
    font-size: 13px !important;
    margin: 2px 0 0 !important;
    font-style: normal !important;
    font-weight: 600 !important;
    font-family: inherit !important;
  }
  /* Move badges inline; suppress decorative gradient bubble */
  .srp-card .mark::before { display: none; }
  .srp-card .mark .mark-foot { gap: 4px; }
  .srp-card .mark .badge {
    font-size: 10.5px;
    padding: 2px 8px;
  }
  /* Body — tighten spacing, larger name */
  .srp-card .body { padding: 14px 16px 12px !important; }
  .srp-card .body .title {
    font-size: 18px !important;
    line-height: 1.2 !important;
  }
  .srp-card .body .addr { margin-bottom: 8px; font-size: 13.5px !important; }
  .srp-card .body .services {
    /* Hide service chips on mobile — they're noise; users have already
       searched for a service. Keeps the card visually clean. */
    display: none !important;
  }
  .srp-card .body .quality {
    gap: 10px;
    font-size: 12px !important;
  }
  /* Action panel — horizontal stack of 2 primary CTAs, drop secondary */
  .srp-card .action {
    border-top: 1px solid var(--line, #f3f4f6) !important;
    padding: 10px 12px !important;
    flex-direction: row !important;
    gap: 8px !important;
  }
  .srp-card .action .btn-phone,
  .srp-card .action .btn-quote {
    flex: 1 1 0;
    min-height: 44px;
    padding: 10px 12px !important;
    font-size: 13.5px !important;
  }
  .srp-card .action .btn-profile,
  .srp-card .action .btn-web,
  .srp-card .action .compare {
    display: none !important;
  }
  /* Tighter result grid */
  .srp-results { gap: 12px !important; }
}

/* ── Get-quotes: form-first on mobile (hide explainer aside) ──── */
@media (max-width: 900px) {
  /* The hero-promo on get-quotes is the "How it works" 3-step explainer.
     On mobile we suppress it so the form appears above the fold. */
  body.page-get-quotes .hero .hero-promo {
    display: none !important;
  }
  body.page-get-quotes .hero {
    padding-bottom: 12px !important;
  }
}

/* ── Cost-calc result → Find roofer follow-on ──────────────────── */
.cc-follow-on {
  margin: 18px 0 6px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--primary, #0f1e2f) 0%, var(--primary-deep, #0a1623) 100%);
  color: #ffffff;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}
.cc-follow-on__icon {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  background: rgba(255, 255, 255, .14);
  border-radius: 12px;
  display: grid; place-items: center;
  color: #ffffff;
}
.cc-follow-on__text { flex: 1; min-width: 0; }
.cc-follow-on__text strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}
.cc-follow-on__text small {
  font-size: 13px;
  opacity: .82;
}
.cc-follow-on__cta {
  flex: 0 0 auto;
  padding: 12px 20px;
  background: var(--brand, #f97316);
  color: #ffffff;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: transform .12s ease, background .15s;
}
.cc-follow-on__cta:hover { background: var(--brand-deep, #ea580c); color: #fff; }
.cc-follow-on__cta:active { transform: scale(.97); }
@media (max-width: 480px) {
  .cc-follow-on { flex-wrap: wrap; padding: 16px; }
  .cc-follow-on__cta { width: 100%; justify-content: center; margin-top: 4px; }
}

/* ── Blog cover-image fallback (SVG, not emoji) ─────────────── */
.blog-cover-fallback {
  width: 100%;
  height: 176px;
  background: linear-gradient(135deg, var(--primary-tint, #e8eef6) 0%, var(--brand-tint, #fff5e8) 100%);
  display: grid;
  place-items: center;
  color: var(--primary, #0f1e2f);
}
.blog-cover-fallback svg { width: 56px; height: 56px; opacity: .9; }
