/**
 * Editorial Page Builder — блоки страницы в стиле Zara.
 * Подключается только на singular page при наличии блоков.
 */

.pearl-editorial-blocks {
    margin: 2rem 0;
}

.pearl-editorial-block {
    margin-bottom: 3rem;
}

.pearl-editorial-block:last-child {
    margin-bottom: 0;
}

/* ——— Hero ——— */
.pearl-editorial-hero {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.pearl-editorial-hero-media {
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: 70vh;
    background: #f5f5f5;
    position: relative;
}

.pearl-editorial-hero-media-link {
    display: block;
    width: 100%;
    height: 100%;
}

.pearl-editorial-hero-image,
.pearl-editorial-hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    vertical-align: middle;
}

.pearl-editorial-hero-media .pearl-editorial-hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
}

@media (max-width: 768px) {
    .pearl-editorial-hero-media {
        aspect-ratio: 4 / 5;
        max-height: 85vh;
    }
}

.pearl-editorial-hero-caption {
    padding: 1.5rem 0 0;
    max-width: 640px;
}

.pearl-editorial-hero-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 0 0 0.5em;
    line-height: 1.3;
}

.pearl-editorial-hero-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.75em;
}

.pearl-editorial-hero-text p {
    margin: 0 0 0.5em;
}

.pearl-editorial-hero-link {
    display: inline-block;
    text-decoration: underline;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.pearl-editorial-hero-link-wrap {
    position: absolute;
    inset: 0;
    display: block;
}

/* ——— Grids ——— */
.pearl-editorial-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
}

.pearl-editorial-grid-2 {
    grid-template-columns: 1fr;
}

.pearl-editorial-grid-3 {
    grid-template-columns: 1fr;
}

.pearl-editorial-grid-2x2 {
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .pearl-editorial-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pearl-editorial-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pearl-editorial-grid-2x2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .pearl-editorial-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.pearl-editorial-grid-item {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.pearl-editorial-grid-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.pearl-editorial-grid-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 3 / 4;
}

.pearl-editorial-grid-item video.pearl-editorial-grid-media {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

.pearl-editorial-grid-caption {
    display: block;
    padding: 0.75rem 0 0;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* ——— Product carousel ——— */
.pearl-editorial-product-carousel {
    margin-bottom: 2.5rem;
}

.pearl-editorial-carousel-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 0 0 1rem;
}

.pearl-editorial-carousel-track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}

.pearl-editorial-carousel-track::-webkit-scrollbar {
    height: 6px;
}

.pearl-editorial-carousel-track::-webkit-scrollbar-track {
    background: #eee;
}

.pearl-editorial-carousel-track::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.pearl-editorial-carousel-card {
    flex: 0 0 auto;
    width: 180px;
    scroll-snap-align: start;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

@media (min-width: 600px) {
    .pearl-editorial-carousel-card {
        width: 200px;
    }
}

.pearl-editorial-carousel-image-wrap {
    width: 100%;
    background: #f5f5f5;
    overflow: hidden;
}

.pearl-editorial-carousel-ratio-3-4 .pearl-editorial-carousel-image-wrap {
    aspect-ratio: 3 / 4;
}

.pearl-editorial-carousel-ratio-4-5 .pearl-editorial-carousel-image-wrap {
    aspect-ratio: 4 / 5;
}

.pearl-editorial-carousel-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pearl-editorial-carousel-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: #eee;
}

.pearl-editorial-carousel-name {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.3;
}

.pearl-editorial-carousel-price {
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.pearl-editorial-carousel-price del {
    opacity: 0.7;
}

/* ——— Editorial text ——— */
.pearl-editorial-text {
    padding: 1rem 0;
}

.pearl-editorial-text-inner {
    max-width: 640px;
    margin: 0 auto;
}

.pearl-editorial-text-align-center .pearl-editorial-text-inner {
    text-align: center;
}

.pearl-editorial-text-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0 0 0.75em;
    line-height: 1.3;
}

.pearl-editorial-text-body {
    font-size: 1rem;
    line-height: 1.65;
}

.pearl-editorial-text-body p {
    margin: 0 0 1em;
}

.pearl-editorial-text-body p:last-child {
    margin-bottom: 0;
}

/* ——— Lookbook / Hotspot ——— */
.pearl-editorial-lookbook {
    margin-bottom: 3rem;
}

.pearl-editorial-lookbook-header {
    margin-bottom: 1rem;
}

.pearl-editorial-lookbook-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 0 0 0.5em;
    line-height: 1.3;
}

.pearl-editorial-lookbook-text {
    font-size: 1rem;
    line-height: 1.5;
}

.pearl-editorial-lookbook-image-wrap {
    position: relative;
    width: 100%;
    background: #f5f5f5;
}

.pearl-editorial-lookbook-image {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.pearl-editorial-lookbook-hotspot-wrap {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.pearl-editorial-lookbook-hotspot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.pearl-editorial-lookbook-hotspot:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.06);
}

.pearl-editorial-lookbook-hotspot.is-active {
    background: rgba(0, 0, 0, 0.82);
    transform: scale(1.09);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.pearl-editorial-lookbook-hotspot.is-active::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.pearl-editorial-lookbook-hotspot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

.pearl-editorial-lookbook-popup {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 14px);
    transform: translate(-50%, 4px);
    min-width: 190px;
    max-width: 240px;
    padding: 8px 8px 10px;
    background: rgba(14, 14, 14, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    font-size: 0.85rem;
    z-index: 10;
    pointer-events: auto;
    color: #f5f5f5;
    opacity: 0;
    visibility: hidden;
}

.pearl-editorial-lookbook-popup[aria-hidden="true"] {
    display: none;
}

.pearl-editorial-lookbook-popup[aria-hidden="false"] {
    display: block;
    opacity: 1;
    visibility: visible;
    animation: pearl-editorial-lookbook-popup-in 200ms ease-out;
}

@keyframes pearl-editorial-lookbook-popup-in {
    from {
        opacity: 0;
        transform: translate(-50%, 12px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 4px);
    }
}

/* Smart positioning modifiers */
.pearl-editorial-lookbook-popup.pearl-editorial-lookbook-popup--left {
    left: auto;
    right: calc(100% + 14px);
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
}

.pearl-editorial-lookbook-popup.pearl-editorial-lookbook-popup--right {
    left: calc(100% + 14px);
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
}

.pearl-editorial-lookbook-popup.pearl-editorial-lookbook-popup--bottom {
    top: calc(100% + 12px);
    bottom: auto;
    transform: translate(-50%, 0);
}

.pearl-editorial-lookbook-popup-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
}

.pearl-editorial-lookbook-popup-card:hover .pearl-editorial-lookbook-popup-product-title {
    text-decoration: underline;
}

.pearl-editorial-lookbook-popup-product-image {
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 9px;
    overflow: hidden;
    background: #111;
    margin-right: 0;
    margin-bottom: 6px;
}

.pearl-editorial-lookbook-popup-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pearl-editorial-lookbook-popup-product-info {
    margin-top: 4px;
    min-width: 0;
}

.pearl-editorial-lookbook-popup-product-price {
    font-size: 0.75rem;
    color: rgba(245, 245, 245, 0.9);
    text-align: center;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 400;
}

.pearl-editorial-lookbook-popup-label {
    margin: 0 0 4px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

/* Мобильный: popup не выходит за экран */
@media (max-width: 768px) {
    .pearl-editorial-lookbook-popup {
        left: 50%;
        right: auto;
        bottom: auto;
        top: calc(100% + 8px);
        transform: translate(-50%, 0);
        max-width: min(280px, 90vw);
    }
}
