/* =========================================================================
   Responsive fixes — mobile / tablet / laptop / desktop
   Loaded last, site-wide. Targets: overflow, header, hero, sections,
   category row, cards, footer. Breakpoints: 320 / 375 / 768 / 1024 / 1366 / 1920
   ========================================================================= */

/* ---------- GLOBAL: kill horizontal scroll, safe media ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
#page, #content, .site-content, .home-9mod, .app-redesign { max-width: 100%; }
.entry-content img, .app-description img, .home-about img { max-width: 100%; height: auto; }

/* ---------- HEADER (tablet & mobile, drawer nav active <=991) ---------- */
@media (max-width: 991px) {
  #masthead .container { flex-wrap: nowrap; min-width: 0; }
  #masthead .site-logo { margin: 0 10px 0 0 !important; flex: 0 0 auto; }
  #masthead .site-logo img { width: auto !important; max-width: 140px; height: 34px; object-fit: contain; }
  /* search wrapper = the only direct <div> child of the header container */
  #masthead .container > div { width: auto !important; max-width: none !important; flex: 1 1 auto; min-width: 0; margin-left: auto; }
  /* keep the Bootstrap input-group on ONE line; let the input flex/shrink */
  #masthead .form-search,
  #masthead .container > div form,
  #masthead .input-group { width: 100% !important; flex-wrap: nowrap !important; }
  #masthead .input-group .form-control { min-width: 0; width: 1%; flex: 1 1 auto; }
}
@media (max-width: 400px) {
  #masthead .site-logo img { max-width: 112px; height: 30px; }
  #masthead .site-nav-toggler { padding-right: 4px !important; padding-left: 0 !important; }
}

/* ---------- HERO (mobile/tablet) ---------- */
@media (max-width: 1023px) {
  .hero-card { height: 300px; }
}
@media (max-width: 767px) {
  .home-hero { margin-bottom: 1.75rem; }
  .hero-card { height: 224px; border-radius: 18px; }
  .hero-card__content { padding: 0 18px; max-width: 100%; }
  .hero-chip { margin-bottom: 10px; padding: 5px 10px; font-size: 10.5px; }
  .hero-card__title {
    font-size: 1.25rem; line-height: 1.2; margin-bottom: 7px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .hero-card__desc { font-size: .82rem; margin-bottom: 12px; -webkit-line-clamp: 2; }
  .hero-card__stats { margin-bottom: 14px; }
  .hero-dl { padding: 10px 18px; font-size: .9rem; }
}
@media (max-width: 380px) {
  .hero-card { height: 205px; }
  .hero-card__title { font-size: 1.1rem; }
  .hero-card__desc { display: none; }   /* keep banner compact on very small screens */
}

/* ---------- SECTION SPACING / TYPE (mobile) ---------- */
@media (max-width: 767px) {
  .home-section, .cat-browse { margin-bottom: 1.9rem; }
  .home-section__head { margin-bottom: .85rem; gap: 10px; }
  .home-section__title, .archive-title { font-size: 1.15rem; }
  .home-section__title svg { width: 20px; height: 20px; }
  .home-section__sub { font-size: .78rem; }
  .home-viewall { padding: 6px 12px; font-size: .78rem; }
  .home-about { padding: 22px 16px; margin: 2rem 0 .5rem; }
  .home-about h2 { font-size: 1.25rem; }
  .home-about p { font-size: .9rem; line-height: 1.65; }
}

/* ---------- BROWSE CATEGORIES (contain scroll, fit nicely) ---------- */
.cat-row { max-width: 100%; }
@media (max-width: 767px) {
  .cat-row { gap: 12px; scroll-padding-left: 4px; }
  .cat-tile { width: 78px; }
  .cat-tile__icon { width: 60px; height: 60px; border-radius: 50%; }
  .cat-tile__icon img { width: 100%; height: 100%; }
  .cat-tile__name { font-size: .74rem; max-width: 78px; }
}

/* ---------- CARD GRID: consistent widths/heights, tighter mobile gaps ---------- */
@media (max-width: 575px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
}
.app-card { display: flex; flex-direction: column; height: 100%; }
.app-card > a { display: flex; flex-direction: column; height: 100%; }
.app-card__body { flex: 1 1 auto; }
@media (max-width: 575px) {
  .app-card__thumb { padding: 12px; }
  .app-card__thumb img { width: 76px; height: 76px; }
  .app-card__title { font-size: .82rem; }
  .app-card__meta, .app-card__star, .app-card__mod { font-size: .7rem; }
}

/* ---------- APP DETAIL PAGE (mobile safety) ---------- */
@media (max-width: 767px) {
  .app-detail { padding: 16px; }
  .app-hero { gap: 14px; }
  .app-hero__icon img { width: 76px; height: 76px; }
  .app-hero__title { font-size: 1.2rem; }
  .app-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .download-btn { font-size: 1rem; padding: 14px 16px; }
  .btn-request { margin-left: 0; }
}

/* ---------- DOWNLOAD PAGE (mobile) ---------- */
@media (max-width: 575px) {
  .dl-card { padding: 16px; }
  .dl-appbar { gap: 12px; }
  .dl-appbar img { width: 58px; height: 58px; }
  .dl-appbar h1 { font-size: 1.05rem; }
  .dl-final__app img { width: 84px; height: 84px; }
  .dl-final__app h1 { font-size: 1.05rem; }
  .dl-go { width: 100%; padding: 14px 18px; font-size: 1rem; }
  .dl-stats div { padding: 0 5px; }
  .dl-stats .lbl { font-size: .62rem; letter-spacing: .2px; }
  .dl-stats .val { font-size: .8rem; }
  .dl-file { padding: 11px 12px; gap: 10px; }
  .dl-file__ic { width: 34px; height: 34px; }
  .dl-file__name { font-size: .82rem; }
}

/* ---------- BREADCRUMB (modern) — #id beats style.php's .class rules ---------- */
#breadcrumb.breadcrumb{
  display:flex; flex-wrap:wrap; align-items:center; gap:3px 0;
  background:transparent; border:0; border-radius:0; padding:2px 0; margin:0;
  list-style:none; font-size:.86rem; line-height:1.5;
}
#breadcrumb .breadcrumb-item{ display:inline-flex; align-items:center; }
#breadcrumb .breadcrumb-item a{
  color:#64748b; text-decoration:none; font-weight:600; transition:color .15s; padding:1px 2px;
}
#breadcrumb .breadcrumb-item a:hover{ color:#16a34a; }
#breadcrumb .breadcrumb-item.active{ color:#1f2937; font-weight:700; }
#breadcrumb .breadcrumb-item.home a{ color:#16a34a; display:inline-flex; align-items:center; gap:5px; }
#breadcrumb .breadcrumb-item.home a::before{
  content:""; width:14px; height:14px; flex:0 0 auto;
  background:no-repeat center/contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="%2316a34a"><path d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31a12 12 0 0 0 16.91 1.6L288.06 96.65a12.19 12.19 0 0 1 15.3 0L536.06 301a12 12 0 0 0 16.91-1.6l25.5-31a12 12 0 0 0-1.87-16.93z"/></svg>');
}
#breadcrumb .breadcrumb-item + .breadcrumb-item::before{
  content:""; border-top:2px solid #cbd5e1; border-right:2px solid #cbd5e1; border-left:0; border-bottom:0;
  width:.42rem; height:.42rem; display:inline-block; vertical-align:middle;
  transform:rotate(45deg); margin:0 .6rem 0 .2rem; padding:0;
}
@media (max-width:575px){
  #breadcrumb.breadcrumb{ font-size:.78rem; }
  #breadcrumb .breadcrumb-item + .breadcrumb-item::before{ margin:0 .42rem; }
}

/* ---------- TABLET (768-1023) ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- LARGE DESKTOP: keep content centered, no over-stretch ---------- */
@media (min-width: 1281px) {
  .home-9mod, .container.home-9mod, .app-redesign { margin-left: auto; margin-right: auto; }
}
