/* ============================================
   RyAurora 主题 - 响应式样式
   电脑端及移动端无感自适应
   ============================================ */

/* ---- 大屏 (>1024px): 默认布局 ---- */

/* ---- 平板 (768px ~ 1024px) ---- */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    article {
        gap: 16px;
        padding: 0 16px;
    }

    .nav > li > a {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .search_bar .input {
        width: 120px;
    }

    .fader {
        padding-top: 62%;
    }
}

/* ---- 移动端 (<768px) ---- */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
        --sidebar-width: 100%;
    }

    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    body {
        font-size: 15px;
        padding-top: var(--header-height);
    }

    .container {
        padding: 0 16px;
        max-width: 100%;
    }

    /* 隐藏 PC 导航，显示移动导航 */
    .menu {
        display: none;
    }

    header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100vw;
        z-index: 1000;
    }

    #mnav {
        display: block;
        width: 100%;
        max-width: 100%;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-sm);
    }

    #mnav h2 {
        max-width: var(--container-max);
        margin: 0 auto;
        padding: 0 16px;
        height: var(--header-height);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    #mnav .mlogo {
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--color-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    #mnav .navicon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
        border-radius: var(--radius-sm);
        transition: background var(--transition-fast);
        flex-shrink: 0;
    }

    #mnav .navicon:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    #mnav .navicon::before,
    #mnav .navicon::after {
        content: '';
        position: absolute;
        width: 22px;
        height: 2.5px;
        background: var(--color-text);
        border-radius: 2px;
        transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #mnav .navicon::before {
        transform: translateY(-6px);
    }

    #mnav .navicon::after {
        transform: translateY(6px);
    }

    /* 中间横线用 box-shadow 模拟 */
    #mnav .navicon {
        background: transparent;
        box-shadow: 0 0 0 0 var(--color-text);
    }

    #mnav h2:not(.open) .navicon {
        box-shadow: inset 0 0 0 2.5px transparent;
    }

    /* 中间横线用额外元素模拟 - 通过 navicon 本身背景 */
    #mnav h2:not(.open) .navicon {
        background-image: linear-gradient(var(--color-text), var(--color-text));
        background-size: 22px 2.5px;
        background-repeat: no-repeat;
        background-position: center;
    }

    /* 展开状态：变换为 X 关闭图标 */
    #mnav h2.open .navicon {
        background-image: none;
    }

    #mnav h2.open .navicon::before {
        transform: rotate(45deg);
    }

    #mnav h2.open .navicon::after {
        transform: rotate(-45deg);
    }

    #mnav .list_dl {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        padding: 0 16px;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease,
                    padding 0.3s ease;
    }

    #mnav h2.open + .list_dl {
        display: block;
        max-height: 80vh;
        overflow-y: auto;
        opacity: 1;
        padding: 8px 16px 16px;
    }

    #mnav .list_dt a {
        display: block;
        padding: 12px 16px;
        border-radius: var(--radius-md);
        font-size: 0.95rem;
        color: var(--color-text);
        font-weight: 500;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 3px solid transparent;
    }

    #mnav .list_dt a:hover,
    #mnav .list_dt a.current {
        background: rgba(13, 148, 136, 0.08);
        color: var(--color-primary);
        border-left-color: var(--color-primary);
        padding-left: 20px;
    }

    #mnav .list_dd {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        padding-left: 20px;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease 0.05s;
    }

    #mnav .list_dt.open + .list_dd {
        max-height: 300px;
        opacity: 1;
    }

    #mnav .list_dd li a {
        display: block;
        padding: 10px 14px;
        font-size: 0.88rem;
        color: var(--color-text-secondary);
        border-radius: var(--radius-sm);
        transition: all 0.2s ease;
        transform: translateX(0);
    }

    #mnav .list_dd li a:hover {
        color: var(--color-primary);
        background: rgba(13, 148, 136, 0.06);
        transform: translateX(4px);
    }

    /* 移动端搜索 */
    #mnav .search_bar {
        margin: 12px 0;
        width: 100%;
    }

    #mnav .search_bar .input {
        width: 100%;
    }

    /* 单栏布局 */
    article {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 0 12px;
        margin: 16px auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    article > .blank {
        display: none;
    }

    article > .blogsbox,
    article > .picsbox,
    article > .infosbox,
    article > .share,
    article > .timebox,
    article > .guestbook-container,
    article > .timeline-container,
    article > .search-results,
    article > .lry-form-box-wrap {
        width: 100%;
        max-width: 100%;
        grid-column: unset;
    }

    article > .sidebar {
        width: 100%;
        max-width: 100%;
        position: static;
        display: flex;
        flex-direction: column;
        gap: 12px;
        grid-column: unset;
    }

    /* Banner + 置顶推荐 上下堆叠 */
    .picsbox {
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        grid-template-columns: none;
    }

    .banner {
        width: 100%;
        max-width: 100%;
    }

    .fader {
        padding-top: 56.25%;
        width: 100%;
    }

    .toppic-widget {
        overflow: visible;
    }

    .toppic-widget .hometitle {
        margin-bottom: 12px;
    }

    .toppic-widget .toppic {
        position: static;
        flex-direction: column;
        gap: 12px;
    }

    .toppic-widget .toppic li {
        flex: none;
    }

    .toppic-widget .toppic li img {
        width: 100%;
        height: auto;
        aspect-ratio: 5 / 3;
        object-fit: cover;
    }

    /* 文章卡片 */
    .blogs {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .blogtitle {
        margin: 12px 16px 0;
        padding: 10px 14px 8px;
        font-size: 1.05rem;
        word-break: break-word;
    }

    .blogpic {
        margin: 8px 16px 10px;
        overflow: hidden;
    }

    .blogpic img {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 5 / 3;
        object-fit: cover;
        border-radius: var(--radius-md);
    }

    .blogtext {
        padding: 0 16px;
        -webkit-line-clamp: 3;
        font-size: 0.88rem;
    }

    .bloginfo {
        padding: 8px 16px 12px;
    }

    .bloginfo ul {
        gap: 10px;
    }

    .bloginfo li {
        font-size: 0.8rem;
    }

    /* 侧边栏组件移动端优化 */
    .sidebar > div,
    .sidebar > section {
        padding: 16px;
    }

    .zhuanti li i {
        width: 80px;
        height: 54px;
    }

    .tuijian .tjpic i {
        width: 90px;
        height: 60px;
    }

    .tuijian .sidenews li i {
        width: 64px;
        height: 48px;
    }

    .tuijian .sidenews li p {
        font-size: 0.84rem;
    }

    /* 面包屑 */
    .t_nav {
        font-size: 0.8rem;
    }

    /* 文章内容 */
    .newsview {
        padding: 18px;
    }

    .news_title {
        font-size: 1.3rem;
    }

    .nextinfo-content {
        grid-template-columns: 1fr;
    }

    .next-article .nav-label {
        justify-content: flex-start;
    }

    /* 相关推荐 */
    .related-list {
        grid-template-columns: 1fr;
    }

    /* 评论区 */
    .comment-item {
        padding: 12px;
    }

    .comment-avatar img {
        width: 36px;
        height: 36px;
    }

    /* 留言板 */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .guestbook-form, .guestbook-list {
        padding: 18px;
    }

    /* 友链表单 */
    .lry-table-title {
        width: auto;
        display: block;
        text-align: left;
        padding: 4px 0;
    }

    .lry-input-text, .lry-textarea {
        max-width: 100%;
    }

    /* 时间轴 */
    .timeline::before {
        left: 24px;
    }

    .timeline-header {
        padding: 30px 20px;
    }

    .timeline-header h1 {
        font-size: 1.6rem;
    }

    .event-item,
    .event-item:nth-child(even) {
        flex-direction: row;
    }

    .event-item:nth-child(odd) .event-content,
    .event-item:nth-child(even) .event-content {
        margin-left: 20px;
        margin-right: 0;
        text-align: left;
    }

    .event-item:nth-child(odd) .event-date,
    .event-item:nth-child(even) .event-date {
        left: 16px;
        right: auto;
    }

    .event-image {
        width: 70px;
        height: 70px;
    }

    .year-title h2 {
        font-size: 1.2rem;
        padding: 10px 20px;
    }

    /* 分页 */
    #page a, .pagelist a, .pagination a {
        min-width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    /* 回到顶部 */
    .cd-top {
        bottom: 20px;
        right: 16px;
        width: 40px;
        height: 40px;
    }

    /* 页脚 */
    footer {
        padding: 20px 16px;
    }

    footer p {
        font-size: 0.8rem;
    }

    /* 图文列表 */
    .share ul {
        grid-template-columns: 1fr;
    }

    /* 顶踩 */
    .digg_up, .digg_down {
        width: 60px;
        height: 60px;
        font-size: 1.1rem;
    }
}

/* ---- 小手机 (<480px) ---- */
@media (max-width: 480px) {
    article {
        padding: 0 8px;
        margin: 12px auto;
    }

    .toppic-widget .toppic li {
        flex: none;
    }

    .fader {
        padding-top: 56.25%;
    }

    /* 文章卡片窄屏优化 */
    .blogtitle {
        margin: 10px 12px 0;
        padding: 8px 12px 6px;
        font-size: 1rem;
    }

    .blogpic {
        margin: 6px 12px 8px;
    }

    .blogtext {
        padding: 0 12px;
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .bloginfo {
        padding: 6px 12px 10px;
    }

    .bloginfo ul {
        gap: 8px;
    }

    .bloginfo li {
        font-size: 0.76rem;
    }

    /* 侧边栏窄屏 */
    .sidebar > div,
    .sidebar > section {
        padding: 14px;
    }

    .zhuanti li i {
        width: 72px;
        height: 48px;
    }

    .tuijian .tjpic i {
        width: 80px;
        height: 54px;
    }

    .tuijian .sidenews li i {
        width: 56px;
        height: 42px;
    }

    .news_title {
        font-size: 1.15rem;
    }

    .timeline-header h1 {
        font-size: 1.3rem;
    }

    .event-image {
        width: 56px;
        height: 56px;
        border-width: 3px;
    }

    .event-content {
        padding: 14px;
    }

    .event-content h3 {
        font-size: 1rem;
    }

    .lry-table td {
        display: block;
        padding: 4px 0;
    }

    .lry-table-title {
        display: block;
    }
}
