/* (.at-ic, not .pill: app.css's .pill is the status pill, with a dot.)
 * The installed app's shell: the bottom tabs (includes/pwa.php mim_app_tabs())
 * and the loading screen between pages (the seal coin, assets/js/pwa.js).
 *
 * Shown ONLY inside the installed app — the Play Store app (a Trusted Web
 * Activity) or a Chrome install — and only on a phone-sized screen. In a
 * browser tab the site's own menus do the job and this bar stays hidden.
 * Two signals, so it works with or without JavaScript: the display-mode
 * media query, and html.is-app (set by assets/js/pwa.js).
 *
 * z-index 50: above the sticky site bar (30), under the scrim (60), the
 * drawer (70), the portal sidebar (80) and toasts (90).
 */
.app-tabs { display: none; }

/* Room for the tabs at the foot — ONLY on a page that has them (2026-11-12):
   .app-tabs-gap is drawn with the bar (mim_app_tabs), so pages without tabs
   (coming-soon, the sign-up pages, joining) end at the bottom of the screen.
   A gap element, not body:has(), so Chromes before 105 get it too (2026-11-18).
   The bar is 80px: 10px of it under the labels, clear of the gesture line. */
.app-tabs-gap { display: none; height: calc(80px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 820px) {
  html.is-app .app-tabs, html.is-app .app-tabs-gap { display: grid; }
  html.is-app .app-tabs ~ .toasts { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (display-mode: standalone) and (max-width: 820px) {
  .app-tabs, .app-tabs-gap { display: grid; }
  .app-tabs ~ .toasts { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

.app-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(80px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: #fff; border-top: 1px solid #e2e8f2;
  box-shadow: 0 -8px 22px -16px rgba(10, 28, 68, .4);
}
.app-tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px; color: #4a5874; text-decoration: none;
  font: 500 12px/16px 'Inter', 'Roboto', system-ui, sans-serif;
}
.app-tabs .at-ic { width: 60px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .15s; }
.app-tabs svg { width: 22px; height: 22px; }
.app-tabs a:hover .at-ic { background: #eef2f8; }
.app-tabs a.on { color: #0a1c44; font-weight: 700; }
.app-tabs a.on .at-ic { background: #d6e3fc; }
.app-tabs a:focus-visible { outline: 2px solid #1d5fd6; outline-offset: -4px; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .app-tabs .at-ic { transition: none; } }

/* ---------------------------------------------------------------------------
 * The loading screen between pages inside the app (the user, 2026-11-12: the
 * seal coin "for the loading screen"). assets/js/pwa.js adds #app-loading when
 * a page takes more than half a second, and it goes with the old page. The
 * coin is assets/css/coin.css's — the Ministry of Social Services seal on the
 * face, the Men's Department seal on the back — turning once a cycle, with a
 * rest on the Ministry's face. Its two images are kept by the service worker,
 * so it shows at once. Reduced motion: it never turns.
 * ------------------------------------------------------------------------- */
#app-loading { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: #0a1c44; animation: al-fade .18s ease both; }
#app-loading .al { display: grid; justify-items: center; gap: 22px; color: #dfe7f8; font: 600 15px 'Inter', 'Roboto', system-ui, sans-serif; }
#app-loading .al-coin { position: relative; width: 136px; height: 136px; perspective: 1400px; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .45)); }
#app-loading .al-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: al-turn 1.8s infinite; }
#app-loading .al-in img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: translateZ(4px); }
#app-loading .al-in img.al-back { transform: rotateY(180deg) translateZ(4px); }
#app-loading .al-in i { position: absolute; inset: .6%; border-radius: 50%; background: #b8861b; }
#app-loading .al-in i:nth-of-type(1) { transform: translateZ(-4px); }
#app-loading .al-in i:nth-of-type(2) { transform: translateZ(-3px); background: #a87a17; }
#app-loading .al-in i:nth-of-type(3) { transform: translateZ(-2px); }
#app-loading .al-in i:nth-of-type(4) { transform: translateZ(-1px); background: #a87a17; }
#app-loading .al-in i:nth-of-type(5) { transform: translateZ(0); }
#app-loading .al-in i:nth-of-type(6) { transform: translateZ(1px); background: #a87a17; }
#app-loading .al-in i:nth-of-type(7) { transform: translateZ(2px); }
#app-loading .al-in i:nth-of-type(8) { transform: translateZ(3px); background: #a87a17; }
#app-loading .al-in i:nth-of-type(9) { transform: translateZ(3.5px); }
@keyframes al-turn {
  0%, 18% { transform: rotateY(0deg) scale(1); animation-timing-function: cubic-bezier(.5, 0, .2, 1); }
  50% { transform: rotateY(180deg) scale(1.06); animation-timing-function: cubic-bezier(.5, 0, .2, 1); }
  82%, 100% { transform: rotateY(360deg) scale(1); }
}
@keyframes al-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #app-loading, #app-loading .al-in { animation: none; }
}
