/* =====================================================================
   FRCT — PWA shell: mobile standalone feel, bottom nav, install UI, FAB
   ===================================================================== */

:root {
  --frct-pwa-bar-h: 64px;
  --frct-pwa-safe-b: env(safe-area-inset-bottom, 0px);
}

.frct-pwa-splash__logo-mark {
  position: relative;
  width: 76px;
  height: 76px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.frct-pwa-splash__ring-inner {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  border: 3px solid rgba(245, 168, 0, 0.5);
  animation: frct-pwa-spin 1.05s cubic-bezier(.4, 0, .2, 1) infinite;
}
.frct-pwa-splash__letter {
  font-weight: 900;
  font-size: 1.75rem;
  color: #f5a800;
}

body.frct-pwa-shell {
  min-height: 100dvh;
  padding-bottom: calc(var(--frct-pwa-bar-h) + var(--frct-pwa-safe-b) + 14px);
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  body.frct-pwa-shell {
    padding-bottom: 0;
  }
}

/* --- Mobile app framing: hide shrinking URL bar quirks in standalone-ish feel --- */
@media (max-width: 1023px) {
  html.frct-pwa-shell {
    height: auto;
    min-height: 100dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .frct-pwa-route,
  #frct-pwa-shell-bottom,
  .frct-pwa-quick-fab,
  .frct-pwa-quick-fab-panel,
  .frct-pwa-install,
  #frct-pwa-splash {
    transition: none !important;
    animation: none !important;
  }
}

/* --- View Transition API enhancement (fallback: opacity fade in pwa.js) --- */
.frct-pwa-route {
  opacity: 1;
}

/* Splash */
#frct-pwa-splash {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #236b43 0%, #0f3720 55%, #0a2414 100%);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
#frct-pwa-splash.frct-pwa-splash--hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.frct-pwa-splash__ring {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  border: 3px solid rgba(245, 168, 0, 0.45);
  animation: frct-pwa-spin 1.05s cubic-bezier(.4, 0, .2, 1) infinite;
  margin-bottom: 18px;
}
.frct-pwa-splash__mark {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(145deg, #f5a800, #ffb833);
  color: #0f3720;
  font-weight: 900;
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.frct-pwa-splash__text {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}

@keyframes frct-pwa-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Bottom navigation */
#frct-pwa-shell-bottom {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--frct-pwa-bar-h) + var(--frct-pwa-safe-b));
  padding-bottom: var(--frct-pwa-safe-b);
  padding-top: 4px;
  background: rgba(15, 55, 32, 0.96);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  z-index: 9500;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}

body#frct-has-mobile-shell.frct-pwa-shell #frct-pwa-shell-bottom {
  display: flex;
}

@media (min-width: 1024px) {
  #frct-pwa-shell-bottom {
    display: none !important;
  }
}

#frct-pwa-shell-bottom-inner {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 10px;
}

#frct-pwa-shell-bottom .frct-pwa-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  border: none;
  background: transparent;
  color: rgba(198, 232, 210, 0.78);
  font-family: 'Poppins', sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, transform 0.18s ease;
}

#frct-pwa-shell-bottom .frct-pwa-tab i {
  font-size: 1.15rem;
  margin-bottom: 1px;
}

#frct-pwa-shell-bottom .frct-pwa-tab--primary {
  color: #ffb020;
}

#frct-pwa-shell-bottom .frct-pwa-tab--active {
  color: #fff;
}

#frct-pwa-shell-bottom .frct-pwa-tab:active {
  transform: scale(0.94);
}

/* Quick FAB --- */
.frct-pwa-quick-fab {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(var(--frct-pwa-bar-h) + var(--frct-pwa-safe-b) + 88px + env(safe-area-inset-bottom, 0px));
  z-index: 9400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

@media (min-width: 1024px) {
  .frct-pwa-quick-fab {
    bottom: 28px;
  }
}

.frct-pwa-quick-fab-main {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(145deg, #f5a800, #d99200);
  color: #0f3720;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(245, 168, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.frct-pwa-quick-fab-main:active {
  transform: scale(0.92);
}

.frct-pwa-quick-fab-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.frct-pwa-quick-fab-panel.frct-pwa-quick-fab-panel--open {
  display: flex;
  animation: frct-pop 0.32s cubic-bezier(.34, 1.3, .64, 1);
}

@keyframes frct-pop {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.frct-pwa-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  -webkit-tap-highlight-color: transparent;
}

.frct-pwa-mini--wa {
  background: #25d366;
  color: #fff;
}

.frct-pwa-mini--ev {
  background: #eef7f2;
  color: #14532d;
}

.frct-pwa-mini--give {
  background: #fde68a;
  color: #422006;
}

.frct-pwa-mini--bell {
  background: #dbeafe;
  color: #1e3a5f;
}

/* Install prompt */
.frct-pwa-install {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(var(--frct-pwa-bar-h) + var(--frct-pwa-safe-b) + 76px + env(safe-area-inset-bottom, 0px));
  max-width: 420px;
  margin: 0 auto;
  background: linear-gradient(145deg, #ffffff 0%, #effaf3 100%);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(27, 94, 56, 0.12);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  z-index: 9600;
  transform: translateY(120%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(.34, 1.2, .64, 1), opacity 0.35s ease, visibility 0.35s;
}

.frct-pwa-install.frct-pwa-install--visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

@media (min-width: 1024px) {
  .frct-pwa-install.frct-pwa-install--desktop {
    bottom: 24px;
  }
}

.frct-pwa-install__row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.frct-pwa-install__logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1b5e38, #14532d);
  color: #f5a800;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.25rem;
}

.frct-pwa-install__body h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 0.975rem;
  font-weight: 700;
  color: #14532d;
  margin-bottom: 4px;
}

.frct-pwa-install__body p {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
}

.frct-pwa-install__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.frct-pwa-install__btn-primary,
.frct-pwa-install__btn-muted {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 11px 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.15s ease;
}

.frct-pwa-install__btn-primary {
  background: #f5a800;
  color: #14532d;
}

.frct-pwa-install__btn-muted {
  background: rgba(20, 83, 45, 0.08);
  color: #14532d;
}


/* =====================================================================
   Horizontal swipe-friendly rails (carousel cards, timelines)
   ===================================================================== */
@media (max-width: 1023px) {
  body.frct-pwa-shell#frct-has-mobile-shell .frct-swipe-row {
    display: flex;
    gap: 0.875rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-inline: calc(-1 * clamp(14px, 4vw, 22px));
    padding-inline: clamp(14px, 4vw, 22px);
  }

  body.frct-pwa-shell#frct-has-mobile-shell .frct-swipe-card {
    flex: 0 0 min(92vw, 360px);
    scroll-snap-align: start;
    border-radius: 16px;
  }
}

/* Float overlap: reposition site WhatsApp/back-to-top on mobile shell */
body#frct-has-mobile-shell.frct-pwa-shell .whatsapp-float {
  bottom: calc(var(--frct-pwa-bar-h) + var(--frct-pwa-safe-b) + 108px + env(safe-area-inset-bottom, 0px));
  left: calc(14px + env(safe-area-inset-left));
  right: auto;
}

body#frct-has-mobile-shell.frct-pwa-shell .back-to-top {
  bottom: calc(var(--frct-pwa-bar-h) + var(--frct-pwa-safe-b) + 24px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1023px) {
  body#frct-has-mobile-shell.frct-pwa-shell .frct-site-header {
    padding-top: env(safe-area-inset-top);
  }

  /** Collapse top informational bar on phones for tighter app chrome */
  body#frct-has-mobile-shell.frct-pwa-shell .frct-topbar .frct-topbar__divider,
  body#frct-has-mobile-shell.frct-pwa-shell .frct-topbar .frct-topbar__divider--lg {
    display: none;
  }

  /** Touch targets */
  body#frct-has-mobile-shell.frct-pwa-shell .frct-hamburger {
    min-width: 44px;
    min-height: 44px;
  }
}
