/*
 * Shared front-end frame. Scoped to shell profiles to avoid changing WP Admin
 * and to keep Gestão Conecta free to retain its operational composition.
 */
body.cc-shell--portal,
body.cc-shell--reader {
  --conecta-app-template-page-max: var(--cc-shell-page-max);
  --conecta-app-template-page-gutter: var(--cc-shell-page-gutter);
  --conecta-app-template-shell-width: min(var(--cc-shell-page-max), calc(100% - (var(--cc-shell-page-gutter) * 2)));
  --conecta-global-footer-gap: var(--cc-shell-content-footer-gap);
  --conecta-global-footer-gap-mobile: var(--cc-shell-content-footer-gap);
  overflow-x: clip !important;
}

body.cc-shell--portal #conecta-public-app-template,
body.cc-shell--reader #conecta-public-app-template {
  width: 100% !important;
  min-height: 100dvh !important;
  overflow-x: clip !important;
}

/* The public template historically escaped theme wrappers with 100vw. The
   shell restores a bounded canvas on mobile, preventing iOS horizontal canvas
   expansion while preserving the desktop Community sticky contract. */
body.conecta-app-template-page.cc-shell--portal .conecta-app,
body.conecta-app-template-page.cc-shell--portal .conecta-profile-edit-view,
body.conecta-app-template-page.cc-shell--portal .conecta-profile-public-view,
body.conecta-app-template-page.cc-shell--portal .conecta-profile-directory-view,
body.cc-shell--portal:not(.conecta-app-template-page) .conecta-app,
body.cc-shell--portal:not(.conecta-app-template-page) .conecta-profile-edit-view,
body.cc-shell--portal:not(.conecta-app-template-page) .conecta-profile-public-view,
body.cc-shell--portal:not(.conecta-app-template-page) .conecta-profile-directory-view {
  --cc-shell-frame-padding: 24px;
  min-height: 100dvh !important;
  box-sizing: border-box !important;
}

@media (max-width: 767px) {
  body.conecta-app-template-page.cc-shell--portal .conecta-app,
  body.conecta-app-template-page.cc-shell--portal .conecta-profile-edit-view,
  body.conecta-app-template-page.cc-shell--portal .conecta-profile-public-view,
  body.conecta-app-template-page.cc-shell--portal .conecta-profile-directory-view,
  body.conecta-app-template-page.cc-shell--portal .conecta-app.conecta-community-view,
  body.cc-shell--portal:not(.conecta-app-template-page) .conecta-app,
  body.cc-shell--portal:not(.conecta-app-template-page) .conecta-profile-edit-view,
  body.cc-shell--portal:not(.conecta-app-template-page) .conecta-profile-public-view,
  body.cc-shell--portal:not(.conecta-app-template-page) .conecta-profile-directory-view {
    --cc-shell-frame-padding: var(--cc-shell-page-gutter);
    width: 100% !important;
    max-width: none !important;
    min-height: 100dvh !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: var(--cc-shell-frame-padding) !important;
    padding-right: var(--cc-shell-frame-padding) !important;
    box-sizing: border-box !important;
  }

  /* Do not manufacture a nested scroller for the Community on phones. The
     module keeps ownership of desktop sticky columns; the mobile frame remains
     in normal document flow. */
  body.conecta-app-template-page.cc-shell--portal .conecta-app.conecta-community-view {
    overflow-x: clip !important;
    overflow-y: visible !important;
  }
}

/* Gestão Conecta receives only the profile marker and neutral primitive
   variables in this release. Its sidebar/topbar are intentionally untouched. */
body.cc-shell--management {
  --cc-shell-page-gutter: 24px;
  --cc-shell-touch-target: 44px;
}
