
* {
  box-sizing: border-box;
}

:root {
  --navy: #003366;
  --blue: #0072c6;
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --page: #f4f7fb;
  --green: #167647;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

button, input, select {
  font: inherit;
}

button, select {
  cursor: pointer;
}

.topbar {
  min-height: 70px;
  padding: 12px clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(0, 51, 102, .98);
  color: white;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 4px 18px #0002;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .03em;
  min-width: 0;
}

.brand img {
  display: block;
  width: 42px;
  height: 42px;
  max-width: 42px;
  object-fit: contain;
  flex: 0 0 42px;
}

.brand span {
  overflow-wrap: anywhere;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar nav a {
  color: white;
  text-decoration: none;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: .88rem;
}

.topbar nav a:hover,
.topbar nav .active {
  background: #ffffff24;
}

.container {
  width: min(1440px, calc(100% - 32px));
  margin: auto;
}

.hero {
  padding: 35px 0 22px;
}

.eyebrow {
  font-size: .75rem;
  letter-spacing: .12em;
  font-weight: 800;
  color: var(--blue);
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -.04em;
  margin: 9px 0;
  color: #0f172a;
}

.hero > p {
  max-width: 760px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 20px;
  padding: 14px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  color: #1e3a5f;
  font-size: .84rem;
  line-height: 1.6;
}

.notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.search-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 28px #0f172a0a;
}

.search-panel > label {
  display: block;
  font-weight: 700;
  font-size: .8rem;
  margin-bottom: 8px;
}

.search-row {
  display: flex;
  gap: 10px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
}

.searchbox:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #0072c61a;
}

.searchbox > span {
  font-size: 1.5rem;
  color: var(--muted);
}

.searchbox input {
  border: 0;
  outline: 0;
  padding: 13px 0;
  width: 100%;
  min-width: 0;
  background: transparent;
  color: var(--ink);
}

.searchbox button {
  border: 0;
  background: white;
  font-size: 1.4rem;
  color: var(--muted);
}

.primary, .secondary {
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 700;
  min-height: 44px;
}

.primary {
  border: 0;
  background: var(--blue);
  color: white;
}

.primary:hover {
  background: var(--navy);
}

.secondary {
  border: 1px solid #cbd5e1;
  background: white;
  color: #334155;
}

.secondary:hover {
  background: #f8fafc;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  align-items: end;
  margin-top: 17px;
}

.filters label {
  min-width: 0;
  font-size: .76rem;
  color: #475569;
  font-weight: 700;
}

.filters select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 7px;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 0 9px;
  background: white;
  color: var(--ink);
}

.filters select:focus,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #0072c6;
  outline-offset: 2px;
}

.filters .secondary {
  width: 100%;
}

.status {
  font-size: .82rem;
  color: var(--muted);
  margin: 14px 0 0;
}

.status.error {
  color: #b91c1c;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 30px 0 16px;
  gap: 12px;
}

.section-heading h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.section-heading p,
.catalog-label {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}

.catalog-label {
  text-align: right;
}

.vendor-group {
  margin: 26px 0 34px;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.group-heading h3 {
  margin: 0;
  font-size: 1.15rem;
}

.group-count {
  background: #e2e8f0;
  border-radius: 99px;
  padding: 3px 9px;
  font-size: .75rem;
  font-weight: 700;
}

.slab-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.slab-card {
  min-width: 0;
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 3px 10px #0f172a08;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s;
}

.slab-card:hover,
.slab-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px #0f172a15;
  outline: 2px solid #0072c633;
}

.photo-wrap {
  aspect-ratio: 1.2;
  background: #e9edf2;
  overflow: hidden;
}

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

.photo-fallback {
  min-height: 130px;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 15px;
  color: #64748b;
  font-size: .8rem;
  background: #e9edf2;
}

.card-body {
  padding: 13px;
}

.card-code {
  color: var(--blue);
  font-size: .7rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.card-title {
  font-size: .95rem;
  line-height: 1.4;
  min-height: 2.5em;
  margin: 6px 0 8px;
}

.card-meta {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.card-price {
  font-weight: 800;
  color: var(--navy);
  font-size: 1rem;
  margin-top: 11px;
}

.card-price small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
}

.thickness-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.chip {
  padding: 4px 7px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e40af;
  font-size: .68rem;
  font-weight: 700;
}

.card-link {
  display: inline-block;
  margin-top: 11px;
  color: var(--blue);
  font-size: .72rem;
  font-weight: 800;
}

.empty {
  background: white;
  text-align: center;
  padding: 42px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}

.empty p {
  color: var(--muted);
}

footer {
  text-align: center;
  padding: 32px 0 25px;
  color: var(--muted);
  font-size: .78rem;
}

dialog {
  padding: 0;
  border: 0;
  border-radius: 16px;
  width: min(1100px, calc(100% - 24px));
  max-width: 1100px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 25px 90px #0005;
  color: var(--ink);
}

dialog::backdrop {
  background: #081426b8;
  backdrop-filter: blur(3px);
}

.close {
  position: sticky;
  float: right;
  top: 8px;
  margin: 10px 10px -48px 0;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #0f172ad9;
  color: white;
  font-size: 1.6rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.detail-photos {
  min-width: 0;
  padding: 18px;
  background: #f1f5f9;
}

.detail-photo-panel {
  overflow: hidden;
  min-height: 300px;
  max-height: 470px;
  display: grid;
  place-items: center;
  background: #e8edf3;
  border-radius: 10px;
}

.detail-photo {
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 470px;
  object-fit: contain;
}

.used-photo-panel {
  margin-top: 15px;
}

.used-photo-panel h3 {
  font-size: .85rem;
  margin: 0 0 8px;
}

.used-photo {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
  background: #e8edf3;
}

.detail-info {
  min-width: 0;
  padding: 36px 26px 28px;
}

.detail-info h2 {
  margin: 8px 0;
  line-height: 1.2;
  font-size: 1.65rem;
  overflow-wrap: anywhere;
}

.detail-code {
  color: var(--muted);
  margin-bottom: 18px;
  font-size: .85rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.detail-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  min-width: 0;
}

.detail-label {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  margin-bottom: 5px;
}

.detail-value {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.price-section {
  margin-top: 20px;
}

.price-section h3 {
  font-size: 1rem;
  margin: 0 0 10px;
}

.price-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.price-table th,
.price-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.price-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}

.price-table tr:last-child td {
  border-bottom: 0;
}

.no-price {
  color: var(--muted);
  font-size: .82rem;
}

.detail-notice {
  margin-top: 20px;
  padding: 12px;
  background: #eff6ff;
  border-radius: 10px;
  color: #1e3a5f;
  font-size: .78rem;
  line-height: 1.6;
}

@media (min-width: 1450px) {
  .slab-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .slab-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-photos {
    padding: 14px;
  }

  .detail-photo-panel {
    min-height: 260px;
    max-height: 40vh;
  }

  .detail-photo {
    min-height: 260px;
    max-height: 40vh;
  }

  .detail-info {
    padding: 24px 18px;
  }
}

@media (max-width: 600px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand {
    font-size: .75rem;
  }

  .topbar nav {
    width: 100%;
  }

  .topbar nav a {
    padding: 8px 10px;
    font-size: .8rem;
  }

  .container {
    width: calc(100% - 20px);
  }

  .hero {
    padding-top: 25px;
  }

  .search-panel {
    padding: 14px;
  }

  .search-row {
    flex-direction: column;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .filters .secondary {
    grid-column: 1 / -1;
  }

  .slab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card-body {
    padding: 10px;
  }

  .card-title {
    font-size: .84rem;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalog-label {
    text-align: left;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}


/* Enlarged slab photo viewer */

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 24px;
  box-sizing: border-box;
  background: rgba(8, 15, 28, 0.97);
  cursor: zoom-out;
}

.image-lightbox img {
  display: block;
  max-width: 96vw;
  max-height: calc(100dvh - 100px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.45);
  cursor: default;
}

.image-lightbox-close {
  position: absolute;
  top: 14px;
  right: 22px;
  z-index: 1;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: #263449;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover {
  background: #40536d;
}

@media (max-width: 600px) {
  .image-lightbox {
    padding: 58px 10px 14px;
  }

  .image-lightbox img {
    max-width: 98vw;
    max-height: calc(100dvh - 85px);
  }

  .image-lightbox-close {
    top: 8px;
    right: 10px;
  }
}


