/* Product window. The spec table is drawn as the brushed-steel rating plate
   riveted to the back of every commercial fridge: the one place on the page
   where we spend visual boldness. On phones the window becomes a bottom sheet. */

.product-dialog {
  width: min(62rem, 100% - 2rem);
  max-height: min(48rem, 92dvh);
  padding: 0;
  border: 0;
  border-radius: var(--radius-large);
  background: var(--white);
  color: var(--ink);
  overscroll-behavior: contain;
}

.product-dialog::backdrop {
  background: rgb(12 36 66 / 0.55);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Entry animation only; closing is instant everywhere (simpler, no flicker). */
.product-dialog[open] {
  opacity: 1;
  transition: opacity 0.2s ease-out, transform 0.25s ease-out;
  @starting-style { opacity: 0; }
  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0);
    @starting-style { transform: translateY(1.25rem); }
  }
}

.dialog-close-form { position: sticky; top: 0; z-index: 1; height: 0; }

.dialog-close {
  position: absolute;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--stainless);
  border-radius: 50%;
  background: var(--white);
  font-size: 1.1rem;
  color: var(--ink);
  cursor: pointer;
}

.dialog-content {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-rows: auto 1fr;
  /* Desktop: the quote buttons sit under the photo, always in view
     while the spec plate scrolls beside them. */
  grid-template-areas: 'photo info' 'actions info';
}

.product-photo {
  grid-area: photo;
  padding: 2rem 2rem 1rem;
  background: var(--white);
}

.product-photo img { aspect-ratio: 1; width: 100%; object-fit: contain; }

.photo-note { margin-top: 0.5rem; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }

.product-info { grid-area: info; border-inline-start: 1px solid var(--stainless); padding: 2rem 2rem 2rem 2.25rem; display: grid; gap: 1rem; align-content: start; }

.product-category { font-size: var(--text-small); color: var(--steel-blue); font-weight: 600; }

.product-name { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); padding-inline-end: 2.5rem; }

.product-description { max-width: 34rem; }

/* The rating plate */
.plate {
  --rivet: radial-gradient(circle, #f4f6f8 0 1.5px, #7d8893 2.5px 3.5px, transparent 4px);
  position: relative;
  margin: 0.25rem 0 0;
  padding: 1.1rem 1.4rem;
  border: 1px solid var(--stainless-dark);
  border-radius: 4px;
  /* Rivets in the four corners, over brushed steel (fine horizontal grain). */
  background:
    var(--rivet) top 0.35rem right 0.35rem / 10px 10px no-repeat,
    var(--rivet) top 0.35rem left 0.35rem / 10px 10px no-repeat,
    var(--rivet) bottom 0.35rem right 0.35rem / 10px 10px no-repeat,
    var(--rivet) bottom 0.35rem left 0.35rem / 10px 10px no-repeat,
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.35) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, #e9edf0 0%, #cdd4da 45%, #e2e7eb 70%, #c3cbd2 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.8), 0 1px 2px rgb(21 33 45 / 0.15);
}

.plate-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding-block: 0.4rem;
  border-bottom: 1px solid rgb(90 102 114 / 0.25);
}

.plate-row:last-child { border-bottom: 0; }

/* Engraved look: dark text with a light edge below. */
.plate dt, .plate dd {
  margin: 0;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.7);
}

.plate dt { color: #4a5763; font-size: var(--text-small); font-weight: 500; padding-top: 0.1rem; }

.plate dd { color: #1d2a36; font-weight: 600; }

.plate-row:first-child dd { font-size: var(--text-large); letter-spacing: 0.02em; }

.variants { width: 100%; border-collapse: collapse; font-size: var(--text-small); }

.variants caption { text-align: start; font-weight: 600; padding-bottom: 0.4rem; }

.variants th, .variants td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--stainless); text-align: start; }

.variants th { color: var(--ink-soft); font-weight: 500; }

.product-actions {
  grid-area: actions;
  align-self: start;
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.6rem;
  padding: 0 2rem 2rem;
}

.product-compare { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; cursor: pointer; }
.product-compare input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--navy); }

/* Similar models: small tiles under the specs; tapping one swaps the window content. */
.similar { margin-top: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--stainless); }
.similar h3 { font-size: var(--text-large); }
.similar-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.similar-item {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  height: 100%;
  padding: 0.4rem 0.4rem 0.6rem;
  border: 1px solid var(--stainless);
  border-radius: var(--radius-small);
  background: var(--white);
  font: inherit;
  text-align: start;
  cursor: pointer;
  align-content: start;
}
.similar-item:hover { border-color: var(--steel-blue); }
.similar-item img { aspect-ratio: 1; width: 100%; object-fit: contain; }
.similar-name { font-size: 0.8rem; font-weight: 600; line-height: 1.3; }
.similar-size { font-size: 0.75rem; color: var(--ink-soft); }

.product-name:focus { outline: none; }

/* Phones: bottom sheet, photo on top, actions pinned to the bottom edge. */
@media (max-width: 52rem) {
  .product-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: var(--radius-large) var(--radius-large) 0 0;
  }

  .dialog-content { grid-template-columns: 1fr; grid-template-areas: 'photo' 'info' 'actions'; grid-template-rows: auto; }

  .product-photo { padding: 1.25rem 3.5rem 0.5rem; }
  .product-photo img { max-height: 15rem; }

  .product-info { padding: 0.5rem 1.25rem 1.25rem; border-inline-start: 0; }

  .plate { padding: 0.9rem 1rem; }
  .plate-row { grid-template-columns: 6.5rem 1fr; gap: 0.75rem; }

  .similar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .product-actions {
    top: auto;
    bottom: 0;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--stainless);
  }

  .product-actions .button-whatsapp { grid-column: 1 / -1; }

  /* No room for the full number next to the quote button; the tel: link dials it anyway. */
  .call-number { display: none; }
}
