/* Nergy - Featured Projects showcase.
   Scoped entirely under .nergy-pj so nothing leaks into other sections. */

.nergy-pj{
  --pj-gap: 24px;
  --pj-border: #e8ebe7;
  --pj-ink: #12261c;
  --pj-body: #33453a;
  --pj-muted: #5c6b61;
  --pj-green: #1d6b3f;
  --pj-dark: #0b2b1b;
  --pj-tint: #f4f6f3;
  position: relative;
  width: 100%;
}

/* ---------------------------------------------------------------- track */

.nergy-pj-track{
  display: flex;
  gap: var(--pj-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 6px 2px 16px;
  margin: 0;
  list-style: none;
}
.nergy-pj-track::-webkit-scrollbar{ display: none; }
.nergy-pj-track:focus{ outline: none; }
.nergy-pj-track:focus-visible{
  outline: 2px solid var(--pj-green);
  outline-offset: 4px;
  border-radius: 14px;
}

/* ----------------------------------------------------------------- card */

.nergy-pj-card{
  position: relative;
  flex: 0 0 calc((100% - (2 * var(--pj-gap))) / 3);
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid var(--pj-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(11,43,27,.04);
  transition: transform .45s cubic-bezier(.22,.61,.36,1),
              box-shadow .45s cubic-bezier(.22,.61,.36,1),
              border-color .45s ease;
}
.nergy-pj-card:hover,
.nergy-pj-card:focus-within{
  transform: translateY(-6px);
  box-shadow: 0 20px 42px -20px rgba(11,43,27,.30);
  border-color: #d9e0da;
}

/* ---------------------------------------------------------- browser bar */

.nergy-pj-bar{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--pj-tint);
  border-bottom: 1px solid var(--pj-border);
  flex: 0 0 auto;
}
.nergy-pj-dots{ display: flex; gap: 5px; flex: 0 0 auto; }
.nergy-pj-dots i{
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #d3dad4;
  display: block;
}
.nergy-pj-url{
  flex: 1 1 auto;
  min-width: 0;
  font-family: "DM Sans", sans-serif;
  font-size: 10.5px;
  line-height: 1.6;
  color: #6a7a70;
  background: #fff;
  border: 1px solid var(--pj-border);
  border-radius: 20px;
  padding: 2px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ screenshot */

.nergy-pj-shot{
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f1f3f0;
  flex: 0 0 auto;
}
@supports not (aspect-ratio: 4 / 3){
  .nergy-pj-shot{ height: 0; padding-top: 75%; }
}

.nergy-pj-shot img{
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: auto;
  display: block;
  transform: translateY(0) scale(1);
  transform-origin: 50% 0;
  /* return glide when the pointer leaves */
  transition: transform .85s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}

/* Tall full-page captures: hover slowly scrolls the page into view. */
.nergy-pj-card:hover .nergy-pj-shot.is-tall img,
.nergy-pj-card:focus-within .nergy-pj-shot.is-tall img{
  transform: translateY(var(--pj-shift, -80%));
  transition: transform var(--pj-dur, 6s) ease-in-out;
}

/* Short/landscape captures: no room to scroll, so a restrained zoom. */
.nergy-pj-shot.is-cover img{
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}
.nergy-pj-card:hover .nergy-pj-shot.is-cover img,
.nergy-pj-card:focus-within .nergy-pj-shot.is-cover img{
  transform: scale(1.06);
  transition: transform 1.1s cubic-bezier(.22,.61,.36,1);
}

.nergy-pj-shot::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,33,15,0) 55%, rgba(8,33,15,.42) 100%);
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}
.nergy-pj-card:hover .nergy-pj-shot::after,
.nergy-pj-card:focus-within .nergy-pj-shot::after{ opacity: 1; }

/* ----------------------------------------------------------------- body */

.nergy-pj-body{
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  padding: 18px 18px 22px;
  background: #fff;
  transition: transform .45s cubic-bezier(.22,.61,.36,1);
}
.nergy-pj-card:hover .nergy-pj-body,
.nergy-pj-card:focus-within .nergy-pj-body{ transform: translateY(-5px); }

.nergy-pj-cat{
  align-self: flex-start;
  font-family: "DM Sans", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--pj-green);
  background: #eef4ef;
  border: 1px solid #dce8df;
  border-radius: 20px;
  padding: 4px 10px;
  line-height: 1.4;
}

.nergy-pj-name{
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.2px;
  color: var(--pj-ink);
}

.nergy-pj-points{
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.nergy-pj-points li{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 12.75px;
  line-height: 1.45;
  color: var(--pj-body);
}
.nergy-pj-points svg{
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin-top: 2px;
  color: var(--pj-green);
}

.nergy-pj-cta{
  margin-top: auto;
  padding-top: 12px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--pj-dark);
  text-decoration: none;
  transition: color .3s ease;
}
.nergy-pj-cta::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}
.nergy-pj-cta svg{
  width: 13px; height: 13px;
  transition: transform .35s cubic-bezier(.22,.61,.36,1);
}
.nergy-pj-card:hover .nergy-pj-cta svg{ transform: translateX(4px); }
.nergy-pj-cta:hover{ color: var(--pj-green); }
.nergy-pj-cta:focus-visible{
  outline: 2px solid var(--pj-green);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ------------------------------------------------------------- controls */

.nergy-pj-controls{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}
.nergy-pj-rail{
  position: relative;
  flex: 1 1 auto;
  max-width: 260px;
  height: 3px;
  background: var(--pj-border);
  border-radius: 3px;
  overflow: hidden;
}
.nergy-pj-rail i{
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 33%;
  background: var(--pj-green);
  border-radius: 3px;
  transform: translateX(0);
  transition: transform .3s ease, width .3s ease;
}
.nergy-pj-count{
  font-family: "DM Sans", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--pj-muted);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.nergy-pj-nav{
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}
.nergy-pj-btn{
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--pj-border);
  background: #fff;
  color: var(--pj-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color .3s ease, color .3s ease,
              border-color .3s ease, transform .3s ease, opacity .3s ease;
}
.nergy-pj-btn svg{ width: 15px; height: 15px; }
.nergy-pj-btn:hover:not(:disabled){
  background: var(--pj-dark);
  color: #fff;
  border-color: var(--pj-dark);
  transform: translateY(-2px);
}
.nergy-pj-btn:disabled{ opacity: .32; cursor: default; }
.nergy-pj-btn:focus-visible{
  outline: 2px solid var(--pj-green);
  outline-offset: 3px;
}

/* ------------------------------------------------------- entrance reveal */

.nergy-pj-card.pj-hide{
  opacity: 0;
  transform: translateY(20px);
}
.nergy-pj-card.pj-show{
  opacity: 1;
  transform: translateY(0);
  transition: opacity .7s ease, transform .7s cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--pj-delay, 0s);
}

/* ----------------------------------------------------------------- hint */

.nergy-pj-hint{
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  color: var(--pj-muted);
  margin: 0;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1024px){
  .nergy-pj{ --pj-gap: 20px; }
  .nergy-pj-card{ flex-basis: calc((100% - var(--pj-gap)) / 2); }
}

@media (max-width: 767px){
  .nergy-pj{ --pj-gap: 16px; }
  .nergy-pj-card{ flex-basis: 86%; }
  .nergy-pj-shot{ aspect-ratio: 5 / 4; }
  @supports not (aspect-ratio: 5 / 4){
    .nergy-pj-shot{ height: 0; padding-top: 80%; }
  }
  .nergy-pj-body{ padding: 16px 16px 20px; }
  .nergy-pj-name{ font-size: 16.5px; }
  .nergy-pj-controls{
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
  .nergy-pj-rail{ order: 1; flex: 1 1 100%; max-width: none; }
  .nergy-pj-count{ order: 2; }
  .nergy-pj-nav{ order: 3; margin-left: 0; }
}

@media (max-width: 400px){
  .nergy-pj-card{ flex-basis: 90%; }
  .nergy-pj-points li{ font-size: 12.5px; }
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce){
  .nergy-pj-track{ scroll-behavior: auto; }
  .nergy-pj-card,
  .nergy-pj-body,
  .nergy-pj-shot img,
  .nergy-pj-shot::after,
  .nergy-pj-cta svg,
  .nergy-pj-btn,
  .nergy-pj-rail i{
    transition: none !important;
  }
  .nergy-pj-card:hover,
  .nergy-pj-card:focus-within{ transform: none; }
  .nergy-pj-card:hover .nergy-pj-body,
  .nergy-pj-card:focus-within .nergy-pj-body{ transform: none; }
  .nergy-pj-card:hover .nergy-pj-shot img,
  .nergy-pj-card:focus-within .nergy-pj-shot img{ transform: none; }
  .nergy-pj-card.pj-hide{ opacity: 1; transform: none; }
}
