/*
 * Local Safari 27.3 composer-render workaround for the OpenClaw Control UI.
 *
 * Symptom: in Safari 27.3 (macOS 27.3) the chat composer occasionally fails to
 * paint entirely or flickers while the transcript is wheel-scrolled. Chrome on
 * the same machine is fine. Upstream: openclaw/openclaw issues #195192 and
 * #193796 (dark-appearance composer visibility), unfixed as of 2026.11.2.
 *
 * Measured on 2026.11.x: every transcript scroll frame re-renders the composer
 * footer (virtualizer + layout-sync listeners), which repaints the composer
 * dozens of times per frame. The composer uses the brand-new
 * `corner-shape: superellipse(1.5)` paint path (Safari 27 only), and Safari
 * 27.3 repaints that path unreliably -> blank/flickering composer.
 *
 * This stylesheet only changes painting, never behaviour:
 *   1. falls back from superellipse corners to plain rounded corners in the
 *      composer area (visually almost identical; Chrome already renders this way)
 *   2. promotes the composer to a stable compositing layer
 *   3. stops `content-visibility:auto` from blanking rows during wheel scrolls
 *
 * Re-apply after an OpenClaw update (the update replaces index.html and the
 * installed assets). Script: ~/Documents/deepseek-harness/default-workspace/.oc-diag/oc-ui-fix/apply.sh
 */
@supports (hanging-punctuation: first) {
  /* 1. Safari 27.3 cannot reliably repaint superellipse corners while the
        composer area is being re-rendered. Use plain rounded corners there. */
  .chat-footer,
  .chat-footer *,
  .agent-chat__input,
  .agent-chat__input *,
  .chat-composer-neighbor-card,
  .chat-session-rail__composer {
    corner-shape: round !important;
  }
  .chat-footer::before,
  .chat-footer::after,
  .chat-footer *::before,
  .chat-footer *::after,
  .agent-chat__input::before,
  .agent-chat__input::after,
  .agent-chat__input *::before,
  .agent-chat__input *::after {
    corner-shape: round !important;
  }

  /* 2. Stable compositing layers for the composer area. `will-change` does not
        create a containing block, so menus and popovers keep their placement. */
  .chat-footer,
  .agent-chat__input {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    isolation: isolate;
  }

  /* 3. Safari can blank rows scrolled into view with content-visibility:auto. */
  .chat-virtual-row,
  .chat-thread-inner--virtual {
    content-visibility: visible !important;
  }

  /* 4. The fade above the footer repaints with the composer; keep it cheap. */
  .chat-footer::before {
    will-change: opacity;
  }
}
