/* Shared preview harness chrome for book/blog iframe previews */

.bp-header {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  font-size: 0.82rem;
  position: relative;
  z-index: 2;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.bp-header a { color: #58a6ff; text-decoration: none; }
.bp-header a:hover { text-decoration: underline; }

.bp-hub-logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
}

.bp-hub-logo-link:hover { opacity: 0.85; text-decoration: none; }

.bp-hub-logo-link img {
  display: block;
  max-height: 36px;
  max-width: 108px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.bp-sep { color: #484f58; }
.bp-note { color: #8b949e; font-size: 0.78rem; }

.bp-views-wrap,
.bp-frame-mode-wrap,
.bp-device-mode-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.bp-views-label,
.bp-frame-mode-label,
.bp-device-mode-label {
  color: #8b949e;
  font-size: 0.78rem;
}

.bp-views-select,
.bp-frame-mode-select,
.bp-device-mode-select {
  appearance: none;
  background: #21262d;
  color: #58a6ff;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.22rem 1.65rem 0.22rem 0.55rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2358a6ff' d='M3 4.5 6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}

.bp-views-select:hover,
.bp-frame-mode-select:hover,
.bp-device-mode-select:hover { border-color: #58a6ff; }

.bp-views-select:focus,
.bp-frame-mode-select:focus,
.bp-device-mode-select:focus {
  outline: 2px solid #58a6ff;
  outline-offset: 1px;
}

.bp-copy-link-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #8b949e;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
}

.bp-copy-link-checkbox {
  accent-color: #58a6ff;
  cursor: pointer;
}

.bp-copy-link-label {
  color: #8b949e;
}

.bp-frame-wrap {
  min-height: 0;
  max-height: calc(100dvh - 3.25rem);
  max-width: 100vw;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.bp-frame-wrap.bp-frame-ordinal {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 1rem;
  box-sizing: border-box;
}

.bp-frame-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b949e;
  font-size: 0.85rem;
  pointer-events: none;
  background: #000;
}

.bp-frame-wrap.is-loaded .bp-frame-loading {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.bp-frame-wrap iframe {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: #000;
  visibility: hidden;
  opacity: 0;
}

.bp-frame-wrap.is-loaded iframe {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.bp-frame-wrap.bp-frame-ordinal iframe {
  position: relative;
  inset: auto;
  width: 600px;
  height: 600px;
  max-width: min(600px, 100%);
  max-height: min(600px, calc(100dvh - 5rem));
  flex: 0 0 auto;
  border: 1px solid #30363d;
  border-radius: 2px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.bp-frame-wrap.bp-frame-mobile:not(.bp-frame-ordinal) {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 1rem;
  box-sizing: border-box;
}

.bp-frame-wrap.bp-frame-mobile:not(.bp-frame-ordinal) iframe {
  position: relative;
  inset: auto;
  width: min(var(--bp-mobile-width, 390px), 100%);
  max-width: min(var(--bp-mobile-width, 390px), 100%);
  height: min(calc(100dvh - 5rem), calc(var(--bp-mobile-width, 390px) * 844 / 390));
  min-height: min(calc(100dvh - 5rem), calc(var(--bp-mobile-width, 390px) * 844 / 390));
  max-height: calc(100dvh - 5rem);
  flex: 0 0 auto;
  border: 1px solid #30363d;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.bp-frame-wrap.bp-frame-mobile.bp-frame-ordinal iframe {
  width: min(var(--bp-mobile-width, 390px), 600px, 100%);
  max-width: min(var(--bp-mobile-width, 390px), 600px, 100%);
  height: min(var(--bp-mobile-width, 390px), 600px, calc(100dvh - 5rem));
  max-height: min(var(--bp-mobile-width, 390px), 600px, calc(100dvh - 5rem));
}
