/* =========================
   PROYECTOS – LISTADO Y DETALLE
========================= */

.pj-hero {
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
  border-bottom: 1px solid var(--gray-200);
  padding: 56px 0 40px;
}

.pj-hero .breadcrumbs {
  margin-bottom: 16px;
}

.pj-hero h1 {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.15;
  margin-bottom: 12px;
}

.pj-hero p {
  color: var(--gray-600);
  font-size: 18px;
}

.pj-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 32px;
}

.pj-stat {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 18px 20px;
}

.pj-stat strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
  color: var(--green-dark);
  font-variant-numeric: tabular-nums;
}

.pj-stat span {
  font-size: 14px;
  color: var(--gray-600);
}

/* ---------- Barra de filtros ---------- */

.pj-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 0;
}

.pj-toolbar-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pj-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.pj-chips::-webkit-scrollbar {
  display: none;
}

.pj-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-700);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pj-chip:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.pj-chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.pj-chip .count {
  font-size: 12px;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 999px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}

.pj-chip[aria-pressed="true"] .count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.pj-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pj-search {
  position: relative;
  flex: 1 1 260px;
}

.pj-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-600);
  font-size: 14px;
}

.pj-search input,
.pj-select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: var(--gray-900);
}

.pj-search input {
  padding: 0 14px 0 38px;
}

.pj-select {
  flex: 0 1 200px;
  padding: 0 12px;
  cursor: pointer;
}

.pj-search input:focus,
.pj-select:focus {
  outline: 2px solid rgba(22, 163, 74, 0.35);
  border-color: var(--green);
}

/* ---------- Resultados ---------- */

.pj-results {
  padding: 32px 0 72px;
}

.pj-results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 15px;
  color: var(--gray-600);
}

.pj-reset {
  border: 0;
  background: none;
  color: var(--green-dark);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.pj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.pj-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pj-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
}

.pj-card:focus-visible {
  outline: 3px solid rgba(22, 163, 74, 0.45);
  outline-offset: 2px;
}

.pj-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--gray-100);
  overflow: hidden;
}

.pj-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.pj-card:hover .pj-card-media img {
  transform: scale(1.04);
}

.pj-status {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--gray-900);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.pj-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.pj-status.is-ejecucion::before {
  background: #f59e0b;
}

.pj-photos {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 13px;
}

.pj-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 20px;
  flex: 1;
}

.pj-program {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green-dark);
}

.pj-card h2 {
  font-size: 20px;
  line-height: 1.3;
}

.pj-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 14px;
  color: var(--gray-600);
  margin-top: auto;
  padding-top: 8px;
}

.pj-meta i {
  color: var(--green);
  margin-right: 4px;
}

.pj-empty {
  text-align: center;
  padding: 64px 16px;
  color: var(--gray-600);
}

.pj-empty i {
  font-size: 32px;
  color: var(--gray-200);
  margin-bottom: 12px;
}

.pj-cta {
  margin-top: 56px;
  background: var(--gray-900);
  color: #fff;
  border-radius: 20px;
  padding: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.pj-cta h2 {
  font-size: 26px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.pj-cta p {
  color: #d1d5db;
}

/* ---------- Detalle ---------- */

.pj-detail {
  padding: 40px 0 72px;
}

.pj-detail-head {
  margin: 16px 0 28px;
}

.pj-detail-head h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 6px 0 12px;
}

.pj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pj-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 14px;
  color: var(--gray-700);
}

.pj-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  align-items: start;
}

/* Portada: la foto completa sobre un fondo difuminado de sí misma */
.pj-cover {
  position: relative;
  height: clamp(260px, 42vw, 460px);
  border-radius: 16px;
  overflow: hidden;
  background: var(--gray-900);
  margin-bottom: 28px;
}

.pj-cover::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: var(--cover) center / cover;
  filter: blur(28px) brightness(0.75);
}

.pj-cover img {
  position: relative;
  display: block;
  height: 100%;
  width: 100%;
  object-fit: contain;
}

.pj-detail-body h2 {
  font-size: 22px;
  margin: 32px 0 12px;
}

.pj-detail-body p {
  color: var(--gray-700);
  margin-bottom: 12px;
}

.pj-facts {
  position: sticky;
  top: 24px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 24px;
}

.pj-facts h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.pj-facts dl {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.pj-facts dt {
  font-size: 13px;
  color: var(--gray-600);
}

.pj-facts dd {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
}

.pj-facts .btn {
  display: flex;
  justify-content: center;
  width: 100%;
}

.pj-gallery-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pj-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.pj-gallery button {
  border: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: 1;
  background: var(--gray-100);
}

.pj-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pj-gallery button:hover img {
  transform: scale(1.05);
}

.pj-docs {
  list-style: none;
  display: grid;
  gap: 8px;
}

.pj-docs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green-dark);
  font-weight: 500;
}

.pj-related {
  margin-top: 64px;
}

.pj-related h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

/* ---------- Lightbox ---------- */

.pj-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000; /* por encima de WhatsApp y menú */
  background: rgba(10, 10, 10, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
}

.pj-lightbox.is-open {
  display: flex;
}

.pj-lightbox img {
  max-width: min(92vw, 1200px);
  max-height: 82vh;
  border-radius: 8px;
}

.pj-lightbox button {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

.pj-lightbox button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.pj-lb-close { top: 20px; right: 20px; }
.pj-lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.pj-lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

.pj-lb-count {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #d1d5db;
  font-size: 14px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .pj-grid { grid-template-columns: repeat(2, 1fr); }
  .pj-detail-grid { grid-template-columns: 1fr; }
  .pj-facts { position: static; }
}

@media (max-width: 700px) {
  .pj-hero { padding: 32px 0 28px; }
  .pj-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pj-stat { padding: 14px 16px; }
  .pj-stat strong { font-size: 24px; }
  .pj-grid { grid-template-columns: 1fr; }
  .pj-select { flex: 1 1 140px; }
  .pj-cta { flex-direction: column; align-items: flex-start; padding: 28px; }
  .pj-lb-prev, .pj-lb-next { top: auto; bottom: 12px; transform: none; }
  .pj-lb-prev { left: 12px; }
  .pj-lb-next { right: 12px; }
}

@media (max-width: 395px) {
  .container { padding: 0 16px; }
}

/* ---------- Ajustes ---------- */

.pj-card-body p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--gray-600);
}

.pj-card h2 {
  font-size: 19px;
}

@media (min-width: 1000px) {
  .pj-toolbar .pj-chips {
    flex-wrap: wrap;
    overflow: visible;
  }
}

.pj-grid-2 {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 16px;
}

@media (max-width: 700px) {
  .pj-grid-2 { grid-template-columns: 1fr; }
}

/* Sello de verificación SERVIU en la ficha */
.pj-verified {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 13px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
}

.pj-verified:hover {
  border-color: var(--green);
}

.pj-verified i {
  font-size: 22px;
  color: var(--green);
}

.pj-verified strong {
  display: block;
  font-size: 15px;
  color: var(--gray-900);
}

/* Año en la tarjeta */
.pj-year {
  color: var(--gray-600);
  font-weight: 500;
}

.pj-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.pj-hero-link:hover {
  text-decoration: underline;
}
