/* Shared functional surfaces. Presentation only: never change display, open,
 * hidden/inert states, positioning, scrolling, focus handling or form data. */
html body.wp-theme-psyguild-theme{
 --pg-system-canvas:color-mix(in srgb,var(--pg-primary) 3%,var(--pg-bg-soft));
 --pg-system-inset:color-mix(in srgb,var(--pg-primary) 3%,var(--pg-block-bg));
 --pg-system-line:color-mix(in srgb,var(--pg-primary) 12%,var(--pg-brand-line));
 --pg-system-shadow:0 8px 28px color-mix(in srgb,var(--pg-primary-deep) 7%,transparent);
 --pg-system-dialog-shadow:0 18px 60px color-mix(in srgb,var(--pg-brand-ink) 22%,transparent);
 --pg-system-scrim:color-mix(in srgb,var(--pg-brand-ink) 54%,transparent);
}
html body.wp-theme-psyguild-theme.pg-theme-dark{
 --pg-system-canvas:color-mix(in srgb,var(--pg-block-bg) 76%,var(--pg-brand-ink));
 --pg-system-line:color-mix(in srgb,var(--pg-primary) 10%,var(--pg-brand-line));
 --pg-system-shadow:0 8px 28px color-mix(in srgb,var(--pg-brand-ink) 28%,transparent);
 --pg-system-dialog-shadow:0 18px 60px color-mix(in srgb,var(--pg-brand-ink) 46%,transparent);
}

/* Explicit panel list: leave overlay containers clear. Preserve each module's
 * desktop dialog / mobile sheet or full-screen geometry. */
html body.wp-theme-psyguild-theme :is(.pg-auth-card,.pg-auth-modal-card,.pg-modal-card,.pg-popup-content,.pg-community-dialog,.pg-channels-dialog,.pg-post-detail,.pg-contributor-request-modal__dialog,.pg-author-stats-modal__dialog,.pg-author-manager__dialog-panel,.pg-admin-author-modal__dialog,.pg-drive,.pg-credit-modal,.pg-onboarding-dialog,.pg-management-sheet,.pg-personal-nav-sheet,.psyguild-assessment-info-dialog__panel,.psyguild-assessment-auth__panel,.psyguild-result-modal__panel){
 box-sizing:border-box;
 background-color:var(--pg-block-bg)!important;
 background-image:radial-gradient(ellipse at 100% 0,color-mix(in srgb,var(--pg-primary) 6%,transparent),transparent 340px)!important;
 border-color:var(--pg-system-line)!important;
 color:var(--pg-text)!important;
 box-shadow:var(--pg-system-dialog-shadow)!important;
}
html body.wp-theme-psyguild-theme :is(.pg-header-account__menu,.pg-search-dropdown,.pg-publish-split__menu,.pg-editor-layout-menu[open]){
 background-color:var(--pg-block-bg)!important;
 border-color:var(--pg-system-line)!important;
 box-shadow:var(--pg-system-shadow)!important;
}

/* Quiet heading layer, without injecting an extra header or wrapping forms. */
html body.wp-theme-psyguild-theme :is(.pg-community-dialog,.pg-channels-dialog,.pg-post-detail)>header,
html body.wp-theme-psyguild-theme :is(.pg-drive__header,.pg-admin-author-modal__header,.pg-author-manager__dialog-head,.pg-contributor-request-modal__top,.pg-credit-modal-head,.pg-management-sheet__head,.pg-popup-header){
 background-color:var(--pg-system-inset)!important;
 border-color:var(--pg-system-line)!important;
 border-radius:8px;
}
html body.wp-theme-psyguild-theme :is(.pg-community-dialog,.pg-channels-dialog,.pg-post-detail)>header,
html body.wp-theme-psyguild-theme :is(.pg-credit-modal-head,.pg-popup-header){padding:12px;}
html body.wp-theme-psyguild-theme :is(.pg-auth-card,.pg-auth-modal-card,.pg-modal-card,.pg-popup-content,.pg-community-dialog,.pg-channels-dialog,.pg-post-detail,.pg-contributor-request-modal__dialog,.pg-author-stats-modal__dialog,.pg-author-manager__dialog-panel,.pg-admin-author-modal__dialog,.pg-drive,.pg-credit-modal,.pg-onboarding-dialog,.pg-management-sheet,.psyguild-assessment-info-dialog__panel,.psyguild-assessment-auth__panel) :is(h1,h2,h3,h4,legend){color:var(--pg-text)!important;}
html body.wp-theme-psyguild-theme .pg-credit-modal :is(p,label):not([role="alert"]):not([data-credit-status]):not(.is-error):not(.error){color:var(--pg-muted)!important;}

/* One scrim for native dialogs and existing div-based modals. No large blur
 * layer on mobile; overlay visibility and click handling stay module-owned. */
html body.wp-theme-psyguild-theme :is(.pg-community-dialog,.pg-channels-dialog,.pg-post-detail,.pg-drive,.pg-credit-modal,.pg-management-sheet)::backdrop,
html body.wp-theme-psyguild-theme :is(.pg-popup-overlay,.pg-auth-modal-backdrop,.pg-contributor-request-modal,.pg-author-stats-modal,.pg-admin-author-modal__backdrop,.pg-author-manager__dialog-backdrop,.psyguild-assessment-info-dialog__backdrop,.psyguild-assessment-auth__backdrop){
 background:var(--pg-system-scrim)!important;
 backdrop-filter:none!important;
 -webkit-backdrop-filter:none!important;
}

/* Remaining operation screens and inset blocks; preserve grids, status
 * colours, article typography, print geometry and the runner state. */
html body.wp-theme-psyguild-theme :is(.pg-review-workspace,.psyguild-assessment-app){background-color:var(--pg-system-canvas)!important;}
html body.wp-theme-psyguild-theme :is(.pg-review-header,.pg-review-sidebar,.pg-review-content,.pg-review-thread,.pg-report-credit-panel,.psyguild-assessment-question,.psyguild-assessment-result,.psyguild-assessment-history-panel,.psyguild-assessment-library-sidebar,.psyguild-assessment-library-results){background-color:var(--pg-block-bg)!important;border-color:var(--pg-system-line)!important;}
html body.wp-theme-psyguild-theme :is(.pg-community-verification,.pg-community-response-box,.pg-drive__permission,.pg-drive__locations,.pg-drive__details,.pg-drive__footer,.pg-author-stats-modal__metric,.pg-admin-author-modal__scope,.pg-channels-data-policy,.pg-credit-package,.psyguild-assessment-info-dialog__guidance,.psyguild-assessment-info-dialog__section){background-color:var(--pg-system-inset)!important;border-color:var(--pg-system-line)!important;}
html body.wp-theme-psyguild-theme .pg-comments-area .comment-respond{padding:clamp(16px,2vw,24px);border:1px solid var(--pg-system-line);border-radius:12px;background-color:var(--pg-system-inset);}
html body.wp-theme-psyguild-theme .pg-portal-commerce :is(.woocommerce-customer-details,.woocommerce-order-details,.woocommerce-Address,.cart_totals,#order_review,#payment,form.woocommerce-EditAccountForm,form.woocommerce-form-login){background-color:var(--pg-block-bg)!important;border-color:var(--pg-system-line)!important;}

/* Text fields only. Hidden inputs, checkboxes, radios, file pickers, content
 * editors and native semantic errors keep their original presentation. */
html body.wp-theme-psyguild-theme :is(.pg-portal-main,.pg-auth-card,.pg-auth-modal-card,.pg-modal-card,.pg-popup-content,.pg-community,.pg-community-dialog,.pg-channels-dialog,.pg-post-detail,.pg-contributor-request-modal__dialog,.pg-author-stats-modal__dialog,.pg-author-manager__dialog-panel,.pg-admin-author-modal__dialog,.pg-drive,.pg-credit-modal,.pg-report-credit-panel,.pg-comments-area,.pg-onboarding-dialog,.pg-management-sheet,.pg-personal-nav-sheet,.psyguild-assessment-auth,.psyguild-assessment-auth__panel,.psyguild-assessment-info-dialog__panel,.psyguild-result-modal__panel,.media-modal) :is(input:not([type]),input[type="text"],input[type="email"],input[type="url"],input[type="search"],input[type="number"],input[type="tel"],input[type="password"],input[type="date"],input[type="datetime-local"],select,textarea):not(:where(.wp-editor-wrap *,.mce-container *,.tox *,.wp-editor-area,.code)){background-color:var(--pg-system-inset)!important;color:var(--pg-text)!important;}
html body.wp-theme-psyguild-theme :is(.pg-portal-main,.pg-auth-card,.pg-auth-modal-card,.pg-modal-card,.pg-popup-content,.pg-community,.pg-community-dialog,.pg-channels-dialog,.pg-post-detail,.pg-contributor-request-modal__dialog,.pg-author-stats-modal__dialog,.pg-author-manager__dialog-panel,.pg-admin-author-modal__dialog,.pg-drive,.pg-credit-modal,.pg-report-credit-panel,.pg-comments-area,.pg-onboarding-dialog,.pg-management-sheet,.pg-personal-nav-sheet,.psyguild-assessment-auth,.psyguild-assessment-auth__panel,.psyguild-assessment-info-dialog__panel,.psyguild-result-modal__panel,.media-modal) :is(input:not([type]),input[type="text"],input[type="email"],input[type="url"],input[type="search"],input[type="number"],input[type="tel"],input[type="password"],input[type="date"],input[type="datetime-local"],select,textarea):not([aria-invalid="true"]):not(.is-error):not(.error):not(:where(.woocommerce-invalid *,.is-error *,.wp-editor-wrap *,.mce-container *,.tox *,.wp-editor-area,.code)){border-color:var(--pg-system-line)!important;}

/* Media Library may mount outside main on the frontend. Frame only: leave
 * attachment thumbnails, editing canvas and iframe contents native. */
html body.wp-theme-psyguild-theme .media-modal :is(.media-modal-content,.media-frame-title,.media-frame-content,.media-frame-toolbar .media-toolbar){background-color:var(--pg-block-bg)!important;color:var(--pg-text)!important;border-color:var(--pg-system-line)!important;}
html body.wp-theme-psyguild-theme .media-modal :is(.media-sidebar,.media-frame-menu,.media-frame-router,.attachments-browser .media-toolbar){background-color:var(--pg-system-inset)!important;border-color:var(--pg-system-line)!important;}
html body.wp-theme-psyguild-theme .media-modal :is(h1,h2,h3,label,legend,.media-menu-item,.media-router a,.media-modal-close,.attachment-details .filename,.attachment-details .details){color:var(--pg-text)!important;}
html body.wp-theme-psyguild-theme .media-modal :is(.media-menu-item,.media-router a){background-color:transparent!important;}
html body.wp-theme-psyguild-theme .media-modal :is(.media-menu-item.is-active,.media-menu-item.active,.media-router a.active){background-color:var(--pg-block-bg)!important;border-color:var(--pg-system-line)!important;}
html body.wp-theme-psyguild-theme .media-modal .media-modal-icon::before{color:var(--pg-text)!important;}
html body.wp-theme-psyguild-theme .media-modal :is(input,textarea)::placeholder{color:var(--pg-muted);opacity:1;}

@media(max-width:767.98px){
 /* Existing safe-area padding, edge-to-edge Drive, rounded sheets and app
  * navigation stay intact. No new fixed layer on the page. */
 html body.wp-theme-psyguild-theme :is(.pg-community-dialog,.pg-channels-dialog,.pg-post-detail)>header,
 html body.wp-theme-psyguild-theme :is(.pg-credit-modal-head,.pg-popup-header){padding:10px;}
}
@media print{html body.wp-theme-psyguild-theme{--pg-system-dialog-shadow:none;--pg-system-shadow:none;}}
