/* GRFTSH MOBILE VIEWPORT STABILITY V1 */

@media (max-width: 699px) {

  html,
  body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: clip;
    touch-action: manipulation;
  }

  .app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #feed,
  #feed .post,
  #feed .post-header,
  #feed .media,
  #feed .media-gallery,
  #feed .media-gallery-track,
  #feed .media-gallery-slide {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #feed .media,
  #feed .media-gallery {
    overflow: hidden;
  }

  #feed .media-gallery-track {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
  }

  #feed .media-gallery-slide {
    flex: 0 0 100%;
    overflow: hidden;
  }

  #feed .media video,
  #feed .media-gallery video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 75dvh;
    object-fit: contain;
  }

  .bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;

    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));

    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
    padding-bottom: env(safe-area-inset-bottom);

    transform: none;
    overflow: visible;
  }

  .bottom-nav .nav-item {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .bottom-nav .nav-item > span,
  .bottom-nav .publish-label {
    max-width: 100%;
    text-align: center;
  }

  .bottom-nav .publish-slot {
    justify-self: stretch;
    overflow: visible;
  }

  .bottom-nav .publish-button {
    left: 50%;
    transform: translateX(-50%);
  }

  .bottom-nav .publish-button:active {
    transform: translateX(-50%) scale(.94);
  }

}

/* GRFTSH_IOS_INPUT_FOCUS_ZOOM_FIX_V1_START */
/* iOS Safari may auto-zoom when focusing editable controls below 16px.
   Preserve pinch-to-zoom and existing viewport settings. */
@media (max-width: 699px) and (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]),
  textarea,
  select,
  [contenteditable="true"],
  [contenteditable=""] {
    font-size: max(16px, 1em);
  }
}
/* GRFTSH_IOS_INPUT_FOCUS_ZOOM_FIX_V1_END */
