/* ==========================================================================
   Components — reusable building blocks. One block per component, BEM names.
   Every block starts with a usage line showing the expected markup.

   Index
     Actions ....... btn · link-arrow · arrow-dot
     Labels ........ badge · chip · avatar · icon-tile
     Surfaces ...... card (+ hover effects) · callout · alert
     Headings ...... section-head · page-hero · photo-hero
     Navigation .... crumbs · pager · filter-chips / filter-chip · segmented
     Forms ......... field · input · check · choices / choice · switch · upload
     Loading ....... skeleton · media · lazy list · reveal on enter

   Rules of this file: tokens only, logical properties, mobile-first media queries from the
   scale in tokens.css, :hover inside @media (hover: hover), state classes are .is-*.
   ========================================================================== */


/* ==========================================================================
   ACTIONS
   ========================================================================== */

/* ---- Button ------------------------------------------------------------
   <a class="btn btn--amber btn--lg" href="…">نص <svg class="icon" aria-hidden="true">…</svg></a>
   <button class="btn btn--sm btn--line" type="button">…</button>
   Colours are three custom properties, so a one-off skin only sets --btn-bg / --btn-fg / --btn-bd. */
.btn {
  --btn-bg: var(--burgundy);
  --btn-fg: var(--text-on-dark);
  --btn-bd: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 2.75rem;
  padding: .625rem 1.5rem;
  font-size: var(--fs-14);
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-12);
  box-shadow: var(--sh-sm);
  transition:
    translate var(--t-fast) var(--ease),
    scale .12s var(--ease),
    filter var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}
.btn .icon { font-size: 1rem; }
.btn:active { scale: .97; }
@media (hover: hover) {
  .btn:hover { translate: 0 -1px; filter: brightness(1.06); }
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  translate: none;
  filter: none;
}

/* colour */
.btn--amber {
  --btn-bg: var(--amber);
  --btn-fg: var(--ink);
  background-image: var(--grad-amber);
  box-shadow: var(--sh-amber);
}
.btn--deep { --btn-bg: var(--burgundy-deep); box-shadow: var(--sh-brand), 0 0 0 2px var(--on-dark-20); }
.btn--outline {
  --btn-bg: var(--surface);
  --btn-fg: var(--burgundy);
  --btn-bd: var(--burgundy);
  box-shadow: var(--sh-xs);
}
.btn--white { --btn-bg: var(--surface); --btn-fg: var(--burgundy); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--navy); box-shadow: none; }
/* size and shape */
.btn--lg {
  min-height: 3.75rem;
  padding: 1rem 3rem;
  font-size: var(--fs-20);
  font-weight: 600;
  border-radius: var(--r-12);
}
.btn--md { min-height: 3rem; padding: .875rem 1.75rem; font-size: var(--fs-16); }
.btn--pill { border-radius: var(--r-full); }
.btn--block { display: flex; width: 100%; }
.btn--icon {
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-radius: var(--r-8);
}
.btn--gradient { background-image: linear-gradient(90deg, var(--burgundy), var(--burgundy-deep)); }

/* quiet colours for toolbars, lists and account pages */
.btn--line {            /* white with a rose line */
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-rose-strong);
  font-weight: 600;
  box-shadow: var(--sh-xs);
}
.btn--danger {          /* same, burgundy text: delete, cancel */
  --btn-bg: var(--surface);
  --btn-fg: var(--burgundy);
  --btn-bd: var(--line-rose-strong);
  font-weight: 600;
  box-shadow: var(--sh-xs);
}
.btn--soft { --btn-bg: var(--sand); --btn-fg: var(--ink); box-shadow: var(--sh-xs); }
.btn--navy { --btn-bg: var(--navy); }
.btn--success { --btn-bg: var(--green-ink); }
/* compact: 44px tall on touch widths, 36px from 48rem */
.btn--sm {
  gap: .375rem;
  min-height: 2.75rem;
  padding: .5rem .875rem;
  font-size: var(--fs-12);
  box-shadow: var(--sh-xs);
}
.btn--sm .icon { font-size: .8125rem; }
/* square, icon only — give the control an aria-label */
.btn--icon-only { width: 2.75rem; padding: 0; }
@media (min-width: 48rem) {
  .btn--sm { min-height: 2.25rem; padding-block: .375rem; }
  .btn--sm.btn--icon-only { width: 2.25rem; }
}

/* ---- Arrow link ---------------------------------------------------------
   <a class="link-arrow" href="…">قراءة المقال <svg class="icon" aria-hidden="true"><use href="#i-arrow-left"></use></svg></a>
   Inside a .card--link the arrow also moves when the card is hovered. Modifiers: --navy, --sm. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-size: var(--fs-14);
  font-weight: 700;
  line-height: 1.45;
  color: var(--burgundy);
  white-space: nowrap;
}
.link-arrow .icon { font-size: .75rem; transition: translate var(--t-fast) var(--ease); }
.link-arrow--navy { color: var(--navy); }
.link-arrow--sm { gap: var(--sp-1); font-size: var(--fs-12); }
.link-arrow--sm .icon { font-size: .6875rem; }
@media (hover: hover) {
  a.link-arrow:hover .icon,
  .card--link:hover .link-arrow .icon { translate: calc(var(--dir) * 3px) 0; }
}

/* ---- Arrow dot (round arrow at the end of a card) -----------------------
   <span class="arrow-dot" aria-hidden="true"><svg class="icon"><use href="#i-arrow-left"></use></svg></span>
   Colour: --arrow-tone. */
.arrow-dot {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  color: var(--arrow-tone, var(--navy));
  background: var(--sand);
  transition: translate var(--t-fast) var(--ease);
}
.arrow-dot .icon { font-size: .75rem; }
/* the arrow symbol points left (the reading direction of the Arabic site): flip it on LTR pages */
[dir="ltr"] .icon:not(.icon--back):has(use[href="#i-arrow-left"]) { scale: -1 1; }
@media (hover: hover) {
  .card--link:hover .arrow-dot { translate: calc(var(--dir) * 3px) 0; }
}


/* ==========================================================================
   LABELS
   ========================================================================== */

/* ---- Badge (small label pill) -------------------------------------------
   <span class="badge badge--rose"><span class="badge__dot" aria-hidden="true"></span>نص</span>
   Status pills: badge--success / --pending / --muted (+ badge--sm, badge--square). */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .25rem .875rem;
  border-radius: var(--r-full);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 1.35;
  color: var(--burgundy-deep);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
}
.badge--rose { color: var(--burgundy); background: var(--burgundy-soft); border-color: transparent; }
.badge--white {
  color: var(--burgundy);
  background: var(--surface);
  border-color: var(--amber-line);
  box-shadow: var(--sh-xs);
}
.badge--cool { color: var(--navy-soft); background: var(--navy-tint); border-color: var(--line-cool); }
.badge--solid { color: var(--text-on-dark); background: var(--burgundy-deep); border-color: transparent; }
.badge--glass {
  color: var(--amber);
  background: var(--line-on-dark);
  border-color: var(--amber-line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-weight: 400;
  font-size: var(--fs-14);
  padding: .5rem 1.25rem;
}
.badge--amber { color: var(--amber-ink); }
.badge--light { font-weight: 400; }
.badge--neutral {
  gap: var(--sp-2);
  padding: .375rem var(--sp-4);
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-rose);
  box-shadow: var(--sh-xs);
}
/* status */
.badge--success { color: var(--green-deep); background: var(--green-soft); border-color: var(--green-line); }
.badge--pending { color: var(--amber-ink); background: var(--amber-soft); border-color: var(--amber-line); }
.badge--muted { color: var(--text); background: var(--sand-strong); border-color: var(--line-rose); }
/* shape */
.badge--sm { padding: .3125rem .75rem; white-space: nowrap; }
.badge--square { padding: .125rem .5rem; border-radius: var(--r-6); }

.badge .icon { font-size: .75rem; }
.badge__dot {
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge__dot--sm { width: .5rem; height: .5rem; }
.badge__dot--xs { width: .375rem; height: .375rem; }
.badge--neutral .badge__dot { color: var(--burgundy); }
.badge--success .badge__dot { color: var(--green); }
.badge--pending .badge__dot { color: var(--amber-deep); }
.badge--muted .badge__dot { color: var(--text-muted); }

/* ---- Chip (tag) -----------------------------------------------------------
   <span class="chip">UI/UX</span> */
.chip {
  display: inline-flex;
  align-items: center;
  padding: .25rem .625rem;
  border-radius: var(--r-6);
  font-size: var(--fs-12);
  line-height: 1.35;
  color: var(--navy-soft);
  background: var(--navy-tint);
  border: 1px solid color-mix(in srgb, var(--line-cool) 40%, transparent);
}

/* ---- Avatar ---------------------------------------------------------------
   <span class="avatar avatar--sm avatar--navy" aria-hidden="true">ن</span>      an initial
   <img class="avatar avatar--lg avatar--ring" src="…" alt="…" width="80" height="80">   a photo
   Sizes: --xs 28px, --sm 40px, default 48px, --lg 80px (or set --avatar-size).
   Tones: default rose, --rose (with a line), --pale, --navy, --amber, --cool. --ring adds a ring (--avatar-ring). */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--avatar-size, 3rem);
  height: var(--avatar-size, 3rem);
  font-size: var(--fs-18);
  font-weight: 700;
  line-height: 1;
  color: var(--burgundy);
  background: var(--burgundy-soft);
  border-radius: 50%;
  object-fit: cover;
}
.avatar--xs { --avatar-size: 1.75rem; font-size: var(--fs-12); }
.avatar--sm { --avatar-size: 2.5rem; font-size: var(--fs-14); }
.avatar--lg { --avatar-size: 5rem; font-size: var(--fs-16); }
.avatar--rose {
  color: var(--burgundy);
  background: var(--burgundy-soft);
  border: 2px solid color-mix(in srgb, var(--burgundy) 20%, transparent);
}
.avatar--pale { background: var(--rose-pale); }
.avatar--navy { color: var(--text-on-dark); background: var(--navy); }
.avatar--amber { color: var(--amber-ink); background: color-mix(in srgb, var(--amber) 30%, transparent); }
.avatar--cool { color: var(--navy); background: var(--sky); }
.avatar--ring { border: 2px solid var(--avatar-ring, var(--amber-light)); box-shadow: var(--sh-xs); }

/* ---- Icon tile ------------------------------------------------------------
   <span class="icon-tile icon-tile--amber"><svg class="icon" aria-hidden="true">…</svg></span> */
.icon-tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: var(--r-12);
  color: var(--burgundy);
  background: var(--burgundy-soft);
}
.icon-tile .icon { font-size: 1.25rem; }
.icon-tile--amber { color: var(--amber-deep); background: var(--amber-soft); }
.icon-tile--navy { color: var(--navy); background: var(--navy-tint); }
.icon-tile--sm { width: 2.25rem; height: 2.25rem; border-radius: var(--r-8); }
.icon-tile--sm .icon { font-size: 1rem; }
.icon-tile--lg { width: 3.5rem; height: 3.5rem; border-radius: var(--r-16); }
.icon-tile--lg .icon { font-size: 1.375rem; }
.icon-tile--glass {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--amber);
  background: var(--line-on-dark);
  border: 1px solid var(--on-dark-15);
}
.icon-tile--glass .icon { font-size: 1.125rem; }


/* ==========================================================================
   SURFACES
   ========================================================================== */

/* ---- Card -----------------------------------------------------------------
   <article class="card card--link">
     <figure class="card__media"><img src="…" alt="…" width="…" height="…" loading="lazy"></figure>
     <div class="card__body">
       <h3 class="card__title"><a class="card__link" href="…">عنوان</a></h3>
       <p class="card__excerpt">…</p>
       <div class="card__footer">…</div>
     </div>
   </article>
   Padding: --card-pad. Media ratio: --media-ratio. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-rose);
  border-radius: var(--r-24);
  box-shadow: var(--sh-xs);
  overflow: clip;
}
.card--raised { box-shadow: var(--sh-soft); }
.card--float { box-shadow: var(--sh-lg); }
.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--card-pad, 1.75rem);
  flex: 1;
}
.card__media { aspect-ratio: var(--media-ratio, 16 / 9); overflow: hidden; background: var(--sand); }
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale .45s var(--ease);
}
.card__title { font-size: var(--fs-22); font-weight: 600; line-height: 1.45; color: var(--navy); }
.card__text { font-size: var(--fs-14); line-height: 1.6; color: var(--text); }
.card__excerpt {
  font-size: var(--fs-14);
  line-height: 1.65;
  color: var(--text);
  text-wrap: pretty;
}
.card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block-start: auto;
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid var(--sand-strong);
}
/* one link stretched over the whole card */
.card__link::after { content: ""; position: absolute; inset: 0; }

/* ---- Card hover effects (opt-in, combine freely) --------------------------
   <article class="card card--lift card--zoom card--sheen">…
     --link       lift + media zoom (the original pair, kept for existing pages)
     --lift       2px lift with a deeper shadow
     --zoom       the media image grows slightly
     --sheen      a soft band of light crosses the card once
     --glow       a faint tinted edge; colour: --card-glow (default amber)
     --spotlight  a highlight follows the pointer (app.js writes --mx / --my)
   All of it only for a hovering pointer; movement is skipped under prefers-reduced-motion. */
.card--link,
.card--lift {
  transition: translate var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
@media (hover: hover) {
  .card--link:hover,
  .card--lift:hover { translate: 0 -2px; box-shadow: var(--sh-md); }
  .card--link:hover .card__media img,
  .card--zoom:hover .card__media img { scale: 1.03; }
}

/* the light layers: ::before carries glow and spotlight, ::after carries the sheen */
.card--glow::before,
.card--spotlight::before,
.card--sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
}
.card--glow::before,
.card--spotlight::before {
  opacity: 0;
  background: var(--card-light, none);
  box-shadow: var(--card-edge, none);
  transition: opacity var(--t-med) var(--ease);
}
.card--glow {
  --card-glow: var(--amber);
  --card-edge:
    inset 0 0 0 1px color-mix(in srgb, var(--card-glow) 55%, transparent),
    inset 0 0 1.5rem -.5rem color-mix(in srgb, var(--card-glow) 45%, transparent);
}
.card--spotlight {
  --card-light: radial-gradient(14rem circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--amber) 16%, transparent), transparent 70%);
}
.card--sheen::after {
  background: linear-gradient(105deg, transparent 38%, color-mix(in srgb, var(--surface) 55%, transparent) 50%, transparent 62%);
  opacity: 0;
  translate: -100% 0;
}
@media (hover: hover) {
  .card--glow:hover::before { opacity: 1; }
}
@media (hover: hover) and (pointer: fine) {
  .card--spotlight:hover::before { opacity: 1; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  /* the transition lives on the hover state only: the band runs once and resets unseen */
  .card--sheen:hover::after {
    opacity: 1;
    translate: 100% 0;
    transition: translate .7s var(--ease);
  }
}

/* ---- Callout (highlighted note) -------------------------------------------
   <aside class="callout callout--amber">
     <h3 class="callout__title">…</h3> <p class="callout__text">…</p>
   </aside>
   With an icon: <div class="callout callout--icon"><svg class="icon callout__icon">…</svg><div class="callout__body">…</div></div>
   Modifiers: --amber, --end (bar on the end side), --plain (no bar), --icon, --sm (small title).
   Custom properties: --callout-accent, --callout-bg, --callout-bar (bar width), --callout-radius. */
.callout {
  padding: var(--sp-4);
  background: var(--callout-bg, var(--sand-strong));
  border-inline-start: var(--callout-bar, 4px) solid var(--callout-accent, var(--burgundy));
  border-radius: var(--callout-radius, var(--r-8));
}
.callout--amber { --callout-accent: var(--amber); }
.callout--end {
  border-inline-start: 0;
  border-inline-end: var(--callout-bar, 4px) solid var(--callout-accent, var(--burgundy));
}
.callout--plain { border-inline: 0; }
.callout--icon { display: flex; align-items: flex-start; gap: var(--sp-2); }
.callout__icon {
  flex: none;
  margin-block-start: .1875rem;
  font-size: 1.125rem;
  color: var(--callout-accent, var(--burgundy));
}
.callout__body { min-width: 0; }
.callout__title { font-size: var(--fs-18); font-weight: 700; line-height: 1.55; color: var(--navy); }
.callout__text { font-size: var(--fs-14); line-height: 1.7; color: var(--text); }
.callout--sm .callout__title { font-size: var(--fs-14); line-height: 1.45; color: var(--ink); }
.callout--sm .callout__text { line-height: 1.65; }

/* ---- Alert (form feedback) ------------------------------------------------
   <p class="alert alert--success" data-form-status role="status" tabindex="-1" hidden>…</p> */
.alert {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: .875rem 1rem;
  border-radius: var(--r-12);
  font-size: var(--fs-14);
  font-weight: 600;
}
.alert--success { color: var(--green-deep); background: var(--green-soft); border: 1px solid var(--green-line); }
.alert--error { color: var(--burgundy-deep); background: var(--danger-soft); border: 1px solid var(--line-rose-strong); }


/* ==========================================================================
   HEADINGS
   ========================================================================== */

/* ---- Section head (eyebrow + title + lead) --------------------------------
   <header class="section-head section-head--center"><span class="badge">…</span><h2 class="h2">…</h2><p class="section-head__lead">…</p></header>
   Split: <header class="section-head section-head--split"><div class="section-head__main">…</div><a class="btn …">…</a></header>
   Modifiers: --center, --split (title block + trailing link), --ruled (line under the head). */
.section-head {
  display: flex;
  flex-direction: column;
  gap: .875rem;
  align-items: flex-start;
  max-width: 42rem;
}
.section-head--center { align-items: center; text-align: center; margin-inline: auto; }
.section-head__lead { font-size: var(--fs-18); line-height: 1.55; color: var(--text); }
.section-head--split {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  max-width: none;
}
.section-head__main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
  min-width: 0;
}
.section-head--ruled { padding-block-end: var(--sp-6); border-block-end: 1px solid var(--line); }

/* ---- Page hero (inner pages: pill + title + lead, centred) ----------------
   <section class="page-hero"><div class="container page-hero__inner">
     <span class="badge">…</span><h1 class="page-hero__title">…</h1><p class="page-hero__lead">…</p>
   </div></section> */
.page-hero { padding-block: var(--sp-8); text-align: center; }
@media (min-width: 40rem) { .page-hero { padding-block: var(--sp-10); } }
.page-hero__inner { display: flex; flex-direction: column; align-items: center; }
.page-hero__title {
  margin-block: var(--sp-4) var(--sp-2);
  font-size: var(--fs-page-title);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
.page-hero__lead {
  font-size: var(--fs-16);
  line-height: 1.625;
  color: var(--text);
  text-wrap: balance;
  max-width: 46rem;
}
@media (prefers-reduced-motion: no-preference) {
  .page-hero__inner > * { animation: rise-in var(--t-slow) var(--ease) both; }
  .page-hero__inner > :nth-child(2) { animation-delay: .12s; }
  .page-hero__inner > :nth-child(3) { animation-delay: .24s; }
}
@keyframes rise-in {
  from { opacity: 0; translate: 0 8px; filter: blur(4px); }
}

/* ---- Photo hero (title over a full-width photograph) ----------------------
   <header class="photo-hero">
     <img class="photo-hero__img" src="…" alt="…" width="…" height="…">
     <div class="container photo-hero__inner"> … <h1 class="photo-hero__title">…</h1> … </div>
   </header>
   Custom properties: --photo-hero-h (height), --photo-hero-focus (object-position),
   --photo-hero-scrim (the gradient between photo and text; default navy from the bottom). */
.photo-hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: flex;
  align-items: flex-end;
  min-height: var(--photo-hero-h, clamp(24rem, 14rem + 28vw, 38.75rem));
  color: var(--text-on-dark);
  background: var(--navy);
}
.photo-hero__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--photo-hero-focus, 50% 25%);
}
.photo-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--photo-hero-scrim, linear-gradient(to top, color-mix(in srgb, var(--navy) 96%, transparent), color-mix(in srgb, var(--navy) 72%, transparent) 38%, color-mix(in srgb, var(--navy) 20%, transparent) 68%, transparent 85%));
}
.photo-hero__inner {
  --container: var(--container-80);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-4);
  padding-block: var(--sp-16) var(--sp-10);
}
.photo-hero__title {
  font-size: var(--fs-page-title);
  font-weight: 700;
  line-height: 1.36;
  text-wrap: balance;
  text-shadow: 0 2px 3px rgb(0 0 0 / .12);
}
@media (prefers-reduced-motion: no-preference) {
  .photo-hero__inner > * { animation: rise-in .5s var(--ease) both; }
  .photo-hero__inner > :nth-child(2) { animation-delay: .06s; }
  .photo-hero__inner > :nth-child(n + 3) { animation-delay: .12s; }
}


/* ==========================================================================
   NAVIGATION
   ========================================================================== */

/* ---- Breadcrumb -----------------------------------------------------------
   <nav class="crumbs" aria-label="مسار التنقل">
     <ol class="crumbs__list">
       <li class="crumbs__item"><a class="crumbs__link" href="index.html">الرئيسية</a></li>
       <li class="crumbs__item"><span class="crumbs__current" aria-current="page">الصفحة</span></li>
     </ol>
   </nav>
   The separator is drawn by CSS. Modifiers: --lg (14px bold, 44px links), --slash ("/" separator,
   muted links, burgundy current page), --on-dark (over a photo or navy ground). */
.crumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  font-size: var(--fs-12);
  line-height: 1.5;
  color: var(--text);
}
.crumbs__item { display: inline-flex; align-items: center; gap: var(--sp-2); }
.crumbs__item + .crumbs__item::before {
  content: "";
  width: .375rem;
  height: .375rem;
  border-block-end: 1.5px solid currentColor;
  border-inline-end: 1.5px solid currentColor;
  rotate: 45deg;
  opacity: .7;
}
.crumbs__link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 1.5rem;
  text-decoration: underline transparent;
  text-underline-offset: .25em;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}
.crumbs__link .icon { font-size: .75rem; }
.crumbs__current { font-weight: 700; color: var(--ink); }
@media (hover: hover) {
  .crumbs__link:hover { color: var(--burgundy); text-decoration-color: currentColor; }
}

.crumbs--lg .crumbs__list {
  gap: 0 var(--sp-1);
  font-size: var(--fs-14);
  font-weight: 700;
  line-height: 1.45;
}
.crumbs--lg .crumbs__item { gap: var(--sp-1); }
.crumbs--lg .crumbs__link { min-height: 2.75rem; text-decoration: none; }

.crumbs--slash .crumbs__list { column-gap: var(--sp-2); }
.crumbs--slash .crumbs__item { gap: var(--sp-2); }
.crumbs--slash .crumbs__item + .crumbs__item::before {
  content: "/";
  width: auto;
  height: auto;
  border: 0;
  rotate: none;
  opacity: 1;
  font-weight: 500;
  color: var(--line-rose-strong);
}
.crumbs--slash .crumbs__link { font-weight: 500; color: var(--text-muted); }
.crumbs--slash .crumbs__current { color: var(--burgundy); }
@media (hover: hover) {
  .crumbs--slash .crumbs__link:hover { color: var(--burgundy); }
}

.crumbs--on-dark .crumbs__list { color: var(--text-on-navy); }
.crumbs--on-dark .crumbs__item + .crumbs__item::before { color: var(--amber); opacity: 1; }
.crumbs--on-dark .crumbs__current { color: var(--amber); }
.crumbs--on-dark .crumbs__link:focus-visible { box-shadow: var(--focus-on-dark); border-radius: var(--r-4); }
@media (hover: hover) {
  .crumbs--on-dark .crumbs__link:hover { color: var(--text-on-dark); }
}

/* ---- Pagination -----------------------------------------------------------
   <nav class="pager" aria-label="صفحات النتائج">
     <p class="pager__status">صفحة 1 من 8</p>
     <ol class="pager__list">
       <li><span class="pager__link pager__link--disabled" aria-disabled="true">السابق</span></li>
       <li><a class="pager__link" href="#" aria-current="page">1</a></li>
       <li><a class="pager__link" href="#">2</a></li>
       <li><span class="pager__gap" aria-hidden="true">…</span></li>
       <li><a class="pager__link pager__link--step" href="#">التالي</a></li>
     </ol>
   </nav>
   Modifier: --pill (one white capsule with round links). */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
}
.pager__status { font-size: var(--fs-12); font-weight: 700; color: var(--text-muted); }
.pager__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .375rem;
}
.pager__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding-inline: var(--sp-3);
  font-size: var(--fs-12);
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-12);
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.pager__link .icon { font-size: .6875rem; }
.pager__icon--back { rotate: 180deg; }
[dir="ltr"] .pager__icon--back { rotate: none; }   /* the back arrow already points left */
.pager__link--step,
.pager__link--disabled { padding-inline: var(--sp-4); }
.pager__link--disabled { color: var(--text-muted); cursor: not-allowed; }
.pager__link[aria-current="page"] {
  color: var(--text-on-dark);
  background: var(--burgundy);
  border-color: var(--burgundy);
}
.pager__gap { padding-inline: var(--sp-1); font-weight: 700; color: var(--text-muted); }
@media (hover: hover) {
  a.pager__link:hover { color: var(--burgundy); border-color: var(--burgundy); }
}
@media (min-width: 48rem) {
  .pager { justify-content: space-between; }
  .pager__link { min-width: 2.5rem; min-height: 2.5rem; }
}

.pager--pill { justify-content: center; }
.pager--pill .pager__list {
  gap: var(--sp-1);
  padding: .375rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-24);
  box-shadow: var(--sh-sm);
  justify-content: center;
}
.pager--pill .pager__link { background: none; border-color: transparent; border-radius: var(--r-full); }
.pager--pill .pager__link[aria-current="page"] { background: var(--burgundy); box-shadow: var(--sh-sm); }
/* narrow phones: "previous" and "next" share a row of their own under the numbers */
@media (max-width: 29.9375rem) {
  .pager--pill .pager__list > li:has(.pager__link--step, .pager__link--disabled) {
    order: 1;
    flex: 1 1 40%;
    display: flex;
  }
  .pager--pill .pager__link--step,
  .pager--pill .pager__link--disabled { flex: 1; }
}

/* ---- Filter chips ---------------------------------------------------------
   <div class="filter-chips" role="group" aria-label="التصنيف">
     <button class="filter-chip" type="button" aria-pressed="true">الكل</button>
     <button class="filter-chip" type="button" aria-pressed="false">تصميم</button>
   </div>
   Modifiers: --square (radius 8, cool ground, burgundy when pressed), --tone (coloured text and
   <span class="filter-chip__dot">, filled with its own colour when pressed), --underline (amber
   line under the pressed chip). Custom properties: --chip-ink (text), --chip-bg, --chip-line,
   --chip-on (pressed ground), --chip-dot. */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  min-height: 2.75rem;
  padding: .375rem var(--sp-4);
  font-size: var(--fs-14);
  line-height: 1.35;
  color: var(--chip-ink, var(--text));
  white-space: nowrap;
  background: var(--chip-bg, var(--surface));
  border: 1px solid var(--chip-line, var(--line));
  border-radius: var(--r-full);
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    scale .12s var(--ease);
}
.filter-chip:active { scale: .97; }
.filter-chip__dot {
  flex: none;
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: var(--chip-dot, currentColor);
  transition: background-color var(--t-fast) var(--ease);
}
@media (hover: hover) {
  .filter-chip:hover { border-color: var(--text-muted); }
}
.filter-chip[aria-pressed="true"] {
  font-weight: 700;
  color: var(--text-on-dark);
  background: var(--chip-on, var(--ink));
  border-color: var(--chip-on, var(--ink));
}
@media (min-width: 48rem) {
  .filter-chip { min-height: 1.875rem; font-size: var(--fs-12); }
}

.filter-chip--square {
  --chip-bg: var(--tint-cool);
  --chip-line: var(--line-cool);
  --chip-on: var(--burgundy);
  min-height: 2.75rem;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-14);
  line-height: 1.5;
  border-radius: var(--r-8);
}
.filter-chip--square[aria-pressed="true"] { box-shadow: var(--sh-xs); }

.filter-chip--tone {
  --chip-bg: var(--gray);
  border-width: 0;
  font-weight: 700;
  line-height: 1.5;
  color: var(--chip-ink, var(--burgundy));
}
.filter-chip--tone[aria-pressed="true"] {
  --chip-dot: var(--surface);
  color: var(--text-on-dark);
  background: var(--chip-on, var(--chip-ink, var(--burgundy)));
  box-shadow: var(--sh-xs);
}

.filter-chip--underline {
  --chip-bg: var(--page);
  border-width: 0;
  min-height: 2.75rem;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-14);
  font-weight: 700;
  line-height: 1.45;
}
.filter-chip--underline[aria-pressed="true"] {
  color: var(--navy);
  background-color: var(--gray);
  background-image: linear-gradient(var(--amber), var(--amber));
  background-repeat: no-repeat;
  background-size: calc(100% - 2 * var(--sp-4)) 3px;
  background-position: 50% calc(100% - .3125rem);
  box-shadow: var(--sh-xs);
}
@media (hover: hover) {
  .filter-chip--square:hover { border-color: var(--burgundy); }
  .filter-chip--tone:hover { background-color: var(--sand-strong); }
  .filter-chip--underline:hover { color: var(--navy); background-color: var(--gray); }
}
@media (min-width: 48rem) {
  .filter-chip--underline { min-height: 2.25rem; }
}

/* ---- Segmented control (two or three exclusive views) ---------------------
   <div class="segmented" role="group" aria-label="…">
     <button class="segmented__btn" type="button" aria-pressed="true">الكل</button> …
   </div> */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: .375rem;
  width: 100%;
  max-width: 20rem;
  padding: var(--sp-1);
  background: var(--line);
  border-radius: var(--r-16);
}
.segmented__btn {
  min-height: 2.75rem;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-14);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  border-radius: var(--r-12);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
@media (hover: hover) {
  .segmented__btn:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
}
.segmented__btn[aria-pressed="true"] {
  color: var(--text-on-dark);
  background: var(--navy);
  box-shadow: var(--sh-xs);
}
@media (min-width: 48rem) {
  .segmented__btn { min-height: 2.25rem; }
}


/* ==========================================================================
   FORMS
   ========================================================================== */

/* ---- Field ----------------------------------------------------------------
   <div class="field">
     <label class="field__label" for="id">الاسم <span class="field__req field__req--star" aria-hidden="true">*</span></label>
     <div class="field__control field__control--icon">
       <svg class="icon field__icon" aria-hidden="true">…</svg>
       <input class="input" id="id" name="…" type="text" required>
     </div>
     <p class="field__hint">…</p>
     <p class="field__error" aria-live="polite"></p>
   </div>
   app.js adds .is-invalid / .is-valid to .field and writes the message into .field__error.
   Label: --icon (leading icon, marker right after the text), --inline (marker right after the text).
   Control: --icon (icon at the start), --icon-end (icon at the end), --toggle (show / hide password). */
.field {
  display: flex;
  flex-direction: column;
  gap: .375rem;
  min-width: 0;
}
.field__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--ink);
}
.field__label--inline { display: block; line-height: 1.45; }
.field__label--icon { display: block; font-size: var(--fs-14); line-height: 1.5; }
.field__label--icon .icon {
  display: inline-block;
  margin-inline-end: .25rem;
  vertical-align: -.15em;
  font-size: .9375rem;
  color: var(--burgundy);
}
.field__req { font-size: var(--fs-11); font-weight: 400; color: var(--text-muted); }
.field__req--star { color: var(--burgundy); font-size: var(--fs-14); font-weight: 700; }
.field__control { position: relative; display: flex; }
.field__icon {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: .875rem;
  translate: 0 -50%;
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}
.field__icon--top { inset-block-start: 1rem; translate: none; }
.field__hint { font-size: var(--fs-12); color: var(--text-muted); }
.field__error {
  display: none;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--burgundy);
}
.field.is-invalid .field__error { display: block; }
@media (min-width: 48rem) {
  .field__label--icon { font-size: var(--fs-12); }
}

/* ---- Input (text field, select, textarea) ---------------------------------
   <input class="input" …>  <select class="input">…</select>  <textarea class="input" rows="4"></textarea> */
.input {
  width: 100%;
  min-height: 2.75rem;
  padding: .625rem 1rem;
  font-size: var(--fs-16);          /* 16px on phones: no zoom on focus in iOS */
  line-height: 1.45;
  color: var(--ink);
  background: var(--sand);
  border: 1px solid var(--line-rose);
  border-radius: var(--r-12);
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
  appearance: none;
}
@media (min-width: 48.0625rem) {
  .input { font-size: var(--fs-14); }
}
.input::placeholder { color: var(--text-muted); opacity: 1; }
@media (hover: hover) {
  .input:hover { border-color: var(--line-rose-strong); }
}
.input:focus,
.input:focus-visible {
  border-color: var(--burgundy);
  background: var(--surface);
  box-shadow: var(--focus-field);
}
.input[disabled] { opacity: .6; cursor: not-allowed; }
textarea.input { min-height: 9.5rem; resize: vertical; padding-block: .875rem; }
/* the chevron sits at the inline end: right by default, left in RTL */
select.input {
  padding-inline-end: 2.5rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d706e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 1rem;
  background-position: right .875rem center;
}
:where([dir="rtl"]) select.input { background-position: left .875rem center; }
/* e-mail / phone / URL values are typed left-to-right but stay right-aligned in the Arabic form */
[dir="rtl"] .input[dir="ltr"] { text-align: right; }
[dir="rtl"] .input[dir="ltr"]::placeholder { text-align: right; }
/* a visually hidden control must not keep the field box */
.input.visually-hidden {
  width: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
}

.field__control--icon .input { padding-inline-start: 2.5rem; }
[dir="rtl"] .field__control--icon .input[dir="ltr"] { padding-inline: 1rem 2.5rem; }   /* the icon stays on the right */
.field__control--icon-end .field__icon { inset-inline: auto var(--sp-4); font-size: 1.0625rem; color: var(--text); }
.field__control--icon-end .input { padding-inline-end: 2.75rem; }
[dir="rtl"] .field__control--icon-end .input[dir="ltr"] { padding-inline: 2.75rem var(--sp-4); }

.field.is-invalid .input { border-color: var(--burgundy); background: var(--danger-soft); }
.field.is-valid .input { border-color: color-mix(in srgb, var(--green) 60%, transparent); }

/* ---- Password toggle ------------------------------------------------------
   <div class="field__control field__control--toggle">
     <input class="input" id="pw" type="password" …>
     <button class="field__toggle" type="button" data-toggle-password="pw" aria-pressed="false" aria-label="إظهار كلمة المرور">
       <svg class="icon" aria-hidden="true"><use href="#i-eye"></use></svg>
     </button>
   </div>
   Modifier: field__toggle--strike draws a line through the eye while the password is shown. */
.field__control--toggle .input { padding-inline-end: 2.75rem; }
[dir="rtl"] .field__control--toggle .input[dir="ltr"] { padding-inline: 2.75rem 1rem; }
[dir="rtl"] .field__control--toggle.field__control--icon .input[dir="ltr"] { padding-inline: 2.75rem 2.5rem; }
.field__toggle {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: grid;
  place-items: center;
  width: 2.75rem;
  color: var(--text-muted);
  border-radius: var(--r-12);
  transition: color var(--t-fast) var(--ease);
}
.field__toggle .icon { font-size: 1.125rem; }
.field__toggle[aria-pressed="true"] { color: var(--burgundy); }
.field__toggle--strike[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  width: 1.375rem;
  height: 2px;
  border-radius: var(--r-full);
  background: currentColor;
  rotate: -45deg;
  box-shadow: 0 0 0 1.5px var(--surface);
}
@media (hover: hover) {
  .field__toggle:hover { color: var(--ink); }
}

/* ---- Checkbox -------------------------------------------------------------
   <label class="check"><input type="checkbox" name="…">
     <span class="check__box"><svg class="icon" aria-hidden="true"><use href="#i-check"></use></svg></span> النص</label> */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: .625rem;
  font-size: var(--fs-14);
  color: var(--text);
  cursor: pointer;
}
.check input {
  position: absolute;
  opacity: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
}
.check__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  margin-block-start: .125rem;
  border: 1.5px solid var(--line-rose-strong);
  border-radius: var(--r-4);
  background: var(--surface);
  color: transparent;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.check__box .icon { font-size: .75rem; }
.check input:checked + .check__box { background: var(--burgundy); border-color: var(--burgundy); color: var(--text-on-dark); }
.check input:focus-visible + .check__box { box-shadow: var(--focus); }
.field.is-invalid .check__box { border-color: var(--burgundy); }

/* ---- Choice group (radio chips) -------------------------------------------
   <fieldset class="choices">
     <legend class="field__label">الجنس</legend>
     <label class="choice"><input type="radio" name="g" value="f" required><span class="choice__label">أنثى</span></label> …
   </fieldset> */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  border: 0;
  padding: 0;
  margin: 0;
}
.choice { position: relative; }
.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.choice__label {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .375rem 1rem;
  border-radius: var(--r-8);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text);
  background: var(--sand);
  border: 1px solid var(--line);
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
@media (min-width: 40rem) {
  .choice__label { min-height: 2.25rem; }
}
@media (hover: hover) {
  .choice:hover .choice__label { border-color: var(--burgundy); }
}
.choice input:checked + .choice__label { color: var(--text-on-dark); background: var(--burgundy); border-color: var(--burgundy); }
.choice input:focus-visible + .choice__label { box-shadow: var(--focus); }
.choice input:disabled + .choice__label { opacity: .5; text-decoration: line-through; cursor: not-allowed; }
.field.is-invalid .choice__label { border-color: var(--burgundy); }

/* ---- Switch ---------------------------------------------------------------
   <label class="switch">
     <input class="switch__input cover-input" type="checkbox" role="switch">
     <span class="switch__label">إظهار المتاحات فقط</span>
     <span class="switch__track" aria-hidden="true"></span>
   </label> */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 2.75rem;
  font-size: var(--fs-16);
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  cursor: pointer;
}
.switch__track {
  position: relative;
  flex: none;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: var(--r-full);
  background: var(--line-rose-strong);
  transition: background-color var(--t-fast) var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute;
  inset-block-start: .125rem;
  inset-inline-start: .125rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--sh-xs);
  transition: translate var(--t-fast) var(--ease);
}
.switch__input:checked ~ .switch__track { background: var(--green); }
.switch__input:checked ~ .switch__track::after { translate: calc(var(--dir) * 1.25rem) 0; }
.switch__input:focus-visible ~ .switch__track { box-shadow: var(--focus); }

/* ---- Upload zone ----------------------------------------------------------
   <label class="upload">
     <input type="file" name="…" accept=".pdf,.png" data-max-mb="5">
     <span class="upload__icon"><svg class="icon" aria-hidden="true">…</svg></span>
     <span class="upload__text"><strong>اسحبي الملف هنا</strong> أو اضغطي للتصفح</span>
     <span class="upload__types" aria-hidden="true"><span>PDF</span><span>PNG</span></span>
   </label>
   <ul class="upload-files"><li>اسم الملف <small>120 KB</small><button class="upload-files__remove" type="button" aria-label="إزالة الملف">…</button></li></ul>
   Ground: --upload-bg. app.js checks type and size (data-max-mb) and reports in the field's .field__error. */
.upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6);
  text-align: center;
  border: 1.5px dashed var(--line-rose-strong);
  border-radius: var(--r-12);
  background: var(--upload-bg, var(--tint-warm));
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload:focus-within,
.upload.is-drag { border-color: var(--burgundy); background: var(--danger-soft); }
@media (hover: hover) {
  .upload:hover { border-color: var(--burgundy); background: var(--danger-soft); }
}
.field.is-invalid .upload { border-color: var(--burgundy); }
.upload__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-block-end: var(--sp-3);
  color: var(--burgundy);
  background: var(--surface);
  border-radius: var(--r-16);
  box-shadow: var(--sh-xs);
}
.upload__icon .icon { font-size: 1.5rem; }
.upload__text { font-size: var(--fs-14); font-weight: 700; line-height: 1.45; color: var(--ink); }
.upload__text strong { color: var(--burgundy); }
.upload__types {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
  margin-block-start: var(--sp-3);
  direction: ltr;
}
.upload__types span {
  padding: .25rem .625rem;
  font-size: var(--fs-11);
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  background: var(--sand-strong);
  border-radius: var(--r-8);
}
.upload-files { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.upload-files li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: 100%;
  padding: .375rem .75rem;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-rose-strong);
  border-radius: var(--r-8);
  overflow-wrap: anywhere;
}
.upload-files small { font-size: var(--fs-11); font-weight: 400; color: var(--text-muted); }
.upload-files__remove {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-inline-end: -.25rem;
  color: var(--text-muted);
  border-radius: 50%;
}
.upload-files__remove .icon { font-size: .75rem; }
@media (hover: hover) {
  .upload-files__remove:hover { color: var(--burgundy); background: var(--burgundy-soft); }
}


/* ==========================================================================
   LOADING
   ========================================================================== */

/* ---- Skeleton (placeholder while content loads) ---------------------------
   <span class="skeleton skeleton--media"></span>
   <span class="skeleton skeleton--text"></span><span class="skeleton skeleton--text"></span>
   <span class="skeleton skeleton--circle"></span>
   Custom properties: --skeleton-radius, --skeleton-width (text line), --skeleton-size (circle),
   --media-ratio (media). Static tint under prefers-reduced-motion. */
.skeleton {
  display: block;
  border-radius: var(--skeleton-radius, var(--r-8));
  background-color: var(--sand-strong);
}
.skeleton--text { width: var(--skeleton-width, 100%); height: .75rem; margin-block: .375rem; }
.skeleton--text:last-child { width: var(--skeleton-width, 60%); }
.skeleton--circle { width: var(--skeleton-size, 3rem); height: var(--skeleton-size, 3rem); border-radius: 50%; }
.skeleton--media { aspect-ratio: var(--media-ratio, 16 / 9); border-radius: var(--skeleton-radius, var(--r-12)); }
/* the block app.js generates for a lazy list that has no <template data-skeleton> */
.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-24);
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton,
  .js-ready .media[data-media]:not(.is-loaded):not(.is-broken) {
    background-image: linear-gradient(100deg, var(--sand-strong) 30%, var(--sand) 50%, var(--sand-strong) 70%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s linear infinite;
  }
}
@keyframes skeleton-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---- Media (image with a skeleton until it has loaded) --------------------
   <figure class="card__media media" data-media>
     <img src="…" alt="…" width="640" height="360" loading="lazy" decoding="async">
   </figure>
   app.js adds .is-loaded (the image fades in) or .is-broken (neutral ground, no broken-image icon).
   Without JavaScript the image is simply shown. */
.media { position: relative; overflow: hidden; background-color: var(--sand-strong); }
.js-ready .media[data-media] img { opacity: 0; transition: opacity .3s var(--ease), scale .45s var(--ease); }
.js-ready .media[data-media].is-loaded img { opacity: 1; }
.media.is-broken img { visibility: hidden; }
.media.is-broken::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d706e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 16l5-5 4 4 3-3 6 6'/%3E%3Ccircle cx='15.5' cy='9.5' r='1.5'/%3E%3C/svg%3E") center / 2rem no-repeat;
  opacity: .6;
}

/* ---- Lazy list ------------------------------------------------------------
   <ul class="grid grid--3" data-lazy-list data-initial="6" data-batch="6"> <li>…</li> … </ul>
   app.js marks the items after the first ones with data-lazy-pending and shows them in batches. */
[data-lazy-pending][data-lazy-pending] { display: none; }
[data-lazy-sentinel] { height: 1px; }

/* ---- Reveal on enter -----------------------------------------------------
   <li data-reveal>…</li>            default: rises from below, sharpening as it arrives
   data-reveal="drop"                falls from above and settles with a small overshoot (cards)
   data-reveal="slide-start|slide-end"  enters from the start / end side (inline direction)
   data-reveal="scale"               grows from 88%
   data-reveal="blur"                comes into focus in place
   optional data-reveal-delay="200"  (milliseconds); siblings that arrive together are staggered by app.js
   Hidden only when app.js is running (html.js-ready) and motion is allowed. */
@media (prefers-reduced-motion: no-preference) {
  .js-ready [data-reveal] {
    opacity: 0;
    translate: 0 36px;
    filter: blur(6px);
    transition:
      opacity var(--t-reveal) var(--ease-soft),
      filter var(--t-reveal) var(--ease-soft),
      translate var(--t-reveal) var(--ease),
      scale var(--t-reveal) var(--ease),
      rotate var(--t-reveal) var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .js-ready [data-reveal="drop"] {
    translate: 0 -72px;
    rotate: var(--drop-tilt, -2.5deg);
    scale: .94;
    filter: blur(3px);
    transition:
      opacity calc(var(--t-reveal) * .7) var(--ease-soft),
      filter var(--t-reveal) var(--ease-soft),
      translate calc(var(--t-reveal) * 1.15) var(--ease-drop),
      scale calc(var(--t-reveal) * 1.15) var(--ease-drop),
      rotate calc(var(--t-reveal) * 1.15) var(--ease-drop);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .js-ready [data-reveal="slide-start"] { translate: calc(var(--dir) * -56px) 0; }
  .js-ready [data-reveal="slide-end"]   { translate: calc(var(--dir) * 56px) 0; }
  .js-ready [data-reveal="scale"]       { translate: 0 16px; scale: .88; }
  .js-ready [data-reveal="blur"]        { translate: none; filter: blur(14px); }
  .js-ready [data-reveal].is-revealed {
    opacity: 1;
    translate: none;
    scale: none;
    rotate: var(--rest-rotate, none);
    filter: none;
  }

  /* lines that draw themselves: <span data-draw> (horizontal) or <span data-draw="y"> (vertical) */
  .js-ready [data-draw] {
    scale: 0 1;
    transform-origin: right center;
    transition: scale calc(var(--t-reveal) * 1.4) var(--ease-soft);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .js-ready [data-draw="y"] { scale: 1 0; transform-origin: center top; }
  .js-ready [data-draw].is-drawn { scale: 1 1; }
}

/* ---- Counters -------------------------------------------------------------
   <span data-count="500" data-count-prefix="+">+500</span>
   The numbers count up once when the element is on screen. The original text stays in the
   markup (it is what search engines, screen readers and reduced-motion users get).
   Optional: data-count-suffix="%", data-count-decimals="1", data-count-group="true" (1,000),
   data-count-digits="ar" (٠–٩), data-count-duration="2200" (ms). */
.count { display: inline-grid; justify-items: start; font-variant-numeric: tabular-nums; }
.count__ghost, .count__live { grid-area: 1 / 1; }
.count__ghost { visibility: hidden; }

/* ---- Ambient motion -------------------------------------------------------
   Decorative loops (orbits, glows) run only while their section is on screen:
   <div data-ambient> … animation-play-state: var(--ambient-state, running) … </div> */
[data-ambient]:not(.is-inview) { --ambient-state: paused; }
@media (prefers-reduced-motion: reduce) {
  [data-ambient] * { animation: none !important; }
}

/* ---- Small hover motion for icons inside cards ------------------------------ */
.icon-tile { transition: scale var(--t-med) var(--ease-drop), rotate var(--t-med) var(--ease-drop); }
@media (hover: hover) {
  .card:hover .icon-tile { scale: 1.1; rotate: -5deg; }
}
