/* ============================================================
   BRANCH PAGE - Design Tokens

   Colour roles:
     --c-white        pure white - card surfaces
     --c-surface      very light grey - inset areas within cards
     --c-border       subtle border colour
     --c-text-primary near-black - headings, strong values
     --c-text-body    dark grey - body copy, descriptions
     --c-text-muted   mid grey - labels, secondary info
     --c-brand        FH blue - interactive elements, highlights
     --c-brand-dark   darker blue - hover states
     --c-highlight-bg very light blue tint - highlight rows

   Spacing: --space-xs 8px / --space-sm 12px / --space-md 16px
            --space-lg 24px / --space-xl 40px
   Cards:   --card-radius 10px / --card-shadow / --card-padding 24px
   ============================================================ */

:root {
    --c-white: #ffffff;
    --c-surface: #f8fafc;
    --c-border: #e5e7eb;
    --c-text-primary: #111827;
    --c-text-body: #374151;
    --c-text-muted: #6b7280;
    --c-brand: #0071E4;
    --c-brand-dark: #005bb5;
    --c-highlight-bg: #eef5fd;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --card-radius: 0.625rem;
    --card-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 2px 12px rgba(0,0,0,0.05);
    --card-padding: var(--space-lg);
}

/* ============================================================
   Page body - gradient background + spacing overrides
   ============================================================ */

.branch-body {
    background: linear-gradient(to bottom, #f0f4f8 0%, #ddeaf8 40%, #c2d8f2 100%) !important;
    padding-top: 2rem !important;
}

    .branch-body .branch-content {
        padding-top: 0 !important;
    }

/* ============================================================
   Accordion icons - move to the LEFT
   ============================================================ */

.accordion__title {
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding-left: var(--space-md);
}

/* ============================================================
   Hero
   ============================================================ */

.branch-hero {
    position: relative;
    background-color: #f3f4f6;
}

.branch-hero__bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

    .branch-hero__bg img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center center;
    }

.branch-hero__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to right, rgba(243,244,246,1) 0%, rgba(243,244,246,0.97) 30%, rgba(243,244,246,0.7) 50%, rgba(243,244,246,0) 70% );
}

.branch-hero__inner {
    position: relative;
    z-index: 2;
    padding-top: 3rem;
    padding-bottom: 2rem;
}

.branch-hero__left {
    max-width: 60%;
}

.branch-hero__title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--c-text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

@media (min-width: 1024px) {
    .branch-hero__title {
        font-size: 2.25rem;
    }
}

.branch-hero__desc {
    margin-bottom: 1.25rem;
    color: var(--c-text-primary);
}

    .branch-hero__desc p,
    .branch-hero__desc li {
        color: var(--c-text-primary);
    }

.branch-hero__phone {
    display: inline-flex;
    align-items: center;
    margin-bottom: 1.25rem;
    text-decoration: none;
    color: var(--c-text-primary);
}

.branch-hero__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: 1.5rem;
}

.branch-hero__directions-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--c-brand);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 150ms;
}

    .branch-hero__directions-btn:hover {
        background: var(--c-brand-dark);
        color: #ffffff;
    }

@media (max-width: 767px) {
    .branch-hero__left {
        max-width: 100%;
    }

    /* Remove nowrap so long branch names wrap naturally */
    .branch-hero__title {
        white-space: normal;
    }

    .branch-hero__overlay {
        background: linear-gradient(to bottom, rgba(243,244,246,0.85) 0%, rgba(243,244,246,1) 70% );
    }
}

/* ============================================================
   Card base - shared background, radius and shadow
   ============================================================ */

.branch-team,
.branch-market,
.branch-holder,
.branch-area-guide,
.branch-sales__card {
    background: var(--c-white);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

/* ============================================================
   Meet the Team
   ============================================================ */

.branch-team {
    padding: var(--card-padding);
}

.branch-team__manager {
    display: flex;
    align-items: stretch;
    margin-bottom: var(--space-xs);
    background: var(--c-surface);
    border-radius: calc(var(--card-radius) - 2px);
    overflow: hidden;
    border: 1px solid var(--c-border);
}

.branch-team__manager-photo {
    width: calc(37.5% - 1px);
    aspect-ratio: 3 / 5.2;
    flex-shrink: 0;
    overflow: hidden;
}

    .branch-team__manager-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top;
        display: block;
    }

.branch-team__manager-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.branch-team__manager-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--c-text-primary);
    line-height: 1.3;
    padding: var(--space-sm) var(--space-md) 2px;
}

.branch-team__manager-role {
    font-size: 1rem;
    color: var(--c-text-muted);
    padding: 0 var(--space-md) var(--space-xs);
}

.branch-team__manager-highlight {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--c-text-body);
    padding: 6px var(--space-md);
    background: var(--c-highlight-bg);
}

.branch-team__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xs);
}

.branch-team__member {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: calc(var(--card-radius) - 2px);
    overflow: hidden;
}

.branch-team__member-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
}

    .branch-team__member-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top;
        display: block;
    }

.branch-team__member-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--c-text-primary);
    line-height: 1.3;
    padding: 6px var(--space-xs) 2px;
}

.branch-team__member-role {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    line-height: 1.3;
    padding: 0 var(--space-xs) var(--space-xs);
}

/* ============================================================
   Local Market commentary
   ============================================================ */

.branch-market {
    padding: var(--card-padding);
}

    .branch-market p {
        font-size: 0.875rem;
        color: var(--c-text-body);
        line-height: 1.7;
        margin: 0;
    }

/* ============================================================
   Recent Sales grid
   ============================================================ */

.branch-sales {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.branch-sales__card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.branch-sales__card-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

    .branch-sales__card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.branch-sales__card-body {
    flex: 1;
    padding: var(--space-xs) var(--space-sm) var(--space-sm);
}

.branch-sales__type {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-bottom: 2px;
}

.branch-sales__price {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--c-text-primary);
    margin-bottom: 4px;
}

.branch-sales__meta {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.branch-sales__card-link {
    display: block;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-brand);
    text-decoration: none;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
    transition: background 150ms, color 150ms;
}

    .branch-sales__card-link:hover {
        background: var(--c-highlight-bg);
        color: var(--c-brand-dark);
    }

/* ============================================================
   Branch holder - card wrapper for FAQs
   ============================================================ */

.branch-holder .accordion {
    margin-left: 0;
    margin-right: 0;
}

.branch-holder .accordion__content {
    display: block !important;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height 250ms ease-in, padding 250ms ease;
}

.branch-holder .accordion--active .accordion__content {
    /* generous cap so long FAQ answers aren't clipped behind the next item */
    max-height: 3000px;
    padding-bottom: var(--card-padding);
    transition: max-height 350ms ease-out, padding 250ms ease;
}

/* ============================================================
   Area Guide
   ============================================================ */

.branch-area-guide {
    overflow: hidden;
}

.branch-area-guide__image {
    width: 100%;
    aspect-ratio: 16 / 5;
    overflow: hidden;
    position: relative;
}

    .branch-area-guide__image > div,
    .branch-area-guide__image > picture {
        display: block;
        width: 100%;
        height: 100%;
    }

    .branch-area-guide__image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

@media (max-width: 767px) {
    .branch-area-guide__image {
        aspect-ratio: 16 / 7;
    }
}

.branch-area-guide__accordions .accordion:first-child {
    border-top-width: 0;
}

.branch-area-guide__accordions .accordion {
    margin-left: 0;
    margin-right: 0;
}

.branch-area-guide__secondary {
    padding: var(--space-md) var(--card-padding);
}

.branch-area-guide__accordions .accordion__content {
    display: block !important;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height 250ms ease-in, padding 250ms ease;
}

.branch-area-guide__accordions .accordion--active .accordion__content {
    /* generous cap so long answers aren't clipped behind the next item */
    max-height: 3000px;
    padding-bottom: var(--card-padding);
    transition: max-height 350ms ease-out, padding 250ms ease;
}

/* ============================================================
   Coverage area tags
   ============================================================ */

.branch-coverage {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.branch-coverage__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--c-white);
    color: var(--c-text-body);
    border: 1px solid var(--c-border);
}

.branch-coverage__postcode {
    font-size: 0.6875rem;
    font-weight: 400;
    opacity: 0.75;
}

/* ============================================================
   Areas We Cover - two column layout
   ============================================================ */

.branch-coverage-layout {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.branch-coverage-layout__tags {
    flex: 0 0 60%;
    padding: var(--card-padding);
}

.branch-coverage-layout__image {
    flex: 0 0 40%;
    min-height: 160px;
    overflow: hidden;
    position: relative;
}

    .branch-coverage-layout__image picture,
    .branch-coverage-layout__image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

.branch-coverage-layout__image--placeholder {
    background: linear-gradient(135deg, #c7d8e8 0%, #a8c0d6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   Opening hours - full width override
   ============================================================ */

.branch-content__hours--full {
    width: 100%;
    max-width: 100%;
}

/* ============================================================
   Property buttons
   ============================================================ */

.branch-prop-buttons {
    gap: 12px;
}

/* ============================================================
   Tablet - reduce grid densities between mobile and desktop
   ============================================================ */

@media (min-width: 768px) and (max-width: 1023px) {

    .branch-sales {
        grid-template-columns: repeat(2, 1fr);
    }

    .branch-team__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


@media (max-width: 767px) {

    /* Team - manager photo wider on mobile so it's not a tiny sliver */
    .branch-team__manager {
        flex-direction: column;
    }

    .branch-team__manager-photo {
        width: 100%;
        aspect-ratio: 4 / 5;
    }

        .branch-team__manager-photo img {
            object-position: center top;
        }

    /* Team grid - 2 columns */
    .branch-team__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Sales - 1 column on mobile so no orphan card */
    .branch-sales {
        grid-template-columns: 1fr;
    }

    /* Coverage layout - stack vertically, limit map image height */
    .branch-coverage-layout {
        flex-direction: column;
    }

    .branch-coverage-layout__tags,
    .branch-coverage-layout__image {
        flex: 0 0 100%;
    }

    .branch-coverage-layout__image {
        min-height: 120px;
        max-height: 180px;
    }

    /* Property buttons - stack vertically centred on mobile */
    .branch-prop-buttons {
        flex-direction: column !important;
        align-items: center;
        gap: 8px !important;
    }

        .branch-prop-buttons .btn {
            width: 100%;
            max-width: 280px;
        }

    /* CTA partial container - force full width */
    .branch-content__right .mb-50 > *,
    .branch-content__right .mb-50.sm\:mb-64 > * {
        width: 100%;
        min-width: 100%;
    }
}
