/* =========================================================
   Regent Dental Location Accordion — Frontend Styles
   ========================================================= */

/* ---- Typography ---- */
.rda-accordion,
.rda-accordion * {
    font-family: 'Poppins', sans-serif;
}

.rda-content__title,
.rda-label__name,
.rda-strip__name {
    font-family: 'Montserrat', sans-serif;
}

/* ---- Wrapper ---- */
.rda-accordion {
    display: flex;
    width: 100%;
    height: var(--rda-height, 460px);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.22);
    position: relative;
}

/* ---- Panel ---- */
.rda-panel {
    position: relative;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0;
    background-color: var(--rda-color, #0a3d62);
    background-size: cover;
    background-position: center;
    overflow: hidden;
    cursor: pointer;

    transition:
        flex-grow   var(--rda-transition, 500ms) cubic-bezier(0.4, 0, 0.2, 1),
        flex-basis  var(--rda-transition, 500ms) cubic-bezier(0.4, 0, 0.2, 1),
        flex-shrink var(--rda-transition, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.rda-panel:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
}

/* Separate background image layer so it can have its own transform */
.rda-panel__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1);
    transition: transform calc(var(--rda-transition, 500ms) * 1.4) cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.rda-panel.is-active .rda-panel__bg {
    transform: scale(1.04);
}

/* Gradient overlay — tight band at the bottom, only behind the label text.
   Everything above fades to fully transparent so the image is crystal clear. */
.rda-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.65) 0%,
        rgba(0, 0, 0, 0.2)  12%,
        transparent         24%
    );
    pointer-events: none;
    z-index: 1;
    transition: opacity var(--rda-transition, 500ms) ease;
}

/* Active panel: image is completely clear — solid content panel handles its own bg */
.rda-accordion.has-active .rda-panel.is-active .rda-overlay {
    opacity: 0;
}

/* Darken inactive collapsed strips */
.rda-accordion.has-active .rda-panel:not(.is-active) .rda-overlay {
    background: rgba(0, 0, 0, 0.72);
    opacity: 1;
}


/* ---- Resting label (title shown when all panels are equal width) ---- */
.rda-label {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 2;
    transition:
        opacity     var(--rda-transition, 500ms) ease,
        transform   var(--rda-transition, 500ms) ease;
}

.rda-label__badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--rda-color, #0a3d62);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 20px;
    margin-bottom: 5px;
}

.rda-label__name {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.02em;
}

/* ---- Collapsed strip label (vertical text when another panel is active) ---- */
.rda-strip {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--rda-transition, 500ms) ease;
}

.rda-strip__name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    white-space: nowrap;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ---- Expanded content — hidden until panel is active ---- */
.rda-content {
    position: absolute;
    inset: 0;
    z-index: 3;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    opacity: 0;
    transform: translateX(-14px);
    pointer-events: none;
    transition:
        opacity   var(--rda-transition, 500ms) ease,
        transform var(--rda-transition, 500ms) ease;
}

.rda-content__badge {
    display: inline-block;
    align-self: flex-start;
    padding: 3px 10px;
    background: var(--rda-color, #0a3d62);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 20px;
    margin-bottom: 8px;
}

.rda-content__title {
    color: #fff;
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0 0 1rem;
    line-height: 1.15;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.rda-content__tagline {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 0.8rem;
    line-height: 1.4;
}

.rda-description {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.rda-description__item {
    position: relative;
    padding-left: 1.1em;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.78rem;
    line-height: 1.5;
}

.rda-description__item::before {
    content: '–';
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.45);
}

.rda-details {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.rda-detail {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.82rem;
    line-height: 1.55;
}

.rda-detail__icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 2px;
    opacity: 0.9;
}

.rda-detail a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    transition: color 0.15s;
}

.rda-detail a:hover {
    color: #fff;
    text-decoration: underline;
}

.rda-detail address {
    font-style: normal;
}

/* Google Maps address link */
.rda-detail__maps-link {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    transition: color 0.15s;
    line-height: inherit;
}

.rda-detail__maps-link:hover {
    color: #fff;
    text-decoration: underline;
}

.rda-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 0.6rem 1.1rem;
    background: #fff;
    color: var(--rda-color, #0a3d62) !important;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none !important;
    border-radius: 6px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.2);
    transition:
        transform   0.2s ease,
        box-shadow  0.2s ease;
}

.rda-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

/* ---- Masonry gallery ---- */
.rda-gallery {
    position: absolute;
    top: 0;
    bottom: 0;
    left: min(290px, 100%);
    right: 0;
    z-index: 2;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    background: #fff; /* white gaps and empty cells */

    opacity: 0;
    pointer-events: none;
    transition: opacity var(--rda-transition, 500ms) ease;
}

.rda-accordion.has-active .rda-panel.is-active .rda-gallery {
    opacity: 1;
    transition-delay: calc(var(--rda-transition, 500ms) * 0.25);
}

.rda-gallery__item {
    background-size: cover;
    background-position: center;
}

/* First image: prominent top-left (2 columns × 2 rows) */
.rda-gallery__item:first-child {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

/* Dynamic row count based on number of images */

/* 1 image: fill the whole area */
.rda-gallery[data-count="1"] {
    grid-template-rows: 1fr;
}
.rda-gallery[data-count="1"] .rda-gallery__item:first-child {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

/* 2–3 images: 2 rows (no empty bottom row) */
.rda-gallery[data-count="2"],
.rda-gallery[data-count="3"] {
    grid-template-rows: repeat(2, 1fr);
}

/* ============================================================
   STATES
   ============================================================ */

/* -- has-active: one panel is open -- */

/* Active panel: expand to take remaining space */
.rda-accordion.has-active .rda-panel.is-active {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0;
    cursor: default;
    min-width: 0;
}

/* Inactive panels: collapse to thin strips */
.rda-accordion.has-active .rda-panel:not(.is-active) {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 60px;
    cursor: pointer;
}

/* Hide resting label on inactive panels */
.rda-accordion.has-active .rda-panel:not(.is-active) .rda-label {
    opacity: 0;
}

/* Show strip label on inactive panels */
.rda-accordion.has-active .rda-panel:not(.is-active) .rda-strip {
    opacity: 1;
    pointer-events: all;
}

/* Hide resting label on active panel */
.rda-accordion.has-active .rda-panel.is-active .rda-label {
    opacity: 0;
    transform: translateY(6px);
}

/* Expanded: solid accent-colour panel on the left, image shows freely to the right */
.rda-accordion.has-active .rda-panel.is-active .rda-content {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    transition-delay: calc(var(--rda-transition, 500ms) * 0.4);

    /* Override inset: 0 — become a left-side column only */
    right: auto;
    width: min(290px, 100%);
    background: var(--rda-color, #0a3d62) !important;
    overflow-y: auto;
}

/* ============================================================
   RESPONSIVE — vertical stack on mobile
   ============================================================ */
@media (max-width: 640px) {
    .rda-accordion {
        flex-direction: column;
        height: auto;
        min-height: 0;
        border-radius: 8px;
    }

    /* Reset flex for column layout, use min-height instead */
    .rda-panel {
        flex: none !important;
        min-height: 64px;
        transition: min-height var(--rda-transition, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Resting: each panel fills an equal portion */
    .rda-accordion:not(.has-active) .rda-panel {
        min-height: 140px;
    }

    /* Collapsed strips */
    .rda-accordion.has-active .rda-panel:not(.is-active) {
        min-height: 60px;
    }

    /* Hard-hide the resting label on collapsed strips so the badge never bleeds through */
    .rda-accordion.has-active .rda-panel:not(.is-active) .rda-label {
        display: none;
    }

    /* Strip label: horizontal text on mobile */
    .rda-strip__name {
        writing-mode: horizontal-tb;
        transform: none;
        letter-spacing: 0.12em;
    }

    /* ---- Expanded panel: solid colour only, no image, all content visible ---- */
    .rda-accordion.has-active .rda-panel.is-active {
        min-height: 560px; /* generous — content never clips */
    }

    /* Hide the background photo and gallery on mobile expanded */
    .rda-gallery {
        display: none;
    }

    .rda-accordion.has-active .rda-panel.is-active .rda-panel__bg {
        display: none;
    }

    /* No overlay needed — solid colour panel covers everything */
    .rda-accordion.has-active .rda-panel.is-active .rda-overlay {
        display: none;
    }

    /* Content: full-width solid colour, vertically centred */
    .rda-accordion.has-active .rda-panel.is-active .rda-content {
        right: 0;           /* override the desktop left-panel width */
        width: 100%;
        background: var(--rda-color, #0a3d62) !important;
        padding: 1.5rem;
        justify-content: center;
    }

    .rda-content__title {
        font-size: 1.25rem;
    }
}
