/* Installed web apps only. Regular website visitors retain normal browser zoom. */
html.is-standalone {
  --app-status-inset: env(safe-area-inset-top, 0px);
  scroll-padding-top: var(--app-header-size, calc(64px + var(--app-status-inset)));
}
html.is-standalone,
html.is-standalone body {
  background-color: #081423;
  touch-action: pan-x pan-y;
}
html.is-standalone .app-scroll > main#inhoud { background-color: var(--paper); }

/* WebKit samples a real, opaque, viewport-attached header for the native status
   area. A thin pseudo-element or translucent background does not qualify. */
html.is-standalone .top,
html.is-standalone .timer-header,
html.is-standalone body[data-wako-release] .page > .header {
  position: sticky;
  top: 0;
  z-index: 9;
  width: 100%;
  background-color: #081423;
}
html.is-standalone .top {
  padding-top: var(--app-status-inset);
  min-height: calc(44px + var(--app-status-inset));
}
html.is-standalone .skip { top: calc(var(--app-status-inset) + 10px); z-index: 10; }

/* The coming-soon page keeps its original content alignment inside the full-width header. */
html.is-standalone body[data-wako-release] .page > .header {
  margin-inline: 0;
  padding-inline: max(56px, calc((100% - 1280px) / 2));
}
@media (min-width: 721px) and (max-width: 960px) {
  html.is-standalone body[data-wako-release] .page > .header { padding-inline: 36px; }
}
@media (max-width: 720px) {
  html.is-standalone body[data-wako-release] .page > .header {
    padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right));
  }
}

/* Prevent double-tap and pinch zoom in the app, including input-focus zoom
   on iPhones. Preserve one-finger scrolling and the timer's scroll wheels. */
html.is-standalone dialog { touch-action: pan-x pan-y; }
html.is-standalone :is(input, select, textarea) {
  font-size: max(16px, 1em) !important;
}

/* WebKit can move viewport-fixed elements during touch scrolling. Keep the
   installed app chrome outside the only scrolling element instead. */
.app-scroll { display: contents; }
@media (max-width: 720px) {
  html.is-standalone.has-app-navigation {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    scroll-padding-top: 0;
  }
  html.is-standalone.has-app-navigation body {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: var(--app-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }
  html.is-standalone.has-app-navigation .top {
    flex: 0 0 auto;
  }
  html.is-standalone.has-app-navigation .app-scroll {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 20px;
  }
  html.is-standalone.has-app-navigation .app-scroll > footer {
    padding-bottom: 18px;
  }
  html.is-standalone.has-app-navigation .mobile {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    z-index: 4;
  }
}
