/* ---------- Clickable product cards ---------- */

.product-card {
  cursor: pointer;
  transition: transform 0.45s var(--ease);
}

.product-card:hover {
  transform: translateY(-4px);
}

.product-card__hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  border-radius: 16px;
  background: none;
  cursor: pointer;
}

.product-card__hit:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.product-card__hit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: rgba(17, 17, 17, 0.28);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.product-card__hit::after {
  content: "Подробнее";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  padding: 9px 16px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, -40%) scale(0.92);
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}

.product-card:hover .product-card__hit::before {
  opacity: 1;
}

.product-card:hover .product-card__hit::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.product-card .fav-btn,
.product-card .product-quick {
  z-index: 2;
}

@media (hover: none) {
  .product-card__hit::after {
    display: none;
  }
}

/* ---------- Product window ---------- */

.pmodal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
}

.pmodal[hidden] {
  display: none;
}

.pmodal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.55);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.pmodal__dialog {
  position: relative;
  width: min(1040px, 100%);
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  outline: none;
  opacity: 0;
  transform: translateY(40px) scale(0.96);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}

.pmodal.is-open .pmodal__backdrop {
  opacity: 1;
}

.pmodal.is-open .pmodal__dialog {
  opacity: 1;
  transform: none;
}

.pmodal__grab {
  display: none;
}

.pmodal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.4s var(--ease), background 0.3s ease;
}

.pmodal__close:hover {
  transform: rotate(90deg);
  background: #e6e6e2;
}

.pmodal__close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Photo side */

.pmodal__media {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

.pmodal__photo {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  cursor: zoom-in;
}

.pmodal__photo img {
  position: absolute;
  inset: 0;
  padding: 8%;
  object-fit: contain;
  transition: transform 0.5s var(--ease), opacity 0.45s ease;
  animation: pm-photo-in 0.7s var(--ease) both;
}

.pmodal__photo img.is-old {
  animation: none;
  opacity: 0;
  transform: scale(0.96);
}

.pmodal__photo.is-zoomed img:not(.is-old) {
  transform: scale(1.9);
}

.pmodal__photo .product-badge {
  top: 20px;
  left: 20px;
}

.pmodal__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: #c9c9c4;
}

@keyframes pm-photo-in {
  from {
    opacity: 0;
    transform: translateX(-24px) scale(0.97);
  }
}

.pmodal__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 0 20px;
}

.pmodal__nav[hidden] {
  display: none;
}

.pmodal__step {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s ease;
}

.pmodal__step:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--lime);
}

.pmodal__step svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pmodal__pos {
  min-width: 70px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Info side */

.pmodal__info {
  min-height: 0;
  overflow-y: auto;
  padding: 44px 40px 32px;
  border-left: 1px solid var(--line);
  overscroll-behavior: contain;
}

.pmodal__info > * {
  animation: pm-rise 0.6s var(--ease) backwards;
}

.pmodal.is-open .pmodal__info > :nth-child(2) { animation-delay: 40ms; }
.pmodal.is-open .pmodal__info > :nth-child(3) { animation-delay: 80ms; }
.pmodal.is-open .pmodal__info > :nth-child(4) { animation-delay: 120ms; }
.pmodal.is-open .pmodal__info > :nth-child(n + 5) { animation-delay: 160ms; }

.pmodal__info.is-swapping > * {
  animation-name: pm-swap;
}

@keyframes pm-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes pm-swap {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
}

.pmodal__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 48px 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.pmodal__kicker a {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  transition: background 0.3s ease, color 0.3s ease;
}

.pmodal__kicker a:hover {
  background: var(--lime);
  color: var(--ink);
}

.pmodal__info h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.pmodal__price {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pmodal__price.is-request {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--muted);
}

.pmodal__desc {
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: #3d3d3a;
}

.pmodal__specs {
  margin-top: 16px;
}

.pmodal__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 20px 0 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
  overflow: hidden;
}

.pmodal__facts div {
  padding: 10px 14px;
  background: var(--surface);
}

.pmodal__facts dt {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pmodal__facts dd {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.pmodal__sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.pmodal__sizes legend {
  width: 100%;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
}

.pmodal__sizes legend small {
  margin-left: 6px;
  font-weight: 600;
  color: var(--muted);
}

.pmodal__sizes button {
  min-width: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: none;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s ease, transform 0.3s var(--ease);
}

.pmodal__sizes button:hover {
  border-color: var(--ink);
}

.pmodal__sizes button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  transform: translateY(-2px);
}

.pmodal__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.pmodal__order {
  flex: 1;
  justify-content: space-between;
}

.pmodal__fav {
  position: static;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.pmodal__fav svg {
  width: 24px;
  height: 24px;
}

.pmodal__perks {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 18px 0 0;
  padding: 0;
}

.pmodal__perks li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #4a4a47;
}

.pmodal__perks li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.85);
}

.pmodal__warn {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #111;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.pmodal__more {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.pmodal__more h3 {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 800;
}

.pmodal__more-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pmodal__more-grid button {
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.pmodal__more-grid span {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.pmodal__more-grid img {
  object-fit: contain;
  padding: 8%;
  transition: transform 0.5s var(--ease);
}

.pmodal__more-grid button:hover span {
  border-color: var(--ink);
}

.pmodal__more-grid button:hover img {
  transform: scale(1.06);
}

.pmodal__more-grid strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.pmodal__more-grid small {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.pmodal__close:focus-visible,
.pmodal__step:focus-visible,
.pmodal__sizes button:focus-visible,
.pmodal__more-grid button:focus-visible,
.pmodal__kicker a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- Tablet & phone: bottom sheet ---------- */

@media (max-width: 860px) {
  .pmodal {
    align-items: end;
    padding: 0;
  }

  .pmodal__dialog {
    grid-template-columns: 1fr;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 26px 26px 0 0;
    transform: translateY(100%);
    transition: opacity 0.4s ease, transform 0.55s var(--ease);
    overscroll-behavior: contain;
  }

  .pmodal__grab {
    display: block;
    position: sticky;
    top: 0;
    z-index: 4;
    width: 44px;
    height: 5px;
    margin: 10px auto -15px;
    border-radius: 3px;
    background: rgba(17, 17, 17, 0.25);
  }

  .pmodal__close {
    position: sticky;
    top: 12px;
    margin: -10px 12px -42px auto;
  }

  .pmodal__photo {
    min-height: 0;
    aspect-ratio: 1 / 0.85;
    cursor: default;
  }

  .pmodal__info {
    overflow: visible;
    padding: 24px 20px 32px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .pmodal__nav {
    padding-bottom: 14px;
  }
}

@media (max-width: 480px) {
  .pmodal__facts {
    grid-template-columns: 1fr;
  }

  .pmodal__more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pmodal__fav {
    width: 56px;
    height: 56px;
  }

  .pmodal__order .order-btn__text {
    font-size: 15px;
  }
}
