/* ==========================================================================
   JVA DESIGN - Comprehensive Responsive Media Queries & Mobile Viewport Fixes
   Breakpoints: 1200px, 992px, 768px, 576px, 480px, 430px, 414px, 390px, 375px, 360px, 320px
   ========================================================================== */

/* --------------------------------------------------------------------------
   GLOBAL OVERFLOW & VIEWPORT DEFENSE
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Ensure no media element or container ever blows out the viewport */
img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

.container,
.custom-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Prevent text overflow and word clipping everywhere */
h1, h2, h3, h4, h5, h6, p, span, a, li {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   HEADER & LOGO RESPONSIVENESS
   -------------------------------------------------------------------------- */
.tg-header__area {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tgmenu__wrap {
  width: 100%;
}

.tgmenu__nav {
  display: flex;
  align-items: center;
  width: 100%;
}

@media (max-width: 991.98px) {
  .tg-header__area {
    padding: 14px 0;
  }
  .tgmenu__nav {
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
  }
  .tgmenu__nav .logo {
    display: flex;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
    max-width: calc(100% - 65px);
  }
  .tgmenu__nav .logo a {
    display: inline-block;
    max-width: 100%;
  }
  .tgmenu__nav .logo img {
    max-height: 70px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
  }
  .mobile-nav-toggler {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .tg-header__area {
    padding: 12px 0;
  }
  .tgmenu__nav .logo img {
    max-height: 60px;
  }
  .sidebar-btn {
    width: 50px;
    height: 50px;
    padding: 17px 0;
  }
  .sidebar-btn .line {
    width: 16px;
    margin: 0 auto;
  }
  .sidebar-btn .line:not(:last-child) {
    margin-bottom: 4px;
  }
}

@media (max-width: 380px) {
  .tg-header__area {
    padding: 10px 0;
  }
  .tgmenu__nav .logo img {
    max-height: 50px;
  }
  .sidebar-btn {
    width: 44px;
    height: 44px;
    padding: 14px 0;
  }
  .sidebar-btn .line {
    width: 14px;
  }
  .sidebar-btn .line:not(:last-child) {
    margin-bottom: 3px;
  }
}

@media (max-width: 330px) {
  .tgmenu__nav .logo img {
    max-height: 44px;
  }
  .sidebar-btn {
    width: 40px;
    height: 40px;
    padding: 13px 0;
  }
}

/* --------------------------------------------------------------------------
   SUBPAGE HERO SECTION RESPONSIVENESS (Gallery, Blog, Search, etc.)
   Prevents any content from appearing behind or overlapping the header
   -------------------------------------------------------------------------- */
.subpage-hero {
  background-color: var(--color-primary-navy);
  padding: 160px 0 50px 0;
  color: var(--color-white);
  border-bottom: 3px solid var(--color-gold);
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.subpage-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
}

.subpage-hero-title {
  font-size: clamp(1.75rem, 5vw, 2.8rem);
  color: var(--color-white);
  margin-bottom: 12px;
  line-height: 1.22;
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: break-word;
}

.subpage-hero-desc {
  color: #D0D5DD;
  font-size: clamp(0.92rem, 2vw, 1.1rem);
  line-height: 1.6;
  max-width: 780px;
  word-break: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 991px) {
  .subpage-hero {
    padding: 140px 0 45px 0;
  }
  .hero-editorial {
    padding: 140px 0 80px 0;
  }
  .article-header {
    padding: 140px 0 35px 0;
  }
}

@media (max-width: 767px) {
  .subpage-hero {
    padding: 130px 0 40px 0;
  }
  .hero-editorial {
    padding: 130px 0 65px 0;
  }
  .article-header {
    padding: 130px 0 30px 0;
  }
  .subpage-hero .hero-pill {
    margin-bottom: 14px;
    font-size: 0.78rem;
    padding: 5px 14px;
  }
}

@media (max-width: 480px) {
  .subpage-hero {
    padding: 115px 0 35px 0;
  }
  .hero-editorial {
    padding: 115px 0 50px 0;
  }
  .article-header {
    padding: 115px 0 25px 0;
  }
  .subpage-hero-title {
    font-size: 1.65rem;
    margin-bottom: 10px;
  }
  .subpage-hero-desc {
    font-size: 0.92rem;
    line-height: 1.55;
  }
}

@media (max-width: 360px) {
  .subpage-hero {
    padding: 105px 0 30px 0;
  }
  .hero-editorial {
    padding: 105px 0 45px 0;
  }
  .article-header {
    padding: 105px 0 20px 0;
  }
  .subpage-hero-title {
    font-size: 1.45rem;
  }
  .subpage-hero-desc {
    font-size: 0.88rem;
    line-height: 1.5;
  }
}

/* --------------------------------------------------------------------------
   LAPTOPS & TABLETS LANDSCAPE (<= 1199px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .hero-title {
    font-size: 2.75rem;
  }
  .featured-post-card {
    grid-template-columns: 1fr;
  }
  .featured-post-img-wrap {
    min-height: 280px;
  }
  .featured-post-content {
    padding: 32px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .masonry-gallery {
    column-count: 2;
    column-gap: 20px;
  }
}

/* --------------------------------------------------------------------------
   TABLETS PORTRAIT (<= 991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .nav-links, .header-actions .btn-primary {
    display: none;
  }
  .hamburger-btn {
    display: block;
  }
  .hero-content-wrapper {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .hero-card-preview {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    transform: none;
  }
  .article-body-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .toc-sidebar {
    position: static;
    margin-bottom: 24px;
  }
  .highlight-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .newsletter-banner {
    grid-template-columns: 1fr;
    padding: 36px 28px;
    text-align: center;
  }
  .newsletter-form {
    flex-direction: column;
  }
  .lightbox-prev {
    left: 10px;
  }
  .lightbox-next {
    right: 10px;
  }
  .blog-layout-grid {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }
}

/* --------------------------------------------------------------------------
   MOBILE DEVICES (<= 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .section-padding {
    padding: 40px 0;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
  }
  .hero-title {
    font-size: 2.1rem;
  }
  .hero-description {
    font-size: 0.98rem;
  }

  /* Gallery Masonry 1-column layout on mobile */
  .masonry-gallery {
    column-count: 1 !important;
    column-gap: 0 !important;
    display: block;
    width: 100%;
  }

  .masonry-item {
    width: 100%;
    margin-bottom: 20px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .gallery-photo-card {
    width: 100%;
    box-sizing: border-box;
  }

  .gallery-photo-card img {
    width: 100%;
    height: auto;
  }

  /* Gallery Filter Bar on Mobile */
  .gallery-filter-bar {
    gap: 8px;
    margin-bottom: 24px;
  }

  .filter-btn {
    padding: 7px 15px;
    font-size: 0.82rem;
  }

  /* Blog Filter & Search Bar */
  .blog-filter-bar-wrap {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .blog-search-form {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
  }

  .blog-search-form input.form-control {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 9px 14px !important;
  }

  .blog-search-form button {
    flex-shrink: 0 !important;
  }

  /* Blog Articles Grid */
  .articles-grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
    width: 100%;
  }

  .article-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .categories-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .article-title-main {
    font-size: 1.85rem;
  }
  .article-meta-bar {
    flex-direction: column;
    gap: 8px;
  }
  .article-featured-hero img {
    height: 240px;
    object-fit: cover;
  }
  .social-share-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .share-buttons {
    flex-wrap: wrap;
    gap: 8px;
  }
  .author-box {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  .pillars-list {
    grid-template-columns: 1fr;
  }

  .footer__top.pt-110 {
    padding-top: 50px !important;
  }
}

/* --------------------------------------------------------------------------
   SMALL MOBILES (<= 480px / 430px / 414px / 390px / 375px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  .hero-title {
    font-size: 1.75rem;
  }
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  .hero-actions .btn-gold,
  .hero-actions .btn-outline {
    width: 100%;
    justify-content: center;
  }
  .categories-grid {
    grid-template-columns: 1fr;
  }
  .category-card {
    height: 150px;
  }
  .featured-post-title {
    font-size: 1.3rem;
  }
  .featured-post-content {
    padding: 20px 16px;
  }
  .article-card-body {
    padding: 16px;
  }
  .article-card-thumb {
    height: 180px;
  }
  .search-modal-box {
    padding: 20px 16px;
  }
  .search-input-wrap {
    flex-direction: column;
  }
  .pagination {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .page-item .page-link {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    font-size: 0.78rem;
  }

  /* Filter buttons */
  .gallery-filter-bar {
    gap: 6px;
    margin-bottom: 20px;
  }
  .filter-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  /* Lightbox on mobile */
  .lightbox-modal {
    padding: 12px;
  }
  .lightbox-close {
    top: 10px;
    right: 10px;
    font-size: 28px;
    width: 36px;
    height: 36px;
  }
  .lightbox-prev {
    left: 6px;
    width: 38px;
    height: 38px;
  }
  .lightbox-next {
    right: 6px;
    width: 38px;
    height: 38px;
  }
}

/* --------------------------------------------------------------------------
   EXTRA SMALL MOBILES (<= 360px / 320px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
  .hero-title {
    font-size: 1.5rem;
  }
  .filter-btn {
    padding: 5px 10px;
    font-size: 0.74rem;
  }
  .article-card-body {
    padding: 14px 12px;
  }
  .article-card-title {
    font-size: 1.1rem;
  }
  .gallery-photo-card .gallery-card-body {
    padding: 12px 14px !important;
  }
  .subpage-hero .hero-pill {
    font-size: 0.72rem;
    padding: 4px 10px;
  }
  .footer__widget p {
    font-size: 0.88rem;
  }
}

/* --------------------------------------------------------------------------
   GRID / FLEX BLOWOUT PREVENTION
   -------------------------------------------------------------------------- */
.blog-layout-grid > div,
.highlight-grid > div,
div[style*="grid-template-columns"] > div {
  min-width: 0;
  max-width: 100%;
}
