/* publish.scrapeable.com — Read-only published output renderer */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: #fff;
  color: #333;
}

#publish-content-area {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

/* ---- Chunk container ---- */

.publish-chunk {
  animation: chunkIn 0.2s ease;
}

@keyframes chunkIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Code toggle (collapsed by default) ---- */

.chunk-code {
  margin-bottom: 6px;
}

.chunk-code summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-radius: 4px;
}

.chunk-code summary::-webkit-details-marker {
  display: none;
}

.chunk-code summary:hover {
  background: #f3f4f6;
  color: #374151;
}

.chunk-code summary .code-chevron {
  font-size: 8px;
  transition: transform 0.15s ease;
}

.chunk-code[open] summary .code-chevron {
  transform: rotate(90deg);
}

.chunk-code summary .code-label {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  font-size: 11px;
}

.chunk-code summary .code-duration {
  font-size: 10px;
  color: #9ca3af;
  font-weight: 400;
}

.chunk-code pre {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: #1f2937;
  color: #e5e7eb;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Output section ---- */

.chunk-output {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chunk-output pre {
  margin: 0;
  padding: 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}

/* ---- Error ---- */

.chunk-error {
  padding: 8px 10px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #991b1b;
}

/* ---- Plots ---- */

.chunk-output img,
.viewer-chunk img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* ---- Widget iframes ---- */

.chunk-output iframe,
.viewer-chunk iframe {
  display: block;
  width: 100%;
  height: 550px;
  border: none;
  background: #fff;
  border-radius: 4px;
}

/* ---- Data views ---- */

.chunk-output .data-view h4,
.viewer-chunk .data-view h4 {
  font-weight: 500;
  margin-bottom: 4px;
  color: #6b7280;
  font-size: 11px;
}

.chunk-output .data-view pre,
.viewer-chunk .data-view pre {
  padding: 8px 10px;
  background: #f5f7f9;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
}

/* ---- Viewer items (plot/widget/data from editor mode) ---- */

.viewer-chunk {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* ---- Loading state ---- */

.publish-loading {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 13px;
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
