/* Define CSS variables for reusability */
:root {
  --primary-color: #bca875;
  --secondary-color: #f1c33c;
  --background-color: #1A1A1A;
  --container-bg: #242326;
  --navbar-bg: #151416;
  --footer-bg: #151416;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --font-family: 'Roboto', sans-serif;
}

/* Base styles */
html {
  height: 100%; /* Ensure html takes full height */
  font-size: 100%; /* Scales with browser zoom, typically 16px */
}

body {
  min-height: 100vh; /* Use min-height instead of height for flexibility */
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  overflow-x: hidden;
  font-family: var(--font-family);
}

/* iOS Safari viewport fix */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: 100dvh; /* Dynamic viewport height for iOS */
  }
}

* {
  box-sizing: border-box;
}

/* Content container */
.content-container {
  position: relative;
  width: 80%;
  margin: 0 auto;
}

/* Ad banners */
.ad-banner {
  position: absolute;
  top: 0;
  width: 15%;
  max-width: 300px;
  z-index: 1;
}

.ad-banner.left { left: 2%; }
.ad-banner.right { right: 2%; }

/* Backgrounds for each page */
.index-bg, .trading-bg, .PVE-bg, .pvp-bg, .crafting-bg, .noreqs-bg, .misc-bg, .calc-bg, .leveling-bg, .Crime-bg {
  background: no-repeat center center / cover fixed;
  flex: 1 0 auto; /* Grow to fill space, don't shrink below content */
}

.Crime-bg { background-image: url(/images/ESO-Crime-Wave-Even.png); }
.index-bg { background-image: url(/images/firesong.jpg); }
.trading-bg { background-image: url(/images/Fezez_the_Merchant.webp); }
.PVE-bg { background-image: url(/images/PVE.webp); }
.pvp-bg { background-image: url(/images/PVP.jpg); }
.crafting-bg { background-image: url(/images/crafting.webp); }
.noreqs-bg { background-image: url(/images/noreqs.jpg); }
.misc-bg { background-image: url(/images/misc.webp); }
.calc-bg { background-image: url(/images/calc.png); }
.leveling-bg { background-image: url(/images/leveling.png); }

/* Containers */
.container {
  background-color: var(--container-bg);
  padding: 3rem 3rem 1rem;
  box-shadow: 0.5rem 0.5rem 1rem 0.5rem var(--background-color);
  width: 60%; /* Percentage scales with parent */
  max-width: 1200px; /* Prevents excessive width on large screens */
  margin: 3rem auto 0;
}

.container1 {
  background-color: var(--container-bg);
  box-shadow: 0.5rem 0.5rem 1rem 0.5rem var(--background-color);
  width: 100%;
  height: auto;
  border: 0.2rem solid black;
  padding: 0;
  margin: 0;
}

.container2 {
  background-color: var(--container-bg);
  padding: 3rem 2rem 1rem;
  box-shadow: 0.5rem 0.5rem 1rem 0.5rem var(--background-color);
  width: 100%;
  height: auto;
  border: 0.2rem solid black;
  margin: 3rem auto 0;
}

/* Navigation bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem; /* Scalable with rem */
  background: var(--navbar-bg);
  color: white;
  box-shadow: 0 0.5rem 1rem var(--shadow-color);
  flex-wrap: wrap;
  border: 0.1rem solid var(--primary-color);
}

/* Navbar links */
.navbar-links ul {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  z-index: 11;
}

.navbar-links li {
  list-style: none;
  padding: 0.5rem;
}

.navbar-links li a {
  display: block;
  text-decoration: none;
  color: var(--primary-color);
  font-size: 1rem; /* Scales with root font size */
  font-weight: 500;
  padding: 0.2rem 0.2rem;
  border-radius: 0.2rem;
  transition: color 0.3s ease;
}

.navbar-links li a:hover {
  color: var(--secondary-color);
}

/* Toggle button */
.toggle-button {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 2rem;
  height: 2rem;
}

.toggle-button .bar {
  height: 0.3rem;
  width: 100%;
  background-color: var(--primary-color);
  border-radius: 10px;
  margin: 0.3rem 0;
}

/* Social media icons */
.Socials, .Hidden-Socials {
  display: flex;
}

.fa-youtube, .fa-twitter, .fa-discord {
  padding: 0;
  font-size: 2.5rem;
  text-decoration: none;
}

.fa-youtube { color: #FF0000; }
.fa-twitter { color: #1D9BF0; }
.fa-discord { color: #5865F2; }

.fa-youtube:hover { color: #FF4C4C; }
.fa-twitter:hover { color: #4CBFFF; }
.fa-discord:hover { color: #8892F8; }

/* Logo and brand */
.logo {
  width: 8rem;
  max-width: 100px;
  height: auto;
}

.brand-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #6F12B8;
}

/* Content blocks */
.contain {
  position: relative;
  width: 100%;
  text-align: center;
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.contain:hover { transform: scale(1.1); }
.container1 .contain:hover { transform: none; }

.image {
  display: block;
  width: 100%;
  height: auto;
  border: 0.2rem solid black;
}

.overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  background-color: whitesmoke;
}

.contain:hover .overlay { transform: scale(1.2); opacity: 0.2; }

/* Video */
.video {
  width: 100%;
  height: auto;
}

/* Footer */
#footer {
  flex-shrink: 0; /* Prevent footer from shrinking */
  border: 0.1rem solid var(--primary-color);
  background: var(--footer-bg);
  padding: 1rem;
  color: grey;
  text-align: center;
  width: 100%;
  box-shadow: 0 0.5rem 1rem var(--shadow-color);
}

/* Dropdown menu */
.navbar-links .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--navbar-bg);
  box-shadow: 0 1rem 2rem var(--shadow-color);
  border-radius: 0.5rem;
  z-index: 20;
}

.navbar-links .dropdown:hover > .dropdown-menu { display: block; }

.navbar-links .dropdown-menu li {
  list-style: none;
  position: relative;
}

.navbar-links .dropdown-menu li a {
  display: block;
  padding: 0.3rem 0.3rem;
  color: var(--primary-color);
  text-decoration: none;
  text-align: left;
  transition: color 0.3s ease;
}

.navbar-links .dropdown-menu li a:hover { color: var(--secondary-color); }

/* Nested dropdowns */
.navbar-links .dropdown-menu .nested-dropdown,
.navbar-links .dropdown-menu .sub-dropdown {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background-color: var(--navbar-bg);
  box-shadow: 0 1rem 2rem var(--shadow-color);
  border-radius: 0.5rem;
}

.navbar-links .dropdown-menu .dropdown:hover > .nested-dropdown,
.navbar-links .dropdown-menu .nested-dropdown .dropdown:hover > .sub-dropdown {
  display: block;
}

/* Scrollable dropdown */
.navbar-links .dropdown-menu.scrollable-content {
  max-height: 30vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #6F12B8 #333;
}

.navbar-links .dropdown-menu.scrollable-content::-webkit-scrollbar {
  width: 0.8rem;
}

.navbar-links .dropdown-menu.scrollable-content::-webkit-scrollbar-track {
  background: var(--navbar-bg);
  border-radius: 0.5rem;
}

.navbar-links .dropdown-menu.scrollable-content::-webkit-scrollbar-thumb {
  background-color: #6F12B8;
  border-radius: 0.5rem;
  border: 0.2rem solid #333;
}

.navbar-links .dropdown-menu.scrollable-content::-webkit-scrollbar-thumb:hover {
  background-color: #A16AE8;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* Trading page */
.thumbnailsize {
  padding-top: 2%;
  height: 300px;
  width: 500px;
}

.TradingDescriptions, .WrittenGuideDescriptions, .ArticleDescriptions, .CalculatorDescriptions {
  padding-top: 1%;
  display: inline-block;
  color: #D5D5D5;
  text-align: center;
  font-size: large;
  font-weight: 500;
  text-shadow: 2px 2px 4px #000000;
}

.WrittenGuideDescriptions { color: var(--primary-color); }
.WrittenGuideDescriptions:hover { color: whitesmoke; }
.ArticleDescriptions { text-align: left; color: #cecdc9; }

/* Headers */
.TradingHeader, .ArticleHeader, .ArticleSubHeader, .CalculatorHeader {
  color: var(--secondary-color);
  font-weight: 400;
  text-shadow: 5px 5px 10px #000000;
}

.TradingHeader { text-align: center; font-size: xx-large; font-weight: 700; }
.ArticleHeader, .ArticleSubHeader { text-align: left; font-size: xx-large; }
.CalculatorHeader {
  text-align: center;
  font-size: 4.375rem; /* Scalable equivalent of 70px */
  font-weight: 800;
}

/* Calculator */
#calculator, .cal { text-align: center; }
.title-cal { font-size: 1rem; }

.CalculatorDescriptions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
  color: #D5D5D5;
  text-align: center;
  font-size: large;
  font-weight: 500;
  text-shadow: 2px 2px 4px #000000;
}

.CalculatorDescriptions p {
  margin-bottom: 0.5rem;
}

.CalculatorDescriptions i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-top: 0.5rem;
}

.in {
  font-size: 3.5rem;
  width: 80%;
  max-width: 300px;
  text-align: center;
}

.cal-btn {
  background-image: url(/images/box.png);
  background-size: cover;
  padding: 1rem 2rem;
  border: none;
  cursor: pointer;
  margin-top: 2rem;
}

.cal-btn:hover {
  background-color: whitesmoke;
  transform: scale(1.02);
  transition: .20s ease;
}

/* Strong text */
strong {
  color: var(--primary-color);
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
}

/* Responsive design */
@media (min-width: 1200px) {
  .Hidden-Socials ul { display: none; }
  .video { height: 20rem; }
}

@media (max-width: 1080px) {
  .navbar {
    display: grid;
    grid-template-areas: "logo toggle socials";
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 1rem;
  }
  .logo {
    grid-area: logo;
  }
  .toggle-button {
    grid-area: toggle;
    justify-self: center;
    display: flex;
    width: 3rem;
    height: 3rem;
  }
  .Socials {
    grid-area: socials;
    justify-self: end;
    display: flex;
  }
  .navbar-links {
    display: none;
    grid-column: 1 / -1;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--navbar-bg);
    z-index: 12;
  }
  .navbar-links.active {
    display: block;
  }
  .navbar-links ul {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }
  .navbar-links li a {
    font-size: 0.9rem;
  }
  .fa-youtube, .fa-twitter, .fa-discord {
    font-size: 1.5rem; /* Adjusted size for mobile */
  }
  .container, .container1, .container2 {
    width: 100%;
    margin: 3rem 0 0;
  }
  .contain {
    margin-bottom: 0;
  }
  .container1 {
    margin-bottom: 3rem;
  }
  .navbar-links .dropdown-menu,
  .navbar-links .dropdown-menu .nested-dropdown,
  .navbar-links .dropdown-menu .sub-dropdown {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .CalculatorHeader {
    font-size: 2.5rem;
  }
  .in {
    font-size: 2rem;
    width: 90%;
  }
  .cal-btn {
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 480px) {
  .CalculatorHeader {
    font-size: 1.5rem;
  }
  .in {
    font-size: 1.5rem;
  }
  .CalculatorDescriptions {
    font-size: medium;
  }
  .CalculatorDescriptions i {
    font-size: 1.5rem;
  }
  .toggle-button {
    width: 2.5rem;
    height: 2.5rem;
  }
  .fa-youtube, .fa-twitter, .fa-discord {
    font-size: 1.2rem;
  }
  .logo {
    width: 12vw;
    max-width: 80px;
  }
  .navbar-links li a {
    font-size: 0.8rem;
  }
}

/* New media query to prevent wrapping on larger screens */
@media (max-width: 1200px) and (min-width: 1081px) {
  .navbar-links li a {
    font-size: 0.9rem; /* Slightly smaller text */
    padding: 0.5rem 0.8rem; /* Reduced padding to save space */
  }
  .fa-youtube, .fa-twitter, .fa-discord {
    font-size: 2rem; /* Smaller icons to fit better */
  }
}