/* =========================================================
   MOBILE ONLY CSS (paste as assets/css/mobile.css)
   Keeps mobile UI hidden on desktop, enables it on phones,
   fixes full-bleed feed and a scrollable editor drawer.
   ========================================================= */

/* Vars used by the mobile nav */
:root{
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* --- Base components (defined once) --- */

/* Bottom tab bar */
.pp-tabbar{
  position: fixed; left:0; right:0; bottom:0; z-index:1200;
  height:var(--tabbar-h);
  padding-bottom:var(--safe-b);
  background:#fff;
  border-top:2px solid var(--pp-black);
  display:grid; grid-template-columns:1fr 1fr auto 1fr 1fr; align-items:center;
}
.pp-tab{ appearance:none; background:none; border:0; height:100%; font:inherit; color:#555; }
.pp-tab[aria-current="page"]{ color:var(--pp-black); font-weight:700; }
.pp-compose{
  appearance:none; border:2px solid var(--pp-black); width:56px; height:56px; border-radius:50%;
  background: var(--pp-red); color:#fff; font-size:28px; line-height:0; transform:translateY(-12px);
  box-shadow:0 8px 18px rgba(0,0,0,.18);
}

/* Scrim (overlay) */
.pp-scrim{
  position:fixed; inset:0;
  background:rgba(0,0,0,.35); backdrop-filter:blur(2px);
  z-index:1190; opacity:0; pointer-events:none; transition:opacity .2s ease;
}
.pp-scrim.show{ opacity:1; pointer-events:auto; }

/* Slide-out header (inside #editorPanel) */
.pp-slideout-head{
  align-items:center; justify-content:space-between;
  position:sticky; top:0; background:#fff; padding:12px 14px;
  border-bottom:2px solid var(--pp-black); z-index:5;
}
.pp-slideout-head .pp-close{
  all: unset;
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px; font-size:22px; line-height:1;
  color:var(--pp-black); cursor:pointer;
}
.pp-slideout-head .pp-close:focus-visible{
  outline:2px solid var(--pp-blue); outline-offset:2px;
}

/* --- Default: HIDE mobile-only UI everywhere --- */
.pp-tabbar,
.pp-scrim,
.pp-slideout-head{ display:none !important; }

/* =========================================================
   PHONE-ONLY OVERRIDES
   ========================================================= */
@media (max-width:720px){

  /* Show mobile-only UI on phones */
  .pp-tabbar{ display:grid !important; }
  .pp-scrim{ display:block !important; }
  .pp-slideout-head{ display:flex !important; }

  /* Layout */
  header{ display:none !important; }
  main{
    display:block; margin-top:0; height:auto;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  }

  /* Full-bleed feed */
  #leftPanel{
    flex:none; width:100%; max-width:none;
    padding:0 !important; border:0 !important; border-radius:0 !important;
    background:transparent;
  }
  .post-card{ border:0; border-radius:0; margin:0 0 12px; background:#fff; box-shadow:none; }

  .post-card img,
.post-card video {
  width: 100%;
  height: auto;        /* no fixed crop */
  aspect-ratio: auto;  /* stop forcing 4:5 */
  object-fit: contain; /* show the whole image/video */
  display: block;
}

  .post-meta:empty, .post-caption:empty, .post-hashtags:empty{ display:none; }

  /* Slide-out editor (mobile) */
#editorPanel{
  position: fixed !important;
  inset: 0;
  width: min(640px, 100%);
  height: 100dvh;                     /* reliable mobile viewport */
  background: var(--pp-white);
  z-index: 2000;
  transform: translateX(100%);
  transition: transform .28s ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;                   /* panel itself doesn't scroll */
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--safe-b);
  border-left: 2px solid var(--pp-black);
}
#editorPanel.open{ transform: translateX(0); }

/* Sticky header (if you use it) */
.pp-slideout-head{
  position: sticky;
  top: 0;
  z-index: 5;
}

/* Make the content area the scroller */
#editorPanel .editor-fields{
  flex: 1 1 auto;
  min-height: 0;                      /* CRITICAL */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;                 /* optional comfort */
}


  /* === Calendar padding (mobile only) === */
  #calendarPanel,
  .calendar-view,
  .calendar-container,
  #calendarView {
    padding: 16px;
    box-sizing: border-box;
  }

.calendar-header {
  padding: 10px;
}

  /* Optional: give the grid a little breathing room too */
  .calendar-grid,
  .calendar-days {
    gap: 6px;
    padding: 0 10px;
  }
}

/* MOBILE: full-bleed stories inside the left panel */
@media (max-width: 720px){
  #leftPanel.stories-view{
    padding: 0;
    background: #000;
    position: relative;
  }

  /* Fill everything above the tab bar */
  #leftPanel.stories-view .swiper{
    width: 100%;
    height: calc(100dvh - var(--tabbar-h) - var(--safe-b)) !important;
    margin: 0;
    border: 0;
    border-radius: 0;
    aspect-ratio: auto !important;     /* cancel old ratio rule */
    max-height: none !important;
  }
  #leftPanel.stories-view .swiper-wrapper,
  #leftPanel.stories-view .swiper-slide{ height: 100%; }

  #leftPanel.stories-view .swiper-slide img,
  #leftPanel.stories-view .swiper-slide video{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Keep header/progress readable & inside safe area */
  #leftPanel.stories-view::before{
    content:"";
    position:absolute; left:0; right:0; top:0;
    height: 96px;
    background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
    z-index: 2; pointer-events:none;
  }
  #leftPanel.stories-view .story-header{
    position:absolute; left:10px; top: max(8px, env(safe-area-inset-top,0));
    z-index:3;
  }
  #leftPanel.stories-view .story-progress{
    position:absolute; left:0; right:0; top: env(safe-area-inset-top,0);
    z-index:3;
  }
}

