/* Товарная карточка услуги: галерея, параметры и загрузка. */
.product-page {
  padding-top: 10px;
}

.product-page .service-breadcrumbs {
  margin-bottom: 14px;
}

.product-layout {
  display: grid;
  max-width: 1300px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 600px;
  gap: 0 32px;
  align-items: start;
}

.product-main {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  gap: 26px;
  align-content: start;
  min-width: 0;
}

.product-gallery {
  min-width: 0;
  max-width: none;
}

.product-gallery-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f3efe7;
}

.product-gallery-track {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  outline: none;
}

.product-gallery-track::-webkit-scrollbar {
  display: none;
}

.product-gallery-slide {
  display: grid;
  flex: 0 0 100%;
  place-items: center;
  height: clamp(280px, 40vw, 420px);
  margin: 0;
  scroll-snap-align: start;
  background: #f3efe7;
}

.product-gallery-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.product-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(23, 23, 23, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

.product-gallery-nav:hover {
  background: var(--accent);
  transform: scale(1.04);
}

.product-gallery-nav:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.product-gallery-nav svg {
  width: 17px;
  height: 17px;
}

.product-gallery-nav--prev {
  left: 12px;
}

.product-gallery-nav--next {
  right: 12px;
}

.product-gallery-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 8px;
}

.product-gallery-dot {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 50%;
  background: #d8d2c8;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.product-gallery-dot.is-active {
  width: 18px;
  border-radius: 999px;
  background: var(--text);
}

.product-description {
  max-width: none;
  padding-top: 4px;
  align-self: start;
  justify-self: stretch;
}

.product-description h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.product-description p {
  margin: 0 0 10px;
  color: #5c5a55;
  font-size: 14px;
  line-height: 1.6;
}

.product-facts {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
}

.product-facts > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.product-facts dt {
  color: var(--muted);
}

.product-facts dd {
  margin: 0;
}

.product-prices {
  margin: 20px 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.product-prices h3,
.product-faq h3 {
  margin: 0 0 10px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.product-prices-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  font-size: 12.5px;
}

.product-prices-table th,
.product-prices-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.product-prices-table th:first-child,
.product-prices-table td:first-child {
  text-align: left;
}

.product-prices-table th {
  background: #f7f3eb;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.product-prices-table thead th {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.product-prices-table thead th:first-child {
  border-left: 1px solid var(--line);
}

.product-prices-table thead th:last-child {
  border-right: 1px solid var(--line);
}

.product-prices-table tr:last-child td {
  border-bottom: 0;
}

/* Небольшие прайсы «Услуга — Цена» не растягиваем на всю ширину описания. */
.product-prices-table--list {
  max-width: 400px;
}

.product-faq {
  margin-top: 24px;
}

.product-faq a,
.product-note a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.product-faq details {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.product-faq summary {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.product-faq details p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.product-description-note {
  margin-top: 14px !important;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f3eb;
  font-size: 12px !important;
}

/* Правая колонка */

.product-buy {
  position: sticky;
  top: 68px;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 23, 23, 0.04);
}

.product-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.product-badge::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-deep);
  content: "";
}

.product-title {
  margin: 12px 0 8px;
  font-size: clamp(25px, 2.6vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.product-price {
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.product-price.product-price--text {
  font-size: 22px;
  letter-spacing: -0.01em;
}

.product-price-note {
  color: var(--muted);
  font-size: 12px;
}

.product-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.product-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-field--qty {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.product-field-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-field-value {
  color: var(--muted);
  font-size: 11px;
}

.product-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.product-option {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.product-option:hover:not(:disabled) {
  border-color: var(--line-strong);
}

.product-option.is-active {
  border-color: var(--text);
  background: #f7f3eb;
  box-shadow: inset 0 0 0 1px var(--text);
}

.product-option:disabled {
  opacity: 0.32;
  cursor: default;
}

.product-option small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.product-options--sizes .product-option {
  min-width: 72px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.product-options--paper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-options--paper .product-option {
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.product-options--request {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-options--request .product-option {
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.product-options--quality .product-option {
  flex: 1;
  min-width: 92px;
}

.product-options--quality .product-option small {
  font-variant-numeric: tabular-nums;
}

.product-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.product-qty button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.product-qty button:hover {
  background: #f7f3eb;
}

.product-qty input {
  width: 38px;
  height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

.product-qty input::-webkit-outer-spin-button,
.product-qty input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.product-upload-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-upload-error {
  margin: 0;
  color: #9b2c1f;
  font-size: 11.5px;
  line-height: 1.4;
}

.product-field-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.product-form .addon-option input:disabled {
  opacity: 0.4;
}

.product-form .addon-option:has(input:disabled) {
  opacity: 0.6;
  cursor: default;
}

.doc-page-list {
  margin: 2px 0 0;
}

/* Документы: широкие кнопки формата и цветности, допуслуги в 2 колонки. */
@media (min-width: 521px) {
  #docPageOrderForm .product-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #docPageOrderForm .product-option {
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
}

/* Допуслуги в 2 колонки, когда сама карточка заказа достаточно широкая,
   независимо от того, стоит она сбоку или в одну колонку. */
#docPageOrderForm {
  container-type: inline-size;
}

.doc-fill-slot:empty {
  display: none;
}

.doc-fill {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  background: #f3f1ec;
  color: #5b574f;
  font-size: 11.5px;
  line-height: 1.4;
}

.doc-fill svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.doc-fill--checking {
  background: #f1f3f5;
  color: #5a5f66;
}

.doc-fill--warn {
  background: #fff4d9;
  color: #7a5300;
}

.doc-fill--ok {
  background: #eef7ec;
  color: #356b2f;
}

.doc-fill--muted {
  background: #f5f3ef;
  color: #756f64;
}

.doc-fill-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
  cursor: pointer;
}

.doc-fill-link:hover {
  color: #000;
}

.doc-fill-link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 3px;
}

.doc-fill-note {
  opacity: 0.85;
}

.doc-fill-spinner {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: docFillSpin 0.8s linear infinite;
}

@keyframes docFillSpin {
  to {
    transform: rotate(360deg);
  }
}

@container (min-width: 520px) {
  #docPageOrderForm .addon-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .product-form,
  .product-upload-field,
  .doc-page-list {
    min-width: 0;
    max-width: 100%;
  }

  .product-field-head {
    flex-wrap: wrap;
  }

  .product-files-count {
    max-width: 100%;
    gap: 5px;
    font-size: 10px;
  }

  .doc-page-list .photo-item {
    gap: 8px;
    padding: 8px;
  }

  .doc-page-list .photo-thumb,
  .doc-page-list .doc-type {
    width: 44px;
    height: 56px;
  }

  .doc-page-list .photo-main {
    min-width: 0;
  }

  .doc-page-list .photo-line {
    flex-wrap: wrap;
    gap: 4px;
  }

  .doc-page-list .photo-name {
    flex: 1 1 120px;
    min-width: 0;
  }

  .doc-page-list .photo-dims {
    flex: 1 1 auto;
    white-space: normal;
  }

  .doc-page-list .doc-remove {
    margin-left: auto;
  }

  .doc-page-list .photo-tools {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }

  .doc-page-list .doc-field {
    flex: 1 1 120px;
    min-width: 0;
  }

  .doc-page-list .doc-stepper {
    width: 100%;
    justify-content: space-between;
  }

  .doc-page-list .doc-stepper input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .doc-page-list .doc-stepper--static {
    justify-content: center;
  }
}

.product-files {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-file {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-file-thumb {
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 5px;
  background: #eee9df;
}

.product-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-file-thumb.is-loading {
  display: grid;
  place-items: center;
  border: 0;
  cursor: default;
}

.product-file-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #ddd6c9;
  border-top-color: #8a7f6d;
  border-radius: 50%;
  animation: product-file-spin 0.8s linear infinite;
}

@keyframes product-file-spin {
  to {
    transform: rotate(360deg);
  }
}

.product-file-name {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-file-size {
  color: var(--muted);
  font-size: 10px;
}

.product-file-remove {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #f4f0e8;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.product-file-remove:hover {
  background: #f5e8e5;
  color: #8a3a2c;
}

.product-file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.product-file-edit {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.product-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.product-summary-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.product-summary-hint {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.product-total {
  font-size: 24px;
  letter-spacing: -0.03em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.product-add {
  width: 100%;
  min-height: 48px;
  font-size: 14px;
}

.product-add:disabled {
  opacity: 0.45;
  cursor: default;
}

.product-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .product-layout {
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 0 26px;
  }

  .product-main {
    gap: 22px;
  }

  .product-buy {
    padding: 18px;
  }
}

@media (max-width: 820px) {
  .product-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .product-main {
    display: contents;
  }

  .product-gallery {
    order: 1;
    max-width: none;
  }

  .product-buy {
    order: 2;
    position: static;
    width: 100%;
    max-width: 600px;
    margin-right: auto;
    margin-left: auto;
  }

  .product-description {
    order: 3;
    max-width: none;
    padding-top: 4px;
  }
}

@media (max-width: 520px) {
  .product-gallery-slide {
    height: 280px;
  }

  .product-buy {
    padding: 16px;
    border-radius: 14px;
  }

  .product-title {
    font-size: 26px;
  }

  .product-price {
    font-size: 30px;
  }

  .product-option {
    flex: 1;
  }

  .product-options--sizes .product-option {
    flex: 0 0 calc(33.333% - 5px);
    min-width: 0;
  }

  .product-facts > div {
    grid-template-columns: 92px minmax(0, 1fr);
  }
}

.product-prices-format {
  color: var(--muted);
  font-size: 10.5px;
}

.product-file-edit:disabled {
  opacity: 0.4;
  cursor: default;
  text-decoration: none;
}

.product-file {
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  grid-template-areas: "thumb copy qty actions";
}

.product-file-thumb {
  grid-area: thumb;
}

.product-file-copy {
  display: flex;
  flex-direction: column;
  grid-area: copy;
  min-width: 0;
}

.product-file-name,
.product-file-size {
  display: block;
}

.product-file-size {
  margin-top: 1px;
  line-height: 1.35;
}

.product-file-changed {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e4f2e7;
  color: #2f6b3a;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.product-file-qty {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  grid-area: qty;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.product-file-qty button {
  flex: 0 0 25px;
  width: 25px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.product-file-qty button:hover {
  background: #f7f3eb;
}

.product-file-qty input {
  flex: 0 0 30px;
  width: 30px;
  height: 28px;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

.product-file-qty input::-webkit-outer-spin-button,
.product-file-qty input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.product-file-actions {
  grid-area: actions;
}

@media (max-width: 520px) {
  .product-prices {
    overflow-x: visible;
  }

  .product-prices h3 {
    font-size: clamp(16px, 4vw, 18px);
  }

  .product-prices-table {
    font-size: clamp(11px, 3.6vw, 12.5px);
  }

  .product-prices-table th,
  .product-prices-table td {
    padding: 6px 4px;
  }

  .product-prices-table th {
    font-size: clamp(9px, 2.8vw, 10.5px);
    letter-spacing: 0;
  }

  .product-prices-table th:first-child,
  .product-prices-table td:first-child {
    width: 27%;
  }

  /* Прайс «Услуга — Цена»: название занимает всё свободное место,
     а колонка цены сжимается по содержимому. */
  .product-prices-table--list {
    table-layout: auto;
  }

  .product-prices-table--list th:first-child,
  .product-prices-table--list td:first-child {
    width: auto;
  }

  .product-prices-table--list th:last-child,
  .product-prices-table--list td:last-child {
    width: 1%;
    white-space: nowrap;
  }

  .product-file {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb copy actions"
      "thumb qty actions";
    align-items: start;
  }

  .product-file-qty {
    margin-top: 3px;
  }

  .product-file-actions {
    align-self: center;
  }
}

.product-file-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.product-file-badges .product-file-changed,
.product-file-badges .product-file-quality {
  margin-top: 0;
}

.product-file-quality {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f5e8e5;
  color: #8a3a2c;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.product-file-thumb {
  display: block;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.product-file-name[role="button"] {
  cursor: pointer;
}

.product-file-name[role="button"]:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.product-divider {
  height: 1px;
  margin: 4px 0 2px;
  background: var(--line);
}

.product-files-count {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.product-files-count.is-over {
  color: #b42318;
}

.product-files-count.is-over .product-files-sep {
  color: inherit;
}

.product-files-count > span {
  white-space: nowrap;
}

.product-files-sep {
  color: var(--muted);
}
