/* ═══════════════════════════════════════════════
   Bejco Medarbejdere — Frontend Styles
   ═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* Variables on :root so they're accessible to the popup (which lives outside .bm-section) */
:root {
    --bm-blue-deep:   #00458a;
    --bm-blue-bright: #2885c1;
    --bm-red:         #e2161c;
    --bm-cream:       #f7f0da;
    --bm-white:       #ffffff;
    --bm-off-white:   #fafbfc;
    --bm-ink-900:     #0a1628;
    --bm-ink-700:     #2a3748;
    --bm-ink-500:     #5a6578;
    --bm-ink-300:     #a8b0bd;
    --bm-ink-100:     #e5e9ef;
    --bm-radius-md:   16px;
    --bm-radius-lg:   24px;
    --bm-ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
}

.bm-section {
    margin-bottom: 80px;
    font-family: 'Source Sans 3', system-ui, sans-serif;
}

.bm-section:last-child {
    margin-bottom: 0;
}

/* ── Section head ─────────────────────────────── */
.bm-section-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 40px;

    opacity: 0;
    transform: translateY(16px);
    transition: opacity .6s var(--bm-ease-out), transform .6s var(--bm-ease-out);
}

.bm-section-head.bm-visible {
    opacity: 1;
    transform: translateY(0);
}

.bm-section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bm-red);
}

.bm-section-eyebrow::before,
.bm-section-eyebrow::after {
    content: '';
    width: 32px;
    height: 2px;
    background: var(--bm-red);
    border-radius: 2px;
}

.bm-section-title {
    font-family: 'Oswald', system-ui, sans-serif !important;
    font-size: clamp(1.875rem, 3.4vw, 2.75rem) !important;
    font-weight: 500 !important;
    color: var(--bm-ink-900) !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    text-align: center !important;
}

/* ── Grid ─────────────────────────────────────── */
.bm-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.bm-grid > .bm-card {
    flex: 0 1 260px;
    max-width: 320px;
}

@media (max-width: 640px) {
    .bm-grid {
        gap: 14px;
    }
    .bm-grid > .bm-card {
        flex: 1 1 200px;
        max-width: none;
    }
}

/* ── Card ─────────────────────────────────────── */
.bm-card {
    background: var(--bm-white);
    border-radius: var(--bm-radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 69, 138, 0.04), 0 2px 6px rgba(0, 69, 138, 0.04);
    isolation: isolate;
    transition: transform .42s var(--bm-ease-out),
                box-shadow .42s var(--bm-ease-out),
                opacity .5s var(--bm-ease-out);

    /* Stagger animation — start hidden */
    opacity: 0;
    transform: translateY(28px);

    display: flex;
    flex-direction: column;
}

.bm-card.bm-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
    .bm-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 28px rgba(0, 69, 138, 0.08), 0 24px 56px rgba(0, 69, 138, 0.1);
    }
}

/* ── Card image ───────────────────────────────── */
.bm-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    background: var(--bm-cream);
    overflow: hidden;
}

.bm-card-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(0, 69, 138, 0.12), transparent 60%),
        linear-gradient(180deg, transparent 60%, rgba(0, 69, 138, 0.05) 100%);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity .42s var(--bm-ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .bm-card:hover .bm-card-image::before { opacity: 1; }
}

.bm-card-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center top;
    transition: transform .65s var(--bm-ease-out), filter .42s ease;
    filter: saturate(0.95);
}

@media (hover: hover) and (pointer: fine) {
    .bm-card:hover .bm-card-image img {
        transform: scale(1.04);
        filter: saturate(1.05);
    }
}

/* ── Card body ────────────────────────────────── */
.bm-card-body {
    padding: 22px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.bm-card-name {
    font-family: 'Oswald', system-ui, sans-serif !important;
    font-size: 1.25rem !important;
    font-weight: 500 !important;
    color: var(--bm-ink-900) !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    letter-spacing: -0.01em !important;
}

.bm-card-title {
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    color: var(--bm-red) !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

/* ── Contacts ─────────────────────────────────── */
.bm-card-contacts {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--bm-ink-100);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bm-card-contact {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--bm-ink-700);
    text-decoration: none !important;
    transition: color .22s ease, transform .32s var(--bm-ease-out);
    line-height: 1.4;
    word-break: break-word;
}

.bm-contact-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bm-cream);
    color: var(--bm-blue-deep);
    flex-shrink: 0;
    transition: background-color .32s ease, color .32s ease, transform .42s var(--bm-ease-out);
}

.bm-contact-icon svg {
    width: 14px;
    height: 14px;
}

.bm-contact-text {
    flex: 1;
    min-width: 0;
}

@media (hover: hover) and (pointer: fine) {
    .bm-card-contact:hover {
        color: var(--bm-blue-deep);
    }
    .bm-card-contact:hover .bm-contact-icon {
        background: var(--bm-red);
        color: var(--bm-white);
        transform: rotate(-8deg) scale(1.06);
    }
}

/* ── Reduced motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .bm-card,
    .bm-section-head {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .bm-card-image img,
    .bm-contact-icon {
        transition: none !important;
    }
}

/* ═══════════════════════════════════════════════
   v1.2.0 — "Læs mere"-knap på kort + flot popup
   ═══════════════════════════════════════════════ */

/* "Læs mere"-CTA on the card */
.bm-card-cta {
    appearance: none;
    -webkit-appearance: none;
    margin-top: 18px;
    margin-bottom: -2px;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px 10px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--bm-blue-deep);
    color: #fff;
    cursor: pointer;
    font-family: 'Source Sans 3', system-ui, sans-serif !important;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(0, 69, 138, 0.18);
    transition: background-color .28s ease,
                box-shadow .28s ease,
                transform .32s var(--bm-ease-out),
                padding .28s var(--bm-ease-out);
}

.bm-card-cta:focus-visible {
    outline: 3px solid var(--bm-blue-bright);
    outline-offset: 3px;
}

.bm-card-cta-arrow {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .32s var(--bm-ease-out);
}

.bm-card-cta-arrow svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

@media (hover: hover) and (pointer: fine) {
    .bm-card-cta:hover {
        background: var(--bm-red);
        box-shadow: 0 10px 22px rgba(226, 22, 28, 0.25);
        padding-right: 22px;
    }
    .bm-card-cta:hover .bm-card-cta-arrow {
        transform: translateX(3px);
    }
}

.bm-card-cta:active {
    transform: scale(0.97);
}

/* Subtle name color shift when hovering the card with a CTA */
@media (hover: hover) and (pointer: fine) {
    .bm-card--has-popup:hover .bm-card-name {
        color: var(--bm-blue-deep);
        transition: color .22s ease;
    }
}

/* ── Popup overlay ── */
.bm-popup-overlay {
    /* Hidden by default — controlled by .bm-popup-preparing / .bm-popup-open / .bm-popup-closing */
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 22, 40, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background-color .42s cubic-bezier(.23,1,.32,1),
                backdrop-filter .42s cubic-bezier(.23,1,.32,1),
                -webkit-backdrop-filter .42s cubic-bezier(.23,1,.32,1);
}

.bm-popup-overlay.bm-popup-preparing,
.bm-popup-overlay.bm-popup-open,
.bm-popup-overlay.bm-popup-closing {
    display: flex;
}

.bm-popup-overlay.bm-popup-open {
    background: rgba(10, 22, 40, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* The popup card */
.bm-popup-overlay .bm-popup {
    position: relative;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-radius: 24px;
    width: 100%;
    max-width: 920px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    display: grid;
    grid-template-columns: 5fr 6fr;
    box-shadow: 0 25px 70px rgba(0, 22, 60, 0.4),
                0 8px 24px rgba(0, 22, 60, 0.18);

    /* Initial (preparing) state — invisible, slightly down + scaled */
    opacity: 0;
    transform: translateY(28px) scale(0.94);
    transition: opacity .48s cubic-bezier(.23,1,.32,1),
                transform .55s cubic-bezier(.23,1,.32,1);
}

.bm-popup-overlay.bm-popup-open .bm-popup {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Closing state — gracefully glide out */
.bm-popup-overlay.bm-popup-closing .bm-popup {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
}

/* When there's no situational image, collapse the grid */
.bm-popup-overlay .bm-popup.bm-popup--no-media {
    grid-template-columns: 1fr;
    max-width: 560px;
}

/* ── Popup close button ── */
.bm-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--bm-ink-900);
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 22, 60, 0.2);
    transition: transform .28s var(--bm-ease-out),
                background-color .28s ease,
                color .28s ease;
    padding: 0;
}
.bm-popup-close svg { width: 18px; height: 18px; }
.bm-popup-close:hover {
    background: var(--bm-red);
    color: #fff;
    transform: rotate(90deg);
}
.bm-popup-close:focus-visible {
    outline: 3px solid var(--bm-blue-bright);
    outline-offset: 2px;
}

/* ── Popup media (left column) ── */
.bm-popup-media {
    background: var(--bm-cream);
    overflow: hidden;
    aspect-ratio: 4/5;
    min-height: 100%;
    position: relative;
}

.bm-popup-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(0, 69, 138, 0.08) 100%);
    pointer-events: none;
}

.bm-popup-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;

    /* Subtle entrance scale-in */
    transform: scale(1.06);
    transition: transform 1.1s cubic-bezier(.23,1,.32,1);
}

.bm-popup-overlay.bm-popup-open .bm-popup-media img {
    transform: scale(1);
}

/* ── Popup body (right column) ── */
.bm-popup-overlay .bm-popup .bm-popup-body {
    /* EXPLICIT background — without this, the right column was transparent.
       Hex fallback so it works even if --bm-white isn't resolved by the host theme. */
    background: #ffffff !important;
    background-color: #ffffff !important;
    padding: 44px 44px 38px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;

    font-family: 'Source Sans 3', system-ui, sans-serif !important;

    /* Stagger entrance for inner content */
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .55s var(--bm-ease-out, cubic-bezier(.23,1,.32,1)) .12s,
                transform .55s var(--bm-ease-out, cubic-bezier(.23,1,.32,1)) .12s;
}

.bm-popup-overlay.bm-popup-open .bm-popup-body {
    opacity: 1;
    transform: translateY(0);
}

.bm-popup-eyebrow {
    font-family: 'Source Sans 3', system-ui, sans-serif !important;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bm-red);
}

.bm-popup-name {
    font-family: 'Oswald', system-ui, sans-serif !important;
    font-size: clamp(1.625rem, 2.6vw, 2.125rem) !important;
    font-weight: 500 !important;
    color: var(--bm-ink-900) !important;
    line-height: 1.12 !important;
    letter-spacing: -0.01em !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.bm-popup-desc {
    font-family: 'Source Sans 3', system-ui, sans-serif !important;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--bm-ink-700);
    white-space: pre-wrap;
    margin-top: 6px;
}

.bm-popup-contacts {
    margin-top: 14px;
    padding-top: 20px;
    border-top: 1px solid var(--bm-ink-100);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bm-popup-contact {
    font-family: 'Source Sans 3', system-ui, sans-serif !important;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--bm-ink-700);
    text-decoration: none !important;
    transition: color .22s ease;
    line-height: 1.4;
    word-break: break-word;
}

.bm-popup-contact-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bm-cream);
    color: var(--bm-blue-deep);
    flex-shrink: 0;
    transition: background-color .32s ease, color .32s ease, transform .42s var(--bm-ease-out);
}

.bm-popup-contact-icon svg {
    width: 16px;
    height: 16px;
}

@media (hover: hover) and (pointer: fine) {
    .bm-popup-contact:hover {
        color: var(--bm-blue-deep);
    }
    .bm-popup-contact:hover .bm-popup-contact-icon {
        background: var(--bm-red);
        color: #fff;
        transform: rotate(-8deg) scale(1.06);
    }
}

/* ── Popup mobile ── */
@media (max-width: 720px) {
    .bm-popup-overlay {
        padding: 0;
        align-items: stretch;
    }
    .bm-popup {
        grid-template-columns: 1fr;
        max-width: none;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        overflow-y: auto;

        /* Slide up from bottom on mobile for native-feel */
        transform: translateY(100%);
    }
    .bm-popup-overlay.bm-popup-open .bm-popup {
        transform: translateY(0);
    }
    .bm-popup-overlay.bm-popup-closing .bm-popup {
        transform: translateY(100%);
    }
    .bm-popup-media {
        aspect-ratio: 4/3;
        min-height: 0;
    }
    .bm-popup-body {
        padding: 30px 22px 36px;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .bm-popup-overlay,
    .bm-popup,
    .bm-popup-body,
    .bm-popup-media img,
    .bm-popup-close,
    .bm-card-cta,
    .bm-card-cta-arrow {
        transition: none !important;
    }
    .bm-popup,
    .bm-popup-body {
        transform: none !important;
        opacity: 1 !important;
    }
    .bm-popup-media img {
        transform: scale(1) !important;
    }
}
