/* campaigns.css — the campaigns section, the campaigns page and one campaign.
 *
 * No date and no countdown appears anywhere in here: a campaign's period is
 * administrative (decision, 2026-09-12). What a visitor reads is the amount,
 * the percentage — always, however small — and what one unit costs. */

.cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}
.cmp-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(15, 68, 89, 0.12);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 220ms cubic-bezier(.22,.61,.36,1), box-shadow 220ms ease, border-color 220ms ease;
}
.cmp-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(10, 42, 61, 0.12); border-color: rgba(201, 162, 39, 0.5); }
.cmp-card__media { position: relative; aspect-ratio: 16 / 10; background: #E8EDEF; }
.cmp-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* ONE FRAME FOR EVERY PICTURE (2026-09-13). Reported by Mohamed Fahim and
   measured at 375px: the frame's 16/10 is only a minimum once its content is
   taller, so a square photograph stretched its frame to 322x322 while India's
   landscape one stayed 322x201. Taken out of the flow, the picture can no
   longer size its frame: every card shows the same 16/10, cropped to cover. */
.cmp-card .cmp-card__media { overflow: hidden; }
.cmp-card .cmp-card__media > img,
.cmp-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.cmp-card__badge {
  position: absolute; inset-block-end: 10px; inset-inline-end: 10px;
  background: rgba(10, 42, 61, 0.72); color: #fff; border-radius: 999px;
  padding: 4px 12px; font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cmp-card__body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; flex: 1; }
.cmp-card__title { margin: 0; font-size: 1.0625rem; line-height: 1.5; color: #0A2A3D; }
.cmp-card__desc {
  margin: 0; color: #5A6B74; font-size: 0.9rem; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cmp-bar { height: 9px; border-radius: 999px; background: #E8EDEF; overflow: hidden; }
.cmp-bar > i { display: block; height: 100%; border-radius: 999px; background: #12525C; }
.cmp-bar.is-done > i { background: #1E7A4C; }
/* The bar fills when it is first seen (2026-09-13), from the reading start
   (right). campaigns.js adds .will-fill only when motion is allowed and then
   .is-seen on first sight, so without the script the bar is simply full.
   clip-path, not scaleX: a scaled bar squashes its rounded ends. */
.cmp-bar.will-fill > i { clip-path: inset(0 0 0 100%); }
.cmp-bar.will-fill.is-seen > i {
  clip-path: inset(0 0 0 0);
  transition: clip-path 900ms cubic-bezier(.22, .61, .36, 1);
}
.cmp-figs { display: flex; justify-content: space-between; gap: 10px; font-size: 0.8125rem; color: #5A6B74; }
.cmp-figs b { display: block; font-size: 1rem; color: #0A2A3D; font-variant-numeric: tabular-nums; }
.cmp-figs .is-goal b { color: #C9A227; }
.cmp-units { margin: 0; font-size: 0.8125rem; color: #12525C; font-weight: 600; }
.cmp-amounts { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-amounts a {
  border: 1px solid rgba(15, 68, 89, 0.16); border-radius: 9px; padding: 6px 12px;
  font-size: 0.8125rem; color: #0A2A3D; text-decoration: none; font-variant-numeric: tabular-nums;
  min-height: 36px; display: inline-flex; align-items: center;
}
.cmp-amounts a:hover { border-color: #12525C; color: #12525C; }
/* «مبلغ مخصص» on a card: the same chip, dashed, so it reads as «choose your
 * own» rather than as one more fixed amount. */
.cmp-amounts a.is-custom { border-style: dashed; border-color: rgba(18, 82, 92, 0.45); color: #12525C; font-weight: 600; }
/* On a touch screen a chip is a 44px target: measured at 36px on a phone,
 * with seven chips now on one card. */
@media (pointer: coarse) { .cmp-amounts a { min-height: 44px; } }
.cmp-give { scroll-margin-top: 110px; }
.cmp-card .primary-button, .cmp-card .cmp-link { margin-block-start: auto; }
.cmp-link { font-size: 0.875rem; color: #12525C; text-decoration: none; font-weight: 600; }
.cmp-link:hover { text-decoration: underline; }
.cmp-card.is-complete .cmp-card__media img { filter: grayscale(0.55); }
.cmp-done { margin: 0; font-size: 0.875rem; color: #1E7A4C; font-weight: 700; }

.cmp-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.cmp-filters button {
  min-height: 40px; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(15, 68, 89, 0.16); background: #fff; color: #33434B;
  font: inherit; font-size: 0.875rem; font-weight: 600;
}
.cmp-filters button[aria-pressed="true"] { background: #0A2A3D; color: #fff; border-color: #0A2A3D; }
.cmp-empty { color: #5A6B74; }

/* ---- one campaign ---- */
.cmp-detail { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 26px; align-items: start; }
@media (max-width: 860px) { .cmp-detail { grid-template-columns: 1fr; } }
.cmp-story h2 { font-size: 1.15rem; margin: 26px 0 8px; color: #0A2A3D; }
.cmp-story h2:first-child { margin-block-start: 0; }
.cmp-story p { margin: 0 0 14px; line-height: 1.9; }
.cmp-story figure { margin: 18px 0; }
.cmp-story figure img { width: 100%; height: auto; border-radius: 14px; }
.cmp-story figcaption { font-size: 0.85rem; color: #5A6B74; margin-top: 8px; }
.cmp-impact { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.cmp-impact div { background: #F4F6F7; border-radius: 12px; padding: 14px 16px; }
.cmp-impact b { display: block; font-size: 1.4rem; color: #0A2A3D; font-variant-numeric: tabular-nums; }
.cmp-impact span { font-size: 0.8125rem; color: #5A6B74; }

.cmp-give {
  position: sticky; top: 96px; display: flex; flex-direction: column; gap: 12px;
  background: #fff; border: 1px solid rgba(15, 68, 89, 0.12); border-radius: 16px; padding: 18px;
  box-shadow: 0 10px 26px rgba(10, 42, 61, 0.07);
}
@media (max-width: 860px) { .cmp-give { position: static; } }
.cmp-give dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 0.9rem; }
.cmp-give dt { color: #5A6B74; }
.cmp-give dd { margin: 0; font-variant-numeric: tabular-nums; color: #0A2A3D; font-weight: 600; }
.cmp-give .cmp-amounts a { flex: 1 1 auto; justify-content: center; }
.cmp-give .primary-button { width: 100%; justify-content: center; }

/* The give panel's picker (2026-09-13): real choices, not links that look like
 * them. Same shape as the donation page's amount buttons, so the two read as
 * one step. */
.cmp-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cmp-pick button {
  min-height: 44px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(15, 68, 89, 0.16); background: #fff; color: #0A2A3D;
  font: inherit; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}
.cmp-pick button:hover { border-color: #12525C; color: #12525C; }
/* A press answers the finger before the colour does. */
.cmp-pick button:active { transform: scale(0.97); }
.cmp-pick button[aria-pressed="true"] { background: #12525C; border-color: #12525C; color: #fff; }
.cmp-pick button[data-cmp-amount="custom"] { grid-column: 1 / -1; }
.cmp-pick button:focus-visible { outline: 3px solid #C9A227; outline-offset: 2px; }
.cmp-custom { display: flex; flex-direction: column; gap: 4px; }
.cmp-custom[hidden] { display: none; }
.cmp-custom span { font-size: 0.8125rem; color: #5A6B74; }
.cmp-custom input {
  min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(15, 68, 89, 0.22);
  font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums; color: #0A2A3D; background: #fff;
}
.cmp-custom input:focus { outline: none; border-color: #12525C; box-shadow: 0 0 0 3px rgba(18, 82, 92, 0.18); }
.cmp-err { margin: 0; font-size: 0.8125rem; font-weight: 600; color: #9B2C2C; }
.cmp-err[hidden] { display: none; }
/* Arrivals, not jumps (2026-09-13): the custom field fades in under the
   buttons, and the amount error arrives with one small shake, which is how a
   form says "this one" without a colour alone. Each plays when the element
   stops being hidden, not on every keystroke. */
.cmp-custom:not([hidden]) { animation: cmp-in 200ms cubic-bezier(.22, .61, .36, 1); }
.cmp-err:not([hidden]) { animation: cmp-err-in 320ms ease-out; }
@keyframes cmp-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes cmp-err-in {
  0% { opacity: 0; transform: translateX(0); }
  35% { opacity: 1; transform: translateX(3px); }
  70% { transform: translateX(-2px); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cmp-custom:not([hidden]), .cmp-err:not([hidden]) { animation: none; }
  .cmp-pick button:active { transform: none; }
  .cmp-bar.will-fill > i { clip-path: none; transition: none; }
}
.cmp-give .primary-button[aria-disabled="true"] {
  background: #E8EDEF; color: #5A6B74; border-color: #E8EDEF; cursor: not-allowed; box-shadow: none;
}

/* The cover (2026-09-13): the campaign's own picture at the head of its story,
 * framed like its card — same radius, same tone behind a loading image, and
 * the percentage in the same pill. */
.cmp-cover {
  position: relative; margin: 0 0 20px; border-radius: 16px; overflow: hidden;
  aspect-ratio: 16 / 9; background: #E8EDEF;
  box-shadow: 0 10px 26px rgba(10, 42, 61, 0.08);
}
.cmp-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-cover__badge {
  position: absolute; inset-block-end: 14px; inset-inline-end: 14px;
  background: rgba(10, 42, 61, 0.78); color: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 0.875rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cmp-cover__badge.is-done { background: #1E7A4C; }
@media (max-width: 560px) { .cmp-cover { aspect-ratio: 4 / 3; border-radius: 14px; } }
.cmp-give small { color: #5A6B74; font-size: 0.8125rem; line-height: 1.6; }

/* ---- the home page's section ---- */
.cmp-home__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }

/* The home section is a slider (2026-09-13): three campaigns in view on a
   desktop, two on a tablet, one on a phone, each snapping to the reading start.
   The scrollbar is hidden because the dots and arrows say where you are; the
   track itself stays keyboard-focusable. */
.cmp-slider { margin-block-start: 22px; }
.cmp-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 20px) / 3);
  gap: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 16px;
  scrollbar-width: none;
}
.cmp-track::-webkit-scrollbar { display: none; }
.cmp-track > .cmp-card { scroll-snap-align: start; }
.cmp-track:focus-visible { outline: 3px solid #C9A227; outline-offset: 4px; border-radius: 18px; }
@media (max-width: 960px) { .cmp-track { grid-auto-columns: calc((100% - 20px) / 2); } }
@media (max-width: 640px) { .cmp-track { grid-auto-columns: 100%; gap: 14px; } }

.cmp-controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-block-start: 4px; }
.cmp-controls[hidden] { display: none; }
.cmp-nav, .cmp-play {
  inline-size: 44px; block-size: 44px; border-radius: 999px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(15, 68, 89, 0.18); background: #fff; color: #0A2A3D;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}
.cmp-play { inline-size: 36px; block-size: 36px; }
.cmp-play[hidden] { display: none; }
.cmp-nav svg { inline-size: 18px; block-size: 18px; }
.cmp-play svg { inline-size: 14px; block-size: 14px; }
.cmp-nav:hover, .cmp-play:hover { background: #12525C; border-color: #12525C; color: #fff; }
.cmp-nav:active, .cmp-play:active { transform: scale(0.96); }
.cmp-dots { display: flex; align-items: center; }
.cmp-dot {
  inline-size: 28px; block-size: 44px; padding: 0; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.cmp-dot::before {
  content: ""; inline-size: 8px; block-size: 8px; border-radius: 999px;
  background: rgba(15, 68, 89, 0.25);
  transition: inline-size 240ms cubic-bezier(.22, .61, .36, 1), background-color 240ms ease;
}
.cmp-dot[aria-current="true"]::before { inline-size: 22px; background: #12525C; }
.cmp-nav:focus-visible, .cmp-play:focus-visible, .cmp-dot:focus-visible { outline: 3px solid #C9A227; outline-offset: 2px; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) {
  .cmp-nav, .cmp-play, .cmp-dot::before { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-card { transition: none; }
  .cmp-card:hover { transform: none; }
}
