/* Site logo — composite mark + text (PNG icons have large canvas) */
.site-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1.2;
}

.site-logo-composite {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.site-logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(32, 114, 243, 0.35);
    background: linear-gradient(145deg, #2072f3 0%, #1557c7 100%);
}

.site-logo-mark-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.site-logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.site-logo-name {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.15;
    white-space: nowrap;
}

.site-logo-tagline {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #2072f3;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

/* Mobile homepage overrides nowrap/ellipsis so tagline stays fully readable */
@media (max-width: 768px) {
    body.page-home .header-row .site-logo-tagline {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        max-width: none;
    }
}

/* Header + institute — same primary logo sizing */
.header-row .site-logo-link,
.inst-header-brand .site-logo-link {
    max-width: min(360px, 48vw);
}

.header-row .site-logo-mark,
.inst-header-brand .site-logo-mark {
    width: 54px;
    height: 54px;
}

.header-row .site-logo-name,
.inst-header-brand .site-logo-name {
    font-size: 19px;
    color: #0f172a;
    -webkit-text-fill-color: currentColor;
    background: none;
}

.header-row .site-logo-tagline,
.inst-header-brand .site-logo-tagline {
    color: #2072f3;
    opacity: 1;
}

/* Dark backgrounds (footer, drawer) */
.site-logo-composite--on-dark .site-logo-name {
    color: #fff;
}

.site-logo-composite--on-dark .site-logo-tagline {
    color: #7dd3fc;
}

.site-logo-composite--on-dark .site-logo-mark {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.logo--footer.site-logo-link {
    margin-bottom: 16px;
}

/* Mobile drawer — slightly smaller */
.site-logo-composite--compact .site-logo-name {
    font-size: 16px;
}

.site-logo-composite--compact .site-logo-tagline {
    font-size: 10px;
    max-width: 180px;
}

.site-logo-composite--compact .site-logo-mark {
    width: 46px;
    height: 46px;
}

/* Plain img fallback (PDF zoom crop) */
.site-logo-img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.site-logo-viewport {
    width: 280px;
    height: 62px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.site-logo-viewport .site-logo-img {
    height: 280px;
    width: auto;
    max-width: none;
    margin-left: -12%;
    margin-top: 0;
}

.site-logo-img--auth {
    height: 100px;
    max-width: 220px;
    margin: 0 auto;
}

.site-logo-img--auth-mobile {
    height: 48px;
}

.site-logo-img--user-bar {
    height: 40px;
}

.site-logo-img--admin {
    height: 48px;
    margin-bottom: 8px;
}

.site-logo-img--institute {
    height: 48px;
    flex-shrink: 0;
}

.doc-brand-logo .site-logo-composite--doc .site-logo-mark {
    width: 48px;
    height: 48px;
}

.doc-brand-logo .site-logo-composite--doc .site-logo-name {
    font-size: 16px;
}

.doc-brand-logo .site-logo-composite--doc .site-logo-tagline {
    font-size: 10px;
}

.user-auth-logo--img {
    text-align: center;
    margin-bottom: 12px;
}

/* Brand panel (dark) — stacked mark + white text */
.user-auth-logo--light.user-auth-logo--img .site-logo-composite {
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.user-auth-logo--light.user-auth-logo--img .site-logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.user-auth-logo--light.user-auth-logo--img .site-logo-text {
    text-align: left;
}

.user-auth-logo--light.user-auth-logo--img .site-logo-name {
    color: #fff;
    font-size: 18px;
    text-align: left;
}

.user-auth-logo--light.user-auth-logo--img .site-logo-tagline {
    color: rgba(125, 211, 252, 0.95);
    text-align: left;
    max-width: none;
}

/* Card logo (light background) — single mark, readable name */
.user-auth-logo--mobile.user-auth-logo--img .site-logo-composite {
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.user-auth-logo--mobile.user-auth-logo--img .site-logo-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
}

.user-auth-logo--mobile.user-auth-logo--img .site-logo-name {
    color: #0f172a;
    font-size: 18px;
    text-align: center;
}

.user-topbar-logo--img .site-logo-composite {
    gap: 8px;
}

.user-topbar-logo--img .site-logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.user-topbar-logo--img .site-logo-name {
    font-size: 15px;
}

.user-topbar-logo--img .site-logo-tagline {
    display: none;
}

.admin-sidebar-logo .site-logo-composite {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.admin-sidebar-logo .site-logo-mark {
    width: 44px;
    height: 44px;
}

.admin-sidebar-logo .site-logo-name {
    font-size: 14px;
    color: #fff;
}

.admin-sidebar-logo .site-logo-tagline {
    display: none;
}

@media (max-width: 1280px) {
    .header-row .site-logo-tagline,
    .inst-header-brand .site-logo-tagline {
        max-width: 160px;
        font-size: 10px;
    }
    .header-row .site-logo-name,
    .inst-header-brand .site-logo-name {
        font-size: 17px;
    }
}

@media (max-width: 992px) {
    .header-row .site-logo-tagline,
    .inst-header-brand .site-logo-tagline {
        display: none;
    }

    /* Homepage: show tagline (mobile white header styles override color in mobile-app.css) */
    body.page-home .header-row .site-logo-tagline {
        display: block !important;
        font-size: 11px;
        font-weight: 600;
        color: #94a3b8 !important;
        -webkit-text-fill-color: #94a3b8 !important;
        max-width: none;
        overflow: visible;
        text-overflow: unset;
        white-space: normal;
        line-height: 1.35;
    }

    .header-row .site-logo-link,
    .inst-header-brand .site-logo-link {
        max-width: none;
        flex: 1;
        min-width: 0;
    }

    .header-row .site-logo-mark,
    .inst-header-brand .site-logo-mark {
        width: 50px;
        height: 50px;
        border-radius: 13px;
    }

    .header-row .site-logo-name,
    .inst-header-brand .site-logo-name {
        font-size: 16px;
        font-weight: 800;
        max-width: none;
        overflow: visible;
        text-overflow: unset;
    }

    .header-row .site-logo-composite,
    .inst-header-brand .site-logo-composite {
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .header-row .site-logo-link {
        max-width: none;
    }

    .header-row .site-logo-mark {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
        box-shadow: 0 4px 20px rgba(32, 114, 243, 0.5);
    }

    /* Mobile home uses white header — dark brand text (see mobile-app.css) */
    body.page-home .header-row .site-logo-name {
        color: #0b1b3a !important;
        -webkit-text-fill-color: #0b1b3a !important;
        font-size: 16px;
        text-shadow: none;
    }

    body:not(.page-home) .header-row .site-logo-name {
        color: #0f172a !important;
        -webkit-text-fill-color: #0f172a !important;
        font-size: 15px;
    }

    body:not(.page-home) .header-system {
        background: #fff !important;
        border-bottom: 1px solid #eef2f7 !important;
    }
}

@media (max-width: 480px) {
    .header-row .site-logo-mark,
    .inst-header-brand .site-logo-mark {
        width: 48px;
        height: 48px;
    }

    .header-row .site-logo-name,
    .inst-header-brand .site-logo-name {
        font-size: 15px;
    }
}
