/* ========== Base Styles ========== */
* {
  font-family: monospace;
}

body {
  margin: 0;
  padding: 0;
}

input[type="radio"] {
  display: none;
}

/* ========== Theme Toggle ========== */
.toggle-theme {
  position: fixed;
  top: 10px;
  left: 10px;
  font-size: 14px;
  z-index: 9999;
  color: #f3dfc1;
}

.toggle-theme label {
  cursor: pointer;
  font-weight: normal;
  text-decoration: none;
}

#light:checked~.toggle-theme label[for="light"],
#dark:checked~.toggle-theme label[for="dark"] {
  text-decoration: underline;
}

#light:checked~.toggle-theme {
  color: #1a1c1a;
}

/* ========== Theme Wrapper ========== */
.theme-wrapper {
  min-height: 100vh;
  width: 100%;
  background-color: #1e1e1e;
  color: #f3dfc1;

  display: flex;
  justify-content: center;
  align-items: center;
}

#light:checked~.theme-wrapper {
  background-color: #f3dfc1;
  color: #1a1c1a;
}

/* ========== Layout: Main Container ========== */
#main {
  font-size: 12px;
  width: 600px;
  margin: auto;
  padding: 40px 0;
  background-color: inherit;
  text-align: left;
}

/* ========== Layout: Gallery ========== */
.gallery {
  column-count: 3;
  column-gap: 1rem;
  max-width: 100%;
}

.gallery img {
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
  break-inside: avoid;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gallery img:hover {
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .gallery {
    column-count: 2;
  }
}

@media (max-width: 480px) {
  .gallery {
    column-count: 1;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  backdrop-filter: blur(6px);
  background: rgba(0, 0, 0, 0.75);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.modal img {
  max-width: 90%;
  max-height: 80%;
  margin-bottom: 1rem;
}

.modal a {
  color: #f3dfc1;
  font-size: 14px;
  text-decoration: underline;
}

.modal-caption {
  font-size: 12px;
  color: #f3dfc1;
  text-align: center;
  max-width: 90%;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  font-style: italic;
  line-height: 1.4;
  font-weight: bold;
}

.modal-nav {
  position: absolute;
  top: 50%; 
  transform: translateY(-50%);
  border: none;
  font-size: 2rem;
  color: #f3dfc1;
  padding: 0.4rem 0.8rem;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
  z-index: 1000;
}

.modal-nav:hover {
  color: #778745;
  transform: translateY(-50%) scale(1.15);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}


/* ========== Links ========== */
.theme-wrapper a.link {
  display: inline-block;
  vertical-align: middle;
  font-size: 12px;
  padding: 5px;
  text-decoration: none;
}

.theme-wrapper a.link:link,
.theme-wrapper a.link:visited {
  color: #f3dfc1;
}

.theme-wrapper a.link:hover {
  color: #778745;
  transform: scale(1.2);
}

.theme-wrapper a.link:active {
  color: #778745;
}

#light:checked~.theme-wrapper a.link:link,
#light:checked~.theme-wrapper a.link:visited {
  color: #1a1c1a;
}

#light:checked~.theme-wrapper a.link:hover,
#light:checked~.theme-wrapper a.link:active {
  color: #778745;
}

a {
  color: #778745;
}

/* ========== Typography Accents ========== */
.theme-wrapper b,
.theme-wrapper h3 {
  color: #778745;
}

#light:checked~.theme-wrapper b,
#light:checked~.theme-wrapper h3 {
  color: #778745;
}

/* ========== Noscript Banner ========== */
.noscript-banner {
  background: #ff0000;
  color: #fff;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.9rem;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
  animation: flickerWarning 0.15s infinite alternate;
}

.noscript-banner a {
  color: #aaa;
  text-decoration: underline;
}

@keyframes flickerWarning {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0.8;
  }
}

/* ========== Responsive Media Queries ========== */

/* Small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
  #main {
    width: 100%;
    padding: 20px;
  }

  table {
    width: 100%;
    display: block;
  }

  table tr {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  table td {
    width: 100% !important;
    text-align: center;
    padding: 10px 0;
  }

  .toggle-theme {
    font-size: 12px;
    top: 8px;
    left: 8px;
  }

  .theme-wrapper a.link {
    font-size: 14px;
    padding: 8px;
  }

  img#random-image {
    max-width: 90%;
    height: auto;
    border: none;
  }
}

/* Medium devices (tablets, 601px–900px) */
@media only screen and (min-width: 601px) and (max-width: 900px) {
  #main {
    width: 90%;
    padding: 30px 0;
  }

  table {
    width: 100%;
  }

  table td {
    width: 50%;
    text-align: center;
  }

  img#random-image {
    max-width: 100%;
    height: auto;
  }
}

/* Large devices (desktops, 901px and up) */
@media only screen and (min-width: 901px) {
  #main {
    width: 600px;
  }

  img#random-image {
    width: 100%;
    max-width: 280px;
    height: auto;
  }
}

/* ========== Now Playing Widget (LastFM) ========== */
.now-playing {
  position: fixed;
  bottom: 0;
  left: 0;
  font-family: monospace;
  font-size: 12px;
  text-align: left;
  color: #f3dfc1;
  padding-left: 10px
}

#light:checked~.now-playing {
  color: #1a1c1a;
}