/* ---------- 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;
  color: var(--color);
}

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

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 Buttons ---------- */
#tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  background-color: var(--bg);
  color: var(--color);
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn:hover {
  background-color: var(--link);
  color: #fff;
}

.tag-btn.active {
  background-color: var(--link);
  color: #fff;
  border-color: var(--link);
}

/* ---------- 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: flex;
}

.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;}
}
