/* Listing page (M8): header band, actions, gallery, sections, services panel, areas, map, sidebar. */

.listing-crumbs { background: var(--color-bg); border-bottom: 1px solid var(--color-border); padding: var(--space-2) 0; }

/* Header band: dark with a subtle diagonal pattern and an orange edge (2026-09-30 build #8). */
.listing-hero {
  background-color: var(--color-dark);
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 16px);
  border-bottom: 4px solid var(--color-brand);
  color: var(--color-on-dark);
  padding: var(--space-5) 0;
}
.listing-hero__inner { display: grid; gap: var(--space-4); grid-template-columns: 1fr; align-items: center; }
.listing-hero__logo {
  width: 128px; height: 128px; border-radius: var(--radius-card); background: var(--color-bg);
  display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: var(--shadow-card);
}
.listing-hero__logo img { max-width: 100%; max-height: 100%; object-fit: contain; padding: var(--space-2); }
.listing-hero__logo .monogram { width: 100%; height: 100%; border-radius: 0; font-size: 2.75rem; }
.listing-hero h1 { color: var(--color-on-dark); margin-bottom: var(--space-2); }
.listing-hero__tagline { color: #e0e0e0; font-size: 1.125rem; margin: 0 0 var(--space-2); }
.listing-hero__address { display: flex; align-items: center; gap: var(--space-1); color: #e0e0e0; margin: 0 0 var(--space-3); }
.listing-hero__address svg { width: 18px; height: 18px; color: var(--color-brand); flex-shrink: 0; }
.listing-hero__badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.badge--link { background: transparent; color: var(--color-on-dark); border-color: rgba(255, 255, 255, 0.5); text-decoration: underline; }
.badge--link:hover { color: var(--color-brand); }
.listing-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.listing-actions__detail { font-weight: 400; text-transform: none; letter-spacing: 0; }
.btn--light { background: transparent; border-color: var(--color-on-dark); color: var(--color-on-dark); }
.btn--light:hover { background: var(--color-on-dark); border-color: var(--color-on-dark); color: var(--color-dark); }
.listing-hero :focus-visible { outline-color: var(--color-on-dark); }
@media (min-width: 740px) { .listing-hero__inner { grid-template-columns: auto 1fr; gap: var(--space-5); } }

/* Gallery (only real photos) */
.listing-gallery { padding: var(--space-4) 0 0; }
.listing-gallery__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.listing-gallery__grid a { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--color-bg-alt); }
.listing-gallery__grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.listing-gallery__grid a:hover img { transform: scale(1.04); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
.lightbox__image { display: block; max-width: 92vw; max-height: 86vh; margin: auto; border-radius: var(--radius); }
.lightbox button {
  position: fixed; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 2.25rem; line-height: 1;
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
}
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox button:focus-visible { outline: 3px solid #fff; }

/* Sections */
.listing-section { padding-bottom: var(--space-4); margin-bottom: var(--space-4); border-bottom: 1px solid var(--color-border); }
.listing-section:last-of-type { border-bottom: 0; }
.listing-section h2 { font-size: 1.375rem; color: var(--color-brand-text); }
.rich-text p:last-child { margin-bottom: 0; }
.detail-list { margin: 0; display: grid; gap: var(--space-2); }
.detail-list div { display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: var(--space-3); }
.detail-list dt { font-weight: 600; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }

/* Services panel (live: orange box with round icons linking to the Attribute Articles). Prompt 19: one Lucide icon
   set, a strict grid of equal cells, equal circles, labels centred and max 2 lines, all cells top-aligned.
   Default = white circles with an orange icon on the orange panel; --light = orange icons on a white panel. */
.listing-services { background: var(--color-brand); border-radius: var(--radius-card); padding: var(--space-4); border-bottom: 0; }
.listing-services h2 { color: var(--color-on-brand); }
.service-list {
  list-style: none; margin: 0; padding: 0; display: grid; align-items: start;
  gap: var(--space-4) var(--space-2); grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.service-list li { display: flex; justify-content: center; min-width: 0; }
.service-list__item {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2); width: 100%;
  color: var(--color-on-brand); text-decoration: none; text-align: center;
}
.service-list__icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 56px; height: 56px; border-radius: 50%; background: var(--color-bg); color: var(--color-brand-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); transition: transform 0.15s ease;
}
.service-list__icon .service-icon { width: 26px; height: 26px; display: block; }
.service-list__label {
  font-size: 0.875rem; font-weight: 600; line-height: 1.25; max-width: 100%;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere; hyphens: auto;
}
a.service-list__item:hover .service-list__label { text-decoration: underline; }
a.service-list__item:hover .service-list__icon { transform: translateY(-2px); }
.listing-services--light { background: var(--color-bg); border: 1px solid var(--color-border); }
.listing-services--light h2 { color: var(--color-brand-text); }
.listing-services--light .service-list__item { color: var(--color-text); }
.listing-services--light .service-list__icon { background: #fff4e6; box-shadow: inset 0 0 0 2px var(--color-brand); }

.social-list { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-3); }

/* Areas served */
.area-groups { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.area-group h3 { display: flex; align-items: center; gap: var(--space-2); font-size: 1.0625rem; margin-bottom: var(--space-1); }
.area-group h3 img { border-radius: 50%; border: 2px solid var(--color-brand); }
.area-group ul { list-style: none; margin: 0; padding: 0 0 0 40px; font-size: var(--font-size-small); }

/* Map */
.listing-map { height: 280px; border-radius: var(--radius-card); border: 1px solid var(--color-border); margin-bottom: var(--space-2); z-index: 0; }
.listing-location__address { color: var(--color-muted); margin-bottom: var(--space-2); }

/* Prev / next */
.post-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-3); }
.post-nav a { display: flex; flex-direction: column; text-decoration: none; max-width: 48%; font-weight: 600; }
.post-nav span { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); font-weight: 400; }
.post-nav__next { margin-left: auto; text-align: right; }

/* Sidebar: the GENERAL lead form, sticky on desktop and compact enough to fit a 768px-high window (Prompt 19). */
@media (min-width: 900px) {
  .listing-sidebar .form-panel { position: sticky; top: var(--space-3); max-height: calc(100vh - 2 * var(--space-3)); overflow-y: auto; }
}
.listing-sidebar .form-panel { scroll-margin-top: var(--space-3); }

/* Mobile: slim fixed call-back bar (fixed, so it never pushes content down); padding keeps the footer reachable. */
.callback-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: var(--space-2) var(--gutter);
  background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--color-border); box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}
.callback-bar .btn { min-height: 44px; }
.callback-bar.is-hidden { transform: translateY(110%); }
body:has(.callback-bar) { padding-bottom: 64px; }
@media (min-width: 900px) {
  .callback-bar { display: none; }
  body:has(.callback-bar) { padding-bottom: 0; }
}

/* "Email this Debt Counsellor": compact modal dialog (direct enquiry). Without JS it opens through :target. */
.enquiry-dialog {
  width: min(440px, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - 2 * var(--space-3));
  padding: 0; border: 0; border-radius: var(--radius-card); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  color: var(--color-text);
}
.enquiry-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.enquiry-dialog:target:not([open]) {
  display: block; position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 50; overflow-y: auto;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55), 0 12px 40px rgba(0, 0, 0, 0.3);
}
.enquiry-dialog__inner { position: relative; padding: var(--space-4); border-top: 4px solid var(--color-brand); border-radius: var(--radius-card); }
.enquiry-dialog h2 { font-size: 1.25rem; margin: 0 var(--space-5) var(--space-1) 0; }
.enquiry-dialog__intro { color: var(--color-muted); font-size: var(--font-size-small); margin-bottom: var(--space-3); }
.enquiry-dialog__close {
  position: absolute; top: var(--space-2); right: var(--space-2); width: 40px; height: 40px; display: flex;
  align-items: center; justify-content: center; border-radius: 50%; font-size: 1.75rem; line-height: 1;
  color: var(--color-text); text-decoration: none;
}
.enquiry-dialog__close:hover { background: var(--color-bg-alt); color: var(--color-text); }
.enquiry-dialog .form-field { margin-bottom: var(--space-2); }
.enquiry-dialog label { font-size: 0.875rem; margin-bottom: 2px; }
.enquiry-dialog .form-control { min-height: 40px; padding: 6px var(--space-2); font-size: 1rem; }
.enquiry-dialog textarea.form-control { min-height: 96px; }
.enquiry-dialog .form-consent { color: var(--color-muted); }

/* ---------- Archive pages (M9): cards left, sticky map right; "Show map" on mobile ---------- */
.archive-header__icon { display: block; margin: 0 auto var(--space-2); border-radius: 50%; border: 3px solid var(--color-brand); background: var(--color-bg); }
.archive-top { padding-top: var(--space-4); }
.archive-filters { display: grid; gap: var(--space-2) var(--space-3); grid-template-columns: minmax(0, 1fr); align-items: end; margin-bottom: var(--space-3); }
.archive-filters .form-field { margin: 0; }
.archive-filters__actions { display: flex; gap: var(--space-3); align-items: center; }
@media (min-width: 740px) { .archive-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } }
.archive-notice { background: var(--color-bg-alt); border-color: var(--color-brand); }
.province-towns { margin-bottom: var(--space-3); }
.province-towns h2 { font-size: 1.125rem; }
.province-towns ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--font-size-small); }
.province-towns span { color: var(--color-muted); }

.archive-layout { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1600px; margin: 0 auto; padding: 0 var(--gutter) var(--space-5); gap: var(--space-4); }
.archive-results { gap: var(--space-3); }
.archive-layout--contained { max-width: var(--container-max); }  /* list + map line up with the form above */
.map-toggle { margin-bottom: var(--space-3); }
.archive-map-wrap { display: none; }
.archive-map-wrap.is-open { display: block; order: -1; }
.archive-map { height: 60vh; min-height: 320px; border-radius: var(--radius-card); border: 1px solid var(--color-border); z-index: 0; }
@media (min-width: 900px) {
  .archive-layout { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); }
  .map-toggle { display: none; }
  .archive-map-wrap, .archive-map-wrap.is-open { display: block; order: 0; }
  .archive-map { position: sticky; top: var(--space-3); height: calc(100vh - 2 * var(--space-3)); }
}
.load-more-wrap { text-align: center; margin: var(--space-4) 0 var(--space-2); }
.pagination ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1); }
.pagination a, .pagination span { display: inline-block; min-width: 36px; padding: 4px 8px; text-align: center; border: 1px solid var(--color-border); border-radius: var(--radius); text-decoration: none; }
.pagination span[aria-current] { background: var(--color-brand); border-color: var(--color-brand); color: var(--color-on-brand); font-weight: 700; }

/* Map pins */
.map-pin span { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--color-brand); border: 2px solid var(--color-dark); box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s ease; }
.map-pin.is-active span { transform: scale(1.5); background: var(--color-dark); border-color: var(--color-brand); }
/* Featured: larger orange pin with a white star (static/js/map-pins.js), anchored at its tip. */
.map-pin--featured svg { display: block; width: 32px; height: 42px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); transform-origin: 50% 100%; transition: transform .15s ease; }
.map-pin--featured.is-active svg { transform: scale(1.25); }
.map-pin-preview { display: inline-flex; align-items: flex-end; gap: var(--space-4); }
.map-pin-preview figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); font-size: var(--font-size-small); }
.map-popup__title { font-weight: 700; color: var(--color-brand-text); }
.leaflet-popup-content p { margin: 4px 0 0 !important; color: var(--color-muted); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(247, 150, 29, 0.35) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: var(--color-brand) !important; color: var(--color-on-brand); font-weight: 700; }

/* ---------- Homepage (M9) ---------- */
.home-hero { position: relative; background: var(--color-dark); color: var(--color-on-dark); padding: var(--space-6) 0; z-index: 2; } /* no overflow clip: the suggestion list hangs below */
.home-hero__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.45; }
.home-hero__content { position: relative; text-align: center; }
.home-hero h1 { color: var(--color-on-dark); font-size: clamp(2.25rem, 1.6rem + 3vw, 3.75rem); margin-bottom: var(--space-2); text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.home-hero__subtitle { font-size: 1.25rem; margin-bottom: var(--space-4); text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.home-search { background: var(--color-bg); color: var(--color-text); border-radius: var(--radius-card); padding: var(--space-3); display: grid; gap: var(--space-2) var(--space-3); grid-template-columns: 1fr; text-align: left; max-width: 860px; margin: 0 auto; box-shadow: var(--shadow-card-hover); align-items: end; }
.home-search .form-field { margin: 0; }
@media (min-width: 740px) { .home-search { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } }
.home-provinces { padding: var(--space-4) 0; border-bottom: 1px solid var(--color-border); }
.home-provinces__title { text-align: center; font-size: 1.125rem; font-weight: 400; color: var(--color-muted); }
.province-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
@media (min-width: 740px) { .province-strip { grid-template-columns: repeat(9, 1fr); } }
.province-strip a { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); text-decoration: none; color: var(--color-text); font-size: var(--font-size-small); font-weight: 600; }
.province-strip img { border-radius: 50%; border: 3px solid var(--color-brand); background: var(--color-bg); transition: transform .15s ease; }
.province-strip a:hover img { transform: scale(1.06); }
.section-title { text-align: center; margin-bottom: var(--space-1); }
.section-subtitle { text-align: center; color: var(--color-muted); margin-bottom: var(--space-4); }
.section-more { text-align: center; margin-top: var(--space-4); }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: step; text-align: center; }
.steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--color-brand); color: var(--color-on-brand); font-family: var(--font-heading); font-weight: 700; font-size: 1.25rem; margin-bottom: var(--space-2); }
.steps h3 { margin-bottom: var(--space-1); }
.city-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 740px) { .city-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .city-grid { grid-template-columns: repeat(4, 1fr); } }
.city-card { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-card); overflow: hidden; background: var(--color-dark); color: var(--color-on-dark); text-decoration: none; }
.city-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.city-card:hover img { transform: scale(1.04); }
.city-card__label { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--space-4) var(--space-3) var(--space-3); background: linear-gradient(transparent, rgba(0,0,0,.75)); font-family: var(--font-heading); font-size: 1.375rem; font-weight: 600; color: var(--color-on-dark); }
.city-card__count { display: inline-block; background: var(--color-brand); color: var(--color-on-brand); border-radius: 999px; padding: 0 10px; font-size: 1rem; margin-right: 6px; }
/* Without JS the "Show map" link opens the map through :target. */
.archive-map-wrap:target { display: block; order: -1; }

/* "Is this your business? Claim this listing" (M13 decision) */
.listing-claim { margin: 0 0 var(--space-4); padding: var(--space-3); background: var(--color-bg-alt); border-radius: var(--radius); font-size: var(--font-size-small); }
.request-form__listing { font-weight: 600; }

/* ---------- Listing grid (Prompt 26): the general form card floats over the header band, top right ---------- */
.listing-shell__band { display: none; }
.listing-hero__inner { padding: 0 var(--gutter); }
.listing-shell__main { padding: 0 var(--gutter) var(--space-5); }
.listing-shell__main .listing-gallery { padding-top: var(--space-4); }
.listing-main { padding-top: var(--space-5); }
.listing-sidebar { padding: 0 var(--gutter) var(--space-5); }
@media (min-width: 900px) {
  .listing-shell {
    display: grid; align-items: start;
    grid-template-columns: [full-start] minmax(var(--gutter), 1fr) [main-start] minmax(0, 780px) [main-end] var(--space-5)
                           [side-start] minmax(320px, 360px) [side-end] minmax(var(--gutter), 1fr) [full-end];
    grid-template-rows: auto 1fr;
  }
  .listing-shell__band {
    display: block; grid-column: full-start / full-end; grid-row: 1; align-self: stretch;
    background-color: var(--color-dark);
    background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 16px);
    border-bottom: 4px solid var(--color-brand);
  }
  .listing-shell .listing-hero { grid-column: main-start / main-end; grid-row: 1; background: none; border-bottom: 0; }
  .listing-hero__inner { padding: 0; }
  .listing-shell__main { grid-column: main-start / main-end; grid-row: 2; padding: 0 0 var(--space-5); }
  .listing-main { padding-top: var(--space-4); }
  .listing-sidebar { grid-column: side-start / side-end; grid-row: 1 / 3; align-self: stretch; padding: var(--space-3) 0 var(--space-5); position: relative; z-index: 1; }
  .listing-sidebar .form-panel { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
}
