/* Mobile adaptive layer for gymn3mogv7 / DLE 17.0
   Safe overrides only: no DLE tags changed. */

html { -webkit-text-size-adjust: 100%; }
body { min-width: 320px; }
img, svg, video, iframe, object, embed { max-width: 100%; }
iframe { border: 0; }

/* Prevent old fixed-width content from breaking the viewport */
.full-text, .content-card, .page, .page__text, .static-page, .article, .news-card__body { overflow-wrap: anywhere; word-break: normal; }
.full-text table, .content-card table, .page__text table, .static-page table { display: block; width: 100% !important; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.full-text img, .page__text img, .static-page img, .content-card img { height: auto !important; }
.full-text iframe, .page__text iframe, .static-page iframe, .content-card iframe { width: 100% !important; aspect-ratio: 16 / 9; height: auto !important; }

@media (max-width: 1400px) {
  .site-container { width: min(100% - 32px, 1680px) !important; }
  .layout-grid { grid-template-columns: 270px minmax(0, 1fr) 260px !important; gap: 18px !important; }
}

@media (max-width: 1200px) {
  .layout-grid { grid-template-columns: 260px minmax(0, 1fr) !important; }
  .right-rail { display: none !important; }
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .important-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .official-wide .official-banners { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 900px) {
  body.mobile-menu-is-opened { overflow: hidden; }
  .site-container { width: min(100% - 24px, 1680px) !important; }
  .topline { font-size: 12px; }
  .topline__inner { height: auto !important; min-height: 36px; padding: 8px 0; gap: 12px; overflow-x: auto; scrollbar-width: none; }
  .topline__inner::-webkit-scrollbar { display: none; }
  .topline__spacer { display: none; }

  .modern-header { top: 0; }
  .modern-header__inner { height: 64px !important; gap: 10px; }
  .brand { min-width: 0 !important; flex: 1 1 auto; gap: 10px; }
  .brand img { width: 44px !important; height: 44px !important; flex: 0 0 auto; }
  .brand b { font-size: 16px !important; line-height: 1.15; }
  .brand small { font-size: 11px !important; }
  .topnav, .modern-header .js-this-in-mobile-menu.topnav { display: none !important; }
  .search-toggle { display: none !important; }
  .header__btn-login span { display: none; }
  .header__btn-login { width: 42px !important; height: 42px !important; padding: 0 !important; border-radius: 12px !important; }
  .header__btn-mobmenu { display: inline-flex !important; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 12px; background: var(--gm-green-soft) !important; color: var(--gm-green) !important; }

  .layout-grid { display: flex !important; flex-direction: column; padding-top: 12px !important; gap: 16px !important; }
  .main-area, .left-rail, .right-rail { width: 100% !important; max-width: 100% !important; position: static !important; top: auto !important; }
  .main-area { order: 1; }
  .left-rail { order: 2; display: none; }
  .right-rail { order: 3; display: block !important; }
  .right-rail .director-card-final { display: none; }
  .right-rail .official-card { margin-bottom: 0; }
  .rail-card, .content-card, .important-panel, .announcements, .official-wide { border-radius: 16px !important; }

  .hero-modern { min-height: 240px !important; border-radius: 16px !important; background-position: center; }
  .hero-modern__content { padding: 28px 22px !important; max-width: 100%; }
  .hero-kicker { font-size: 30px !important; }
  .hero-kicker b { font-size: 34px !important; }
  .hero-modern p { font-size: 15px !important; margin-bottom: 18px !important; }
  .hero-btn { width: 100%; justify-content: center; padding: 13px 16px !important; }

  .quick-actions { margin: 12px 0 16px !important; grid-template-columns: 1fr 1fr !important; border-radius: 16px !important; }
  .quick-actions a { grid-template-columns: 40px 1fr; padding: 16px !important; border-right: 0 !important; border-bottom: 1px solid var(--gm-border); }
  .quick-actions a:nth-child(odd) { border-right: 1px solid var(--gm-border) !important; }
  .quick-actions i { width: 40px !important; height: 40px !important; font-size: 20px !important; }

  .important-grid, .news-grid, .official-wide .official-banners, .footer-grid, .footer-grid-final { grid-template-columns: 1fr 1fr !important; }
  .news-card__img { height: 180px !important; }
  .section-head { gap: 12px; align-items: flex-start !important; }
  .section-head h1, .section-head h2 { font-size: 21px !important; line-height: 1.2; }
  .section-head a { font-size: 13px; white-space: nowrap; }
  .content-card { padding: 18px !important; }
  .page__meta { gap: 8px 12px; }
  .page__prev-next { flex-direction: column; gap: 12px; }

  .mobile-menu { width: min(92vw, 420px) !important; left: -100vw; background: #fff; z-index: 1002; }
  .mobile-menu__header { min-height: 64px; border-bottom: 1px solid var(--gm-border); }
  .mobile-menu__header .brand { padding-right: 8px; }
  .mobile-menu__content { padding: 0 14px 18px; }
  .mobile-menu__content .topnav { display: grid !important; gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--gm-border); }
  .mobile-menu__content .topnav a { display: block; padding: 12px 14px; border-radius: 12px; background: var(--gm-green-soft); color: var(--gm-green); font-weight: 800; }
  .mobile-menu__content .nav-card { display: block !important; margin-top: 14px; box-shadow: none; border: 1px solid var(--gm-border); }
  .mobile-menu__content .nav-card #cssmenu ul ul { display: none; }
  .mobile-menu__content .nav-card #cssmenu li.is-open > ul { display: block; }
  .mobile-menu__content .nav-card #cssmenu li.has-sub > a { position: relative; padding-right: 44px !important; }
  .mobile-menu__content .nav-card #cssmenu li.has-sub > a:after { content: '\f107'; font-family: 'Font Awesome 5 Pro'; font-weight: 900; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--gm-green); }
  .mobile-menu__content .nav-card #cssmenu li.has-sub.is-open > a:after { transform: translateY(-50%) rotate(180deg); }
  .overlay { z-index: 1000; }
}

@media (max-width: 600px) {
  .site-container { width: min(100% - 16px, 1680px) !important; }
  .topline__inner { padding-left: 2px; padding-right: 2px; }
  .modern-header__inner { height: 60px !important; }
  .brand img { width: 40px !important; height: 40px !important; }
  .brand b { font-size: 14px !important; }
  .brand small { display: none !important; }
  .header__btn-login { display: none !important; }

  .hero-modern { min-height: 220px !important; }
  .hero-modern__content { padding: 24px 18px !important; }
  .hero-kicker { font-size: 25px !important; }
  .hero-kicker b { font-size: 29px !important; }
  .hero-modern p { font-size: 14px !important; }

  .quick-actions, .important-grid, .news-grid, .official-wide .official-banners, .footer-grid, .footer-grid-final { grid-template-columns: 1fr !important; }
  .quick-actions a:nth-child(odd) { border-right: 0 !important; }
  .quick-actions a { min-height: 82px; }
  .important-grid a { min-height: auto !important; }
  .news-card__img { height: 190px !important; }
  .news-card__body { padding: 14px !important; }
  .news-card__title { font-size: 16px !important; }
  .announcements > a { grid-template-columns: 52px 1fr !important; }
  .official-banners img { max-height: 90px; object-fit: contain; }

  .page__title, .content-card h1, .full-text h1 { font-size: 24px !important; line-height: 1.2; }
  .page__img { padding-top: 64% !important; }
  .page__meta { display: flex; flex-wrap: wrap; font-size: 13px; }
  .page__tags { overflow-x: auto; flex-wrap: nowrap !important; padding-bottom: 4px; }

  .footer-map-card iframe, .footer-map iframe { min-height: 230px; height: 230px !important; }
  .mobile-menu { width: 100vw !important; }
}

@media (max-width: 380px) {
  .brand b { font-size: 13px !important; }
  .hero-kicker { font-size: 23px !important; }
  .hero-kicker b { font-size: 27px !important; }
  .section-head { flex-direction: column; }
}
