/* Scope intentionally limited to: global light-theme background + bottom navigation spacing. */
html:not([data-theme="dark"]){
  --app-background:#e9e4de;
  background:var(--app-background) !important;
  min-height:100%;
}

html:not([data-theme="dark"]) body{
  min-height:100dvh;
  background:
    radial-gradient(circle at 70% 20%,rgba(255,107,26,.22),transparent 28rem),
    var(--app-background) !important;
}

html:not([data-theme="dark"]) body:before{
  content:none !important;
  background:none !important;
}

html:not([data-theme="dark"]) #root,
html:not([data-theme="dark"]) .app-shell,
html:not([data-theme="dark"]) .page{
  background:transparent !important;
}

html:not([data-theme="dark"]) #root,
html:not([data-theme="dark"]) .app-shell{
  min-height:100dvh;
}

/* After unlock, the wrapper must not cover the global light background. */
html:not([data-theme="dark"]) .unlock-stage.is-ready,
html:not([data-theme="dark"]) .unlock-stage.is-ready .unlock-home-layer{
  background:transparent !important;
}

/* Important: once unlock is finished, do not let the animated wrapper become
   the containing block for position:fixed descendants on mobile Safari. */
.unlock-stage.is-ready .unlock-home-layer{
  will-change:auto !important;
  transform:none !important;
  filter:none !important;
}

/* Layer order:
   normal content < bottom navigation < orange + button < transient menus/modals.
   This keeps the nav always visible, while every popup can fully cover it. */
.bottom-nav{
  position:fixed !important;
  left:50% !important;
  bottom:max(12px,env(safe-area-inset-bottom)) !important;
  transform:translateX(-50%) !important;
  z-index:900 !important;
}

.quick{
  position:fixed !important;
  z-index:1100 !important;
}

.sheet-backdrop{
  z-index:2000 !important;
}

.sheet-backdrop .sheet,
.sheet-backdrop .modal,
.sheet-backdrop .quick-sheet{
  position:relative;
  z-index:2001 !important;
}

.app-shell{
  padding-bottom:calc(120px + env(safe-area-inset-bottom)) !important;
}

.page{
  padding-bottom:calc(118px + env(safe-area-inset-bottom)) !important;
}

/* Revenue privacy: the summary in Clienti is concealed by default and can be
   revealed with the small eye control. The preference is stored locally. */
.revenue-link-card{
  position:relative;
}
.revenue-privacy-toggle{
  position:absolute;
  top:14px;
  right:14px;
  z-index:4;
  min-height:34px;
  padding:7px 10px;
  border:1px solid rgba(24,21,18,.10);
  border-radius:999px;
  background:rgba(255,255,255,.72);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  box-shadow:0 8px 22px rgba(31,24,17,.08);
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--text,#181512);
  font-size:.72rem;
  font-weight:800;
  line-height:1;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.revenue-privacy-toggle:focus-visible{
  outline:2px solid rgba(185,82,32,.45);
  outline-offset:2px;
}
html:not(.revenue-visible) .revenue-link-card h2{
  font-size:0 !important;
  letter-spacing:0 !important;
  min-height:1.2em;
}
html:not(.revenue-visible) .revenue-link-card h2::after{
  content:'€ ••••';
  display:inline-block;
  font-size:clamp(1.65rem,4vw,2.35rem);
  letter-spacing:-.04em;
}

/* PIN unlock: compositor-friendly transition. Avoid animating blur/width to reduce jank on mobile. */
.unlock-stage.is-unlocking .unlock-home-layer{
  backface-visibility:hidden;
  transform:translateZ(0);
  animation:mkHomeReveal .98s cubic-bezier(.2,.78,.18,1) both !important;
}
.unlock-cinematic{
  backface-visibility:hidden;
  transform:translateZ(0);
  filter:none !important;
  animation:mkUnlockOverlay .98s cubic-bezier(.2,.78,.18,1) forwards !important;
}
.unlock-glow{
  filter:blur(18px) !important;
  backface-visibility:hidden;
  animation:mkUnlockGlow .98s cubic-bezier(.2,.78,.18,1) forwards !important;
}
.cinematic-core{
  backface-visibility:hidden;
  animation:mkUnlockCore .98s cubic-bezier(.2,.78,.18,1) forwards !important;
}
.cinematic-logo{
  backface-visibility:hidden;
  animation:mkUnlockLogo .98s cubic-bezier(.2,.78,.18,1) forwards !important;
}
.cinematic-line{
  width:82vw !important;
  transform-origin:center;
  backface-visibility:hidden;
  animation:mkUnlockLine .98s cubic-bezier(.2,.78,.18,1) forwards !important;
}
.cinematic-orbit{
  backface-visibility:hidden;
  animation:mkUnlockOrbit .98s cubic-bezier(.2,.78,.18,1) forwards !important;
}
.unlock-stage.is-unlocking .home .top,
.unlock-stage.is-unlocking .home .hero,
.unlock-stage.is-unlocking .home .week-pulse,
.unlock-stage.is-unlocking .home .daily-note,
.unlock-stage.is-unlocking .home .bento{
  backface-visibility:hidden;
  animation:mkHomeStagger .62s cubic-bezier(.2,.78,.18,1) both !important;
}
.unlock-stage.is-unlocking .home .top{animation-delay:.14s !important}
.unlock-stage.is-unlocking .home .hero{animation-delay:.18s !important}
.unlock-stage.is-unlocking .home .week-pulse{animation-delay:.22s !important}
.unlock-stage.is-unlocking .home .daily-note{animation-delay:.26s !important}
.unlock-stage.is-unlocking .home .bento{animation-delay:.30s !important}

@keyframes mkHomeReveal{
  0%{opacity:.34;transform:translate3d(0,8px,0) scale(.992)}
  55%{opacity:.72;transform:translate3d(0,3px,0) scale(.997)}
  100%{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
@keyframes mkUnlockOverlay{
  0%{opacity:1;transform:translate3d(0,0,0) scale(1)}
  58%{opacity:.88;transform:translate3d(0,0,0) scale(1.004)}
  100%{opacity:0;transform:translate3d(0,0,0) scale(1.012)}
}
@keyframes mkUnlockGlow{
  0%{opacity:.14;transform:translate3d(-8vw,5vh,0) scale(.9)}
  52%{opacity:.46;transform:translate3d(2vw,0,0) scale(1.08)}
  100%{opacity:0;transform:translate3d(16vw,-4vh,0) scale(1.45)}
}
@keyframes mkUnlockCore{
  0%,34%{opacity:1;transform:translate3d(0,0,0) scale(1)}
  72%{opacity:.7;transform:translate3d(0,0,0) scale(.93)}
  100%{opacity:0;transform:translate3d(0,0,0) scale(.86)}
}
@keyframes mkUnlockLogo{
  0%,28%{opacity:1;transform:translate3d(0,0,0) scale(1)}
  66%{opacity:.84;transform:translate3d(0,0,0) scale(.72)}
  100%{opacity:0;transform:translate3d(0,0,0) scale(.42)}
}
@keyframes mkUnlockLine{
  0%,24%{opacity:0;transform:translate3d(0,0,0) scaleX(.04)}
  52%{opacity:.82;transform:translate3d(0,0,0) scaleX(.58)}
  100%{opacity:0;transform:translate3d(0,0,0) scaleX(1.18)}
}
@keyframes mkUnlockOrbit{
  0%{opacity:0;transform:translate3d(0,0,0) scale(.82)}
  38%{opacity:.62;transform:translate3d(0,0,0) scale(1)}
  100%{opacity:0;transform:translate3d(0,0,0) scale(3.2)}
}
@keyframes mkHomeStagger{
  0%{opacity:0;transform:translate3d(0,8px,0)}
  100%{opacity:1;transform:translate3d(0,0,0)}
}

@media(max-width:760px){
  .bottom-nav{
    position:fixed !important;
    left:50% !important;
    right:auto !important;
    bottom:max(8px,env(safe-area-inset-bottom)) !important;
    transform:translate3d(-50%,0,0) !important;
    width:calc(100% - 14px) !important;
    z-index:900 !important;
  }
  .quick{
    z-index:1100 !important;
  }
  .sheet-backdrop{
    z-index:2000 !important;
  }
  .revenue-privacy-toggle{
    top:11px;
    right:11px;
    min-height:32px;
    padding:6px 9px;
  }
  .unlock-glow{filter:blur(14px) !important}
}

@media(prefers-reduced-motion:reduce){
  .unlock-stage.is-unlocking .unlock-home-layer,
  .unlock-cinematic,
  .unlock-glow,
  .cinematic-core,
  .cinematic-logo,
  .cinematic-line,
  .cinematic-orbit,
  .unlock-stage.is-unlocking .home .top,
  .unlock-stage.is-unlocking .home .hero,
  .unlock-stage.is-unlocking .home .week-pulse,
  .unlock-stage.is-unlocking .home .daily-note,
  .unlock-stage.is-unlocking .home .bento{
    animation:none !important;
  }
  .unlock-cinematic{opacity:0 !important}
  .unlock-stage.is-unlocking .unlock-home-layer{opacity:1 !important;transform:none !important}
}
