*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0a0a0a;
  --surface: #111111;
  --border:  #222222;
  --accent:  #e8ff00;
  --accent2: #ff3c00;
  --text:    #e8e8e0;
  --muted:   #666660;
  --tag-bg:  #1a1a1a;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── NOISE OVERLAY ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.4;
}

/* ── HEADER ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.08em;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
}

.logo span {
  color: var(--accent2);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
}

#count-display {
  color: var(--accent);
  font-weight: 400;
}

/* ── GRID ── */
main {
  padding: 24px;
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
}

/* ── TILE ── */
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  animation: fadeIn 0.4s ease both;
  transition: border-color 0.2s, transform 0.2s;
}

.tile:hover {
  border-color: var(--accent);
  z-index: 2;
  transform: scale(1.01);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tile-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--tag-bg);
  overflow: hidden;
}

.tile-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.tile:hover .tile-img-wrap img {
  transform: scale(1.04);
}

.tile-img-wrap .img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}

/* ── TILE META ── */
.tile-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile-address {
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.3;
  font-weight: 400;
}

.tile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tile-neighborhood {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-datetime {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  font-style: italic;
}

.tile-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.tag {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  text-transform: uppercase;
}

/* ── LIGHTBOX ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: lbIn 0.2s ease;
}

#lightbox.open {
  display: flex;
}

@keyframes lbIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lb-inner {
  display: flex;
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  border: 1px solid var(--border);
  overflow: hidden;
}

.lb-img-side {
  flex: 1 1 60%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 300px;
}

.lb-img-side img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 90vh;
}

.lb-info-side {
  flex: 0 0 320px;
  background: var(--surface);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
  z-index: 10;
}

.lb-close:hover { color: var(--accent); }

.lb-section-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.lb-value {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.lb-value.accent {
  color: var(--accent);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.05em;
}

.lb-value.alert { color: var(--accent2); }

.lb-divider {
  border: none;
  border-top: 1px solid var(--border);
}

/* ── LOADING / EMPTY ── */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 40vh;
  gap: 16px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#empty {
  display: none;
  align-items: center;
  justify-content: center;
  height: 40vh;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .lb-inner { flex-direction: column; max-height: 95vh; }
  .lb-info-side { flex: 0 0 auto; border-left: none; border-top: 1px solid var(--border); }
  #grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .logo { font-size: 22px; }
}