/* ==========================================================
   TypingTutor.Online — Universal Logo Visibility v17.7.6

   Nested sections use two theme-aware logo images inside
   .test-logo-stack. Older section styles mixed absolute
   positioning, display switching and opacity switching, which
   could collapse the logo container or hide both images.

   This final stylesheet creates one stable overlapping grid,
   reserves the correct header space and switches only opacity.
========================================================== */

.test-logo {
    box-sizing: border-box !important;
    width: min(280px, 100%) !important;
    min-width: 190px !important;
    min-height: 58px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: visible !important;
}

.test-logo-stack {
    box-sizing: border-box !important;
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    width: 280px !important;
    max-width: 100% !important;
    min-width: 190px !important;
    min-height: 58px !important;
    aspect-ratio: 280 / 58 !important;
    overflow: visible !important;
    isolation: isolate;
}

.test-logo-stack > .test-logo-light,
.test-logo-stack > .test-logo-dark {
    box-sizing: border-box !important;
    grid-area: 1 / 1 !important;
    position: static !important;
    inset: auto !important;
    z-index: 1;
    display: block !important;
    width: 100% !important;
    max-width: 280px !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 58px !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: left center !important;
    pointer-events: none !important;
    transition: opacity .16s ease, visibility .16s ease !important;
}

/* Reliable default, including pages before ThemeManager runs. */
.test-logo-stack > .test-logo-light {
    opacity: 1 !important;
    visibility: visible !important;
}

.test-logo-stack > .test-logo-dark {
    opacity: 0 !important;
    visibility: hidden !important;
}

html[data-theme="light"] .test-logo-stack > .test-logo-light,
html[data-resolved-theme="light"] .test-logo-stack > .test-logo-light {
    opacity: 1 !important;
    visibility: visible !important;
}

html[data-theme="light"] .test-logo-stack > .test-logo-dark,
html[data-resolved-theme="light"] .test-logo-stack > .test-logo-dark {
    opacity: 0 !important;
    visibility: hidden !important;
}

html[data-theme="dark"] .test-logo-stack > .test-logo-light,
html[data-resolved-theme="dark"] .test-logo-stack > .test-logo-light {
    opacity: 0 !important;
    visibility: hidden !important;
}

html[data-theme="dark"] .test-logo-stack > .test-logo-dark,
html[data-resolved-theme="dark"] .test-logo-stack > .test-logo-dark {
    opacity: 1 !important;
    visibility: visible !important;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .test-logo-stack > .test-logo-light {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    html[data-theme="system"] .test-logo-stack > .test-logo-dark {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

@media (prefers-color-scheme: light) {
    html[data-theme="system"] .test-logo-stack > .test-logo-light {
        opacity: 1 !important;
        visibility: visible !important;
    }

    html[data-theme="system"] .test-logo-stack > .test-logo-dark {
        opacity: 0 !important;
        visibility: hidden !important;
    }
}

@media (max-width: 760px) {
    .test-logo {
        width: min(220px, 100%) !important;
        min-width: 165px !important;
        min-height: 46px !important;
    }

    .test-logo-stack {
        width: 220px !important;
        min-width: 165px !important;
        min-height: 46px !important;
    }

    .test-logo-stack > .test-logo-light,
    .test-logo-stack > .test-logo-dark {
        max-width: 220px !important;
        max-height: 46px !important;
    }
}

@media (max-width: 440px) {
    .test-logo {
        width: 178px !important;
        min-width: 150px !important;
        min-height: 37px !important;
    }

    .test-logo-stack {
        width: 178px !important;
        min-width: 150px !important;
        min-height: 37px !important;
    }

    .test-logo-stack > .test-logo-light,
    .test-logo-stack > .test-logo-dark {
        max-width: 178px !important;
        max-height: 37px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .test-logo-stack > .test-logo-light,
    .test-logo-stack > .test-logo-dark {
        transition: none !important;
    }
}
