/* ============================================================
   Gastrogonia: the Android app feel (2026-12-04, docs/2026-12-04-android-app-feel.md)

   🔴 EVERY rule here hangs off `html.gg-app`, a class the
   inline script in base.html sets only inside the app (installed PWA / Trusted Web Activity). The site in a normal
   browser must look byte-for-byte the same as before this file existed. The only unscoped conditions are the
   `@media (display-mode: standalone)` blocks, which are the app by definition.
   Guard: storefront/test_app_feel_1204.py checks that no rule here escapes that scope.

   No hard-coded pixels (rem, tokens, env()), touch targets of at least 2.75rem, motion only under
   `prefers-reduced-motion: no-preference`.
   ============================================================ */

html.gg-app {
  --gg-tap: 2.75rem;            /* minimum touch target (44px at the default size) */
  --gg-appbar-h: 4rem;          /* the same height the browser's mobile tab bar has */
  --gg-z-launch: 5000;          /* above every other layer: progress bar 3000, skip link 4000 */
  --gg-ease: cubic-bezier(.2, .7, .2, 1);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 1. Bottom tab bar ----------
   One <nav class="tabbar"> holds two groups (base.html): the browser's own (Αρχική, Κατηγορίες, …) and the app's.
   Outside the app only the browser's group shows (storefront.css hides the app's group). Inside, the bar shows at every width and only the app's group. */
html.gg-app .tabbar { display: block; }
html.gg-app .tabbar-in:not(.tabbar-in--app) { display: none; }
html.gg-app .tabbar-in--app { display: flex; }

html.gg-app .tab {
  min-width: 0;
  min-height: var(--gg-tap);
  padding: .4375rem .0625rem;
  font-size: .65rem;
  letter-spacing: 0;
  transition: transform .12s ease, background-color .12s ease;
}
html.gg-app .tab .tab-l {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.gg-app .tab[aria-current="page"] { color: var(--olive-d); }
html.gg-app .tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -.4375rem;
  width: 1.625rem;
  height: .1875rem;
  border-radius: 100vmax;
  background: var(--terra);
}
html.gg-app .tab:focus-visible { outline: .125rem solid var(--olive-d); outline-offset: -.125rem; }

/* The browser's bar exists only up to 760px; the app shows it on wider screens too (tablet, landscape), so what the
   narrow-screen rules of storefront.css lift above the bar is lifted here as well. 760.02px pairs with that
   `max-width:760px` without a gap at fractional widths (traps.md, 2026-09). */
@media (min-width: 47.5013rem) {
  html.gg-app body { padding-bottom: calc(var(--gg-appbar-h) + env(safe-area-inset-bottom)); }
  html.gg-app .backtop { bottom: calc(5.25rem + env(safe-area-inset-bottom)); }
  html.gg-app .cookiebar,
  html.gg-app .app-offer { bottom: calc(4.5625rem + env(safe-area-inset-bottom)); }
}

/* ---------- 2. Slim footer: the legal link and the © line stay; install prompts go ---------- */
html.gg-app .ftr-main,
html.gg-app .ftr-track { display: none; }
html.gg-app .ftr-slim {
  display: block;
  margin: 0;
  padding: 1rem 0 0;
  text-align: center;
}
html.gg-app .ftr-slim a {
  display: inline-flex;
  align-items: center;
  min-height: var(--gg-tap);
  padding-inline: .75rem;
  font-size: .8125rem;
  color: rgba(var(--ftr-fg-rgb), .72);
  text-decoration: underline;
}
/* padding-inline keeps the line clear of the floating back-to-top button */
html.gg-app .ftr-bottom { margin-top: 0; padding-inline: 4.5rem; justify-content: center; text-align: center; }
html.gg-app .ftr-app,
html.gg-app .app-offer { display: none; }

/* ---------- 3. Launch screen: the animated logo while the first page of an app session loads ---------- */
html.gg-app.gg-app-launch { overflow: hidden; }
html.gg-app.gg-app-launch .gg-launch {
  position: fixed;
  inset: 0;
  z-index: var(--gg-z-launch);
  display: grid;
  place-items: center;
  background: var(--cream);
  opacity: 1;
  transition: opacity .35s ease;
}
html.gg-app.gg-app-launch.gg-app-launch-out .gg-launch { opacity: 0; pointer-events: none; }
html.gg-app .gg-launch-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: min(72vw, 22rem);
}
html.gg-app .gg-launch-in img { display: block; width: 100%; height: auto; }
html.gg-app .gg-launch-line {
  position: relative;
  overflow: hidden;
  width: 40%;
  height: .1875rem;
  border-radius: 100vmax;
  background: rgba(var(--olive-rgb), .16);
}
html.gg-app .gg-launch-line::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--olive-l);
  opacity: .55;
}
@keyframes gg-launch-in {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes gg-launch-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}
@media (prefers-reduced-motion: no-preference) {
  html.gg-app.gg-app-launch .gg-launch-in img { animation: gg-launch-in .7s var(--gg-ease) both; }
  html.gg-app.gg-app-launch .gg-launch-line { animation: gg-launch-in .7s var(--gg-ease) .15s both; }
  html.gg-app.gg-app-launch .gg-launch-line::after {
    inset: 0 auto 0 0;
    width: 40%;
    opacity: 1;
    background: linear-gradient(90deg, var(--olive-l), var(--gold));
    animation: gg-launch-slide 1.4s ease-in-out infinite;
  }
}

/* ---------- 4. Smoother navigation: a short cross-fade between pages; the bar stays still ---------- */
@media (display-mode: standalone) and (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: .18s; }
  html.gg-app .tabbar { view-transition-name: gg-appbar; }
  ::view-transition-group(gg-appbar) { animation: none; }
  ::view-transition-old(gg-appbar) { display: none; }
  ::view-transition-new(gg-appbar) { animation: none; }
}

/* ---------- 5. Tap feedback ---------- */
html.gg-app a,
html.gg-app button,
html.gg-app input,
html.gg-app select,
html.gg-app textarea,
html.gg-app label,
html.gg-app summary,
html.gg-app [role="button"] { touch-action: manipulation; }

/* No sticky hover on touch: a tap leaves :hover on, so the lift and the shadow that come with it would stay. */
@media (hover: none) {
  html.gg-app .btn:hover,
  html.gg-app .pcard:hover { transform: none; box-shadow: none; }
  html.gg-app .pcard:hover .pcard-media .art { transform: none; }
}
html.gg-app .btn:active { transform: scale(.97); filter: brightness(.92); }
html.gg-app .pcard:active { transform: scale(.98); }
html.gg-app .tab:active { transform: scale(.94); background-color: rgba(var(--olive-rgb), .08); }
@media (prefers-reduced-motion: reduce) {
  html.gg-app .btn:active,
  html.gg-app .pcard:active,
  html.gg-app .tab:active { transform: none; }
}
