.catalog-list .card { position: relative; }

.product-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

.product-link:focus-visible { outline: none; }
.product-link:focus-visible::after {
  outline: 3px solid var(--section-accent);
  outline-offset: 3px;
}

.card-open-mark {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #eadfcbab;
  border-radius: 50%;
  background: #24231ce8;
  color: #fff1dc;
  font: 16px/1 var(--sans);
}

@media (hover: hover) {
  .catalog-list .card:hover .product-link { color: var(--section-accent); }
  .catalog-list .card:hover .card-open-mark { color: #221b14; background: var(--section-accent); }
}

html:has(#product-card[open]) { overflow: hidden; }

dialog.product-card {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f2ebdf;
  overflow: hidden;
  overscroll-behavior: contain;
  grid-template-rows: auto minmax(0, 1fr);
}

dialog.product-card[open] { display: grid; }
.product-card::before { content: none; }
.product-card::backdrop { background: transparent; }
.product-header-host { position: relative; z-index: 4; }
.product-header-host, .product-header-placeholder { min-height: var(--shop-header-height); }
.product-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: clamp(8px, 2vw, 24px);
  background: #0b0c0be0;
  overflow: hidden;
}
.product-sheet {
  width: min(100%, 1000px);
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--section-rule);
  background: var(--section-bg);
  box-shadow: 0 18px 95px #000a, 0 0 32px #b3986b1a;
  scrollbar-color: var(--section-rule) var(--section-bg);
}
.product-bar, #product-share-fallback, #product-pages { flex: 0 0 auto; }

.product-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px clamp(18px, 3.2vw, 42px);
  border-bottom: 1px solid var(--section-rule);
  background: var(--section-panel);
}

#product-category {
  margin: 0;
  color: var(--section-accent);
  font: 650 11px/1.5 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

#product-close {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 4px 0 4px 10px;
  border: 0;
  color: #ede4d6;
  background: transparent;
  font: 500 14px/1 var(--sans);
}

#product-close span { color: var(--section-accent); font-size: 23px; font-weight: 400; }
#product-close:hover { color: var(--section-accent); }
#product-close:focus-visible { outline: 2px solid var(--section-accent); outline-offset: 1px; }

.product-tools, #product-share {
  display: inline-flex;
  align-items: center;
}
.product-tools { gap: clamp(8px, 2vw, 24px); }
#product-share {
  min-height: 44px;
  gap: 7px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #e0d6ca;
  font: 500 14px/1 var(--sans);
}
.copy-icon { position: relative; width: 15px; height: 15px; }
.copy-icon::before, .copy-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 10px;
  border: 1px solid var(--section-accent);
  border-radius: 1px;
  background: var(--section-panel);
}
.copy-icon::before { top: 0; left: 0; }
.copy-icon::after { bottom: 0; right: 0; }
#product-share-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#product-share-fallback {
  padding: 14px clamp(18px, 3.2vw, 42px);
  border-bottom: 1px solid var(--section-rule);
}
#product-share-fallback label { display: block; margin-bottom: 6px; color: #dfd4c3; font-size: 13px; }
#product-share-url {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--section-rule);
  padding: 8px 11px;
  color: #f4e7d1;
  background: var(--section-panel);
  font-size: 16px;
}
#product-pages {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 5px;
  align-items: center;
  padding: 6px clamp(14px, 3.2vw, 42px);
  border-top: 1px solid var(--section-rule);
  background: var(--section-panel);
}
#product-pages button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: #f0e5d8;
  font: 550 14px/1 var(--sans);
}
#product-prev { justify-self: start; }
#product-next { justify-self: end; }
#product-pages button span { color: var(--section-accent); }
#product-pages button:disabled { opacity: .48; cursor: default; }
#product-position { color: var(--section-accent); font: 500 13px/1.4 var(--sans); font-variant-numeric: tabular-nums; }
#product-pages button:enabled:hover, #product-share:hover { color: var(--section-accent); }
#product-pages button:focus-visible, #product-share:focus-visible { outline: 2px solid var(--section-accent); outline-offset: 1px; }

.product-spread {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.17fr);
  grid-template-areas: "photo title" "photo facts" "photo notes" "photo demo";
  align-items: start;
  gap: 20px clamp(22px, 3.3vw, 46px);
  padding: clamp(20px, 3.2vw, 42px);
  overflow-wrap: anywhere;
}

#product-title {
  grid-area: title;
  margin: 0;
  color: #faf1e4;
  font: 500 clamp(40px, 4.2vw, 63px)/.99 var(--serif);
  letter-spacing: -.035em;
  text-wrap: balance;
}

.product-illustration {
  grid-area: photo;
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--section-rule);
  background: #a99c8c;
}

.product-illustration::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #ffeed15c;
  pointer-events: none;
}

#product-photo { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }

#product-facts {
  grid-area: facts;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin: 0;
  padding: 14px 0;
  border-block: 1px solid var(--section-rule);
}

#product-facts dt { margin: 0 0 3px; color: #c4b8aa; font: 500 12px/1.3 var(--sans); }
#product-facts dd {
  margin: 0;
  color: var(--section-accent);
  font: 600 21px/1.05 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
}
.product-notes { grid-area: notes; display: grid; gap: 16px; }
.product-notes h3 { margin: 0 0 5px; color: var(--section-accent); font: italic 500 27px/1.06 var(--serif); }
.product-notes p { margin: 0; color: #e7dfd3; font: 400 15px/1.55 var(--sans); }
#product-demo { grid-area: demo; margin: 0; color: #bfb4a6; font: 400 12px/1.45 var(--sans); }

.product-spread:has(.product-illustration[hidden]) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "title" "facts" "notes" "demo";
}

@media (max-width: 680px) {
  .product-sheet { width: min(500px, 100%); }

  .product-spread {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas: "title title" "photo facts" "notes notes" "demo demo";
    grid-auto-rows: max-content;
    gap: 16px clamp(12px, 4vw, 20px);
    padding: 20px clamp(14px, 4vw, 24px);
  }
  .product-bar { gap: 8px; padding-inline: 12px; }
  #product-close { padding-left: 4px; }

  #product-title { font-size: clamp(36px, 9.2vw, 48px); }
  #product-facts { grid-template-columns: minmax(0, 1fr); gap: 6px; border: 0; padding: 0; }
  #product-facts dt { margin-bottom: 1px; }
  #product-facts dd { font-size: 19px; }
  .product-illustration { align-self: center; }
  .product-illustration::after { inset: 5px; }
  .product-notes { border-top: 1px solid var(--section-rule); padding-top: 15px; }
  .card-open-mark { top: 7px; right: 7px; width: 26px; height: 26px; }
}

@media (max-height: 450px) {
  .product-stage { padding-block: 4px; }
  .product-bar { padding-block: 0; }
}

@media (max-width: 680px), (pointer: coarse) {
  .product-sheet { height: min(840px, 100%); }
  .product-bar { position: static; }
  #product-pages { padding-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
  #product-prev, #product-next { justify-self: stretch; }
  #product-pages #product-prev { justify-content: flex-start; }
  #product-pages #product-next { justify-content: flex-end; }
  #product-pages button, .product-bar button { touch-action: manipulation; }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (transition-behavior: allow-discrete) {
    dialog.product-card {
      transition: overlay .17s allow-discrete, display .17s allow-discrete;
    }
    dialog.product-card:not([open]) { pointer-events: none; }
    .product-stage { opacity: 0; transition: opacity .17s ease-out; }
    .product-sheet { transform: translateY(6px); transition: transform .17s ease-out; }
    .product-card[open] .product-stage { opacity: 1; }
    .product-card[open] .product-sheet { transform: none; }
    @starting-style {
      .product-card[open] .product-stage { opacity: 0; }
      .product-card[open] .product-sheet { transform: translateY(6px); }
    }
  }
  .product-card[open] .product-illustration::before {
    content: "";
    position: absolute;
    inset: -30%;
    background: linear-gradient(112deg, transparent 40%, #ffefc83d 50%, transparent 60%);
    animation: product-glint 1.2s .05s ease-in-out both;
    pointer-events: none;
  }
  @keyframes product-glint {
    from { opacity: 0; transform: translateX(-46%); }
    45% { opacity: 1; }
    to { opacity: 0; transform: translateX(46%); }
  }
}
.card-price del, #product-price del {
  display: block;
  color: #bfb4a6;
  font: 400 .7em/1.4 var(--sans);
  text-decoration-thickness: 1px;
}
