/* Map + list catalog */

:root {
  --ember: #e94e1b;
  --ember-soft: rgba(233, 78, 27, 0.1);

  --bg: #f4f1ec;
  --white: #fff;
  --ink: #1a1917;
  --muted: #5c5852;
  --accent: #8a6d4b;
  --border: #d4cfc6;
  --map-h: calc(100vh - 9.5rem);
  --list-w: min(420px, 38vw);
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;

  --cat-villas: #5a7d8c;
  --cat-business: #3d5f6e;
  --cat-cultural: #8a6d4b;
  --cat-housing: #4a6356;
  --cat-interiors: #9a8474;
  --cat-urban: #6b7c8a;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--white);
}
.skip-link:focus { top: 0.5rem; }

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  z-index: 500;
  position: relative;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.back {
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
}

.filter-group select,
.filter-search input {
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}

.filter-group--category select {
  min-width: 11rem;
  font-weight: 600;
}

.filter-search {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
}

.filter-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 0;
  outline: none;
}

.filter-years {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-years .dash {
  color: var(--muted);
}

.btn-reset {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.btn-reset:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.filter-summary {
  margin: 0;
  padding: 0.4rem 1.25rem 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Split layout */
.catalog-split {
  display: flex;
  height: var(--map-h);
}

.map-panel {
  flex: 1;
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--ice, #e8eef2);
}

.map-legend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 400;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.legend-item[data-cat="villas"]::before { background: var(--cat-villas); }
.legend-item[data-cat="business"]::before { background: var(--cat-business); }
.legend-item[data-cat="cultural"]::before { background: var(--cat-cultural); }
.legend-item[data-cat="housing"]::before { background: var(--cat-housing); }
.legend-item[data-cat="interiors"]::before { background: var(--cat-interiors); }
.legend-item[data-cat="urban"]::before { background: var(--cat-urban); }

/* List panel */
.list-panel {
  width: var(--list-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-left: 1px solid var(--border);
}

.project-list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  scroll-behavior: smooth;
}

.list-item {
  border-bottom: 1px solid var(--border);
}

.list-item button {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  color: inherit;
  background: var(--white);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.list-item button:hover {
  background: var(--bg);
}

.list-item.is-selected button {
  background: var(--bg);
  box-shadow: inset 3px 0 0 var(--accent);
}

.list-item.is-highlight button {
  animation: pulse-bg 0.6s ease;
}

@keyframes pulse-bg {
  0%, 100% { background: var(--white); }
  50% { background: #ebe6de; }
}

.list-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--border);
}

.list-body h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
}

.list-cat {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.list-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.list-coords {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 0.25rem;
  opacity: 0.8;
}

.empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.list-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.list-pagination button,
.list-pagination span {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  font-family: inherit;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--white);
  cursor: pointer;
}

.list-pagination span {
  border: none;
  background: none;
  cursor: default;
}

.list-pagination button.is-active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.list-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
}

.map-popup h4 {
  font-family: var(--font-serif);
  font-size: 1rem;
  margin: 0 0 0.25rem;
}

.map-popup p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.map-popup a {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.marker-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.marker-dot.is-selected {
  width: 16px;
  height: 16px;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(138, 109, 75, 0.45);
}

/* Mobile: stack map above list */
@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .catalog-split {
    flex-direction: column;
    height: auto;
  }

  .map-panel {
    height: 45vh;
    min-height: 280px;
  }

  .list-panel {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .project-list {
    max-height: 55vh;
  }

  .filter-bar {
    gap: 0.4rem;
  }

  .filter-group--category {
    width: 100%;
  }

  .filter-group--category select {
    width: 100%;
  }
}
