/* ---------- Base Styles ---------- */
html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

::-webkit-scrollbar {
  width: .5rem;
}

::-webkit-scrollbar-track {
  margin: .25rem;
}

::-webkit-scrollbar-thumb {
  background: #c5c5c5;
  border-radius: .635rem;
}

::selection {
  background-color: #000000;
}

:not(:root):fullscreen::backdrop {
  background: #00000050;
  backdrop-filter: blur(3px);
}

/* ---------- Colors & Fonts ---------- */
:root {
  --main-bg: #f0f1f5;
  --bg: #ffffff;
  --color: #333;
  --link: #3ea6ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --main-bg: #1F1F1F;
    --bg: #282828;
    --color: #f0f1f5;
  }
}

* {
  margin: 0;
  padding: 0;
  word-wrap: break-word;
  font-size: 1rem;
  font-family: 'Nunito', sans-serif;
  box-sizing: border-box;
}

body {
  margin: 2rem;
  background-color: var(--main-bg);
  color: var(--color);
}

main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: var(--bg);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem;
}

h1 {
  font-size: 1.2rem;
}

/* ---------- Gallery Styles ---------- */
.gallery,
.overlay img {
  user-select: none;
}

.gallery {
  opacity: 0;
  transition: opacity .25s linear .25s;
}

.gallery.uploaded {
  opacity: 1;
}

.gallery:hover .gallery__figure:not(:hover) {
  opacity: 0.3;
}

.gallery__figure {
  display: flex;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  animation: fade-in 1s;
  transition: opacity .3s;
  border-radius: 0px;
}

.gallery__img {
  transition: all .3s;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  height: auto;
  max-width: 100%;
}

.gallery__img:hover {
  transform: scale(1.1);
}

.gallery.flex {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr));
}

.gallery.grid {
  display: grid;
}

/* ---------- Tag Container ---------- */
#tags {
  display: flex;
  flex-direction: column; /* categories stacked vertically */
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ---------- Each Category ---------- */
.tag-category {
  display: flex;
  flex-wrap: wrap; /* buttons wrap to next line */
  gap: 0.5rem;
}

/* ---------- Tag Buttons ---------- */
.tag-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  color: #000;
}

.tag-btn {
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
}


/* Hover and Active Styles */
.tag-btn:hover {
  opacity: 0.85;
}

.tag-btn.active {
  font-weight: bold;
}


#region-tags .tag-btn,
#artist-tags .tag-btn {
  background-color: #ccc;
  color: #000;
}

/* ---------- Region Tags Centered in 2 Rows ---------- */
#region-tags {
  display: flex;
  flex-wrap: wrap;           /* allow wrapping to next row */
  justify-content: center;   /* center buttons horizontally */
  gap: 0.5rem;               /* spacing between buttons */
  max-width: 1000px;          /* adjust for your page width */
  margin: 0 auto;            /* center the container itself */
}

/* Force buttons to take up half the width per row (2 rows) */
#region-tags .tag-btn {

  max-width: 100px;              /* optional: cap button size */
  text-align: center;
}

/* ---------- Art Tags Centered in 2 Rows ---------- */
#artist-tags {
  display: flex;
  flex-wrap: wrap;           /* allow wrapping to next row */
  justify-content: center;   /* center buttons horizontally */
  gap: 0.5rem;               /* spacing between buttons */
  max-width: 1000px;          /* adjust for your page width */
  margin: 0 auto;            /* center the container itself */
}

/* Force buttons to take up half the width per row (2 rows) */
#artist-tags .tag-btn {
  display: flex;
  max-width: 400px;              /* optional: cap button size */
  text-align: center;
}


/* ---------- Hidden Class for Filtering ---------- */
.hidden {
  display: none !important;
}

/* ---------- Overlay / Lightbox Styles ---------- */
.overlay {
  display: grid;
  position: fixed;
  top: 0;
  left: 0;
  background-color: rgba(0,0,0, .5);
  width: 100%;
  height: 100vh;
  grid-template-columns: 100%;
  grid-template-rows: auto 1fr auto;
  z-index: 9999;
  opacity: 1;
  transition: opacity .5s;
  backdrop-filter: blur(3px);
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.overlay__btns {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  flex-wrap: wrap;
}

.overlay button {
  background: transparent;
  border: none;
  color: #fff;
  width: 3em;
  height: 3em;
}

.overlay button i {
  font-size: 1.5rem;
  cursor: pointer;
  color: #fff;
}

.overlay :is(#next,#prev) {
  position: absolute;
  bottom: calc(50vh - 24px);
}

#next {
  right: 0;
}

#gallery__exitfullscreen {
  display: none;
}

.overlay .leyend {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 48px;
  text-align: center;
  color: #fff;
}

.gallery__open {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.gallery__open img {
  max-height: calc(100vh - 96px);
  max-width: 100%;
}

.gallery__open img:hover ~ figcaption {
  display: none
}

.overlay figcaption {
  display: none;
  position: absolute;
  top: 0;
  background-color: #ffffffd0;
  color: #333;
  padding: 8px;
  font-size: .8rem;
}

/* ---------- Animations ---------- */
@keyframes fade-in {
  from {opacity: 0;}
  to {opacity: 1;}
}
/* =========================================================
   TYPE TAG BUTTONS – FINAL, OVERRIDE-SAFE
   ========================================================= */

/* ---------- Type Tags Centered in 2 Rows ---------- */
#type-tags {
  display: flex;
  flex-wrap: wrap;           /* allow wrapping to next row */
  justify-content: center;   /* center buttons horizontally */
  gap: 0.5rem;               /* spacing between buttons */
  max-width: 1000px;          /* adjust for your page width */
  margin: 0 auto;            /* center the container itself */
}

/* Force buttons to take up half the width per row (2 rows) */
#type-tags .tag-btn {
  flex: 1 1 calc(50% - 0.5rem); /* two buttons per row, minus gap */
  max-width: 100px;              /* optional: cap button size */
  text-align: center;
}



/* Hover & Active – NEVER change background */
#type-tags .tag-btn:hover {
  filter: brightness(1.05);
}

#type-tags .tag-btn.active {
  outline: 3px #fff;
  font-weight: bold;
}

/* Pokémon Type Colors */
#type-tags .tag-btn[data-type="Normal"]   { background:#A8A77A; color:#000; }
#type-tags .tag-btn[data-type="Fire"]     { background:#EE8130; color:#fff; }
#type-tags .tag-btn[data-type="Water"]    { background:#6390F0; color:#fff; }
#type-tags .tag-btn[data-type="Electric"] { background:#F7D02C; color:#000; }
#type-tags .tag-btn[data-type="Grass"]    { background:#7AC74C; color:#000; }
#type-tags .tag-btn[data-type="Ice"]      { background:#96D9D6; color:#000; }
#type-tags .tag-btn[data-type="Fighting"] { background:#C22E28; color:#fff; }
#type-tags .tag-btn[data-type="Poison"]   { background:#A33EA1; color:#fff; }
#type-tags .tag-btn[data-type="Ground"]   { background:#E2BF65; color:#000; }
#type-tags .tag-btn[data-type="Flying"]   { background:#A98FF3; color:#fff; }
#type-tags .tag-btn[data-type="Psychic"]  { background:#F95587; color:#fff; }
#type-tags .tag-btn[data-type="Bug"]      { background:#A6B91A; color:#000; }
#type-tags .tag-btn[data-type="Rock"]     { background:#B6A136; color:#000; }
#type-tags .tag-btn[data-type="Ghost"]    { background:#735797; color:#fff; }
#type-tags .tag-btn[data-type="Dragon"]   { background:#6F35FC; color:#fff; }
#type-tags .tag-btn[data-type="Dark"]     { background:#705746; color:#fff; }
#type-tags .tag-btn[data-type="Steel"]    { background:#B7B7CE; color:#000; }
#type-tags .tag-btn[data-type="Fairy"]    { background:#D685AD; color:#fff; }


.tag-toggle-btn {
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #ccc;
  background-color: #C22E28;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-toggle-btn:hover {
  filter: brightness(1.1);
}
#tags {
  transition: opacity 0.3s ease;
}

#tags.hidden {
  opacity: 0;
  pointer-events: none;
}
