/* Keep the Portal independent from theme content-width and template chrome. */
body.wce-portal-page .wp-site-blocks,
body.wce-portal-page .entry-content,
body.wce-portal-page .wp-block-post-content,
body.wce-portal-page .wp-block-group.alignfull {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.wce-portal-page header.wp-block-template-part,
body.wce-portal-page footer.wp-block-template-part,
body.wce-portal-page .wp-block-post-title {
  display: none !important;
}

body.wce-portal-page .wce-portal-shell,
body.wce-portal-page .wce-login-wrap {
  position: relative;
  left: 50%;
  width: calc(100vw - 32px);
  max-width: none !important;
  margin: 16px 0 !important;
  transform: translateX(-50%);
  box-sizing: border-box;
}

/* The site theme must never restyle or enlarge the WCE sidebar control. */
@media (min-width: 901px) {
  body.wce-portal-page .wce-sidebar-toggle {
    position: absolute !important;
    z-index: 80 !important;
    top: 18px !important;
    right: -19px !important;
    display: grid !important;
    place-items: center !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 2px solid #fff !important;
    border-radius: 10px !important;
    background: #e85d32 !important;
    color: #fff !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28) !important;
    transform: none !important;
    line-height: 1 !important;
  }

  body.wce-portal-page .wce-sidebar-toggle:hover,
  body.wce-portal-page .wce-sidebar-toggle:focus,
  body.wce-portal-page .wce-sidebar-toggle:active {
    border-color: #fff !important;
    background: #cf4d27 !important;
    color: #fff !important;
    opacity: 1 !important;
    outline: 3px solid rgba(232, 93, 50, .24) !important;
    outline-offset: 2px !important;
  }

  body.wce-portal-page .wce-sidebar-toggle .dashicons {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    font-size: 20px !important;
    line-height: 20px !important;
    text-align: center !important;
    opacity: 1 !important;
  }
}

/* Dedicated attendance mode: the lesson header replaces general dashboard chrome. */
.wce-portal-shell:has(.wce-attendance-mode) .wce-topbar,
.wce-portal-shell:has(.wce-attendance-mode) .wce-manager-mobile-menu {
  display: none;
}

.wce-portal-shell:has(.wce-attendance-mode) .wce-main {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 0 18px 18px 0;
  background: #f3f4f6;
}

.wce-portal-shell:has(.wce-attendance-mode) {
  overflow: visible;
}

.wce-portal-shell:has(.wce-attendance-mode) .wce-sidebar {
  z-index: 2;
  overflow: visible;
  border-radius: 18px 0 0 18px;
}

.wce-portal-shell:has(.wce-attendance-mode) .wce-sidebar-toggle {
  z-index: 40;
}

.wce-portal-shell:has(.wce-attendance-mode) .wce-content {
  width: 100%;
  max-width: none;
  padding: 0 clamp(16px, 2.2vw, 34px) 34px;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  body.wce-portal-page .wce-portal-shell,
  body.wce-portal-page .wce-login-wrap {
    left: auto;
    width: calc(100% - 32px);
    margin: 16px auto !important;
    transform: none;
  }

  body.wce-portal-page .wce-mobile-nav {
    position: fixed !important;
    z-index: 10020 !important;
    inset: auto 0 0 0 !important;
    width: auto !important;
    min-height: 72px !important;
    max-height: calc(88px + env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-transform: translate3d(0, 0, 0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    box-sizing: border-box !important;
  }

  body.wce-portal-page .wce-mobile-nav a,
  body.wce-portal-page .wce-mobile-nav .wce-mobile-more-toggle {
    min-height: 56px !important;
    max-height: 64px !important;
    margin: 0 !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
  }

  body.wce-portal-page .wce-content {
    padding-bottom: calc(118px + env(safe-area-inset-bottom)) !important;
  }

  .wce-portal-shell:has(.wce-attendance-mode) .wce-main {
    border-radius: 18px;
  }
}

@media (max-width: 600px) {
  body.wce-portal-page .wce-portal-shell,
  body.wce-portal-page .wce-login-wrap {
    width: 100vw;
    margin: 0 !important;
    border-radius: 0;
  }

  .wce-portal-shell:has(.wce-attendance-mode) .wce-main {
    border-radius: 0;
  }
}
