/* ============================================
   PREMIUM BRANCH SELECTOR - REFANCY OPTIMIZED
   Reflow-free Flex Animation
   ============================================ */

/* ============================================
   SELECTOR CONTAINER
   ============================================ */

.branch-selector {
    position: relative;
    left: 0;
    right: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    height: 75vh;
    min-height: 500px;
    display: flex;
    overflow: hidden;
    background: #000;
    z-index: 10;
    contain: layout style paint;
}

.branch-selector,
.branch-selector * {
    max-width: none;
}

/* ============================================
   SELECTOR CARDS
   ============================================ */

.branch-card {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    overflow: hidden;
    cursor: pointer;
    transition: flex-grow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    contain: layout style;
    transform: translateZ(0);
}

/* Hover Physics */
.branch-selector:hover .branch-card {
    flex-grow: 0.35;
}

.branch-selector:hover .branch-card:hover {
    flex-grow: 0.65;
}

/* ============================================
   THEMES
   ============================================ */

/* DARK (Tattoo) */
.branch-card--tattoo {
    background-color: #1a1a1a;
    color: #ffffff;
}

.branch-card--tattoo .branch-card__bg {
    background-image: url('../../assets/concrete-wall-texture.jpg');
    /* REMOVED: background-blend-mode: overlay; -> CPU KILLER */
    background-color: #1a1a1a;
    /* Fallback color */
    opacity: 0.3;
    /* Just simple opacity */
}

/* RED (Gallery) */
.branch-card--gallery {
    background-color: #8f3349;
    color: #ffffff;
}

.branch-card--gallery .branch-card__bg {
    background-color: #8f3349;
    background-image: url('../../assets/concrete-wall-texture.jpg');
    /* REMOVED: background-blend-mode: overlay; */
    opacity: 0.15;
    /* Lower opacity to simulate blend */
}

.branch-card__overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    /* Gradient is cheaper than blend modes */
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
}

/* ============================================
   BACKGROUND LAYERS
   ============================================ */

.branch-card__bg {
    position: absolute;
    top: -30px; right: -30px; bottom: -30px; left: -30px; /* Fallback: Safari <14.1 */
    inset: -30px;
    background-size: cover;
    background-position: center;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: strict;
}

/* Dimming inactive side - VIA OPACITY, NOT FILTER */
.branch-selector:hover .branch-card:not(:hover) .branch-card__bg {
    /* REMOVED: filter: grayscale(0.5) brightness(0.7); -> CPU KILLER */
    opacity: 0.1;
    /* Fade it out instead */
}

/* Active side - subtle zoom effect */
.branch-selector:hover .branch-card:hover .branch-card__bg {
    transform: scale(1.05);
}

/* ============================================
   GLOW LAYER - PREMIUM HOVER EFFECT
   Only for devices with full performance (GPU accelerated)
   ============================================ */

.branch-card__glow {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

/* Tattoo Glow - Burgundy edge glow */
.branch-card--tattoo .branch-card__glow {
    background: radial-gradient(ellipse at center,
            transparent 40%,
            rgba(155, 39, 67, 0.15) 70%,
            rgba(155, 39, 67, 0.3) 100%);
    box-shadow: inset 0 0 80px rgba(155, 39, 67, 0.2);
}

/* Gallery Glow - White/warm edge glow */
/* Gallery Glow - Dark/Black edge glow (Duality) */
.branch-card--gallery .branch-card__glow {
    background: radial-gradient(ellipse at center,
            transparent 40%,
            rgba(0, 0, 0, 0.15) 70%,
            rgba(0, 0, 0, 0.3) 100%);
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.2);
}

/* Show glow on hover */
.branch-card:hover .branch-card__glow {
    opacity: 1;
}

/* ============================================
   CONTENT - THE KEY OPTIMIZATION
   ============================================ */

.branch-card__content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 3rem;

    /* CRITICAL OPTIMIZATION:
       Fixed width ensures text NEVER reflows when parent flex changes.
       It will just be clipped or centered. */
    min-width: 500px;
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scale UP content on ACTIVE (hovered) side - emphasis effect */
.branch-selector:hover .branch-card:hover .branch-card__content {
    transform: scale(1.05);
}

/* Scale DOWN and fade content on INACTIVE side */
.branch-selector:hover .branch-card:not(:hover) .branch-card__content {
    opacity: 0.4;
    transform: scale(0.85);
}

/* ============================================
   ICONS & TYPOGRAPHY
   ============================================ */

.branch-card__icon {
    margin-bottom: 2rem;
    opacity: 0.7;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.branch-card__icon svg {
    width: 64px;
    height: 64px;
    stroke-width: 1.2px;
    transition: stroke 0.3s ease;
}

.branch-card--tattoo .branch-card__icon svg {
    stroke: #888;
}

.branch-card--gallery .branch-card__icon svg {
    stroke: rgba(255, 255, 255, 0.7);
}

.branch-card--tattoo:hover .branch-card__icon {
    transform: scale(1.1);
    opacity: 1;
}

.branch-card--tattoo:hover .branch-card__icon svg {
    stroke: #9b2743;
}

.branch-card--gallery:hover .branch-card__icon {
    transform: scale(1.1);
    opacity: 1;
}

.branch-card--gallery:hover .branch-card__icon svg {
    stroke: #ffffff;
}

.branch-card__pre {
    display: block;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.branch-card__title {
    font-family: 'Excellent Display', sans-serif !important;
    font-size: 4rem; /* Fallback */
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    transition: color 0.4s ease, text-shadow 0.4s ease;
    font-weight: bold;
    white-space: nowrap;
    /* Prevent line breaks */
}

/* Colors */
.branch-card--tattoo .branch-card__title {
    color: #fff;
}

.branch-card--gallery .branch-card__title {
    color: #fff;
}

.branch-card--tattoo:hover .branch-card__title {
    color: #9b2743;
    text-shadow: 0 0 40px rgba(155, 39, 67, 0.3);
}

.branch-card--gallery:hover .branch-card__title {
    color: #fff;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
}

.branch-card__ornament {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    opacity: 0.5;
}

.branch-card__ornament svg {
    width: 120px;
    height: 12px;
    fill: none;
    stroke: currentColor;
}

.branch-card--tattoo .branch-card__ornament {
    color: #666;
}

.branch-card--gallery .branch-card__ornament {
    color: rgba(255, 255, 255, 0.5);
}

.branch-card--tattoo:hover .branch-card__ornament {
    color: #9b2743;
    opacity: 1;
}

.branch-card--gallery:hover .branch-card__ornament {
    color: #fff;
    opacity: 1;
}

.branch-card__tagline {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    opacity: 0.8;
    font-weight: 300;
}

.branch-card--tattoo .branch-card__tagline {
    color: #ccc;
}

.branch-card--gallery .branch-card__tagline {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media screen and (max-width: 900px) {
    .branch-selector {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        width: 100vw;
        margin-left: calc(50% - 50vw);
        padding: 0;
    }

    .branch-card {
        width: 100%;
        min-height: 50vh;
        min-height: 50dvh;
        transition: none !important;
    }

    .branch-card__content {
        min-width: auto;
        width: auto;
        padding: 2rem;
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
    }

    /* Mobile: Stacked 50/50, kill ALL hover expansion + effects */
    .branch-selector:hover .branch-card,
    .branch-selector:hover .branch-card:hover {
        flex: 1 !important;
    }

    .branch-selector:hover .branch-card:not(:hover) .branch-card__bg {
        opacity: 0.3 !important;
        transform: none !important;
    }

    .branch-selector:hover .branch-card:hover .branch-card__bg {
        transform: none !important;
    }

    .branch-selector:hover .branch-card:hover .branch-card__content,
    .branch-selector:hover .branch-card:not(:hover) .branch-card__content {
        transform: none !important;
        opacity: 1 !important;
    }

    .branch-card:hover .branch-card__icon {
        transform: none !important;
    }

    .branch-card__bg {
        transition: none !important;
    }

    .branch-card__icon {
        transition: none !important;
    }

    .branch-card__glow {
        display: none !important;
    }

    .branch-card__title {
        transition: none !important;
    }

    .branch-card--tattoo:hover .branch-card__title {
        color: #fff;
        text-shadow: none;
    }

    .branch-card--gallery:hover .branch-card__title {
        text-shadow: none;
    }
}

/* Also block hover effects on any touch-primary device regardless of width */
@media (hover: none) {
    .branch-card {
        transition: none !important;
    }

    .branch-selector:hover .branch-card,
    .branch-selector:hover .branch-card:hover {
        flex: 1 !important;
    }

    .branch-selector:hover .branch-card:not(:hover) .branch-card__bg {
        opacity: 0.3 !important;
        transform: none !important;
    }

    .branch-selector:hover .branch-card:hover .branch-card__bg {
        transform: none !important;
    }

    .branch-selector:hover .branch-card:hover .branch-card__content,
    .branch-selector:hover .branch-card:not(:hover) .branch-card__content {
        transform: none !important;
        opacity: 1 !important;
    }

    .branch-card:hover .branch-card__icon {
        transform: none !important;
    }

    .branch-card__bg,
    .branch-card__icon,
    .branch-card__title,
    .branch-card__content {
        transition: none !important;
    }

    .branch-card__glow {
        display: none !important;
    }
}

/* ============================================
   PERF-MINIMAL & PERF-REDUCED OVERRIDES
   Aggressively disable ALL hover animations for both reduced and minimal
   ============================================ */
body.perf-minimal .branch-card,
body.perf-reduced .branch-card {
    transition: none !important;
}

body.perf-minimal .branch-card__content,
body.perf-reduced .branch-card__content {
    transition: none !important;
}

body.perf-minimal .branch-card__bg,
body.perf-reduced .branch-card__bg {
    transition: none !important;
}

body.perf-minimal .branch-card__icon,
body.perf-reduced .branch-card__icon {
    transition: none !important;
}

body.perf-minimal .branch-card__glow,
body.perf-reduced .branch-card__glow {
    display: none !important;
}

body.perf-minimal .branch-selector:hover .branch-card,
body.perf-reduced .branch-selector:hover .branch-card,
body.perf-minimal .branch-selector:hover .branch-card:hover,
body.perf-reduced .branch-selector:hover .branch-card:hover {
    flex: 1 !important;
}

/* Disable content scale/opacity hover effects */
body.perf-minimal .branch-selector:hover .branch-card:hover .branch-card__content,
body.perf-reduced .branch-selector:hover .branch-card:hover .branch-card__content {
    transform: none !important;
    opacity: 1 !important;
}

body.perf-minimal .branch-selector:hover .branch-card:not(:hover) .branch-card__content,
body.perf-reduced .branch-selector:hover .branch-card:not(:hover) .branch-card__content {
    opacity: 1 !important;
    transform: none !important;
}

/* Disable bg zoom on hover */
body.perf-minimal .branch-selector:hover .branch-card:hover .branch-card__bg,
body.perf-reduced .branch-selector:hover .branch-card:hover .branch-card__bg {
    transform: none !important;
}

body.perf-minimal .branch-selector:hover .branch-card:not(:hover) .branch-card__bg,
body.perf-reduced .branch-selector:hover .branch-card:not(:hover) .branch-card__bg {
    opacity: 0.3 !important;
}

/* Disable icon scale on hover */
body.perf-minimal .branch-card:hover .branch-card__icon,
body.perf-reduced .branch-card:hover .branch-card__icon {
    transform: none !important;
}

/* Disable title text-shadow on hover */
body.perf-minimal .branch-card__title,
body.perf-reduced .branch-card__title {
    transition: none !important;
}

body.perf-minimal .branch-card__ornament,
body.perf-reduced .branch-card__ornament {
    transition: none !important;
}