/**
 * Divi Horizontal Accordion – Styles
 * Version: 2.0.0 | Author: MADEBY7 – https://www.madeby7.co.uk
 */

.dha-accordion *, .dha-accordion *::before, .dha-accordion *::after { box-sizing: border-box; }

/* Editor preview visibility — toggled by inline JS */
.dha-accordion--hidden { display: none !important; }
.dha-preview--hidden   { display: none !important; }

.dha-accordion {
    position: relative; display: flex; flex-direction: row;
    width: 100%; height: var(--dha-height, 520px);
    overflow: hidden; border-radius: 4px; user-select: none;
}

.dha-panel {
    position: relative; display: flex; flex-direction: row;
    overflow: hidden; cursor: pointer; flex: 0 0 72px;
    background-color: var(--dha-teal, #00596b);
    color: var(--dha-text, #ffffff);
    transition: flex var(--dha-speed, 500ms) cubic-bezier(0.4,0,0.2,1),
                background-color var(--dha-speed, 500ms) ease;
}

/*.dha-panel:first-child { background-color: var(--dha-dark, #0e2935); }*/
.dha-panel:not(:first-child) { background-color: var(--dha-teal, #00596b); }
.dha-panel--active { flex: 1 1 auto; background-color: var(--dha-dark, #0e2935) !important; cursor: default; }
.dha-panel + .dha-panel { border-left: 1px solid rgba(255,255,255,0.08); }

.dha-panel__strip {
    display: flex; flex-direction: column; align-items: flex-start;
    justify-content: flex-start; flex-shrink: 0;
    width: 72px; padding: 28px 0 28px 22px; gap: 16px;
}

.dha-panel__number {
    display: block; font-size: 1.6rem; font-weight: 300;
    line-height: 1; color: var(--dha-text, #ffffff);
    letter-spacing: 0; flex-shrink: 0;
}
.dha-panel--active .dha-panel__number { color: var(--dha-accent, #69923a); }

.dha-panel__title-vertical {
    display: block; writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: 0.78rem; font-weight: 400; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.80); white-space: nowrap;
    transition: opacity var(--dha-speed, 500ms) ease;
}
.dha-panel--active .dha-panel__title-vertical { opacity: 0; pointer-events: none; }

.dha-panel__body {
    flex: 1 1 auto; overflow: hidden; opacity: 0;
    pointer-events: none; transition: opacity var(--dha-speed, 500ms) ease; height: 100%;
}
.dha-panel--active .dha-panel__body { opacity: 1; pointer-events: auto; }

.dha-panel__body-inner {
    padding: 36px 44px 36px 24px; height: 100%;
    display: flex; flex-direction: column;
    justify-content: flex-start; gap: 12px;
}

.dha-panel__split { display: flex; flex-direction: row; height: 100%; width: 100%; }
.dha-panel__split--right .dha-panel__text-col { order: 1; }
.dha-panel__split--right .dha-panel__img-col  { order: 2; }
.dha-panel__split--left  .dha-panel__text-col { order: 2; }
.dha-panel__split--left  .dha-panel__img-col  { order: 1; }

.dha-panel__text-col {
    flex: 0 0 var(--dha-text-col-width, 45%); display: flex; align-items: stretch;
    background-color: var(--dha-dark, #0e2935);
}
.dha-panel__text-col .dha-panel__body-inner { padding: 30px 40px 30px 15px; width: 100%; }

.dha-panel__img-col {
    flex: 1 1 auto; background-size: cover;
    background-position: center center; background-repeat: no-repeat;
    position: relative; overflow: hidden;
}
.dha-panel__img-overlay { position: absolute; inset: 0; }

/* Fade-in for title and content */
.dha-panel__title,
.dha-panel__content,
.dha-panel__btn-wrap {
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    transition-delay: var(--dha-speed, 500ms);
}
.dha-panel--active .dha-panel__title,
.dha-panel--active .dha-panel__content,
.dha-panel--active .dha-panel__btn-wrap { opacity: 1; transform: translateY(0); }
/* Stagger: title → content → button */
.dha-panel--active .dha-panel__content  { transition-delay: calc(var(--dha-speed, 500ms) + 80ms); }
.dha-panel--active .dha-panel__btn-wrap { transition-delay: calc(var(--dha-speed, 500ms) + 180ms); }

/* ── Outgoing panel (leaving state) ──────────────────────────────
 * When JS adds .dha-panel--leaving to the currently active panel,
 * we immediately override the fade-in transition-delay to 0 and
 * drive opacity to 0 with a fast dedicated transition.
 * The duration matches getFadeOutDuration() in the JS (~35% of
 * animation speed, between 120–300ms).
 * We use a slightly shorter easing (ease-in) so the fade feels
 * decisive rather than lingering.
 */
/* Exit mirrors the entrance exactly — same distance, same duration, reversed direction.
 * Entrance: translateY(10px)→0, opacity 0→1, ease, 0.35s, stagger title→content→button.
 * Exit:     translateY(0)→10px, opacity 1→0, ease-out, 0.35s, reverse stagger button→content→title.
 *
 * To adjust speed: change the 0.35s values below.
 * To adjust distance: change the translateY(10px) values to match the entrance in the
 * .dha-panel__title / .dha-panel__content block above.
 */
.dha-panel--leaving .dha-panel__title,
.dha-panel--leaving .dha-panel__content,
.dha-panel--leaving .dha-panel__btn-wrap {
    pointer-events: none !important;
}

/* Reverse stagger: button exits first, content second, title last */
.dha-panel--leaving .dha-panel__btn-wrap {
    opacity:          0 !important;
    transform:        translateY(10px) !important;
    transition:       opacity 0.35s ease-out, transform 0.35s ease-out !important;
    transition-delay: 0ms !important;
}

.dha-panel--leaving .dha-panel__content {
    opacity:          0 !important;
    transform:        translateY(10px) !important;
    transition:       opacity 0.35s ease-out, transform 0.35s ease-out !important;
    transition-delay: 60ms !important;
}

.dha-panel--leaving .dha-panel__title {
    opacity:          0 !important;
    transform:        translateY(10px) !important;
    transition:       opacity 0.35s ease-out, transform 0.35s ease-out !important;
    transition-delay: 120ms !important;
}

.dha-panel__number--body { display: none; }

.dha-panel__title {
    margin: 0; padding: 0; font-size: 1.6rem; font-weight: 500;
    line-height: 1.3; color: var(--dha-accent, #69923a);
    text-transform: none; letter-spacing: 0;
}
.dha-panel__content {
    margin-top: 8px; font-size: 0.9rem; line-height: 1.7;
    color: rgba(255,255,255,0.88); max-width: 360px;
}
.dha-panel__content p { margin: 0 0 0.75em; }
.dha-panel__content p:last-child { margin-bottom: 0; }

.dha-progress {
    position: absolute; bottom: 0; left: 0;
    width: 100%; height: 3px;
    background: rgba(255,255,255,0.12); z-index: 10;
}
.dha-progress__bar { height: 100%; width: 0%; background: var(--dha-accent, #69923a); transition: none; }

.dha-toggle-play {
    position: absolute; bottom: 12px; right: 14px; z-index: 20;
    background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%; width: 32px; height: 32px; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; transition: background 0.2s ease;
}
.dha-toggle-play:hover, .dha-toggle-play:focus { background: rgba(0,0,0,0.6); outline: none; }
.dha-toggle-play svg { display: block; fill: currentColor; }

.dha-icon-play  { display: none; }
.dha-icon-pause { display: flex; align-items: center; }
.dha-accordion.dha-paused .dha-icon-pause { display: none; }
.dha-accordion.dha-paused .dha-icon-play  { display: flex; align-items: center; }

/*.dha-panel:focus { outline: 2px solid var(--dha-accent, #69923a); outline-offset: -2px; }*/

/* ─── Button / link ──────────────────────────────────────────── */
.dha-panel__btn-wrap {
    margin-top: 20px;
    flex-shrink: 0;
}

.dha-panel__btn {
    /* Base styles are applied inline from saved settings.          */
    /* These rules handle hover and focus only.                     */
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.dha-panel__btn:hover,
.dha-panel__btn:focus {
    opacity: 0.85;
    transform: translateY(-1px);
    outline: none;
}

/* Whole-panel link cursor (applied via JS once panel is active) */
.dha-panel--linked.dha-panel--active {
    cursor: pointer;
}

/* ─── Background image animations ────────────────────────────────
 *
 * Animations only play when the panel is active (.dha-panel--active).
 * The img-col has overflow:hidden so scale/translate stays contained.
 * Duration is deliberately slow (18-22s) for a subtle, premium feel.
 * Using will-change:transform only while active avoids GPU memory cost
 * on collapsed panels.
 *
 * Classes applied by shortcode PHP based on per-panel admin setting:
 *   .dha-img--zoom-in    .dha-img--zoom-out
 *   .dha-img--pan-left   .dha-img--pan-right
 *   .dha-img--pan-up     .dha-img--pan-down
 */

@keyframes dha-zoom-in {
    from { transform: scale(1);    }
    to   { transform: scale(1.12); }
}
@keyframes dha-zoom-out {
    from { transform: scale(1.12); }
    to   { transform: scale(1);    }
}
@keyframes dha-pan-left {
    from { transform: scale(1.08) translateX(3%);  }
    to   { transform: scale(1.08) translateX(-3%); }
}
@keyframes dha-pan-right {
    from { transform: scale(1.08) translateX(-3%); }
    to   { transform: scale(1.08) translateX(3%);  }
}
@keyframes dha-pan-up {
    from { transform: scale(1.08) translateY(3%);  }
    to   { transform: scale(1.08) translateY(-3%); }
}
@keyframes dha-pan-down {
    from { transform: scale(1.08) translateY(-3%); }
    to   { transform: scale(1.08) translateY(3%);  }
}

/* Base: all animated img-cols */
.dha-panel__img-col[class*="dha-img--"] {
    /* overflow already hidden on parent — transform origin centre */
    transform-origin: center center;
}

/* Animations only play on the ACTIVE panel, not during collapse/expand */
.dha-panel--active .dha-panel__img-col.dha-img--zoom-in {
    animation: dha-zoom-in 20s ease-in-out infinite alternate;
    will-change: transform;
}
.dha-panel--active .dha-panel__img-col.dha-img--zoom-out {
    animation: dha-zoom-out 20s ease-in-out infinite alternate;
    will-change: transform;
}
.dha-panel--active .dha-panel__img-col.dha-img--pan-left {
    animation: dha-pan-left 18s ease-in-out infinite alternate;
    will-change: transform;
}
.dha-panel--active .dha-panel__img-col.dha-img--pan-right {
    animation: dha-pan-right 18s ease-in-out infinite alternate;
    will-change: transform;
}
.dha-panel--active .dha-panel__img-col.dha-img--pan-up {
    animation: dha-pan-up 18s ease-in-out infinite alternate;
    will-change: transform;
}
.dha-panel--active .dha-panel__img-col.dha-img--pan-down {
    animation: dha-pan-down 18s ease-in-out infinite alternate;
    will-change: transform;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .dha-panel__img-col[class*="dha-img--"] {
        animation: none !important;
        will-change: auto !important;
    }
}

.dha-no-panels {
    padding: 20px; background: #f8d7da; border: 1px solid #f5c6cb;
    border-radius: 4px; color: #721c24;
}

/* Responsive – Tablet */
@media (max-width: 980px) {
    .dha-accordion { height: auto; flex-direction: column; }
    .dha-panel { flex: 0 0 auto; width: 100%; height: 64px; flex-direction: column; overflow: hidden;
        transition: height var(--dha-speed,500ms) cubic-bezier(0.4,0,0.2,1), background-color var(--dha-speed,500ms) ease; }
    .dha-panel--active { height: auto; }
    .dha-panel__strip { flex-direction: row; align-items: center; width: 100%; height: 64px; padding: 0 20px; gap: 14px; flex-shrink: 0; }
    .dha-panel__number { font-size: 1.2rem; }
    .dha-panel__title-vertical { writing-mode: horizontal-tb; transform: none; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
    .dha-panel--active .dha-panel__title-vertical { opacity: 0; }
    .dha-panel__body { opacity: 0; max-height: 0; height: auto; transition: opacity var(--dha-speed,500ms) ease, max-height var(--dha-speed,500ms) cubic-bezier(0.4,0,0.2,1); }
    .dha-panel--active .dha-panel__body { opacity: 1; max-height: 700px; }
    .dha-panel--active .dha-panel__title,
    .dha-panel--active .dha-panel__content,
    .dha-panel--active .dha-panel__btn-wrap { transition-delay: calc(var(--dha-speed,500ms) * 0.6); }
    .dha-panel--active .dha-panel__content  { transition-delay: calc(var(--dha-speed,500ms) * 0.6 + 80ms); }
    .dha-panel--active .dha-panel__btn-wrap { transition-delay: calc(var(--dha-speed,500ms) * 0.6 + 160ms); }

    /* Leaving state on tablet/mobile — same reversed stagger, slightly shorter */
    .dha-panel--leaving .dha-panel__btn-wrap {
        opacity: 0 !important;
        transform: translateY(10px) !important;
        transition: opacity 0.3s ease-out, transform 0.3s ease-out !important;
        transition-delay: 0ms !important;
    }
    .dha-panel--leaving .dha-panel__content {
        opacity: 0 !important;
        transform: translateY(10px) !important;
        transition: opacity 0.3s ease-out, transform 0.3s ease-out !important;
        transition-delay: 50ms !important;
    }
    .dha-panel--leaving .dha-panel__title {
        opacity: 0 !important;
        transform: translateY(10px) !important;
        transition: opacity 0.3s ease-out, transform 0.3s ease-out !important;
        transition-delay: 100ms !important;
    }
    .dha-panel__split { flex-direction: column; height: auto; }
    .dha-panel__split--right .dha-panel__text-col,
    .dha-panel__split--left  .dha-panel__text-col { order: 1; flex: 0 0 auto; }
    .dha-panel__split--right .dha-panel__img-col,
    .dha-panel__split--left  .dha-panel__img-col  { order: 2; flex: 0 0 240px; min-height: 240px; }
    .dha-panel__text-col { flex: 0 0 auto; }
    .dha-panel__text-col .dha-panel__body-inner { padding: 24px 24px 20px; }
    .dha-panel__body-inner { padding: 20px 24px 28px; }
    .dha-panel__content { max-width: 100%; }
    .dha-panel__title { font-size: 1.3rem; }
}

/* Responsive – Mobile */
@media (max-width: 540px) {
    .dha-panel__strip { padding: 0 14px; gap: 10px; }
    .dha-panel__number { font-size: 1rem; flex-shrink: 0; }
    .dha-panel__title-vertical { font-size: 0.78rem; }
    .dha-panel__body-inner,
    .dha-panel__text-col .dha-panel__body-inner { padding: 16px 18px 22px; }
    .dha-panel__title { font-size: 1.1rem; }
    .dha-panel__content { font-size: 0.85rem; }
    .dha-panel__split--right .dha-panel__img-col,
    .dha-panel__split--left  .dha-panel__img-col { flex: 0 0 200px; min-height: 200px; }
    .dha-toggle-play { bottom: 8px; right: 10px; width: 28px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .dha-panel, .dha-panel__body, .dha-panel__title,
    .dha-panel__content, .dha-panel__btn-wrap, .dha-progress__bar {
        transition-duration: 50ms !important;
        transition-delay: 0ms !important;
    }
    .dha-panel--leaving .dha-panel__title,
    .dha-panel--leaving .dha-panel__content,
    .dha-panel--leaving .dha-panel__btn-wrap {
        transition-duration: 50ms !important;
        transition-delay: 0ms !important;
    }
}
