/* Mobile & tablet fixes for new blog article template */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
video,
iframe,
table,
pre {
  max-width: 100%;
  height: auto;
}

.site-header,
.main-wrapper,
.header-container,
.breadcrumb-container,
.article-container,
.sidebar,
.sidebar-card,
.content-text {
  max-width: 100%;
  min-width: 0;
}

.content-text,
.content-text p,
.content-text li,
.content-text h2,
.content-text h3,
.article-title,
.breadcrumb-container,
.recent-post-info a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.content-text table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tablet: single column + hide side clutter */
@media (max-width: 1024px) {
  .main-wrapper {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 14px 40px !important;
    gap: 24px !important;
  }

  .article-container,
  .sidebar,
  .sidebar-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .sidebar {
    position: static !important;
    top: auto !important;
  }

  .breadcrumb-container {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.5;
    padding: 0 14px;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .logo {
    flex-shrink: 1;
    min-width: 0;
  }

  .logo img {
    height: 36px !important;
    max-height: 36px !important;
    width: auto !important;
  }

  .header-right {
    gap: 6px;
    flex-shrink: 0;
  }

  .icon-btn,
  .social-circle {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .breadcrumb-bar {
    padding: 10px 0;
    margin-bottom: 12px;
  }

  .breadcrumb-container {
    padding: 0 12px;
    font-size: 11px;
    line-height: 1.6;
  }

  .main-wrapper {
    padding: 0 10px 100px !important;
    gap: 16px !important;
  }

  .article-container {
    padding: 14px !important;
    border-radius: 12px;
  }

  .featured-image-wrapper {
    margin-bottom: 16px;
    border-radius: 10px;
  }

  .article-title {
    font-size: 20px !important;
    line-height: 1.35;
  }

  .article-meta {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 16px;
  }

  .content-text p,
  .content-text li {
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 14px;
  }

  .content-text h2 {
    font-size: 18px;
    margin-top: 24px;
    margin-bottom: 12px;
  }

  .content-text h3 {
    font-size: 16px;
    margin-top: 18px;
    margin-bottom: 10px;
  }

  .content-text ul li {
    padding-left: 20px;
  }

  .sidebar-card {
    padding: 14px !important;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  .sidebar-heading {
    font-size: 17px;
  }

  .search-input-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search-input-wrapper input {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .search-submit {
    width: 100%;
    padding: 10px 16px;
  }

  .recent-post-item {
    gap: 10px;
    align-items: flex-start;
  }

  .recent-post-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }

  .recent-post-info {
    min-width: 0;
    flex: 1;
  }

  .recent-post-info a {
    font-size: 13px;
    line-height: 1.4;
  }

  /*
   * On mobile only: tuck side tabs inward so they don't cover article text.
   * Widgets stay in the DOM (menu.js / footer.js) — visible on desktop/tablet.
   */
  body.blog-article-page .applyknow,
  body.blog-article-page .applyknow1 {
    right: -72px !important;
    width: 140px !important;
    font-size: 13px !important;
    z-index: 5 !important;
  }

  body.blog-article-page .chatwithstudent {
    left: -72px !important;
    width: 150px !important;
    font-size: 12px !important;
    z-index: 5 !important;
  }

  body.blog-article-page #whatsapp-button {
    bottom: 12px !important;
    left: 12px !important;
    z-index: 900 !important;
  }

  body.blog-article-page button[aria-label="Go to top"] {
    bottom: 72px !important;
    right: 12px !important;
    z-index: 900 !important;
  }

  /* Footer: prevent horizontal scroll from wide grids */
  footer,
  .footer,
  footer section,
  .footer section {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  footer .container,
  .footer .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
    max-width: 100% !important;
  }
}

@media (max-width: 480px) {
  .logo img {
    height: 30px !important;
    max-height: 30px !important;
  }

  .article-container {
    padding: 12px !important;
  }

  .article-title {
    font-size: 18px !important;
  }

  .content-text h2 {
    font-size: 17px;
  }

  .content-text h3 {
    font-size: 15px;
  }

  .main-wrapper {
    padding: 0 8px 90px !important;
  }
}
