/* ==========================================================================
   Responsive — Breakpoint-specific overrides (Ruki theme)
   ========================================================================== */

/* ---- xs: < 480px ---- */
@media (max-width: 479px) {
    .site-header {
        margin-top: 0;
        margin-bottom: 15px;
    }

    .header-inner {
        flex-direction: column;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        box-shadow: var(--shadow-card);
        flex-direction: column;
        padding: var(--space-2);
        z-index: 99;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav > ul {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .main-nav > ul > li > a,
    .main-nav > ul > li > button.dropdown-toggle {
        padding: 10px 15px;
        font-size: var(--text-size-body);
        border-radius: var(--radius-card);
    }

    /* The drawer stacks submenus inline instead of floating them, so undo the
       fixed width and the fade the desktop panel is hidden behind. */
    .has-dropdown .dropdown {
        position: static;
        width: auto;
        visibility: visible;
        opacity: 1;
        box-shadow: none;
        background: var(--very-light-bg);
        padding: 0 0 0 var(--space-3);
    }

    .dropdown > li > a,
    .dropdown > li > button.dropdown-toggle {
        padding: 10px 15px;
    }

    .nav-toggle {
        display: flex;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn-row {
        flex-direction: column;
    }

    .hero {
        padding: var(--space-5) 0;
    }

    .hero-title {
        font-size: var(--text-size-h2);
    }

    .hero-tagline {
        font-size: var(--text-size-body);
    }

    .article-hero {
        min-height: 220px;
        border-radius: 0;
    }

    .article-hero h1 {
        font-size: var(--text-size-h2);
    }

    .article-hero-overlay {
        padding: 40px 15px 20px;
    }

    .feature-band {
        flex-direction: column;
        gap: var(--space-3);
    }

    .feature-band-media {
        order: -1;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card-grid-2,
    .card-grid-3 {
        grid-template-columns: 1fr;
    }

    .issue-grid {
        grid-template-columns: 1fr;
    }

    .volume-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .volume-cover {
        width: 120px;
    }

    .card-padded {
        padding: 20px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }

    .article-detail {
        border-radius: 0;
    }

    .article-detail .entry-header {
        padding: 20px 15px 0 15px;
    }

    .article-detail .entry-content {
        padding: 0 15px 20px;
    }

    .article-detail .post-thumbnail,
    .article-detail .post-thumbnail img {
        border-radius: 0;
    }

    /* Single post card mobile */
    .the-post .single-post .entry-content,
    .the-post .single-post .entry-header {
        padding: 20px 15px 20px 15px;
    }

    .the-post .single-post .post-thumbnail,
    .the-post .single-post .post-thumbnail img {
        border-radius: 0;
    }

    .the-post .hentry-footer {
        margin: 15px auto 15px auto;
    }

    .the-post .hentry-footer.card {
        border-radius: 0;
    }

    .the-post .hentry-footer.card::before {
        display: none;
    }

    .hentry-footer ul.social-icons li.social-icon a {
        width: 38px;
        height: 38px;
    }

    .single-post .entry-title {
        font-size: 1.5rem;
    }

    .article-entry {
        border-radius: 0;
    }

    .article-entry .article-item {
        padding: 20px 15px;
    }

    .article-entry .post-thumbnail,
    .article-entry .post-thumbnail img {
        border-radius: 0;
    }

    .site-logo img {
        max-width: 200px;
    }

    .primary-menu-container {
        flex-direction: column;
        align-items: center;
    }

    .page-title {
        font-size: var(--text-size-h1);
    }
}

/* ---- Mobile: 480–767px ---- */
@media (min-width: 480px) and (max-width: 767px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .feature-band {
        flex-direction: column;
        gap: var(--space-3);
    }

    .feature-band-media {
        order: -1;
    }

    .hero-title {
        font-size: var(--text-size-h1);
    }

    .article-hero {
        min-height: 260px;
    }

    .article-hero h1 {
        font-size: var(--text-size-h1);
    }
}

/* ---- Tablet: 768–1024px ---- */
@media (min-width: 768px) and (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero {
        padding: var(--space-6) 0;
    }

    .hero-title {
        font-size: var(--text-size-entry);
    }
}

/* ---- Desktop: 1025px+ ---- */
@media (min-width: 1025px) {
    .hero {
        padding: var(--space-7) 0 var(--space-5);
    }

    .hero-title {
        font-size: var(--text-size-entry);
    }

    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ---- XLarge: 1280px+ ---- */
@media (min-width: 1280px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---- Global responsive helpers ---- */
@media (max-width: 1024px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        box-shadow: var(--shadow-card);
        flex-direction: column;
        padding: var(--space-3);
        z-index: 99;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav > ul {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .main-nav > ul > li > a,
    .main-nav > ul > li > button.dropdown-toggle {
        padding: 10px 15px;
        font-size: var(--text-size-body);
        border-radius: var(--radius-card);
    }

    /* The drawer stacks submenus inline instead of floating them, so undo the
       fixed width and the fade the desktop panel is hidden behind. */
    .has-dropdown .dropdown {
        position: static;
        width: auto;
        visibility: visible;
        opacity: 1;
        box-shadow: none;
        background: var(--very-light-bg);
        padding: 0 0 0 var(--space-3);
    }

    .dropdown > li > a,
    .dropdown > li > button.dropdown-toggle {
        padding: 10px 15px;
    }

    .dropdown .has-dropdown .dropdown {
        padding-left: var(--space-4);
    }

    .nav-toggle {
        display: flex;
    }

    .hide-mobile {
        display: none;
    }

    .article-hero {
        border-radius: 0;
    }

    .article-detail {
        border-radius: 0;
    }

    .article-entry {
        border-radius: 0;
    }

    .article-entry .post-thumbnail,
    .article-entry .post-thumbnail img {
        border-radius: 0;
    }

    .article-detail .post-thumbnail,
    .article-detail .post-thumbnail img {
        border-radius: 0;
    }
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none;
    }
}

/* ---- Reduced motion ----
   Neutralises the site-wide transitions and the smooth `scroll-behavior`
   that drives the back-to-top handler (see base.css and base.html). */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---- Print ---- */
@media print {
    .site-header,
    .site-sidebar,
    .site-footer,
    .fab,
    .btn,
    .pdf-link {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
