/* ============================================
   Noor — Work card component (reusable card)
   ============================================ */

.work-card {
  display: block;
  width: 100%;
  text-decoration: none;
  color: var(--surface-text);
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.work-card:hover {
  text-decoration: none;
  color: var(--surface-text);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.work-card:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

.work-card__media {
  position: relative;
  /* Para posicionar el pseudo-elemento */
  aspect-ratio: 4 / 3;
  /* Mantiene la proporción del contenedor */
  overflow: hidden;
  /* Oculta la parte de la imagen que sobresale */
  width: 100%;
  background: transparent;
  /* Elimina cualquier fondo directo */
}

.work-card__media::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--img-normal);
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease, background-image 0.4s ease;
  transform: scale(1.35);
}

/* Parallax Layers Support */
.work-card__layers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.work-card__layer {
  position: absolute;
  /* Extra size to avoid showing edges during parallax */
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  will-change: transform;
}

.work-card__layer-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Compensates for source PNGs whose visible content occupies a larger
   share of the transparent canvas than the established convention
   (~25% of canvas width) — scales the rendered content down to match. */
.work-card__layer-img--compact {
  object-fit: contain;
  transform: scale(0.85);
}

/* Frontmost card — nudged left to open up space between the stack. */
.work-card__layer-img--compact-left {
  object-fit: contain;
  transform: scale(0.85) translateX(-8%);
}

/* Backmost card — nudged right to open up space between the stack. */
.work-card__layer-img--compact-right {
  object-fit: contain;
  transform: scale(0.85) translateX(8%);
}

/* `cover` crops a window into the source that depends on the frame's aspect
   ratio, which itself varies a lot across viewports (card width is vw-based,
   height is vh-based, independently) — any fixed object-position tuned for
   one aspect ratio drifts at another. `contain` never crops, so position is
   stable regardless of the frame's shape. */
.work-card__layer-img--top-anchored {
  object-fit: contain;
  object-position: center top;
  transform: translateY(-3%) scale(0.9);
}

.work-card__layer-img--bottom-anchored {
  object-fit: contain;
  object-position: center bottom;
}

/* Dimmed background layer for better contrast - constant */
.work-card__layer--dimmed::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  /* Constant dark overlay */
}

.work-card:hover .work-card__media::before {
  background-image: var(--img-hover);
  transform: scale(1.38);
  /* Hide the old background-switch effect if layers are present */
  opacity: var(--has-layers, 1);
}

.work-card[data-has-layers="true"] .work-card__media::before {
  display: none;
}