/*! Theme Name: dhive
Author: Digital Hyve
template: bb-theme
*/

/**
 * Photo gallery: collapsible sections and "Jump to" navigation.
 * Paired with assets/scripts/gallery-collapse.js.
 */

/* --------------------------------------------------------------------------
   Collapsible panel
   -------------------------------------------------------------------------- */

/**
 * Collapsed panels keep their layout box so PowerPack can measure the Isotope
 * grid inside them. visibility:hidden takes the images out of the tab order and
 * off the accessibility tree once the collapse animation has finished.
 */
.gallery-collapse__panel {
    overflow: hidden;
    transition: height 350ms ease;
}

.gallery-collapse__panel[data-collapsed] {
    height: 0;
    visibility: hidden;
    transition: height 350ms ease, visibility 0s linear 350ms;
}

/**
 * Isotope writes visibility:visible inline on every gallery item, which beats
 * the panel's visibility:hidden. Without this the photos in a collapsed
 * section stay in the tab order and are still announced by screen readers.
 * The delay holds them on screen until the collapse animation has finished.
 */
.gallery-collapse__panel[data-collapsed] .pp-gallery-item {
    visibility: hidden !important;
    transition: visibility 0s linear 350ms;
}

/* --------------------------------------------------------------------------
   Section heading toggle
   -------------------------------------------------------------------------- */

/**
 * The theme skin gives every <button> a dark fill, white text, a border and a
 * 24px font, which this toggle is not meant to have. Those properties are
 * pinned across every state so the heading looks the same at rest, hovered,
 * focused and pressed. Keyboard focus stays visible through the outline below.
 *
 * The .fl-page prefix is load bearing. The skin sets these on
 * ".fl-page button", which outweighs a lone class. Without the prefix the
 * plain rule loses while the :hover rule wins, so the heading text inherits
 * 24px at rest and snaps up to its real size on hover.
 */
.fl-page .gallery-collapse__toggle,
.fl-page .gallery-collapse__toggle:hover,
.fl-page .gallery-collapse__toggle:focus,
.fl-page .gallery-collapse__toggle:active {
    align-items: center;
    background: none;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    font: inherit;
    gap: 15px;
    justify-content: space-between;
    letter-spacing: inherit;
    line-height: inherit;
    padding: 0 0 12px;
    text-align: left;
    text-decoration: none;
    text-transform: inherit;
    width: 100%;
}

.gallery-collapse__toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

/* Chevron, drawn from borders so it always matches the heading colour. */
.gallery-collapse__icon {
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    display: block;
    flex: 0 0 auto;
    height: 0.5em;
    margin-top: -0.25em;
    transform: rotate(45deg);
    transition: transform 350ms ease;
    width: 0.5em;
}

.gallery-collapse__heading.is-open .gallery-collapse__icon {
    margin-top: 0.15em;
    transform: rotate(225deg);
}

/* Offset scroll targets by the sticky header, measured in JS. */
.gallery-collapse__heading {
    scroll-margin-top: calc(var(--gallery-collapse-offset, 0px) + 20px);
}

/* --------------------------------------------------------------------------
   "Jump to" navigation
   -------------------------------------------------------------------------- */

.gallery-collapse__nav {
    align-items: center;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 30px;
    padding: 15px 20px;
}

.gallery-collapse__nav-label {
    font-weight: 700;
}

.gallery-collapse__nav-list {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 10px 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gallery-collapse__nav-list li {
    margin: 0;
}

.gallery-collapse__nav-link {
    text-decoration: underline;
}

/* Prefixed for the same reason as the toggle above: ".fl-page button" wins. */
.fl-page .gallery-collapse__expand-all {
    background: none;
    border: 1px solid currentColor;
    border-radius: 3px;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 0.875em;
    padding: 6px 14px;
    white-space: nowrap;
}

.gallery-row {
    padding-bottom: 0 !important;
    padding-top: 12px !important;
}

.fl-builder-content > .fl-row:last-of-type {
    padding-bottom: 60px;
}

.pp-photo-gallery-content {
    padding-bottom: 30px;
}

/* Hover is left to the theme skin so this matches every other button. */

@media only screen and (max-width: 600px) {
    .gallery-collapse__nav {
        align-items: flex-start;
        flex-direction: column;
    }

    /**
     * Sized down and set to its own width so it reads as a secondary control
     * rather than a full width call to action, with room above the links.
     */
    .gallery-collapse__expand-all {
        font-size: 0.875rem !important;
        margin-top: 10px;
        padding: 8px 16px;
    }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .gallery-collapse__panel,
    .gallery-collapse__icon {
        transition: none;
    }

    .gallery-collapse__panel[data-collapsed],
    .gallery-collapse__panel[data-collapsed] .pp-gallery-item {
        transition: none;
    }
}