/* ============================================================
   GistKE — Mobile & Responsive Styles
   Mobile-first: these override desktop styles at breakpoints
   ============================================================ */

/* ============================================================
   TABLET — max-width: 1024px
   ============================================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 260px;
    }

    .hero-grid {
        grid-template-columns: 1fr 300px;
    }

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

    .hero-main__title {
        font-size: 26px;
    }

    .nav-menu a {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* ============================================================
   LARGE MOBILE / SMALL TABLET — max-width: 768px
   ============================================================ */
@media (max-width: 768px) {

    /* Header */
    .site-header__nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-raised);
        border-bottom: 1px solid var(--border);
        padding: var(--space-md);
        z-index: 200;
    }

    .site-header__nav.is-open {
        display: block;
    }

    .nav-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .nav-menu a {
        display: block;
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header-btn-label {
        display: none;
    }

    .site-header__inner {
        position: relative;
    }

    /* Hero */
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-side-stack {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--gap);
    }

    .hero-side-stack .side-card:last-child {
        display: none; /* hide 3rd side card on mobile */
    }

    .hero-main {
        min-height: 320px;
    }

    .hero-main__title {
        font-size: 24px;
    }

    /* Layout */
    .home-layout {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .home-layout__sidebar {
        position: static;
        order: -1; /* Sidebar goes above grid on mobile */
    }

    /* Only show Most Heated widget on mobile, hide others */
    .home-layout__sidebar .sidebar-widget:not(:first-child) {
        display: none;
    }

    /* Post grid */
    .post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Single post */
    .single-post__title {
        font-size: 28px;
    }

    .single-layout {
        max-width: 100%;
    }
}

/* ============================================================
   MOBILE — max-width: 480px
   ============================================================ */
@media (max-width: 480px) {

    /* Container padding */
    .container {
        padding: 0 12px;
    }

    /* Ticker */
    .ticker-live-label {
        padding: 0 10px;
        font-size: 10px;
    }

    .ticker-item {
        padding: 0 24px;
        font-size: 11px;
    }

    /* Header */
    .logo-text {
        font-size: 24px;
    }

    .btn-tip {
        padding: 7px 12px;
        font-size: 11px;
    }

    /* Hero */
    .hero-main {
        min-height: 280px;
    }

    .hero-main__content {
        padding: var(--space-md);
    }

    .hero-main__title {
        font-size: 22px;
    }

    .hero-side-stack {
        grid-template-columns: 1fr;
    }

    .hero-side-stack .side-card:last-child {
        display: flex;
    }

    /* Grid: single column on smallest screens */
    .post-grid {
        grid-template-columns: 1fr;
    }

    /* Single post */
    .single-post__title {
        font-size: 24px;
    }

    .single-post__content {
        font-size: 15px;
    }

    /* Sidebar hidden on smallest screens */
    .home-layout__sidebar {
        display: none;
    }

    /* Share bar */
    .share-bar {
        gap: 6px;
    }

    .share-btn--twitter,
    .share-btn--copy {
        display: none;
    }

    .share-btn--whatsapp {
        flex: 1;
        justify-content: center;
    }

    /* Footer */
    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .site-footer__bottom {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }

    .footer-legal a:first-child {
        margin-left: 0;
    }

    /* Pagination */
    .gistke-pagination .page-numbers {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* ============================================================
   TOUCH — tap targets minimum 44px
   ============================================================ */
@media (hover: none) and (pointer: coarse) {

    .nav-menu a,
    .btn-tip,
    .btn-load-more,
    .share-btn,
    .post-tag,
    .heat-list__title,
    .ticker-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .ticker-item {
        min-height: unset; /* ticker items shouldn't be 44px tall */
    }

    /* Remove hover transforms on touch — they feel sticky */
    .post-card:hover .post-card__img,
    .hero-main:hover .hero-main__thumb img,
    .side-card:hover .side-card__thumb img {
        transform: none;
    }
}

/* ============================================================
   REDUCE MOTION — accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .ticker-track {
        animation: none;
    }

    .heat--critical {
        animation: none;
    }

    * {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .ticker-wrap,
    .site-header__actions,
    .home-layout__sidebar,
    .share-bar,
    .load-more-wrap,
    .site-footer {
        display: none !important;
    }

    .single-post__content {
        color: #000;
    }

    .single-post__title {
        color: #000;
        font-size: 24pt;
    }

    a { color: #000; text-decoration: underline; }
    a[href]::after { content: ' (' attr(href) ')'; font-size: 10pt; }
}
