/* Minecraft item/method icons used in tables. */

/* Tooltip-style outer border on tables. */
table {
  border-collapse: separate;
  border-spacing: 0;
  border: 4px solid transparent;
  border-image: url("/img/gui/tooltip_frame.png") 2 / 4px / 0 stretch;
}

/* Code blocks embedded in table cells inherit inline-code color. */
.content table td pre code {
  color: var(--inline-code-color);
}

/* Minecraft tooltip styling for blockquotes. */
blockquote {
  border: 4px solid transparent;
  border-block-start: none;
  border-block-end: none;
  border-image: url("/img/gui/tooltip_frame.png") 2 / 4px / 0 stretch;
  padding: 1px 16px;
}

/* Centers Method/Input/Output (or Base Item/Catalyst) columns in icon-driven tables. */

.recipe-table table td:nth-child(2),
.recipe-table table td:nth-child(3),
.recipe-table table td:nth-child(4),
.recipe-table table th:nth-child(2),
.recipe-table table th:nth-child(3),
.recipe-table table th:nth-child(4),
.icon-table table td:nth-child(2),
.icon-table table td:nth-child(3),
.icon-table table th:nth-child(2),
.icon-table table th:nth-child(3) {
  text-align: center;
}

.mc-icon {
  height: 1.4em;
  width: 1.4em;
  vertical-align: -0.35em;
  image-rendering: pixelated;
  margin-right: 0.35em;
}

/* Sprite-strip atlases (e.g. ender_eye): show only the first frame. */
/* cover scales the strip so one frame fills the box; top crops to frame 1. */
.mc-icon-atlas,
img.card-icon-atlas {
  object-fit: cover;
  object-position: top;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.5rem 1.75rem;
  border: 4px solid transparent;
  border-image: url("/img/gui/tooltip_frame.png") 2 / 4px / 0 stretch;
  border-radius: 0;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-fg);
  text-decoration: none;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--sidebar-active);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  color: var(--sidebar-fg);
}

.card .card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin-bottom: 0.4rem;
}

/* When the icon is next to the title, shrink it to an inline size. */
.card .card-header .card-icon {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0;
}

.card .card-header img.card-icon {
  display: block;
  height: 1.6rem;
  width: 1.6rem;
  image-rendering: pixelated;
}

.card .card-header .card-title {
  display: block;
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0;
}

.card .card-icon {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.card img.card-icon {
  display: block;
  height: 2.2rem;
  width: 2.2rem;
  image-rendering: pixelated;
}

.card .card-title {
  display: block;
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.card .card-desc {
  display: block;
  font-size: 1rem;
  color: var(--sidebar-fg);
  opacity: 0.75;
  width: 100%;
}

/* Recipe cards are not links: they hold a recipe render as the description. */
.card.recipe-card {
  cursor: default;
}

/* Recipe grid uses a fixed 4-column layout (not the auto-fill of Introduction). */
.recipe-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card.recipe-card:hover {
  transform: none;
  box-shadow: none;
}

a.card.recipe-card:hover {
  color: var(--sidebar-fg);
  text-decoration: none;
}

.card.recipe-card .card-title {
  font-family: "IllyriaRP", monospace;
  font-weight: normal;
  /* Minecraft-style hard drop shadow */
  text-shadow: 2px 2px 0 rgb(0 0 0 / 60%);
  font-smooth: never;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  /* Divider between title and recipe */
  border-bottom: 2px solid var(--table-border-color);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  width: 100%;
}

.card-desc ul {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
  text-align: left;
  width: 100%;
}

.card-desc li {
  margin-left: 0;
}

.card-desc .recipe-title {
  display: block;
  width: 100%;
  text-decoration: underline;
  margin-bottom: 0.25rem;
  text-align: left;
}

.card-desc .recipe-title {
  display: block;
  width: 100%;
  text-decoration: underline;
  margin-bottom: 0.25rem;
  text-align: left;
}

.card-desc .stats-block {
  display: block;
  width: 100%;
  text-align: left;
}

.card-desc .stats-title {
  display: block;
  width: 100%;
  text-decoration: underline;
  margin-bottom: 0.25rem;
  text-align: left;
}

/* Footnote superscripts shrink inside the pixel font. */
.card.recipe-card .card-title sup,
.card.recipe-card .card-title .footnote-reference {
  font-size: 0.6em;
}

.card-desc .pos-stat {
  color: #55ff55;
}
.card-desc .neg-stat {
  color: #ff5555;
}
.card-desc .value-stat {
  color: #ffff55;
}

/* Rarity glow: a colored halo around the card frame, keyed per weapon rarity. */
.rarity-rare {
  --rarity-color: #55aaff;
}

.rarity-legendary {
  --rarity-color: #ff55ff;
}

.rarity-mythic {
  --rarity-color: #ffaa00;
}

/* Inline one-line legend above the grid. */
.content .legend-rarity,
.legend-rarity {
  color: var(--rarity-color);
  font-weight: 600;
  opacity: 1;
}

/* Keep the legend on its own line above the grid. */
.content sub:has(.legend-rarity) {
  display: block;
  margin-bottom: 1rem;
  opacity: 1;
}

.card.recipe-card[class*="rarity-"] {
  box-shadow:
    0 0 6px 1px color-mix(in srgb, var(--rarity-color) 55%, transparent),
    0 0 18px 2px color-mix(in srgb, var(--rarity-color) 25%, transparent);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.card.recipe-card[class*="rarity-"]:hover {
  box-shadow:
    0 0 10px 2px color-mix(in srgb, var(--rarity-color) 75%, transparent),
    0 0 28px 4px color-mix(in srgb, var(--rarity-color) 40%, transparent);
}

.card.recipe-card[class*="rarity-"] .card-title {
  color: var(--rarity-color);
}

.card.recipe-card .card-desc {
  display: flex;
  justify-content: center;
  opacity: 1;
}
