/* ============================================================
   Dennis 6.0 — Responsive Stylesheet
   Five Breakpoints: xs / sm / md / lg / xl
   Target site reference: pc528.net
   ============================================================ */

/* ============================================================
   xs — Mobile (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    /* ---- Layout: Single column ---- */
    .container {
        padding: 0 14px;
    }

    .has-sidebar .site-content > .container {
        flex-direction: column;
    }

    .has-sidebar .site-main,
    .widget-area {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .widget-area {
        margin-top: var(--space-xl);
    }

    /* ---- Top Bar ---- */
    .top-bar {
        font-size: 12px;
    }

    .welcome-text {
        display: none;
    }

    /* ---- Quick Nav: horizontal scroll ---- */
    .quick-nav-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .quick-nav-bar::-webkit-scrollbar {
        display: none;
    }

    .quick-nav {
        flex-wrap: nowrap;
        gap: 16px;
        padding-bottom: var(--space-xs);
    }

    .quick-nav-link {
        white-space: nowrap;
        font-size: 13px;
    }

    /* ---- Header: mobile ---- */
    .header-inner {
        height: 56px;
    }

    .site-name {
        font-size: 15px;
    }

    /* ---- Hamburger Menu ---- */
    .menu-toggle {
        display: flex;
    }

    .menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-wrapper {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--color-nav-bg);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-md);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: var(--z-sticky);
        margin-left: 0;
    }

    .nav-wrapper.is-open {
        transform: translateX(0);
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu > li {
        width: 100%;
        border-bottom: 1px solid var(--color-border);
    }

    .nav-menu > li > a {
        height: auto;
        padding: var(--space-md) 0;
        justify-content: space-between;
    }

    .nav-menu > li > a::after {
        display: none;
    }

    /* ---- Mobile Dropdown (Accordion) ---- */
    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: max-height 0.3s ease;
        background-color: transparent;
    }

    .nav-menu > li.is-expanded > .sub-menu {
        max-height: 500px;
    }

    .sub-menu > li > a {
        padding-left: var(--space-md);
        color: var(--color-text-secondary);
    }

    .mega-menu-panel {
        grid-template-columns: 1fr;
        padding: 0;
    }

    .dropdown-arrow {
        transition: transform 0.3s ease;
    }

    .nav-menu > li.is-expanded .dropdown-arrow {
        transform: rotate(180deg);
    }

    /* ---- Nav Tools ---- */
    .nav-tools {
        margin-left: auto;
        margin-top: var(--space-lg);
        justify-content: center;
    }

    .search-overlay {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
    }

    /* ---- Article Cards: stacked ---- */
    .article-card {
        flex-direction: column;
    }

    .card-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .card-title {
        font-size: 16px;
    }

    /* ---- Footer: stacked ---- */
    .footer-widgets .container {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    /* ---- Auth Panel ---- */
    .auth-panel {
        flex-direction: column;
    }

    .auth-left {
        flex: none;
        padding: var(--space-xl);
    }

    .auth-right {
        padding: var(--space-lg);
    }

    /* ---- Comments: reduce nesting ---- */
    .comment-body {
        gap: var(--space-sm);
    }

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

    .children .comment-body {
        padding-left: var(--space-md);
    }

    /* ---- Pagination ---- */
    .pagination {
        flex-wrap: wrap;
    }
}

/* ============================================================
   sm — Tablet (768px - 1023px)
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    /* ---- Layout: single column, sidebar below ---- */
    .has-sidebar .site-content > .container {
        flex-direction: column;
    }

    .has-sidebar .site-main,
    .widget-area {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .widget-area {
        margin-top: var(--space-xl);
    }

    /* ---- Navigation: hamburger ---- */
    .menu-toggle {
        display: flex;
    }

    .nav-wrapper {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--color-nav-bg);
        flex-direction: column;
        padding: var(--space-lg);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: var(--z-sticky);
    }

    .nav-wrapper.is-open {
        transform: translateX(0);
    }

    .nav-menu {
        flex-direction: column;
    }

    .nav-menu > li {
        border-bottom: 1px solid var(--color-border);
    }

    .nav-menu > li > a {
        height: auto;
        padding: var(--space-md) 0;
    }

    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0;
    }

    .nav-menu > li.is-expanded > .sub-menu {
        max-height: 500px;
    }

    .mega-menu-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-tools {
        margin-left: 0;
        margin-top: var(--space-lg);
    }

    /* ---- Article Cards ---- */
    .article-card {
        flex-direction: column;
    }

    .card-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    /* ---- Footer ---- */
    .footer-widgets .container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   md — Small Desktop (1024px - 1249px)
   ============================================================ */
@media (min-width: 1024px) and (max-width: 1249px) {
    /* ---- Layout: two columns ---- */
    .has-sidebar .site-main {
        flex: 0 0 65%;
        max-width: 65%;
    }

    .widget-area {
        flex: 0 0 35%;
        max-width: 35%;
    }

    /* ---- Navigation: fully expanded ---- */
    .menu-toggle {
        display: none;
    }

    .nav-wrapper {
        position: static;
        transform: none;
        flex-direction: row;
    }

    /* ---- Article Cards ---- */
    .card-thumbnail {
        width: 160px;
        height: 100px;
    }
}

/* ============================================================
   lg — Desktop (1250px - 1369px)
   ============================================================ */
@media (min-width: 1250px) and (max-width: 1369px) {
    /* ---- Layout: two columns (standard) ---- */
    .has-sidebar .site-main {
        flex: 0 0 var(--main-ratio);
        max-width: var(--main-ratio);
    }

    .widget-area {
        flex: 0 0 var(--sidebar-ratio);
        max-width: var(--sidebar-ratio);
    }

    /* ---- Navigation: expanded mode ---- */
    .menu-toggle {
        display: none;
    }

    .nav-wrapper {
        position: static;
        transform: none;
        flex-direction: row;
    }

    .nav-menu > li > a {
        padding: 0 14px;
    }
}

/* ============================================================
   xl — Large Desktop (>= 1370px)
   ============================================================ */
@media (min-width: 1370px) {
    /* ---- Layout: two columns, sidebar can be sticky ---- */
    .has-sidebar .site-main {
        flex: 0 0 var(--main-ratio);
        max-width: var(--main-ratio);
    }

    .widget-area {
        flex: 0 0 var(--sidebar-ratio);
        max-width: var(--sidebar-ratio);
    }

    .widget-area.is-sticky {
        position: sticky;
        top: calc(var(--nav-height) + var(--space-xl));
        align-self: flex-start;
        max-height: calc(100vh - var(--nav-height) - var(--space-xl) * 2);
        overflow-y: auto;
    }

    /* ---- Navigation: fully expanded ---- */
    .menu-toggle {
        display: none;
    }

    .nav-wrapper {
        position: static;
        transform: none;
        flex-direction: row;
    }

    .nav-menu > li > a {
        padding: 0 16px;
    }

    /* ---- Mega Menu: more columns ---- */
    .mega-menu-panel {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .top-bar,
    .quick-nav-bar,
    .main-navigation,
    .widget-area,
    .site-footer,
    .comments-area,
    .pagination {
        display: none !important;
    }

    .site-main {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .article-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    a {
        text-decoration: underline;
    }
}
