/*
 * CEOMRX Website Styles
 *
 * This stylesheet defines a modern, professional look for the CEOMRX site.
 * Colours and spacing are managed with CSS variables for easy customization.
 */

:root {
  --primary: #ff6600;
  --secondary: #ffaa00;
  --background: #0e1a2b;
  --surface: #162a47;
  --surface-alt: #1e3a5c;
  --text: #e5e5e5;
  --heading: #ffffff;
}

/* Reset & global styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--secondary);
}

/* Navbar styling */
.custom-navbar {
  background: rgba(14, 26, 43, 0.9) !important;
  backdrop-filter: blur(6px);
  padding: 0.8rem 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--primary) !important;
  transition: color 0.3s ease;
}

.navbar-brand:hover {
  color: var(--secondary) !important;
}

/* Brand text styling for the logo; appears on medium and larger screens */
.navbar-brand .brand-text {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  transition: transform 0.3s ease;
}
.navbar-brand:hover .brand-text {
  transform: translateY(-2px);
}

.navbar-nav .nav-link {
  color: var(--text) !important;
  margin-left: 1rem;
  position: relative;
  font-weight: 500;
  transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--primary) !important;
}

/* Hero section */
.hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

/* p5 canvas occupies full hero */
#p5-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/*
 * The hero content (tagline and CTA button) normally sits dead‑centre in the hero
 * section. After removing the static <h1> heading we want the dotted text
 * drawn on the canvas to take centre stage and the tagline/button to sit
 * below it. By adding a top margin based on the viewport height we push the
 * tagline and button further down, creating a clear separation between the
 * particles text and the descriptive content. On smaller screens we reduce
 * this offset using a media query.
 */
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 0 1rem;
  text-align: center;
  /*
   * Push the tagline/button further down to sit beneath the particle text.
   * On larger screens we position it around mid‑page; on smaller screens
   * the offset is reduced so content remains visible without scrolling.
   */
  margin-top: 50vh;
}

/* On very small screens push the tagline further down so it appears below
   the particle text. Mobile devices typically need larger offsets. */
@media (max-width: 576px) {
  .hero-content {
    margin-top: 60vh;
  }
}

/* On small tablets push the tagline down but slightly less than on phones. */
@media (min-width: 577px) and (max-width: 768px) {
  .hero-content {
    margin-top: 55vh;
  }
}

.hero-content h1 {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 1rem;
  letter-spacing: 2px;
}

.tagline {
  font-size: 1.25rem;
  opacity: 0.95;
  margin-bottom: 2.5rem;
  min-height: 3rem;
  display: block;
  color: var(--heading);
}

.btn-primary {
  display: inline-block;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: var(--background);
  padding: 0.8rem 2rem;
  border-radius: 30px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(255, 102, 0, 0.4);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(255, 102, 0, 0.6);
}

/* Features section */
.features {
  width: 90%;
  margin: 4rem auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--surface);
  border-radius: 15px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 1;
}

.feature-card i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  color: var(--heading);
  font-size: 1.4rem;
}

.feature-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.8;
}

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Page content generic styling */
.page-content {
  width: 90%;
  max-width: 900px;
  margin: 6rem auto 4rem auto;
}

.page-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--heading);
}

.page-content h2 {
  font-size: 1.8rem;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  color: var(--heading);
}

.page-content p {
  margin-bottom: 1rem;
  line-height: 1.6;
  opacity: 0.9;
}

/* Games page */
.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--surface);
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 1;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.game-card .game-image {
  background: var(--surface-alt);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card .game-image i {
  font-size: 3rem;
  color: var(--primary);
}

.game-card h3 {
  font-size: 1.5rem;
  margin: 1rem;
  color: var(--heading);
}

.game-card p {
  flex-grow: 1;
  margin: 0 1rem 1rem 1rem;
  font-size: 0.95rem;
  opacity: 0.9;
}

.game-card a {
  display: block;
  margin: 0 1rem 1.5rem 1rem;
  padding: 0.6rem 1rem;
  border-radius: 25px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: var(--background);
  font-weight: 600;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.game-card a:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* Games page search bar */
.game-search {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background 0.3s ease;
}
.game-search:focus {
  background: var(--surface-alt);
}

/* Contact form */
.contact-form {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  transition: background 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  background: var(--surface-alt);
}

.contact-form button {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: var(--background);
  border: none;
  padding: 0.8rem;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* Input groups with icons inside contact forms */
.contact-form .input-group {
  position: relative;
}
.contact-form .input-group i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 1.1rem;
}
.contact-form .input-group input,
.contact-form .input-group textarea {
  padding-left: 2.5rem;
}

/* Footer */
footer {
  background: #0a172b;
  color: var(--text);
  text-align: center;
  padding: 2rem 1rem;
  margin-top: auto;
}

footer p {
  margin-bottom: 0.5rem;
}

footer .social a {
  color: var(--text);
  font-size: 1.4rem;
  margin: 0 0.5rem;
  transition: color 0.3s ease;
}

footer .social a:hover {
  color: var(--primary);
}

/* Decorative underline for secondary headings */
.page-content h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  margin: 0.3rem auto 1rem auto;
}

/* Reveal animations using IntersectionObserver (see main.js) */
.hidden {
  opacity: 0;
  transform: translateY(40px);
}

.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
  .tagline {
    font-size: 1.1rem;
  }
  .navbar-nav .nav-link {
    margin-left: 0.5rem;
  }
  .page-content {
    margin-top: 5rem;
  }
}

/* Back-to-top button */
#back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 2rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: var(--background);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Theme toggle button in navbar */
.theme-toggle-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}
.theme-toggle-btn:hover {
  color: var(--primary);
}
body.light .theme-toggle-btn {
  color: var(--text);
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Light theme overrides for public site */
body.light {
  --background: #f9f9f9;
  --surface: #ffffff;
  --surface-alt: #f0f0f0;
  --text: #333333;
  --heading: #111111;
}

/* Adjust navbar colours in light mode */
body.light .custom-navbar {
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(6px);
}
body.light .navbar-nav .nav-link {
  color: var(--text) !important;
}
body.light .navbar-nav .nav-link:hover,
body.light .navbar-nav .nav-link.active {
  color: var(--primary) !important;
}
body.light .navbar-brand {
  color: var(--primary) !important;
}
body.light .navbar-brand:hover {
  color: var(--secondary) !important;
}
