/* Loading components: page progress bar, skeleton cards, modal and dropdown
   helpers. Pairs with assets/js/loading.js. Relies on .ux-spinner,
   .skeleton-bar and .skeleton-row from ux.css. Respects reduced motion. */

.ux-sr-only{
  position:absolute !important; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* ---------- Page progress bar ---------- */
.ux-progress{
  position:fixed; left:0; top:0; width:100%; height:3px; z-index:2000;
  pointer-events:none; opacity:0; transition:opacity .2s ease .05s;
}
.ux-progress.is-active, .ux-progress.is-finishing{opacity:1; transition-delay:0s;}
.ux-progress-bar{
  height:100%; width:0; background:var(--gold-bright,#E3C171);
  box-shadow:0 0 8px rgba(227,193,113,.7);
  transition:width .2s ease;
}
/* Eases toward 80% while the browser is really waiting; never claims to be done. */
.ux-progress.is-active .ux-progress-bar{width:80%; transition:width 8s cubic-bezier(.1,.6,.2,1);}
.ux-progress.is-finishing .ux-progress-bar{width:100%; transition:width .15s ease;}
@media (prefers-reduced-motion: reduce){
  /* Static state: a full-width, dimmed bar for as long as a navigation is pending */
  .ux-progress, .ux-progress-bar{transition:none !important;}
  .ux-progress.is-active .ux-progress-bar{width:100%; opacity:.6; box-shadow:none;}
  .ux-progress.is-finishing{opacity:0;}
}

/* ---------- Skeleton cards ---------- */
.ux-skel-grid{
  display:grid; gap:18px; grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
}
.ux-skel-card{
  border:1px solid #d8cfae; border-radius:4px; background:#fbf7ea; padding:14px; overflow:hidden;
}
.ux-skel-card .skeleton-bar{margin:0 0 10px;}
.ux-skel-card .ux-skel-img{height:140px; margin-bottom:14px; border-radius:2px;}
.ux-skel-card .skeleton-bar:last-child{margin-bottom:0;}
@media (prefers-reduced-motion: reduce){
  .skeleton-bar{animation:none; background:#e9e2cd;}
}

/* ---------- Inline status (loading / error with retry) ---------- */
.ux-state{text-align:center; padding:22px 14px; color:var(--ink-soft,#4A4032);}
.ux-state[hidden]{display:none;}

/* ---------- Modal ---------- */
.ux-modal-backdrop{
  position:fixed; inset:0; z-index:1500; background:rgba(13,42,30,.72);
  display:flex; align-items:center; justify-content:center; padding:16px;
  animation:uxFade .16s ease-out;
}
.ux-modal{
  position:relative; background:var(--paper,#F5EEDC); color:var(--ink,#241F18);
  width:100%; max-width:560px; max-height:calc(100vh - 32px); overflow:auto;
  border-radius:4px; box-shadow:0 12px 40px rgba(0,0,0,.4); padding:22px 22px 20px;
}
.ux-modal:focus{outline:none;}
.ux-modal h2{margin:0 40px 12px 0; font-size:1.3rem;}
.ux-modal-close{
  position:absolute; right:8px; top:8px; min-width:44px; min-height:44px;
  background:none; border:0; font-size:1.6rem; line-height:1; cursor:pointer; color:inherit;
}
.ux-modal-body[aria-busy="true"]{min-height:80px; position:relative;}
.ux-modal-body[aria-busy="true"] > *:not(.ux-state){opacity:.35;}
body.ux-modal-open{overflow:hidden;}

/* ---------- Dropdown ---------- */
.ux-dropdown{position:relative; display:inline-block;}
.ux-dropdown-panel{
  position:absolute; left:0; top:calc(100% + 6px); min-width:220px; z-index:300;
  background:#fff; color:var(--ink,#241F18); border:1px solid #cbbf93; border-radius:4px;
  box-shadow:0 8px 24px rgba(0,0,0,.2); padding:6px 0; animation:uxFade .14s ease-out;
}
.ux-dropdown-panel[hidden]{display:none;}
.ux-dropdown-panel a, .ux-dropdown-panel button.ux-item{
  display:block; width:100%; text-align:left; padding:10px 14px; min-height:44px;
  background:none; border:0; font:inherit; color:inherit; text-decoration:none; cursor:pointer;
}
.ux-dropdown-panel a:hover, .ux-dropdown-panel button.ux-item:hover,
.ux-dropdown-panel a:focus-visible, .ux-dropdown-panel button.ux-item:focus-visible{background:#f3ecd2;}
