/* Focused mobile reading improvements for the inherited Sakura theme. */

@media (min-width: 861px) {
    /* Reduce the desktop navigation bar from 75px to 72px. */
    .site-header {
        height: 72px;
    }

    .site-header .site-branding {
        height: 72px;
        line-height: 72px;
    }

    .site-top .lower {
        top: 13.5px;
    }

    .site-header .header-user-avatar,
    .site-header .searchbox {
        margin-top: 18.5px;
    }

    /* Lift only the desktop text logo; mobile keeps its inherited position. */
    .site-header .logolink.moe-mashiro.keaifont {
        position: relative;
        top: -6px;
    }

    .site-top .lower nav.navbar > ul > li > a {
        margin: 0 -2px;
        padding: 10px 7px;
        border-radius: 9px;
        background-color: transparent;
        transition: color .18s ease, background-color .18s ease, transform .18s ease;
    }

    .site-top .lower nav.navbar > ul > li > a:hover,
    .site-top .lower nav.navbar > ul > li > a:focus-visible {
        color: #df861f;
        background-color: rgba(254, 150, 0, .1);
        transform: translateY(-1px);
    }

    .site-top .lower nav.navbar > ul > li.current-menu-item > a,
    .site-top .lower nav.navbar > ul > li.current-menu-ancestor > a {
        color: #d77d17;
        background-color: rgba(254, 150, 0, .07);
    }

    body.dark .site-top .lower nav.navbar > ul > li > a:hover,
    body.dark .site-top .lower nav.navbar > ul > li > a:focus-visible,
    body.dark .site-top .lower nav.navbar > ul > li.current-menu-item > a,
    body.dark .site-top .lower nav.navbar > ul > li.current-menu-ancestor > a {
        color: #f1a34b;
        background-color: rgba(255, 174, 72, .12);
    }
}

@media (max-width: 860px) {
    :root {
        --wnlen-mobile-drawer-width: min(76vw, 260px);
        --wnlen-mobile-nav-accent: #ed8b24;
        --wnlen-mobile-nav-ink: #302b27;
        --wnlen-mobile-nav-muted: #837a73;
        --wnlen-mobile-nav-surface: rgba(255, 255, 255, .96);
    }

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overflow-x: clip;
        scrollbar-width: none;
        scrollbar-color: transparent transparent;
    }

    ::-webkit-scrollbar {
        display: none;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }

    /* The page-level desktop cover rule is emitted after the parent CSS. */
    .headertop {
        width: 100vw;
        max-width: 100vw;
        overflow: hidden;
    }

    #centerbg.centerbg {
        display: block;
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
        margin-right: 0;
        margin-left: 0;
        background-image: url("https://api.wenyicai.cn/api/picture?action=mobile") !important;
        background-attachment: scroll;
        background-position: center center;
        background-repeat: no-repeat;
        background-size: cover;
    }

    /* Mobile drawer and its trigger. */
    body.navOpen {
        overflow: hidden;
        overscroll-behavior: none;
    }

    #main-container {
        transition: none !important;
    }

    #main-container.open {
        position: relative;
        right: auto;
        left: auto;
        width: 100%;
        transform: none;
        -webkit-transform: none;
    }

    #main-container.open::before {
        display: none;
    }

    .wnlen-mobile-nav-scrim {
        position: fixed;
        z-index: 99990;
        inset: 0;
        width: auto;
        height: auto;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: rgba(24, 20, 17, .42);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        box-shadow: none;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        cursor: pointer;
        transition: opacity .28s ease, visibility 0s linear .28s;
    }

    #main-container.open .wnlen-mobile-nav-scrim {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .openNav {
        position: absolute;
        z-index: 1000;
        top: env(safe-area-inset-top, 0);
        height: 64px !important;
        pointer-events: none;
    }

    .openNav .site-branding {
        margin-right: 0;
        pointer-events: auto;
        transition: opacity .2s ease;
    }

    .wnlen-mobile-nav-scrim,
    .search-form--modal,
    #night-mode-cover,
    .aplayer-lrc {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    .openNav.open .site-branding {
        opacity: 0;
    }

    .openNav .iconflat {
        position: absolute;
        top: 10px;
        left: max(10px, env(safe-area-inset-left));
        float: none;
        display: block;
        width: 40px !important;
        height: 40px !important;
        border: 1px solid rgba(255, 255, 255, .28);
        border-radius: 50%;
        color: rgba(62, 57, 53, .78);
        background: rgba(255, 255, 255, .32);
        -webkit-backdrop-filter: saturate(120%) blur(6px);
        backdrop-filter: saturate(120%) blur(6px);
        box-shadow: none;
        opacity: .72;
        pointer-events: auto;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: opacity .2s ease, border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
    }

    .openNav .iconflat::after {
        display: none;
        content: none;
    }

    .openNav .iconflat:hover,
    .openNav .iconflat:focus-visible,
    .openNav.open .iconflat {
        opacity: 1;
    }

    .openNav .iconflat:active {
        transform: scale(.95);
    }

    .openNav .iconflat:focus-visible {
        outline: 2px solid rgba(254, 150, 0, .24);
        outline-offset: 2px;
    }

    .openNav .icon {
        top: 19px;
        left: 11px;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background-color: currentColor;
    }

    .openNav .icon::before,
    .openNav .icon::after {
        left: 0;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background-color: currentColor;
    }

    .openNav .icon::before {
        top: -6px;
    }

    .openNav .icon::after {
        top: 6px;
    }

    .openNav.open .iconflat {
        width: 40px !important;
        border-color: rgba(255, 255, 255, .42);
        color: #fff;
        background: rgba(207, 139, 84, .9);
        box-shadow: none;
    }

    .openNav.open .icon::before,
    .openNav.open .icon::after {
        background: currentColor;
    }

    #mo-nav {
        box-sizing: border-box;
        position: fixed;
        z-index: 999;
        top: 0;
        bottom: 0;
        left: 0;
        width: var(--wnlen-mobile-drawer-width);
        max-width: none !important;
        height: auto;
        padding: calc(16px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom));
        color: var(--wnlen-mobile-nav-ink);
        background:
            radial-gradient(circle at 12% 0, rgba(254, 150, 0, .08), transparent 38%),
            var(--wnlen-mobile-nav-surface);
        box-shadow: 12px 0 34px rgba(36, 29, 24, .12);
        overflow-x: hidden !important;
        overflow-y: auto;
        overscroll-behavior: contain;
        touch-action: pan-y;
        opacity: 0;
        visibility: hidden;
        transform: translate3d(-100%, 0, 0);
        transition: transform .38s cubic-bezier(.22, 1, .36, 1), opacity .22s ease, visibility 0s linear .38s;
    }

    #mo-nav.open {
        width: var(--wnlen-mobile-drawer-width);
        opacity: 1;
        visibility: visible;
        transform: translate3d(0, 0, 0);
        transition-delay: 0s;
    }

    #mo-nav .m-avatar {
        width: auto;
        max-width: none;
        padding: 8px 0 0;
    }

    #mo-nav .m-avatar img {
        width: 64px;
        height: 64px;
        max-width: 64px;
        border: 3px solid rgba(255, 255, 255, .9);
        box-shadow: 0 8px 24px rgba(59, 44, 33, .16);
    }

    #mo-nav .m-name p {
        margin: 9px 0 6px;
        color: var(--wnlen-mobile-nav-ink) !important;
        font-size: 16px;
    }

    #mo-nav .m-icon p {
        margin: 0 0 12px;
        word-spacing: 13px !important;
    }

    #mo-nav .m-icon a {
        display: inline-grid;
        min-width: 30px;
        min-height: 30px;
        place-items: center;
        border-radius: 50%;
    }

    #mo-nav .m-icon a img {
        top: 0 !important;
        width: 18px;
        max-width: 18px !important;
    }

    #mo-nav .m-search form {
        width: 100%;
        max-width: none;
        margin: 0 0 12px;
        padding: 0;
        background: transparent;
    }

    #mo-nav .m-search input {
        min-height: 40px;
        padding: 8px 14px;
        border: 1px solid rgba(78, 65, 55, .1);
        border-radius: 12px;
        color: var(--wnlen-mobile-nav-ink);
        background: rgba(245, 241, 237, .78);
        box-shadow: inset 0 1px 2px rgba(47, 38, 31, .03);
        transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
    }

    #mo-nav .m-search input:focus {
        border-color: rgba(254, 150, 0, .48);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(254, 150, 0, .11);
    }

    #mo-nav > ul {
        width: 100%;
        margin: 0;
        padding: 2px 0 0;
    }

    #mo-nav ul li {
        margin: 2px 0;
        padding: 0;
        border-radius: 11px;
    }

    #mo-nav ul li a {
        display: flex;
        min-height: 40px;
        padding: 9px 12px;
        align-items: center;
        border-radius: 11px;
        color: var(--wnlen-mobile-nav-ink);
        font-size: 15px;
        line-height: 1.45;
        transition: color .18s ease, background-color .18s ease, transform .18s ease;
    }

    #mo-nav > ul > li > a:hover,
    #mo-nav > ul > li > a:focus-visible,
    #mo-nav > ul > li.current-menu-item > a,
    #mo-nav > ul > li.current-menu-ancestor > a {
        color: #d87816;
        background: rgba(254, 150, 0, .1);
    }

    #mo-nav ul li a:active {
        transform: scale(.98);
    }

    #mo-nav li ul {
        width: auto;
        margin: 2px 0 6px 12px;
        padding: 3px 0 3px 10px;
        border-left: 1px solid rgba(254, 150, 0, .2);
    }

    #mo-nav li ul li {
        padding: 0;
    }

    #mo-nav li ul li a {
        min-height: 36px;
        padding: 7px 11px;
        color: var(--wnlen-mobile-nav-muted);
        font-size: 13px;
    }

    body.dark {
        --wnlen-mobile-nav-ink: #f1ece7;
        --wnlen-mobile-nav-muted: #aaa19a;
        --wnlen-mobile-nav-surface: rgba(31, 31, 34, .97);
    }

    body.dark #mo-nav {
        background:
            radial-gradient(circle at 12% 0, rgba(254, 150, 0, .08), transparent 38%),
            var(--wnlen-mobile-nav-surface);
        box-shadow: 12px 0 34px rgba(0, 0, 0, .24);
    }

    body.dark #mo-nav .m-search input {
        border-color: rgba(255, 255, 255, .08);
        color: var(--wnlen-mobile-nav-ink);
        background: rgba(255, 255, 255, .06);
    }

    body.dark #mo-nav .m-search input:focus {
        border-color: rgba(254, 150, 0, .45);
        background: rgba(255, 255, 255, .09);
    }

    body.dark #mo-nav .m-icon .fa-github {
        color: #eee !important;
    }

    body.dark .openNav .iconflat:not(:active) {
        border-color: rgba(255, 255, 255, .12);
        color: rgba(242, 238, 233, .78);
        background: rgba(38, 38, 41, .28);
    }

    body.dark .openNav.open .iconflat {
        color: #fff;
        background: rgba(190, 124, 74, .9);
    }

    /* Home cards: clearer hierarchy and stronger text contrast. */
    .post-list-thumb {
        margin: 10px 0 18px;
        border-radius: 12px;
        box-shadow: 0 10px 28px -18px rgba(0, 0, 0, .55);
    }

    .post-list-thumb .post-content-wrap {
        height: clamp(215px, 62vw, 270px);
        border-radius: 12px;
    }

    .post-content-wrap .post-content {
        padding: 52px 17px 17px;
        border-radius: 0 0 12px 12px;
        background: linear-gradient(to top, rgba(12, 16, 18, .78), rgba(12, 16, 18, .08));
    }

    .post-list-thumb .post-title {
        display: block;
        margin: -8px -8px 0;
        padding: 8px;
    }

    .post-list-thumb .post-title h3 {
        margin: 0;
        font-size: clamp(19px, 5.1vw, 22px);
        line-height: 1.35;
    }

    .post-list-thumb .post-date,
    .post-list-thumb .post-meta,
    .post-list-thumb .post-meta a {
        line-height: 1.6;
    }

    .post-list-thumb .post-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 2px 10px;
    }

    .post-list-thumb .comments-number {
        margin: 0;
    }

    .float-content p {
        line-height: 1.6;
    }

    /* Article typography and wide embedded content. */
    .entry-content {
        font-size: 16px;
        line-height: 1.85;
        overflow-wrap: anywhere;
    }

    .entry-content p {
        margin-bottom: 1.35em;
        font-size: 16px;
        line-height: 1.85;
    }

    .entry-content h2 {
        margin-top: 1.8em;
        font-size: 23px;
        line-height: 1.4;
    }

    .entry-content h3 {
        margin-top: 1.65em;
        font-size: 20px;
        line-height: 1.45;
    }

    .entry-content h4,
    .entry-content h5,
    .entry-content h6 {
        line-height: 1.5;
    }

    .entry-content figure {
        max-width: 100%;
        margin: 1.5em 0;
    }

    .entry-content img,
    .entry-content video,
    .entry-content iframe {
        max-width: 100%;
    }

    .entry-content img,
    .entry-content video {
        height: auto;
    }

    .entry-content blockquote {
        margin: 1.5em 0;
        padding: 16px 16px 16px 20px;
        border-left: 3px solid #fe9600;
        border-radius: 0 10px 10px 0;
        background: rgba(254, 150, 0, .06);
    }

    .entry-content blockquote::before,
    .entry-content blockquote::after {
        display: none;
    }

    .entry-content ul,
    .entry-content ol {
        margin-left: 1.35em;
        padding-left: .35em;
    }

    .entry-content pre {
        max-width: 100%;
        padding: 14px;
        border-radius: 8px;
        font-size: 13px;
        line-height: 1.65;
        -webkit-overflow-scrolling: touch;
    }

    .entry-content table:not(.motion-switcher-table) {
        display: block;
        overflow-x: auto;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    /* Compact the screening-room header without changing the desktop layout. */
    body.wnlen-cinema-view .blank {
        padding-top: 50px !important;
    }

    body.wnlen-cinema-view .wnlen-cinema-page {
        margin-top: 6px;
        margin-bottom: 44px;
    }

    body.wnlen-cinema-view .wnlen-cinema-page .site-main {
        padding-top: 0;
    }

    body.wnlen-cinema-view .wnlen-cinema-stage {
        padding-top: 22px;
        padding-bottom: 32px;
    }

    body.wnlen-cinema-view .wnlen-cinema-heading {
        margin-bottom: 14px;
        padding-bottom: 18px;
    }

    body.wnlen-cinema-view .wnlen-cinema-intro {
        margin-top: 12px;
    }

    body.wnlen-cinema-view .wnlen-cinema-formats {
        margin-bottom: 10px;
    }

    body.wnlen-cinema-view .wnlen-cinema-filters {
        gap: 6px;
        margin-bottom: 24px;
    }

    body.wnlen-cinema-view .wnlen-movie-card-copy {
        text-align: center;
    }

    body.wnlen-cinema-view .wnlen-movie-card-title {
        justify-content: center;
    }

    body.wnlen-cinema-view .wnlen-movie-card h2 {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .post-list-thumb .post-content-wrap {
        height: clamp(210px, 64vw, 245px);
    }

    .entry-content blockquote {
        padding: 14px 14px 14px 17px;
    }

    .entry-content .alignleft,
    .entry-content .alignright {
        float: none;
        display: block;
        margin: 1.25em auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    .post-list-thumb,
    .site-branding,
    .header-user-avatar,
    .searchbox,
    .site-top .lower,
    #content,
    .headertop,
    .pattern-center {
        animation: none !important;
    }

    .site-top .lower nav.navbar > ul > li > a {
        transition: none !important;
    }

    #main-container,
    #mo-nav,
    .openNav .iconflat,
    .openNav .site-branding,
    .openNav .icon,
    .openNav .icon::before,
    .openNav .icon::after,
    .wnlen-mobile-nav-scrim {
        transition: none !important;
    }

    .site-top .lower nav.navbar > ul > li > a:hover,
    .site-top .lower nav.navbar > ul > li > a:focus-visible {
        transform: none;
    }
}
