/* ============================================================
   BuonaLabs · Mobile App Showcase — phone-centric device shell
   Shared frame. Each app supplies its own theme + screens.
   ============================================================ */

:root {
  /* theme defaults — overridden per app in app.css */
  --bg-0: #0e0f13;
  --bg-1: #16181f;
  --glow: rgba(120, 140, 255, 0.30);
  --glow-2: rgba(120, 140, 255, 0.18);
  --accent: #6c7cff;
  --accent-2: #4453d6;
  --on-accent: #ffffff;
  --app-bg: #ffffff;
  --app-bg-2: #f4f5f8;
  --ink: #12131a;
  --muted: #8b8f9c;
  --line: rgba(18, 19, 26, 0.08);
  --card: #ffffff;
  --status-dark: 0; /* 1 => white status text */

  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --shadow-lg: 0 50px 120px -40px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Stage (immersive backdrop) ---------- */
.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 720px at 50% -10%, var(--glow), transparent 62%),
    radial-gradient(900px 600px at 12% 108%, var(--glow-2), transparent 60%),
    linear-gradient(165deg, var(--bg-1), var(--bg-0));
}
.stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.04; mix-blend-mode: overlay; pointer-events: none;
}
.watermark {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(160px, 34vw, 620px);
  line-height: 0.8; letter-spacing: -0.05em;
  color: rgba(255, 255, 255, 0.028);
  pointer-events: none; user-select: none; z-index: 0;
  white-space: nowrap;
}

/* ---------- Top bar (kept minimal) ---------- */
.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(18px, 4vw, 44px);
}
.brandmark { display: flex; align-items: center; gap: 11px; color: #fff; }
.brandmark .dot {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  box-shadow: 0 8px 20px -8px var(--accent);
  font-weight: 800; font-size: 15px; color: var(--on-accent);
}
.brandmark b { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.brandmark small {
  display: block; font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: rgba(255,255,255,0.5); font-weight: 600;
}
.lab-link {
  color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; transition: 0.25s;
}
.lab-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.lab-link svg { width: 14px; height: 14px; }

/* ---------- Device area (the hero) ---------- */
.device-area {
  position: relative; z-index: 2;
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  padding: 6px 16px 30px;
}
.phone {
  position: relative;
  height: min(824px, 82vh);
  aspect-ratio: 390 / 844;
  border-radius: 52px;
  background: linear-gradient(160deg, #2b2c31, #0a0a0c);
  padding: 12px;
  box-shadow: var(--shadow-lg), inset 0 0 0 2px rgba(255,255,255,0.06);
  animation: rise 0.7s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.phone .btn-side, .phone .btn-vol { position: absolute; background: #171719; border-radius: 3px; }
.phone .btn-side { right: -3px; top: 170px; width: 3px; height: 84px; }
.phone .btn-vol { left: -3px; top: 132px; width: 3px; height: 48px; box-shadow: 0 66px 0 #171719, 0 126px 0 #171719; }

.screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 42px; overflow: hidden;
  background: var(--app-bg);
  color: var(--ink);
  display: flex; flex-direction: column;
}
.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 112px; height: 31px; background: #050506; border-radius: 18px; z-index: 60;
}

/* Embed mode: render only the app screen, full-bleed (for previews) */
.embed-stage { position: fixed; inset: 0; background: var(--app-bg); }
.embed-stage .screen { width: 100%; height: 100%; border-radius: 0; }
#root.embed .island { display: none; }

/* status bar */
.statusbar {
  height: 50px; flex: 0 0 auto;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 26px 6px; font-size: 13px; font-weight: 600; z-index: 40;
  color: var(--ink);
}
.statusbar.dark { color: #fff; }
.statusbar .glyphs { display: flex; align-items: center; gap: 6px; }

/* scroll region */
.app-scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.app-scroll::-webkit-scrollbar { display: none; }

.view { display: none; animation: viewIn 0.4s cubic-bezier(.2,.8,.2,1); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* ---------- Tab bar ---------- */
.tabbar {
  flex: 0 0 auto;
  display: flex; justify-content: space-around; align-items: center;
  padding: 9px 10px 24px;
  background: color-mix(in srgb, var(--app-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  position: relative; z-index: 45;
}
.tab {
  border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); font-size: 10px; font-weight: 600;
  padding: 4px 10px; border-radius: 12px; position: relative;
  transition: color 0.2s;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--accent); }
.tab .badge {
  position: absolute; top: -3px; right: 3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; border-radius: 999px;
  display: grid; place-items: center; border: 1.5px solid var(--app-bg);
  transform: scale(0); transition: transform 0.3s cubic-bezier(.3,1.5,.5,1);
}
.tab .badge.show { transform: scale(1); }

/* center FAB-style tab (optional, .tab.fab) */
.tab.fab {
  color: var(--on-accent);
}
.tab.fab .fab-ring {
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; margin-top: -22px;
  box-shadow: 0 12px 26px -8px var(--accent); color: var(--on-accent);
}
.tab.fab .fab-ring svg { width: 26px; height: 26px; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 70;
  background: rgba(8, 8, 12, 0.5); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.35s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 71;
  background: var(--app-bg);
  border-radius: 28px 28px 42px 42px;
  transform: translateY(103%);
  transition: transform 0.42s cubic-bezier(.2,.85,.25,1);
  max-height: 92%; display: flex; flex-direction: column;
}
.sheet.open { transform: none; }
.sheet .grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(0,0,0,0.15); margin: 11px auto 4px; }
.sheet-scroll { overflow-y: auto; scrollbar-width: none; padding: 6px 22px 8px; }
.sheet-scroll::-webkit-scrollbar { display: none; }
.sheet-foot { padding: 12px 22px 24px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }

/* ---------- Buttons / chips ---------- */
.btn-primary {
  flex: 1; border: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 14.5px; padding: 15px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform 0.15s, filter 0.2s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  border: 1px solid var(--line); background: var(--app-bg-2); color: var(--ink);
  border-radius: 14px; padding: 13px 16px; font-weight: 600; font-size: 14px; cursor: pointer;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 92px; transform: translate(-50%, 18px);
  background: var(--ink); color: var(--app-bg);
  padding: 12px 18px; border-radius: 14px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 9px; z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,0.6); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Success overlay ---------- */
.success {
  position: absolute; inset: 0; z-index: 90;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-0));
  color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 40px;
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
.success.open { opacity: 1; pointer-events: auto; }
.success .ring {
  width: 94px; height: 94px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 44px; margin-bottom: 22px;
  color: var(--on-accent);
  box-shadow: 0 20px 50px -14px var(--accent); animation: pop 0.5s cubic-bezier(.3,1.5,.5,1);
}
@keyframes pop { from { transform: scale(0); } to { transform: none; } }
.success h2 { font-family: var(--font-display); font-size: 27px; font-weight: 600; margin-bottom: 9px; }
.success p { font-size: 13.5px; color: rgba(255,255,255,0.72); line-height: 1.6; max-width: 250px; margin-bottom: 22px; }
.success button { border: 1px solid rgba(255,255,255,0.25); background: transparent; color: #fff; padding: 12px 24px; border-radius: 14px; font-weight: 600; font-size: 14px; cursor: pointer; }

/* ---------- Caption under phone ---------- */
.caption { position: relative; z-index: 2; text-align: center; max-width: 560px; padding: 0 16px; }
.caption .row1 { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.caption h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -0.01em; color: #fff; }
.caption .tag { font-size: 12px; color: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.16); padding: 5px 11px; border-radius: 999px; }
.caption p { font-size: 13.5px; line-height: 1.55; color: rgba(255,255,255,0.62); margin: 10px auto 0; max-width: 460px; }
.caption .tech { display: inline-flex; gap: 7px; margin-top: 13px; flex-wrap: wrap; justify-content: center; }
.caption .tech span { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; padding: 5px 10px; border-radius: 8px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.72); }

.footer { position: relative; z-index: 2; text-align: center; padding: 18px; font-size: 12px; color: rgba(255,255,255,0.34); }
.footer a { color: rgba(255,255,255,0.55); text-decoration: none; }

/* ---------- Responsive: phone fills the screen ---------- */
@media (max-width: 560px) {
  .watermark { display: none; }
  .device-area { padding: 4px 0 20px; }
  .phone { height: auto; width: 100%; max-width: 430px; aspect-ratio: 390 / 844; border-radius: 44px; }
  .caption h1 { font-size: 22px; }
  .caption p { display: none; }
  .lab-link span { display: none; }
}
@media (max-height: 720px) and (min-width: 561px) {
  .phone { height: 88vh; }
  .caption p { display: none; }
}

/* generic helpers used across apps */
.reveal-up { animation: viewIn 0.5s cubic-bezier(.2,.8,.2,1); }

/* ============================================================
   In-app typography — clean native sans. Fraunces is reserved
   for the marketing caption OUTSIDE the phone only.
   ============================================================ */
.screen { --font-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
.screen h1, .screen h2, .screen h3, .screen h4 { letter-spacing: -0.022em; }
.screen h5 { letter-spacing: -0.012em; }
.screen, .sheet, .success, .toast { font-feature-settings: "cv11", "ss01"; }

/* ---------- Shared SVG icon rendering ----------
   Icons inherit sizing from their container's font-size (1em),
   matching where OS emoji used to sit, and use currentColor. */
.gi { width: 1em; height: 1em; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.gi * { vector-effect: non-scaling-stroke; }
