/* =========================================================
   ap.css — Combined Pack (SAFE)
   Includes:
   A) Theme Loader (blur + progress)
   B) Gallery Effects Pack (REPEAT ON SCROLL)
   - No theme override (only motion/overlay UI)
   - Keyframes prefixed ap_
   ========================================================= */

:root{
  --ap-ease: cubic-bezier(.2,.9,.2,1);
  --ap-ease2: cubic-bezier(.16,1,.3,1);

  --ap-in: 620ms;
  --ap-out: 220ms;

  --ap-fast: 160ms;
  --ap-mid: 260ms;

  --ap-shadow: 0 18px 60px rgba(0,0,0,.35);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .postCard, .sheetCard, .calPanel,
  .pgrid, .ptile, .ptile img,
  .pill, .chip, .sBtn, .xBtn, .calBtn,
  .nav, .gDrawer, .gBack,
  .sheet, .overlay, .calSheet, .calSheetOverlay,
  #apFab, .ap-ripple,
  .ap-mask, .ap-card, .ap-back, .ap-fill{
    animation:none !important;
    transition:none !important;
    transform:none !important;
    filter:none !important;
    opacity:1 !important;
  }
}

/* =========================================================
   A) THEME LOADER (blur + progress)  [auto injected by ap.js]
========================================================= */
.ap-mask{
  position:fixed;
  inset:0;
  z-index:2147483000;
  display:none;
  pointer-events:none;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.ap-mask.ap-show{
  display:block;
  pointer-events:auto;
}
.ap-back{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity:0;
  transition: opacity .18s var(--ap-ease);
}
.ap-mask.ap-show .ap-back{ opacity:1; }

.ap-card{
  position:absolute;
  left:50%;
  top:18%;
  transform: translate(-50%, -8px) scale(.98);
  width: min(520px, 92vw);
  border-radius: 22px;
  padding: 14px 14px 12px;
  opacity:0;
  transition: opacity .18s var(--ap-ease), transform .18s var(--ap-ease);
  box-shadow: 0 28px 90px rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(15,23,42,.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color:#e5e7eb;
}
.ap-mask.ap-show .ap-card{
  opacity:1;
  transform: translate(-50%, 0) scale(1);
}
.ap-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.ap-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  font-size:14px;
  letter-spacing:.2px;
}
.ap-title i{
  width:30px;height:30px;
  display:grid;place-items:center;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
}
.ap-pill{
  font-size:12px;
  font-weight:900;
  padding:6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  opacity:.9;
}
.ap-bar{
  position:relative;
  height: 10px;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
}
.ap-fill{
  position:absolute;
  inset:0;
  width:0%;
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(59,130,246,.95),
    rgba(34,211,238,.95),
    rgba(251,191,36,.95)
  );
  box-shadow: 0 6px 20px rgba(59,130,246,.28);
  transition: width .65s var(--ap-ease);
}
.ap-hint{
  margin-top:10px;
  font-size:12px;
  line-height:1.35;
  color: rgba(229,231,235,.82);
}
html[data-theme="light"] .ap-card{
  background: rgba(255,255,255,.78);
  color: #0b1020;
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 28px 90px rgba(15,23,42,.18);
}
html[data-theme="light"] .ap-title i,
html[data-theme="light"] .ap-pill,
html[data-theme="light"] .ap-bar{
  background: rgba(15,23,42,.06);
  border: 1px solid rgba(15,23,42,.10);
}
html[data-theme="light"] .ap-hint{ color: rgba(11,16,32,.70); }
html[data-theme="light"] .ap-back{ background: rgba(255,255,255,.28); }

/* =========================================================
   B) GALLERY EFFECTS PACK (REPEAT ON SCROLL)
========================================================= */

/* 1) REVEAL: default hidden (when NOT .ap-in) */
.postCard,
.sheetCard,
.calPanel{
  opacity: 0;
  transform: translateY(14px) scale(.988);
  filter: blur(10px);
  transition:
    opacity var(--ap-out) var(--ap-ease),
    transform var(--ap-out) var(--ap-ease),
    filter var(--ap-out) var(--ap-ease);
  will-change: transform, opacity, filter;
  transform-origin: 50% 30%;
}

/* visible */
.postCard.ap-in,
.sheetCard.ap-in,
.calPanel.ap-in{
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition-duration: var(--ap-in);
}

/* pop */
.postCard.ap-in{ box-shadow: var(--ap-shadow); }

/* 2) NAV show/hide on scroll */
.nav{
  will-change: transform, opacity, filter;
  transition:
    transform var(--ap-mid) var(--ap-ease),
    opacity var(--ap-mid) var(--ap-ease),
    filter var(--ap-mid) var(--ap-ease);
}
.nav.ap-hide{
  transform: translateY(-14px);
  opacity: 0;
  pointer-events:none;
  filter: blur(6px);
}
.nav.ap-show{
  transform: translateY(0);
  opacity: 1;
  pointer-events:auto;
  filter: blur(0);
}

/* 3) BUTTON micro interactions */
.pill, .chip, .sBtn, .xBtn, .calBtn, .gRow{
  transition:
    transform var(--ap-fast) var(--ap-ease),
    filter var(--ap-fast) var(--ap-ease),
    box-shadow var(--ap-fast) var(--ap-ease);
  will-change: transform;
}
.pill:active, .chip:active, .sBtn:active, .xBtn:active, .calBtn:active, .gRow:active{
  transform: translateY(1px) scale(.99);
  filter: brightness(1.05);
}
@media (hover:hover){
  .pill:hover, .chip:hover, .sBtn:hover, .gRow:hover{ filter: brightness(1.06); }
}

/* Ripple (JS injects span.ap-ripple) */
.ap-rippleHost{ position:relative; overflow:hidden; }
.ap-ripple{
  position:absolute;
  border-radius:999px;
  transform: translate(-50%,-50%) scale(.3);
  opacity:0;
  pointer-events:none;
  width:18px;height:18px;
  background: radial-gradient(circle, rgba(255,255,255,.55), rgba(255,255,255,0) 70%);
  animation: ap_ripple 520ms var(--ap-ease) forwards;
  mix-blend-mode: screen;
}
@keyframes ap_ripple{
  0%{ opacity:.85; transform: translate(-50%,-50%) scale(.3); }
  70%{ opacity:.25; }
  100%{ opacity:0; transform: translate(-50%,-50%) scale(9); }
}

/* 4) PHOTOS tiles + zoom */
.pgrid{ transform-origin: 50% 40%; }
.pgrid .ptile{
  transform: translateY(6px) scale(.99);
  opacity: 0;
  transition: transform var(--ap-mid) var(--ap-ease), opacity var(--ap-mid) var(--ap-ease);
}
.postCard.ap-in .pgrid .ptile{
  opacity: 1;
  transform: translateY(0) scale(1);
}
.postCard.ap-in .pgrid .ptile:nth-child(1){ transition-delay: 40ms; }
.postCard.ap-in .pgrid .ptile:nth-child(2){ transition-delay: 90ms; }
.postCard.ap-in .pgrid .ptile:nth-child(3){ transition-delay: 140ms; }
.postCard.ap-in .pgrid .ptile:nth-child(4){ transition-delay: 190ms; }

.ptile img{
  transform: scale(1.02);
  transition: transform 640ms var(--ap-ease), filter var(--ap-fast) var(--ap-ease);
  will-change: transform;
}
@media (hover:hover){
  .ptile:hover img{ transform: scale(1.06); filter: brightness(1.05); }
}

/* “More photos” overlay pulse */
.moreOverlay{ animation: ap_morePulse 1.45s ease-in-out infinite; }
@keyframes ap_morePulse{
  0%,100%{ transform: scale(1); }
  50%{ transform: scale(1.02); }
}

/* 5) DRAWER polish (gDrawer/gBack) */
.gBack{
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.gBack.show{ animation: ap_fadeIn 180ms var(--ap-ease) both; }
@keyframes ap_fadeIn{ from{opacity:0} to{opacity:1} }

.gDrawer{
  transition: transform 240ms var(--ap-ease2);
}
.gDrawer.show{
  animation: ap_drawerIn 260ms var(--ap-ease2) both;
}
@keyframes ap_drawerIn{
  0%{ transform: translateX(110%); }
  100%{ transform: translateX(0); }
}

/* drawer row stagger */
.gDrawer.show .gRow{ animation: ap_rowIn 360ms var(--ap-ease2) both; }
.gDrawer.show .gRow:nth-child(1){ animation-delay: 40ms; }
.gDrawer.show .gRow:nth-child(2){ animation-delay: 70ms; }
.gDrawer.show .gRow:nth-child(3){ animation-delay: 100ms; }
.gDrawer.show .gRow:nth-child(4){ animation-delay: 130ms; }
.gDrawer.show .gRow:nth-child(5){ animation-delay: 160ms; }
.gDrawer.show .gRow:nth-child(6){ animation-delay: 190ms; }
.gDrawer.show .gRow:nth-child(7){ animation-delay: 220ms; }
@keyframes ap_rowIn{
  from{ opacity:0; transform: translateX(8px); }
  to{ opacity:1; transform: translateX(0); }
}

/* 6) BACK TO TOP FAB */
#apFab{
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 999999;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  pointer-events: none;
  transition: opacity var(--ap-mid) var(--ap-ease), transform var(--ap-mid) var(--ap-ease);
  will-change: transform, opacity;
}
#apFab.ap-show{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#apFab button{
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,14,28,.78);
  color: #fff;
  box-shadow: var(--ap-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  cursor: pointer;
}
[data-theme="light"] #apFab button{
  background: rgba(255,255,255,.78);
  color: #0b1020;
  border-color: rgba(15,23,42,.10);
  box-shadow: 0 18px 60px rgba(15,23,42,.18);
}
#apFab button:active{ transform: translateY(1px) scale(.99); } 