/* Only apply horizontal layout to Desktop (screens wider than 1200px) */
@media (min-width: 1200px) {
    ul#menu-home-menu {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    li.menu-lang-switch {
        margin-top: 0 !important;
        margin-left: 20px !important;
    }
}

/* Prevent menu links from overlapping the logo on in-between screen sizes */
@media (max-width: 1199px) {
    ul#menu-home-menu {
        gap: 10px;
    }
    /* Forces the logo image to maintain its native aspect ratio without distortion */
    .elementor-widget-theme-site-logo img, 
    .custom-logo-link img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Fix the Japanese text wrapping (applies to all devices) */
li.menu-lang-switch a {
    white-space: nowrap !important;
    display: inline-block !important;
}

.ga-menu-divider > a {
    pointer-events: none;
    cursor: default;
    color: transparent !important;
    padding: 0px 0;
    margin: 0px 0;
    position: relative;
}

.ga-menu-divider > a::after {
    content: "";
    display: block;
    height: 3px;              /* thicker line */
    width: 400%;               /* nearly full width */
    margin: 0 auto;
    border-radius: 1px;

    background: linear-gradient(
        90deg,
        rgba(71, 158, 255, 0) 0%,
        #479EFF 20%,
        #479EFF 80%,
        rgba(71, 158, 255, 0) 100%
    );
}

.single-post .wp-block-list {
    margin-top: 0.75em;
    margin-bottom: 1.5em;
}

.single-post .wp-block-list li {
    margin-bottom: 0.35em;
}

.single-post .wp-block-list + p {
    margin-top: 1.25em;
}

/* Prevent container flashing with an automatic fail-safe */
html:not(.wp-admin) {
    animation: permanentFadeIn 0.1s ease-in forwards;
    /* Keeps page hidden initially for up to 1.5s maximum if styles hang */
    animation-delay: 0s; 
}

html:not(.wp-admin).elementor-html, 
html:not(.wp-admin):has(.elementor),
.elementor-editor-active html {
    opacity: 1 !important;
}

/* Fail-safe: If Elementor completely fails to load after 1.5s, force show the content */
@keyframes permanentFadeIn {
    0% { opacity: 0; }
    99% { opacity: 0; }
    100% { opacity: 1; }
}