/* Momu Home demo — a web rebuild of the SwiftUI Home screen (HomeView · MomentRow · MomentStack · MomuTabBar).
   All sizes inside .mh-screen are iOS points on a 393 × 852 screen; the whole screen is scaled with --mh-scale. */

@font-face {
  font-family: "Momu Mona Sans";
  src: url("assets/fonts/MonaSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Momu Mona Sans";
  src: url("assets/fonts/MonaSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

.mh-demo {
  --mh-w: clamp(262px, 78vw, 320px);   /* displayed screen width */
  --mh-scale: 0.8142;                  /* JS sets width / 393 */
  --mh-bezel: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

/* ---------- phone frame ---------- */
.mh-phone {
  width: calc(var(--mh-w) + 2 * var(--mh-bezel));
  padding: var(--mh-bezel);
  border-radius: calc(55px * var(--mh-scale) + var(--mh-bezel));
  background: #1b1b1b;
  box-shadow: 0 0 0 1.5px #3a3a3a inset, 0 22px 50px rgba(0, 0, 0, .14);
}
.mh-viewport {
  width: var(--mh-w);
  height: calc(852px * var(--mh-scale));
  overflow: hidden;
  border-radius: calc(55px * var(--mh-scale));
  position: relative;
  background: #f8f8f8;
  /* keep page text styles out */
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- the 393 × 852 pt screen ---------- */
.mh-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 393px;
  height: 852px;
  transform: scale(var(--mh-scale));
  transform-origin: 0 0;
  background: #f8f8f8;                      /* AppColors.background */
  color: #0f0f0f;                           /* AppColors.neutral900 */
  font-family: "Momu Mona Sans", "Mona Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.gallery .mh-screen img {           /* neutralise the page's .gallery img rule */
  width: auto;
  max-height: none;
  display: block;
}

/* status bar + island (approximation of iOS chrome; not part of the app UI) */
.mh-status {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 54px;
  z-index: 30;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
.mh-status-time {
  position: absolute;
  top: 18px; left: 52px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: #000;
}
.mh-status-icons {
  position: absolute;
  top: 21px; right: 30px;
  display: flex;
  gap: 6px;
  align-items: center;
  color: #000;
}
.mh-island {
  position: absolute;
  top: 11px; left: 50%;
  width: 126px; height: 37px;
  margin-left: -63px;
  border-radius: 20px;
  background: #000;
  z-index: 31;
  pointer-events: none;
}
.mh-home-indicator {
  position: absolute;
  bottom: 8px; left: 50%;
  width: 134px; height: 5px;
  margin-left: -67px;
  border-radius: 3px;
  background: #0f0f0f;
  z-index: 31;
  pointer-events: none;
}

/* ---------- feed (vertical ScrollView) ---------- */
.mh-feed {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;                    /* showsIndicators: false */
  padding-top: 59px;                        /* top safe area */
  outline: none;
  touch-action: pan-x pan-y;
}
.mh-feed::-webkit-scrollbar { display: none; }
.mh-feed:focus-visible { box-shadow: inset 0 0 0 3px rgba(138, 188, 197, .9); }

.mh-feed-content {
  padding-bottom: 134px;                    /* .padding(.bottom, 40) + tab bar 60 + bottom safe area 34 */
}

/* ---------- HomeHeader ---------- */
.mh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 24px 0;                     /* expandedTop 28 · horizontal 24 */
  margin-bottom: 34px;                      /* .padding(.bottom, 34) */
}
/* frame 159 × 36 with scaledToFit (the artwork is wider than 159:36, so it is 159 wide and centred vertically) */
.gallery .mh-screen img.mh-logo { width: 159px; height: 36px; object-fit: contain; object-position: left center; }
.mh-inbox {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  color: #0f0f0f;
}
.mh-inbox svg { width: 24px; height: 24px; display: block; }

/* compact sticky header (overlay, outside the scroll content) */
.mh-compact {
  position: absolute;
  top: 59px; left: 0; right: 0;
  height: 44px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .22s ease-out, transform .22s ease-out;
  pointer-events: none;
}
.mh-compact::before {                       /* header background up through the status bar */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -59px; bottom: 0;
  background: #f8f8f8;
  z-index: -1;
}
.mh-compact::after {                        /* 28 pt fade below, same colour 100% → 0% */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -28px;
  height: 28px;
  background: linear-gradient(#f8f8f8, rgba(248, 248, 248, 0));
}
.gallery .mh-screen .mh-compact img.mh-logo { width: calc(159px * .78); height: calc(36px * .78); }
.mh-demo.is-compact .mh-compact { opacity: 1; transform: none; }

/* ---------- rows (MomentRow) ---------- */
.mh-rows { display: flex; flex-direction: column; gap: 18px; }   /* rowSpacing 18 (incl. my row → first friend) */
.mh-row { display: flex; flex-direction: column; gap: 10px; }
.mh-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 38px;
}
.mh-avatar,
.gallery .mh-screen img.mh-avatar {         /* profile photo (MockAvatarAssets), 4:3 source cropped to a circle */
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  flex: none;
}
.mh-meta { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.mh-name { font-size: 16px; font-weight: 500; letter-spacing: 0; }
.mh-time { font-size: 12px; font-weight: 400; color: rgba(15, 15, 15, .62); }

/* ---------- photo strip (MomentStack, Home: native horizontal scroll + view-aligned snapping) ---------- */
.mh-strip {
  height: 180px;                            /* 160 + 10 + 10 so rotated corners / shadows are not clipped */
  margin: -10px 0;
  padding: 10px 0;
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  /* resting on photo boundaries is done in JS (CSS mandatory snapping re-snaps to its previous target and fights
     the "other strips go back to the first photo" rule) */
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  cursor: grab;
}
.mh-strip::-webkit-scrollbar { display: none; }
.mh-strip.is-dragging { cursor: grabbing; }
.mh-strip::before, .mh-strip::after {       /* contentMargins(.horizontal, 24) */
  content: "";
  flex: 0 0 24px;
}
.mh-slot {                                  /* untransformed layout box (exact 106-pt boundaries) */
  position: relative;
  flex: 0 0 140px;
  width: 140px; height: 140px;
}
.mh-slot + .mh-slot { margin-left: -34px; }/* step 106 → 34 pt overlap */
.mh-card {
  width: 140px; height: 140px;
  border-radius: 8px;                       /* AppRadius.medium */
  overflow: hidden;
  background: #ebebe9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);/* AppShadow.subtleColor, radius 6, y 2 */
  transform: translateY(var(--y)) rotate(var(--r));
  position: relative;
}
.mh-card img {
  width: 140px !important; height: 140px;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}
.mh-more {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at center, rgba(0, 0, 0, .16), transparent 70px), rgba(0, 0, 0, .28);
  color: #fcfcfc;
  font-size: 12px; font-weight: 500;
  text-shadow: 0 .5px 2px rgba(0, 0, 0, .25);
}

/* ---------- tab bar (MomuTabBar) ---------- */
.mh-tabbar {
  position: absolute;
  left: 20px; right: 20px;                  /* screenMargin 20 */
  bottom: 34px;                             /* on top of the bottom safe area */
  height: 60px;
  border-radius: 28px;
  z-index: 25;
  display: flex;
  padding: 0 15px;                          /* innerPadding 15 */
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .9), inset 0 0 0 .5px rgba(255, 255, 255, .45), 0 4px 28px rgba(0, 0, 0, .05);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mh-tabbar { background: rgba(250, 250, 250, .94); }
}
.mh-tab {
  flex: 1 1 0;
  display: grid;
  place-items: center;
  position: relative;
  color: #999999;                           /* unselectedIcon */
  border: 0; background: none; padding: 0; margin: 0;
  font: inherit;
}
.mh-tab svg { width: 24px; height: 24px; display: block; position: relative; z-index: 1; }
.mh-tab.is-selected { color: #5f5f5d; }    /* selectedIcon */
.mh-tab.is-selected::before {               /* selection bubble 38 */
  content: "";
  position: absolute;
  width: 38px; height: 38px;
  left: 50%; top: 50%;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  background: linear-gradient(rgba(255, 255, 255, .79), rgba(255, 255, 255, .58));
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .9), 0 1px 5px rgba(0, 0, 0, .035);
}
button.mh-tab { cursor: pointer; }
button.mh-tab:focus-visible { outline: 2px solid #8abcc5; outline-offset: -6px; border-radius: 20px; }

.mh-plate {                                 /* MomuCameraPlate 32 */
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #fcfcfc;
  box-shadow: inset 0 0 0 .33px #e3e3e0, 0 1px 4px rgba(15, 15, 15, .05);
  display: grid; place-items: center;
  position: relative;
}
.mh-plate::before {                         /* concave centre 17 */
  content: "";
  position: absolute;
  width: 17px; height: 17px;
  left: 7.5px; top: 7.5px;
  border-radius: 50%;
  background: #fcfcfc;
  box-shadow: inset 0 .75px 3px rgba(15, 15, 15, .07), inset 0 -.5px 1px rgba(255, 255, 255, .6), inset 0 0 0 .33px rgba(227, 227, 224, .7);
}
.mh-plate svg { width: 11px; height: 11px; position: relative; color: #9c9c9c; }

@media (max-width: 600px) {
  .mh-demo { --mh-bezel: 9px; }
}

/* ---------- preview crop: show the top ~75% of the phone (frame and screen keep their real size) ---------- */
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
.mh-crop {
  --mh-phone-h: calc(852px * var(--mh-scale) + 2 * var(--mh-bezel));
  width: calc(var(--mh-w) + 2 * var(--mh-bezel) + 128px);   /* wider than phone + shadow, so the shadow is never cut at the sides */
  flex: none;                                                /* may extend past the narrow gallery column (centred; page overflow is clipped) */
  height: calc(var(--mh-phone-h) * 0.75 + 30px);
  padding-top: 30px;           /* room for the shadow above the frame (offset by the negative margin below) */
  margin-top: -24px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;   /* never stretch/shrink the phone: it keeps its full height and is only clipped */
  /* soften the cut so no hard black edge of the frame is visible: fade the last 56px into the page background */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
}
.mh-crop .mh-phone { flex: none; }

/* ---------- fade-up for the content below the preview ---------- */
.mh-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms cubic-bezier(.22, .61, .36, 1), transform 600ms cubic-bezier(.22, .61, .36, 1);
  will-change: opacity, transform;
}
.mh-reveal.mh-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .mh-reveal { opacity: 1; transform: none; transition: none; }
}
