/*
 * BlogSite — Responsive CSS (Mobile-First)
 * Breakpoints: 320 → 480 → 640 → 768 → 1024 → 1280 → 1440 → 1600px+
 *
 * Architecture: start mobile, scale up with min-width queries.
 * @package blogsite
 * @version 2.0.0
 */

/* ══════════════════════════════════════════════
   BASE (all screens, mobile-first defaults)
   ══════════════════════════════════════════════ */

/* Single-column layout on mobile */
#content.site-content {
    flex-direction: column;
    padding: 16px 0;
}

#primary,
#secondary {
    width: 100% !important;
    float: none !important;
    flex: none !important;
}

/* Desktop nav hidden on mobile */
#primary-nav.primary-navigation,
.header-search {
    display: none;
}

/* Hamburger toggle visible on mobile */
.header-toggles {
    display: flex !important;
    margin-left: auto;
}

/* Branding on mobile */
.site-title h1 {
    font-size: clamp(16px, 4vw, 20px) !important;
    margin: 0;
}
.site-description { display: none; }

#logo img,
.custom-logo {
    max-height: 44px;
}

/* Container padding on mobile */
.container {
    padding-left: 14px;
    padding-right: 14px;
}

/* Site main tighter on mobile */
.site-main {
    padding: 16px !important;
    border-radius: 6px;
}

/* Content loop — card grid (float layout removed; theme-core.css handles cards) */
.content-loop .entry-title {
    font-size: clamp(15px, 3.5vw, 18px);
}

.content-loop .entry-meta {
    font-size: 12px;
}

.content-loop .entry-summary {
    font-size: 14px;
}

/* Entry category badge */
.entry-category a {
    height: 22px;
    line-height: 22px;
    padding: 0 8px !important;
    font-size: 10px !important;
}

/* Single post */
.single h1.entry-title,
.page h1.entry-title {
    font-size: clamp(22px, 6vw, 32px) !important;
}

/* Featured / slider */
#featured-content .featured-left,
#featured-content .featured-right,
#featured-content .featured-grid {
    float: none;
    width: 100%;
    margin-right: 0;
}

#featured-content .featured-slide .entry-header {
    bottom: 10px;
    padding: 0 12px;
}

#featured-content .featured-slide .entry-title {
    font-size: clamp(18px, 5vw, 24px);
}

/* Sidebar stacks below on mobile */
.sidebar .widget {
    margin-bottom: 12px;
    padding: 14px !important;
}

/* Footer single-column */
.footer-columns .container {
    grid-template-columns: 1fr;
    gap: 24px;
}

#site-bottom .container {
    flex-direction: column;
    text-align: center;
    gap: 10px;
}

#site-bottom .footer-nav ul {
    justify-content: center;
}

/* Pagination touch targets */
.pagination .page-numbers {
    min-width: 44px;
    height: 44px;
    font-size: 13px;
}

/* Post navigation: stacked */
#post-nav .post-previous,
#post-nav .post-next {
    float: none;
    width: 100%;
    border-left: none;
    padding-left: 0;
    text-align: left;
    margin-bottom: 16px;
}

/* Comment form: stacked fields */
.comment-form .comment-form-author,
.comment-form .comment-form-email,
.comment-form .comment-form-url {
    float: none !important;
    width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 14px;
}

/* Author box: stacked */
.author-box .avatar {
    float: none;
    display: block;
    margin: 0 0 12px 0;
    width: 60px;
}

/* Related posts: stacked */
.entry-related .hentry {
    float: none;
    width: 100%;
}

/* Search results */
.content-search .thumbnail-link { width: 52px; }
.content-search .entry-meta { display: none; }

/* 404 */
.error-404 .page-content .search-form input.search-field {
    width: 100%;
    max-width: 300px;
}

/* All form inputs full-width on mobile */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
    width: 100% !important;
    max-width: 100% !important;
}

/* Accessible toggle touch targets */
.nav-toggle,
.close-nav-toggle,
.toggle {
    min-height: 44px;
    min-width: 44px;
}

/* Clip horizontal overflow on content area only — #page must stay overflow:visible for sticky header */
#content.site-content { overflow-x: hidden; }

/* Back-to-top position on mobile */
#back-top {
    bottom: 16px;
    right: 16px;
}

/* ══════════════════════════════════════════════
   480px — Large mobile / small phone landscape
   ══════════════════════════════════════════════ */

@media (min-width: 480px) {

    .container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .site-main { padding: 18px !important; }

    .content-loop .entry-title { font-size: 17px; }

    .entry-content p,
    .entry-content li { line-height: 1.8; }

    /* Show entry meta */
    .content-loop .entry-meta { display: flex; }

    /* Hide author/sep on narrow */
    .content-loop .entry-meta .entry-author,
    .content-loop .entry-meta .author-sep { display: none; }

    /* Featured grid: 2 columns */
    #featured-content .featured-grid {
        float: left;
        width: 49%;
        margin-right: 2%;
    }

    #featured-content .featured-grid:nth-child(2n) { margin-right: 0; }

    #featured-content .featured-slide .entry-title { font-size: 26px; }

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

/* ══════════════════════════════════════════════
   640px — Large phone / small tablet
   ══════════════════════════════════════════════ */

@media (min-width: 640px) {

    .container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .site-main { padding: 22px !important; }

    .content-loop .entry-title { font-size: 18px; }
    .content-loop .entry-summary { -webkit-line-clamp: 3; }

    /* 2-column card grid on pages without a sidebar */
    #content.is_full_width .content-loop {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Show author in entry meta */
    .content-loop .entry-meta .entry-author,
    .content-loop .entry-meta .author-sep { display: inline; }

    /* Featured: 3 columns */
    #featured-content .featured-grid {
        width: 32%;
        margin-right: 2%;
    }
    #featured-content .featured-grid:last-child { margin-right: 0; }

    /* Related posts: 2 columns */
    .entry-related .hentry {
        float: left;
        width: 48%;
        margin-right: 4%;
    }
    .entry-related .hentry:nth-child(2n) { margin-right: 0; }

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

    /* Comment form: 2-column author/email */
    .comment-form .comment-form-author,
    .comment-form .comment-form-email {
        float: left !important;
        width: 48% !important;
    }
    .comment-form .comment-form-author { margin-right: 4% !important; }
}

/* ══════════════════════════════════════════════
   768px — Tablet portrait
   ══════════════════════════════════════════════ */

@media (min-width: 768px) {

    .site-title h1 {
        font-size: 20px !important;
    }

    .site-description { display: block; }

    .container {
        padding-left: 28px;
        padding-right: 28px;
    }

    .site-main { padding: 26px !important; }

    /* Content loop */
    .content-loop .entry-title { font-size: clamp(17px, 2vw, 20px); }
    .content-loop .entry-summary { -webkit-line-clamp: 3; }

    /* Author box: horizontal */
    .author-box .avatar {
        float: left;
        display: inline-block;
        margin: 0 16px 0 0;
    }

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

    /* Footer bar: horizontal */
    #site-bottom .container {
        flex-direction: row;
        text-align: left;
    }

    #site-bottom .footer-nav ul { justify-content: flex-end; }

    /* Post nav: side by side */
    #post-nav .post-previous {
        float: left;
        width: 48%;
        margin-bottom: 0;
    }

    #post-nav .post-next {
        float: right;
        width: 48%;
        border-left: 1px solid #e5e7eb;
        padding-left: 20px;
        text-align: right;
    }

    /* Featured: left + right split */
    #featured-content .featured-left {
        float: left;
        width: 63%;
    }

    #featured-content .featured-right {
        float: right;
        width: 35%;
        margin-top: 0;
    }

    #featured-content .featured-grid {
        float: none;
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
}

/* ══════════════════════════════════════════════
   1024px — Tablet landscape / small laptop
   Desktop nav visible. Sidebar + content.
   ══════════════════════════════════════════════ */

@media (min-width: 1024px) {

    /* Restore desktop navigation — block; sf-menu handles layout via float */
    #primary-nav.primary-navigation { display: block !important; }
    .header-search { display: block !important; }
    .header-toggles { display: none !important; }

    /* Two-column: content + sidebar */
    #content.site-content {
        flex-direction: row;
        align-items: flex-start;
        padding: 32px 0;
    }

    #primary {
        flex: 1 !important;
        width: auto !important;
        min-width: 0;
    }

    #secondary {
        flex: 0 0 300px !important;
        width: 300px !important;
    }

    .container {
        padding-left: 32px;
        padding-right: 32px;
    }

    .site-main { padding: 28px !important; }

    /* Content loop */
    .content-loop .entry-title { font-size: clamp(18px, 1.5vw, 22px); }

    /* Show all entry meta */
    .content-loop .entry-meta { display: flex; }
    .content-loop .entry-meta .entry-author,
    .content-loop .entry-meta .author-sep { display: inline; }

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

    /* Related: 3 columns */
    .entry-related .hentry {
        float: left;
        width: 31%;
        margin-right: 3.5%;
    }
    .entry-related .hentry:nth-child(3n) { margin-right: 0; }

    /* Superfish dropdown styling */
    .sf-menu ul {
        border-radius: 0 0 8px 8px;
        box-shadow: 0 8px 24px rgba(0,0,0,.15);
        min-width: 180px;
        overflow: hidden;
    }

    .sf-menu li li a {
        padding: 10px 16px;
        font-size: 13px;
        color: #1a1a2e;
        background: #fff;
        display: block;
        border-bottom: 1px solid #f0f0f0;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .sf-menu li li a:hover {
        background: #eff6ff;
        color: #2563eb;
    }

    /* Sticky header: add extra top padding */
    .site-content.has-sticky { padding-top: 120px; }
}

/* ══════════════════════════════════════════════
   1280px — Standard desktop
   ══════════════════════════════════════════════ */

@media (min-width: 1280px) {

    .container {
        padding-left: 40px;
        padding-right: 40px;
    }

    .site-main { padding: 32px !important; }

    #primary-menu.sf-menu > li > a {
        padding: 0 16px;
        font-size: 14px;
    }

    .content-loop .entry-title { font-size: 20px; }

    /* 3-column card grid on full-width pages at 1280px+ */
    #content.is_full_width .content-loop {
        grid-template-columns: repeat(3, 1fr);
    }

    #secondary,
    .sidebar {
        flex: 0 0 310px !important;
        width: 310px !important;
    }
}

/* ══════════════════════════════════════════════
   1440px — Large desktop
   ══════════════════════════════════════════════ */

@media (min-width: 1440px) {

    .container {
        max-width: 1400px;
        padding-left: 48px;
        padding-right: 48px;
    }

    #secondary,
    .sidebar {
        flex: 0 0 320px !important;
        width: 320px !important;
    }

    #primary-menu.sf-menu > li > a {
        padding: 0 18px;
        font-size: 15px;
    }
}

/* ══════════════════════════════════════════════
   1600px — Ultrawide
   ══════════════════════════════════════════════ */

@media (min-width: 1600px) {

    .container {
        max-width: 1520px;
        padding-left: 56px;
        padding-right: 56px;
    }

    #secondary,
    .sidebar {
        flex: 0 0 340px !important;
        width: 340px !important;
    }

    .site-main { padding: 40px !important; }

    #primary-menu.sf-menu > li > a { padding: 0 20px; }
}

/* ══════════════════════════════════════════════
   1920px+ — 4K / very large displays
   Content stays centered and never stretches
   ══════════════════════════════════════════════ */

@media (min-width: 1920px) {

    .container {
        max-width: 1680px;
        padding-left: 60px;
        padding-right: 60px;
    }

    #secondary,
    .sidebar {
        flex: 0 0 360px !important;
        width: 360px !important;
    }
}

/* ══════════════════════════════════════════════
   COMPONENT PATCHES AT SPECIFIC BREAKPOINTS
   ══════════════════════════════════════════════ */

/* bxSlider */
@media (max-width: 767px) {
    .bxslider, .bx-wrapper { max-height: 100%; }
    .bx-wrapper { background: transparent; }
}

@media (min-width: 1024px) { .bxslider { max-height: 460px; } }
@media (min-width: 1280px) { .bxslider { max-height: 520px; } }

/* Breadcrumbs: hide long post title on small screens */
@media (max-width: 639px) {
    .single .breadcrumbs .post-title { display: none; }
    .single .breadcrumbs .post-category a { background: none; }
}

/* Entry share: icon-only on small screens */
@media (max-width: 639px) {
    .entry-share a span { display: none; }
    .entry-share a { margin-right: 4px; }
}

/* Very small screens: fully stack featured grid */
@media (max-width: 479px) {
    #featured-content { margin-bottom: 12px; }

    #featured-content .featured-grid {
        float: none;
        width: 100%;
        margin: 0 0 10px;
    }
}

/* Sidebar ad widget */
@media (max-width: 1023px) {
    .sidebar .widget_ad .widget-title,
    .site-footer .widget_ad .widget-title { text-align: left; }
}

/* ══════════════════════════════════════════════
   SCROLLBAR STYLING
   ══════════════════════════════════════════════ */

* { scrollbar-width: thin; scrollbar-color: #94a3b8 transparent; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
