/* ============================================================================
   Seraglio - in-page demo of the desktop app.

   Styles for the gallery window, which runs inside the page. Popping a tile out
   opens a REAL browser window (player.html); the camera and stats windows are
   real windows too, each with its own stylesheet. Every visual value
   (typography, palette, control chrome, masonry, pulse) mirrors the shipped
   app; the collection is locked to a bundled sample set (no folder
   browsing).

   All rules are scoped under #srg-stage so the app's palette and reset never
   leak into the surrounding marketing page, and all internal classes carry an
   `srg-` prefix so they never collide with the page's own .tile / .grid / etc.
   ========================================================================== */

#srg-stage {
  position: relative;
  overflow: hidden;
  height: clamp(540px, 66vh, 780px);
  background: #0a0a0a;
  /* The app's own type stack: system sans, NOT the marketing serif. */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #ddd;
  user-select: none;
}
#srg-stage *, #srg-stage *::before, #srg-stage *::after { box-sizing: border-box; }
#srg-stage [hidden] { display: none !important; }

/* Keyboard focus: the accent ring, on every control in the stage. */
#srg-stage :focus-visible {
  outline: 2px solid #d7b3ff;
  outline-offset: 2px;
}

/* The gallery "window" body - fills the stage, scrolls internally like the app. */
#srg-stage .srg-canvas {
  position: absolute;
  inset: 0;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
}
#srg-stage .srg-canvas::-webkit-scrollbar { width: 9px; }
#srg-stage .srg-canvas::-webkit-scrollbar-thumb { background: #222; border-radius: 5px; }

/* ---- header --------------------------------------------------------------- */
#srg-stage .srg-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 14px;
  flex-wrap: wrap;
}
#srg-stage .srg-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
/* cam + stats + help travel together: one no-wrap unit, so the ? never strands on its own line */
#srg-stage .srg-icon-group { display: inline-flex; gap: 6px; align-items: center; }

#srg-stage .srg-ghost-btn {
  background: transparent; color: #8a8a8a;
  border: 1px solid #222; padding: 5px 11px; border-radius: 5px;
  font-size: 11px; letter-spacing: 1px; cursor: pointer;
  font-family: inherit; text-transform: uppercase;
}
#srg-stage .srg-ghost-btn:hover { color: #ccc; border-color: #444; background: #141414; }
#srg-stage .srg-ghost-btn.srg-active {
  color: #d7b3ff; border-color: rgba(150,90,255,0.55);
  background: rgba(120,70,220,0.16); box-shadow: 0 0 12px rgba(150,90,255,0.3);
}

#srg-stage .srg-step-group { display: flex; gap: 4px; align-items: center; position: relative; }
/* Micro-label under each stepper - hidden at rest, revealed on hover/focus. */
#srg-stage .srg-step-label {
  position: absolute; top: calc(100% + 1px); left: 50%; transform: translateX(-50%);
  font-size: 8px; letter-spacing: 1px; text-transform: uppercase;
  color: #8a8a8a; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s ease;
}
#srg-stage .srg-step-group:hover .srg-step-label,
#srg-stage .srg-step-group:focus-within .srg-step-label { opacity: 1; }
#srg-stage .srg-step-btn {
  background: transparent; color: #8a8a8a; border: 1px solid #222;
  width: 26px; padding: 5px 0; border-radius: 5px;
  font-size: 13px; line-height: 1; cursor: pointer; font-family: inherit;
}
#srg-stage .srg-step-btn:hover { color: #ccc; border-color: #444; background: #141414; }
#srg-stage .srg-value-btn { min-width: 58px; text-align: center; }

#srg-stage .srg-icon-btn {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: #8a8a8a;
  border: 1px solid #222; border-radius: 5px; cursor: pointer;
}
#srg-stage .srg-icon-btn:hover { color: #ccc; border-color: #444; background: #141414; }
#srg-stage .srg-icon-btn svg { width: 15px; height: 15px; display: block; }
#srg-stage .srg-shuffle:active svg { transform: rotate(180deg); transition: transform 0.25s ease; }
/* Desktop-only actions (collapse wall, save layout): shown for parity with the
   real app, but inert here - the tooltip explains they live in the desktop app,
   the same treatment as folder browsing. */
#srg-stage .srg-desktop-only { opacity: 0.4; cursor: default; }
#srg-stage .srg-desktop-only:hover { color: #8a8a8a; border-color: #222; background: transparent; }

#srg-stage .srg-help-btn {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  background: transparent; color: #7f7f7f; border: 1px solid #222;
  font-size: 12px; line-height: 1; cursor: pointer; font-family: inherit;
}
#srg-stage .srg-help-btn:hover { color: #ccc; border-color: #444; background: #141414; }

/* ---- masonry wall --------------------------------------------------------- */
#srg-stage .srg-grid { display: flex; align-items: flex-start; gap: 10px; }
#srg-stage .srg-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

#srg-stage .srg-tile { position: relative; }
#srg-stage .srg-tile video,
#srg-stage .srg-tile img {
  width: 100%; display: block; border-radius: 6px; background: #111;
}
#srg-stage .srg-tile .srg-name {
  position: absolute; top: 6px; left: 8px;
  max-width: calc(100% - 56px);
  color: rgba(255,255,255,0.85); font-size: 10px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 3px 7px; border-radius: 4px;
  opacity: 0; transition: opacity 0.15s ease; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; z-index: 9; line-height: 1.4;
}
#srg-stage .srg-tile:hover .srg-name { opacity: 1; }
#srg-stage .srg-pop {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; padding: 0; border-radius: 6px;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.12);
  color: #eee; cursor: pointer; opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#srg-stage .srg-tile:hover .srg-pop, #srg-stage .srg-pop:focus-visible { opacity: 1; }
#srg-stage .srg-pop:hover { background: rgba(0,0,0,0.8); border-color: rgba(255,255,255,0.28); }
/* First-visit affordance: a few tiles keep their popout button visible for a
   moment after the wall boots, so the multi-window move is discoverable. */
#srg-stage .srg-pop.srg-pop-hint { opacity: 1; }

/* ---- one-time popout tip (shown inside the stage on first boot) ----------- */
#srg-stage .srg-tip {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 300; display: flex; align-items: center; gap: 8px;
  max-width: min(440px, 92%);
  background: #1c1630; color: #d7b3ff;
  border: 1px solid rgba(150,90,255,0.5); border-radius: 8px;
  padding: 8px 8px 8px 14px; font-size: 12px; line-height: 1.4;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
#srg-stage .srg-tip-close {
  background: transparent; border: none; color: #b3aac4;
  font-size: 13px; line-height: 1; cursor: pointer; padding: 4px 6px;
  font-family: inherit; flex: 0 0 auto;
}
#srg-stage .srg-tip-close:hover { color: #e6d8ff; }

/* ---- gallery cooldown + pulse overlays (stage-wide) ----------------------- */
#srg-stage .srg-gallery-pulse {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  opacity: var(--srg-gpulse, 0);
  background: radial-gradient(ellipse 70% 70% at 50% 50%,
    rgba(178,102,255,0) 52%, rgba(178,102,255,1) 125%);
}
#srg-stage .srg-gallery-cool {
  position: absolute; inset: 0; z-index: 50; background: #000;
  opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
}
#srg-stage.srg-cooled .srg-gallery-cool { opacity: 0.97; }

/* ---- help legend (stage-wide overlay) ------------------------------------- */
#srg-stage .srg-help-overlay {
  position: absolute; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#srg-stage .srg-help-card {
  width: min(520px, 92%); max-height: 100%; overflow-y: auto;
  background: #121016; border: 1px solid #2a2438; border-radius: 12px;
  padding: 22px 26px 26px; box-shadow: 0 18px 60px rgba(0,0,0,0.6);
}
#srg-stage .srg-help-card h2 { margin: 0 0 4px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #d7b3ff; font-family: inherit; font-weight: 600; }
#srg-stage .srg-help-sub { margin: 0 0 16px; font-size: 11px; color: #8a8a8a; }
#srg-stage .srg-help-section { margin-top: 16px; }
#srg-stage .srg-help-section h3 { margin: 0 0 8px; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #888; font-family: inherit; font-weight: 600; }
#srg-stage .srg-help-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; font-size: 13px; color: #ccc; }
#srg-stage .srg-help-hint { margin-top: 18px; font-size: 11px; color: #7f7f7f; text-align: center; }
#srg-stage kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
  background: #1d1828; border: 1px solid #322a44; border-bottom-width: 2px;
  border-radius: 4px; padding: 2px 7px; color: #e6d8ff;
}

/* ---- "launch the wall" gate (before scroll-into-view boot) ---------------- */
#srg-stage .srg-launch {
  position: absolute; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(60% 60% at 50% 45%, rgba(138,99,201,0.14), transparent 60%), #0a0a0a;
  cursor: pointer; transition: opacity 0.4s ease;
}
#srg-stage .srg-launch.gone { opacity: 0; pointer-events: none; }
#srg-stage .srg-launch-inner { text-align: center; color: #d7b3ff; }
#srg-stage .srg-launch-play {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  border: 1px solid rgba(150,90,255,0.5); display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: rgba(120,70,220,0.14); box-shadow: 0 0 30px rgba(150,90,255,0.25);
}
#srg-stage .srg-launch-label { font-size: 13px; letter-spacing: 1px; color: #c9b3ee; }
#srg-stage .srg-launch-sub { font-size: 11px; color: #8a8a8a; margin-top: 6px; }

/* ---- Brave-Shields positioning hint (shown only when placement is blocked) - */
#srg-stage .srg-shield-hint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 9500; width: min(460px, 90%);
  background: #15101f; border: 1px solid rgba(150,90,255,0.5); border-radius: 11px;
  padding: 15px 17px; box-shadow: 0 18px 55px rgba(0,0,0,0.65);
  text-align: left;
}
#srg-stage .srg-shield-title { font-size: 13.5px; font-weight: 600; color: #d7b3ff; margin-bottom: 7px; }
#srg-stage .srg-shield-body { font-size: 12px; line-height: 1.55; color: #b3aac4; }
#srg-stage .srg-shield-body b { color: #e6d8ff; font-weight: 600; }
#srg-stage .srg-shield-close {
  margin-top: 12px; background: rgba(120,70,220,0.18); color: #d7b3ff;
  border: 1px solid rgba(150,90,255,0.5); border-radius: 6px;
  padding: 6px 14px; font-size: 11px; letter-spacing: 0.5px; cursor: pointer; font-family: inherit;
}
#srg-stage .srg-shield-close:hover { background: rgba(120,70,220,0.32); border-color: rgba(150,90,255,0.7); }
