/* منظومة الرياضة: the section page, the federations / clubs / committees lists (Figma 571:83422, 1023:210403,
   1023:214831) and a body's page (1023:208188, 1080:221090, 1023:217045). Layout and colours use the shared tokens. */

/* section page: one card per list */
.system-sections { padding-block: var(--sp-7) var(--sp-9); }
.system-sections__grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.system-section { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.system-section:hover { box-shadow: var(--shadow-raised); border-color: var(--gold); }
.system-section:has(a:focus-visible) { outline: 2px solid var(--gold-strong); outline-offset: 2px; }
.system-section__media { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--surface-2); color: var(--gold-strong); }
.system-section__media img, .system-section__media picture { width: 100%; height: 100%; object-fit: cover; }
.system-section__media .icon { width: 48px; height: 48px; }
.system-section__body { padding: var(--sp-5); }
.system-section__title { font-size: var(--fs-h4); font-weight: 800; line-height: 1.5; }
.system-section__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.system-section__title a:focus-visible { outline: none; box-shadow: none; }
.system-section:hover .system-section__title a { color: var(--gold-strong); }
.system-section__text { margin-top: var(--sp-2); color: var(--text-3); font-size: var(--fs-small); line-height: 1.8; }

/* lists */
.bodies { padding-block: var(--sp-6) var(--sp-9); }
.bodies-search { max-width: 1323px; margin: 0 auto var(--sp-9); }
.bodies-search__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.bodies-search__field { flex: 1 1 320px; }
.bodies-search__field input { width: 100%; min-height: var(--control-h-lg); padding: 0 var(--sp-7) 0 var(--sp-4); border: 1px solid var(--border-control); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-ui); }
[dir="ltr"] .bodies-search__field input { padding: 0 var(--sp-4) 0 var(--sp-7); }
.bodies-search__field input:focus { outline: none; border-color: var(--gold-strong); background: var(--surface); box-shadow: var(--focus); }
.bodies-search__field input::placeholder { color: var(--text-3); opacity: 1; }
.bodies-search__field .icon { position: absolute; inset-inline-start: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--text-3); }
.bodies-search__select { flex: 0 1 200px; }
/* the federations' photo card: the title, a line and the search on a darkened photo */
.bodies-search--card { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--sp-5); min-height: 574px; padding: var(--sp-7); overflow: hidden; border-top: 4px solid var(--gold); border-radius: var(--r-lg); background: var(--ink); color: #fff; box-shadow: var(--shadow-raised); }
.bodies-search--card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to left, rgb(16 19 20 / .85), rgb(16 19 20 / .35) 70%); }
[dir="ltr"] .bodies-search--card::before { background: linear-gradient(to right, rgb(16 19 20 / .85), rgb(16 19 20 / .35) 70%); }
.bodies-search__bg, .bodies-search--card picture { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; }
.bodies-search--card img { width: 100%; height: 100%; object-fit: cover; }
.bodies-search__text { max-width: 560px; }
.bodies-search__title { color: #fff; font-size: var(--fs-h1); font-weight: 500; line-height: 1.4; }
.bodies-search__lead { margin-top: var(--sp-3); color: rgb(255 255 255 / .9); font-size: var(--fs-lead); font-weight: 700; line-height: 2.2; }
.bodies-search--card .bodies-search__row { max-width: 560px; }
.bodies-search--card .bodies-search__field input { border-color: rgb(255 255 255 / .7); background: rgb(255 255 255 / .94); }
.bodies__heading { margin-bottom: var(--sp-8); text-align: start; }

.body-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-7); }
/* three large logo cards a row, committees two (571:83422, 1023:210403, 1023:214831) */
.body-grid--committee { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6); }
.body-grid__empty { grid-column: 1 / -1; }
.body-card { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.body-card:hover { box-shadow: var(--shadow-raised); border-color: var(--gold); }
.body-card:has(a:focus-visible) { outline: 2px solid var(--gold-strong); outline-offset: 2px; }
.body-card__logo { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--surface); color: var(--gold-strong); }
.body-card__logo img { position: absolute; inset: var(--sp-4); width: calc(100% - 2 * var(--sp-4)); height: calc(100% - 2 * var(--sp-4)); object-fit: contain; }
.body-card__logo .icon { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; }
.body-card__body { display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; padding: var(--sp-4) var(--sp-5) var(--sp-5); border-top: 1px solid var(--border); }
.body-card__tag { align-self: flex-start; }
.body-card__title { font-size: var(--fs-h4); font-weight: 800; line-height: 1.5; }
.body-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.body-card__title a:focus-visible { outline: none; box-shadow: none; }
.body-card:hover .body-card__title a { color: var(--gold-strong); }
.body-card__text { color: var(--text-3); font-size: var(--fs-lead); line-height: 1.8; }
.body-card--committee .body-card__logo { aspect-ratio: 5 / 4; }
.body-card--committee .body-card__text { color: var(--text); font-weight: 700; }
.body-card--committee .body-card__logo img { inset: var(--sp-5); width: calc(100% - 2 * var(--sp-5)); height: calc(100% - 2 * var(--sp-5)); }

/* a body's page */
.sports-body { padding-bottom: var(--sp-9); }
.sports-body__top { padding-top: var(--sp-6); }
.body-slider .facility-slider__slide { aspect-ratio: 1340 / 564; }
.sports-body__logo { position: relative; max-width: 1340px; aspect-ratio: 1340 / 564; margin-inline: auto; border: 2px solid var(--border); border-radius: var(--r-lg); background: transparent; }
.sports-body__logo img { position: absolute; inset: var(--sp-6); width: calc(100% - 2 * var(--sp-6)); height: calc(100% - 2 * var(--sp-6)); object-fit: contain; }
.sports-body__head { margin-top: var(--sp-6); }
.sports-body__title { color: var(--gold-strong); font-size: var(--fs-h1); font-weight: 800; line-height: 1.4; }
.sports-body__place { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); color: var(--text); font-size: var(--fs-h4); font-weight: 400; }
.sports-body__place .icon { width: 32px; height: 32px; padding: var(--sp-2); border-radius: var(--r-sm); background: var(--selected-bg); color: var(--gold-strong); }
.sports-body__about { margin-top: var(--sp-5); color: var(--text-3); font-size: var(--fs-lead); line-height: var(--lh-body); }
.sports-body__about .rich-text > * + * { margin-top: 1em; }
.sports-body__band { margin-top: var(--sp-8); }
.sports-body__band--cream { position: relative; isolation: isolate; padding-block: var(--sp-7); border-top: 4px solid var(--gold); background: var(--selected-bg); }
.sports-body__band--cream::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background-color: var(--gold); opacity: .05; pointer-events: none;
  -webkit-mask: url("../core/img/pattern-sports.6f987643372c.webp") repeat -120px -40px / 1650px 896px;
          mask: url("../core/img/pattern-sports.6f987643372c.webp") repeat -120px -40px / 1650px 896px;
}
.sports-body__band--cream + .sports-body__band--cream { margin-top: 0; }
.sports-body__band--cream .body-contacts .icon { background: var(--surface); }
/* the club's sports in a cream panel (1080:221090) */
.sports-body__band--panel > .container { position: relative; isolation: isolate; overflow: hidden; padding-block: var(--sp-7); border: 1px solid var(--gold); border-radius: var(--r-lg); background: var(--selected-bg); }
.sports-body__band--panel > .container::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background-color: var(--gold); opacity: .05; pointer-events: none;
  -webkit-mask: url("../core/img/pattern-sports.6f987643372c.webp") repeat -120px -40px / 1650px 896px;
          mask: url("../core/img/pattern-sports.6f987643372c.webp") repeat -120px -40px / 1650px 896px;
}
.bodies-search:not(.bodies-search--card) { padding-bottom: var(--sp-5); border-bottom: 1px solid var(--border); }
/* the same title and section headings as facility, news and event pages (1080:221090, 1023:208188) */
.sports-body__heading { margin-bottom: var(--sp-6); color: var(--gold-strong); font-size: var(--fs-h2); font-weight: 800; line-height: 1.4; }

/* the club's sports (1080:221090): equal chips with a large icon */
.body-sports { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-5); }
.body-sports li { display: grid; justify-items: center; align-content: center; gap: var(--sp-3); min-height: 140px; padding: var(--sp-6) var(--sp-4); border: 2px solid var(--gold-strong); border-radius: var(--r-md); background: var(--surface); font-size: var(--fs-h4); font-weight: 700; text-align: center; }
.body-sports .icon { width: 40px; height: 40px; color: var(--gold-strong); }

/* milestones on a line (1023:208188): dots, years, then the text, oldest at the start */
.milestones-scroll { overflow-x: auto; padding-bottom: var(--sp-2); }
.milestones-scroll:focus-visible { outline: 2px solid var(--gold-strong); outline-offset: 4px; }
/* as wide as its years (the line then runs under every one), and at least as wide as the band */
.milestones { list-style: none; position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: var(--sp-5); width: max-content; min-width: 100%; }
.milestones::before { content: ""; position: absolute; inset-inline: 0; top: 20px; height: 4px; background: var(--border); }
.milestones-scroll { margin-top: var(--sp-8); }
.milestone { position: relative; display: grid; justify-items: center; align-content: start; gap: var(--sp-2); text-align: center; }
.milestone__dot { position: relative; width: 44px; height: 44px; border: 4px solid var(--gold); border-radius: 50%; background: var(--surface) radial-gradient(circle, var(--text) 0 5px, transparent 6px); }
.milestone__year { font-size: var(--fs-h3); font-weight: 800; }
.milestone__title { font-size: var(--fs-h4); font-weight: 800; }
.milestone__title + .milestone__text { font-weight: 400; }
.milestone__text { max-width: 220px; color: var(--text); font-size: var(--fs-lead); font-weight: 700; line-height: 1.8; }

/* photo gallery (1080:221090): two columns, caption over the photo's foot */
.body-gallery { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.body-gallery__item { position: relative; display: block; overflow: hidden; border-radius: var(--r-md); aspect-ratio: 33 / 20; background: var(--surface-2); border: 2px solid var(--gold-strong); }
.body-gallery__item img, .body-gallery__item picture { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease); }
.body-gallery__item:hover img { transform: scale(1.03); }
.body-gallery__caption { position: absolute; inset-inline: 0; bottom: 0; padding: var(--sp-6) var(--sp-4) var(--sp-3); background: linear-gradient(to top, rgb(16 19 20 / .85), transparent); color: #fff; font-size: var(--fs-h4); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .body-gallery__item img { transition: none; } }

/* athletes (1023:217045): a row of portrait cards that scrolls sideways, with the drawn round arrows */
.athletes-wrap { position: relative; }
.athletes__arrow { position: absolute; top: calc(50% - 44px); z-index: 1; box-shadow: var(--shadow-raised); }
.athletes__arrow--prev { inset-inline-start: -12px; }
.athletes__arrow--next { inset-inline-end: -12px; }
.athletes-scroll { overflow-x: auto; padding-bottom: var(--sp-3); scroll-snap-type: x mandatory; }
.athletes-scroll:focus-visible { outline: 2px solid var(--gold-strong); outline-offset: 4px; }
/* three large cards across the row, more scroll sideways (1023:217045) */
.athletes { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, calc((100% - 2 * var(--sp-5)) / 3)); gap: var(--sp-5); }
.athlete { overflow: hidden; scroll-snap-align: start; background: var(--surface); border: 2px solid var(--gold); border-radius: var(--r-lg); text-align: start; }
.athlete__photo { display: grid; place-items: center; aspect-ratio: 5 / 4; background: var(--surface-2); color: var(--text-3); }
.athlete__photo img, .athlete__photo picture { width: 100%; height: 100%; object-fit: cover; }
.athlete__photo .icon { width: 48px; height: 48px; }
.athlete__name { padding: var(--sp-5) var(--sp-4) 0; font-size: var(--fs-h3); font-weight: 800; }
.athlete__sport { padding: var(--sp-2) var(--sp-4) var(--sp-5); color: var(--gold-strong); font-size: var(--fs-h4); font-weight: 700; }

/* contacts (1023:208188): one row of icon + text, then the social pages */
.sports-body__contact-text { max-width: 760px; margin-bottom: var(--sp-5); color: var(--text-3); font-size: var(--fs-h3); line-height: 1.8; }
.body-contacts { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-7); }
.body-contacts li { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; font-size: var(--fs-lead); }
.body-contacts li + li { padding-inline-start: var(--sp-7); border-inline-start: 1px solid var(--border); }
.body-contacts .icon { flex: none; width: 48px; height: 48px; padding: var(--sp-3); border-radius: var(--r-sm); background: var(--selected-bg); color: var(--gold-strong); }
.body-contacts a { overflow-wrap: anywhere; font-weight: 700; }
.body-contacts a:hover { color: var(--gold-strong); }
.body-social { display: inline-flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5); color: var(--gold-strong); font-size: var(--fs-h4); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.body-social .icon { width: 56px; height: 56px; }
.body-contacts + .body-social, .body-social + .body-social { margin-inline-end: var(--sp-5); }

@media (max-width: 1100px) {
  .system-sections__grid, .body-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) { .sports-body__title { font-size: var(--fs-h2); } }
@media (max-width: 640px) {
  .system-sections__grid, .body-grid, .body-grid--committee, .body-gallery { grid-template-columns: minmax(0, 1fr); }
  .body-grid:not(.body-grid--committee) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); } /* two logo cards a row on phones (revises R-53) */
  .body-grid:not(.body-grid--committee) .body-card__title { font-size: var(--fs-body); }
  .body-grid:not(.body-grid--committee) .body-card__body { padding: var(--sp-3); }
  .bodies-search--card { min-height: 0; padding: var(--sp-5); }
  .bodies-search__select { flex: 1 1 140px; }
  .bodies-search__submit { flex: 1 1 100%; }
  .body-contacts li + li { padding-inline-start: 0; border-inline-start: 0; }
  .sports-body__logo { aspect-ratio: auto; height: 220px; }
  .sports-body__title, .sports-body__heading { font-size: var(--fs-h3); }
  .milestones { grid-auto-columns: 200px; }
  .body-contacts { flex-direction: column; }
}
