/* ============================================================================
   scenarios.css — the "See CARTaja in action" journey gallery.
   Reuses the design tokens defined on :root in home.css (loaded before this).
   Layout: teal brand hero (nav sits on it) → ivory gallery grid → dark viewer.
   ========================================================================== */

.sg-body {
  background: var(--ivory);
  color: var(--text-primary);
  font-family: "DM Sans", system-ui, sans-serif;
  margin: 0;
}

/* ── Nav: force an always-on teal glass so links stay readable over ivory ── */
.sg-body nav {
  background: rgba(4, 58, 60, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-glass);
}
.sg-body .nav-links a.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* ═══════════════════ HERO ═══════════════════ */
/* Cothon artwork as the hero backdrop — same image and same treatment as the
   home page's .page-bg (css/demo.css), so the two heroes read as one brand.
   The `70% center` position is load-bearing: it crops out the "cartaja"
   wordmark baked into the image's left third, which would otherwise duplicate
   the nav logo. The teal wash over it keeps white text legible on the artwork. */
.sg-hero {
  background-color: var(--bg-darkest);
  background-image:
    /* Legibility scrim. The brand wash below is tuned for the home page's
       LEFT-aligned copy (opaque at 0%, thinnest at 55%); this hero is centred,
       so its text lands in exactly that thinnest band — over the cart and the
       cobblestones. This soft ellipse restores contrast behind the copy while
       leaving the artwork readable at the edges. */
    radial-gradient(120% 78% at 50% 52%, rgba(4, 58, 60, 0.52) 0%, rgba(4, 58, 60, 0.28) 45%, transparent 78%),
    linear-gradient(
      90deg,
      rgba(4, 58, 60, 0.93) 0%,
      rgba(10, 138, 142, 0.85) 30%,
      rgba(10, 138, 142, 0.55) 55%,
      rgba(4, 58, 60, 0.7) 100%
    ),
    url("../assets/cothon-shopping-cart-graphic.jpg");
  background-size: auto, auto, cover;
  background-position: center, center, 70% center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  color: var(--ivory);
  padding: 132px 24px 64px;
  text-align: center;
}
.sg-hero__inner { max-width: 780px; margin: 0 auto; }
.sg-hero__eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd9c7;
  background: rgba(215, 111, 75, 0.18);
  border: 1px solid rgba(255, 217, 199, 0.28);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.sg-hero__title {
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5.4vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  color: #fff;
}
.sg-hero__lede {
  font-size: clamp(1rem, 2.1vw, 1.2rem);
  line-height: 1.6;
  color: rgba(245, 241, 229, 0.86);
  max-width: 620px;
  margin: 0 auto;
}

/* ── Industry filter chips ──
   These live on the ivory gallery, directly above the grid they filter — so
   they're styled dark-on-light, not for the teal hero. */
.sg-filterbar { padding: 44px 0 34px; }
.sg-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
/* Industry glyphs are Material Symbols, sized as text so they sit on the label's
   baseline inside the pill (design-system/brand/icons.md). */
.sg-chip__icon, .sg-pill__icon {
  font-size: 1.05em;
  line-height: 1;
  margin-right: 6px;
  vertical-align: -0.16em;
}
.sg-chip {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--crimson);
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(68, 22, 57, 0.05);
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.1s, box-shadow 0.16s;
}
.sg-chip:hover {
  border-color: var(--terracotta);
  box-shadow: 0 4px 12px rgba(68, 22, 57, 0.1);
}
.sg-chip:active { transform: translateY(1px); }
.sg-chip:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.sg-chip.is-active {
  color: var(--white);
  background: var(--crimson);
  border-color: var(--crimson);
  box-shadow: 0 6px 16px rgba(68, 22, 57, 0.24);
}
.sg-chip__count {
  opacity: 0.55;
  font-weight: 500;
  margin-left: 4px;
}
.sg-chip.is-active .sg-chip__count { opacity: 0.7; }

/* ═══════════════════ GALLERY GRID ═══════════════════ */
.sg-gallery {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 96px;
}
.sg-gallery__loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 0;
  font-size: 1.05rem;
}
.sg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 26px;
}

/* ── Card ── */
.sg-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  box-shadow: 0 2px 4px rgba(68, 22, 57, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.sg-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(68, 22, 57, 0.16);
  border-color: rgba(215, 111, 75, 0.5);
}
.sg-card:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

.sg-card__poster {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(160deg, #dfeceb, #cfe0df);
}
.sg-card__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.sg-card__poster::after { /* gentle fade so the meta area reads clean */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 46%;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.9), transparent);
  pointer-events: none;
}
.sg-card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
}
.sg-card__play .material-symbols-outlined {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--whatsapp);
  color: #fff;
  font-size: 26px;
  padding-left: 3px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.18s, transform 0.18s;
}
.sg-card:hover .sg-card__play .material-symbols-outlined,
.sg-card:focus-visible .sg-card__play .material-symbols-outlined { opacity: 1; transform: scale(1); }

/* Bottom-left, inside the poster's white fade: the frameless poster starts at
   the chat header, so any top-aligned pill collides with the business avatar
   (left) or a long business name (right — e.g. "Souk el Akel Online"). */
.sg-card__pill {
  position: absolute;
  bottom: 10px;
  left: 12px;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(4, 58, 60, 0.78);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 999px;
}

.sg-card__body { padding: 16px 18px 20px; }
.sg-card__biz {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 4px;
}
.sg-card__title {
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-size: 1.16rem;
  font-weight: 600;
  color: var(--crimson);
  margin: 0 0 6px;
  line-height: 1.2;
}
.sg-card__tagline {
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--text-primary);
  opacity: 0.82;
  margin: 0;
}

/* ═══════════════════ VIEWER OVERLAY ═══════════════════ */
.sg-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sg-viewer[hidden] { display: none; }
.sg-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  animation: sg-fade 0.2s ease;
}
@keyframes sg-fade { from { opacity: 0; } to { opacity: 1; } }

.sg-viewer__panel {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 34px;
  align-items: center;
  max-width: 940px;
  width: 100%;
  animation: sg-rise 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes sg-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.sg-viewer__close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.sg-viewer__close:hover { background: rgba(255, 255, 255, 0.28); }

/* ── Phone bezel ── */
.sg-viewer__phone { flex-shrink: 0; }
.sg-viewer__bezel {
  width: 372px;
  height: min(748px, 84vh);
  background: #0b0b0d;
  border-radius: 46px;
  padding: 12px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}
/* Screen corners must be concentric with the bezel: outer 46px − 12px padding
   = 34px. emulator.css forces .nui-wa-container to border-radius:0 (it assumes
   a square, full-bleed merchant page), and that container is what actually
   paints the chat background — so rounding only the device leaves the screen
   corners near-square and the bezel looks blobby at the corners. Round both. */
.sg-viewer__bezel .emulator-page__device {
  width: 100%;
  height: 100%;
  background: #0c1317; /* fallback behind the screen; never on the container —
                          that would paint over the widget's doodle backdrop */
}
.sg-viewer__bezel .emulator-page__device,
.sg-viewer__bezel .emulator-page__device .nui-wa-container {
  border-radius: 34px;
  overflow: hidden;
}

/* emulator.css insets the header by 52px to clear the merchant page's overlaid
   iPhone status bar. The gallery renders no status bar, so that inset is just a
   dead grey band under the bezel — pull it back to a natural header. */
.sg-viewer__bezel .emulator-page__device .nui-wa-header {
  padding-top: 14px;
}

/* ── Aside: meta + controls + CTA ── */
.sg-viewer__aside {
  flex: 1;
  min-width: 0;
  color: var(--ivory);
  max-width: 380px;
}
.sg-viewer__pill {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffd9c7;
  background: rgba(215, 111, 75, 0.22);
  border: 1px solid rgba(255, 217, 199, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
}
.sg-viewer__biz {
  display: block;
  margin-top: 16px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(245, 241, 229, 0.6);
}
.sg-viewer__title {
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 4px 0 12px;
  color: #fff;
}
.sg-viewer__outcome {
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(245, 241, 229, 0.82);
  margin: 0;
}

.sg-viewer__controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
  flex-wrap: wrap;
}
.sg-step {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 4px;
}
.sg-step__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  /* Material Symbols scale off font-size — see design-system/brand/icons.md. */
  font-size: 21px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.14s;
}
.sg-step__btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.sg-step__btn:disabled { opacity: 0.32; cursor: default; }
.sg-step__counter {
  min-width: 54px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(245, 241, 229, 0.9);
}
.sg-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  background: var(--whatsapp);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  /* The label swaps between Pause / Play / Replay — reserve the widest so the
     control doesn't resize under the cursor. */
  min-width: 124px;
  justify-content: center;
}
.sg-play .material-symbols-outlined { font-size: 20px; }
.sg-play:hover { filter: brightness(1.06); }
.sg-play:active { transform: translateY(1px); }

.sg-viewer__cta {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 22px;
}
.sg-viewer__cta-line {
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-size: 1.12rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 12px;
}
.sg-viewer__cta-btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: var(--terracotta);
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(215, 111, 75, 0.35);
  transition: transform 0.12s, box-shadow 0.15s;
}
.sg-viewer__cta-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(215, 111, 75, 0.45); }
.sg-viewer__cta-note {
  display: block;
  margin-top: 10px;
  font-size: 0.85rem;
  color: rgba(245, 241, 229, 0.6);
}

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 860px) {
  .sg-viewer { padding: 0; align-items: stretch; }
  .sg-viewer__panel {
    flex-direction: column;
    gap: 18px;
    max-width: none;
    height: 100%;
    overflow-y: auto;
    padding: 64px 20px 32px;
    justify-content: flex-start;
  }
  .sg-viewer__backdrop { background: rgba(15, 10, 20, 0.92); }
  .sg-viewer__close { top: 14px; right: 14px; }
  .sg-viewer__bezel {
    width: min(320px, 86vw);
    height: min(640px, 62vh);
    border-radius: 40px;
  }
  .sg-viewer__aside { max-width: 420px; margin: 0 auto; text-align: center; }
  .sg-viewer__controls { justify-content: center; }
  .sg-viewer__cta { text-align: center; }
}

@media (max-width: 560px) {
  .sg-hero { padding-top: 108px; }
  .sg-grid { grid-template-columns: 1fr; gap: 18px; }
}
