/* General Body Styles */
body {
  font-family: "Orbitron", serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: rgba(18, 18, 18, 0.93);
  color: #e0e0e0;
  background-image: url('bg_ouro.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Header Styles */

/* Page-wide transparent background wrapper */
.page-bg {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: rgba(31, 31, 31, 0.5);
  padding-top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

header {
  text-align: center;
  background: none;
  padding-top: 3rem;
  padding-bottom: 0rem;
  color: #e0e0e0;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0rem;
}

header p {
  font-size: clamp(0.5rem, 1.5vw, 2rem);
  margin: 0;
}

/* Main Content Styles */
main {
  flex: 1;
  padding-bottom: 2vh;
  padding-top: 0;
  text-align: center;
  max-height: 100vh;
  overflow-y: auto;
}

/* Link Section Styles */
#links {
  padding: 0.5vw;
  margin: 0.5vh auto;
  border-radius: 8px;
  max-width: 95vw;
  background: rgba(31, 31, 31, 0.5);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

#links h2 {
  text-align: center;
  color: #e0e0e0;
  font-size: clamp(0.6rem, 3vw, 2rem);
}

/* Grid Styles */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5vw, 2fr));
  gap: clamp(0.5rem, 1vw, 1rem);
  justify-content: center;
  padding: clamp(0.5rem, 1vw, 2rem);
  max-width: 100vw;
  box-sizing: border-box;
}

.grid-item {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  background: rgba(50, 50, 50, 0.6);
  padding: clamp(0.1rem, 1vw, 1rem);
  border-radius: 8px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, background 0.2s ease;
  color: #76c7ff;
  position: relative;
  text-decoration: none;
  word-break: break-word;
  white-space: normal;
  font-size: clamp(0.2rem, 2vw, 1rem);
}

.grid-item:hover {
  transform: scale(1.05);
  background: rgba(70, 70, 70, 0.8);
  color: #ffffff;
}

.grid-item::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 31, 31, 0.8);
  color: #fff;
  padding: 0.5rem;
  border-radius: 5px;
  font-size: 0.85rem;
  white-space: nowrap;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.grid-item:hover::after,
.grid-item:focus::after {
  display: block;
  opacity: 1;
}

.grid-icon {
  width: clamp(15px, 5vw, 45px);
  height: clamp(15px, 5vw, 45px);
}

/* Logo Styles */
.logo {
  fill: #e0e0e0;
  display: block;
  margin: 0 auto;
  width: clamp(25vw, 30vw, 50vw);
  height: auto;
  transition: transform 0.3s ease, fill 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
  fill: #ffffff;
}

/* Footer Styles */
footer {
  text-align: center;
  padding: 1rem 0;
  background: rgba(31, 31, 31, 0.5);
  color: #e0e0e0;
}

footer p {
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  margin: 0;
}

/* 404 Page Specific Styles */
.message-box {
  background: rgba(50, 50, 50, 0.6);
  color: #e0e0e0;
  padding: 1.5rem;
  margin: 2rem auto;
  max-width: 600px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.message-box p {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.6;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background-color: #1f1f1f;
  margin: 15% auto;
  padding: 20px;
  border-radius: 8px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.close {
  color: #fff;
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.qr-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.qr-container {
  text-align: center;
}

.qr-legend {
  margin-top: 1rem;
  color: #ffffff;
  font-size: 1.2rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 1rem;
  border-radius: 5px;
  display: inline-block;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-thumb {
  background: #2e2e2e;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #505050;
}

/* Media Queries */
/* Extra-wide Landscape: width is much greater than height */
@media screen and (aspect-ratio > 2/1) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .logo {
    width: 25vw;
    max-width: 100%;
    max-height: 16vh;
  }
}

/* Landscape: width is greater than height, but not ultra-wide */
@media screen and (aspect-ratio > 4/3) and (aspect-ratio <=2/1) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .logo {
    width: 30vw;
    max-width: 100%;
    max-height: 18vh;
  }
}

/* Square-ish: width and height are similar */
@media screen and (aspect-ratio >=1/2) and (aspect-ratio <=4/3) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .logo {
    width: 40vw;
    max-width: 100%;
    max-height: 20vh;
  }
}

/* Portrait: height is much greater than width */
@media screen and (aspect-ratio < 1/2) {
  .grid {
    grid-template-columns: 1fr;
  }

  .logo {
    width: 60vw;
    max-width: 100%;
    max-height: 20vh;
  }
}