/* ── Reset & Variables ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #f5f0e8;
  --ink: #1a1a1a;
  --rust: #66103c;
  --sage: #66103c;
  --mist: #eeeded;
  --border: #d4cfc6;
  --sidebar-width: 400px;
  --header-height: 80px;
  --base-gray: #f7f7f7;
}

html,
body {
  height: 100%;
  font-family: "DM Sans", sans-serif;
  background: var(--base-gray);
  color: var(--ink);
  overflow: hidden;
}

body {
  margin: 0;
  padding: 0;
}

/* ── Header ────────────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.header-title {
  font-family: "DM Serif Display", serif;
  font-size: 1.2rem;
  color: var(--base-gray);
  letter-spacing: 0.01em;
}

.header-title span {
  color: var(--ink);
}

.header-cta {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink);
  background: #d5d3d3;
  border: none;
  padding: 5px 12px;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s;
  text-align: center;
}

.header-cta:hover {
  background: var(--rust);
  color: white;
}

.header-cta:hover {
  background: var(--ink);
  color: white;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Layout ────────────────────────────────────────────────────── */
.app {
  display: flex;
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  bottom: 0;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--base-gray);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.filter-clear {
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  font-size: 0.72rem;
  color: #888;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-clear:hover {
  color: var(--ink, #2b2520);
}

.filter-clear.active {
  color: #aaa;
}

.result-count {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin-bottom: 10px;
}

/* Filter chips */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
  color: var(--ink);
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--ink);
  color: var(--base-gray);
  border-color: var(--ink);
}
.filter-type-list {
  display: none;
}
.filter-type-list.expanded {
  display: block;
}

/* Listings */
.listings {
  flex: 2;
  overflow-y: auto;
  padding: 8px;
}

.listings::-webkit-scrollbar {
  width: 4px;
}
.listings::-webkit-scrollbar-track {
  background: transparent;
}
.listings::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

.listing-item {
  padding: 25px 30px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  border-color: var(--ink);
}

.listing-item:hover {
  background: var(--mist);
}
.listing-item.active {
  background: var(--mist);
  border-color: #999;
}

.listing-name {
  font-family: "DM Serif Display", serif;
  font-size: 1.2rem;
  margin-bottom: 4px;
  line-height: 1.3;
}

.listing-type {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 14px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.listing-discipline {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 4px;
}

.listing-website {
  font-size: 0.7rem;
  color: var(--sage);
  text-decoration: none;
  display: inline-block;
  margin-top: 4px;
}

.listing-website:hover {
  text-decoration: underline;
}

.instagram {
  font-size: 0.7rem;
  color: var(--sage);
  text-decoration: none;
  display: inline-block;
  margin-top: 4px;
}

.instagram:hover {
  text-decoration: underline;
}

.description {
  font-size: 0.7rem;
  color: var(--sage);
  text-decoration: none;
  display: inline-block;
  margin-top: 10px;
}

.services {
  font-size: 0.7rem;
  color: var(--sage);
  text-decoration: none;
  display: inline-block;
  margin-top: 4px;
}

.no-results {
  padding: 40px 20px;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
}

/* Filter group headers — larger, bolder */
.filter-group-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: none;
  border: none;
  padding: 3px 2px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.filter-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink, #2b2520);
  position: relative;
}

.group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-label {
  flex: 1;
}

/* Animated underline that appears when active */
.filter-group-header::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 18px; /* aligns past the dot */
  right: 0px;
  height: 3px;
  background: var(--group-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1s ease;
}

.filter-group-header.active::after {
  transform: scaleX(1);
}

/* Filter type items — smaller, indented */
.filter-type-item {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 400;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px 10px;
  margin: 3px 4px 3px 0;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.03em;
}

.filter-type-list {
  display: none;
  background: transparent;
  padding: 4px 0;
}

.filter-type-list.expanded {
  display: block;
}

.filter-type-item:hover {
  color: var(--ink);
}

.filter-type-item.active {
  color: var(--rust);
  font-weight: 600;
}

/* Listing spacing */
.listing-item {
  padding: 16px 20px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

/* Expanded detail section — hidden by default */
.listing-detail {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.listing-detail.open {
  display: block;
}

/* Tag chips for subdisciplines and services */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag-chip {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--ink);
  background: white;
  letter-spacing: 0.03em;
}

.tag-chip.discipline {
  border-color: var(--sage);
  color: var(--sage);
}

.tag-chip.service {
  border-color: var(--rust);
  color: var(--rust);
}

.detail-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-top: 8px;
  margin-bottom: 4px;
}

.detail-link {
  font-size: 0.72rem;
  color: var(--sage);
  text-decoration: none;
  display: block;
  margin-top: 4px;
}

.detail-link:hover {
  text-decoration: underline;
}
/* ── Map ───────────────────────────────────────────────────────── */
#map {
  flex: 1;
  height: 100%;
}

.map-legend {
  position: absolute;
  bottom: 30px;
  right: 12px;
  background: var(--base-gray);
  border: 1px solid var(--border, #d4c9b6);
  border-radius: 10px;
  padding: 10px 25px;
  font-size: 0.75 rem;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-header {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.legend-header:hover {
  color: var(--ink, #2b2520);
}

.legend-arrow {
  transition: transform 0.2s;
  font-size: 0.8rem;
}

.legend-header.collapsed .legend-arrow {
  transform: rotate(-90deg);
}
.legend-header.collapsed {
  margin-bottom: 0;
}
.legend-body.collapsed {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Popup ─────────────────────────────────────────────────────── */
.mapboxgl-popup-content {
  background: #85858c !important;
  color: #f0f0f2 !important;
  border-radius: 4px !important;
  padding: 8px 12px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  font-family: "DM Sans", sans-serif !important;
}

.mapboxgl-popup-tip {
  border-top-color: #85858c !important;
}

.popup-name {
  font-family: "DM Sans", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #f0f0f2;
  display: flex;
  align-items: center;
}

.popup-type {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rust);
  font-weight: 500;
  margin-bottom: 10px;
}

.popup-field {
  font-size: 0.75rem;
  margin-bottom: 4px;
  color: #ccc;
  line-height: 1.4;
}

.popup-field strong {
  color: var(--base-gray);
}

.popup-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--rust);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
}

.popup-link:hover {
  text-decoration: underline;
}

.popup-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}

/* ── Neighborhood tooltip ──────────────────────────────────────── */
.neighborhood-tooltip {
  position: absolute;
  background: white;
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 0.75rem;
  pointer-events: none;
  border-radius: 2px;
  display: none;
  z-index: 50;
  font-family: "DM Sans", sans-serif;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 26, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: var(--base-gray);
  max-width: 540px;
  padding: 40px 36px 32px;
  border-radius: 6px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--ink);
  line-height: 1;
}

.modal-title {
  font-family: "DM Serif Display", serif;
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.modal-subtitle {
  font-family: "DM Serif Display", serif;
  font-size: 1.1rem;
  margin-top: 20px;
  margin-bottom: 8px;
}

.modal-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 14px;
}

.modal-body a {
  color: var(--rust);
  text-decoration: underline;
}

.modal-button {
  background: var(--ink);
  color: var(--base-gray);
  border: none;
  padding: 10px 24px;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  margin-top: 16px;
}

.modal-button:hover {
  background: var(--rust);
}

.detail-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  font-size: 0.78rem;
}

.detail-key {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 2px;
}

.detail-value {
  color: var(--ink);
  line-height: 1.4;
}

.detail-value .empty {
  color: #b5a99e;
  font-style: italic;
  font-weight: 300;
}

/* ── Search Bar ──────────────────────────────────────── */

.search-wrap {
  position: relative;
  margin-bottom: 12px;
}

#search-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  border: 1px solid var(--border, #d4c9b6);
  border-radius: 4px;
  font-family: inherit;
  background: white;
}

#search-input:focus {
  outline: none;
  border-color: var(--ink, #2b2520);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border, #d4c9b6);
  border-radius: 4px;
  margin-top: 4px;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
}

.search-result {
  padding: 8px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #d4c9b6);
}

.search-result:hover {
  background: #ccc;
}

.search-result:last-child {
  border-bottom: none;
}

.search-empty {
  padding: 10px 12px;
  font-size: 0.8rem;
  color: #999;
}

.home-button {
  position: absolute;
  top: 151px;
  right: 10px;
  z-index: 5;
  width: 29px;
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.home-button:hover {
  background: #f0f0f0;
}
