/*
  Navigation correction for tablet and phone widths.
  The earlier mobile rules changed left/right/bottom but left the desktop
  top: 50% and transform in place between 641px and 820px, stretching the
  menu into a large panel. This file is loaded last and fully resets every
  positioning and sizing property for each responsive mode.
*/

/* Tablet: use a compact vertical menu on the right. */
@media (min-width: 641px) and (max-width: 820px) {
  .home-page .section-nav {
    left: auto;
    right: 0.75rem;
    top: 50%;
    bottom: auto;
    width: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    display: flex;
    grid-template-columns: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0.4rem;
    overflow: hidden;
    transform: translateY(-50%);
    border-radius: 14px;
  }

  .home-page .section-nav a {
    width: auto;
    min-width: 104px;
    height: 40px;
    padding: 0 0.75rem;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
  }

  .home-page .section-nav .menu-en {
    display: none;
  }

  .home-page .section-nav .menu-ja {
    position: static;
    opacity: 1;
    transform: none;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
  }
}

/* Phone: use one slim bottom bar. Never allow top and bottom together. */
@media (max-width: 640px) {
  .home-page .section-nav {
    left: 0.5rem;
    right: 0.5rem;
    top: auto;
    bottom: 0.5rem;
    width: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    flex-direction: initial;
    align-items: stretch;
    justify-content: stretch;
    gap: 0.1rem;
    padding: 0.32rem;
    overflow: hidden;
    transform: none;
    border-radius: 16px;
  }

  .home-page .section-nav a {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 0.12rem;
  }
}
