/* ==========================================================================
   Browser compatibility layer (loaded last): fallbacks for features that older Safari / Firefox / Edge versions lack.
   Everything here is progressive: modern browsers ignore the @supports blocks and use the real rules.
   ========================================================================== */

/* color-mix() (Safari < 16.2, Chrome < 111, Firefox < 113): plain token colors instead of mixed ones */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .app-topbar::before { background: var(--surface); }
    .data-table tbody tr:hover, .table-body tr:not(.table-header):hover td { background: var(--primary-soft); }
    .ed-mini { background: var(--surface); }
    .ed-node.is-selected { box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-3); }
    .mod-menu .icon-btn { background: var(--surface); }
    .btn--danger:hover { filter: brightness(.9); }
    mark { background: var(--warning-soft); }
    @keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--warning-soft); } }
}

/* viewport units that follow the visible area on mobile browsers (iOS Safari address bar) */
@supports (height: 100dvh) {
    #editor-area { height: calc(100dvh - var(--topbar-h)); }
    .auth { min-height: 100dvh; }
}

/* overlays: top/right/bottom/left for browsers without the `inset` shorthand (Safari < 14.1) */
.ui-modal-backdrop, .drawer-wrap, .drawer-scrim, .sim-overlay, .palette, .drawer-backdrop, .app-topbar::before { top: 0; right: 0; bottom: 0; left: 0; }

/* Safari: sticky needs the prefixed value, form controls need appearance reset, search field decoration */
.app-topbar { position: -webkit-sticky; position: sticky; }
.is-workspace .app-topbar { position: fixed; }
select, input[type=search], input[type=text], input[type=password], input[type=email], input[type=number], input[type=tel], input[type=url], input:not([type]), textarea { -webkit-appearance: none; -moz-appearance: none; appearance: none; border-radius: var(--radius-sm); }
input[type=search]::-webkit-search-decoration, input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
.btn, .tab, .nav-item, .ed-graph, .ch__tools button { -webkit-user-select: none; user-select: none; }
button, a, label, select, .btn { -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }

/* iOS Safari zooms the page when an input smaller than 16px gets focus */
@media (max-width: 900px) {
    input, select, textarea { font-size: 16px; }
}
