/* ============================================
   THM Motorcycle - Branches directory
   Shared by Branches.html and the branch
   selector on Contacts.html.
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.branches-main {
    max-width: 1280px;
}

.branch-browser {
    display: grid;
    grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: start;
}

/* ---- Branch list ---- */

.branch-sidebar {
    min-width: 0;
    padding: 1rem;
    background: rgba(10, 10, 10, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.branch-search {
    position: relative;
    margin-bottom: 0.85rem;
}

.branch-search > i {
    position: absolute;
    top: 50%;
    left: 0.95rem;
    transform: translateY(-50%);
    color: var(--yamaha-red);
    font-size: 0.85rem;
    pointer-events: none;
}

.branch-search input {
    width: 100%;
    padding: 0.78rem 0.9rem 0.78rem 2.45rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.88rem;
}

.branch-search input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.branch-search input:focus {
    outline: none;
    border-color: var(--yamaha-red);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.16);
}

.branch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.branch-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.55rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.branch-chip span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.6rem;
}

.branch-chip:hover {
    color: #ffffff;
    border-color: var(--yamaha-red);
}

.branch-chip.active {
    color: #ffffff;
    background: var(--yamaha-red);
    border-color: var(--yamaha-red);
}

.branch-chip.active span {
    color: rgba(255, 255, 255, 0.82);
}

.branch-chip:focus-visible,
.branch-item:focus-visible {
    outline: 2px solid var(--yamaha-red);
    outline-offset: 2px;
}

.branch-status {
    margin-bottom: 0.55rem;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.branch-list {
    max-height: min(620px, 62vh);
    overflow-y: auto;
    padding-right: 0.3rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 0, 18, 0.7) rgba(255, 255, 255, 0.08);
}

.branch-list::-webkit-scrollbar {
    width: 6px;
}

.branch-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
}

.branch-list::-webkit-scrollbar-thumb {
    background: rgba(230, 0, 18, 0.7);
}

.branch-group + .branch-group {
    margin-top: 0.9rem;
}

.branch-group-title {
    margin-bottom: 0.4rem;
    padding-left: 0.15rem;
    color: var(--yamaha-red);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.branch-group-items {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.branch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    padding: 0.62rem 0.7rem;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid transparent;
    border-left: 3px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.branch-item:hover {
    background: rgba(230, 0, 18, 0.11);
    border-left-color: var(--yamaha-red);
}

.branch-item.active {
    background: rgba(230, 0, 18, 0.18);
    border-color: rgba(230, 0, 18, 0.45);
    border-left-color: var(--yamaha-red);
}

.branch-item-text {
    min-width: 0;
    overflow: hidden;
}

.branch-item-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.3;
}

.branch-item-meta {
    display: block;
    max-width: 100%;
    margin-top: 0.1rem;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.67rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.branch-item > i {
    flex-shrink: 0;
    color: var(--yamaha-red);
    font-size: 0.65rem;
    opacity: 0.55;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.branch-item:hover > i,
.branch-item.active > i {
    opacity: 1;
    transform: translateX(2px);
}

.branch-empty {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

/* ---- Selected branch detail ---- */

.branch-detail-panel {
    position: sticky;
    top: 96px;
    min-width: 0;
    scroll-margin-top: 96px;
}

.branch-detail {
    padding: clamp(1.25rem, 3vw, 2rem);
    background: linear-gradient(155deg, rgba(16, 16, 16, 0.88), rgba(8, 8, 8, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.branch-detail-head {
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.branch-detail-kicker {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--yamaha-red);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.branch-detail-name {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.branch-detail-region {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.branch-detail-region i {
    color: var(--yamaha-red);
}

.branch-facts {
    display: grid;
    gap: 0.8rem;
    margin: 0 0 1.25rem;
}

.branch-fact {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.branch-fact:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.branch-fact dt {
    color: var(--yamaha-red);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.branch-fact dd {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
}

.branch-fact address {
    font-style: normal;
}

.branch-fact a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.25s ease;
}

.branch-fact a:hover {
    color: var(--yamaha-red);
}

.branch-map-frame {
    height: clamp(230px, 34vh, 330px);
    overflow: hidden;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.branch-map-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.branch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.1rem;
    margin-top: 1.15rem;
}

.branch-directions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.78rem 1.15rem;
    background: var(--yamaha-red);
    border: 1px solid var(--yamaha-red);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-decoration: none;
    text-transform: uppercase;
    transition: background 0.25s ease, border-color 0.25s ease, gap 0.25s ease;
}

.branch-directions:hover {
    gap: 0.75rem;
    background: #cc0010;
    border-color: #cc0010;
}

.branch-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.25s ease, gap 0.25s ease;
}

.branch-contact-link:hover {
    gap: 0.65rem;
    color: #ffffff;
}

.branch-directions:focus-visible,
.branch-contact-link:focus-visible,
.branch-browse-link:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

/* ---- Contact page selector card ---- */

.contact-branch-note {
    margin-bottom: 0.85rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.branch-select-wrap {
    position: relative;
}

.branch-select-wrap select {
    width: 100%;
    padding: 0.72rem 2rem 0.72rem 0.75rem;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.branch-select-wrap select:focus {
    outline: none;
    border-color: var(--yamaha-red);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.16);
}

.branch-select-wrap > i {
    position: absolute;
    top: 50%;
    right: 0.8rem;
    transform: translateY(-50%);
    color: var(--yamaha-red);
    font-size: 0.68rem;
    pointer-events: none;
}

.branch-select-wrap optgroup,
.branch-select-wrap option {
    background: #151515;
    color: #ffffff;
}

.branch-browse-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    color: var(--yamaha-red);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-decoration: none;
    text-transform: uppercase;
    transition: gap 0.25s ease, color 0.25s ease;
}

.branch-browse-link:hover {
    gap: 0.65rem;
    color: #ffffff;
}

.branch-preview {
    margin-top: 1.75rem;
    scroll-margin-top: 96px;
}

.branch-preview .branch-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    column-gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: start;
}

.branch-preview .branch-detail-head {
    grid-column: 1 / -1;
}

.branch-preview .branch-facts {
    grid-column: 1;
}

.branch-preview .branch-map-frame {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: stretch;
    height: auto;
    min-height: 300px;
}

.branch-preview .branch-actions {
    grid-column: 1;
}

/* ---- Responsive ---- */

@media (max-width: 980px) {
    .branch-browser {
        grid-template-columns: minmax(0, 1fr);
    }

    .branch-detail-panel {
        position: static;
    }

    .branch-list {
        max-height: 430px;
    }

    .branch-map-frame {
        height: clamp(240px, 42vw, 340px);
    }

    .branch-preview .branch-detail {
        display: block;
    }

    .branch-preview .branch-map-frame {
        height: clamp(240px, 42vw, 340px);
        min-height: 0;
        margin-bottom: 1.15rem;
    }
}

@media (max-width: 560px) {
    .branch-sidebar {
        padding: 0.85rem;
    }

    .branch-detail {
        padding: 1.15rem;
    }

    .branch-fact {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .branch-fact dt {
        font-size: 0.6rem;
    }

    .branch-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.9rem;
    }

    .branch-directions,
    .branch-contact-link {
        justify-content: center;
        text-align: center;
    }

    .branch-contact-link {
        padding: 0.5rem;
    }

    .branch-map-frame {
        height: 240px;
    }
}
