/* PROJECTS SECTION */

.engine-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vh, 22px);
  width: 100%;
  max-width: 1100px;
  margin: clamp(18px, 2.5vh, 32px) auto 0;
}

/* Kart */
.engine-box {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #111114 0%, #08080a 100%);

  text-decoration: none;
  color: white;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  /* Sized to fit desktop 800px viewport while retaining presence */
  min-height: clamp(170px, 26vh, 360px);

  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  isolation: isolate;
  transition: border-color 300ms ease, box-shadow 300ms ease, transform 300ms var(--scroll-ease);
}

.engine-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  z-index: 2;
  pointer-events: none;
  transition: background 300ms ease;
}

.engine-box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 30%, rgba(0,0,0,0.55) 68%, rgba(0,0,0,0.85) 100%);
  z-index: 0;
  pointer-events: none;
}

/* Card top-left badge */
.badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(5, 5, 6, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.unreal .badge {
  border-color: rgba(230, 57, 70, 0.55);
  color: #ff858d;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.2);
}

.uefn .badge {
  border-color: rgba(0, 178, 255, 0.55);
  color: #70d3ff;
  box-shadow: 0 4px 12px rgba(0, 178, 255, 0.2);
}

.unity .badge,
.roblox .badge {
  background: rgba(18, 18, 22, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.45);
}

.engine-img {
  position: absolute;
  inset: 0;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  transition: transform 600ms var(--scroll-ease), filter 600ms ease;
  z-index: -1;

  filter: brightness(0.6) contrast(1.05) saturate(1.1);
}

/* Card bottom label */
.engine-box span:not(.badge) {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 0.88rem;
  background: rgba(5, 5, 6, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  padding: 14px 12px;
  text-align: center;
  position: relative;
  z-index: 1;
  display: block;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card arrow for active cards */
.card-arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform 300ms var(--scroll-ease);
}

.unreal:hover .card-arrow,
.uefn:hover .card-arrow {
  transform: translateX(6px);
}

/* Unreal hover with accent border glow */
.unreal:hover .engine-img {
  transform: scale(1.08);
  filter: brightness(0.72) contrast(1.05) saturate(1.15);
}

.unreal:hover {
  border-color: rgba(230, 57, 70, 0.7);
  box-shadow: 0 0 0 1px rgba(230, 57, 70, 0.4), 0 24px 70px rgba(230, 57, 70, 0.22), 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(-6px);
}

.unreal:hover::before {
  background: linear-gradient(90deg, transparent, rgba(230, 57, 70, 0.95), transparent);
}

/* Unity disabled card */
.unity {
  opacity: 0.38;
  filter: grayscale(100%);
  cursor: not-allowed;
  user-select: none;
  box-shadow: none;
}

/* UEFN - Fortnite blue */
.uefn .engine-img {
  background:
    radial-gradient(80% 90% at 50% 18%, rgba(0, 178, 255, 0.4), transparent 70%),
    linear-gradient(160deg, #0a1e38 0%, #060b12 72%);
  filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.uefn-img::after {
  content: "FN";
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 900;
  letter-spacing: 6px;
  color: transparent;
  -webkit-text-stroke: 2px rgba(0, 178, 255, 0.5);
}

.uefn:hover .engine-img {
  transform: scale(1.08);
}

.uefn:hover {
  border-color: rgba(0, 178, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 178, 255, 0.4), 0 24px 70px rgba(0, 178, 255, 0.22), 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(-6px);
}

.uefn:hover::before {
  background: linear-gradient(90deg, transparent, rgba(0, 178, 255, 0.95), transparent);
}

/* Roblox - disabled card */
.roblox {
  opacity: 0.38;
  filter: grayscale(100%);
  cursor: not-allowed;
  user-select: none;
  box-shadow: none;
}

.roblox .engine-img {
  background:
    radial-gradient(80% 90% at 50% 18%, rgba(255, 45, 45, 0.32), transparent 70%),
    linear-gradient(160deg, #240d0d 0%, #0b0707 72%);
  filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.roblox-img::after {
  content: "R";
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.35);
}

/* Responsive: 1 column at <= 900px */
@media (max-width: 900px) {
  .engine-split {
    grid-template-columns: 1fr;
  }

  .engine-box {
    min-height: clamp(150px, 24vh, 300px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .engine-box,
  .engine-img,
  .card-arrow {
    transition: none !important;
    transform: none !important;
  }
}
