/*
 * Metal apartment product card — DRE Supreme / interior commerce layout.
 * Branch: /metal-doors-apartment/<category>/<product>/
 * Shell width: --storefront-content-max (1248px).
 */

.mda-product {
  /* Canonical soft blue text-card tokens (base-layout.css / FRONTEND_CSS_POLICY). */
  --mda-workspace: var(--storefront-workspace-bg, #edf1f6);
  --mda-panel: var(
    --storefront-text-card-bg,
    linear-gradient(180deg, #fbfcff 0%, #f5f8fe 100%)
  );
  --mda-panel-solid: var(--storefront-text-card-bg-solid, #f5f8fe);
  --mda-panel-border: var(--storefront-text-card-border, #d9e1ee);
  --mda-panel-radius: var(--storefront-text-card-radius, 7px);
  --mda-panel-accent: #0b3a91;
  --mda-panel-shadow: none;
  --mda-navy: #0d2d63;
  --mda-blue: #0b3a91;
  --mda-muted: #38568b;
  --mda-font-floor: 12px;
  color: #082b69;
  font-family: var(--font-sans);
}

.mda-product--commerce {
  padding-bottom: 88px;
}

body.metal-door-product {
  --footer-w: var(--storefront-content-max, 1248px);
  /* Outer page field like fire PDP */
  background: #f7f9fd;
}

body.metal-door-product main {
  background: #f7f9fd;
}

body.metal-door-product .bd-home-main {
  margin: 9px 0 16px;
  background: transparent;
}

body.metal-door-product .bd-home-main__wrap {
  padding-bottom: 0;
}

body.metal-door-product .bd-home-main__inner {
  padding: clamp(18px, 2.5vw, 28px);
}

/* White block (shell) — elements sit on blue substrate inside */
body.metal-door-product .bd-home-main__shell {
  border: 1px solid #d9e1ee;
  border-radius: 4px;
  box-shadow: none;
  background: #fff;
}

body.metal-door-product .bd-home-main__shell::after {
  display: none;
}

/* ---- Nav ----------------------------------------------------------------- */
.mda-product__nav {
  display: grid;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 18px;
}

.mda-product__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(0, 104, 183, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #0068b7;
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0, 47, 102, 0.08);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.mda-product__back:hover {
  border-color: rgba(0, 104, 183, 0.42);
  box-shadow: 0 10px 24px rgba(0, 47, 102, 0.12);
  transform: translateY(-1px);
}

.mda-product__back-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0068b7;
  color: #fff;
  font-size: var(--text-small);
  line-height: 1;
}

.mda-product__breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  min-height: 24px;
  padding: 4px 0 0 2px;
  color: #7892a8;
  font-size: var(--text-caption);
  font-weight: 700;
  line-height: 1.35;
}

.mda-product__breadcrumbs a {
  color: #557997;
  text-decoration: none;
}

.mda-product__breadcrumbs a:hover {
  color: #0068b7;
}

.mda-product__breadcrumbs span:not(.mda-product__sep) {
  color: #315d80;
}

.mda-product__sep {
  color: #a5b7c7;
  font-weight: 800;
}

/* ---- Workspace: fire-style blue substrate under text panels -------------- */
.mda-product__workspace {
  display: grid;
  gap: clamp(12px, 1.8vw, 20px);
}

.mda-product--commerce .mda-product__workspace {
  padding: clamp(12px, 1.8vw, 20px);
  border: 1px solid var(--storefront-workspace-border, #c2cfdf);
  border-radius: 4px;
  background: var(--mda-workspace);
  box-shadow: none;
}

/* Desktop: gallery | rail */
.mda-product__commerce {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(12px, 1.8vw, 20px);
  align-items: start;
}

/*
 * Text cards — same visual as fire .fd-product__panel / .fd-features:
 * soft blue fill + light blue border + 3px navy top accent line.
 */
.mda-product__panel {
  min-width: 0;
  border: 1px solid var(--mda-panel-border);
  border-top: 3px solid var(--mda-panel-accent, #0b3a91);
  border-radius: var(--mda-panel-radius, 7px);
  background: var(--mda-panel);
  box-shadow: var(--mda-panel-shadow);
}

/* Gallery stays neutral white so product photo reads cleanly;
 * top accent line still applies (same as fire photo + summary blocks). */
.mda-product__panel.mda-product__gallery {
  background: #fff;
  border-color: #c9d4e3;
  border-top-color: var(--mda-panel-accent, #0b3a91);
}

/* ---- Gallery ------------------------------------------------------------- */
.mda-product__gallery {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  position: sticky;
  top: 20px;
  align-self: start;
  height: fit-content;
  padding: clamp(12px, 1.5vw, 18px);
}

.mda-product__gallery:not(:has(.mda-product__thumbs)) {
  grid-template-columns: minmax(0, 1fr);
}

.mda-product__thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding-right: 2px;
}

.mda-product__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d5e5f3;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mda-product__thumb.is-active,
.mda-product__thumb:hover {
  border-color: var(--mda-blue);
  box-shadow: 0 0 0 2px rgba(0, 104, 183, 0.15);
}

.mda-product__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mda-product__stage {
  border-radius: 10px;
  background: #f7fafc;
  padding: 10px;
}

body.metal-door-product .mda-product__frame.product-image-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: min(56vh, 520px);
  height: clamp(340px, 36vw, 520px);
  max-height: 560px;
  overflow: hidden;
  border: 1px solid #e2ebf3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(18, 66, 103, 0.06);
}

body.metal-door-product .mda-product__frame.product-image-grid img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(62vh, 560px);
  margin: 0 auto;
  object-fit: contain;
  object-position: center center;
}

body.metal-door-product .mda-product__image-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 420px;
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid #e2ebf3;
  border-radius: 8px;
  background: #fff;
  color: #7795af;
  text-align: center;
  gap: 8px;
}

.mda-product__image-empty .material-symbols-outlined {
  font-size: var(--text-5xl);
}

/* ---- Rail / buybox ------------------------------------------------------- */
.mda-product__rail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.mda-product__buybox {
  position: sticky;
  top: 20px;
  z-index: 2;
  padding: clamp(18px, 2.2vw, 26px);
}

.mda-product__eyebrow {
  margin: 0 0 8px;
  color: var(--mda-blue);
  font-size: var(--text-caption);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mda-product__buybox h1,
.mda-product__main h1 {
  margin: 0 0 12px;
  color: var(--mda-navy);
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.mda-product__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 8px;
}

.mda-product__price strong {
  color: var(--mda-blue);
  font-size: var(--text-3xl);
  font-weight: 800;
}

.mda-product__price del {
  color: #8fa3b5;
  font-size: var(--text-body);
}

.mda-product__price span {
  flex-basis: 100%;
  color: var(--mda-muted);
  font-size: var(--text-caption);
  font-weight: 600;
}

.mda-product__meta {
  margin: 0 0 12px;
  color: var(--mda-muted);
  font-size: var(--text-caption);
}

.mda-product__sku {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef5fb;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mda-product__lead {
  margin: 0 0 14px;
  color: #315d80;
  font-size: var(--text-small);
  line-height: 1.45;
}

.mda-product__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  color: var(--mda-muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.mda-product__trust a {
  color: var(--mda-blue);
  text-decoration: none;
}

.mda-product__trust a:hover {
  text-decoration: underline;
}

.mda-product__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mda-product__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--text-body);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.mda-product__btn--primary {
  background: var(--mda-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 104, 183, 0.22);
}

.mda-product__btn--primary:hover:not(:disabled) {
  background: #055a9e;
}

.mda-product__btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.mda-product__btn--ghost {
  background: #fff;
  border-color: #bdd5e8;
  color: var(--mda-blue);
}

.mda-product__btn--ghost:hover {
  border-color: var(--mda-blue);
}

.mda-product__cart-status {
  flex-basis: 100%;
  margin: 0;
  color: var(--mda-muted);
  font-size: var(--text-caption);
  font-weight: 600;
}

/* ---- Configurator -------------------------------------------------------- */
.mda-product__configure {
  padding: clamp(14px, 2vw, 18px);
}

/* Nested heading / options already inside soft blue panel */

.mda-configurator {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.mda-configurator__heading h2 {
  margin: 0;
  color: var(--mda-navy);
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: var(--fw-title);
}

.mda-configurator__heading p {
  margin: 6px 0 16px;
  color: var(--mda-muted);
  font-family: var(--font-sans);
  font-size: var(--text-small);
  line-height: 1.45;
}

.mda-configurator__group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.mda-configurator__group + .mda-configurator__group {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid #e1edf7;
}

.mda-configurator__group legend {
  margin-bottom: 9px;
  color: #69849c;
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mda-configurator__option {
  display: grid;
  gap: 5px;
}

.mda-configurator__option[hidden] {
  display: none !important;
}

.mda-configurator__option-title {
  color: #244b6d;
  font-size: var(--text-body);
  font-weight: 700;
}

.mda-configurator__option-title em {
  margin-left: 4px;
  color: #0068b7;
  font-size: var(--text-caption);
  font-style: normal;
  text-transform: uppercase;
}

.mda-configurator select {
  width: 100%;
  min-height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid #bdd5e8;
  border-radius: 8px;
  background: #fff;
  color: #163b5b;
  font: inherit;
  font-size: var(--text-body);
  cursor: pointer;
}

.mda-configurator select:focus {
  border-color: #0068b7;
  outline: 3px solid rgba(0, 104, 183, 0.14);
}

.mda-configurator__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mda-configurator__choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid #bdd5e8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 600;
  color: #244b6d;
}

.mda-configurator__choice:has(input:checked),
.mda-configurator__choice.is-selected {
  border-color: #0068b7;
  box-shadow: 0 0 0 3px rgba(0, 104, 183, 0.12);
}

.mda-configurator__choice input {
  margin: 0;
}

.mda-configurator__choice--swatch {
  flex-direction: column;
  width: 72px;
  min-height: 0;
  padding: 6px;
  text-align: center;
  font-size: var(--text-caption);
}

.mda-configurator__choice--swatch img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.mda-configurator__status {
  margin: 12px 0 0;
  color: var(--mda-muted);
  font-size: var(--text-caption);
}

.mda-configurator__messages {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #b42318;
  font-size: var(--text-caption);
}

.mda-configurator__breakdown {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f3f8fe;
  font-size: var(--text-caption);
  color: #315d80;
}

/* ---- Tabs ---------------------------------------------------------------- */
.mda-product__tabs {
  padding: 0;
  overflow: hidden;
}

.mda-product__tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid #e1edf7;
  background: #f8fbfe;
}

.mda-product__tab {
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #5a7390;
  font: inherit;
  font-size: var(--text-small);
  font-weight: 800;
  cursor: pointer;
}

.mda-product__tab.is-active {
  color: var(--mda-navy);
  border-bottom-color: var(--mda-blue);
  background: #fff;
}

.mda-product__tabpanel {
  display: none;
  padding: clamp(16px, 2vw, 24px);
}

.mda-product__tabpanel.is-active {
  display: block;
}

.mda-features-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.mda-features-list > div {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 12px 20px;
  padding: 12px 0;
  border-bottom: 1px solid #e8f0f7;
}

.mda-features-list > div:last-child {
  border-bottom: 0;
}

.mda-features-list dt {
  margin: 0;
  color: #5a7390;
  font-size: var(--text-small);
  font-weight: 700;
}

.mda-features-list dt small {
  display: block;
  margin-top: 2px;
  color: #8fa3b5;
  font-size: var(--text-caption);
  font-weight: 600;
}

.mda-features-list dd {
  margin: 0;
  color: var(--mda-navy);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.mda-product__description-body {
  color: #315d80;
  font-size: var(--text-body);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mda-product__description-body p {
  margin: 0 0 10px;
}

.mda-product__service {
  color: #315d80;
  font-size: var(--text-body);
  line-height: 1.55;
}

.mda-product__service a {
  color: var(--mda-blue);
  font-weight: 700;
  text-decoration: none;
}

.mda-product__service a:hover {
  text-decoration: underline;
}

/* ---- Sticky mobile bar --------------------------------------------------- */
.mda-product__sticky-bar {
  display: none;
}

/* ---- Focus --------------------------------------------------------------- */
.mda-product__back:focus-visible,
.mda-product__btn:focus-visible,
.mda-product__thumb:focus-visible,
.mda-product__tab:focus-visible,
.mda-configurator__choice:focus-within,
.mda-configurator select:focus-visible {
  outline: 3px solid rgba(13, 57, 124, 0.35);
  outline-offset: 2px;
}

/* ---- Tablet -------------------------------------------------------------- */
@media (max-width: 1024px) {
  .mda-product__commerce {
    grid-template-columns: 1fr;
  }

  .mda-product__gallery {
    position: static;
    grid-template-columns: minmax(0, 1fr);
  }

  .mda-product__thumbs {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
  }

  .mda-product__thumb {
    scroll-snap-align: start;
    width: 56px;
    height: 56px;
  }

  .mda-product__buybox {
    position: static;
  }

  body.metal-door-product .mda-product__frame.product-image-grid {
    height: min(52vw, 380px);
    min-height: 280px;
  }
}

/* ---- Mobile -------------------------------------------------------------- */
@media (max-width: 768px) {
  .mda-product--commerce {
    padding-bottom: 96px;
  }

  body.metal-door-product .bd-home-main__inner {
    padding: 14px 12px 20px;
  }

  .mda-product__buybox h1 {
    font-size: clamp(28px, 4vw, 36px);
  }

  body.metal-door-product .mda-product__frame.product-image-grid {
    height: min(52vw, 300px);
    min-height: 220px;
  }

  .mda-features-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .mda-product__tab {
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 10px;
    font-size: var(--text-caption);
  }

  .mda-product__sticky-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #d5e3f0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 28px rgba(9, 39, 91, 0.12);
    backdrop-filter: blur(8px);
  }

  .mda-product__sticky-price {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .mda-product__sticky-price strong {
    color: var(--mda-blue);
    font-size: var(--text-xl);
    font-weight: 800;
  }

  .mda-product__sticky-price-state {
    color: var(--mda-muted);
    font-size: var(--text-caption);
    font-weight: 600;
  }

  .mda-product__sticky-bar .mda-product__btn {
    flex: 0 0 auto;
    min-width: 120px;
  }
}


