/* ahen26 - the projects area at the bottom of the home page (section#bottom): heading, project cards, "about" cards, donate band.
   The cards come from the stock article-category module (ul > li > .img-intro + h4); html/mod_articles_category/default_items.php
   marks each li as .is-project (it has a description in the language file) or .is-about, and adds .proj-* parts to the projects.
   Scoped to #bottom, loaded after top.css. To go back to the previous look, remove its <link> in index.php. */

section#bottom {
  display: block;
  background: var(--surface);
  padding-block: clamp(40px, 5.5vw, 80px);
  margin-top: 0;
}

/* ---- heading ---- */
section#bottom .projects-head {
  max-width: 720px;
  margin: 0 auto clamp(26px, 3.5vw, 46px);
  text-align: center;
}
section#bottom .projects-head h2 {
  margin: 0 0 10px;
  color: var(--brand-deep);
  font-family: var(--font-head);
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
}
section#bottom .projects-head h2::after {
  content: '';
  display: block;
  width: 56px;
  height: 4px;
  margin: 14px auto 0;
  border-radius: 4px;
  background: var(--green);
}
section#bottom .projects-head p { margin: 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); }

/* ---- the grid: 4 project cards per row, 2 wide "about" cards below ---- */
#bottom .moduletable_latestNews { float: none; width: 100%; margin: 0; }

/* two lists (html/mod_articles_category/default.php): ul.cards-projects first, then ul.cards-about, each with its own grid */
#bottom ul.category-module_latestNews {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}
#bottom ul.cards-projects { grid-template-columns: repeat(3, 1fr); }
#bottom ul.cards-about    { grid-template-columns: repeat(2, 1fr); margin-top: clamp(16px, 2vw, 24px); }
@media (max-width: 1099px) {
  #bottom ul.cards-projects { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 599px) {
  #bottom ul.cards-projects,
  #bottom ul.cards-about { grid-template-columns: 1fr; }
}

/* keep the visual order of the old float:left layout on the Hebrew pages (first module item on the left, as before);
   the cards themselves still read right-to-left */
html[dir="rtl"] #bottom ul.category-module_latestNews { direction: ltr; }
html[dir="rtl"] #bottom ul.category-module_latestNews > li { direction: rtl; }

/* ---- the card: undo the old float / height:0 / padding-bottom tricks ---- */
#bottom ul.category-module_latestNews > li {
  position: relative;
  float: none;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
#bottom ul.category-module_latestNews > li:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
#bottom ul.category-module_latestNews > li:focus-within { outline: 3px solid var(--brand); outline-offset: 3px; }

/* photo: fixed ratio, cropped to fill, slow zoom on hover */
#bottom .img-intro {
  position: relative;
  width: 100%;
  height: auto;
  padding: 0;
  margin: 0;
  border: 0;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surface);
}
#bottom .img-intro a { display: block; width: 100%; height: 100%; }
#bottom .img-intro img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
#bottom ul.category-module_latestNews > li:hover .img-intro img { transform: scale(1.06); }

/* figure on the photo ("16,000 participants") */
#bottom .proj-stat {
  position: absolute;
  inset-block-end: 12px;   /* bottom corner: some photos carry a logo in the top corners */
  inset-inline-start: 12px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: rgba(7,31,43,.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: var(--font-head);
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.3;
  pointer-events: none;
}

/* title; its link is stretched over the whole card, so the card is one big click target */
#bottom ul.category-module_latestNews h4 {
  display: flex;
  align-items: center;
  width: auto;
  margin: 0;
  padding: 16px 18px 18px;
  background: transparent;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: start;
}
#bottom h4 a.mod-articles-category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  color: var(--brand-deep);
  text-decoration: none;
}
#bottom h4 a.mod-articles-category-title::before { content: ''; position: absolute; inset: 0; z-index: 1; }
#bottom h4 a.mod-articles-category-title:focus-visible { outline: 0; }
#bottom ul.category-module_latestNews > li:hover h4 a.mod-articles-category-title { color: var(--brand); }

/* round arrow after the title of the "about" cards (the project cards have their own "more" line) */
#bottom h4 a.mod-articles-category-title::after {
  content: '\2192';
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
html[dir="rtl"] #bottom h4 a.mod-articles-category-title::after { content: '\2190'; }
#bottom ul.category-module_latestNews > li:hover h4 a.mod-articles-category-title::after { background: var(--brand); color: #fff; }
#bottom li.is-project h4 a.mod-articles-category-title::after { display: none; }

/* ---- project card: title, description, "more" + donate ---- */
#bottom li.is-project h4 { padding-bottom: 6px; }
#bottom .proj-desc {
  flex: 1;
  margin: 0;
  padding: 0 18px;
  color: var(--muted);
  font-size: .97rem;
  line-height: 1.6;
}
#bottom .proj-foot { padding: 14px 18px 18px; }
#bottom .proj-more { color: var(--brand); font-size: .95rem; font-weight: 700; white-space: nowrap; }
#bottom .proj-more::after { content: ' \2192'; }
html[dir="rtl"] #bottom .proj-more::after { content: ' \2190'; }
#bottom ul.category-module_latestNews > li:hover .proj-more { color: var(--brand-deep); }

/* ---- "about" cards: photo beside the title ---- */
#bottom ul.category-module_latestNews > li.is-about { flex-direction: row; }
#bottom li.is-about .img-intro { flex: 0 0 38%; width: 38%; aspect-ratio: auto; min-height: 130px; }
#bottom li.is-about h4 { flex: 1; padding: 18px 20px; }

/* ---- the donation: a quiet card with a few sentences that lead to the one button ---- */
#bottom .donate-band {
  margin-top: clamp(30px, 4.5vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px 48px;
  padding: clamp(26px, 3.4vw, 42px) clamp(22px, 4vw, 52px);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--green);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
#bottom .donate-band__text { max-width: 62ch; }
#bottom .donate-band h3 {
  margin: 0 0 12px;
  color: var(--brand-deep);
  font-family: var(--font-head);
  font-size: clamp(1.35rem, 2.3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.3;
  text-align: start;
}
#bottom .donate-band h3::after { display: none; }
#bottom .donate-band__lead { margin: 0 0 12px; font-size: 1.1rem; line-height: 1.75; color: var(--ink); }
#bottom .donate-band__fine { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.65; }
#bottom .donate-band__action { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#bottom .donate-band__cta {
  display: inline-flex;
  align-items: center;
  padding: 14px 42px;
  border-radius: var(--r-pill);
  background: var(--donate);
  color: #fff;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(224,62,62,.26);
  transition: background .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
#bottom .donate-band__cta:hover,
#bottom .donate-band__cta:focus-visible { background: var(--donate-deep); color: #fff; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(224,62,62,.38); }
#bottom .donate-band__cta:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
#bottom .donate-band__tel { color: var(--muted); font-size: .92rem; text-decoration: none; }
#bottom .donate-band__tel span { font-weight: 700; color: var(--ink); }
#bottom .donate-band__tel:hover { text-decoration: underline; }

@media (max-width: 899px) {
  #bottom .donate-band { flex-direction: column; align-items: stretch; }
  #bottom .donate-band__action { align-items: stretch; }
  #bottom .donate-band__cta { justify-content: center; }
}

/* ---- phone ---- */
@media (max-width: 599px) {
  #bottom ul.category-module_latestNews { gap: 14px; }
  #bottom li.is-project .img-intro { aspect-ratio: 16 / 9; }
  #bottom li.is-about .img-intro { flex-basis: 34%; width: 34%; min-height: 96px; }
  #bottom li.is-about h4 { padding: 12px 14px; font-size: 1.05rem; }
  #bottom .donate-band__cta { padding: 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  #bottom ul.category-module_latestNews > li:hover { transform: none; }
  #bottom ul.category-module_latestNews > li:hover .img-intro img { transform: none; }
}

/* ---- inside a project article: links row + small gallery (fields proj-links / proj-gallery) ---- */
.proj-links { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.proj-links a {
  display: inline-block; padding: 9px 18px; border: 1px solid var(--line, #d9d9d9); border-radius: 999px;
  color: var(--ink, #222); text-decoration: none; font-weight: 600; font-size: .95rem; background: #fff;
}
.proj-links a:hover, .proj-links a:focus-visible { border-color: var(--brand, #1d6fa5); color: var(--brand, #1d6fa5); }
.proj-gallery { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.proj-gallery li { margin: 0; }
.proj-gallery a { display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: #eee; }
.proj-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.proj-gallery a:hover img { transform: scale(1.04); }
.proj-gallery span { display: block; margin-top: 6px; font-size: .85rem; color: var(--muted, #666); }

/* the article stylesheet puts a green bullet and a negative margin on every li of .item-page - not on these lists */
.item-page .proj-links li, .item-page .proj-gallery li { margin: 0 !important; padding: 0; }
.item-page .proj-links li::before, .item-page .proj-gallery li::before { content: none !important; display: none !important; }
.proj-gallery a { cursor: zoom-in; }
/* modal for a gallery picture */
.proj-modal { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); max-height: 92vh; overflow: visible; }
.proj-modal::backdrop { background: rgba(0,0,0,.72); }
.proj-modal img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: 10px; background: #fff; cursor: zoom-out; }
.proj-modal p { margin: 10px 0 0; text-align: center; color: #fff; font-size: .95rem; }
.proj-modal__x { position: absolute; top: -14px; inset-inline-end: -14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; color: #222; font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.item-page .fields-container li.field-entry { margin: 0 !important; list-style: none; }
.item-page .fields-container li.field-entry::before { content: none !important; display: none !important; }

/* year sections inside the "special projects" article */
.item-page h3.proj-year { margin: 2.2em 0 .4em; padding-bottom: .3em; border-bottom: 2px solid var(--brand-soft, #cfe3f1); color: var(--brand-deep, #0d4a6f); font-size: 1.35rem; }
.item-page h3.proj-year:first-of-type { margin-top: 1.2em; }
