/**
 * com_bzhotspots — "accordion" tile: image with markers + expandable bullets.
 *
 * Rendered by a module or the {bzhotspots} content plugin, so it can land on
 * any page of any template: every colour falls back to a sane literal if the
 * budynok design tokens aren't on the page.
 *
 * Progressive enhancement — with no JavaScript every bullet stays open and
 * readable; accordion.js adds .bzacc--js, which is what enables collapsing.
 */

.bzacc {
    --bzacc-accent: var(--c-ginger, #E8821E);
    --bzacc-ink: var(--c-coffee, #4A3426);
    --bzacc-text: var(--c-text, #3A2C20);
    --bzacc-line: var(--c-line, #E5DDD0);
    --bzacc-card: var(--c-card, #FFFDF9);
    --bzacc-muted: var(--c-muted, #8B8072);

    color: var(--bzacc-text);
    margin: 0 0 var(--space-6, 32px);
}

.bzacc__heading {
    font-family: var(--font-heading, Georgia, serif);
    color: var(--bzacc-ink);
    margin: 0 0 var(--space-5, 24px);
}

/* Image column = the tile's own "image width" setting (--bzacc-figw, a share
   of the block) but never wider than the photo's real pixel size
   (--bzacc-figmax) — both set inline by AccordionHelper. Capping the COLUMN
   and not just the image matters: on a 2400px page a 50% column would
   otherwise sit half empty next to a 700px photo. */
.bzacc__grid {
    display: grid;
    grid-template-columns:
        minmax(0, min(var(--bzacc-figw, 50%), var(--bzacc-figmax, 100%)))
        minmax(0, 1fr);
    gap: var(--space-6, 32px);
    align-items: start;
}

/* ---------- image + markers ---------- */

.bzacc__figure {
    position: sticky;
    top: 90px;
}

.bzacc__frame {
    position: relative;
    display: block;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: var(--bzacc-card);
}

.bzacc__image {
    display: block;
    width: 100%;
    height: auto;
}

.bzacc__marker {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--bzacc-accent);
    color: #fff;
    font-family: var(--font-body, sans-serif);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    transition: transform .18s ease, background-color .18s ease;
}

.bzacc__marker:hover,
.bzacc__marker:focus-visible {
    transform: scale(1.15);
}

.bzacc__marker.is-active {
    background: var(--bzacc-ink);
    transform: scale(1.15);
}

/* Dot style: no number, a quiet sonar pulse instead — the collage look. */
.bzacc--dot .bzacc__marker {
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
}

.bzacc--dot .bzacc__marker-num {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.bzacc__marker-pulse {
    display: none;
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--bzacc-accent);
    animation: bzacc-sonar 2s ease-out infinite;
}

.bzacc--dot .bzacc__marker-pulse {
    display: block;
}

@keyframes bzacc-sonar {
    0%   { transform: scale(.6); opacity: .9; }
    100% { transform: scale(1.5); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .bzacc__marker-pulse { animation: none; }
    .bzacc--js .bzacc__body { transition: none; }
}

/* ---------- accordion list ---------- */

.bzacc__list {
    min-width: 0;
}

/* Side by side the list is its own scroller, sized to the photo by
   accordion.js (max-height is set inline), so clicking a marker can bring
   its title flush with the top of the image. */
/* Scroll chaining is left at the browser default on purpose: once the
   bullets have scrolled to their end the wheel must carry on down the page,
   not stall over the block. */
.bzacc--scroller .bzacc__list {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bzacc-line) transparent;
    padding-right: var(--space-3, 12px);
}

.bzacc--scroller .bzacc__list::-webkit-scrollbar {
    width: 8px;
}

.bzacc--scroller .bzacc__list::-webkit-scrollbar-thumb {
    background: var(--bzacc-line);
    border-radius: var(--radius-pill, 999px);
}

.bzacc__item {
    border-bottom: 1px solid var(--bzacc-line);
    /* Stacked layout: a marker tap scrolls the page to the bullet, which
       must clear the site's sticky header rather than hide under it. */
    scroll-margin-top: 84px;
}

.bzacc__item:first-child {
    border-top: 1px solid var(--bzacc-line);
}

.bzacc__headline {
    margin: 0;
    font: inherit;
}

.bzacc__head {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    width: 100%;
    /* Tight rather than airy: the numbered circle already sets a 28px floor,
       so 10px keeps the row a comfortable 48px tap target while fitting
       noticeably more of the list beside the photo. */
    padding: 10px 0;
    border: 0;
    background: none;
    color: var(--bzacc-ink);
    font-family: var(--font-body, sans-serif);
    font-size: 16px;
    font-weight: 700;
    line-height: 22px;
    text-align: left;
    cursor: pointer;
}

.bzacc__num {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bzacc-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.bzacc--dot .bzacc__num {
    background: var(--bzacc-line);
    color: var(--bzacc-ink);
}

.bzacc__item.is-open .bzacc__num {
    background: var(--bzacc-ink);
    color: #fff;
}

.bzacc__title {
    flex: 1 1 auto;
    min-width: 0;
}

.bzacc__chevron {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--bzacc-muted);
    border-bottom: 2px solid var(--bzacc-muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .2s ease;
}

.bzacc__item.is-open .bzacc__chevron {
    transform: rotate(225deg) translate(-2px, -2px);
}

.bzacc--js .bzacc__body {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    transition: grid-template-rows .28s ease;
}

.bzacc--js .bzacc__item.is-open .bzacc__body {
    grid-template-rows: 1fr;
}

.bzacc__content {
    min-height: 0;
    overflow: hidden;
}

.bzacc--js .bzacc__item.is-open .bzacc__content {
    padding-bottom: var(--space-4, 16px);
}

.bzacc__content img,
.bzacc__content video,
.bzacc__content iframe {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm, 8px);
}

.bzacc__content > *:first-child {
    margin-top: 0;
}

.bzacc__content > *:last-child {
    margin-bottom: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .bzacc__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-5, 24px);
    }

    .bzacc__figure {
        position: static;
    }
}
