/* One file, on purpose (see docs/ARCHITECTURE.md folder structure) —
   polished but plain: generous whitespace, a tight type scale, no chrome.
   Mobile-first: base rules target narrow phones, then two breakpoints
   widen things up — 640px (tablet) and 900px (desktop, where the full
   nav shows and the hamburger toggle disappears). See docs/DECISIONS/0011. */

:root {
  /* Neutrals */
  --ink: #2a2420;
  --ink-soft: #6b6058;
  --line: #e8ddd0;
  --paper: #fff9f2;
  --card: #ffffff;

  /* Brand — coral primary, teal secondary */
  --accent: #d8481f;
  --accent-hover: #c23f1a;
  --accent-ink: #ffffff;
  --accent-soft: #fde4d8;
  --teal: #0f766e;
  --teal-soft: #dcf3f0;

  /* Status */
  --danger: #c0392b;
  --danger-soft: #fbe4e1;
  --success: #157a55;
  --success-soft: #e1f3ea;
  --warn: #b8860b;
  --warn-soft: #faf1dc;

  --radius: 8px;
  --radius-sm: 4px;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  /* Type scale */
  --font-sm: 0.85rem;
  --font-base: 1rem;
  --font-md: 1.1rem;
  --font-lg: 1.4rem;
  --font-xl: 1.8rem;
}

* { box-sizing: border-box; }

/* The UA's [hidden] rule is a bare `display: none` on the element type, so
   any explicit display in this file beats it — `button { display:
   inline-block }` below silently defeated `hidden` on a <button>. This makes
   the attribute mean what it says wherever it's used. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--font-base)/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--teal); }

h1 {
  font-size: var(--font-lg);
  margin: 0 0 var(--space-4);
}

h2 {
  font-size: var(--font-md);
  margin: var(--space-6) 0 var(--space-3);
}

@media (min-width: 640px) {
  h1 { font-size: var(--font-xl); }
}

/* ============ Header / responsive nav ============ */

.site-header,
.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: var(--font-md);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  height: 2rem;
  width: auto;
  display: block;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  margin-left: auto;
  order: 1;
}

.site-nav {
  display: none;
  flex-basis: 100%;
  flex-direction: column;
  gap: var(--space-3);
  order: 2;
}

.site-nav.nav-open { display: flex; }

.site-nav nav,
.staff-header nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.site-nav nav a,
.staff-header nav a,
.link-button {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--font-base);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.site-nav nav a:hover,
.staff-header nav a:hover,
.link-button:hover { color: var(--ink); }

.staff-header .helptext { color: var(--staff-ink-soft, var(--ink-soft)); }

.site-search { flex-basis: 100%; }

.site-search input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--font-base);
}

.site-nav .site-categories {
  display: flex;
  flex-direction: row;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--font-sm);
}

.site-categories a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-categories a:hover { color: var(--ink); }

.inline-form { display: inline; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }

  .site-header { flex-wrap: nowrap; }

  .site-nav {
    display: flex !important;
    flex-basis: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
    flex: 1 1 auto;
    order: initial;
  }

  .site-nav nav,
  .staff-header nav {
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
  }

  .site-search { flex: 1 1 220px; max-width: 320px; }
  .site-categories { flex: 0 1 auto; }
}

/* ============ Layout container ============ */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
}

.container.wide { max-width: 1040px; }

@media (min-width: 640px) {
  .container { padding: var(--space-6) var(--space-5) var(--space-8); }
}

/* ============ Forms ============ */

form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

label {
  display: block;
  font-size: var(--font-sm);
  color: var(--ink-soft);
  margin-bottom: var(--space-1);
}

label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-base);
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--font-base);
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

input[type="file"] {
  font-size: var(--font-sm);
  color: var(--ink-soft);
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

input:invalid:not(:placeholder-shown),
input.invalid {
  border-color: var(--danger);
}

button, .button {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

button:hover, .button:hover { background: var(--accent-hover); }

.field-error {
  color: var(--danger);
  font-size: var(--font-sm);
  margin: var(--space-1) 0 0;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
}

.message {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: var(--space-2);
}

.message-success { background: var(--success-soft); color: var(--success); }
.message-error { background: var(--danger-soft); color: var(--danger); }

.helptext {
  font-size: var(--font-sm);
  color: var(--ink-soft);
  margin-top: var(--space-4);
}

.helptext a { color: var(--accent); }

.safety-notice {
  background: var(--warn-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  margin-bottom: var(--space-3);
}

.safety-notice a { color: var(--accent); font-weight: 600; }

.meetup-suggestion {
  background: var(--teal-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  margin-bottom: var(--space-3);
}

.meetup-suggestion a { color: var(--teal); font-weight: 600; }

/* ============ Tooltip ============ */
/* CSS-only: :hover for mouse, :focus-within for keyboard/touch (tabindex
   on .tooltip makes tap-to-focus work on mobile, where hover doesn't). */

.tooltip {
  position: relative;
  display: inline-flex;
  margin-left: var(--space-1);
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: var(--font-sm);
  font-style: normal;
  cursor: help;
}

.tooltip-text {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: var(--space-1);
  width: max-content;
  max-width: 220px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.tooltip:hover .tooltip-text,
.tooltip:focus-within .tooltip-text {
  opacity: 1;
  visibility: visible;
}

/* ============ Hero / place picker ============ */

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.hero h1 { margin: 0; }

.tagline {
  margin: 0 0 var(--space-1);
  font-size: var(--font-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

@media (min-width: 640px) {
  .hero { flex-direction: row; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
}

/* Full-width row of its own inside the hero — as an ordinary flex child it
   competes with the heading for space and squeezes it into a column. */
.hero .place-help {
  flex-basis: 100%;
  margin: 0;
  max-width: 60ch;
}

.place-picker {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.place-picker input[type="text"] {
  width: 220px;
}

.place-suggestions {
  position: relative;
}

.place-suggestions .suggestion-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 5;
}

.place-suggestions .suggestion-list a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}

.place-suggestions .suggestion-list a:hover { background: var(--paper); }

/* ============ Filter bar ============ */

.filter-bar {
  display: flex;
  flex-direction: row;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.filter-bar select,
.filter-bar input[type="number"],
.filter-bar input[type="text"] {
  width: auto;
  padding: var(--space-2) var(--space-2);
  font-size: var(--font-sm);
}

.sort-links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--font-sm);
}

.sort-links a { color: var(--ink-soft); text-decoration: none; }
.sort-links a.active { color: var(--accent); font-weight: 600; }

/* ============ Listing grid ============ */

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

@media (min-width: 640px) {
  .listing-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-5); }
}

.listing-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.listing-card:hover { border-color: var(--accent); }

.listing-card-media {
  aspect-ratio: 1 / 1;
  background: var(--paper);
  display: block;
}

.listing-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-card-body {
  padding: var(--space-3) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.listing-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.listing-card-price {
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
}

.listing-card-meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-soft);
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.load-more {
  display: block;
  width: fit-content;
  margin: 0 auto;
}

/* ============ Photo strip (post-listing upload) ============ */

.photo-strip {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.photo-strip-item {
  cursor: grab;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.photo-strip-item img { display: block; }

/* ============ Photo gallery (listing detail pages) ============ */

.photo-gallery {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.photo-gallery img {
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

.photo-gallery-link {
  display: block;
  cursor: zoom-in;
}

/* ============ Lightbox ============ */
/* First position:fixed overlay component in this codebase — no existing
   modal/dialog precedent to reuse. Built by static/js/photo-lightbox.js. */

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  z-index: 100;
}

.lightbox-backdrop[hidden] {
  display: none;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  display: block;
}

.lightbox-close {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: var(--card);
  color: var(--ink);
  font-size: var(--font-lg);
  line-height: 1;
  cursor: pointer;
}

/* ============ My listings ============ */

.my-listing-row {
  border-bottom: 1px solid var(--line);
  padding: var(--space-4) 0;
}

.my-listing-actions {
  margin-top: var(--space-2);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ============ Contact-seller / reputation ============ */

.contact-seller-form {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.reputation-summary {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.reputation-summary p { margin: 0 0 var(--space-2); }
.reputation-summary p:last-child { margin-bottom: 0; }

/* ============ Landing page intro ============ */

.landing-intro {
  color: var(--ink-soft);
  max-width: 60ch;
  margin-bottom: var(--space-5);
}

/* ============ Messaging ============ */

.badge {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.05rem 0.45rem;
  margin-left: var(--space-1);
}

.conversation-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.conversation-row.unread strong { color: var(--accent); }

.message-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 50vh;
  overflow-y: auto;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
}

@media (min-width: 640px) {
  .message-thread { max-height: 60vh; }
}

.message-bubble {
  max-width: 85%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  align-self: flex-start;
}

@media (min-width: 640px) {
  .message-bubble { max-width: 75%; }
}

.message-bubble.mine {
  align-self: flex-end;
  background: var(--accent-soft);
}

.message-meta {
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 0 0 var(--space-1);
}

/* ============ Footer ============ */

.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  font-size: var(--font-sm);
  color: var(--ink-soft);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-2);
}

.footer-links a { color: var(--ink-soft); }
.footer-links a:hover { color: var(--accent); }

/* ============ Screen-reader-only text ============ */
/* First need for one in this codebase — the map's pins are graphical links
   whose only accessible name is this span. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============ Corridor map ============ */
/* No tile provider and no map library (docs/DECISIONS/0028): an inline SVG
   basemap with an HTML overlay on top. The overlay is HTML rather than more
   SVG specifically so the hover preview can be an ordinary CSS-only panel
   with a real <img> — the same pattern as the tooltip component (ADR-0018),
   opened on :hover and :focus-within so it works from the keyboard. */

.map-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.map-header h1 { margin: 0 0 var(--space-2); }
.map-header .helptext { margin: 0; max-width: 46ch; }

.listing-map {
  position: relative;
  width: 100%;
  /* --map-aspect comes from the projection's own height/width, so the box
     and the viewBox always agree and percentage-positioned pins land
     exactly where the SVG puts the corridor. */
  padding-top: var(--map-aspect, 60%);
  /* A tall region (the gazetteer reaches 100km north to Bancroft) would
     otherwise render a map taller than the screen. Capping the *width*
     keeps the aspect ratio the pin percentages depend on intact — capping
     the height would not. */
  max-width: calc(78vh * var(--map-ratio, 1.6));
  margin: var(--space-4) auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.map-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Stretched, not letterboxed — the container's aspect is derived from the
   viewBox, so "none" costs nothing and keeps the HTML overlay in lockstep
   with the SVG even when the percentage rounds. */
.map-corridor-casing {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-corridor {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
}

.map-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- Legend ----
   Always visible, above the map, never a hover-only affordance: it is the
   key to the one encoding on this page that has no text on it. Each entry
   filters the map, so it doubles as the category control. */

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--font-sm);
  font-weight: 600;
}

.map-legend-item:hover { border-color: var(--ink-soft); }
.map-legend-item.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.map-legend-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pin-color);
  flex: none;
}

.map-legend-swatch svg {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  fill: #fff;
}

.map-legend-count { color: var(--ink-soft); font-weight: 400; }

.map-legend-clear {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  color: var(--accent);
}

.map-towns,
.map-pins {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-towns li,
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
}

.map-town-dot {
  display: block;
  width: 6px;
  height: 6px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.55;
}

.map-town-name {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--ink-soft);
  white-space: nowrap;
  transform: translateX(-50%);
  margin-left: 50%;
  width: max-content;
}

.map-pin { z-index: 1; }

.map-pin > a {
  display: block;
  width: 22px;
  height: 22px;
}

/* --pin-color is set per pin from the category palette. The white ring and
   shadow are what keep the two lowest-contrast hues (housing, services)
   legible against the map surface — see docs/DECISIONS/0030. */
.map-pin-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pin-color, var(--accent));
  border: 2px solid var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Counter-rotates the teardrop's -45deg so the glyph sits upright. */
.map-pin-glyph {
  width: 11px;
  height: 11px;
  transform: rotate(45deg);
  fill: #fff;
}

.map-pin > a:focus-visible .map-pin-mark {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.map-pin-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-2);
  width: 15rem;
  padding: var(--space-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* Pins near an edge open inward — the side is chosen server-side from the
   pin's own coordinates, since CSS can't measure the viewport for us. */
.map-pin-left .map-pin-panel { left: auto; right: 0; transform: none; }
.map-pin-right .map-pin-panel { left: 0; transform: none; }
.map-pin-below .map-pin-panel { bottom: auto; top: calc(100% + 8px); }

.map-pin:hover,
.map-pin:focus-within { z-index: 2; }

.map-pin:hover .map-pin-panel,
.map-pin:focus-within .map-pin-panel {
  opacity: 1;
  visibility: visible;
}

.map-pin-panel img {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex: none;
}

.map-pin-panel-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.map-pin-title {
  font-weight: 600;
  font-size: var(--font-sm);
  line-height: 1.25;
  /* Long titles must not stretch the panel past its fixed width. */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.map-pin-price { color: var(--accent); font-weight: 600; font-size: var(--font-sm); }
.map-pin-place { color: var(--ink-soft); font-size: 0.75rem; }

@media (hover: none) {
  /* Touch has no hover: tapping a pin follows the link, which is the
     useful outcome anyway. Showing the panel on :focus-within would leave
     it stuck open after the tap. */
  .map-pin-panel { display: none; }
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: baseline;
  justify-content: space-between;
}

.results-header h1 { margin: 0; }

/* ============ Trust badges ============ */
/* Earned from ratings; the warn tone is written by moderation only (see
   docs/DECISIONS/0029). Both carry their evidence in `title`, so a claim
   is never shown with no way to see what it rests on. */

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-4);
}

/* On a card the badge row is the last thing in a tight stack — the outer
   card padding already provides the gap below it. */
.listing-card .trust-badges,
.map-pin-panel .trust-badges { margin-bottom: 0; }

.trust-badge {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.trust-badge small {
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.85;
}

.trust-badge-good {
  background: var(--teal-soft);
  color: var(--teal);
}

.trust-badge-warn {
  background: var(--danger-soft);
  color: var(--danger);
}

.caution-notice {
  padding: var(--space-3);
  margin: var(--space-4) 0;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--ink);
}

.caution-notice a { color: var(--danger); }

.seller-block {
  margin: var(--space-4) 0;
}

.seller-block p { margin: 0; }

/* ============ Issue reports ============ */

.issue-status {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: var(--font-sm);
  margin: 0 0 var(--space-3);
}

.issue-status-resolved { background: var(--success-soft); color: var(--success); }
.issue-status-wont_fix,
.issue-status-duplicate { background: var(--line); color: var(--ink-soft); }
.issue-status-new { background: var(--warn-soft); color: var(--ink); }

.issue-updates {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--line);
}

.issue-updates li {
  padding: 0 0 var(--space-4) var(--space-4);
  position: relative;
}

.issue-updates li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.issue-updates p { margin: 0 0 var(--space-2); }
.issue-update-meta { font-size: var(--font-sm); color: var(--ink-soft); }

.staff-issue {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.staff-issue h2 { margin-top: 0; }

/* Vector basemap canvas, under the pin layer (docs/DECISIONS/0032).
   Scoped to .listing-map for specificity, not tidiness: maplibre-gl.css is
   injected into <head> after this file and its own `.maplibregl-map {
   position: relative }` wins any equal-specificity tie. Losing that tie
   collapsed the layer to zero height, which MapLibre then replaced with its
   300px fallback — and a wrong container height means a wrong fitBounds
   zoom, which means every pin sits somewhere the basemap doesn't agree
   with. */
.listing-map .map-basemap {
  position: absolute;
  inset: 0;
}

/* The drawn fallback's card background would show through the tiles. */
.listing-map.has-basemap { background: transparent; }

.map-attribution {
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin: calc(var(--space-2) * -1) 0 var(--space-3);
  text-align: right;
}

.map-attribution a { color: var(--ink-soft); }

.map-basemap-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
}

.map-basemap-controls .link-button {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.map-basemap-controls .helptext { margin: 0; }

/* Once real tiles are up, the drawn fallback underneath would show through. */
.listing-map.has-basemap .map-base { display: none; }

/* Featured strip (docs/DECISIONS/0036) */
.featured-heading {
  font-size: 1.05rem;
  margin: 1.6rem 0 0.7rem;
}
.featured-strip .featured-heading {
  margin-top: 0.4rem;
}
.listing-card-media {
  position: relative;
}
.featured-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.listing-card.is-featured {
  outline: 2px solid var(--accent-soft);
  outline-offset: -2px;
}

/* "Load more" is a grid child; on a partial last row it would stretch to
   the full card height. Span the row and keep its natural size instead. */
.listing-grid .load-more {
  grid-column: 1 / -1;
  justify-self: center;
  align-self: start;
}

/* Breadcrumbs + related listings (docs/DECISIONS/0040) */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted, #6b6257);
  margin-bottom: 0.6rem;
}
.breadcrumbs a {
  color: inherit;
}
.related-listings {
  margin-top: 2rem;
}

/* ============ Advertisement: signs613.com (docs/DECISIONS/0045) ============
   A paid-style ad unit for a different business, so it deliberately shares
   nothing with Kivajo's palette: the advertiser's own near-black + violet
   + orange, its own wordmark, and a visible "Ad" chip. Everything is drawn in
   CSS — no image request — because this renders on every page and the
   Lighthouse gate is score >= 0.92 / LCP <= 2600ms / CLS <= 0.05. The fixed
   min-heights are what hold CLS at 0. */
.s613ad {
  --s613-bg: #0a0710;
  --s613-bg2: #150d24;
  --s613-purple: #9b3bff;
  --s613-orange: #ff8a1e;
  --s613-text: #ece8f4;
  --s613-muted: #a79fbb;

  /* Same grid as `.container.wide` so the card's edges line up exactly with
     the listing grid underneath it. On the narrow (480px) form pages it is
     deliberately wider than the content — an ad band, not a text column. */
  margin: 0 auto var(--space-5);
  max-width: 1040px;
  padding: 0 var(--space-4);
  box-sizing: border-box;
}
.s613ad__link {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 188px;            /* reserved: mobile stacked layout */
  padding: var(--space-5) var(--space-5) var(--space-6);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--s613-bg) 0%, var(--s613-bg2) 100%);
  color: var(--s613-text);
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(10, 7, 16, 0.28);
}
.s613ad__link:hover,
.s613ad__link:focus-visible {
  box-shadow: 0 16px 40px rgba(10, 7, 16, 0.4);
}
.s613ad__link:focus-visible {
  outline: 3px solid var(--s613-orange);
  outline-offset: 2px;
}

/* Two soft colour blobs for depth, and a slow diagonal light sweep. Both are
   decorative and sit behind the text on their own stacking context. */
.s613ad__glow,
.s613ad__sweep {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.s613ad__glow {
  background:
    radial-gradient(38% 120% at 12% 0%, color-mix(in srgb, var(--s613-purple) 55%, transparent) 0%, transparent 70%),
    radial-gradient(34% 110% at 92% 100%, color-mix(in srgb, var(--s613-orange) 42%, transparent) 0%, transparent 72%);
  animation: s613-breathe 7s ease-in-out infinite;
}
.s613ad__sweep {
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.11) 50%, transparent 62%);
  transform: translateX(-120%);
  animation: s613-sweep 6.5s ease-in-out infinite;
}
@keyframes s613-breathe {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}
@keyframes s613-sweep {
  0%, 62%  { transform: translateX(-120%); }
  100%     { transform: translateX(120%); }
}

.s613ad__brandcol {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.s613ad__wordmark {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  color: #fff;
}
.s613ad__wordmark-num { color: var(--s613-purple); }
.s613ad__brandsub {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--s613-muted);
}

.s613ad__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}
.s613ad__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--s613-orange);
}
.s613ad__headline {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #fff;
}
.s613ad__subline {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--s613-muted);
  max-width: 54ch;
}

.s613ad__cta {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 0.62rem 1.15rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(120deg, var(--s613-purple), var(--s613-orange));
  color: #fff;
  box-shadow: 0 6px 18px rgba(155, 59, 255, 0.35);
}
.s613ad__link:hover .s613ad__cta { filter: brightness(1.08); }

/* Disclosure. Small, but never hidden — this is an ad and has to say so. */
.s613ad__chip {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--s613-muted);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ---- Themes. Same structure, different weighting of the two brand hues. */
/* ember — warm: orange leads, the base tints towards it. */
.s613ad--ember {
  --s613-bg: #140a06;
  --s613-bg2: #2a1408;
  --s613-purple: #ff8a1e;
  --s613-orange: #ffb347;
}
.s613ad--ember .s613ad__wordmark-num { color: var(--s613-orange); }
.s613ad--ember .s613ad__eyebrow      { color: #ffcf8a; }

/* duo — the full violet-to-orange sweep, the loudest of the four. */
.s613ad--duo { --s613-bg2: #24103d; }

/* ink — cool and near-monochrome, the quiet one in the rotation. */
.s613ad--ink {
  --s613-bg: #070610;
  --s613-bg2: #0d0a18;
  --s613-orange: #c9a7ff;
}
.s613ad--ink .s613ad__eyebrow { color: #c9a7ff; }
.s613ad--ink .s613ad__cta {
  background: linear-gradient(120deg, #7c3aed, #c9a7ff);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.4);
}

@media (min-width: 640px) {
  .s613ad { padding: 0 var(--space-5); }
  .s613ad__link {
    flex-direction: row;
    align-items: center;
    gap: var(--space-5);
    min-height: 124px;          /* reserved: wide single-row layout */
    padding: var(--space-4) var(--space-5);
  }
  .s613ad__brandcol {
    padding-right: var(--space-5);
    border-right: 1px solid rgba(255, 255, 255, 0.14);
  }
  .s613ad__headline { font-size: 1.6rem; }
  .s613ad__cta      { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .s613ad__glow,
  .s613ad__sweep { animation: none; }
  .s613ad__sweep { opacity: 0; }
}
