/* product.css */

#detailed_view {
    background-image: url('/static/images/product/product-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
}

/* Полупрозрачный overlay для лучшей читаемости контента */
#detailed_view::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 248, 244, 0.4); /* --bg-main с прозрачностью */
    z-index: 0;
    pointer-events: none;
}

#detailed_view > * {
    position: relative;
    z-index: 1;
}

/* Строка характеристики: чуть крупнее и контрастнее */
.product-details {
    font-size: 16px;
    font-weight: 400;
    color: rgba(var(--text-main-rgb), 1);
    margin: 0;
    line-height: 1.45;
    letter-spacing: 0.01em;
}

@media (min-width: 768px) {
    .product-details {
        font-size: 18px;
    }
}

/* Подпись характеристики (левая часть строки) */
.product-details-label {
    color: rgba(var(--text-muted-rgb), 1);
    font-weight: 400;
}

.product-main-image {
    position: relative;
    padding-bottom: 100px; /* Место для отражения */
    overflow: visible; /* Разрешаем отражению выходить за границы */
}

/* Product price */
.product-price {
    color: #414141;
    /* font-family: "EB Garamond", "Wix Madefor Display", serif; */
    font-weight: 200;
    font-size: 24px;
}

.price-suffix {
    font-size: 0.72em;
    margin-left: 3px;
}

.product-price-align {
    text-align: center;
}

@media (min-width: 769px) {
    .product-price-align {
        width: 280px;
    }
}

/* Price styled like order button */
.product-price-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 280px;
    height: 48px;
    padding: 0 24px;
    border-radius: 10px;
    background-color: rgba(var(--bg-soft-rgb, #F3EFE8), 0.2);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.08),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
}
@media (max-width: 768px) {
    .product-price {
        font-size: 20px;
    }
    .product-price-button {
        width: 85%;
    }
    .product-order-button {
        width: 85%;
    }
}

.product-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  
    width: 280px;
    min-height: 48px;
    padding: 12px 24px;
  
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
  
    /* Главное: плотнее фон, без прозрачности */
    background-color: rgba(var(--gold-light-rgb), 0.6);
    border: 1px solid rgba(var(--gold-main-rgb), 0.85);
    box-shadow: 0 8px 18px rgba(0,0,0,0.06);
    color: rgba(var(--text-main-rgb), 1);
  
    /* Рамка чуть заметнее */
    border: 1px solid rgba(var(--gold-main-rgb), 0.75);
    border-radius: 10px;
  

  
    cursor: pointer;
    outline: none;
    position: relative;
  
    transition:
      background-color 300ms ease,
      border-color 300ms ease,
      box-shadow 300ms ease,
      transform 120ms ease;
  }

  /* Gold lines on hover */
  .product-order-button::before,
  .product-order-button::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 48px;
    height: 1px;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
  }

  .product-order-button::before {
    left: 10px;
    background: linear-gradient(
      to left,
      var(--gold-main, #C9A45C) 0%,
      rgba(201, 164, 92, 0.7) 30%,
      rgba(201, 164, 92, 0.3) 70%,
      rgba(201, 164, 92, 0) 100%
    );
  }

  .product-order-button::after {
    right: 10px;
    background: linear-gradient(
      to right,
      var(--gold-main, #C9A45C) 0%,
      rgba(201, 164, 92, 0.7) 30%,
      rgba(201, 164, 92, 0.3) 70%,
      rgba(201, 164, 92, 0) 100%
    );
  }

  .product-order-button:hover::before,
  .product-order-button:hover::after {
    opacity: 1;
  }
  
  .product-order-button:hover {
    background-color: rgba(var(--bg-soft-rgb), 0.52);
    border-color: rgba(var(--gold-main-rgb), 0.3);
    transition: background 300ms ease;
    box-shadow:
      0 10px 22px rgba(0, 0, 0, 0.08),
      0 1px 0 rgba(var(--gold-light-rgb), 0.30) inset;
  }
  
  .product-order-button:active {
    transform: translateY(1px);
    box-shadow:
      0 6px 14px rgba(0, 0, 0, 0.06),
      0 1px 0 rgba(var(--gold-light-rgb), 0.22) inset;
  }
  
  .product-order-button:focus-visible {
    box-shadow:
      0 0 0 2px rgba(var(--gold-light-rgb), 0.35),
      0 8px 18px rgba(0, 0, 0, 0.06),
      0 1px 0 rgba(var(--gold-light-rgb), 0.25) inset;
  }

.product-where-buy-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 85%;
    min-height: 36px;
    margin: 2px auto 0;
    text-decoration: none;
    font-size: 1.125rem;
    line-height: 1.2;
    color: rgba(var(--text-main-rgb), 1);
    transition: color 200ms ease, opacity 200ms ease;
}

.product-where-buy-link::before,
.product-where-buy-link::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 54px;
    height: 1px;
    transform: translateY(-50%);
}

.product-where-buy-link::before {
    left: 0;
    background: linear-gradient(
      to left,
      var(--gold-main, #C9A45C) 0%,
      rgba(201, 164, 92, 0.7) 30%,
      rgba(201, 164, 92, 0.3) 70%,
      rgba(201, 164, 92, 0) 100%
    );
}

.product-where-buy-link::after {
    right: 0;
    background: linear-gradient(
      to right,
      var(--gold-main, #C9A45C) 0%,
      rgba(201, 164, 92, 0.7) 30%,
      rgba(201, 164, 92, 0.3) 70%,
      rgba(201, 164, 92, 0) 100%
    );
}

.product-where-buy-link:hover {
    color: rgba(var(--gold-main-rgb), 1);
}
  
  @media (max-width: 640px) {
    .product-order-button {
      width: 85%;
      min-height: 52px;
      font-size: 1.25rem;
      font-weight: 600;
    }
  }

@media (min-width: 768px) {
    .product-where-buy-link {
        width: 280px;
        margin: 2px 0 0;
        font-size: 1.2rem;
    }
}



/* Product tags (non-clickable pills) */
.product-tags {
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 8px;
}

.product-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border-radius: 9999px;
    border: 1px solid rgba(201, 164, 92, 0.35);
    background: rgba(var(--gold-light-rgb), 0.15);
    color: var(--text-main, #1F1F1F);
    font-size: 18px;
    line-height: 1;
    letter-spacing: 0.01em;
    user-select: none;
    transition: background-color 300ms ease-in-out;
}

.product-tag:hover {
    background: rgba(var(--gold-light-rgb), 0.55);
    transition:  300ms ease-in-out;
}

@media (max-width: 768px) {
    .product-tag {
        height: 28px;
        font-size: 16px;
        padding: 0 12px;
    }
}

.product-image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    overflow: visible; /* Разрешаем отражению выходить за границы */
}

.product-main-image .product-main-img {
    max-height: 500px !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    position: relative;
    z-index: 1;
    display: block;
    margin: 0 auto;
    transition: opacity 520ms ease;
    /* Динамическая тень, следующая контуру изображения - как будто кулон стоит на столе */
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.18)) 
            drop-shadow(0 12px 10px rgba(0, 0, 0, 0.12))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

/* Отражение изображения */
.product-main-reflection {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(97%) rotateX(180deg);

    max-height: 500px !important;
    width: 120% !important; /* Расширяем отражение за границы изображения */
    height: auto !important;
    max-width: none !important;
    object-fit: contain;
    object-position: center;
    /* Плавное затухание: сильное вверху, размывается в области thumbnails, полностью прозрачно внизу */
    mask-image: linear-gradient(to top, 
        rgba(0, 0, 0, 0.4) 0%, 
        rgba(0, 0, 0, 0.2) 3%,
        rgba(0, 0, 0, 0.05) 20%,
        rgba(0, 0, 0, 0) 40%,
        transparent 100%);
    -webkit-mask-image: linear-gradient(to top, 
    rgba(0, 0, 0, 0.4) 0%, 
    rgba(0, 0, 0, 0.2) 3%,
    rgba(0, 0, 0, 0.05) 20%,
    rgba(0, 0, 0, 0) 40%,
        transparent 100%);
    pointer-events: none;
    z-index: -10;
    transition: opacity 220ms ease;
    /* Ограничиваем высоту, чтобы не опускаться ниже thumbnails */
    clip-path: inset(70% 0 0 0);
}

/* Плавная смена десктопного изображения и отражения */
.product-image-wrapper.is-fading .product-main-img,
.product-image-wrapper.is-fading .product-main-reflection {
    opacity: 0;
}

.ar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
}

.ar-button:hover {
    background-color: #444;
}

.ar-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

summary::-webkit-details-marker {
    display: none;
}
summary::marker {
    display: none !important;
}

summary::-webkit-details-marker,
summary::marker {
    display:  none !important;
}

details summary {
    list-style: none;
}

details[open] .arrow {
    transform: rotate(180deg);
}

.title-overline {
    position: relative;
    margin: 0 1.5rem 0rem 1.5rem;
}

.title-overline::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: #1F2937;
}

.dark .title-overline::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: #F2F4F6;
}

/* Галерея продукта */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-main-image {
    width: 100%;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
 
    padding: 24px;
}

.product-main-image img {
    max-height: 600px;
    width: auto;
}

.product-thumbnails {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    overflow-x: auto;
    padding: 8px 8px;
}

.product-thumbnail {
    flex-shrink: 0 !important;
    width: 100px !important;
    height: 100px !important;
    display: block !important;
    border: 2px solid var(--line-light, #E2DED7) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url('/static/images/product/product-bg.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    padding: 4px !important;
}

.product-thumbnail:hover {
    border-color: var(--gold-main, #C9A45C) !important;
    transform: scale(1.05);
}

.product-thumbnail.active {
    border-color: var(--gold-main, #C9A45C) !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 2px rgba(201, 164, 92, 0.2);
}

.product-thumbnail img,
.product-thumbnail-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

/* Мобильная галерея с отражением */
.product-gallery-mobile {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.product-mobile-image-wrapper {
    position: relative;
    overflow: visible;
    z-index: 0;
}

/* Даём место тени снизу (overflow у контейнера режет drop-shadow) */
#slider-container {
    padding-bottom: 5px;
}

.product-mobile-slide {
    position: relative;
    min-height: 20rem; /* как h-80 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-mobile-slide-img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 20rem !important;
    margin: 0 auto;
    /* Та же тень, что на десктопе у .product-main-img */
    filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.18))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.product-mobile-reflection-layer {
    position: absolute;
    top: 95%; /* высота мобильного изображения (h-80) */
    left: 0;
    right: 0;
    height: 120px;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.product-mobile-reflection-track {
    display: flex;
    width: 100%;
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.product-mobile-reflection-slide {
    position: relative;
}

.product-mobile-reflection-img {
    width: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    z-index: -20;
    /* height: 120px; */
    object-fit: contain;
    object-position: bottom center;
    transform: rotateX(180deg);
    /* Маска как на десктопе: верх отражения полностью прозрачный (убирает "стык" с тенью) */
    mask-image: linear-gradient(to top,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.2) 3%,
        rgba(0, 0, 0, 0.05) 20%,
        rgba(0, 0, 0, 0) 40%,
        transparent 100%);
    -webkit-mask-image: linear-gradient(to top,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.2) 3%,
        rgba(0, 0, 0, 0.05) 20%,
        rgba(0, 0, 0, 0) 40%,
        transparent 100%);
}

.product-thumbnails-mobile {
    position: relative;
    z-index: 10; /* гарантированно выше отражения */
    border-radius: 12px;
    padding: 8px 10px;
}

/* Слайдер и отражение должны анимироваться абсолютно одинаково */
#slider {
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    #slider,
    .product-mobile-reflection-track {
        transition: none !important;
    }
}

/* Буквица: fallback для Firefox (float), initial-letter для Safari/Chrome.
   CKEditor оборачивает текст в <p>, поэтому в Firefox ::first-letter у .description
   не срабатывает — первая буква внутри дочернего элемента. Добавляем селектор
   по первому абзацу / первому блоку. */
.description::first-letter,
.description > p:first-of-type::first-letter,
.description > *:first-child::first-letter {
  margin-right: 10px;
  float: left;
  font-size: 2.8em;
  line-height: 1;
  font-weight: inherit;
  margin-top: 0.14em;
  padding-top: 0.04em;
}

@supports (initial-letter: 2) or (-webkit-initial-letter: 2) {
  .description::first-letter,
  .description > p:first-of-type::first-letter,
  .description > *:first-child::first-letter {
    float: none;
    font-size: inherit;
    initial-letter: 2;
    -webkit-initial-letter: 2;
  }
}
