/* =========================================================
   SouthCoast Plumbers — mobile-first stylesheet
   Brand palette taken from the logo: lime green + blue + dark
   ========================================================= */
:root {
  --dark: #16231a; --dark-2: #1f3326;
  --lime: #8cc63f; --lime-dark: #6fa42c;
  --blue: #2c9fd6; --blue-dark: #1f7fae;
  --ink: #1c2733; --muted: #5b6b7a; --line: #e3e8ee;
  --bg: #f6f8fa; --card: #ffffff;
  --good: #21a366; --ok: #f4a300; --bad: #e0533d;
  --radius: 14px; --shadow: 0 2px 12px rgba(22,35,26,.10); --max: 1080px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 40px; width: auto; }
.brand .mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--lime); border-radius: 8px; }
.brand .mark svg { width: 19px; height: 19px; }
.nav { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nav a { color: #cfe0ef; font-weight: 600; font-size: .85rem; white-space: nowrap; padding: 6px 8px; border-radius: 6px; }
.nav a:hover { color: #fff; text-decoration: none; }
@media (max-width: 600px) { .nav { display: none; } }

/* Hero */
.hero { position: relative; color: #fff; padding: 44px 0 52px; text-align: center; background: var(--dark); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background-image: linear-gradient(180deg, rgba(15,30,20,.72), rgba(15,30,20,.82)), url('images/coastline.jpg'); background-size: cover; background-position: center; z-index: 0; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.4px; }
.hero p { font-size: 1.02rem; color: #e7eef0; max-width: 620px; margin: 0 auto 22px; }
.hero-logo { display: block; width: 78%; max-width: 320px; height: auto; margin: 0 auto 16px; filter: drop-shadow(0 8px 22px rgba(0,0,0,.5)); }
@media (min-width: 600px) { .hero-logo { max-width: 430px; } }
.search-bar { display: flex; flex-direction: column; gap: 8px; max-width: 540px; margin: 0 auto; }
.search-bar input { border: 0; padding: 14px 18px; font-size: 1rem; border-radius: 12px; outline: none; color: var(--ink); width: 100%; }
.search-bar .btn { width: 100%; }

/* Buttons */
.btn { display: inline-block; background: var(--lime); color: #14250d; border: 0; padding: 13px 22px; border-radius: 12px; font-weight: 800; font-size: 1rem; cursor: pointer; text-align: center; line-height: 1.2; }
.btn:hover { background: var(--lime-dark); text-decoration: none; color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); font-weight: 700; }
.btn-outline:hover { background: #f0f7fc; color: var(--blue-dark); }

/* Sections */
section { padding: 36px 0; }
.section-head { text-align: center; margin-bottom: 24px; }
.section-head h2 { font-size: 1.4rem; margin: 0 0 6px; }
.section-head p { color: var(--muted); margin: 0; font-size: .96rem; }

/* Towns */
.towns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.town-chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow); font-size: .92rem; }
.town-chip:hover { border-color: var(--lime); color: var(--lime-dark); text-decoration: none; }

/* Controls bar */
.list-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.result-count { color: var(--muted); font-size: .9rem; font-weight: 700; }
.controls-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.view-toggle button { border: 0; background: #fff; padding: 8px 14px; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; }
.view-toggle button.active { background: var(--dark); color: #fff; }
.sort-wrap { font-size: .85rem; color: var(--muted); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.sort-wrap select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: .9rem; font-weight: 600; color: var(--ink); background: #fff; cursor: pointer; }
@media (max-width: 699px) { .view-toggle { display: none; } }

/* Listings grid base */
.listings { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--blue); text-decoration: none; }

/* Avatars + card head */
.avatar { width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 1.02rem; letter-spacing: .02em; background: var(--avatar, #1d6fb8); }
.avatar-lg { width: 60px; height: 60px; font-size: 1.3rem; border-radius: 14px; }
.listing-hero-head { display: flex; gap: 16px; align-items: center; }
.card-head { display: flex; gap: 14px; align-items: flex-start; }
.card-id { flex: 1; min-width: 0; }

/* Tier accent + featured */
.card.tier-good { border-left-color: var(--lime); }
.card.tier-mid { border-left-color: var(--blue); }
.card.tier-low { border-left-color: var(--ok); }
.card.featured { background: linear-gradient(160deg, #f3fae8, #fff); border-color: #cfe6a3; border-left-color: var(--lime); box-shadow: 0 4px 16px rgba(140,198,63,.20); }

/* Badges */
.badge { font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; white-space: nowrap; }
.badge-specialty { background: #e6f3fb; color: var(--blue-dark); }
.badge-preferred { background: var(--lime); color: #14250d; display: inline-flex; align-items: center; gap: 4px; }
.badge-preferred svg { width: 11px; height: 11px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.meta { color: var(--muted); font-size: .92rem; margin: 4px 0; display: flex; align-items: center; gap: 8px; }
.meta svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.card-actions { margin-top: 16px; display: flex; gap: 10px; }
.card-actions .btn { padding: 10px 16px; font-size: .9rem; flex: 1; }

/* Dual scores */
.scores { display: flex; gap: 14px; margin: 14px 0 4px; }
.score { display: flex; align-items: center; gap: 9px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; flex: 1; }
.score-ring { --val: 0; --ring: var(--good); width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: radial-gradient(closest-side, #fff 70%, transparent 71% 100%), conic-gradient(var(--ring) calc(var(--val) * 1%), #e7ecf1 0); font-weight: 800; font-size: .82rem; color: var(--ink); }
.score-ring span { grid-area: 1 / 1; }
.score-label { font-size: .72rem; line-height: 1.25; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.score-label small { display: block; font-size: .68rem; color: #9aa7b3; font-weight: 600; text-transform: none; letter-spacing: 0; }
.s-good { --ring: var(--good); }
.s-ok { --ring: var(--ok); }
.s-bad { --ring: var(--bad); }

/* Grid (tile) view */
#listingsGrid.view-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { #listingsGrid.view-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (min-width: 900px) { #listingsGrid.view-grid { grid-template-columns: repeat(3, 1fr); } }

/* List view (desktop; falls back to stacked tiles on mobile) */
@media (min-width: 700px) {
  #listingsGrid.view-list { display: block; }
  #listingsGrid.view-list .card { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 28px; margin-bottom: 12px; }
  #listingsGrid.view-list .card .scores { margin: 0; }
  #listingsGrid.view-list .card .card-actions { margin-top: 0; }
  #listingsGrid.view-list .card .card-actions .btn { flex: 0 0 auto; padding: 10px 18px; }
  #listingsGrid.view-list .card:nth-of-type(even) { background: #f4f7f9; }
  #listingsGrid.view-list .card.featured { background: linear-gradient(160deg, #f3fae8, #fff); }
  #listingsGrid.view-list .placeholder { display: none; }
}

/* Listing detail */
.listing-hero { background: #fff; border-bottom: 1px solid var(--line); padding: 28px 0; }
.listing-hero h1 { margin: 0 0 8px; font-size: 1.5rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 20px; padding: 28px 0; }
.detail-stack { padding: 28px 0; max-width: 820px; margin: 0 auto; }
.info-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.info-block h2 { margin-top: 0; font-size: 1.15rem; }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-row:last-child { border-bottom: 0; }
.contact-row svg { width: 20px; height: 20px; color: var(--blue); flex-shrink: 0; }
.claim-box { background: linear-gradient(160deg, #f3fae8, #fff); border: 1px solid #d4e7a8; }
.map-placeholder { background: #e9eef3; border-radius: 10px; height: 170px; border: 1px solid var(--line); }
.scores-detail { display: flex; gap: 14px; flex-wrap: wrap; }
.scores-detail .score { min-width: 150px; }

/* Blog */
.posts { display: grid; grid-template-columns: 1fr; gap: 16px; }
.post-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.post-card .thumb { height: 160px; background-size: cover; background-position: center; background-color: #dbe4ea; }
.post-card .post-body { padding: 18px; }
.post-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.post-card h3 a { color: var(--ink); }
.post-card .tag { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--blue); }
.article { max-width: 720px; margin: 0 auto; padding: 28px 0; }
.article h1 { font-size: 1.7rem; line-height: 1.2; }
.article p { font-size: 1.05rem; }
.article h2 { margin-top: 1.6em; }
.article-hero { width: 100%; border-radius: 14px; margin: 6px 0 22px; max-height: 360px; object-fit: cover; }
.banner { width: 100%; max-height: 300px; object-fit: cover; border-radius: 14px; margin-bottom: 22px; }

/* CTA band */
.cta-band { background: var(--dark); color: #fff; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #d7e3dd; max-width: 560px; margin: 0 auto 22px; }

/* Footer */
.site-footer { background: #0f1c14; color: #9fb3a6; padding: 30px 0; font-size: .9rem; }
.site-footer .container { display: flex; flex-direction: column; gap: 14px; }
.site-footer a { color: #cfe0ef; }
.site-footer .legal { color: #6f8479; }
.footer-logo { height: 46px; width: auto; margin-bottom: 4px; }

.breadcrumb { font-size: .88rem; color: var(--muted); padding: 14px 0 0; }
.breadcrumb a { color: var(--muted); }
.hidden { display: none !important; }
.no-results { text-align: center; color: var(--muted); padding: 24px; }

/* Tablet+ */
@media (min-width: 600px) {
  .nav { display: flex; overflow: visible; }
  .nav a { font-size: .92rem; padding: 6px 10px; margin-left: 4px; }
  .brand { font-size: 1.15rem; }
  .brand-logo { height: 44px; }
  .hero { padding: 60px 0 68px; }
  .hero h1 { font-size: 2.1rem; }
  .hero p { font-size: 1.15rem; }
  .search-bar { flex-direction: row; background: #fff; border-radius: 999px; padding: 6px; gap: 6px; }
  .search-bar input { border-radius: 999px; }
  .search-bar .btn { width: auto; border-radius: 999px; }
  .section-head h2 { font-size: 1.7rem; }
  .posts { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .site-footer .container { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; }
}
@media (min-width: 900px) {
  .container { padding: 0 20px; }
  .posts { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr 330px; gap: 32px; }
  .sidebar .info-block { position: sticky; top: 80px; }
  .listing-hero h1 { font-size: 2rem; }
  .article h1 { font-size: 2.1rem; }
}
