/* Examples gallery — card grid with live previews for images, videos, and
   HTML artifacts. HTML previews use an iframe scaled down to fit the tile,
   with pointer-events disabled so the whole card stays clickable.

   Every color, background, and border below resolves through the tenant
   theme's CSS custom properties (see static/css/theme_dark.css and
   theme_light.css) — the light/dark toggle repaints this page without
   any JS changes needed here. */

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.example-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  overflow: hidden;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.example-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--backdrop-overlay);
}

.example-preview {
  aspect-ratio: 16 / 9;
  background: var(--surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.example-preview img,
.example-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Live HTML thumbnail — the artifact is rendered in an iframe at ~2.5×
   its container size and scaled down to 0.4, giving a zoomed-out
   snapshot. Pointer events disabled so clicks flow to the parent link.
   ``background: var(--bg)`` matches the theme so a report whose own
   background is transparent still reads correctly against the card. */
.example-preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 250%;
  height: 250%;
  border: 0;
  transform: scale(0.4);
  transform-origin: 0 0;
  pointer-events: none;
  background: var(--bg);
}

.example-preview .icon-fallback {
  font-size: 3rem;
  color: var(--muted);
  opacity: 0.7;
}

.example-meta {
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.example-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.example-info {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.example-info .badge {
  padding: 0.25rem 0.3rem 0.2rem 0.3rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: var(--muted);
}

.examples-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.examples-empty code {
  background: var(--surface-hover);
  color: var(--text);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Admin section — visually distinct from the public gallery so the
   admin knows immediately that these tiles are only visible to them.
   Uses --divider for the separator so light/dark themes both look right. */
.admin-examples-section {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--divider);
}
.admin-examples-header {
  margin-bottom: 1rem;
}
.admin-examples-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  color: var(--accent);
}
/* .admin-examples-header h2::before {
  content: "🔒 ";
  font-size: 0.9em;
  margin-right: 0.25rem;
} */
.admin-examples-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 780px;
}
.admin-examples-header code {
  background: var(--surface-hover);
  color: var(--text);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ────────────────────────────────────────────────────────────────────
   Viewer page — the wrapper that keeps the tenant chrome (nav, footer,
   theme toggle) around a full-size iframe of the selected example. */

.example-viewer-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.example-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.example-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius, 6px);
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.example-back:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.example-back i { font-size: 0.95rem; line-height: 1; }

.example-viewer-title {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.example-admin-tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-dim, var(--surface-hover));
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.example-viewer-spacer { width: 1px; }

.example-viewer-frame {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
}
.example-viewer-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 70vh;
  border: 0;
  display: block;
  background: var(--bg);
}
