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

/* ===== Tokens ===== */
:root {
  --bg: #000000;
  --surface: #0c0c0c;
  --surface-2: #0a0a0a;
  --border: #1f1f1f;
  --border-hover: #333333;
  --text: #ffffff;
  --text-muted: #888888;
  --text-faint: #666666;
  --accent: #00d27f;
  --accent-hover: #26e69a;
  --sold: #ff4444;
  --key-issue: #f5c84c;
  --key-issue-text: #1a1200;
  --radius: 4px;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== Base ===== */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: #000; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: var(--radius); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ===== Banner ===== */
.banner {
  width: 100%;
  margin: 0;
  padding: 8px clamp(8px, 1.5vw, 32px);
  line-height: 0;
  background: var(--accent);
  color: #000;
  animation: banner-flash 2s steps(1, end) infinite;
}
.banner-svg {
  display: block;
  width: 100%;
  height: auto;
}

@keyframes banner-flash {
  0%, 49.999% {
    background: var(--accent);
    color: #000;
  }
  50%, 100% {
    background: var(--bg);
    color: var(--accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .banner {
    animation: none;
    background: var(--accent);
    color: #000;
  }
}

/* ===== Header (centered brand + 3-card row) ===== */
.header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px 16px 20px;
}
.tagline {
  margin: 0;
  text-align: center;
  color: #cccccc;
  font-size: clamp(1rem, 1.4vw, 1.6rem);
  line-height: 1.4;
  max-width: 720px;
}
.logo {
  width: clamp(120px, 12vw, 200px);
  height: auto;
  aspect-ratio: 1 / 1;
  image-rendering: pixelated;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 48px);
}

.contact-info-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.contact-info-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  color: var(--accent);
  flex-shrink: 0;
}
.card-icon svg { width: 22px; height: 22px; }

.card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.card-label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.card-value {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* eBay multi-color wordmark */
.ebay-logo {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--radius);
  padding: 4px 10px;
  font-family: var(--font);
  font-weight: 800;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: -1px;
  flex-shrink: 0;
  margin-left: auto;
}
.ebay-logo .e { color: #e53238; }
.ebay-logo .b { color: #0064d2; }
.ebay-logo .a { color: #f5af02; }
.ebay-logo .y { color: #86b817; }

/* ===== Controls (search + filters) ===== */
.controls-wrap {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 99;
}
.controls-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.controls-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.controls input[type="search"],
.controls select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
}
.controls input[type="search"] { width: 240px; }
.controls input[type="search"]:focus,
.controls select:focus {
  outline: none;
  border-color: var(--accent);
}
.controls .toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.controls .toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}
.result-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== Stats line ===== */
.stats-line {
  padding: 8px 24px;
  font-size: 0.8rem;
  color: var(--text-faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow-x: auto;
}
.stats-line:empty { display: none; }
.stats-line .active { color: var(--accent); font-weight: 600; }

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px;
}

/* ===== Tile ===== */
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border-color: var(--border-hover);
}
.tile .cover {
  position: relative;
  background: #1a1a1a;
}
.tile .cover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 42%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.54) 58%, rgba(0, 0, 0, 0));
  pointer-events: none;
}
.tile img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}
.tile .overlay-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 42px 12px 12px;
}
.tile .title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}
.tile .title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.22;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile .issue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(0, 210, 127, 0.13);
  border: 1px solid rgba(0, 210, 127, 0.5);
  border-radius: var(--radius);
  padding: 3px 7px;
  font-size: 0.86rem;
  line-height: 1.1;
  font-weight: 700;
  white-space: nowrap;
}
.tile .meta {
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 4px;
}

/* ===== Sold overlay (red diagonal stripe + corner badge) ===== */
.tile.sold { opacity: 0.55; }
.tile.sold::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(135deg, transparent 47%, var(--sold) 47%, var(--sold) 53%, transparent 53%);
  pointer-events: none;
}
.sold-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--sold);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: var(--radius);
  z-index: 4;
}

/* ===== Key issue overlay (yellow diagonal stripe + status badge) ===== */
.tile.key-issue {
  border-color: rgba(245, 200, 76, 0.42);
}
.tile.key-issue::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(135deg, transparent 46.5%, var(--key-issue) 46.5%, var(--key-issue) 53.5%, transparent 53.5%);
  pointer-events: none;
}
.key-issue-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  padding: 5px 7px;
  background: var(--key-issue);
  color: var(--key-issue-text);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.42);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.7px;
  line-height: 1.12;
  text-align: center;
  text-transform: uppercase;
}

/* ===== No results / error ===== */
.no-results,
.error {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 1rem;
  grid-column: 1 / -1;
}
.error button {
  margin-left: 12px;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
}
.error button:hover { background: var(--accent-hover); }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; }

.modal {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.modal img {
  max-height: 85vh;
  max-width: 55vw;
  object-fit: contain;
  border-radius: var(--radius);
}

.modal-details {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: var(--radius);
  min-width: 280px;
  max-width: 340px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-details h2 {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}
.modal-details p {
  color: #cccccc;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.modal-details .sold-note {
  color: var(--sold);
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 12px;
}

.modal-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  z-index: 210;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 2.5rem;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: var(--radius);
  z-index: 210;
}
.modal-nav:hover { background: rgba(255, 255, 255, 0.15); color: var(--text); }
.modal-nav.prev { left: 12px; }
.modal-nav.next { right: 12px; }

/* ===== Mobile (≤900px) ===== */
@media (max-width: 900px) {
  .banner { padding: 6px 8px; }

  .brand { padding: 16px 12px 12px; gap: 14px; }
  .logo { width: 140px; }

  .contact-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 12px;
  }

  .controls-wrap { padding: 10px 12px; position: static; }
  .controls-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .controls input[type="search"] { width: 100%; flex: 1 1 100%; }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 12px;
  }
  .tile .title { font-size: 0.85rem; }
  .tile .meta { font-size: 0.65rem; }

  .modal {
    flex-direction: column;
    align-items: center;
    padding: 20px 8px;
  }
  .modal img {
    max-width: 90vw;
    max-height: 55vh;
  }
  .modal-details {
    min-width: auto;
    width: 90vw;
    max-height: 30vh;
  }
}
