/* Tablet */

@media (max-width: 65rem) {
    .blog-hero-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .blog-hero h1 {
        max-width: 16ch;
    }

    .blog-hero-card {
        max-width: 44rem;
    }

    .blog-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .category-panel {
        position: static;
    }

    .category-links {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    }
}

@media (max-width: 56.25rem) {
    :root {
        --tx-header-height: 4.25rem;
    }

    .header-nav {
        display: none;
    }

    .mobile-navigation {
        display: block;
    }

    .post-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .footer-content {
        grid-template-columns: minmax(0, 1fr);
    }

    .footer-nav {
        justify-content: flex-start;
    }
}

/* Mobile and high zoom reflow */

@media (max-width: 43.75rem) {
    .site-container {
        width: min(var(--tx-container), calc(100% - 1.5rem));
    }

    .brand-logo {
        height: 2.35rem;
        max-width: 7.2rem;
    }

    .brand-blog-label {
        min-height: 1.65rem;
        padding-inline: 0.5rem;
        font-size: 0.7rem;
    }

    .mobile-navigation summary span {
        display: none;
    }

    .blog-hero {
        padding-block: 2.75rem 2rem;
    }

    .blog-hero-card {
        padding: 1.35rem;
        border-radius: var(--tx-radius-lg);
    }

    .blog-search {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .search-field {
        grid-column: 1 / -1;
    }

    .blog-section {
        padding-block: 1.75rem 3.75rem;
    }

    .category-links {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 0.15rem 0.15rem 0.55rem;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .category-link {
        min-width: max-content;
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .post-card-content {
        padding: 1.1rem;
    }

    .article-page {
        padding-block: 2rem 3.75rem;
    }

    .article-cover {
        margin-block: 1.5rem;
        border-radius: var(--tx-radius-lg);
    }

    .pagination {
        align-items: stretch;
    }

    .pagination a,
    .pagination span {
        flex: 1 1 8rem;
    }
}

@media (max-width: 25rem) {
    .blog-search {
        grid-template-columns: minmax(0, 1fr);
    }

    .search-field {
        grid-column: auto;
    }

    .tx-btn {
        width: 100%;
    }

    .post-meta > *:not(:last-child)::after {
        content: none;
    }

    .post-meta {
        display: grid;
    }

    .footer-nav {
        display: grid;
    }
}

/* Accessibility preferences */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --tx-border: #64748b;
        --tx-border-soft: #94a3b8;
        --tx-text-soft: #334155;
    }

    .post-card,
    .category-panel,
    .simple-card,
    .article-content {
        box-shadow: none;
    }
}

@media (forced-colors: active) {
    .site-header,
    .post-card,
    .category-panel,
    .simple-card,
    .article-content,
    .blog-hero-card,
    .tx-btn,
    .category-link,
    .tag-list a {
        forced-color-adjust: auto;
        box-shadow: none;
    }

    .blog-hero-card::after {
        display: none;
    }

    .tx-icon {
        stroke: CanvasText;
    }

    .tx-btn-primary {
        color: ButtonText;
        background: ButtonFace;
        border-color: ButtonText;
    }
}

@media print {
    .site-header,
    .site-footer,
    .breadcrumbs,
    .related-section,
    .blog-search,
    .category-panel,
    .pagination,
    .skip-link {
        display: none !important;
    }

    body {
        color: #000000;
        background: #ffffff;
    }

    .article-page,
    .article-content {
        padding: 0;
    }

    .article-content {
        max-width: none;
        border: 0;
        box-shadow: none;
    }

    a {
        color: inherit;
    }
}
