/* ============================================================
   AMARAL PRODUTORA — APP LAYER
   Splash screen, tab bar, micro-interactions, PWA enhancements
   Loaded on all pages
============================================================ */

/* ============================================================
   1. ANIMATED SPLASH SCREEN
============================================================ */
.app-splash {
  position: fixed; inset: 0;
  z-index: 99999;
  background: #05101C;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: opacity 0.6s cubic-bezier(0.32, 0.72, 0.24, 1),
              visibility 0.6s cubic-bezier(0.32, 0.72, 0.24, 1);
}
.app-splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* Ambient glow behind logo */
.app-splash::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 72, 128, 0.35), transparent 70%);
  filter: blur(60px);
  opacity: 0;
  animation: splash-glow 1.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.app-splash-logo {
  width: 88px; height: auto;
  opacity: 0;
  transform: scale(0.7);
  animation: splash-logo-in 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
  filter: drop-shadow(0 0 30px rgba(178, 190, 204, 0.15));
}

.app-splash-wordmark {
  margin-top: 1.25rem;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  animation: splash-text-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
}
.app-splash-wordmark .splash-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  background: linear-gradient(135deg, #C9D3E0, #E8EEF4 28%, #A8B6C6 48%, #DCE4EE 68%, #B0BCC9);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.app-splash-wordmark .splash-type {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #6B7888;
  margin-top: 0.3rem;
}

/* Chrome shimmer sweep across logo */
.app-splash-logo::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.15) 45%,
    rgba(255,255,255,0.25) 50%,
    rgba(255,255,255,0.15) 55%,
    transparent 60%
  );
  animation: splash-shimmer 1.6s cubic-bezier(0.32, 0.72, 0.24, 1) 0.9s forwards;
  transform: translateX(-100%);
}

/* Loading bar */
.app-splash-bar {
  position: absolute;
  bottom: 15%;
  width: 48px; height: 2px;
  border-radius: 2px;
  background: rgba(178, 190, 204, 0.12);
  overflow: hidden;
  opacity: 0;
  animation: splash-text-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}
.app-splash-bar::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, #A8B6C6, #DCE4EE);
  border-radius: 2px;
  animation: splash-bar-fill 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

@keyframes splash-glow {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splash-logo-in {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splash-text-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes splash-shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}
@keyframes splash-bar-fill {
  from { width: 0; }
  to   { width: 100%; }
}

/* ============================================================
   2. BOTTOM TAB BAR (iOS-style)
   Only shows in standalone/PWA mode
============================================================ */
.app-tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 98;
  display: none; /* Hidden by default, shown via JS in standalone mode */
  padding: 0.5rem 0.75rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 17, 31, 0.88);
  backdrop-filter: blur(32px) saturate(2.0);
  -webkit-backdrop-filter: blur(32px) saturate(2.0);
  border-top: 1px solid rgba(178, 190, 204, 0.1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}
.app-tabbar.visible {
  display: flex;
}

.app-tabbar-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.tab-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 0.2rem;
  padding: 0.35rem 0.6rem;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.32, 0.72, 0.24, 1);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg {
  width: 22px; height: 22px;
  stroke: #6B7888;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.35s cubic-bezier(0.32, 0.72, 0.24, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-item span {
  font-family: 'Inter', sans-serif;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #6B7888;
  transition: color 0.35s cubic-bezier(0.32, 0.72, 0.24, 1);
}

/* Active state */
.tab-item.active svg {
  stroke: #D4DCE6;
  transform: scale(1.08);
}
.tab-item.active span {
  color: #D4DCE6;
}
/* Active glow dot */
.tab-item.active::after {
  content: '';
  position: absolute;
  top: -1px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #D4DCE6;
  box-shadow: 0 0 12px rgba(212, 220, 230, 0.6);
}

/* Touch/hover feedback */
.tab-item:active {
  transform: scale(0.92);
}
@media (hover: hover) {
  .tab-item:hover svg { stroke: #B2BECC; }
  .tab-item:hover span { color: #B2BECC; }
}

/* Add bottom padding to body when tab bar is visible */
body.has-tabbar {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
body.has-tabbar footer {
  margin-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* ============================================================
   3. MICRO-INTERACTIONS — Button press, ripple, glow
============================================================ */

/* Press feedback for all buttons */
.btn, .nav-cta, .svc-card, .tab-item {
  -webkit-tap-highlight-color: transparent;
}

/* Enhanced button press */
.btn:active {
  transform: translateY(1px) scale(0.97) !important;
  transition-duration: 0.1s !important;
}

/* Touch ripple on interactive cards */
.svc-card:active,
.gallery-item:active {
  transform: scale(0.98) !important;
  transition-duration: 0.12s !important;
}

/* Smooth page content entry */
.page-enter {
  animation: page-fade-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Enhanced link transitions for app feel */
a[href$=".html"] {
  transition: opacity 0.2s ease;
}

/* Scroll indicator pulse */
@keyframes tab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 220, 230, 0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(212, 220, 230, 0); }
}

/* ============================================================
   4. STANDALONE (PWA) MODE ADJUSTMENTS
============================================================ */
@media (display-mode: standalone) {
  /* Show tab bar in PWA mode */
  .app-tabbar { display: flex; }

  /* Hide desktop nav in PWA on mobile */
  @media (max-width: 768px) {
    .nav { display: none !important; }
    .mobile-menu { display: none !important; }
    .hamburger { display: none !important; }
  }

  /* Adjust hero padding (no nav bar on top in PWA mobile) */
  @media (max-width: 768px) {
    .hero {
      padding-top: calc(env(safe-area-inset-top, 0px) + 2rem) !important;
      min-height: auto !important;
    }
  }
}

/* Also detect iOS standalone via JS-added class */
body.is-standalone .app-tabbar { display: flex; }
@media (max-width: 768px) {
  body.is-standalone .nav { display: none !important; }
  body.is-standalone .mobile-menu { display: none !important; }
}

/* ============================================================
   5. REDUCED MOTION
============================================================ */
@media (prefers-reduced-motion: reduce) {
  .app-splash-logo,
  .app-splash-wordmark,
  .app-splash-bar,
  .app-splash::before {
    animation-duration: 0.01ms !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .app-splash-bar::after { animation-duration: 0.3s !important; }
  .page-enter { animation-duration: 0.01ms !important; }
}
