:root {
  --mb-bg: #f8f6f2;
  --mb-surface: #ffffff;
  --mb-soft: #eee8df;
  --mb-line: #ded8cf;
  --mb-ink: #211e1a;
  --mb-muted: #746d65;
  --mb-accent: #3b2350;
  --mb-accent-soft: #d9c7f0;
  --mb-shadow: 0 14px 35px color-mix(in srgb, var(--mb-ink) 9%, transparent);
}

.materials-bank-page {
  background: var(--mb-bg);
  color: var(--mb-ink);
}
.mb-page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 4rem;
}

.mb-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 250px;
  gap: 1.5rem;
  align-items: start;
}
.mb-filters,
.mb-discovery {
  border: 1px solid var(--mb-line);
  background: color-mix(in srgb, var(--mb-surface) 82%, transparent);
}
.mb-filters {
  padding: 1.15rem;
  position: sticky;
  top: 1rem;
}
.mb-panel-heading,
.mb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.mb-panel-heading {
  border-bottom: 1px solid var(--mb-line);
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
}
.mb-panel-heading h2,
.mb-section-head h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif !important;
  font-size: 1.35rem;
  font-weight: 600;
}
.mb-panel-heading button {
  border: 0;
  background: transparent;
  color: var(--mb-muted);
  cursor: pointer;
  font-size: 0.7rem;
  text-decoration: underline;
}
.mb-filters label {
  display: grid;
  gap: 0.45rem;
  margin: 0 0 1rem;
  font: 700 0.68rem/1.3 var(--font-subtitle, sans-serif);
}
.mb-filters select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--mb-line);
  border-radius: 4px;
  background: var(--mb-surface);
  color: var(--mb-ink);
  padding: 0 0.65rem;
  font-size: 0.72rem;
}
.mb-filters input[type="range"] {
  width: 100%;
  accent-color: var(--mb-accent);
}
#mb-price-value {
  color: var(--mb-muted);
  font-weight: 500;
}
.mb-apply,
.mb-more {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 3px;
  background: var(--mb-ink);
  color: var(--mb-surface);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.72rem;
}

.mb-content {
  min-width: 0;
}
.mb-hero {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  background: var(--mb-soft);
}
.mb-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--mb-bg) 94%, transparent) 0%,
    color-mix(in srgb, var(--mb-bg) 75%, transparent) 42%,
    transparent 72%
  );
}
.mb-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mb-hero-copy {
  position: relative;
  z-index: 1;
  max-width: min(100%, 560px);
  padding: clamp(2rem, 5vw, 4.4rem) clamp(1.5rem, 4vw, 3.4rem);
}
.mb-hero-copy span {
  display: block;
  margin-bottom: 0.7rem;
  color: var(--mb-muted);
  font: 700 0.62rem/1 var(--font-subtitle, sans-serif);
  letter-spacing: 0.18em;
}
.mb-hero-copy h1 {
  margin: 0 0 0.8rem;
  max-width: 12ch;
  font-family: "Cormorant Garamond", Georgia, serif !important;
  font-size: clamp(1.9rem, 3vw, 2.9rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: 0;
}
.mb-hero-copy p {
  max-width: 430px;
  margin: 0 0 1.2rem;
  color: var(--mb-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}
.mb-hero-copy a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 42px;
  padding: 0 1.2rem;
  border-radius: 3px;
  background: #cbb6e8;
  color: var(--mb-surface);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
}

.mb-section {
  padding-top: 1.6rem;
}
.mb-section-head {
  margin-bottom: 0.9rem;
}
.mb-section-head > span,
.mb-section-head > a {
  color: var(--mb-muted);
  font-size: 0.7rem;
  text-decoration: none;
}
.mb-product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}
.mb-product-card {
  display: block;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid var(--mb-line);
  border-radius: 4px;
  background: var(--mb-surface);
  color: var(--mb-ink);
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.mb-product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--mb-shadow);
}
.mb-product-media {
  position: relative;
  aspect-ratio: 1.05;
  overflow: hidden;
  margin-bottom: 0.65rem;
  background: var(--mb-soft);
}
.mb-product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.mb-product-card:hover img {
  transform: scale(1.035);
}
.mb-product-media span {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  max-width: calc(100% - 2.5rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.24rem 0.42rem;
  border-radius: 3px;
  background: color-mix(in srgb, var(--mb-surface) 88%, transparent);
  font-size: 0.52rem;
}
.mb-product-media i {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--mb-surface);
  font-size: 0.65rem;
}
.mb-product-card > small {
  color: var(--mb-muted);
  font-size: 0.55rem;
}
.mb-product-card h3 {
  min-height: 2.5em;
  margin: 0.25rem 0 0.45rem;
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mb-product-card > strong {
  font-size: 0.65rem;
}
.mb-more-wrap {
  max-width: 220px;
  margin: 1.25rem auto 0;
}

.mb-articles {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 0.8rem;
}
.mb-article-card {
  display: grid;
  grid-template-columns: 42% 1fr;
  min-height: 165px;
  border: 1px solid var(--mb-line);
  background: var(--mb-surface);
  color: var(--mb-ink);
  text-decoration: none;
  overflow: hidden;
}
.mb-article-card.is-featured {
  position: relative;
  grid-template-columns: 1fr;
}
.mb-article-card.is-featured::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent, color-mix(in srgb, var(--mb-ink) 90%, transparent));
}
.mb-article-card img {
  width: 100%;
  height: 100%;
  min-height: 165px;
  object-fit: cover;
}
.mb-article-card > div {
  padding: 1rem;
  position: relative;
  z-index: 1;
}
.mb-article-card.is-featured > div {
  position: absolute;
  inset: auto 0 0;
  color: var(--mb-surface);
}
.mb-article-card small {
  font-size: 0.55rem;
  text-transform: uppercase;
}
.mb-article-card h3 {
  margin: 0.35rem 0;
  font-family: "Cormorant Garamond", Georgia, serif !important;
  font-size: 1.05rem;
  line-height: 1.15;
}
.mb-article-card p {
  margin: 0;
  color: var(--mb-muted);
  font-size: 0.65rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mb-article-card.is-featured p {
  color: var(--mb-surface);
}

.mb-discovery {
  padding: 1rem;
}
.mb-discovery .mb-section-head {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--mb-line);
}
.mb-discovery .mb-section-head h2 {
  font-size: 1rem;
}
.mb-mini-product {
  display: grid;
  grid-template-columns: 60px 1fr 22px;
  gap: 0.65rem;
  align-items: center;
  min-height: 88px;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--mb-line);
  color: var(--mb-ink);
  text-decoration: none;
}
.mb-mini-product img {
  width: 60px;
  height: 65px;
  object-fit: cover;
  border-radius: 3px;
}
.mb-mini-product span {
  min-width: 0;
}
.mb-mini-product small,
.mb-mini-product b,
.mb-mini-product strong {
  display: block;
}
.mb-mini-product small {
  color: var(--mb-muted);
  font-size: 0.5rem;
}
.mb-mini-product b {
  margin: 0.25rem 0;
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.25;
}
.mb-mini-product strong {
  font-size: 0.58rem;
}
.mb-mini-product > i {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--mb-line);
  border-radius: 50%;
  font-size: 0.5rem;
}
.mb-feature {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 290px;
  margin-top: 1rem;
  padding: 1.2rem;
  overflow: hidden;
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 4px;
}
.mb-feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.mb-feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.85) 100%);
  z-index: 1;
}
.mb-feature span,
.mb-feature strong,
.mb-feature small {
  position: relative;
  z-index: 2;
  color: #ffffff !important;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.mb-feature span {
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.9;
}
.mb-feature strong {
  margin: 0.35rem 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.4rem;
  line-height: 1.2;
}
.mb-feature small {
  font-size: 0.65rem;
  line-height: 1.45;
  opacity: 0.95;
}
.mb-empty {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  color: var(--mb-muted);
}
[id^="ad-slot-"]:not([data-ad-filled="1"]) {
  display: none !important;
}

@media (max-width: 1180px) {
  .mb-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .mb-discovery {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
  }
  .mb-discovery .mb-section-head {
    grid-column: 1 / -1;
  }
  .mb-feature {
    display: none;
  }
  .mb-product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 820px) {
  .mb-page {
    padding-inline: 1rem;
  }
  .mb-layout {
    grid-template-columns: 1fr;
  }
  .mb-filters {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 1rem;
  }
  .mb-panel-heading,
  .mb-apply {
    grid-column: 1 / -1;
  }
  .mb-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mb-articles {
    grid-template-columns: 1fr 1fr;
  }
  .mb-article-card.is-featured {
    grid-column: 1 / -1;
    min-height: 260px;
  }
  .mb-discovery {
    grid-template-columns: repeat(3, 1fr);
  }
  .mb-mini-product:nth-of-type(n + 4) {
    display: none;
  }
}
@media (max-width: 560px) {
  .mb-page {
    padding-inline: 0.75rem;
  }
  .mb-filters {
    grid-template-columns: 1fr;
  }
  .mb-panel-heading,
  .mb-apply {
    grid-column: auto;
  }
  .mb-hero {
    min-height: 390px;
  }
  .mb-hero::after {
    background: linear-gradient(
      90deg,
      color-mix(in srgb, var(--mb-bg) 94%, transparent),
      color-mix(in srgb, var(--mb-bg) 52%, transparent)
    );
  }
  .mb-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mb-articles {
    grid-template-columns: 1fr;
  }
  .mb-article-card {
    grid-template-columns: 38% 1fr;
  }
  .mb-discovery {
    grid-template-columns: 1fr;
  }
  .mb-mini-product:nth-of-type(n + 4) {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mb-product-card,
  .mb-product-card img {
    transition: none;
  }
}
