/* =========================================================================
   Jamaity — components

   Every block below maps 1:1 to a PHP template part when we convert:
     .c-btn            -> template-parts/ui/button.php
     .c-tag            -> template-parts/ui/tag.php
     .c-field          -> template-parts/ui/field.php
     .c-searchbar      -> template-parts/ui/searchbar.php
     .c-toolbar        -> template-parts/ui/toolbar.php
     .c-avatar         -> template-parts/ui/avatar.php
     .c-stat           -> template-parts/ui/stat.php
     .c-band           -> template-parts/section/band.php
     .c-card           -> template-parts/card/base.php
     .c-card--thumb    -> template-parts/card/thumb.php
     .c-card--row      -> template-parts/card/row.php
     .c-card--date     -> template-parts/card/date.php
     .c-card--org      -> template-parts/card/organisation.php

   Keep that mapping true and the port stays mechanical.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Button
   Fully-rounded because every terminal in the logo is a semicircle.
   ------------------------------------------------------------------------- */

.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding-block: var(--sp-3);
  padding-inline: var(--sp-6);
  border-radius: var(--radius-pill);
  border: var(--stroke) solid transparent;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color     var(--dur-fast) var(--ease-out),
    color            var(--dur-fast) var(--ease-out),
    transform        var(--dur-fast) var(--ease-out),
    box-shadow       var(--dur-base) var(--ease-out);
}

.c-btn:active { transform: translateY(1px); }

.c-btn--primary {
  background: var(--surface-brand);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-sm);
}
.c-btn--primary:hover {
  background: var(--surface-brand-hover);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-md);
}

/* Mint is a tint, so it carries deep blue text — never white. 8.0:1. */
.c-btn--accent {
  background: var(--surface-accent);
  color: var(--text-on-accent);
}
.c-btn--accent:hover {
  background: var(--mint-300);
  color: var(--blue-900);
}

.c-btn--outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.c-btn--outline:hover {
  border-color: var(--border-brand);
  color: var(--text-link);
  background: var(--surface-brand-soft);
}

.c-btn--ghost {
  background: transparent;
  color: var(--text-link);
  padding-inline: var(--sp-4);
}
.c-btn--ghost:hover { background: var(--surface-brand-soft); }

/* On a blue band, the outline button inverts. */
.c-btn--on-brand {
  background: transparent;
  border-color: hsl(0 0% 100% / 0.45);
  color: #fff;
}
.c-btn--on-brand:hover {
  background: hsl(0 0% 100% / 0.1);
  border-color: #fff;
  color: #fff;
}

.c-btn--lg { padding-block: var(--sp-4); padding-inline: var(--sp-8); font-size: var(--fs-md); }
.c-btn--sm { padding-block: var(--sp-2); padding-inline: var(--sp-4); font-size: var(--fs-xs); }

.c-btn--icon {
  padding: var(--sp-3);
  aspect-ratio: 1;
}

/* Arrow nudge — direction-aware, so it points the right way in RTL. */
.c-btn .icon--arrow {
  transition: transform var(--dur-base) var(--ease-out);
}
.c-btn:hover .icon--arrow {
  transform: translateX(3px);
}
[dir="rtl"] .c-btn:hover .icon--arrow {
  transform: translateX(-3px) scaleX(-1);
}
[dir="rtl"] .c-btn .icon--arrow { transform: scaleX(-1); }

/* -------------------------------------------------------------------------
   Tag / pill
   ------------------------------------------------------------------------- */

/* Default is an outline, not a pastel fill. A grid of twelve cards each
   carrying two or three filled pastel chips is the single most generated-
   looking thing a directory can do. Fills are reserved for status, where the
   colour is information rather than decoration. */
.c-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding-block: calc(var(--sp-1) - 1px);
  padding-inline: var(--sp-3);
  border-radius: var(--radius-pill);
  border: var(--stroke) solid var(--border);
  background: transparent;
  color: var(--text-muted);
  /* Chrome: raw scale, so a tag is the same size in every language and a
     row of cards keeps one baseline. */
  font-size: var(--fs-xs-raw);
  font-weight: var(--fw-medium);
  line-height: 1.5;
  text-decoration: none;
  /* Tag text comes from the catalogue's own taxonomy, so its length is not
     ours to assume — "Développement économique et social" is one term. nowrap
     made it overflow the card instead of wrapping. Short labels (status,
     region) still never wrap, because they fit. */
  white-space: normal;
  max-inline-size: 100%;
}

a.c-tag {
  transition:
    border-color var(--dur-fast) var(--ease-out),
    color        var(--dur-fast) var(--ease-out);
}
a.c-tag:hover { border-color: var(--border-strong); color: var(--text); }

/* Category marker: no box at all. Reads as a label, not a chip. */
.c-tag--plain {
  border-color: transparent;
  padding-inline: 0;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  font-size: var(--fs-2xs-raw);
  color: var(--text-muted);
}
[lang="ar"] .c-tag--plain, [dir="rtl"] .c-tag--plain {
  text-transform: none;
  letter-spacing: 0;
}

/* Status — filled, because here the colour is the message. */
.c-tag--ok   { background: var(--ok-bg);   color: var(--ok);   border-color: transparent; }
.c-tag--warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.c-tag--stop { background: var(--stop-bg); color: var(--stop); border-color: transparent; }

.c-tag--dot::before {
  content: "";
  inline-size: 0.5em;
  block-size: 0.5em;
  border-radius: var(--radius-pill);
  background: currentColor;
  flex: none;
}

/* -------------------------------------------------------------------------
   Field
   ------------------------------------------------------------------------- */

.c-field { display: flex; flex-direction: column; gap: var(--sp-2); }

.c-field__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}

.c-field__control {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-3);
  padding-inline: var(--sp-5);
  border: var(--stroke) solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow   var(--dur-fast) var(--ease-out);
}

.c-field__control:focus-within {
  border-color: var(--border-brand);
  box-shadow: 0 0 0 3px var(--surface-brand-soft);
}

.c-field__control > .icon { color: var(--text-subtle); }

.c-field__control input,
.c-field__control select {
  flex: 1;
  min-inline-size: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--fs-sm);
}

.c-field__control input::placeholder { color: var(--text-subtle); }

/* Textareas and multi-line controls get the generous arc, not the pill. */
.c-field__control--block {
  border-radius: var(--radius-lg);
  align-items: flex-start;
}

/* -------------------------------------------------------------------------
   Search bar — the hero's two-field search, one pill containing both.
   The internal divider stops short of the edges: the open-gap rule.
   ------------------------------------------------------------------------- */

.c-searchbar {
  --control-h: 48px;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: var(--sp-2);
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
}

.c-searchbar__field {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-inline-size: 0;
  padding-inline: var(--sp-5);
  position: relative;
}

.c-searchbar__field + .c-searchbar__field::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block: 22%;                    /* stops short, top and bottom */
  inline-size: var(--stroke);
  background: var(--border);
}

.c-searchbar__field > .icon { color: var(--text-link); }

/* Icon-only submit. It has to be an exact circle, and `aspect-ratio` cannot
   deliver one here: the height comes from `align-items: stretch`, which is not
   a definite cross size, so the ratio never resolves and the button ends up as
   wide as its glyph plus padding. Both axes are therefore stated outright,
   against the same token the fields are floored to, so the two can't drift. */
.c-searchbar .c-btn--icon {
  align-self: center;
  flex: none;
  inline-size: var(--control-h);
  block-size: var(--control-h);
  padding: 0;
}

.c-searchbar__field { min-block-size: var(--control-h); }

.c-searchbar__field input {
  flex: 1;
  min-inline-size: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--fs-sm);
  padding-block: var(--sp-3);
}

@media (max-width: 720px) {
  .c-searchbar {
    flex-direction: column;
    border-radius: var(--radius-xl);
    gap: var(--sp-1);
  }
  .c-searchbar__field + .c-searchbar__field::before {
    inset-inline: 22%;
    inset-block: 0 auto;
    inline-size: auto;
    block-size: var(--stroke);
  }
  .c-searchbar .c-btn { inline-size: 100%; }
  /* Stacked: the submit spans the column like any other row, so the square
     sizing above has to be released on the inline axis. */
  .c-searchbar .c-btn--icon { inline-size: 100%; }
}

/* -------------------------------------------------------------------------
   Avatar / logo plate
   41 of the scraped logos have white baked into the file, so the plate is
   white by default and the mark is contained, never cropped.
   ------------------------------------------------------------------------- */

.c-avatar {
  display: grid;
  place-items: center;
  inline-size: var(--size, 56px);
  block-size: var(--size, 56px);
  flex: none;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: var(--stroke) solid var(--border);
  overflow: hidden;
}

.c-avatar img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
  padding: 12%;
}

.c-avatar--round { border-radius: var(--radius-pill); }
.c-avatar--round img { object-fit: cover; padding: 0; }

.c-avatar--lg { --size: 88px; }
.c-avatar--xl { --size: 120px; }

/* Initial fallback for records with no logo at all. */
.c-avatar__initial {
  font-size: calc(var(--size, 56px) * 0.38);
  font-weight: var(--fw-bold);
  color: var(--text-link);
  background: var(--surface-brand-soft);
  inline-size: 100%;
  block-size: 100%;
  display: grid;
  place-items: center;
}

/* -------------------------------------------------------------------------
   Card — the base every record card extends.
   Generous radius, monoline border, lift on hover. No shadow at rest:
   the directory shows 12+ at a time and resting shadows make a grid muddy.
   ------------------------------------------------------------------------- */

.c-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--surface-raised);
  border: var(--stroke) solid var(--border);
  block-size: 100%;

  /* Asymmetric corner, taken from the mark: the roof arcs, the foot does
     not. Logical properties, so it mirrors correctly in Arabic. */
  border-start-start-radius: var(--radius-xl);
  border-start-end-radius:   var(--radius-xl);
  border-end-end-radius:     var(--radius-xl);
  border-end-start-radius:   var(--radius-sm);

  transition:
    border-color var(--dur-base) var(--ease-out),
    background   var(--dur-base) var(--ease-out);
}

/* No lift, no shadow bloom. Twelve cards rising off the page in sequence is
   a stock interaction; the grid reads calmer and more considered when the
   card simply acknowledges the pointer. */
.c-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-sunken);
}

/* Whole-card link without nesting anchors — keeps the title a real link
   for assistive tech and keeps inner tags independently clickable. */
.c-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.c-card__link { text-decoration: none; color: inherit; }
.c-card:hover .c-card__link { color: var(--text-link); }

/* Title-led. The record's own words are the largest thing in the card;
   everything else is support.

   Clamped, because real catalogue titles run long ("OIM recrute un(e)
   Opérateur(rice) Salle de Contrôle Radio") and an unclamped title breaks the
   grid's rhythm — every card in the row grows to match the worst one.
   Two lines where the card is a block; one where it is a row or centred, since
   there a second line pushes the metadata out of alignment. */
.c-card__title {
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  font-weight: var(--fw-bold);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  /* balance fights the clamp — it reflows lines the clamp then cuts. */
  text-wrap: normal;
}

.c-card--row .c-card__title,
.c-card--org .c-card__title {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

/* The publishing organisation, set quietly on one line with a small mark. */
.c-card__org {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  min-inline-size: 0;
}
.c-card__org span { min-inline-size: 0; }

.c-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.c-card__meta-item { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* The rule stops short of both edges — the open-gap rule, and it keeps the
   card from looking like a stack of boxed rows. */
/* The footer is chrome, not running text: dates, a region, a status. It keeps
   the Latin scale in every language (--fs-*-raw) so that in a mixed grid the
   Arabic card's rule lands at exactly the same height as its neighbours'.
   Boosting it instead made the Arabic card ~5px taller and pushed its hairline
   onto a different fractional pixel, where it rendered soft and read thicker.
   This also settles the footer's own type, which previously inherited the card
   size and so sat larger than the tag beside it. */
.c-card__foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-block-start: auto;
  padding-block-start: var(--sp-4);
  font-size: var(--fs-xs-raw);
  line-height: var(--lh-snug);
}

.c-card__foot::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0 var(--sp-10);
  block-size: var(--stroke);
  background: var(--border);
}

/* Deadline urgency, shown on the opportunity card. */
.c-card__deadline { font-weight: var(--fw-semibold); }
.c-card__deadline--soon   { color: var(--warn); }
/* --muted, not --subtle: a closed deadline is still information the reader
   needs. --subtle measured 2.85:1 on white, below the 4.5:1 floor. */
.c-card__deadline--closed { color: var(--text-muted); }

/* -------------------------------------------------------------------------
   Card variants

   Four, because the catalogue is not one kind of record. They differ in
   *rhythm*, not decoration — what leads the card changes, so a grid of events
   never reads like a grid of opportunities.

     .c-card--thumb  image-led   -> events, publications, actualités
     .c-card--row    horizontal  -> search results, dense listings, dashboards
     .c-card--date   date-led    -> agenda
     .c-card--org    logo-led    -> organisation and expert directories

   All four keep the base card's asymmetric corner and its no-lift hover.
   ------------------------------------------------------------------------- */

/* --- A. Thumbnail ------------------------------------------------------- */

.c-card--thumb {
  padding: 0;
  gap: 0;
  overflow: hidden;   /* clips the media to the card's own radius */
}

.c-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-sunken);
  flex: none;
}

.c-card__media img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* Sits on a photograph, so it carries its own opaque ground rather than
   relying on the image behind it. */
.c-card__badge {
  position: absolute;
  inset-block-start: var(--sp-3);
  inset-inline-start: var(--sp-3);
  padding-block: var(--sp-1);
  padding-inline: var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-2xs-raw);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

[lang="ar"] .c-card__badge, [dir="rtl"] .c-card__badge {
  text-transform: none;
  letter-spacing: 0;
}

.c-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  flex: 1;
  min-inline-size: 0;
}

/* --- B. Horizontal ------------------------------------------------------ */

.c-card--row {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-5);
  block-size: auto;
}

.c-card--row .c-card__body { padding: 0; gap: var(--sp-2); }

.c-card--row .c-card__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;   /* flex-end is direction-aware, so this mirrors */
  gap: var(--sp-3);
  flex: none;
  text-align: end;
}

/* No footer rule in the row — the aside already separates the metadata. */
.c-card--row .c-card__foot { padding-block-start: 0; margin-block-start: 0; }
.c-card--row .c-card__foot::before { content: none; }

@media (max-width: 680px) {
  .c-card--row { flex-direction: column; align-items: stretch; gap: var(--sp-4); }
  .c-card--row .c-card__aside {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: start;
  }
}

/* --- C. Date-led -------------------------------------------------------- */

.c-card--date {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--sp-5);
}

.c-card__date {
  flex: none;
  inline-size: 68px;
  padding-block: var(--sp-3);
  text-align: center;
  border: var(--stroke) solid var(--border);
  /* Same asymmetric corner as the card, one step down. */
  border-start-start-radius: var(--radius-md);
  border-start-end-radius:   var(--radius-md);
  border-end-end-radius:     var(--radius-md);
  border-end-start-radius:   var(--radius-xs);
}

.c-card__date-day {
  font-size: var(--fs-xl-raw);
  font-weight: var(--fw-bold);
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}

.c-card__date-month {
  font-size: var(--fs-2xs-raw);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

[lang="ar"] .c-card__date-month, [dir="rtl"] .c-card__date-month {
  text-transform: none;
  letter-spacing: 0;
}

/* Today, or an event in progress — the one place the date block fills. */
.c-card__date--live {
  background: var(--surface-accent);
  border-color: transparent;
}
.c-card__date--live .c-card__date-day,
.c-card__date--live .c-card__date-month { color: var(--text-on-accent); }

.c-card--date .c-card__body { padding: 0; gap: var(--sp-2); }

/* --- D. Organisation ---------------------------------------------------- */

.c-card--org {
  align-items: center;
  text-align: center;
  gap: var(--sp-4);
  padding-block: var(--sp-8);
}

.c-card--org .c-card__title { font-size: var(--fs-md); }

.c-card--org .c-card__foot {
  inline-size: 100%;
  justify-content: center;
  gap: var(--sp-5);
}

/* Centred card, so the rule is inset symmetrically rather than stopped at
   one end — the open gap is kept, the asymmetry is not. */
.c-card--org .c-card__foot::before { inset-inline: var(--sp-6); }

.c-card--org .c-card__count {
  font-size: var(--fs-sm-raw);   /* chrome — see .c-card__foot */
  font-weight: var(--fw-semibold);
}

.c-card--org .c-card__count span {
  font-weight: var(--fw-regular);
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------
   Loader — the mark, looping

   Same masked trim as the one-shot reveal, but it goes out and comes back:
   the line draws to full, holds, then the head RETRACTS along the path it
   came down, back to nothing.

   The dash pattern is `L L`. Offset L hides everything, offset 0 shows
   everything. Sweeping L -> 0 -> L therefore draws and then un-draws in
   reverse, with the tail pinned at the start throughout.

   (Sweeping L -> 0 -> -L instead makes the tail chase the head, so the line
   keeps travelling forward and empties from the start. That reads as a
   second forward pass rather than a return, which is not what we want here.)

   NOTE: the mask id must be unique per instance. In PHP, generate it
   (wp_unique_id) — two loaders sharing an id on one page will both take the
   first mask.
   ------------------------------------------------------------------------- */

.c-loader {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
}

.c-loader__mark {
  inline-size: var(--loader-size, 88px);
  block-size: auto;
}

.c-loader__label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.c-loader [data-trim] {
  stroke-dasharray: var(--len, 428) var(--len, 428);
  animation: jam-loader-trim var(--loader-dur, 2600ms) linear infinite;
}

/* Eased at both ends rather than linear: the turnaround is the whole point of
   this loop, and a constant-speed reversal reads as a glitch. The hold at full
   extension lets the complete mark register before it goes back. */
@keyframes jam-loader-trim {
  0%   { stroke-dashoffset: var(--len, 428);
         animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  45%  { stroke-dashoffset: 0; }
  58%  { stroke-dashoffset: 0;
         animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  100% { stroke-dashoffset: var(--len, 428); }
}

.c-loader [data-mark="dot"] {
  transform-box: fill-box;
  transform-origin: center;
  animation: jam-loader-dot var(--loader-dur, 2600ms) linear infinite;
}

/* Lands as the line reaches full extension, leaves as it starts back. */
@keyframes jam-loader-dot {
  0%, 36%   { opacity: 0; transform: scale(0.3);
              animation-timing-function: cubic-bezier(0.16, 0.84, 0.44, 1); }
  46%, 58%  { opacity: 1; transform: none; }
  72%, 100% { opacity: 0; transform: scale(0.3); }
}

/* Full-screen variant. */
.c-loader--screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  background: var(--surface);
}

/* A loop that cannot be escaped is exactly what reduced-motion is for:
   show the finished mark instead of animating indefinitely. */
@media (prefers-reduced-motion: reduce) {
  .c-loader [data-trim] {
    animation: none;
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }
  .c-loader [data-mark="dot"] {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* -------------------------------------------------------------------------
   Band — full-bleed brand section. Inner content stays on the grid.
   ------------------------------------------------------------------------- */

.c-band {
  position: relative;
  overflow: hidden;
  background: var(--surface-brand);
  color: var(--text-on-brand);
  padding-block: var(--section-y);
}

.c-band :is(h1, h2, h3, h4, h5, h6) { color: inherit; }

/* Text on the blue is white or white-muted. Never the mint: it is a shape
   colour, and mint type on blue reads as a template. */
.c-band .u-eyebrow { color: var(--text-on-brand-muted); }
.c-band .u-muted   { color: var(--text-on-brand-muted); }
.c-band .c-tag     { border-color: var(--border-on-brand); color: var(--text-on-brand-muted); }

.c-band--deep   { background: var(--surface-brand-dp); }
.c-band--accent {
  background: var(--surface-accent-soft);
  color: var(--text);
}

/* -------------------------------------------------------------------------
   Toolbar — count / filter / sort above every listing grid.
   ------------------------------------------------------------------------- */

.c-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-4);
  border-block-end: var(--stroke) solid var(--border);
  /* The rule needs air beneath it or whatever follows appears to be hanging
     off it — the closing panel sat directly on the line. Owned here rather
     than added to each thing that happens to come next, which is how
     archive.php ended up carrying an inline margin for the grid. */
  margin-block-end: var(--sp-6);
}

.c-toolbar__count { font-size: var(--fs-sm); color: var(--text-muted); }
.c-toolbar__count strong { color: var(--text); font-weight: var(--fw-bold); }

/* -------------------------------------------------------------------------
   Stat — the figure blocks on the homepage.
   ------------------------------------------------------------------------- */

/* Figures, not KPI tiles. Set at heading scale in the running text colour,
   separated by hairlines rather than boxed — an oversized accent-coloured
   number in a 2x2 grid is stock dashboard furniture. */
.c-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6) 0;
}

.c-stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding-inline: var(--sp-8);
  flex: 1 1 auto;
  min-inline-size: max-content;
}

.c-stat:first-child { padding-inline-start: 0; }

/* Centred variant. The figures stop stretching (flex: none) — with flex-grow
   left on they would spread to the container edges and the row would only
   look centred by accident, at the one width where the maths happened to
   agree. The first child's padding comes back so the group is symmetrical. */
.c-stats--center { justify-content: center; text-align: center; }
.c-stats--center .c-stat { flex: none; padding-inline: var(--sp-12); }
.c-stats--center .c-stat:first-child { padding-inline-start: var(--sp-12); }

/* Narrow screens cannot afford --sp-12 either side of four figures; they wrap
   instead, and the rule between them is dropped on the wrapped rows. */
@media (max-width: 720px) {
  .c-stats--center .c-stat,
  .c-stats--center .c-stat:first-child { padding-inline: var(--sp-6); }
}

/* Hairline between figures, stopped short at both ends. */
.c-stat + .c-stat {
  border-inline-start: var(--stroke) solid var(--border);
}

.c-band .c-stat + .c-stat { border-inline-start-color: var(--border-on-brand); }

.c-stat__value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: lining-nums tabular-nums;
  color: inherit;
}

.c-stat__label {
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

.c-band .c-stat__label { color: var(--text-on-brand-muted); }

[lang="ar"] .c-stat__label, [dir="rtl"] .c-stat__label { letter-spacing: 0; }

@media (max-width: 720px) {
  .c-stat { padding-inline: var(--sp-5); }
  .c-stat:nth-child(odd) { padding-inline-start: 0; }
  .c-stat { flex: 1 1 40%; }
}
