/*
 * Module sections — the section page hero (on the catalog template), the landing strip and the
 * «الأقسام» admin section. Prefix `sec-` (plus the catalog's own `cat-scope-*` hooks). Tokens only
 * (assets/css/ds/tokens.css): light/dark follow them. Mobile first, RTL (logical properties).
 */
.sec-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Section page: the hero on the catalog template ─────────────────────────────── */
.cat-scope-head { flex-wrap: wrap; gap: var(--sp-3); }
.cat-scope-head h1 { overflow-wrap: anywhere; }
.cat-scope-head p { max-width: 70ch; overflow-wrap: anywhere; }
.cat-scope-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.cat-scope-actions:empty { display: none; }

/* ── Landing strip ───────────────────────────────────────────────────────────────── */
.sec-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }
@media (min-width: 640px) { .sec-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.sec-card { padding: 0; overflow: hidden; }
.sec-card-link { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); color: var(--text); text-decoration: none; height: 100%; box-sizing: border-box; }
.sec-card-link:hover { background: var(--surface-2); }
.sec-card-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sec-card-ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand); }
.sec-card-body { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.sec-card-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); overflow-wrap: anywhere; }
.sec-card-desc { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; overflow-wrap: anywhere; }
.sec-card-meta { align-self: flex-start; margin-top: var(--sp-1); }

/* ── Admin section ──────────────────────────────────────────────────────────────── */
/* keep the visually-hidden labels inside their scroll box (else they widen the page on a phone) */
#section-sections .ds-table-wrap, #section-sections .ds-card { position: relative; }
.sec-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.sec-row-actions { white-space: nowrap; }
.sec-row-actions .ds-btn + .ds-btn { margin-inline-start: var(--sp-1); }
.sec-form { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); padding: var(--sp-4); }
@media (min-width: 720px) { .sec-form { grid-template-columns: 1fr 1fr; } }
.sec-wide { grid-column: 1 / -1; }
.sec-terms { border: 0; margin: 0; padding: 0; min-width: 0; }
.sec-terms legend { padding: 0; margin-bottom: var(--sp-2); font-weight: var(--fw-semibold, 600); }
.sec-terms-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-2); }
.sec-term { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.sec-term .ds-input { width: 100%; min-width: 0; }
.sec-slug { display: flex; align-items: center; gap: var(--sp-1); direction: ltr; }
.sec-slug .ds-input { flex: 1 1 auto; min-width: 0; }
.sec-slug-pre { color: var(--text-3); font-family: var(--font); white-space: nowrap; }
.sec-help { color: var(--text-3); font-size: var(--fs-xs); }
.sec-opt { color: var(--text-3); font-weight: var(--fw-regular); font-size: var(--fs-xs); }
.sec-err { margin: 0; color: var(--bad); font-size: var(--fs-xs); }
.sec-form [aria-invalid="true"] { border-color: var(--bad); }
.sec-inline { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-2); }
.sec-inline .ds-input, .sec-inline .ds-select { flex: 1 1 200px; min-width: 0; }
.sec-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.sec-spec { padding: 0 var(--sp-4) var(--sp-4); border-top: 1px solid var(--border); }
.sec-spec-title { font-size: var(--fs-md); margin: var(--sp-4) 0 var(--sp-2); }
.sec-spec-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.sec-spec-row { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2); align-items: center; padding: var(--sp-2);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sec-spec-row .ds-input { min-width: 0; }
.sec-spec-n { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); }
.sec-spec-count { grid-column: 2; }
.sec-spec-btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-1); justify-content: flex-end; }
@media (min-width: 720px) {
  .sec-spec-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .sec-spec-count, .sec-spec-btns { grid-column: auto; }
}
.sec-spec-pub { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.sec-spec-pub .sec-slug { flex: 1 1 220px; min-width: 0; }
.sec-spec-pub .ds-select { flex: 0 1 220px; min-width: 0; }
.sec-public { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); margin: 0; min-width: 0; display: grid; gap: var(--sp-3); }
.sec-public legend { padding: 0 var(--sp-1); font-weight: var(--fw-semibold); }
.sec-public-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }
@media (min-width: 720px) { .sec-public-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sec-spec-empty { color: var(--text-3); padding: var(--sp-2) 0; }
.sec-preset-row label { font-size: var(--fs-sm); color: var(--text-2); }
.sec-report { margin-top: var(--sp-3); }
