/* MV Apartments — basic clean style */
* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, sans-serif;
  margin: 0;
  background: #fafaf9;
  color: #1c1917;
  line-height: 1.5;
}

a { color: #0369a1; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
  background: #1c1917;
  color: #fafaf9;
  padding: 1.25rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
header .container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
header h1 a { color: inherit; }
header h1 small {
  font-weight: 400;
  opacity: 0.75;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}
header nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}
header nav a {
  color: #fafaf9;
  opacity: 0.85;
}
header nav a:hover { opacity: 1; text-decoration: none; }

/* Main */
main {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

/* Hero stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1c1917;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.8125rem;
  color: #78716c;
  margin-top: 0.125rem;
}

/* Search bar */
.search-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.search-row input {
  flex: 1;
  min-width: 250px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  background: white;
}
.sort-select {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}
.sort-select:focus { outline: 2px solid #0369a1; border-color: transparent; }
.search-row input:focus {
  outline: 2px solid #0369a1;
  border-color: transparent;
}
.results-count {
  font-size: 0.875rem;
  color: #57534e;
  align-self: center;
}

/* Filter chips */
.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.chip {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  background: white;
  border: 1px solid #d6d3d1;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.chip:hover { background: #f5f5f4; }
.chip.active {
  background: #1c1917;
  color: white;
  border-color: #1c1917;
}
.chip.tier-1.active { background: #15803d; border-color: #15803d; }
.chip.tier-2.active { background: #c2410c; border-color: #c2410c; }
.chip.avoid.active { background: #b91c1c; border-color: #b91c1c; }

/* Apartment grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}
.card {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card:hover {
  border-color: #1c1917;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}
.card-img-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f5f5f4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.card-body {
  padding: 1.125rem 1.25rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-rank {
  font-size: 0.75rem;
  font-weight: 600;
  color: #57534e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: #1c1917;
}
.card-address {
  font-size: 0.8125rem;
  color: #78716c;
  margin-bottom: 0.75rem;
}
.card-verdict {
  font-size: 0.875rem;
  color: #1c1917;
  margin-bottom: 0.75rem;
  font-style: italic;
}
.card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: #44403c;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.card-meta strong { color: #1c1917; }
.card-tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: auto;
}
.tag {
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  background: #f5f5f4;
  border-radius: 4px;
  color: #57534e;
}
.tag.tier-1 { background: #d1fae5; color: #065f46; }
.tag.tier-2 { background: #fed7aa; color: #9a3412; }
.tag.tier-avoid { background: #fecaca; color: #991b1b; }
.tag.special { background: #fef3c7; color: #92400e; font-weight: 600; }
.tag.danger { background: #fecaca; color: #991b1b; }

/* Rating badges */
.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}
.rating-badge .star {
  color: #eab308;
}

/* Risk indicator */
.risk {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.risk-LOW, .risk-LOW-MEDIUM { background: #d1fae5; color: #065f46; }
.risk-MEDIUM { background: #fef3c7; color: #92400e; }
.risk-MEDIUM-HIGH { background: #fed7aa; color: #9a3412; }
.risk-HIGH { background: #fecaca; color: #991b1b; }
.risk-HIGHEST { background: #1c1917; color: white; }
.risk-UNKNOWN { background: #e7e5e4; color: #44403c; }

/* Article cards (lower section) */
.articles-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
}
.articles-section h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem 0;
  color: #1c1917;
}
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.article-card {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.article-card:hover {
  border-color: #1c1917;
  transform: translateY(-1px);
}
.article-card .article-category {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #78716c;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.article-card .article-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.25rem 0;
  color: #1c1917;
}
.article-card .article-summary {
  font-size: 0.8125rem;
  color: #57534e;
  line-height: 1.4;
}

/* Detail view */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  z-index: 200;
  display: none;
  overflow-y: auto;
  padding: 2rem 1rem;
}
.detail-overlay.open { display: block; }
.detail-modal {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  padding: 2rem;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: #78716c;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}
.detail-close:hover { background: #f5f5f4; color: #1c1917; }
.detail-content { padding-right: 2rem; }

/* Detail hero (image + quick links) */
.detail-hero {
  margin: -0.5rem -0.5rem 1.5rem -0.5rem;
}
.detail-hero-img {
  width: 100%;
  height: 320px;
  overflow: hidden;
  border-radius: 8px;
  background: #f5f5f4;
}
.detail-hero-img img,
.detail-hero-img .card-img-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.detail-hero-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e7e5e4;
}
.detail-hero-links a {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1c1917;
}
.detail-hero-links a:hover {
  background: #1c1917;
  color: white;
  text-decoration: none;
  border-color: #1c1917;
}

/* Available units section */
.units-section {
  margin-top: 1.5rem;
  padding: 1rem 1.125rem;
  background: #f5f5f4;
  border-radius: 8px;
}
.units-section h2 {
  font-size: 1.0625rem;
  margin: 0 0 0.5rem 0;
  border-bottom: none;
  padding-bottom: 0;
}
.units-source {
  font-size: 0.75rem;
  color: #78716c;
  margin-bottom: 0.75rem;
  font-style: italic;
}
.units-table {
  background: white;
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.875rem;
}
.units-table th {
  background: #1c1917;
  color: white;
  padding: 0.5rem 0.625rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
}
.units-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.units-table th.sortable:hover {
  background: #44403c;
}
.units-table td a {
  color: #0369a1;
  text-decoration: none;
}
.units-table td a:hover {
  text-decoration: underline;
}
.units-link {
  margin: 0.75rem 0 0 0;
  font-size: 0.875rem;
}
.units-link a {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  background: #1c1917;
  color: white;
  border-radius: 6px;
  font-weight: 500;
}
.units-link a:hover {
  background: #0369a1;
  text-decoration: none;
}
.units-table td {
  border: 1px solid #e7e5e4;
  padding: 0.625rem;
  vertical-align: top;
}
.units-table tr:hover td {
  background: #fafaf9;
}
.unit-num {
  font-size: 0.75rem;
  color: #78716c;
}
.units-note-text {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: #44403c;
}

/* Markdown content styling */
.detail-content h1 { font-size: 1.5rem; margin: 0 0 0.75rem 0; }
.detail-content h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.5rem 0;
  border-bottom: 1px solid #e7e5e4;
  padding-bottom: 0.25rem;
}
.detail-content h3 { font-size: 1.0625rem; margin: 1.25rem 0 0.5rem 0; }
.detail-content p, .detail-content ul, .detail-content ol {
  margin: 0.5rem 0;
}
.detail-content ul, .detail-content ol { padding-left: 1.5rem; }
.detail-content li { margin: 0.25rem 0; }
.detail-content code {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  background: #f5f5f4;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}
.detail-content pre {
  background: #f5f5f4;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}
.detail-content pre code {
  background: transparent;
  padding: 0;
}
.detail-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.detail-content th, .detail-content td {
  border: 1px solid #e7e5e4;
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.detail-content th {
  background: #f5f5f4;
  font-weight: 600;
}
.detail-content blockquote {
  border-left: 4px solid #d6d3d1;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: #57534e;
  background: #fafaf9;
}
.detail-content hr {
  border: none;
  border-top: 1px solid #e7e5e4;
  margin: 1.5rem 0;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: #78716c;
}

/* Footer */
footer {
  max-width: 1200px;
  margin: 4rem auto 2rem;
  padding: 1.5rem;
  border-top: 1px solid #e7e5e4;
  color: #78716c;
  font-size: 0.8125rem;
  text-align: center;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  header .container { gap: 1rem; }
  header nav { font-size: 0.8125rem; gap: 0.75rem; }
  .grid { grid-template-columns: 1fr; }
  .detail-modal { padding: 1.5rem 1rem; }
  .detail-content { padding-right: 1rem; }
}

/* =========================================================
   All-Apartments page (all-apartments.html)
   ========================================================= */

header nav a.active {
  background: #fde68a;
  color: #422006;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.page-intro {
  max-width: 1400px;
  margin: 2rem auto 1rem;
  padding: 0 1.5rem;
}
.page-intro h2 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.page-intro p { color: #57534e; max-width: 900px; }

.aa-table-wrap {
  max-width: 100%;
  margin: 1rem auto 2rem;
  padding: 0;
  overflow-x: auto;
  overflow-y: visible;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
}

/* Full-width layout override for the All Units page only */
body.page-units main {
  max-width: 100%;
  padding: 0;
  margin: 0;
}
body.page-units .search-row,
body.page-units .filters {
  max-width: 100%;
  padding: 0 1rem;
  margin-left: auto;
  margin-right: auto;
}
body.page-units .aa-table-wrap {
  width: 100%;
  max-width: 100%;
  border-left: none;
  border-right: none;
  border-radius: 0;
  margin: 0.5rem 0 2rem;
}
body.page-units .page-intro {
  max-width: 100%;
  padding: 1rem 1rem 0;
}
body.page-units .page-intro p { max-width: none; }
body.page-units .footnote-mini {
  max-width: 100%;
  padding: 0 1rem;
}

.aa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  table-layout: auto;
}
.aa-table thead {
  background: #1c1917;
  color: #fafaf9;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.aa-table thead th {
  text-align: left;
  padding: 0.625rem 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #44403c;
  background: #1c1917;
}
.aa-table th.sortable { cursor: pointer; user-select: none; }
.aa-table th.sortable:hover { background: #292524; }
.aa-table th.col-name { min-width: 180px; }

.aa-table tbody tr.aa-row {
  border-bottom: 1px solid #f5f5f4;
  cursor: pointer;
  transition: background 0.1s;
}
.aa-table tbody tr.aa-row:hover { background: #fefce8; }
.aa-table tbody tr.aa-row td {
  padding: 0.625rem 0.5rem;
  vertical-align: middle;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aa-table tbody tr.aa-row td.col-name {
  white-space: normal;
  max-width: 220px;
}
.aa-table tbody tr.aa-row td.au-plan {
  max-width: 140px;
  white-space: normal;
}
.aa-table tbody tr.aa-row td.aa-special-cell,
.aa-table tbody tr.aa-row td:has(.aa-special) {
  max-width: 220px;
  white-space: normal;
}
.aa-table tbody tr.aa-row.aa-row-tier-1 { background: #f0fdf4; }
.aa-table tbody tr.aa-row.aa-row-tier-1:hover { background: #dcfce7; }
.aa-table tbody tr.aa-row.aa-row-tier-2 { background: #fffbeb; }
.aa-table tbody tr.aa-row.aa-row-tier-2:hover { background: #fef3c7; }
.aa-table tbody tr.aa-row.aa-row-tier-avoid {
  background: #fef2f2;
  color: #7f1d1d;
}
.aa-table tbody tr.aa-row.aa-row-tier-avoid:hover { background: #fee2e2; }

.aa-table .col-name a.aa-name-link {
  font-weight: 600;
  color: #1c1917;
  text-decoration: none;
}
.aa-table .col-name a.aa-name-link:hover { color: #0369a1; text-decoration: underline; }
.aa-table .aa-neigh {
  font-size: 0.6875rem;
  color: #78716c;
  margin-top: 2px;
}

.aa-total { font-weight: 600; color: #1c1917; }
.aa-special {
  display: inline-block;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #78350f;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 200px;
  white-space: normal;
}
.aa-links { white-space: nowrap; font-size: 1.125rem; }
.aa-links a { margin: 0 0.125rem; text-decoration: none; }
.aa-links a:hover { transform: scale(1.2); }

/* Detail row (expand on click) */
.aa-detail-row td {
  padding: 0 !important;
  background: #fffbeb !important;
  border-bottom: 2px solid #fbbf24 !important;
}
.aa-detail-grid {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem 2rem;
  font-size: 0.875rem;
}
.aa-detail-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #57534e;
  border-bottom: 1px solid #e7e5e4;
  padding-bottom: 0.25rem;
}
.aa-detail-section p { margin: 0 0 0.5rem; line-height: 1.45; }
.aa-detail-section.aa-units-wide { grid-column: 1 / -1; }
.aa-detail-section.aa-cta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid #e7e5e4;
  padding-top: 1rem;
}
.aa-cta-link {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  background: #1c1917;
  color: #fafaf9 !important;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
}
.aa-cta-link:hover { background: #44403c; text-decoration: none; }

.aa-amenities-list {
  margin: 0;
  padding-left: 1.125rem;
  columns: 2;
  column-gap: 1rem;
}
.aa-amenities-list li { margin-bottom: 0.25rem; break-inside: avoid; }
.aa-meta-line { font-size: 0.8125rem; color: #57534e; line-height: 1.6; }
.aa-walk-note { font-size: 0.75rem; color: #78716c; font-style: italic; }
.aa-pros { color: #15803d; }
.aa-cons { color: #92400e; }
.aa-flags { color: #b91c1c; }

.aa-units-table { width: 100%; max-width: 700px; font-size: 0.8125rem; }
.aa-units-src {
  font-size: 0.6875rem;
  color: #78716c;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.footnote-mini {
  max-width: 1400px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  color: #78716c;
  line-height: 1.5;
}

.chip-sep {
  color: #d6d3d1;
  padding: 0 0.25rem;
  align-self: center;
}

@media (max-width: 1100px) {
  .aa-table { font-size: 0.75rem; }
  .aa-table thead th { padding: 0.5rem 0.375rem; font-size: 0.6875rem; }
  .aa-table tbody tr.aa-row td { padding: 0.5rem 0.375rem; }
  .aa-amenities-list { columns: 1; }
}

