/* Mobile calendar pinch: keep vertical appointment density in step with horizontal zoom.
   Applies to portrait phones and short landscape touch screens, not desktop. */
@media (max-width:620px), (orientation:landscape) and (max-height:600px) and (pointer:coarse){
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) > .cal-cell:not(.cal-head){
    min-height:calc(var(--calendar-row-height,64px) * var(--calendar-mobile-height-scale,1))!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event[data-appointment-id]{
    min-height:calc(66px * var(--calendar-mobile-height-scale,1))!important;
    height:auto!important;
    padding:calc(6px * var(--calendar-mobile-height-scale,1)) calc(7px * var(--calendar-mobile-height-scale,1))!important;
    gap:calc(2px * var(--calendar-mobile-height-scale,1))!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event.attendance-due{
    min-height:calc(94px * var(--calendar-mobile-height-scale,1))!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .event-time{
    font-size:clamp(8px,calc(10px * var(--calendar-mobile-height-scale,1)),15px)!important;
    line-height:1.12!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .event-client{
    font-size:clamp(9px,calc(11px * var(--calendar-mobile-height-scale,1)),15px)!important;
    line-height:1.12!important;
    margin-top:0!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .event-worker{
    font-size:clamp(8px,calc(9px * var(--calendar-mobile-height-scale,1)),12px)!important;
    margin-top:0!important;
    line-height:1.1!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .event-service{
    font-size:clamp(8px,calc(9px * var(--calendar-mobile-height-scale,1)),13px)!important;
    padding:calc(1px * var(--calendar-mobile-height-scale,1)) 4px!important;
    margin-top:0!important;
    line-height:1.1!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .event-status-tag{
    margin-top:calc(1px * var(--calendar-mobile-height-scale,1))!important;
    padding-top:1px!important;
    padding-bottom:1px!important;
    font-size:clamp(7px,calc(8px * var(--calendar-mobile-height-scale,1)),11px)!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .calendar-attendance-actions{
    margin-top:calc(3px * var(--calendar-mobile-height-scale,1))!important;
    padding-top:calc(3px * var(--calendar-mobile-height-scale,1))!important;
    gap:3px!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .cal-cell .event .calendar-attendance-actions button{
    min-height:22px!important;
    height:22px!important;
    font-size:9px!important;
  }
  #calendar #calendarGrid.calendar-grid.half-hour:not(.calendar-month-grid) .calendar-parallel-event-row{
    margin-top:calc(2px * var(--calendar-mobile-height-scale,1))!important;
  }
}

/* Preserve one-finger scroll and allow an already enlarged iPhone page to shrink. */
html.iphone-page-zoomed{
  --calendar-scroll-touch-action:auto;
}
html:is(.iphone-app,.ios-standalone-app):not(.iphone-page-zoomed),
html:is(.iphone-app,.ios-standalone-app):not(.iphone-page-zoomed) body{
  touch-action:pan-x pan-y;
}
@media (max-width:620px), (orientation:landscape) and (max-height:600px) and (pointer:coarse){
  html:not(.iphone-page-zoomed):has(#calendar.page.active),
  html:not(.iphone-page-zoomed) body:has(#calendar.page.active),
  html:not(.iphone-page-zoomed) #calendar.page.active .calendar-scroll,
  html:not(.iphone-page-zoomed) #calendar.page.active{
    touch-action:pan-x pan-y;
  }
}
