/* The HTML preview (assets/js/davix-h2i-html-preview.js): Studio results and History file pages. Logical properties only (RTL-safe). */
.hp{display:flex;flex-direction:column;gap:10px;width:100%;min-width:0;text-align:start;}
.hp-bar{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;justify-content:space-between;}
.hp-seg{display:inline-flex;border:1px solid var(--border-strong,var(--border));border-radius:var(--radius,10px);overflow:hidden;background:var(--surface);}
.hp-seg[hidden]{display:none;}
.hp-btn{appearance:none;border:0;margin:0;min-height:40px;min-width:44px;padding:0 16px;background:transparent;color:var(--text-muted);font:inherit;font-size:13px;font-weight:600;cursor:pointer;}
.hp-btn + .hp-btn{border-inline-start:1px solid var(--border);}
.hp-btn:hover:not(:disabled){color:var(--text);background:var(--surface-2);}
.hp-btn[aria-pressed="true"]{background:var(--pink-soft);color:var(--pink-dark);}
.hp-btn:disabled{opacity:.45;cursor:not-allowed;}
.hp-btn:focus-visible{outline:2px solid var(--pink-dark);outline-offset:-2px;}
.hp-stage{position:relative;border:1px solid var(--border);border-radius:var(--radius-lg,12px);background:var(--surface-2);padding:12px;min-width:0;}
.hp-canvas{position:relative;margin-inline:auto;width:100%;max-width:100%;min-height:80px;overflow:hidden;direction:ltr;}
.hp[data-width="phone"] .hp-canvas{width:375px;}
/* the page itself is always drawn on white, in the light and the dark theme */
/* the frame is given the height of its page (js fit()); this height only shows while it loads */
.hp-frame{display:block;width:100%;height:320px;border:1px solid var(--border);border-radius:8px;background:#fff;color-scheme:light;transform-origin:top left;box-sizing:border-box;}
.hp[data-state="loading"] .hp-frame{visibility:hidden;}
.hp-loading{position:absolute;inset:0;display:none;align-items:center;justify-content:center;border-radius:8px;background:#fff;color:#4b5563;font-size:13px;}
.hp[data-state="loading"] .hp-loading{display:flex;}
.hp-loading::before{content:"";width:16px;height:16px;margin-inline-end:10px;border:2px solid #d1d5db;border-top-color:var(--pink-dark);border-radius:50%;animation:hp-spin .8s linear infinite;}
@keyframes hp-spin{to{transform:rotate(360deg);}}
.hp-code{margin:0;padding:14px 16px;border-radius:8px;background:var(--surface);border:1px solid var(--border);color:var(--text);font-family:var(--font-mono,ui-monospace,monospace);font-size:12.5px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left;}
.hp-code[hidden],.hp-canvas[hidden]{display:none;}
.hp-note{padding:6px 4px;color:var(--text-muted);font-size:13px;}
.hp-note:not([hidden]) + .hp-code, .hp-code:not([hidden]) ~ .hp-note{margin-block-start:8px;}
@media (max-width:640px){
  .hp-stage{padding:8px;}
  .hp-seg{flex:1 1 auto;}
  .hp-btn{flex:1 1 0;padding:0 10px;}
}
@media (prefers-reduced-motion:reduce){ .hp-loading::before{animation:none;} }
/* History file page */
.hx .dp-preview.dp-html{display:block;padding:12px;}
.hx .dp-htmlview{width:100%;min-width:0;}
.hx .dp-textview .dp-htmlview{margin-block-end:14px;}
/* Studio result: the preview and the plain-text copy under it share the flex row of #resultPreview; stack them, so the page gets the full width */
/* no box of its own that scrolls: the whole result screen scrolls (also under the several-files layout, which limits other previews) */
.result-preview:has(> .hp), .result-view.has-groups .result-preview:has(> .hp){flex-direction:column;align-items:stretch;justify-content:flex-start;gap:12px;max-height:none;overflow:visible;}
.result-preview:has(> .hp) > .hp{flex:none;}
