/*
 * Shared responsive shell for new_gytni_copy.
 * Covers head.1/head2 navigation and footer.1/footer2 without changing
 * their desktop information architecture.
 */

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  overflow-x: clip;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.prod-header-logo img,
.navbar-brand img,
.footer-main img,
.portal-footer img {
  height: auto;
  object-fit: contain;
}

@media (max-width: 1180px) {
  .prod-header-shell {
    gap: 10px;
  }

  .prod-header-logo {
    min-width: 0;
  }

  .prod-header-logo img {
    width: 100% !important;
    max-width: 100% !important;
  }

  .prod-gnb {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .prod-menu {
    width: min(100%, 760px);
    margin: 0 auto;
  }

  .prod-submenu,
  .prod-submenu--products,
  .prod-submenu--database,
  .prod-submenu--wide {
    box-sizing: border-box;
  }

  body:has(.prod-structure-header.is-mobile-open) {
    overflow: hidden;
  }
}

@media (max-width: 767px) {
  .prod-structure-header,
  .prod-header-shell {
    height: 64px;
  }

  .prod-header-shell {
    width: calc(100% - 24px);
    gap: 6px;
  }

  .prod-header-logo {
    width: clamp(118px, 34vw, 142px);
    height: 40px;
    margin-right: auto;
  }

  .prod-header-logo img {
    width: 100% !important;
    max-height: 36px !important;
  }

  .prod-mobile-toggle {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  .prod-header-utils {
    flex: 0 0 auto;
    gap: 0;
    margin-left: 2px;
    padding-left: 4px;
  }

  .prod-header-utils .header-action {
    width: 34px;
    height: 34px;
  }

  .prod-gnb {
    top: 64px;
    max-height: calc(100dvh - 64px);
  }

  .prod-menu {
    width: 100%;
    padding: 8px 14px max(24px, env(safe-area-inset-bottom));
  }

  .prod-menu-trigger.gnb-depth1-link {
    min-height: 52px;
    height: auto;
    padding: 14px 8px;
    font-size: 15px;
    line-height: 1.35;
  }

  .prod-submenu-heading {
    margin-bottom: 10px;
  }

  .prod-submenu-grid,
  .prod-submenu-list {
    grid-template-columns: 1fr;
  }

  .prod-submenu a {
    min-height: 44px;
  }

  #loginSearchOverlay,
  #loginSearchOverlay.active.login-only,
  #loginSearchOverlay.active.show-search {
    top: 64px;
    max-height: calc(100dvh - 64px);
    padding: 16px;
    overflow-y: auto;
  }

  #loginSearchOverlay.active.show-search .overlay-panel.search-panel {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
  }

  #loginSearchOverlay .search-panel .search-box {
    gap: 8px;
  }

  #loginSearchOverlay .search-panel .search-box input {
    min-width: 0;
    padding: 13px 16px;
    font-size: 15px;
  }

  #loginSearchOverlay .search-panel .search-box button {
    min-width: 76px;
    padding: 12px 14px;
  }

  .navbar {
    min-height: 64px;
  }

  .navbar .navbar-brand img {
    width: clamp(116px, 34vw, 142px);
    max-height: 36px;
  }

  .navbar-collapse {
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
  }

  .footer-main,
  .portal-footer {
    box-sizing: border-box;
    width: 100%;
    padding: 42px 0 calc(42px + env(safe-area-inset-bottom)) !important;
    overflow: hidden;
  }

  .footer-main > .container,
  .portal-footer > .container,
  .portal-footer__inner {
    width: calc(100% - 32px);
    max-width: 720px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 0;
    padding-left: 0;
  }

  .footer-main .row,
  .portal-footer__content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-right: 0;
    margin-left: 0;
  }

  .footer-main [class*="col-"],
  .portal-footer__content > * {
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding-right: 0;
    padding-left: 0;
  }

  .footer-main p,
  .footer-main a,
  .portal-footer p,
  .portal-footer a {
    overflow-wrap: anywhere;
  }

  .footer-main .input-group,
  .footer-main .bt-news {
    display: flex;
    width: 100%;
    max-width: 440px;
  }

  .footer-main .bt-email-input {
    min-width: 0;
  }

  .footer-main .bt-social,
  .portal-footer__social {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-left: 0;
  }

  .footer-main .bt-social img,
  .portal-footer__social img {
    width: 34px;
    height: 34px;
    object-fit: contain;
  }

  .footer-main .footer-chrome {
    margin-top: 26px;
    padding: 12px 16px !important;
  }
}

@media (max-width: 420px) {
  .prod-header-shell {
    width: calc(100% - 18px);
  }

  .prod-header-logo {
    width: 112px;
  }

  .prod-header-utils .header-action {
    width: 32px;
    height: 32px;
  }

  .prod-mobile-toggle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  #loginSearchOverlay .search-panel .search-box {
    align-items: stretch;
    flex-direction: column;
  }

  #loginSearchOverlay .search-panel .search-box button {
    width: 100%;
  }

  .footer-main,
  .portal-footer {
    padding-top: 34px !important;
    padding-bottom: calc(34px + env(safe-area-inset-bottom)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prod-gnb,
  .prod-submenu,
  .prod-mobile-toggle span {
    transition: none !important;
  }
}
