/*
 * The live preview (PreviewsController): what the authoring chat drafted last, beside its check results and the
 * recent drafts. Inherits the .km world from knowledge.css (tokens, fonts, pills, buttons).
 */

.km-pv { display: grid; gap: 1.5rem; }
.pv-head { display: grid; gap: 0.6rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.pv-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; }
.pv-title { margin: 0; font-size: 1.75rem; font-weight: 800; line-height: 1.18; letter-spacing: -0.01em; }
.pv-mode { margin: 0; color: var(--quiet); font-size: 0.9375rem; font-weight: 650; line-height: 1.5; }
.pv-mode .pv-link { margin-left: 0.4rem; }
.pv-mode strong { color: var(--ink); font-weight: 800; }
.pv-dot { display: inline-block; width: 10px; height: 10px; margin-right: 0.45rem; border-radius: 50%; background: var(--action); vertical-align: 0.05em; }
.pv-mode[data-mode="follow"] .pv-dot { background: var(--right); box-shadow: 0 0 0 0 color-mix(in oklab, var(--right) 45%, transparent); animation: pv-breathe 2.6s var(--settle, cubic-bezier(0.45, 0.05, 0.2, 1)) infinite; }
@keyframes pv-breathe { 70% { box-shadow: 0 0 0 7px transparent; } }
.pv-link { font-weight: 650; text-underline-offset: 0.2em; }

.pv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 2rem; align-items: start; }

.pv-stage { display: grid; gap: 0.9rem; min-width: 0; }
.pv-stage-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1rem; }
.pv-stage-name h2 { margin: 0; font-size: 1.375rem; font-weight: 800; line-height: 1.2; }
.pv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin: 0.25rem 0 0; color: var(--quiet); font-size: 0.875rem; font-weight: 650; }
.pv-status { padding: 0.05rem 0.55rem; border-radius: 999px; background: var(--sunk); color: var(--ink); font-weight: 800; font-size: 0.8125rem; }
.pv-status[data-status="approved"], .pv-status[data-status="released"] { background: var(--right-bg); color: var(--right); }
.pv-status[data-status="rejected"] { background: var(--not-yet-bg); color: var(--not-yet); }
.pv-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pv-button {
  display: inline-flex; align-items: center; padding: 0.45rem 1.1rem; border-radius: 999px; background: var(--action); color: #fff;
  font-weight: 650; font-size: 0.9375rem; text-decoration: none; transition: background 200ms var(--glide), transform 200ms var(--pop);
}
.km .pv-button { color: #fff; }
.pv-button:hover { background: var(--action-deep); }
.pv-button:active { transform: scale(0.96); }
.km .pv-button-quiet { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.km .pv-button-quiet:hover { background: var(--paper); box-shadow: inset 0 0 0 2px var(--action); }

/* The embedded view is a window onto another page: an edge, no second panel. */
.pv-frame { display: block; width: 100%; height: max(34rem, calc(100dvh - 15rem)); border: 1px solid var(--line); border-radius: 24px; background: var(--paper); }
.pv-noframe { display: grid; gap: 1rem; justify-items: start; padding: 1.5rem; border-radius: 24px; background: var(--sunk); }
.pv-noframe p { margin: 0; }

.pv-side { position: sticky; top: 1.5rem; display: grid; gap: 1.25rem; max-height: calc(100dvh - 3rem); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.pv-panel { display: grid; gap: 0.6rem; }
.pv-panel h2 { margin: 0; font-size: 1.125rem; font-weight: 800; }
.pv-ok { margin: 0; padding: 0.6rem 0.9rem; border-radius: 14px; background: var(--right-bg); color: var(--right); font-weight: 650; font-size: 0.9375rem; }
.pv-count { margin: 0; font-weight: 800; font-size: 0.9375rem; }
.pv-count-error { color: var(--not-yet); }
.pv-diags { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.pv-diag { display: grid; gap: 0.1rem; padding: 0.5rem 0.75rem; border-radius: 14px; background: var(--sunk); font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
.pv-diag small { color: var(--quiet); font-size: 0.8125rem; }
.pv-diag-error { background: var(--not-yet-bg); }
.pv-warnings { margin-top: 0; }

.pv-recent { display: grid; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.pv-entry { display: grid; gap: 0.05rem; padding: 0.5rem 0.75rem; border-radius: 14px; text-decoration: none; transition: background 200ms var(--glide); }
.pv-entry:hover { background: var(--sunk); }
.pv-entry[aria-current="true"] { background: var(--paper); box-shadow: var(--soft), inset 0 0 0 2px var(--action); }
.pv-entry-name { font-weight: 650; font-size: 0.9375rem; }
.pv-entry-meta { color: var(--quiet); font-size: 0.8125rem; overflow-wrap: anywhere; }
.pv-entry[data-live="false"] .pv-entry-name { color: var(--quiet); }

@media (max-width: 1100px) {
  .pv-grid { grid-template-columns: minmax(0, 1fr); }
  .pv-side { position: static; max-height: none; overflow: visible; }
  .pv-frame { height: 80dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .pv-mode .pv-dot { animation: none !important; }
}
