/* The F5 preview demo (preview-demo.js). Uses the tokens from styles.css; the inspector colours match the app's. */
.pv { --w: min(1440px, 100vw - clamp(40px, 12vw, 240px)); width: var(--w); margin: clamp(96px, 12vw, 160px) calc(50% - var(--w) / 2) 0; --insp: #0a6cd8; }
.pv-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px clamp(32px, 6vw, 96px); align-items: end; margin-bottom: 32px; }
.pv-head h3 { grid-column: 1 / -1; margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 3vw, 36px); line-height: 1.1; letter-spacing: -.02em; }
.pv-head p { margin: 0; max-width: 44ch; color: var(--text-2); text-wrap: pretty; }
.pv-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.pv-points li { padding-top: 14px; border-top: 1px solid var(--line); }
.pv-points b { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }

/* The frame matches .showcase-media */
.pv-frame { padding: clamp(14px, 3vw, 40px); border-radius: var(--r-card); background: linear-gradient(135deg, #3b82ff 0%, var(--blue) 55%, #1f4fd8 100%); }
.pv-app {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); height: clamp(460px, 44vw, 600px);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; background: #0b0b0d; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 10, 60, .45);
}

/* Editor */
.pv-editor { position: relative; display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.pv-tabs { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 0; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.pv-tab { display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 14px; border-right: 1px solid var(--line); background: #0b0b0d; color: var(--text); font: 12.5px var(--font-code); }
.pv-dot { width: 8px; height: 8px; border-radius: 2px; background: #e8743b; }
.pv-run {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg-2); color: var(--text); font: 500 12.5px var(--font-ui); cursor: pointer; transition: border-color .15s, background .15s;
}
.pv-run svg { color: var(--ok); }
.pv-run:hover { border-color: #3a3a44; background: var(--bg-3); }
.pv-app kbd { padding: 0 5px; border: 1px solid #3a3a44; border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); font: 11px/16px var(--font-code); }
.pv-src { flex: 1; overflow: auto; padding: 10px 0; scrollbar-width: thin; scrollbar-color: #2c2c33 transparent; }
.pv-src:focus-visible { outline-offset: -2px; }
.pv-lines { margin: 0; padding: 0; list-style: none; font: 12.5px/1.75 var(--font-code); color: #d4d4d8; }
.pv-lines li { display: flex; padding-right: 12px; white-space: pre; transition: background .3s; }
.pv-ln { flex: none; width: 3.4em; padding-right: 1.2em; text-align: right; color: #4a4a54; user-select: none; }
.pv-lines code { font: inherit; }
.pv-lines li.is-hover { background: rgba(10, 108, 216, .12); }
.pv-lines li.is-hover .pv-ln { color: #8ab4ff; }
.pv-lines li.is-shown { animation: pv-flash 1.6s ease-out; }
@keyframes pv-flash { 0%, 30% { background: rgba(10, 108, 216, .42); } 100% { background: transparent; } }
.h-p { color: #6b7280; }
.h-tag { color: #7cc7ff; }
.h-attr { color: #c4a7ff; }
.h-str { color: #a7e3a1; }

/* Ask AI composer */
.pv-ask {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px;
  border: 1px solid #2f2f38; border-radius: 10px; background: var(--bg-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: pv-up .2s ease-out;
}
.pv-ask[hidden] { display: none; }
.pv-ask-who { color: #e8896b; font-weight: 600; font-size: 13px; }
.pv-ask-chip { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 7px; border-radius: 6px; background: rgba(10, 108, 216, .2); color: #8ab4ff; font: 12px var(--font-code); }
.pv-ask input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: 13px var(--font-ui); }
.pv-ask input:focus { outline: none; }
.pv-ask-send { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: var(--blue); color: #fff; cursor: pointer; }
.pv-ask-close { border: 0; background: none; color: var(--text-3); font-size: 18px; line-height: 1; cursor: pointer; }
@keyframes pv-up { from { opacity: 0; transform: translateY(6px); } }

/* Preview pane */
.pv-pane { display: flex; flex-direction: column; min-width: 0; }
.pv-bar { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.pv-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--text-2); cursor: pointer; }
.pv-btn:hover { background: var(--bg-3); color: var(--text); }
.pv-inspect[aria-pressed="true"] { border-color: rgba(10, 108, 216, .6); background: rgba(10, 108, 216, .2); color: #8ab4ff; }
.pv-app:not(.is-running) .pv-btn { opacity: .4; pointer-events: none; }
.pv-url { padding: 3px 10px; border-radius: 6px; background: var(--bg-2); color: var(--text-2); font: 12px var(--font-code); white-space: nowrap; }
.pv-hint { margin-left: auto; overflow: hidden; color: var(--text-3); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.pv-view { position: relative; flex: 1; min-height: 0; background: #f6f1ea; }
.pv-page { position: absolute; inset: 0; overflow: auto; scrollbar-width: thin; }
.pv-app:not(.is-running) .pv-page { visibility: hidden; }
.pv-app.is-inspecting .pv-page { cursor: default; }
.pv-empty { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px; background: #0e0e11; color: var(--text-2); font-size: 15px; }
.pv-empty[hidden] { display: none; }
.pv-empty p { margin: 0; }
.pv-empty kbd { font-size: 13px; }

/* Inspector overlay, as previewInspector.ts draws it */
.pv-box, .pv-label { position: absolute; z-index: 3; pointer-events: none; }
.pv-box[hidden], .pv-label[hidden] { display: none; }
.pv-box { border: 1px solid rgba(10, 108, 216, .55); border-radius: 2px; background: rgba(10, 108, 216, .06); transition: background .2s ease-out, border-color .2s ease-out; }
.pv-box.morph { transition: left .18s cubic-bezier(.16, 1, .3, 1), top .18s cubic-bezier(.16, 1, .3, 1), width .18s cubic-bezier(.16, 1, .3, 1), height .18s cubic-bezier(.16, 1, .3, 1), background .2s ease-out; }
.pv-box.pinned { border-color: rgba(10, 108, 216, .9); background: rgba(10, 108, 216, .16); }
.pv-box.editing { border: 1px dashed var(--insp); background: transparent; }
.pv-label { max-width: calc(100% - 8px); padding: 0 5px; border-radius: 3px; background: var(--insp); color: #fff; font: 600 10px/16px ui-monospace, Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-label.morph { transition: left .18s cubic-bezier(.16, 1, .3, 1), top .18s cubic-bezier(.16, 1, .3, 1); }
.pv-label b { margin-right: 4px; font-weight: 700; }
.pv-size { margin-left: 6px; font-weight: 500; opacity: .75; }

/* Right-click menu, styled like Breeze's own menus */
.pv-menu {
  position: absolute; z-index: 4; display: grid; min-width: 170px; padding: 4px; border: 1px solid var(--glass-line); border-radius: 9px;
  background: var(--glass-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}
.pv-menu[hidden] { display: none; }
.pv-menu button { padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 13px var(--font-ui); text-align: left; cursor: pointer; }
.pv-menu button:hover, .pv-menu button:focus-visible { outline: none; background: var(--blue); }

@media (prefers-reduced-motion: reduce) {
  .pv-box, .pv-box.morph, .pv-label.morph { transition: none; }
  .pv-lines li.is-shown { animation-duration: .01s; }
  .pv-ask { animation: none; }
}
@media (max-width: 900px) {
  .pv-head { grid-template-columns: 1fr; }
  .pv-points { grid-template-columns: 1fr; gap: 12px; }
  .pv-app { grid-template-columns: 1fr; grid-template-rows: 220px minmax(0, 1fr); height: 680px; }
  .pv-editor { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .pv-url { display: none; }
  .pv-frame { padding: 10px; }
}
