/* ===================================================
   Chemify — Periodic Table Explorer Styles
   =================================================== */

/* ---------- Explorer Layout ---------- */
.explorer-hero {
   padding: calc(var(--navbar-height) + 40px) 32px 10px;
   max-width: 1000px;
   margin: 0 auto;
   display: flex;
   flex-direction: column;
   align-items: center;
   text-align: center;
}

.explorer-hero__heading {
   font-family: Georgia, 'Times New Roman', serif;
   font-size: 3.5rem;
   font-weight: 400;
   margin-bottom: 24px;
   line-height: 1.2;
   color: var(--color-text);
}

.explorer-hero__sub {
   font-family: var(--font-family);
   font-size: 1.1rem;
   color: #444;
   max-width: 520px;
   line-height: 1.7;
   margin-bottom: 0;
}

.explorer {
   padding: 32px 32px 64px;
   max-width: 1400px;
   margin: 0 auto;
}

.explorer__scroll-wrap {
   overflow-x: auto;
   -webkit-overflow-scrolling: touch;
   padding-bottom: 8px;
   /* Scroll shadow for mobile */
   position: relative;
}

.explorer__grid {
   display: grid;
   grid-template-columns: repeat(18, 58px);
   grid-template-rows: repeat(7, 64px) 20px repeat(2, 64px);
   gap: 3px;
   justify-content: center;
   min-width: fit-content;
   padding: 0 4px;
}

/* ---------- Element Tile ---------- */
.el-tile {
   width: 58px;
   height: 64px;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   border: 1px solid #e0e0e0;
   border-radius: 4px;
   background: #fff;
   cursor: pointer;
   position: relative;
   gap: 1px;
   padding: 3px 2px 2px;
   /* Animation start state */
   opacity: 0;
   transform: translateY(10px);
   transition:
      transform 0.2s ease,
      border-color 0.2s ease,
      box-shadow 0.2s ease,
      opacity 0.3s ease;
}

.el-tile.is-visible {
   animation: tileEnter 0.3s ease forwards;
}

.el-tile:hover {
   transform: scale(1.1);
   border-color: #1a1a1a;
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
   z-index: 10;
}

.el-tile.is-active {
   border-color: #1a1a1a;
   border-width: 2px;
   box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.el-tile.is-dimmed {
   opacity: 0.15 !important;
   pointer-events: none;
}

/* Tile inner elements */
.el-tile__number {
   position: absolute;
   top: 3px;
   left: 4px;
   font-size: 0.55rem;
   font-weight: 500;
   color: #888;
   line-height: 1;
}

.el-tile__symbol {
   font-family: Georgia, 'Times New Roman', serif;
   font-size: 1.1rem;
   font-weight: 700;
   color: #1a1a1a;
   line-height: 1;
   margin-top: 6px;
}

.el-tile__name {
   font-size: 0.45rem;
   font-weight: 500;
   color: #666;
   line-height: 1;
   max-width: 54px;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
   text-align: center;
}

.el-tile__mass {
   font-size: 0.45rem;
   font-weight: 400;
   color: #999;
   line-height: 1;
}

/* ---------- Category Colors ---------- */
.el-tile--alkali-metal {
   background: #fff5f5;
}

.el-tile--alkaline-earth {
   background: #fff8f0;
}

.el-tile--transition-metal {
   background: #f8f8ff;
}

.el-tile--post-transition {
   background: #f5fff5;
}

.el-tile--metalloid {
   background: #fffff0;
}

.el-tile--nonmetal {
   background: #f0f8ff;
}

.el-tile--halogen {
   background: #fdf0ff;
}

.el-tile--noble-gas {
   background: #f0f0ff;
}

.el-tile--lanthanide {
   background: #fff0f8;
}

.el-tile--actinide {
   background: #fff0f0;
}

/* ---------- Marker cells (Ln / Ac refs) ---------- */
.el-marker {
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 0.6rem;
   font-weight: 600;
   color: #aaa;
   letter-spacing: 0.02em;
}

/* ---------- Tile Enter Animation ---------- */
@keyframes tileEnter {
   from {
      opacity: 0;
      transform: translateY(10px);
   }

   to {
      opacity: 1;
      transform: translateY(0);
   }
}

/* ---------- Scroll hint (mobile only) ---------- */
.explorer__scroll-hint {
   display: none;
   text-align: center;
   font-size: 0.8rem;
   color: #aaa;
   margin-top: 12px;
   letter-spacing: 0.05em;
}

/* ---------- Legend ---------- */
.explorer__legend {
   display: flex;
   flex-wrap: wrap;
   justify-content: center;
   gap: 16px 24px;
   margin-top: 40px;
   padding-top: 24px;
   border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.legend-item {
   display: flex;
   align-items: center;
   gap: 8px;
}

.legend-swatch {
   width: 16px;
   height: 16px;
   border-radius: 3px;
   border: 1px solid #e0e0e0;
   flex-shrink: 0;
}

.legend-label {
   font-family: Georgia, 'Times New Roman', serif;
   font-size: 0.8rem;
   font-weight: 400;
   color: #555;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
   .explorer__grid {
      grid-template-columns: repeat(18, 46px);
      grid-template-rows: repeat(7, 52px) 16px repeat(2, 52px);
   }

   .el-tile {
      width: 46px;
      height: 52px;
   }

   .el-tile__symbol {
      font-size: 0.95rem;
   }

   .el-tile__number {
      font-size: 0.48rem;
   }

   .el-tile__name {
      font-size: 0.38rem;
   }

   .el-tile__mass {
      font-size: 0.38rem;
   }
}

@media (max-width: 768px) {
   .explorer {
      padding: 20px 16px 48px;
   }

   .explorer-hero {
      padding: calc(var(--navbar-height) + 20px) 16px 10px;
   }

   .explorer-hero__heading {
      font-size: 2.8rem;
   }

   .explorer__scroll-hint {
      display: block;
   }

   /* Right-edge scroll shadow */
   .explorer__scroll-wrap::after {
      content: '';
      position: sticky;
      right: 0;
      top: 0;
      width: 32px;
      height: 100%;
      background: linear-gradient(to left, var(--color-bg), transparent);
      pointer-events: none;
      display: block;
      float: right;
      margin-top: -100%;
   }
}

@media (max-width: 480px) {
   .explorer__legend {
      gap: 10px 16px;
   }

   .legend-label {
      font-size: 0.7rem;
   }
}