/* ==========================================================================
   Programme pillars — shared by the home page and /about.
   Desktop: expanding image panels (hover / focus / click to open one).
   Tablet & phone: full cards that stack on top of each other as you scroll.
   Markup: scripts/build_pages.py → render_pillars(). Behaviour: /js/pillars.js
   ========================================================================== */

.pl {
  --pl-ease: cubic-bezier(.22, 1, .36, 1);
  --pl-ink: #14110d;
  display: grid;
  gap: 18px;
  font-family: var(--font-inter), "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pl-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 22px;
  background: var(--pl-ink);
  color: #fff;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  outline: none;
  box-shadow: 0 30px 60px -30px rgba(20, 17, 13, .45);
}
/* small screens: photo on top, copy below, cards rise in as you scroll */
@media (max-width: 1023px) {
  .pl .pl-card__body { padding-top: clamp(170px, 40vw, 260px); }
  .pl .pl-card__shade {
    background:
      linear-gradient(180deg, rgba(20, 17, 13, .05) 0%, rgba(20, 17, 13, .2) 22%, rgba(20, 17, 13, .9) 46%, rgba(20, 17, 13, .97) 100%),
      radial-gradient(120% 60% at 0% 100%, color-mix(in srgb, var(--accent) 40%, transparent) 0%, transparent 60%);
  }
  .pl .pl-card__media img { transform: none; object-position: var(--focus, 50% 75%); height: 62%; }
  @supports (animation-timeline: view()) {
    .pl-card { animation: pl-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  }
}
@keyframes pl-rise { from { opacity: .3; transform: translateY(60px) scale(.94); } }
.pl-card:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--accent); }

.pl-card__media { position: absolute; inset: 0; z-index: -2; }
.pl-card__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 62%); display: block;
  transform: scale(1.08);
  transition: transform 1.4s var(--pl-ease), filter .9s var(--pl-ease);
}
.pl-card__shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(20, 17, 13, .15) 0%, rgba(20, 17, 13, .35) 35%, rgba(20, 17, 13, .92) 78%),
    radial-gradient(120% 70% at 0% 100%, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 60%);
}
.pl-card__no {
  position: absolute; top: 22px; left: 26px;
  font-size: 15px; font-weight: 700; letter-spacing: .08em;
  display: inline-flex; align-items: center; gap: 10px;
}
.pl-card__no::after { content: ""; width: 28px; height: 2px; background: var(--accent); border-radius: 2px; }
.pl-card__spine { display: none; }

.pl-card__body { padding: 24px 22px 22px; display: grid; gap: 11px; }
.pl-card__tag {
  justify-self: start;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, .08));
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
}
.pl .pl-card__title {
  color: #fff; font-family: "Bricolage Grotesque", inherit;
  margin: 0; font-size: clamp(26px, 2.6vw, 34px); line-height: 1; font-weight: 800; letter-spacing: -.035em;
}
.pl-card__text { margin: 0; font-size: 14.5px; line-height: 1.6; color: rgba(255, 255, 255, .78); max-width: 46ch; }
.pl-card__points { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 9px; }
.pl-card__points li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; color: rgba(255, 255, 255, .92); }
.pl-card__points svg { width: 16px; height: 16px; flex: none; color: var(--accent); margin-top: 1px; }
.pl-card__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 8px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .14);
}
.pl-card__stat { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .7); }
.pl-card__stat b { font-size: 24px; letter-spacing: -.03em; color: #fff; margin-right: 4px; text-transform: none; }
.pl-card__cta {
  display: inline-flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  background: #fff; color: var(--pl-ink) !important; font-weight: 700; font-size: 13.5px; text-decoration: none;
  transition: background .3s, color .3s, transform .3s var(--pl-ease);
}
.pl-card__cta svg { width: 18px; height: 18px; transition: transform .35s var(--pl-ease); }
.pl-card__cta:hover { background: var(--accent); color: #fff !important; }
.pl-card__cta:hover svg { transform: translateX(4px); }

@media (min-width: 640px) {
  .pl-card__points { grid-template-columns: 1fr 1fr; }
  .pl-card__body { padding: 28px; }
}

/* ---------- Desktop: expanding panels ---------- */
@media (min-width: 1024px) {
  .pl { display: flex; gap: 12px; height: clamp(400px, 56vh, 480px); }
  .pl-card {
    position: relative; top: auto;
    flex: 1 1 0; min-width: 0; min-height: 0;
    cursor: pointer;
    transition: flex-grow .85s var(--pl-ease), box-shadow .4s;
  }
  .pl-card.is-active { flex-grow: 4.4; cursor: default; }
  .pl-card__media img { filter: grayscale(1) brightness(.62) contrast(1.05); }
  .pl-card.is-active .pl-card__media img { filter: none; transform: scale(1); }
  .pl-card:not(.is-active):hover .pl-card__media img { filter: grayscale(.3) brightness(.7); transform: scale(1.12); }

  .pl-card__spine {
    display: block; position: absolute; left: 50%; bottom: 30px;
    transform: translateX(-50%) rotate(180deg);
    writing-mode: vertical-rl;
    font-family: "Bricolage Grotesque", inherit; font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap;
    transition: opacity .35s, transform .6s var(--pl-ease);
  }
  .pl-card.is-active .pl-card__spine { opacity: 0; transform: translateX(-50%) rotate(180deg) translateY(-20px); }

  .pl-card__no { left: 50%; transform: translateX(-50%); transition: left .6s var(--pl-ease), transform .6s var(--pl-ease); }
  .pl-card__no::after { display: none; }
  .pl-card.is-active .pl-card__no { left: 30px; transform: none; }
  .pl-card.is-active .pl-card__no::after { display: block; }

  .pl-card__body {
    width: min(560px, 48vw);
    padding: 30px;
    opacity: 0; transform: translateY(24px);
    visibility: hidden;
    transition: opacity .3s, transform .5s var(--pl-ease), visibility 0s .3s;
  }
  .pl-card.is-active .pl-card__body {
    opacity: 1; transform: none; visibility: visible;
    transition: opacity .6s .28s, transform .8s .28s var(--pl-ease), visibility 0s;
  }
  .pl-card.is-active .pl-card__body > * { animation: pl-in .8s var(--pl-ease) both; }
  .pl-card.is-active .pl-card__body > :nth-child(2) { animation-delay: .34s; }
  .pl-card.is-active .pl-card__body > :nth-child(3) { animation-delay: .4s; }
  .pl-card.is-active .pl-card__body > :nth-child(4) { animation-delay: .46s; }
  .pl-card.is-active .pl-card__body > :nth-child(5) { animation-delay: .52s; }

  /* progress line for the auto-advance */
  .pl-card::after {
    content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
    background: var(--accent); transform-origin: left; transform: scaleX(0);
  }
  .pl[data-autoplay="on"] .pl-card.is-active::after { animation: pl-progress var(--pl-dur, 7s) linear forwards; }
}
@keyframes pl-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes pl-progress { to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .pl-card, .pl-card *, .pl-card::after { transition: none !important; animation: none !important; }
}
