/*
 * Complex (Цогцолбор) detail + index pages.
 * Layout primitives (.ub-page, .ub-container--wide, .ub-split, .ub-sidebar,
 * .ub-card) come from base.css/components.css — keep complex-specific styles
 * here. The detail page owns ALL .ub-complex__* rules (hero, tour, about,
 * location, map, gallery); the index page owns .ub-complex-list*.
 */

/* ============================================================
   HERO — full-bleed band above the split. Cover image when the
   site has one, else a warm brand→accent gradient. A dark scrim
   keeps the eyebrow / title / address legible either way.
   ============================================================ */
.ub-complex-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    min-height: clamp(320px, 46vh, 500px);
    color: var(--ub-color-on-brand);
    background:
        linear-gradient(135deg,
            var(--ub-color-brand-soft) 0%,
            var(--ub-color-accent) 62%,
            var(--ub-color-section-dark) 100%);
    background-color: var(--ub-color-accent);
}

.ub-complex-hero--image {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: var(--ub-color-heading);
}

.ub-complex-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(29, 29, 31, 0.30) 0%,
        rgba(29, 29, 31, 0.18) 38%,
        rgba(29, 29, 31, 0.74) 100%);
    pointer-events: none;
}

.ub-complex-hero__content {
    position: relative;
    z-index: 1;
    width: 100%;
    padding-block: clamp(48px, 7vw, 96px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--ub-space-l);
}

.ub-complex-hero__lotus {
    width: var(--ub-size-icon-chip-md);
    height: var(--ub-size-icon-chip-md);
    object-fit: contain;
    margin-bottom: var(--ub-space-s);
    /* Lotus PNG is dark-inked — lift it onto the dark scrim. */
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.ub-complex-hero__eyebrow {
    font-size: var(--ub-text-xs);
    font-weight: 600;
    line-height: 1.4;
    color: var(--ub-color-on-brand);
    text-transform: uppercase;
    letter-spacing: var(--ub-tracking-eyebrow);
    opacity: 0.92;
}

.ub-complex-hero__title {
    font-family: var(--ub-font-display);
    font-size: clamp(var(--ub-text-3xl), 5vw, var(--ub-text-5xl));
    font-weight: 600;
    line-height: var(--ub-leading-display);
    letter-spacing: var(--ub-tracking-display);
    color: var(--ub-color-on-brand);
    max-width: 22ch;
}

.ub-complex-hero__lede {
    display: flex;
    align-items: center;
    gap: var(--ub-space-s);
    margin-top: var(--ub-space-s);
    font-size: clamp(var(--ub-text-md), 1.4vw, var(--ub-text-lg));
    line-height: var(--ub-leading-snug);
    color: rgba(255, 255, 255, 0.92);
}

.ub-complex-hero__lede-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--ub-color-brand-soft);
}

/* ============================================================
   MAIN COLUMN — stacked content blocks with generous rhythm.
   ============================================================ */
.ub-complex__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(var(--ub-space-6xl), 7vw, var(--ub-space-7xl));
}

/* Calm lead line that opens the column — keeps the page from reading as
   empty when a complex has no tour and no gallery. */
.ub-complex__intro {
    margin: 0;
    font-size: clamp(var(--ub-text-md), 1.3vw, var(--ub-text-lg));
    line-height: var(--ub-leading-body);
    color: var(--ub-color-body-muted);
    max-width: 60ch;
}

.ub-complex__block {
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-2xl);
}

/* Section heading: small lotus mark + title — quiet, left-aligned. */
.ub-complex__block-head {
    display: flex;
    align-items: center;
    gap: var(--ub-space-l);
}

.ub-complex__block-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ub-size-icon-chip-sm);
    height: var(--ub-size-icon-chip-sm);
    flex-shrink: 0;
    border-radius: var(--ub-radius-pill);
    background: var(--ub-color-hover-tint);
    color: var(--ub-color-brand);
}

.ub-complex__block-title {
    font-family: var(--ub-font-display);
    font-size: var(--ub-text-2xl);
    font-weight: 600;
    color: var(--ub-color-heading);
    line-height: var(--ub-leading-display);
    letter-spacing: var(--ub-tracking-display);
    margin: 0;
}

/* ============================================================
   VIRTUAL TOUR — framed 16:9, soft border + card shadow.
   ============================================================ */
.ub-complex__tour {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--ub-radius-md);
    border: 1px solid var(--ub-color-divider);
    background-color: var(--ub-color-section-soft);
    box-shadow: var(--ub-shadow-card);
}

/* Empty state: no real tour to fill a 16:9 frame, so cap the height
   and let it read as an intentional notice rather than a vast blank. */
.ub-complex__tour--empty {
    aspect-ratio: auto;
    min-height: var(--ub-size-empty-panel);
}

.ub-complex__tour-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.ub-complex__tour-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ub-space-l);
    background:
        radial-gradient(120% 120% at 50% 0%, var(--ub-color-hover-tint), transparent 60%),
        var(--ub-color-section-soft);
    color: var(--ub-color-body-muted);
    font-size: var(--ub-text-md);
    font-weight: 500;
    padding: var(--ub-space-2xl);
    text-align: center;
}

.ub-complex__tour-placeholder-icon {
    width: var(--ub-size-icon-chip-lg);
    height: var(--ub-size-icon-chip-lg);
    object-fit: contain;
    opacity: 0.55;
}

/* ============================================================
   ABOUT — calm, readable body block.
   ============================================================ */
.ub-complex__description {
    font-size: var(--ub-text-md);
    color: var(--ub-color-body);
    line-height: var(--ub-leading-body);
    margin: 0;
    max-width: 70ch;
}

/* ============================================================
   LOCATION — elegant info card holding the rows + (optional) map.
   ============================================================ */
.ub-complex__location-card {
    background-color: var(--ub-color-section-soft);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-md);
    padding: clamp(var(--ub-space-2xl), 3vw, var(--ub-space-4xl));
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-3xl);
}

.ub-complex__location-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-2xl);
}

.ub-complex__location-row {
    display: flex;
    align-items: center;
    gap: var(--ub-space-xl);
}

.ub-complex__location-icon {
    flex-shrink: 0;
    width: var(--ub-size-icon-chip-md);
    height: var(--ub-size-icon-chip-md);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-accent);
    color: var(--ub-color-on-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ub-complex__location-text {
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-xs);
    min-width: 0;
}

.ub-complex__location-line {
    margin: 0;
    font-size: var(--ub-text-md);
    line-height: var(--ub-leading-snug);
    color: var(--ub-color-body);
}

.ub-complex__location-line a {
    color: inherit;
    transition: color var(--ub-transition-fast);
}

.ub-complex__location-line a:hover {
    color: var(--ub-color-brand);
}

.ub-complex__location-line--strong {
    font-weight: 600;
    color: var(--ub-color-heading);
}

/* ============================================================
   MAP — Google Maps embed, framed inside the location card.
   ============================================================ */
.ub-complex__map {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--ub-radius-sm);
    overflow: hidden;
    border: 1px solid var(--ub-color-divider);
}

.ub-complex__map iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================================
   GALLERY — responsive grid of rounded photos with hover lift.
   ============================================================ */
.ub-complex__gallery-grid {
    display: grid;
    gap: var(--ub-space-xl);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.ub-complex__gallery-item {
    position: relative;
    margin: 0;
    aspect-ratio: 4 / 3;
    border-radius: var(--ub-radius-md);
    overflow: hidden;
    background-color: var(--ub-color-section-soft);
    box-shadow: var(--ub-shadow-card);
    transition: transform var(--ub-transition-base),
                box-shadow var(--ub-transition-base);
}

.ub-complex__gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--ub-shadow-card-hover);
}

.ub-complex__gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--ub-transition-slow);
}

.ub-complex__gallery-item:hover .ub-complex__gallery-img {
    transform: scale(1.04);
}

.ub-complex__gallery-caption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: var(--ub-space-2xl) var(--ub-space-l) var(--ub-space-l);
    font-size: var(--ub-text-sm);
    color: var(--ub-color-on-brand);
    line-height: var(--ub-leading-snug);
    background: linear-gradient(180deg, transparent, rgba(29, 29, 31, 0.72));
}

/* ============================================================
   SIDEBAR — light polish on the shared .ub-sidebar primitive,
   SCOPED to the complex page via the .ub-sidebar--complex modifier
   so other listings (shop, etc.) keep the plain shared look:
   a clear brand accent bar on the current complex.
   ============================================================ */
.ub-sidebar--complex .ub-sidebar__row {
    position: relative;
    padding-inline-start: var(--ub-space-l);
    border-radius: var(--ub-radius-xs);
}

.ub-sidebar--complex .ub-sidebar__row.is-current {
    background-color: var(--ub-color-hover-tint);
    color: var(--ub-color-brand);
}

.ub-sidebar--complex .ub-sidebar__row.is-current::before {
    content: "";
    position: absolute;
    inset-block: var(--ub-space-xs);
    inset-inline-start: 0;
    width: var(--ub-size-hairline);
    border-radius: var(--ub-radius-pill);
    background-color: var(--ub-color-brand);
}

/* The current complex IS the destination — drop its chevron so the row
   reads as "you are here" rather than another link to follow. */
.ub-sidebar--complex .ub-sidebar__row.is-current svg {
    display: none;
}

/* ============================================================
   COMPLEX LIST — index page cards.
   ============================================================ */
.ub-complex-list {
    display: grid;
    gap: var(--ub-space-3xl);
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .ub-complex-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ub-complex-list__card {
    display: flex;
    flex-direction: column;
    background: var(--ub-color-white);
    border: 1px solid var(--ub-color-divider);
    border-radius: var(--ub-radius-md);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    box-shadow: var(--ub-shadow-card);
    transition: transform var(--ub-transition-base),
                box-shadow var(--ub-transition-base);
}

.ub-complex-list__card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ub-shadow-card-hover);
}

.ub-complex-list__cover {
    aspect-ratio: 16 / 9;
    background: var(--ub-color-section-soft) center / cover no-repeat;
}

/* No cover photo: instead of a flat cream rectangle, lay a faint, centered
   lotus watermark — same dignified empty-state treatment as the tour/hero
   placeholders. The pseudo-element keeps the cream background solid while
   only the lotus mark stays faint. */
.ub-complex-list__cover--empty {
    position: relative;
}

.ub-complex-list__cover--empty::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../../images/public/icons/lotus-2Rt0ZoN.png") center / 24% no-repeat;
    opacity: 0.18;
}

.ub-complex-list__body {
    padding: var(--ub-space-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--ub-space-s);
}

.ub-complex-list__name {
    margin: 0;
    font-size: var(--ub-text-xl);
    font-weight: 600;
    color: var(--ub-color-heading);
}

.ub-complex-list__address {
    margin: 0;
    font-size: var(--ub-text-sm);
    color: var(--ub-color-body-muted);
    line-height: var(--ub-leading-snug);
}
