/* CSS Reset & Global Styles */
* {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
  max-width: 100vw; /* Prevent horizontal overflow */
}

html,
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  overflow-x: hidden; /* Ensure no horizontal scrollbar */
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Barlow', sans-serif;
  background-color: #1c1e18; /* Zen Garden BG */
  color: #e0e0e0; /* Light text for contrast */
}

main {
  flex: 1;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden; /* Prevent main content from causing overflow */
}

.chmefy-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px; /* Responsive padding */
}

/* Global Image Styles */
img,
canvas,
iframe,
video,
svg {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover; /* Ensures images cover their container without distortion */
  box-sizing: border-box;
}

/* Typography & Links */
a {
  color: #2ecc71; /* Accent color for links */
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #34f081;
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  color: #ffffff; /* White for headings */
  margin-bottom: 1rem;
  line-height: 1.3;
}

p {
  line-height: 1.8;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Header Styles */
.chmefy-header-c-l-r {
  background: rgba(28, 30, 24, 0.8); /* Semi-transparent Zen Garden BG */
  padding: 20px 0; /* Adjusted padding */
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px); /* Glassmorphism effect */
  -webkit-backdrop-filter: blur(10px); /* For Safari compatibility */
  border-bottom: 1px solid rgba(149, 165, 166, 0.2); /* Subtle border */
}

.chmefy-header-c-l-r .chmefy-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.chmefy-logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 20px; /* Add some margin */
}

.chmefy-logo span {
  margin-left: 10px;
}

.chmefy-desktop-nav ul {
  display: flex;
  gap: 30px; /* Increased gap for navigation links */
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chmefy-desktop-nav ul li a {
  color: #e0e0e0;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 8px 15px;
  border-radius: 6px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.chmefy-desktop-nav ul li a:hover {
  background-color: rgba(42, 204, 113, 0.2); /* Accent color with transparency */
  color: #ffffff;
  text-decoration: none;
}

.chmefy-age-flag {
  display: flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background-color: rgba(42, 204, 113, 0.1);
  padding: 8px 15px;
  border-radius: 6px;
  margin-left: 20px; /* Space from logo */
}

.chmefy-age-flag img {
  width: 24px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 4px; /* Slight rounding on flag */
}

.chmefy-hamburger {
  display: none; /* Hidden by default on desktop */
  background: none;
  border: none;
  font-size: 2rem;
  color: #e0e0e0;
  cursor: pointer;
  margin-left: 20px;
}

/* Mobile Menu Styles */
.chmefy-mobile-menu {
  display: none; /* Hidden by default, shown via JS */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(28, 30, 24, 0.95); /* Darker overlay */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 999;
  padding: 40px 20px;
  overflow-y: auto;
  transform: translateX(-100%); /* Start off-screen */
  transition: transform 0.4s ease-out;
}

.chmefy-mobile-menu.active {
  transform: translateX(0); /* Slide in */
}

.chmefy-mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 40px; /* Space below close button */
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.chmefy-mobile-menu ul li a {
  color: #e0e0e0;
  font-size: 1.8rem;
  font-weight: 700;
  padding: 15px 0;
  display: block;
  width: 100%;
  text-align: center;
  border-radius: 10px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.chmefy-mobile-menu ul li a:hover {
  background-color: rgba(42, 204, 113, 0.2);
  color: #ffffff;
}

.chmefy-close-menu {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 2.5rem;
  color: #ffffff;
  cursor: pointer;
}

/* Hero Section Styles */
.chmefy-hero {
  display: flex;
  flex-wrap: wrap-reverse; /* Image first on smaller screens, text wraps below */
  align-items: center;
  justify-content: space-between;
  padding: 140px 20px 100px 20px; /* Generous padding */
  gap: 60px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 70vh; /* Ensure hero takes up significant screen height */
}

.chmefy-hero-text {
  flex: 1; /* Takes available space */
  max-width: 600px; /* Constrain text width */
  min-width: 300px; /* Minimum width for readability */
  padding-right: 20px; /* Space between text and image */
}

.chmefy-hero-text h1 {
  font-size: 3.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 20px;
}

.chmefy-hero-text p {
  font-size: 1.3rem;
  color: #e0e0e0;
  margin-bottom: 30px;
}

.chmefy-hero-image-container {
  flex: 1; /* Takes available space */
  max-width: 650px; /* Image container width */
  min-width: 300px; /* Minimum width for image */
  position: relative; /* For potential overlays or pseudo-elements */
}

.chmefy-hero-image-container img {
  width: 100%;
  aspect-ratio: 4/3; /* Consistent aspect ratio */
  object-fit: cover;
  border-radius: 24px; /* Softly rounded corners */
  box-shadow: -15px 15px 0px rgba(0, 0, 0, 0.05); /* Subtle shadow for depth */
  border: 4px solid #2ecc71; /* Accent border */
}

/* Buttons */
.chmefy-btn {
  display: inline-block;
  padding: 15px 30px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1c1e18; /* Dark text on bright button */
  background-color: #2ecc71; /* Accent color */
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 5px 15px rgba(42, 204, 113, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chmefy-btn:hover {
  background-color: #34f081; /* Lighter accent */
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(42, 204, 113, 0.6);
}

.chmefy-btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(42, 204, 113, 0.4);
}

/* Content Section */
.chmefy-content-section {
  padding: 80px 20px;
  line-height: 1.8;
  font-size: 1.1rem;
  background-color: rgba(28, 30, 24, 0.5); /* Slightly darker than body */
  border-bottom: 1px solid rgba(149, 165, 166, 0.1);
}

.chmefy-content-section h2 {
  font-size: 2.5rem;
  text-align: center;
  color: #ffffff;
  margin-bottom: 40px;
}

.chmefy-content-section p {
  max-width: 800px; /* Limit paragraph width for readability */
  margin-left: auto;
  margin-right: auto;
  text-align: justify;
}

/* Games Grid Styles (Neo-Brutalist Grid) */
.chmefy-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
  gap: 24px;
  max-width: 1200px;
  margin: 40px auto; /* Centered with space */
  padding: 0 20px; /* Padding for smaller screens */
}

.chmefy-game-card {
  background-color: #2c2f27; /* Darker background for cards */
  border: 4px solid #000000; /* Thick black border */
  box-shadow: 6px 6px 0px #000000; /* Hard shadow */
  border-radius: 8px; /* Slightly rounded corners despite brutality */
  overflow: hidden; /* Ensure content stays within rounded corners */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column; /* Stack image and content */
  cursor: pointer;
}

.chmefy-game-card:hover {
  transform: translateY(-5px);
  box-shadow: 8px 8px 0px #000000, 0 0 15px rgba(42, 204, 113, 0.5); /* Add glow on hover */
}

.chmefy-game-card img {
  width: 100%;
  height: 200px; /* Fixed height for consistent grid */
  object-fit: cover;
  border-bottom: 4px solid #000000; /* Border between image and content */
}

.chmefy-game-card-content {
  padding: 20px;
  text-align: center;
  flex-grow: 1; /* Allow content to fill remaining space */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Push title and button apart */
}

.chmefy-game-card-content h3 {
  font-size: 1.4rem;
  color: #ffffff;
  margin-bottom: 15px;
  flex-shrink: 0; /* Prevent title from shrinking */
}

.chmefy-game-card-content .chmefy-btn {
  margin-top: auto; /* Push button to the bottom */
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
}

/* Footer Styles */
.chmefy-footer {
  padding: 40px 20px;
  background: rgba(0, 0, 0, 0.15); /* Darker footer background */
  border-top: 1px solid rgba(149, 165, 166, 0.2);
  margin-top: auto; /* Pushes footer to the bottom */
  font-family: 'Barlow', sans-serif;
  color: rgba(255, 255, 255, 0.8);
}

.chmefy-footer .chmefy-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
}

.chmefy-footer ul {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
  flex-wrap: wrap; /* Allow wrapping */
  justify-content: center;
}

.chmefy-footer ul li a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.3s ease;
}

.chmefy-footer ul li a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.chmefy-footer-contact {
  margin-top: 20px;
  font-size: 0.85em;
  text-align: center;
  opacity: 0.85;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chmefy-footer-contact span {
  color: #ffffff;
}

.chmefy-footer hr {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  width: 100%;
  margin: 15px 0;
}

.chmefy-footer h4 {
  margin: 0 0 8px 0;
  color: #ffcc00; /* Yellow for emphasis */
  font-size: 1.2em;
  font-weight: 700;
}

.chmefy-footer p {
  margin: 0;
  opacity: 0.9;
  font-size: 1em;
  text-align: justify;
}

.chmefy-footer p:not(.chmefy-copyright) {
  margin-bottom: 15px; /* Space between paragraphs */
}

.chmefy-footer a {
  color: #2ecc71; /* Accent for links in footer */
  text-decoration: underline;
}

.chmefy-footer a:hover {
  color: #34f081;
}

.chmefy-copyright {
  margin-top: 15px;
  text-align: center;
  font-size: 0.85em;
  opacity: 0.7;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .chmefy-desktop-nav {
    display: none; /* Hide desktop nav on small screens */
  }

  .chmefy-hamburger {
    display: block; /* Show hamburger menu */
  }

  .chmefy-header-c-l-r .chmefy-container {
    flex-wrap: nowrap; /* Keep logo and flag on one line */
  }

  .chmefy-hero {
    flex-direction: column-reverse; /* Stack image above text */
    padding: 80px 20px 60px 20px;
    gap: 30px;
    text-align: center; /* Center align text */
  }

  .chmefy-hero-text {
    max-width: 100%;
    padding-right: 0; /* Remove padding */
  }

  .chmefy-hero-text h1 {
    font-size: 2.8rem;
  }

  .chmefy-hero-text p {
    font-size: 1.1rem;
  }

  .chmefy-hero-image-container {
    max-width: 80%; /* Limit image size */
    margin: 0 auto; /* Center image */
  }

  .chmefy-game-grid {
    grid-template-columns: 1fr; /* Single column on small screens */
    padding: 0 15px;
  }

  .chmefy-footer ul {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .chmefy-logo {
    font-size: 1.2rem;
  }

  .chmefy-age-flag {
    font-size: 0.9rem;
    padding: 6px 10px;
  }

  .chmefy-hamburger {
    font-size: 1.8rem;
    margin-left: 10px;
  }

  .chmefy-mobile-menu ul li a {
    font-size: 1.5rem;
  }

  .chmefy-hero-text h1 {
    font-size: 2.2rem;
  }

  .chmefy-hero-text p {
    font-size: 1rem;
  }

  .chmefy-btn {
    padding: 12px 20px;
    font-size: 1rem;
  }

  .chmefy-content-section {
    padding: 50px 15px;
  }

  .chmefy-content-section h2 {
    font-size: 2rem;
  }

  .chmefy-game-card {
    box-shadow: 4px 4px 0px #000000;
  }

  .chmefy-game-card:hover {
    box-shadow: 6px 6px 0px #000000, 0 0 10px rgba(42, 204, 113, 0.4);
  }

  .chmefy-game-card-content {
    padding: 15px;
  }

  .chmefy-footer {
    padding: 30px 15px;
  }

  .chmefy-footer-contact {
    font-size: 0.75em;
  }
}