/* MUI Kabupaten Subang - CHAT UX v0.3.1 - staging only.
 * This stylesheet is loaded only when WordPress home URL is precisely
 * staging.muisubang.com; it never replaces backend consultation handlers.
 * Retains the original modal visibility/open-close logic.
 */

/* Existing consultation widget remains in DOM, clickable and keyboard focusable.
 * A compact label is injected by staging-chat.js to avoid showing an unverified
 * ONLINE claim. If JS fails, original button stays visible with safe bounds.
 */
body #muiChatTrigger.mui-chat-trigger-btn {
  position:fixed !important;
  top:auto !important;
  left:auto !important;
  right:14px !important;
  bottom:calc(18px + env(safe-area-inset-bottom, 0px) + var(--mui-prd-chat-lift, 0px)) !important;
  z-index:9998 !important;
  width:auto !important;
  max-width:min(210px, calc(100vw - 28px)) !important;
  min-width:56px !important;
  min-height:48px !important;
  border-radius:999px !important;
  padding:10px 15px !important;
  box-sizing:border-box !important;
  white-space:nowrap;
  box-shadow:0 8px 22px rgba(0,35,17,.25) !important;
  touch-action:manipulation;
}
body #muiChatTrigger.mui-chat-trigger-btn.muisubang-prd-chat-enhanced {
  font-size:0 !important;
  color:transparent !important;
  gap:0 !important;
}
body #muiChatTrigger.mui-chat-trigger-btn.muisubang-prd-chat-enhanced > :not(.muisubang-prd-chat-label) {
  display:none !important;
}
body #muiChatTrigger.mui-chat-trigger-btn.muisubang-prd-chat-enhanced::before,
body #muiChatTrigger.mui-chat-trigger-btn.muisubang-prd-chat-enhanced::after { content:none !important; }
body #muiChatTrigger .muisubang-prd-chat-label {
  display:inline-flex !important;
  align-items:center;
  gap:8px;
  color:#fff !important;
  font-size:14px !important;
  font-weight:750 !important;
  line-height:1.2;
}
body #muiChatTrigger:focus-visible,
body #muiChatModal :is(button,a,input,textarea,select):focus-visible {
  outline:3px solid #f5d17c !important;
  outline-offset:3px !important;
}

/* The original chat modal is neither hidden nor force-opened. Its own JS
 * decides display/opacity/visibility. These styles only constrain geometry.
 */
body #muiChatModal.mui-chat-modal {
  position:fixed !important;
  inset:auto 12px calc(12px + env(safe-area-inset-bottom, 0px)) auto !important;
  width:min(410px, calc(100vw - 24px)) !important;
  max-width:calc(100vw - 24px) !important;
  height:min(690px, calc(100dvh - 30px - env(safe-area-inset-bottom, 0px))) !important;
  max-height:calc(100dvh - 30px - env(safe-area-inset-bottom, 0px)) !important;
  box-sizing:border-box !important;
  border-radius:18px !important;
  z-index:9999 !important;
  overflow:hidden;
  overscroll-behavior:contain;
}
body #muiChatModal .muisubang-prd-chat-note {
  padding:10px 14px;
  background:#ecf5ef;
  color:#183a29;
  border-bottom:1px solid #bed7c5;
  font-size:12px;
  line-height:1.5;
}
body #muiChatModal .muisubang-prd-chat-note a {
  color:#10502e;
  font-weight:700;
  text-decoration:underline;
  text-underline-offset:2px;
}
body #muiChatModal .muisubang-prd-chat-note p { margin:0 0 5px; }
body #muiChatModal .muisubang-prd-chat-note p:last-child { margin-bottom:0; }
body #muiChatModal :is(input,textarea,select) { box-sizing:border-box;max-width:100%; }
body #muiChatModal :is(button,input,select) { min-height:44px; }
body #muiChatModal textarea { min-height:72px; }
body #muiChatModal .mui-chat-header button { min-width:44px; min-height:44px; }
@media (max-width:600px) {
  body #muiChatTrigger.mui-chat-trigger-btn {
    right:12px !important;
    bottom:calc(15px + env(safe-area-inset-bottom, 0px) + var(--mui-prd-chat-lift, 0px)) !important;
    width:52px !important;
    max-width:52px !important;
    min-width:52px !important;
    height:52px !important;
    min-height:52px !important;
    border-radius:50% !important;
    padding:0 !important;
    justify-content:center !important;
  }
  body #muiChatTrigger .muisubang-prd-chat-label {
    font-size:0 !important;
    gap:0 !important;
  }
  body #muiChatTrigger .muisubang-prd-chat-label::before {
    content:'💬';
    font-size:23px;
    line-height:1;
  }
  body #muiChatModal.mui-chat-modal {
    right:8px !important;
    left:8px !important;
    bottom:calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    width:auto !important;
    max-width:calc(100vw - 16px) !important;
    height:min(640px, calc(100dvh - 18px - env(safe-area-inset-bottom, 0px))) !important;
    max-height:calc(100dvh - 18px - env(safe-area-inset-bottom, 0px)) !important;
    border-radius:15px !important;
  }
  body #muiChatModal input,
  body #muiChatModal button,
  body #muiChatModal textarea { font-size:16px; }
}
@media (prefers-reduced-motion:reduce) {
  body #muiChatModal,body #muiChatTrigger {scroll-behavior:auto !important;transition-duration:.01ms !important;animation-duration:.01ms !important;}
}

/* FR-17 / T13: diagnostic footer heading contrast was ~1.39:1.
 * Footer background observed in user's screenshot: dark green.
 * A narrow override corrects actual FSE footer block headings/paragraphs.
 * Links are underlined to retain a non-color affordance.
 * Re-audit contrast after rendering; do NOT assume WCAG PASS from CSS alone.
 */
footer.wp-block-template-part .wp-block-heading,
footer.wp-block-template-part .wp-block-heading.has-text-color,
footer.wp-block-template-part .wp-block-site-title,
footer.wp-block-template-part .wp-block-site-tagline {
  color: #f7fff9 !important;
}
footer.wp-block-template-part p,
footer.wp-block-template-part p.has-text-color {
  color: #eef8f0 !important;
}
footer.wp-block-template-part :is(.wp-block-navigation a, .wp-block-site-title a, p a) {
  color: #f7fff9 !important;
  text-decoration: underline !important;
  text-underline-offset: .18em;
}
footer.wp-block-template-part :is(a, button):focus-visible {
  outline: 3px solid #f3c96e !important;
  outline-offset: 3px;
}

/* v0.2.3 — verified staging diagnostic 375x752 reports minimum 1.39:1
 * on `li.wp-block-pages-list__item` ("Beranda") in the FSE footer.
 * v0.2.2 styled `.wp-block-navigation a` but missed WordPress Page List
 * descendants when the Pages List is outside a Navigation block.
 * Scope to the verified footer template part, avoiding all other page lists.
 * Do not depend on theme-defined has-text-color or hover/visited styles.
 */
footer.wp-block-template-part li.wp-block-pages-list__item,
footer.wp-block-template-part li.wp-block-pages-list__item.has-text-color,
footer.wp-block-template-part li.wp-block-pages-list__item a,
footer.wp-block-template-part li.wp-block-pages-list__item a:link,
footer.wp-block-template-part li.wp-block-pages-list__item a:visited,
footer.wp-block-template-part li.wp-block-pages-list__item a:hover,
footer.wp-block-template-part li.wp-block-pages-list__item a:focus,
footer.wp-block-template-part li.wp-block-pages-list__item a:active,
footer.wp-block-template-part li.wp-block-pages-list__item span {
  color: #f7fff9 !important;
  opacity: 1 !important;
}
footer.wp-block-template-part li.wp-block-pages-list__item a,
footer.wp-block-template-part li.wp-block-pages-list__item a:visited,
footer.wp-block-template-part li.wp-block-pages-list__item a:hover {
  text-decoration: underline !important;
  text-underline-offset: .19em;
  text-decoration-thickness: .09em;
}
footer.wp-block-template-part li.wp-block-pages-list__item a:focus-visible {
  outline: 3px solid #f3c96e !important;
  outline-offset: 3px;
}

@media (max-height:520px) and (min-width:601px) {
  body #muiChatTrigger.mui-chat-trigger-btn {
    width:52px !important;min-width:52px !important;max-width:52px !important;
    height:52px !important;min-height:52px !important;padding:0 !important;
    border-radius:50% !important;justify-content:center !important;
  }
  body #muiChatTrigger .muisubang-prd-chat-label {font-size:0 !important;gap:0 !important;}
  body #muiChatTrigger .muisubang-prd-chat-label::before {content:'💬';font-size:23px;line-height:1;}
}
