/*
 * P05 product card in the sample layout (remix stage 3, S08/S09): WooCommerce
 * gallery left and summary right from 992, one column below; tabs from 768,
 * an accordion below. The row of other products is in pages.css (shared with P01).
 */

.ti28-product {
  display: grid;
  gap: var(--ti28-space-6);
}

.ti28-product > * {
  min-width: 0;
}

/* Photo, title, summary on phones; from 992 the photo spans both rows on the left. */
.ti28-product__top {
  display: grid;
  grid-template-areas: "gallery" "title" "summary";
  gap: var(--ti28-space-4);
}

.ti28-product__top > .ti28-product__title {
  grid-area: title;
}

.ti28-product__gallery {
  grid-area: gallery;
}

.ti28-product__summary {
  grid-area: summary;
}

.ti28-product__top > * {
  min-width: 0;
}

@media (min-width: 992px) {
  .ti28-product__top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "gallery title" "gallery summary";
    gap: 0 var(--ti28-space-6);
    align-items: start;
  }

  /* The photo stays in view next to a long summary (VIS-15). */
  .ti28-product__gallery {
    position: sticky;
    top: calc(64px + var(--ti28-space-4));
  }
}

/* Gallery: Storefront floats it at 41%; here it fills its column. */
.ti28-product .woocommerce-product-gallery {
  position: relative;
  float: none;
  width: 100%;
  margin: 0;
}

.ti28-product .woocommerce-product-gallery__wrapper {
  margin: 0;
}

.ti28-product .woocommerce-product-gallery__image,
.ti28-product .woocommerce-product-gallery .flex-viewport {
  overflow: hidden;
  background: var(--ti28-surface-media);
  border-radius: var(--ti28-radius-panel);
}

.ti28-product .woocommerce-product-gallery__image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

/* The sample has no magnifier: the large photo itself opens the lightbox. */
.ti28-product .woocommerce-product-gallery__trigger {
  display: none;
}

.ti28-product .flex-control-thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ti28-space-2);
  margin: var(--ti28-space-3) 0 0;
  padding: 0;
  list-style: none;
}

/* Phones: thumbnails in one scrolling row, the price comes sooner (UX-07). */
@media (max-width: 767px) {
  .ti28-product .flex-control-thumbs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 4px;
  }

  .ti28-product .flex-control-thumbs li {
    flex: 0 0 auto;
  }
}

.ti28-product .flex-control-thumbs li {
  width: 72px !important;
  margin: 0 !important;
  float: none !important;
}

.ti28-product .flex-control-thumbs img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: var(--ti28-surface-media);
  border: 2px solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-control);
  opacity: 1;
  cursor: pointer;
}

.ti28-product .flex-control-thumbs img.flex-active {
  border-color: var(--ti28-link-light);
}

/* Neutral placeholder, no lookalike illustration (ST8, «Фото уточняется»). */
.ti28-product__noimage,
.ti28-product .ti28-noimage {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 240px;
  padding: var(--ti28-space-4);
  background: var(--ti28-surface-page);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-panel);
  color: var(--ti28-text-secondary);
}

.ti28-product__title {
  margin: 0 0 var(--ti28-space-3);
  font-size: clamp(26px, calc(26px + 6 * (100vw - 390px) / 1050), 32px);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ti28-product__identity p {
  margin: 0 0 var(--ti28-space-2);
}

.ti28-product__number {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--ti28-space-1);
  overflow-wrap: anywhere;
}

.ti28-product__number .ti28-mono {
  padding: 2px var(--ti28-space-2);
  background: var(--ti28-surface-panel);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-control);
}

.ti28-product__number .ti28-caption {
  margin: 0;
}

/* Country and condition chips under the number (sample: «Китай», «Новый»). */
.ti28-product__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ti28-space-2);
  margin: var(--ti28-space-2) 0 0;
  padding: 0;
  list-style: none;
}

.ti28-product__chips li {
  padding: 2px var(--ti28-space-2);
  background: var(--ti28-surface-panel);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-control);
  font-size: var(--ti28-text-caption);
  font-weight: 600;
}

/* Price card (sample: price block above the buy row). */
.ti28-product__buy {
  margin-top: var(--ti28-space-4);
  padding: var(--ti28-space-4) var(--ti28-space-5);
  background: var(--ti28-surface-accent-soft);
  border-radius: var(--ti28-radius-panel);
}

.ti28-product__buy p {
  margin: 0 0 var(--ti28-space-2);
}

.ti28-product__buy .ti28-price {
  margin-bottom: var(--ti28-space-2);
  font-size: var(--ti28-text-price);
  font-weight: 600;
}

.ti28-product__warning,
.ti28-product__status {
  color: var(--ti28-text-secondary);
  font-size: var(--ti28-text-caption);
}

.ti28-product__buy .ti28-notice {
  margin-bottom: var(--ti28-space-3);
}

.ti28-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--ti28-space-2);
  margin: var(--ti28-space-3) 0 0;
}

.ti28-buy .ti28-qty {
  flex: 0 0 auto;
}

.ti28-buy__submit {
  flex: 1 1 140px;
}

.ti28-buy__ask {
  flex: 1 1 180px;
}

.ti28-buy__error {
  flex: 1 1 100%;
  margin: 0;
}

.ti28-product__callback {
  margin-top: var(--ti28-space-3);
}

/* WooCommerce notices inside the buy panel use the ST8 notice look. */
.ti28-product__notices .woocommerce-message,
.ti28-product__notices .woocommerce-error,
.ti28-product__notices .woocommerce-info {
  margin: 0 0 var(--ti28-space-4);
  padding: var(--ti28-space-4);
  border: 0;
  border-radius: var(--ti28-radius-panel);
  color: var(--ti28-text-primary);
  list-style: none;
}

.ti28-product__notices .woocommerce-message::before,
.ti28-product__notices .woocommerce-error::before,
.ti28-product__notices .woocommerce-info::before {
  content: none;
}

/* Shown only after the cart confirmed the line on the server (ST9 P05-02). */
.ti28-product__notices .woocommerce-message {
  background: var(--ti28-success-surface);
}

.ti28-product__notices .woocommerce-error {
  background: var(--ti28-error-surface);
}

.ti28-product__notices .woocommerce-error li {
  margin: 0;
}

.ti28-product__notices a.button {
  display: none;
}

.ti28-product__contact {
  margin-top: var(--ti28-space-3);
  padding: var(--ti28-space-4);
  background: var(--ti28-surface-panel);
  border-radius: var(--ti28-radius-panel);
}

.ti28-product__contact a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ti28-target-min);
  margin-right: var(--ti28-space-4);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ti28-product__benefits,
.ti28-product__brief {
  margin: var(--ti28-space-4) 0 0;
  padding: var(--ti28-space-3) var(--ti28-space-4);
  background: var(--ti28-surface-panel);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-panel);
  list-style: none;
}

.ti28-product__benefits li {
  display: flex;
  gap: var(--ti28-space-3);
  padding: var(--ti28-space-2) 0;
}

.ti28-product__benefits .ti28-icon {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--ti28-action-primary);
}

.ti28-product__brief div {
  display: flex;
  justify-content: space-between;
  gap: var(--ti28-space-4);
  padding: var(--ti28-space-2) 0;
}

.ti28-product__brief div + div {
  border-top: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
}

.ti28-product__brief dt {
  color: var(--ti28-text-secondary);
  font-weight: 400;
}

.ti28-product__brief dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.ti28-product__sections {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ti28-space-2);
  margin: var(--ti28-space-4) 0 0;
  color: var(--ti28-text-secondary);
  font-size: var(--ti28-text-caption);
}

/* Chip look comes from pages.css (loaded on P05 too). */
.ti28-product__sections .ti28-chip {
  min-height: 36px;
}

/* Tabs (from 768) and accordion (below), sample S09 ------------------------- */

.ti28-ptabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ti28-space-2);
  margin-bottom: var(--ti28-space-3);
}

.ti28-ptabs__tab {
  min-height: var(--ti28-button-min-height);
  padding: 0 var(--ti28-space-4);
  background: var(--ti28-surface-panel);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-control);
  color: var(--ti28-text-primary);
  font: 600 var(--ti28-text-body) / var(--ti28-line-height) var(--ti28-font-sans);
  cursor: pointer;
}

.ti28-ptabs__tab[aria-selected="true"] {
  background: var(--ti28-action-primary);
  border-color: var(--ti28-link-light);
  color: var(--ti28-action-foreground);
}

.ti28-ptabs__panel {
  margin-bottom: var(--ti28-space-3);
  padding: var(--ti28-space-5);
  background: var(--ti28-surface-panel);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-panel);
}

.ti28-ptabs__heading {
  margin: 0 0 var(--ti28-space-3);
  font-size: var(--ti28-text-h-section);
}

.ti28-ptabs__body h3 {
  margin: var(--ti28-space-4) 0 var(--ti28-space-2);
  font-size: 18px;
}

.ti28-ptabs__body h3:first-child {
  margin-top: 0;
}

.ti28-ptabs__body p:last-child {
  margin-bottom: 0;
}

/* «Особенности» under the description: closed by default, like the sample. */
.ti28-product__features {
  margin-top: var(--ti28-space-4);
  border-top: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
}

.ti28-product__features > summary {
  display: flex;
  align-items: center;
  min-height: var(--ti28-target-min);
  font-weight: 600;
  cursor: pointer;
}

/* Delivery tab: three cards in a row from 768, stacked below (sample S09). */
.ti28-pdelivery {
  display: grid;
  gap: var(--ti28-space-3);
}

.ti28-pdelivery__card {
  padding: var(--ti28-space-4);
  background: var(--ti28-surface-panel);
  border: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  border-radius: var(--ti28-radius-panel);
}

.ti28-ptabs__body .ti28-pdelivery__card h3 {
  margin-top: 0;
}

.ti28-pdelivery__links {
  margin-top: var(--ti28-space-4);
}

@media (min-width: 768px) {
  .ti28-pdelivery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tabs mode: the tab names the panel, the heading stays for the outline. */
.ti28-ptabs.is-tabs .ti28-ptabs__heading {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Accordion mode: the heading holds the toggle; the panel is a plain list row. */
.ti28-ptabs.is-accordion .ti28-ptabs__panel {
  padding: 0;
}

.ti28-ptabs.is-accordion .ti28-ptabs__heading {
  margin: 0;
}

.ti28-ptabs.is-accordion .ti28-ptabs__label {
  display: none;
}

.ti28-ptabs__acc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  padding: 0 var(--ti28-space-4);
  border: 0;
  background: none;
  color: var(--ti28-text-primary);
  font: 600 18px / var(--ti28-line-height) var(--ti28-font-sans);
  text-align: left;
  cursor: pointer;
}

/* display is explicit: a Storefront rule hides ::after on product page buttons. */
.ti28-ptabs__acc::after {
  content: "";
  display: block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.ti28-ptabs__acc[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

.ti28-ptabs__acc:focus-visible {
  outline-offset: -4px;
}

.ti28-ptabs.is-accordion .ti28-ptabs__body {
  padding: 0 var(--ti28-space-4) var(--ti28-space-4);
}

.ti28-prose p {
  margin: 0 0 var(--ti28-space-3);
}

.ti28-specs {
  overflow-x: auto;
}

/* style.css makes .shop_attributes a scrolling block; here the wrapper scrolls. */
.ti28-specs table.shop_attributes {
  display: table;
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
}

.ti28-specs tr {
  background: none !important;
}

.ti28-specs th,
.ti28-specs td {
  padding: var(--ti28-space-2) 0;
  border-bottom: var(--ti28-border-decorative-width) solid var(--ti28-border-decorative);
  background: none;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}

.ti28-specs th {
  width: 40%;
  padding-right: var(--ti28-space-4);
  color: var(--ti28-text-secondary);
}

.ti28-specs td p {
  margin: 0;
}

@media print {
  .ti28-buy,
  .ti28-product__copy {
    display: none !important;
  }
}
