/* prevent global overlay from affecting tiles */
.icon-tile,
.icon-tile-full {
  isolation: isolate;
  z-index: 2; /* makes tiles above the wiggle background */
}

/* tile base with stable dark background */
.icon-tile,
.icon-tile-full {
  position: relative;
  background-color: #141414; /* dark base */
  border-radius: 6px;
  padding: 1.6rem 1.2rem;
  text-align: center;
  overflow: hidden;
  border: 2px solid #444;
  box-shadow:
    inset 0 3px 6px rgba(0, 0, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.5);
  transition: background-color 0.3s ease; /* only color */
}

/* only asphalt overlay (no buried here) */
.icon-tile::before,
.icon-tile-full::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('/src/images/bgs/dark_wall.png'), url('/src/images/bgs/asfalt-light.png');
  background-repeat: repeat, repeat-x;
  background-size: auto, 150px auto;
  background-position: center, center;
  opacity: 0.7; /* base visibility */
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s ease;
}

.icon-tile:hover::before,
.icon-tile-full:hover::before {
  opacity: 0.6; /* more visible on hover */
}


/* hover = lighten */
.icon-tile:hover,
.icon-tile-full:hover {
  background-color: #4a4a4a; /* lighten the base */
}

.icon-tile:hover::before,
.icon-tile-full:hover::before {
  opacity: 0.55; /* asphalt texture more visible on hover */
}

/* content above textures */
.icon-tile *,
.icon-tile-full * {
  position: relative;
  z-index: 1;
}

  .icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .icon-tile:hover {
    background-color: #333;
  }

  .icon-tile h5 {
    font-family: "Stardos Stencil", system-ui;
    font-weight: bold;
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
  }

  .icon-tile p {
    font-family: "Lexend", sans-serif;
    color: #ccc;
    font-size: 0.95rem;
  }

  .icon-tile img {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
  opacity: 1;
  filter: none;
  }

  .icon-tile-full img {
  width: 150px;
  height: 150px;
  margin-bottom: 0.6rem;
}


  .icon-tile-full:hover {
    background-color: #333;
  }

  /* directional flicker light overlay */
  .icon-tile::after,
  .icon-tile-full::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    background: linear-gradient(
      to bottom,
      rgba(255, 240, 200, 0.3) 0%,
      rgba(255, 240, 200, 0.15) 40%,
      rgba(255, 240, 200, 0) 100%
    );
    clip-path: polygon(45% 0%, 55% 0%, 100% 100%, 0% 100%);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    animation: none;
    transition: opacity 0.2s ease-in-out;
  }


  /* activate flicker light on hover */
  .icon-tile:hover::after,
  .icon-tile-full:hover::after {
    animation: flickerLight 0.4s steps(2, start) forwards;
  }

  /* flicker keyframes */
  @keyframes flickerLight {
    0%   { opacity: 0; border-bottom-color: rgba(255, 240, 200, 0); }
    30%  { opacity: 1; border-bottom-color: rgba(255, 240, 200, 0.4); }
    50%  { opacity: 0.5; border-bottom-color: rgba(255, 240, 200, 0.2); }
    70%  { opacity: 1; border-bottom-color: rgba(255, 240, 200, 0.5); }
    100% { opacity: 1; border-bottom-color: rgba(255, 240, 200, 0.6); }
  }

  .icon-tile:hover h5,
  .icon-tile-full:hover h5,
  .icon-tile:hover p,
  .icon-tile-full:hover p {
    text-shadow:
      2px 2px 0 #000,
      3px 3px 6px rgba(0, 0, 0, 0.8),
      0 0 10px rgba(0, 0, 0, 0.6);
  }

  /* make entire tile clickable */
.tile-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.tile-link:hover {
  text-decoration: none;
  transform: scale(1.03);
  transition: transform 0.2s ease;
}
