/* ========================================================================
   Oficina Portátil V75.26
   SAFARI iOS — estabilidade sem interferir no transform da Sidebar
   ======================================================================== */

:root{
  --op-ios-glass-light-rgb:244,249,248;
  --op-ios-glass-dark-rgb:9,24,24;
  --op-ios-glass-light-alpha:.82;
  --op-ios-glass-dark-alpha:.78;
}

/*
 * IMPORTANTE:
 * NÃO definir transform / translate3d / will-change:transform na sidebar.
 * O aplicativo usa transform para abrir e fechar o drawer.
 */
html.op-ios-safari :is(
  .topbar,
  .op-topbar,
  .topbar-shell,
  .app-topbar,
  .mobile-topbar,
  .sidebar,
  .op-sidebar,
  .app-sidebar,
  .drawer,
  .side-drawer,
  .navigation-drawer,
  .notification-portal-host > .notification-popover,
  .op-appearance-popover,
  .op-profile-popover,
  .sap-global-overlay .sap-global-modal,
  .op-workspace-dialog,
  .op-workspace-popover,
  .modal-content,
  .dialog-content,
  [role="dialog"]
){
  isolation:isolate!important;
  background-clip:padding-box!important;
  -webkit-backface-visibility:hidden!important;
  backface-visibility:hidden!important;
  will-change:opacity, -webkit-backdrop-filter, backdrop-filter!important;
}

/* Não usar contain:paint nos drawers: também pode mudar clipping/stacking no Safari. */
html.op-ios-safari :is(
  .sidebar,
  .op-sidebar,
  .app-sidebar,
  .drawer,
  .side-drawer,
  .navigation-drawer
){
  contain:none!important;
}

/* Base visual persistente para impedir o flash transparente durante scroll. */
html.op-ios-safari:not([data-theme="dark"]) :is(
  .topbar,
  .op-topbar,
  .topbar-shell,
  .app-topbar,
  .mobile-topbar,
  .sidebar,
  .op-sidebar,
  .app-sidebar,
  .drawer,
  .side-drawer,
  .navigation-drawer,
  .notification-portal-host > .notification-popover,
  .op-appearance-popover,
  .op-profile-popover,
  .sap-global-overlay .sap-global-modal,
  .op-workspace-dialog,
  .op-workspace-popover,
  .modal-content,
  .dialog-content,
  [role="dialog"]
){
  background-color:rgba(var(--op-ios-glass-light-rgb),var(--op-ios-glass-light-alpha))!important;
}

html.op-ios-safari[data-theme="dark"] :is(
  .topbar,
  .op-topbar,
  .topbar-shell,
  .app-topbar,
  .mobile-topbar,
  .sidebar,
  .op-sidebar,
  .app-sidebar,
  .drawer,
  .side-drawer,
  .navigation-drawer,
  .notification-portal-host > .notification-popover,
  .op-appearance-popover,
  .op-profile-popover,
  .sap-global-overlay .sap-global-modal,
  .op-workspace-dialog,
  .op-workspace-popover,
  .modal-content,
  .dialog-content,
  [role="dialog"]
){
  background-color:rgba(var(--op-ios-glass-dark-rgb),var(--op-ios-glass-dark-alpha))!important;
}

/* Topbar/Sidebar continuam usando o material já aprovado do core. */
html.op-ios-safari :is(
  .topbar,
  .op-topbar,
  .topbar-shell,
  .app-topbar,
  .mobile-topbar,
  .sidebar,
  .op-sidebar,
  .app-sidebar,
  .drawer,
  .side-drawer,
  .navigation-drawer
){
  -webkit-backdrop-filter:
    blur(var(--op-lg-blur,8px))
    saturate(var(--op-lg-saturation,.8))
    contrast(var(--op-lg-contrast,1.4))!important;
  backdrop-filter:
    blur(var(--op-lg-blur,8px))
    saturate(var(--op-lg-saturation,.8))
    contrast(var(--op-lg-contrast,1.4))!important;
}

/* Popups usam exclusivamente as variáveis do Popup Glass Lab. */
html.op-ios-safari :is(
  .notification-portal-host > .notification-popover,
  .op-appearance-popover,
  .op-profile-popover,
  .sap-global-overlay .sap-global-modal,
  .op-workspace-dialog,
  .op-workspace-popover,
  .modal-content,
  .dialog-content,
  [role="dialog"]
){
  -webkit-backdrop-filter:
    blur(var(--op-pg-blur,3px))
    saturate(var(--op-pg-saturation,1.45))
    contrast(var(--op-pg-contrast,.7))!important;
  backdrop-filter:
    blur(var(--op-pg-blur,3px))
    saturate(var(--op-pg-saturation,1.45))
    contrast(var(--op-pg-contrast,.7))!important;
}

/* Durante rolagem, aumenta só a base do material. Nenhum transform é alterado. */
html.op-ios-safari.op-ios-safari-scrolling:not([data-theme="dark"]) :is(
  .topbar,.op-topbar,.topbar-shell,.app-topbar,.mobile-topbar,
  .sidebar,.op-sidebar,.app-sidebar,.drawer,.side-drawer,.navigation-drawer,
  .notification-portal-host > .notification-popover,.op-appearance-popover,
  .op-profile-popover,.sap-global-overlay .sap-global-modal
){
  background-color:rgba(var(--op-ios-glass-light-rgb),.88)!important;
}

html.op-ios-safari.op-ios-safari-scrolling[data-theme="dark"] :is(
  .topbar,.op-topbar,.topbar-shell,.app-topbar,.mobile-topbar,
  .sidebar,.op-sidebar,.app-sidebar,.drawer,.side-drawer,.navigation-drawer,
  .notification-portal-host > .notification-popover,.op-appearance-popover,
  .op-profile-popover,.sap-global-overlay .sap-global-modal
){
  background-color:rgba(var(--op-ios-glass-dark-rgb),.84)!important;
}
