/* ==========================================================================
   ByteYogi Theme — Responsive Stylesheet
   Breakpoints: 1279px (Tablet), 767px (Mobile)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Large Tablet / Small Desktop (max-width: 1279px)
   -------------------------------------------------------------------------- */
@media (max-width: 1279px) {

  /* Layout */
  .blog-page,
  .site-content,
  .container,
  .navbar-inner,
  .footer-top,
  .footer-bottom,
  .categories-inner {
    padding-left: 32px;
    padding-right: 32px;
  }

  .hero-inner {
    padding-left: 32px;
    padding-right: 32px;
  }

  /* Navbar */
  .nav-links {
    gap: 24px;
  }

  .nav-links a {
    font-size: 14px;
  }

  .search-toggle .search-shortcut {
    display: none;
  }

  /* Hero */
  .hero {
    padding: 80px 0;
  }

  .hero-inner {
    flex-direction: column;
    text-align: center;
    gap: 40px;
  }

  .hero-visual {
    display: none;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero h1 {
    font-size: 48px;
  }

  .hero-sub {
    max-width: 100%;
  }

  .hero-actions {
    justify-content: center;
  }

  .stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    justify-items: center;
    text-align: center;
  }

  .stat-item {
    text-align: center;
  }

  /* Posts Grid */
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  /* Trending */
  .trending-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Featured */
  .featured-card {
    padding: 32px;
    gap: 32px;
  }

  .featured-image {
    width: 320px;
  }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }

  /* Sections */
  .section,
  .posts-section,
  .trending-section,
  .featured-section {
    padding: 48px 0;
  }

  .newsletter-section {
    padding: 64px 0;
  }

  /* Single Article */
  .single-article {
    padding: 40px 32px 64px;
  }

  .comments-area {
    padding: 0 32px 48px;
  }

  .article-header .article-title {
    font-size: 34px;
  }

  /* Related Posts */
  .related-posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Contact Layout */
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 0 32px 64px;
  }

  /* Page */
  .page-content {
    padding: 0 32px 64px;
  }

  /* 404 */
  .error-404 {
    padding: 80px 32px;
  }

  .error-404__number,
  .error-404 .error-code {
    font-size: 100px;
  }
}

/* --------------------------------------------------------------------------
   1b. iPad / Medium Tablet (max-width: 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {

  .nav-links {
    display: none;
  }

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

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

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

  .featured-card {
    flex-direction: column;
  }

  .featured-image {
    width: 100%;
    order: -1;
  }

  /* Ensure cat-pills meet WCAG 44px minimum touch target */
  .cat-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* --------------------------------------------------------------------------
   2. Mobile (max-width: 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {

  /* Layout */
  .blog-page,
  .site-content,
  .container,
  .categories-inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Navbar */
  .navbar-inner {
    padding: 0 16px;
    height: 56px;
  }

  .nav-links {
    display: none;
  }

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

  .search-toggle {
    padding: 8px 10px;
  }

  .search-toggle .search-text {
    display: none;
  }

  .search-toggle .search-shortcut {
    display: none;
  }

  .logo {
    font-size: 22px;
  }

  /* Mobile Menu */
  .mobile-menu {
    width: 100%;
    top: 56px;
    height: calc(100vh - 56px);
  }

  .mobile-menu-overlay {
    top: 56px;
    height: calc(100vh - 56px);
  }

  /* Search Modal */
  .search-modal {
    padding-top: 80px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .search-modal-inner {
    border-radius: var(--radius-md);
  }

  .search-modal-inner input {
    font-size: 16px;
    padding: 14px 16px;
  }

  /* Hero */
  .hero {
    padding: 60px 0;
  }

  .hero-inner {
    padding-left: 20px;
    padding-right: 20px;
    text-align: center;
  }

  .hero h1 {
    font-size: 36px;
    letter-spacing: -0.02em;
  }

  .hero-sub {
    font-size: 16px;
    margin-bottom: 28px;
  }

  .hero-badge {
    font-size: 12px;
    padding: 5px 14px 5px 10px;
    margin-bottom: 20px;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
  }

  .stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 36px;
    padding-top: 24px;
  }

  .stat-number {
    font-size: 22px;
  }

  .stat-label {
    font-size: 12px;
  }

  /* Categories */
  .categories {
    padding: 16px 0;
  }

  .categories-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 6px;
    padding-bottom: 4px;
  }

  .cat-pill {
    scroll-snap-align: start;
    padding: 6px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }

  /* Featured */
  .featured-card {
    flex-direction: column;
    padding: 24px;
    gap: 24px;
  }

  .featured-image {
    width: 100%;
    order: -1;
  }

  .featured-content h2 {
    font-size: 22px;
  }

  .featured-excerpt {
    font-size: 15px;
  }

  .featured-meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Section Headers */
  .featured-section .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .section-title {
    font-size: 24px;
  }

  /* Posts Grid */
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .post-card-title {
    font-size: 17px;
  }

  .post-card-body {
    padding: 20px;
  }

  .post-card-image {
    aspect-ratio: 16 / 8;
  }

  .post-card-meta {
    font-size: 12px;
  }

  .post-card-readmore {
    opacity: 1;
    transform: translateX(0);
  }

  /* Trending */
  .trending-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .trending-item {
    padding: 16px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .trending-icon {
    width: 40px;
    height: 40px;
  }

  .trending-title {
    font-size: 14px;
  }

  .trending-meta {
    font-size: 12px;
  }

  /* Ad Banner */
  .ad-section-inner {
    padding: 0 20px;
  }

  .ad-banner {
    padding: 24px 16px;
    margin: 32px 0;
  }

  /* Newsletter */
  .newsletter-section {
    padding: 48px 0;
  }

  .newsletter-inner {
    padding: 32px 24px;
    margin: 0 20px;
  }

  .newsletter-inner h2 {
    font-size: 20px;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form input[type="email"] {
    width: 100%;
  }

  .newsletter-form button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Footer */
  .footer {
    padding-top: 40px;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 0 20px 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }

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

  /* Sections */
  .section,
  .posts-section,
  .trending-section,
  .featured-section,
  .blog-posts-section {
    padding: 40px 0;
  }

  .blog-page .category-filter {
    margin-left: -20px;
    margin-right: -20px;
  }

  .blog-page .archive-header {
    padding: 32px 0 20px;
  }

  .blog-page .archive-header h1 {
    font-size: 28px;
  }

  /* Single Article */
  .single-article {
    padding: 24px 20px 48px;
  }

  .article-header .article-title {
    font-size: 28px;
  }

  .article-meta {
    gap: 12px;
    font-size: 13px;
  }

  .article-content {
    font-size: 16px;
  }

  .article-content h2 {
    font-size: 24px;
    margin-top: 36px;
  }

  .article-content h3 {
    font-size: 20px;
    margin-top: 28px;
  }

  .article-content pre {
    margin-left: -20px;
    margin-right: -20px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .article-content pre code {
    padding: 16px 20px;
    font-size: 13px;
  }

  .article-content blockquote {
    padding: 20px;
    margin: 24px 0;
  }

  .article-content table {
    font-size: 14px;
    display: block;
    overflow-x: auto;
  }

  .article-content table th,
  .article-content table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  .article-content img {
    margin: 24px -20px;
    width: calc(100% + 40px);
    max-width: calc(100% + 40px);
    border-radius: 0;
  }

  .article-toc {
    padding: 20px;
  }

  /* Author Box */
  .author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
  }

  .author-box-social {
    justify-content: center;
  }

  /* Related Posts */
  .related-posts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .related-posts h3 {
    font-size: 20px;
  }

  /* Post Navigation */
  .post-navigation {
    flex-direction: column;
    gap: 12px;
  }

  /* Comments */
  .comments-area {
    padding: 0 20px 40px;
  }

  .comments-title {
    font-size: 20px;
  }

  .comment-content {
    padding-left: 0;
    margin-top: 8px;
  }

  .comment-reply-link {
    margin-left: 0;
  }

  .comment .children {
    padding-left: 20px;
  }

  .comment .children .comment {
    padding-left: 16px;
  }

  .comment-form .form-row {
    grid-template-columns: 1fr;
  }

  /* Contact Layout */
  .contact-layout {
    padding: 0 20px 48px;
  }

  .contact-info-card {
    position: static;
  }

  /* Share Buttons */
  .article-share {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Pages */
  .page-header h1 {
    font-size: 32px;
  }

  .page-header .page-description {
    font-size: 15px;
  }

  .page-content {
    padding: 0 20px 48px;
    font-size: 16px;
  }

  /* Archive / Search */
  .archive-header,
  .search-header {
    padding: 40px 0 24px;
  }

  .archive-header h1,
  .search-header h1 {
    font-size: 28px;
  }

  .search-header .search-form-wrap {
    padding: 0 20px;
  }

  .search-header .search-form-wrap .search-form {
    flex-direction: column;
  }

  /* Pagination */
  .pagination {
    padding: 32px 0;
  }

  .pagination .page-numbers {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

  /* 404 */
  .error-404 {
    padding: 80px 20px;
    min-height: 50vh;
  }

  .error-404__number,
  .error-404 .error-code {
    font-size: 80px;
  }

  .error-404__heading,
  .error-404 h1 {
    font-size: 24px;
  }

  .error-404__message,
  .error-404 p {
    font-size: 15px;
  }

  .error-404 .error-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .error-404 .error-actions .btn-primary,
  .error-404 .error-actions .btn-secondary {
    width: 100%;
  }

  .error-404 .search-form {
    flex-direction: column;
    max-width: 100%;
  }

  /* Author Profile */
  .author-profile {
    flex-direction: column;
    text-align: center;
    padding: 40px 20px 24px;
  }

  .author-profile__avatar img {
    width: 80px;
    height: 80px;
  }

  .author-profile__name {
    font-size: 24px;
  }

  /* Sidebar */
  .sidebar {
    margin-top: 40px;
  }

  .widget {
    padding: 20px;
  }

  /* Scroll to top */
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }

  /* WP Blocks */
  .alignwide {
    margin-left: -20px;
    margin-right: -20px;
    max-width: calc(100% + 40px);
  }
}

/* --------------------------------------------------------------------------
   3. Small Mobile (max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {

  .hero h1 {
    font-size: 30px;
  }

  .hero-sub {
    font-size: 15px;
  }

  .stat-number {
    font-size: 20px;
  }

  .section-title {
    font-size: 22px;
  }

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

  .trending-item {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
  }

  .featured-content h2 {
    font-size: 20px;
  }

  .article-header .article-title {
    font-size: 24px;
  }

  .footer-social a {
    width: 32px;
    height: 32px;
  }

  .newsletter-inner {
    margin: 0 12px;
    padding: 24px 16px;
  }

  .newsletter-inner h2 {
    font-size: 18px;
  }
}

/* --------------------------------------------------------------------------
   4. Large Screens (min-width: 1440px)
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {

  .site-content,
  .container,
  .navbar-inner,
  .hero-inner,
  .footer-top,
  .footer-bottom,
  .categories-inner {
    max-width: 1400px;
  }

  .hero h1 {
    font-size: 64px;
  }

  .hero-sub {
    font-size: 20px;
  }

  .hero-visual {
    width: 420px;
    height: 420px;
  }

  .stats-bar {
    gap: 64px;
  }

  .stat-number {
    font-size: 32px;
  }
}

/* --------------------------------------------------------------------------
   5. Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

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

  .hero-visual,
  .orbit-item {
    animation: none !important;
  }

  .btn-primary::before {
    animation: none !important;
  }

  .newsletter-inner::before {
    animation: none !important;
  }

  .animate-up,
  .animate-down,
  .animate-scale {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   6. High Contrast
   -------------------------------------------------------------------------- */
@media (prefers-contrast: high) {

  :root {
    --border-subtle: rgba(255, 255, 255, 0.15);
    --border-medium: rgba(255, 255, 255, 0.25);
    --text-muted: #94a3b8;
  }

  .post-card,
  .widget,
  .featured-card,
  .trending-item,
  .newsletter-inner {
    border-width: 2px;
  }

  a:focus-visible {
    outline-width: 3px;
  }
}

/* --------------------------------------------------------------------------
   7. Touch Device Optimizations
   -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse) {

  /* Disable hover effects on touch */
  .post-card:hover {
    transform: none;
    box-shadow: none;
  }

  .post-card:hover::before {
    opacity: 0;
  }

  .post-card-readmore {
    opacity: 1;
    transform: translateX(0);
  }

  .trending-item:hover {
    transform: none;
  }

  .featured-card:hover {
    transform: none;
  }

  /* Larger tap targets — WCAG 2.5.8: min 44x44px */
  .nav-links a {
    padding: 8px 4px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .cat-pill {
    padding: 10px 18px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .footer-social a {
    width: 44px;
    height: 44px;
  }

  .pagination .page-numbers {
    min-width: 44px;
    height: 44px;
  }
}
