/* mbz-v2 — dark + glass + tech-forward (Option A) */

:root {
  --bg-0:   #06090d;     /* page background */
  --bg-1:   #0c1218;     /* cards */
  --bg-2:   #131c26;     /* raised */
  --line:   rgba(125, 211, 252, 0.0);   /* fully transparent — no white-ish borders */
  --line-2: rgba(125, 211, 252, 0.0);   /* fully transparent — no white-ish borders */
  --text:   #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --accent: #38bdf8;     /* cyan-400 */
  --accent-2: #06b6d4;   /* cyan-500 */
  --amber:  #f59e0b;
  --green:  #10b981;
  --red:    #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* Subtle background grid */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(ellipse at top, rgba(56, 189, 248, 0.08), transparent 60%),
    linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* ------ Header ------ */

header.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(6, 9, 13, 0.85);
  border-bottom: 1px solid var(--line);
}

header.topbar .container {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 32px;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .badge {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.brand .badge.amg { background: rgba(245, 158, 11, 0.15); color: var(--amber); border-color: rgba(245, 158, 11, 0.4); }

.topbar nav {
  display: flex;
  gap: 24px;
  align-items: center;
  flex: 1;
}

.topbar nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.topbar nav a:hover,
.topbar nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.topbar .meta {
  font-size: 12px;
  color: var(--text-3);
  font-family: ui-monospace, "Menlo", monospace;
}

/* ------ Hero ------ */

.hero {
  position: relative;
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 32px;
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .model-hero-grid { grid-template-columns: 1fr; gap: 24px; }
}

.model-hero-grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 32px;
}

.model-hero-photo {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 16 / 10;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  border: none;
  outline: none;
  max-width: 460px;
  justify-self: end;
  width: 100%;
}

.model-hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: var(--bg-2);
}

.hero-photo {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 16 / 10;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-photo-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(6, 9, 13, 0.85);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  backdrop-filter: blur(8px);
}

.hero h1 {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .sub {
  color: var(--text-2);
  font-size: 16px;
  max-width: 720px;
  margin: 0 0 32px;
}

.hero-spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  max-width: 100%;
}

.spec-tile {
  padding: 16px;
  background: rgba(19, 28, 38, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.spec-tile .label {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 600;
}

.spec-tile .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: ui-monospace, "Menlo", monospace;
}

.spec-tile .value small { color: var(--text-3); font-size: 11px; font-weight: 500; }

/* ------ Search ------ */

.search-shell {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: rgba(19, 28, 38, 0.7);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 6px;
  max-width: 720px;
  backdrop-filter: blur(10px);
}

.search-shell input,
.search-shell select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.search-shell select {
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%),
                    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: right 18px top 50%, right 13px top 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.search-shell input::placeholder,
.search-shell select { color: var(--text-3); }

.search-shell button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #061018;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 0 24px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: filter 0.15s;
}

.search-shell button:hover { filter: brightness(1.1); }
.search-shell button:disabled {
  background: var(--bg-2);
  color: var(--text-3);
  cursor: not-allowed;
}
.search-shell select:disabled,
.search-shell input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.model-pills {
  margin-top: 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 14px;
  background: rgba(19, 28, 38, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.amg  { border-color: rgba(245, 158, 11, 0.3); color: var(--amber); }
.pill.amg:hover { border-color: var(--amber); }

/* ------ Tabs ------ */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-top: 32px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tabpanel { display: none; padding: 32px 0; }
.tabpanel.active { display: block; }

/* ------ Cards + grids ------ */

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

.card {
  background: rgba(19, 28, 38, 0.6);
  border: none; /* Changed from 1px solid var(--line) to fix white borders */
  outline: none !important; /* Explicitly remove any outline artifacts */
  box-shadow: none !important; /* Explicitly remove any box-shadow artifacts */
  border-radius: 12px;
  overflow: hidden;
  /* Don't transition transform — GPU layers make downscaled images look soft */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.card:hover {
  border-color: var(--line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

.card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* Keep on its own layer without blurry transforms */
  backface-visibility: hidden;
}

/* Paint swatch card: clean box, no border, no background, image fits without stretching */
.card .thumb.thumb-paint {
  background: transparent;
  border: none;
  outline: none;
  aspect-ratio: 4 / 3;
}

.card .thumb.thumb-paint img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: auto;
  border: none;
  outline: none;
}

.card .thumb .placeholder {
  width: 60px;
  height: 60px;
  border: 1px dashed var(--line-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 24px;
  font-weight: 700;
}

.card .body {
  padding: 14px 16px 16px;
}

.card .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.card .code {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-family: ui-monospace, "Menlo", monospace;
  letter-spacing: 0.04em;
}

.card .price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: ui-monospace, "Menlo", monospace;
}

.card .price.zero { color: var(--text-3); }
.card .price.tbd  { color: var(--text-3); font-style: italic; font-weight: 500; }

.card .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.card .meta {
  font-size: 12px;
  color: var(--text-2);
  margin: 0;
}

/* ------ Copy buttons ------ */

.copy-btn {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copy-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent);
}

.copy-btn.copied {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--green);
  color: var(--green);
}

/* ------ Toast (after copy) ------ */

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(16, 185, 129, 0.95);
  color: #04151a;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ------ Detail rows ------ */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-head .count {
  color: var(--text-3);
  font-size: 13px;
  font-family: ui-monospace, "Menlo", monospace;
}

/* ------ Empty state ------ */

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-3);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* ------ Tables (specs, packages list) ------ */

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: rgba(19, 28, 38, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

table.data th {
  text-align: left;
  padding: 12px 16px;
  background: rgba(56, 189, 248, 0.06);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid transparent;
  vertical-align: top;
}

table.data tr:last-child td { border-bottom: none; }

table.data tr:hover td { background: rgba(56, 189, 248, 0.04); }

table.data td.code {
  font-family: ui-monospace, "Menlo", monospace;
  color: var(--accent);
  font-weight: 700;
}

/* ------ Footer ------ */

footer.bottom {
  margin-top: 80px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  font-family: ui-monospace, "Menlo", monospace;
}

/* ------ Gallery lightbox ------ */

.gallery-card {
  cursor: zoom-in;
}

/* Small CSS fit only. Source is a pre-sized thumb (max 800px), not the 4k master. */
.gallery-card .thumb {
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
}

.gallery-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 13, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(8px);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox .lb-close,
.lightbox .lb-prev,
.lightbox .lb-next {
  position: absolute;
  background: rgba(19, 28, 38, 0.7);
  color: var(--text);
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
  font-family: inherit;
  z-index: 2;
}

.lightbox .lb-close:hover,
.lightbox .lb-prev:hover,
.lightbox .lb-next:hover {
  background: rgba(56, 189, 248, 0.25);
  color: var(--accent);
  transform: scale(1.05);
}

.lightbox .lb-close {
  top: 16px;
  right: 16px;
}

.lightbox .lb-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox .lb-prev:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox .lb-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox .lb-next:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox .lb-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-2);
  font-family: ui-monospace, "Menlo", monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  background: rgba(19, 28, 38, 0.7);
  padding: 6px 12px;
  border-radius: 999px;
}

/* ------ Utility ------ */

.copy-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, "Menlo", monospace;
}

.flex { display: flex; gap: 8px; align-items: center; }
.right { margin-left: auto; }
