/* NYCHA PARTY — housing showcase pages (worldwide-showcase, nycha-top10)
   Page-scoped styles using existing brand tokens from site.css. */

/* ---------- Map section ---------- */
.housing-map-section { padding: 56px 0 64px; }
.housing-map-layout {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: stretch;
}
.housing-map {
  min-height: 460px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--gray-border); background: #EAF0F5;
  box-shadow: var(--shadow-md);
}
.housing-map--tall { min-height: 560px; }
.housing-map:empty::after {
  content: "Interactive map — enable JavaScript to view the map.";
  display: grid; place-items: center; height: 100%;
  color: var(--gray-text); font-size: 0.95rem; padding: 40px; text-align: center;
}

/* Leaflet skin on light basemap */
.housing-map .leaflet-container {
  font-family: inherit; background: #EAF0F5;
}
.housing-map .leaflet-tile-pane { opacity: 1; }
.housing-map .leaflet-control-attribution {
  background: rgba(255,255,255,0.85); color: #5A6472; font-size: 0.7rem;
}
.housing-map .leaflet-control-attribution a { color: #0A3D7A; }
.housing-map .leaflet-popup-content-wrapper {
  background: var(--white); color: var(--ink); border-radius: var(--radius-sm);
  border: 1px solid rgba(245,130,32,0.5); box-shadow: var(--shadow-md);
}
.housing-map .leaflet-popup-tip { background: var(--white); }
.housing-map .leaflet-popup-content { margin: 12px 16px; }
.housing-map .leaflet-popup-content strong { color: var(--ny-orange-hover); }
.housing-map .housing-house-tooltip {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(10, 61, 122, 0.45);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 45, 98, 0.18);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 7px;
}
.housing-map .housing-house-tooltip::before { border-top-color: rgba(10, 61, 122, 0.45); }
.housing-map .housing-boundary-label {
  background: rgba(245, 249, 252, 0.58);
  border: 1px solid rgba(23, 62, 103, 0.18);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 45, 98, 0.08);
  color: #173E67;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 5px;
  pointer-events: none;
  white-space: nowrap;
}
.housing-map .housing-boundary-label--community-district {
  color: #2E6798;
  font-size: 0.62rem;
  font-weight: 600;
}
.housing-map .housing-boundary-label--neighborhood {
  background: rgba(245, 249, 252, 0.48);
  border-color: rgba(73, 106, 130, 0.16);
  color: #35556D;
  font-size: 0.62rem;
  font-weight: 650;
  opacity: 0.94;
}

/* ---------- Case sidebar ---------- */
.housing-case-sidebar {
  background: var(--ny-blue); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius); padding: 28px; color: var(--white);
  box-shadow: var(--shadow-md); display: flex; flex-direction: column; justify-content: center;
}
.housing-case-sidebar .badge { align-self: flex-start; margin-bottom: 14px; }
.housing-sidebar-title { font-size: 1.5rem; font-weight: 900; margin-bottom: 10px; }
.housing-sidebar-text { color: #DCE6F2; font-size: 1rem; line-height: 1.6; }
.housing-sidebar-meta { margin-top: 12px; font-size: 0.9rem; color: var(--ny-orange); font-weight: 700; }

/* ---------- Case cards ---------- */
.housing-case-grid { grid-template-columns: repeat(3, 1fr); }
.housing-case-card { position: relative; padding-top: 26px; cursor: pointer; }
.housing-case-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  margin-bottom: 10px; box-shadow: 0 0 0 4px rgba(245,130,32,0.15);
}
.housing-case-card h3 { display: flex; align-items: baseline; gap: 8px; }
.housing-case-country { font-size: 0.85rem; font-weight: 600; color: var(--gray-text); text-transform: uppercase; letter-spacing: 0.5px; }
.housing-case-card.is-active { border-color: var(--ny-orange); box-shadow: var(--shadow-md); }
.housing-case-card.is-active h3 { color: var(--ny-orange-hover); }

/* ---------- Comparison / data tables ---------- */
.housing-table-section { padding-bottom: 72px; }
.housing-table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.housing-table {
  width: 100%; border-collapse: collapse; background: var(--white); min-width: 640px;
}
.housing-table thead th {
  background: var(--ny-blue); color: var(--white); text-align: left;
  padding: 14px 16px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.housing-table tbody td {
  padding: 13px 16px; border-top: 1px solid var(--gray-border);
  color: var(--ink); font-size: 0.95rem; vertical-align: top;
}
.housing-table tbody tr:nth-child(even) { background: var(--gray-light); }
.housing-table tbody tr.is-active { background: #FFF3E5; box-shadow: inset 4px 0 0 var(--ny-orange); }
.housing-table tbody tr.is-active td:first-child { color: var(--ny-orange-hover); font-weight: 700; }
.housing-table thead th.is-active { background: var(--ny-orange); color: var(--ny-blue-dark); }
.housing-table tbody td.is-active { background: rgba(245,130,32,0.12); }
.housing-table-note { margin-top: 14px; color: var(--gray-text); font-size: 0.9rem; }

/* Cluster house rosters under each cluster name */
.housing-cluster-dev {
  display: block; margin-top: 5px; font-size: 0.78rem; line-height: 1.45;
  color: #5b6770; white-space: normal; font-weight: 400;
}
.housing-cluster-dev-label {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  font-size: 0.64rem; color: #1a4e8a;
}
.housing-cluster-category {
  display: block;
  margin-top: 3px;
}
.housing-table tbody td[data-col="0"] { min-width: 260px; }

/* ---------- Vanguard hub ---------- */
.housing-vanguard {
  display: flex; gap: 24px; align-items: flex-start; background: var(--ny-blue-mid);
  border: 1px solid rgba(255,255,255,0.14); border-radius: var(--radius); padding: 30px;
  box-shadow: var(--shadow-md); color: var(--white);
}
.housing-vanguard-badge { flex: 0 0 auto; text-align: center; }
.housing-vanguard-pulse {
  display: block; width: 22px; height: 22px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--error); box-shadow: 0 0 0 0 rgba(179,38,30,0.6);
  animation: housing-pulse 2s infinite;
}
@keyframes housing-pulse {
  0% { box-shadow: 0 0 0 0 rgba(179,38,30,0.55); }
  70% { box-shadow: 0 0 0 16px rgba(179,38,30,0); }
  100% { box-shadow: 0 0 0 0 rgba(179,38,30,0); }
}
.housing-vanguard-badge span:last-child {
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.4px; color: var(--ny-orange);
}
.housing-vanguard-name { font-size: 1.6rem; font-weight: 900; margin-bottom: 6px; }
.housing-vanguard-meta { color: var(--ny-orange); font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; }
.housing-vanguard-focus { color: #DCE6F2; font-size: 0.98rem; line-height: 1.6; }

/* ---------- Roster ---------- */
.housing-section-teaser { color: var(--gray-text); margin-bottom: 22px; max-width: 720px; }
.housing-roster {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.housing-roster-item {
  background: var(--white); border: 1px solid var(--gray-border); border-left: 4px solid var(--ny-orange);
  border-radius: var(--radius-sm); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.housing-roster-role { display: block; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ny-orange-hover); margin-bottom: 4px; }
.housing-roster-name { display: block; font-size: 1.1rem; font-weight: 800; color: var(--ny-blue); }
.housing-roster-dev { display: block; font-size: 0.88rem; color: var(--gray-text); margin-top: 4px; }

/* ---------- Turnout stats ---------- */
.housing-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 20px;
}
.housing-stat {
  background: var(--ny-blue-mid); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius); padding: 28px; text-align: center; color: var(--white);
  box-shadow: var(--shadow-md);
}
.housing-stat-value { display: block; font-size: 3.2rem; font-weight: 900; color: var(--ny-orange); line-height: 1; }
.housing-stat-label { display: block; margin-top: 10px; font-size: 1.05rem; font-weight: 700; }
.housing-stat-note { display: block; margin-top: 4px; color: #DCE6F2; font-size: 0.9rem; }
.housing-stats-context { max-width: 760px; color: #DCE6F2; font-size: 0.98rem; }

.hero-cta { margin-top: 14px; color: var(--ny-orange); font-weight: 700; max-width: 720px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .housing-map-layout { grid-template-columns: 1fr; }
  .housing-case-grid { grid-template-columns: repeat(2, 1fr); }
  .housing-stats { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .housing-map { min-height: 360px; }
  .housing-map--tall { min-height: 420px; }
  .housing-case-grid { grid-template-columns: 1fr; }
  .housing-roster { grid-template-columns: 1fr; }
  .housing-vanguard { flex-direction: column; }
}

/* ================================================================
   NYCHA CLUSTERS — sortable table, priority chips, GOTV playbook
   ================================================================ */

/* Sortable header affordance */
.housing-sortable thead th[data-sort] { cursor: pointer; user-select: none; }
.housing-sortable thead th[data-sort]:hover { background: var(--ny-blue-mid); }
.housing-sortable thead th[data-sort].is-active { background: var(--ny-orange); color: var(--ny-blue-dark); }
.housing-sort-caret { display: inline-block; margin-left: 6px; opacity: 0.45; transition: transform 0.15s ease; }
.housing-sortable thead th[aria-sort="ascending"] .housing-sort-caret,
.housing-sortable thead th[aria-sort="descending"] .housing-sort-caret { opacity: 1; }
.housing-sortable thead th[aria-sort="ascending"] .housing-sort-caret { transform: rotate(180deg); }
.housing-sortable thead th[aria-sort="ascending"],
.housing-sortable thead th[aria-sort="descending"] { background: var(--ny-orange); color: var(--ny-blue-dark); }

/* Priority chips */
.housing-priority {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.4px; white-space: nowrap;
}
.housing-priority--vanguard,
.housing-priority--critical { background: rgba(179,38,30,0.14); color: var(--error); border: 1px solid rgba(179,38,30,0.4); }
.housing-priority--high,
.housing-priority--core { background: rgba(245,130,32,0.16); color: var(--ny-orange-hover); border: 1px solid rgba(245,130,32,0.4); }
.housing-priority--battleground { background: rgba(233,161,59,0.18); color: #8A5A12; border: 1px solid rgba(233,161,59,0.5); }
.housing-priority--medium { background: rgba(10,61,122,0.1); color: var(--ny-blue); border: 1px solid rgba(10,61,122,0.3); }

/* GOTV Field Playbook toggles */
.housing-playbook { display: grid; gap: 16px; margin-top: 8px; }
.housing-playbook-item {
  background: var(--ny-blue-mid); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius); box-shadow: var(--shadow-md); color: var(--white);
  overflow: hidden; transition: border-color 0.2s ease;
}
.housing-playbook-item[open] { border-color: var(--ny-orange); }
.housing-playbook-head {
  display: flex; align-items: center; gap: 16px; padding: 20px 24px;
  cursor: pointer; list-style: none; font-weight: 800;
}
.housing-playbook-head::-webkit-details-marker { display: none; }
.housing-playbook-index {
  flex: 0 0 auto; font-size: 1.4rem; font-weight: 900; color: var(--ny-orange); line-height: 1;
}
.housing-playbook-title { font-size: 1.05rem; line-height: 1.35; }
.housing-playbook-caret {
  margin-left: auto; width: 12px; height: 12px; flex: 0 0 auto;
  border-right: 2px solid var(--ny-orange); border-bottom: 2px solid var(--ny-orange);
  transform: rotate(45deg) translateY(-3px); transition: transform 0.2s ease;
}
.housing-playbook-item[open] .housing-playbook-caret { transform: rotate(-135deg) translateY(-3px); }
.housing-playbook-body { padding: 0 24px 24px; color: #DCE6F2; font-size: 0.97rem; line-height: 1.65; }
.housing-playbook-opportunity { margin-bottom: 10px; }
.housing-playbook-opportunity strong { color: var(--ny-orange); }
.housing-playbook-action { margin: 0; }

/* Clusters table responsiveness */
@media (max-width: 640px) {
  .housing-playbook-head { flex-wrap: wrap; gap: 10px; padding: 16px 18px; }
  .housing-playbook-body { padding: 0 18px 18px; }
}
