/**
 * Critical shell — muat blocking sebelum body paint (anti-FOUC).
 * Jangan @import. Keep small & sync with public-css-boot.js guard.
 */
html.css-pending,
html.desa-shell-loading {
  background: #f4f9fd;
}

html.css-pending body,
html.desa-shell-loading body {
  margin: 0;
  visibility: hidden;
}

html.css-ready body {
  visibility: visible;
}

html.css-pending .topbar,
html.desa-shell-loading .topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  box-sizing: border-box;
  width: min(100%, var(--dt-shell-max, 1000px));
  margin-inline: auto;
  padding: 10px clamp(16px, 4vw, 24px);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
}

html.css-pending .topbar .brand,
html.desa-shell-loading .topbar .brand {
  flex: 0 0 auto;
  min-width: 0;
}

html.css-pending .topbar .menu-button,
html.desa-shell-loading .topbar .menu-button {
  order: 3;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin-left: 8px;
  display: grid;
  place-items: center;
}

@media (max-width: 991.98px) {
  html.css-pending .topbar .menu-button,
  html.desa-shell-loading .topbar .menu-button {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

@media (min-width: 992px) {
  html.css-pending .topbar .menu-button,
  html.desa-shell-loading .topbar .menu-button {
    display: none !important;
  }
}

html.css-pending .topbar .nav,
html.desa-shell-loading .topbar .nav {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Sembunyikan struktur mobile drawer sampai template CSS siap */
html.css-pending .nav-mobile-head,
html.css-pending .nav-mobile-tools,
html.css-pending .nav-mobile-section,
html.css-pending .nav-mobile-search,
html.css-pending .nav-mobile-pills,
html.css-pending .nav-mobile-foot,
html.desa-shell-loading .nav-mobile-head,
html.desa-shell-loading .nav-mobile-tools,
html.desa-shell-loading .nav-mobile-section,
html.desa-shell-loading .nav-mobile-search,
html.desa-shell-loading .nav-mobile-pills,
html.desa-shell-loading .nav-mobile-foot {
  display: none !important;
}

html.css-pending:not(.shell-ready) .topbar .nav,
html.desa-shell-loading:not(.shell-ready) .topbar .nav {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  max-height: 48px;
}

html.css-ready.shell-ready .topbar .nav {
  opacity: 1;
  transition: opacity 0.16s ease;
}

html.css-pending .nav-scroll,
html.desa-shell-loading .nav-scroll {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
}

html.css-pending .nav-links,
html.desa-shell-loading .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

html.css-pending .nav-actions,
html.desa-shell-loading .nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

html.css-pending.desa-template .desa-main,
html.desa-shell-loading.desa-template .desa-main {
  width: min(100%, var(--dt-shell-max, 1000px));
  margin-inline: auto;
  background: #fff;
}

html.css-pending.desa-template .desa-hero,
html.css-pending.desa-template .hero,
html.desa-shell-loading.desa-template .desa-hero,
html.desa-shell-loading.desa-template .hero {
  position: relative;
  min-height: 500px;
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
}

html.css-ready #desa-css-progress {
  display: none;
}

/* Halaman inner publik — sembunyikan hero + konten + sidebar sampai JS commit reveal serentak */
html.site-public .desa-main:not(.site-home):not(.is-page-chrome-ready) > .inner-hero,
html.site-public .desa-main:not(.site-home):not(.is-page-chrome-ready) > .desa-page-hero,
html.site-public .desa-main:not(.site-home):not(.is-page-chrome-ready) .desa-page-layout,
html.site-public .desa-main:not(.site-home):not(.is-page-chrome-ready) > .section,
html.site-public .desa-main:not(.site-home):not(.is-page-chrome-ready) > .desa-section {
  opacity: 0;
  visibility: hidden;
}

html.site-public .desa-main.is-page-chrome-ready > .inner-hero,
html.site-public .desa-main.is-page-chrome-ready > .desa-page-hero,
html.site-public .desa-main.is-page-chrome-ready .desa-page-layout,
html.site-public .desa-main.is-page-chrome-ready > .section,
html.site-public .desa-main.is-page-chrome-ready > .desa-section {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

/* Skeleton konten — tampil sebelum JS bootstrap selesai */
html.desa-template .page-skeleton {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  box-sizing: border-box;
}

html.desa-template .page-skeleton__cover {
  width: 100%;
  min-height: min(38vh, 280px);
  border-radius: 14px;
}

html.desa-template .page-skeleton__body {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

html.desa-template .page-skeleton__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

html.desa-template .sk-shimmer,
html.desa-template .sk-line,
html.desa-template .sk-card {
  height: 14px;
  margin-bottom: 0;
  background: linear-gradient(90deg, #e8eef4, #f4f7fa, #e8eef4);
  background-size: 200% 100%;
  animation: desaSkShimmer 1.2s ease infinite;
  border-radius: 8px;
}

html.desa-template .sk-card {
  min-height: 120px;
  height: auto;
  aspect-ratio: 4 / 3;
}

html.desa-template .sk-line.sk-title {
  height: 28px;
  width: 55%;
}

html.desa-template .sk-line.sk-short {
  width: 40%;
}

@keyframes desaSkShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html.desa-template #profileDynamic.is-loading,
html.desa-template #managedPageBody.is-loading,
html.desa-template #potentialDynamic.is-loading,
html.desa-template #galleryPageGrid.is-loading {
  min-height: 280px;
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

html.desa-template .desa-page-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "main" "sidebar";
  gap: clamp(16px, 3vw, 22px);
  align-items: start;
  padding: var(--dt-pad, clamp(18px, 3vw, 28px));
  box-sizing: border-box;
}

html.desa-template .desa-page-layout__main {
  grid-area: main;
  min-width: 0;
}

html.desa-template .desa-page-sidebar {
  grid-area: sidebar;
  min-width: 0;
  width: 100%;
}

@media (min-width: 992px) {
  html.desa-template .desa-page-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 288px);
    grid-template-areas: "main sidebar";
    gap: clamp(20px, 2.2vw, 28px);
    padding: var(--dt-pad, clamp(18px, 3vw, 28px));
  }
}
