/*==========================================================================
  Projects page
  Loaded only by projects.php / en/projects.php. Everything is scoped under
  .pj so nothing here can reach another page.
==========================================================================*/

.pj {
  /* Spacing scale. Sections step between these three rather than each one
     inventing its own padding, which is what produced the 150px+ gaps. */
  --pj-s: clamp(28px, 3.4vw, 48px);
  --pj-m: clamp(48px, 5.5vw, 80px);
  --pj-l: clamp(64px, 7vw, 104px);
  --pj-gut: clamp(18px, 4.4vw, 72px);
  --pj-ink: #10365b;
  --pj-ink-2: #0b2540;
  --pj-amber: #e18825;
  --pj-mute: #5a6a78;
  --pj-line: rgba(16, 54, 91, 0.13);
  --pj-ease: cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--pj-ink);
  /* The page is built from full-bleed bands; nothing may push sideways. */
  overflow-x: clip;
}
.pj-wrap {
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding-inline: var(--pj-gut);
}

/* ── Shared type ──────────────────────────────────────────────────────── */
.pj-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 clamp(16px, 2vw, 24px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--pj-amber);
}
.pj-eyebrow-rule {
  width: 34px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
  flex: 0 0 auto;
}

/* ── Masthead ─────────────────────────────────────────────────────────── */
.pj-mast {
  /* The site header is position:absolute over the page, 133px tall at desktop,
     so the masthead has to reserve that height or the H1 sits under it. */
  padding-top: clamp(112px, 11vw, 176px);
  padding-bottom: var(--pj-m);
}
.pj-title {
  margin: 0;
  color: var(--pj-ink);
  font-size: clamp(40px, 6vw, 84px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.04em;
}
.pj-title em {
  font-style: normal;
  color: var(--pj-amber);
}
.pj-lede {
  margin: clamp(16px, 2vw, 22px) 0 0;
  max-width: 52ch;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.75;
  color: var(--pj-mute);
}

/* ── Facts band ───────────────────────────────────────────────────────── */
.pj-facts {
  padding: var(--pj-s) 0;
  background: var(--pj-ink);
  color: #fff;
}
.pj-facts-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 60px);
  flex-wrap: wrap;
}
.pj-tally {
  display: flex;
  gap: clamp(22px, 3vw, 46px);
  margin: 0;
}
.pj-tally div { display: flex; align-items: baseline; gap: 9px; }
.pj-tally dt {
  order: 2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.pj-tally dd {
  order: 1;
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 600;
  line-height: 1;
  color: var(--pj-amber);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.pj-places { min-width: 0; }
.pj-places-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.pj-places-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}
.pj-places-list li + li::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 11px;
  margin: 0 14px;
  background: rgba(255, 255, 255, 0.28);
  vertical-align: -1px;
}

/* ── Work ─────────────────────────────────────────────────────────────── */
.pj-work { padding-top: var(--pj-l); }
.pj-work-head { margin-bottom: var(--pj-m); }
.pj-work-h {
  margin: 0;
  color: var(--pj-ink);
  max-width: 20ch;
  font-size: clamp(26px, 3.2vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.pj-work-h em { font-style: normal; color: var(--pj-amber); }

/* ── Cards, two to a row ──────────────────────────────────────────────── */
.pj-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 2.6vw, 40px);
}
.pj-card { min-width: 0; }
/* One link around the whole tile: the card is a single tap target, and a
   touch device never has to find a control that only appears on hover. */
.pj-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--pj-line);
 /* --sg-radius is the site-wide block radius; every other rounded block on
     the site (project rows, map, gallery, next-project) is built from it. */
  border-radius: var(--sg-radius);
  overflow: hidden;
  transition: border-color 0.35s var(--pj-ease), box-shadow 0.35s var(--pj-ease), transform 0.35s var(--pj-ease);
}
.pj-card-link:hover {
  border-color: transparent;
  box-shadow: 0 30px 60px -34px rgba(11, 37, 64, 0.42);
  transform: translateY(-4px);
}

/* Picture carries the card: it is the tallest thing in the tile. */
.pj-card-media {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--sg-radius) var(--sg-radius) 0 0;
  background: var(--pj-ink-2);
}
.pj-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.001);
  transition: transform 1.1s var(--pj-ease);
}
.pj-card-link:hover .pj-card-media img { transform: scale(1.05); }
/* The flag and the number sit on whatever the photo happens to be; a light
   sky left the white number barely readable. */
.pj-card-media::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 104px;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(11, 37, 64, 0.42), transparent);
  pointer-events: none;
}
.pj-card.is-sold .pj-card-media img { filter: saturate(0.7); }

.pj-card-flag {
  position: absolute;
  top: 16px;
  inset-inline-start: 16px;
  z-index: 2;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  color: var(--pj-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(11, 37, 64, 0.14);
}
.pj-card-flag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 7px;
  border-radius: 50%;
  background: #2ea043;
  vertical-align: middle;
}
.pj-card-flag.is-sold { color: var(--pj-mute); }
.pj-card-flag.is-sold::before { background: var(--pj-mute); }

.pj-card-n {
  position: absolute;
  top: 12px;
  /* Physical, not logical: this element sets its own direction to ltr for the
     digits, which would otherwise keep inset-inline-end on the right in Arabic
     and drop the number on top of the status pill. */
  right: 18px;
  left: auto;
  z-index: 2;
  color: #fff;
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-shadow: 0 2px 14px rgba(11, 37, 64, 0.55);
  opacity: 0.9;
}

/* ── Card copy ────────────────────────────────────────────────────────── */
.pj-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: clamp(20px, 2vw, 30px);
}
.pj-card-name {
  margin: 0;
  color: var(--pj-ink);
  font-size: clamp(21px, 1.9vw, 27px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  transition: color 0.25s var(--pj-ease);
}
.pj-card-name small {
  margin-inline-start: 9px;
  font-size: 14px;
  font-weight: 400;
  color: var(--pj-mute);
}
.pj-card-link:hover .pj-card-name { color: var(--pj-amber); }
.pj-card-loc {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: var(--pj-mute);
  font-size: 13.5px;
}
.pj-card-loc svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--pj-amber); }
.pj-card-blurb {
  display: block;
  margin-top: clamp(12px, 1.2vw, 16px);
  color: var(--pj-mute);
  font-size: 15px;
  line-height: 1.7;
}

/* Facts sit on a hairline, pushed to the bottom so cards in a row line up. */
.pj-card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px clamp(16px, 2vw, 30px);
  margin-top: auto;
  padding-top: clamp(16px, 1.6vw, 22px);
  border-top: 1px solid var(--pj-line);
}
.pj-card-fact { display: block; min-width: 0; }
.pj-card-fact i {
  display: block;
  margin-bottom: 4px;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pj-mute);
}
.pj-card-fact b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pj-ink);
}
.pj-card-go {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-top: clamp(16px, 1.6vw, 22px);
  color: var(--pj-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.25s var(--pj-ease);
}
.pj-card-go-t { position: relative; padding-bottom: 3px; }
.pj-card-go-t::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform 0.45s var(--pj-ease);
}
.pj-card-link:hover .pj-card-go { color: var(--pj-amber); }
.pj-card-link:hover .pj-card-go-t::after { transform: scaleX(1); }
.pj-card-go-ic { display: inline-flex; transition: transform 0.4s var(--pj-ease); }
.pj-card-go-ic svg { width: 15px; height: 15px; }
.pj-card-link:hover .pj-card-go-ic { transform: translateX(5px); }
[dir="rtl"] .pj-card-n { left: 18px; right: auto; }
[dir="rtl"] .pj-card-go-ic svg { transform: scaleX(-1); }
[dir="rtl"] .pj-card-link:hover .pj-card-go-ic { transform: translateX(-5px); }

@media (max-width: 767.98px) {
  .pj-grid { grid-template-columns: minmax(0, 1fr); }
  .pj-card-media { aspect-ratio: 16 / 10; }
}
@media (prefers-reduced-motion: reduce) {
  .pj-card-link:hover { transform: none; }
  .pj-card-link:hover .pj-card-media img { transform: none; }
}

/* ── CTA ──────────────────────────────────────────────────────────────── */
.pj-cta {
  padding: var(--pj-m) 0;
  background: var(--pj-ink-2);
  color: #fff;
}
.pj-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 60px);
  flex-wrap: wrap;
}
.pj-cta-h {
  margin: 0;
  /* the theme sets a colour on every heading, which beats inheriting white */
  color: #fff;
  font-size: clamp(26px, 3.2vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.pj-cta-p {
  margin: 12px 0 0;
  max-width: 46ch;
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.7);
}
.pj-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  padding: 17px 20px 17px 30px;
  border-radius: 999px;
  background: var(--pj-amber);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.3s var(--pj-ease);
}
[dir="rtl"] .pj-cta-link { padding: 17px 30px 17px 20px; }
.pj-cta-link:hover { background: #fff; color: var(--pj-ink-2); }
.pj-cta-ic {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: transform 0.4s var(--pj-ease), background 0.3s var(--pj-ease);
}
.pj-cta-ic svg { width: 16px; height: 16px; }
.pj-cta-link:hover .pj-cta-ic { background: rgba(16, 54, 91, 0.1); transform: translateX(4px); }
[dir="rtl"] .pj-cta-ic svg { transform: scaleX(-1); }
[dir="rtl"] .pj-cta-link:hover .pj-cta-ic { transform: translateX(-4px); }

/* ── Focus ────────────────────────────────────────────────────────────── */
.pj a:focus-visible {
  outline: 2px solid var(--pj-amber);
  outline-offset: 3px;
}

/* ── Narrow ───────────────────────────────────────────────────────────── */
@media (max-width: 719.98px) {
  .pj-facts-inner { display: block; }
  .pj-places { margin-top: 22px; }
  .pj-places-list { display: block; }
  .pj-places-list li { padding: 5px 0; }
  .pj-places-list li + li::before { display: none; }
  .pj-tally { gap: 26px; }
  .pj-cta-inner { display: block; }
  .pj-cta-link { margin-top: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .pj *,
  .pj *::after { transition-duration: 0.01ms !important; }
  .pj-row:hover .pj-row-media img,
  .pj-frame:hover img { transform: none; }
}

/* The last project already carries a bottom margin and the CTA its own padding;
   together they left roughly 190px of empty white before the band. */
.pj-work > :last-child { margin-bottom: 0; }
.pj-work { padding-bottom: var(--pj-m); }

/* The village number reads better aligned to the project name's baseline than
   to the bottom of its block. */
@media (min-width: 900px) {
  .pj-village-head { align-items: baseline; }
}

/* At 320px the three counts do not fit on one line. */
.pj-tally { flex-wrap: wrap; row-gap: 12px; }

