/* ── Onboarding flow — 6-screen swipe carousel ──────────────────
 * All classes prefixed ob- to avoid collisions with app styles.
 * Uses app CSS variables from variables.css where possible.
 * ──────────────────────────────────────────────────────────────── */

/* ── Layout: fill viewport when onboarding is active ── */
#app:has(.ob-screens) {
  position: fixed; inset: 0;
  background: var(--color-canvas, #FAFAF9);
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}

/* ── Top chrome (back + progress) ── */
.ob-chrome {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 20px 22px 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
}
.ob-back {
  width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: none;
  display: grid; place-items: center;
  cursor: pointer; color: var(--color-text-primary);
  transition: background .15s;
}
.ob-back:hover { background: rgba(0,0,0,.05); }
.ob-back.hidden { visibility: hidden; }
.ob-progress {
  flex: 1; height: 4px;
  background: rgba(0,0,0,.06);
  border-radius: 99px; overflow: hidden;
}
.ob-progress > div {
  height: 100%; background: var(--sage-500);
  border-radius: 99px;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
  width: 0%;
}

/* ── Screen carousel ── */
.ob-screens {
  position: absolute; inset: 0;
  display: flex;
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}
.ob-screen {
  flex: 0 0 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 72px 24px 24px;
  position: relative; overflow-y: auto;
}
.ob-screen.ob-no-chrome { padding-top: 24px; }

/* ── Skip button ── */
.ob-skip {
  position: absolute; top: 24px; right: 22px;
  background: transparent; border: none;
  font-size: 14px; color: var(--color-text-muted);
  cursor: pointer; font-family: var(--font-body);
  font-weight: 500; z-index: 11;
}
.ob-skip:hover { color: var(--color-text-primary); }

/* ── Typography ── */
h1.ob-title {
  font-family: var(--font-heading); font-weight: 600;
  font-size: 30px; line-height: 1.15;
  letter-spacing: -.01em; color: var(--color-text-primary);
  margin-bottom: 8px;
}
h1.ob-title.ob-lg { font-size: 34px; }
p.ob-sub {
  font-size: 15px; color: var(--color-text-secondary);
  line-height: 1.5; margin-bottom: 20px;
}

/* ── Spacer / Footer ── */
.ob-spacer { flex: 1; }
.ob-footer { padding-top: 14px; }

/* ── Buttons ── */
.ob-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 17px 22px;
  border: none; border-radius: 99px;
  font-family: var(--font-body); font-weight: 600; font-size: 16px;
  cursor: pointer;
  transition: transform .12s ease, opacity .15s, background .15s;
}
.ob-btn:active { transform: scale(.98); }
.ob-btn-primary { background: #1a1a1a; color: #fff; }
.ob-btn-primary:hover { background: #000; }
.ob-btn-primary[disabled] { opacity: .35; cursor: not-allowed; }
.ob-btn-secondary {
  background: #fff; color: var(--color-text-primary);
  border: 1px solid rgba(0,0,0,.08);
}
.ob-btn-text {
  background: transparent; color: var(--color-text-primary);
  font-weight: 500; font-size: 14.5px; padding: 14px;
}
.ob-btn-carrot { background: var(--carrot); color: #fff; }
.ob-btn-apple { background: #000; color: #fff; }
.ob-btn-google {
  background: #fff; color: var(--color-text-primary);
  border: 1px solid rgba(0,0,0,.12);
}

/* ── Welcome screen ── */
.ob-logo-row {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 36px; margin-bottom: 18px;
}
.ob-logo-img {
  height: 32px; width: auto; object-fit: contain; display: block; flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(110,148,96,.12));
}
.ob-logo-text {
  font-family: var(--font-heading); font-size: 19px;
  font-weight: 600; color: var(--color-text-primary);
  letter-spacing: -.005em;
}
.ob-welcome-hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; flex: 1; justify-content: flex-start;
  padding: 0 24px; overflow: hidden;
}
.ob-welcome-text {
  display: flex; flex-direction: column; align-items: center;
}
.ob-welcome-hero h1 {
  font-family: var(--font-heading); font-size: 30px; font-weight: 700;
  letter-spacing: -.015em; line-height: 1.15;
  color: var(--color-text-primary); margin-bottom: 10px;
}
.ob-welcome-hero .ob-tagline {
  font-size: 14.5px; color: var(--color-text-secondary);
  line-height: 1.5; max-width: 290px; margin-bottom: 0;
}

/* ── Phone mockup hero ── */
.ob-hero-phone-wrap {
  position: relative; width: 100%; flex: 1; min-height: 0;
  display: flex; justify-content: center; align-items: flex-start;
  overflow: hidden; margin-top: 22px; padding-top: 8px;
}
.ob-hero-phone-wrap::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--color-canvas) 0%, transparent 100%);
  z-index: 8; pointer-events: none;
}
.ob-hero-phone {
  position: relative; width: 260px; height: 520px; margin-top: 0;
  border-radius: 42px; overflow: hidden; flex-shrink: 0;
  border: none;
  box-shadow: 0 0 0 6px #1a1a1a;
  background: transparent;
}
.ob-hero-phone::before {
  content: ""; position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 72px; height: 20px; background: #000;
  border-radius: 20px; z-index: 10;
}

/* Status bar */
.ob-status-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 42px; z-index: 11;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 22px 0;
}
.ob-status-time {
  font-size: 12.5px; font-weight: 700; color: #fff;
  font-family: var(--font-body); letter-spacing: -.02em;
}
.ob-status-icons { display: flex; align-items: center; gap: 5px; }
.ob-status-icons svg { display: block; }

/* Photo background */
.ob-photo-bg {
  position: absolute; inset: 0;
  background: url('https://images.pexels.com/photos/3989046/pexels-photo-3989046.jpeg?auto=compress&cs=tinysrgb&w=600&h=1100&fit=crop') center/cover no-repeat;
}
.ob-photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.04) 25%, rgba(0,0,0,.04) 75%, rgba(0,0,0,.2) 100%);
}

/* ── Glassmorphism badges ── */
.ob-glass-badge {
  position: absolute; z-index: 5;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-radius: 14px; padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: 0 4px 20px -6px rgba(0,0,0,.2);
}
.ob-gb-title { font-size: 13.5px; font-weight: 700; color: #1a1a1a; line-height: 1.2; }
.ob-gb-sub {
  display: flex; align-items: center; gap: 5px; margin-top: 3px;
  font-size: 10.5px; font-weight: 600; line-height: 1;
}
.ob-gb-icon { font-size: 11px; flex-shrink: 0; }
.ob-gb-sub.ob-red { color: #DC2626; }
.ob-gb-sub.ob-amber { color: #B45309; }

/* Badge positions */
.ob-gb-1 { top: 50px; left: 10px; }
.ob-gb-2 { top: 155px; right: 8px; }
.ob-gb-3 { bottom: 170px; left: 8px; }
.ob-gb-4 { bottom: 95px; right: 10px; }

/* ── Problem screen ── */
.ob-problem-stat {
  margin-top: 24px; padding: 20px 22px; border-radius: 20px;
  background: #FEE2E2; border: 1px solid rgba(183,28,28,.15);
}
.ob-problem-stat .ob-num {
  font-family: var(--font-heading); font-size: 42px;
  font-weight: 600; color: #B71C1C; line-height: 1;
}
.ob-problem-stat .ob-lbl {
  margin-top: 6px; font-size: 13.5px; color: #5b1a1a; line-height: 1.4;
}

/* Product mock card */
.ob-product-mock {
  margin-top: 20px; background: #fff; border-radius: 20px; padding: 18px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 20px 40px -24px rgba(14,21,18,.16);
  border: 1px solid #ECEBE4; position: relative;
}
.ob-product-mock .ob-photo {
  height: 170px; border-radius: 14px; background: #FAF8F1;
  border: 1px solid #ECEBE4;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.ob-product-mock .ob-photo img {
  max-width: 72%; max-height: 82%; object-fit: contain; mix-blend-mode: multiply;
}
.ob-product-mock .ob-badge {
  position: absolute; background: #fff; border-radius: 999px;
  padding: 6px 11px; font-size: 11.5px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
  display: flex; align-items: center; gap: 6px; z-index: 2;
}
.ob-product-mock .ob-badge.ob-bad {
  color: #9A1A1A; top: 14px; left: 14px; background: #FEE2E2;
}
.ob-product-mock .ob-badge.ob-bad .ob-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #DC2626;
}
.ob-product-mock .ob-badge.ob-warn {
  color: #8A5A00; top: 54px; right: 14px; background: #FEF3C7;
}
.ob-product-mock .ob-badge.ob-warn .ob-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #D97706;
}
.ob-product-mock .ob-score-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; padding: 3px 9px;
  border-radius: 999px; background: #FEE2E2; color: #9A1A1A;
  letter-spacing: .04em; text-transform: uppercase;
}
.ob-product-mock .ob-score-pill .ob-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #DC2626;
}
.ob-product-mock .ob-name {
  margin-top: 14px; font-size: 16px; font-weight: 700;
  color: #0F1512; letter-spacing: -.01em; line-height: 1.25;
}
.ob-product-mock .ob-marketed {
  font-size: 12.5px; color: #6B7570; margin-top: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ob-product-mock .ob-marketed b { color: #3A403C; font-weight: 600; }

/* ── Solution screen — reuses pd2 classes from product.css ── */
/* (pd2 classes are already loaded via product.css) */

/* ── Categories screen ── */
.ob-cat-grid {
  display: grid; grid-template-columns: repeat(2,1fr);
  gap: 12px; margin-top: 8px;
}
.ob-cat-tile {
  background: #fff; border: 2px solid transparent; border-radius: 18px;
  padding: 18px 14px; cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center; position: relative;
}
.ob-cat-tile:hover { border-color: var(--sage-200); }
.ob-cat-tile.selected { border-color: var(--sage-500); background: var(--sage-50); }
.ob-emoji { font-size: 30px; line-height: 1; }
.ob-cat-lbl { font-size: 13.5px; font-weight: 600; color: var(--color-text-primary); }
.ob-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.15);
  position: absolute; top: 10px; right: 10px;
  display: grid; place-items: center; background: #fff;
}
.ob-cat-tile.selected .ob-check {
  background: var(--sage-500); border-color: var(--sage-500); color: #fff;
}
.ob-cat-tile.selected .ob-check svg { display: block; }
.ob-check svg { display: none; width: 11px; height: 11px; }

/* ── Account screen ── */
.ob-auth-stack { display: flex; flex-direction: column; gap: 10px; }
.ob-or-row {
  display: flex; align-items: center; gap: 12px;
  color: var(--color-text-muted); font-size: 12px; margin: 6px 0;
}
.ob-or-row::before, .ob-or-row::after {
  content: ""; flex: 1; height: 1px; background: rgba(0,0,0,.08);
}
.ob-legal {
  font-size: 11.5px; color: var(--color-text-muted);
  text-align: center; line-height: 1.5; margin-top: 14px; padding: 0 8px;
}
.ob-legal a { color: var(--color-text-secondary); text-decoration: underline; }

/* ── Success screen ── */
.ob-success-illus { display: grid; place-items: center; margin: 30px 0; }
.ob-scan-frame {
  width: 240px; height: 240px; border-radius: 36px;
  background: #1a1a1a; position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.ob-corners {
  position: absolute; inset: 24px;
  border: 2px solid transparent;
}
.ob-corners::before, .ob-corners::after {
  content: ""; position: absolute;
  width: 32px; height: 32px; border: 3px solid var(--sage);
}
.ob-corners::before {
  top: 0; left: 0; border-right: none; border-bottom: none;
  border-radius: 6px 0 0 0;
}
.ob-corners::after {
  bottom: 0; right: 0; border-left: none; border-top: none;
  border-radius: 0 0 6px 0;
}
.ob-laser {
  position: absolute; left: 30px; right: 30px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--sage), transparent);
  animation: ob-scan 2.4s ease-in-out infinite; top: 50%;
}
@keyframes ob-scan {
  0%, 100% { transform: translateY(-72px); }
  50% { transform: translateY(72px); }
}

/* ══════════════════════════════════════════════════════════════════
 * RESPONSIVE — Desktop & Tablet (768px+)
 * Center content in a max-width container, scale up typography,
 * and lay out cards side-by-side where it makes sense.
 * ══════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  /* ── Base layout: keep full-width, clip overflow ── */
  #app:has(.ob-screens) {
    position: fixed; inset: 0;
    overflow: hidden;
  }

  /* Screens stay full-width so carousel transform works correctly.
     Content centering happens inside each .ob-screen instead. */

  .ob-screen {
    padding: 72px 48px 40px;
    align-items: center;
  }
  .ob-screen.ob-no-chrome { padding-top: 48px; }

  /* ── Chrome: center progress bar ── */
  .ob-chrome {
    max-width: 1200px;
    left: 50%; transform: translateX(-50%);
    padding: 28px 48px 0;
  }
  .ob-skip { right: 48px; top: 32px; font-size: 15px; }

  /* ── Typography: scale up ── */
  h1.ob-title { font-size: 40px; text-align: center; }
  h1.ob-title.ob-lg { font-size: 44px; }
  p.ob-sub { font-size: 17px; max-width: 520px; text-align: center; }

  /* ── Buttons: cap width ── */
  .ob-btn { max-width: 420px; }
  .ob-footer { width: 100%; max-width: 420px; }

  /* ── Welcome screen: bigger hero ── */
  .ob-logo-row { margin-top: 48px; margin-bottom: 24px; gap: 10px; }
  .ob-logo-img { height: 40px; width: 40px; }
  .ob-logo-text { font-size: 22px; }

  .ob-welcome-hero h1 { font-size: 42px; }
  .ob-welcome-hero .ob-tagline { font-size: 17px; max-width: 400px; }

  .ob-hero-phone-wrap {
    margin-top: 24px; flex: 0 1 auto; max-height: 380px;
  }
  .ob-hero-phone-wrap::after { height: 80px; }
  .ob-hero-phone {
    width: 220px; height: 440px;
    border-radius: 38px;
    box-shadow: 0 0 0 6px #1a1a1a;
  }
  .ob-hero-phone::before {
    width: 72px; height: 20px; top: 10px;
  }

  /* Scale badge positions for tablet phone */
  .ob-gb-1 { top: 50px; left: 10px; }
  .ob-gb-2 { top: 155px; right: 8px; }
  .ob-gb-3 { bottom: 170px; left: 8px; }
  .ob-gb-4 { bottom: 95px; right: 10px; }
  .ob-glass-badge { padding: 9px 13px; border-radius: 13px; }
  .ob-gb-title { font-size: 12.5px; }
  .ob-gb-sub { font-size: 10px; }

  /* ── Problem screen: wider stat card, bigger mock ── */
  .ob-problem-stat {
    max-width: 520px; padding: 28px 30px;
    margin-top: 32px;
  }
  .ob-problem-stat .ob-num { font-size: 52px; }
  .ob-problem-stat .ob-lbl { font-size: 15px; }
  .ob-product-mock { max-width: 520px; padding: 24px; margin-top: 24px; }
  .ob-product-mock .ob-photo { height: 220px; }
  .ob-product-mock .ob-name { font-size: 18px; }

  /* ── Solution screen: wider card ── */
  .pd2 { max-width: 560px; width: 100%; }
  .pd2-card { padding: 24px; }

  /* ── Categories: 3 columns on desktop ── */
  .ob-cat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px; max-width: 560px; margin-top: 12px;
  }
  .ob-cat-tile { padding: 24px 16px; border-radius: 20px; }
  .ob-emoji { font-size: 36px; }
  .ob-cat-lbl { font-size: 14.5px; }

  /* ── Auth screen: wider ── */
  .ob-auth-stack { max-width: 420px; width: 100%; }

  /* ── Success screen: bigger scanner ── */
  .ob-scan-frame { width: 300px; height: 300px; border-radius: 44px; }
  .ob-success-illus { margin: 48px 0; }
}

/* ══════════════════════════════════════════════════════════════════
 * RESPONSIVE — Large desktop (1200px+)
 * Side-by-side layouts for welcome and problem screens.
 * ══════════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {
  .ob-screen { padding: 72px 64px 48px; }
  .ob-screen.ob-no-chrome { padding-top: 56px; }
  .ob-chrome { padding: 32px 64px 0; }

  /* ── Welcome: side-by-side text + phone ── */
  .ob-welcome-hero {
    flex-direction: row; text-align: left;
    align-items: center; justify-content: center;
    gap: 60px; padding: 0;
  }
  .ob-welcome-text { align-items: flex-start; flex: 1; max-width: 460px; }
  .ob-welcome-hero h1 { font-size: 48px; text-align: left; }
  .ob-welcome-hero .ob-tagline { text-align: left; max-width: 380px; margin-bottom: 0; }
  .ob-hero-phone-wrap {
    margin-top: 0; max-width: 300px; max-height: 520px;
    flex: 0 0 auto; overflow: visible;
  }
  .ob-hero-phone-wrap::after { display: none; }
  .ob-hero-phone {
    width: 250px; height: 500px;
    border-radius: 44px;
    box-shadow: 0 0 0 7px #1a1a1a;
  }
  .ob-hero-phone::before { width: 80px; height: 22px; top: 11px; }
  .ob-gb-1 { top: 55px; left: 12px; }
  .ob-gb-2 { top: 170px; right: 8px; }
  .ob-gb-3 { bottom: 190px; left: 8px; }
  .ob-gb-4 { bottom: 105px; right: 10px; }
  .ob-glass-badge { padding: 10px 14px; border-radius: 14px; }
  .ob-gb-title { font-size: 13.5px; }
  .ob-gb-sub { font-size: 10.5px; }
}
