:root {
  /* Loko mazava sy nature */
  --bg: #f4f8fb;
  --bg-soft: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  
  /* Manga lanitra sy Maitso Natiora */
  --primary: #0ea5e9;
  --primary-2: #38bdf8;
  --accent: #10b981; 
  --danger: #ef4444;
  --success: #22c55e;
  
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  
  --radius: 22px;
  --radius-sm: 16px;
  --container: 1180px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif;
  /* Background manga tanora toy ny lanitra sy maitso toy ny zava-maniry */
  background: 
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 40%),
    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 40%),
    linear-gradient(180deg, #f0f7f9 0%, #ffffff 100%);
  color: var(--text);
  overflow-x: hidden;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.section {
  padding: 96px 0;
  position: relative;
  z-index: 1;
}

/* Glass mazava */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 999px;
  color: #0284c7;
  background: rgba(14, 165, 233, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 2.2rem;
}

.section-heading h2 {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.9rem, 3vw, 3rem);
  color: #0f172a;
  line-height: 1.12;
  margin-bottom: 0.9rem;
}

.section-heading p {
  color: var(--text-muted);
  line-height: 1.8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: 0.25s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

.btn-secondary {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(14, 165, 233, 0.2);
}

.btn-ghost {
  color: #0f172a;
  background: transparent;
  border-color: rgba(15, 23, 42, 0.1);
}

.btn-full {
  width: 100%;
}

.link-btn {
  display: inline-flex;
  color: var(--primary);
  font-weight: 700;
  margin-top: 1rem;
}

.link-btn:hover {
  color: var(--accent);
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: grid;
  place-items: center;
  z-index: 9999;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.8rem;
}

.loader-logo span {
  color: var(--accent);
}

.loader-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.loader-bar span {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  animation: loadbar 1.4s infinite ease-in-out;
}

@keyframes loadbar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: 0.3s ease;
}

.header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 800;
  color: #0f172a;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-family: "Orbitron", sans-serif;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
}

.nav-menu a {
  color: var(--text-muted);
  font-weight: 600;
  transition: 0.2s ease;
}

.nav-menu a:hover, .nav-menu a.active {
  color: var(--primary);
}

/* Hero Section */
.hero {
  padding-top: 88px;
  padding-bottom: 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 2rem;
}

.hero-copy h1 {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(2.5rem, 4.5vw, 4.5rem);
  color: #0f172a;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.hero-slogan {
  color: var(--accent);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.hero-text {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 1.8rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  font-family: "Orbitron", sans-serif;
  color: var(--primary);
}

.stat-card span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Hero Visual (Bright / Dashboard) */
.hero-visual {
  position: relative;
  min-height: 560px;
}

.dashboard-card {
  position: absolute;
  inset: 15% 10% auto 10%;
  border-radius: 28px;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.dashboard-top {
  display: flex;
  justify-content: space-between;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.live-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
}

.route-list div {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  margin-bottom: 0.8rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
}

.route-list span {
  color: #64748b;
}

.route-list strong {
  color: #0f172a;
}

/* Cards & Visuals (Nature / Road theme) */
.visual {
  position: relative;
  min-height: 180px;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 1rem;
}

/* Theme mazava ho an'ny sary */
.theme-ets2 { background: linear-gradient(135deg, #bae6fd, #e0f2fe); } /* Lanitra / Highway */
.theme-proton { background: linear-gradient(135deg, #bbf7d0, #dcfce7); } /* Maitso tanàna */
.theme-bussid { background: linear-gradient(135deg, #fef08a, #fef9c3); } /* Masoandro / Tropical */
.theme-maps { background: linear-gradient(135deg, #a7f3d0, #d1fae5); } /* Tendrombohitra */
.theme-skins { background: linear-gradient(135deg, #e9d5ff, #f3e8ff); } 

.visual-chip {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.visual-label {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  color: #0f172a;
  font-weight: 800;
}

/* Grid Layouts */
.game-grid, .video-grid, .mods-grid, .community-grid, .gallery-grid {
  display: grid;
  gap: 1.5rem;
}

.game-grid { grid-template-columns: repeat(4, 1fr); }
.video-grid, .mods-grid { grid-template-columns: repeat(3, 1fr); }
.gallery-grid { grid-template-columns: repeat(4, 1fr); }

.game-card, .video-card, .mod-card, .community-card, .gallery-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.game-card:hover, .mod-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.gallery-card {
  padding: 0;
  overflow: hidden;
  border: none;
  background: transparent;
  cursor: pointer;
}

.gallery-meta { padding: 1rem 0; }

.game-card h3, .mod-card h3, .video-card h3 {
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.game-card p, .mod-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Toolbar Controls */
.toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.control-input {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 0 1rem;
  color: #0f172a;
}

.control-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* Downloads List */
.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.download-row h4 { color: #0f172a; margin-bottom: 0.4rem; }
.download-row p { color: var(--text-muted); font-size: 0.9rem; }

/* Contact Form */
.form-row label {
  color: #334155;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.form-row input, .form-row textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 1rem;
  background: #ffffff;
}

/* Footer */
.footer {
  background: #f8fafc;
  padding: 4rem 0 2rem;
  border-top: 1px solid #e2e8f0;
}

.footer h4 {
  color: #0f172a;
  margin-bottom: 1rem;
}

.footer-text, .footer-links a {
  color: #64748b;
}

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

/* Lightbox & Toast */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: grid;
  place-items: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
}

.lightbox.open { opacity: 1; visibility: visible; }

.lightbox-card {
  background: #ffffff;
  width: min(90%, 800px);
  border-radius: 20px;
  overflow: hidden;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 1rem 2rem;
  border-radius: 12px;
  transition: 0.3s;
  z-index: 300;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .game-grid, .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .video-grid, .mods-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-actions { justify-content: center; }
  .dashboard-card { position: relative; inset: 0; margin-top: 2rem; }
  .toolbar { grid-template-columns: 1fr; }
  .nav-menu { display: none; } /* Add toggle logic if mobile */
}


/* =========================
   Background Slideshow
========================= */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-slideshow {
  position: absolute;
  inset: 0;
}

.bg-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.06);
  filter: saturate(1.15) brightness(1.05) contrast(1.05);
  transition: opacity 1.6s ease-in-out, transform 8s ease-in-out;
  will-change: opacity, transform;
}

.bg-slide.is-visible {
  opacity: 1;
  animation: bgZoom 12s ease-in-out infinite alternate;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.10), transparent 35%),
    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.08), transparent 40%),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.12) 45%,
      rgba(255, 255, 255, 0.30) 100%
    );
}


/* =========================
   Background Caption
========================= */
.bg-caption {
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
  z-index: 2;
  display: inline-flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  max-width: 80vw;
}

.bg-caption.show {
  opacity: 1;
  transform: translateY(0);
}

.bg-caption-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0284c7;
}

.bg-caption-text {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  color: #0f172a;
}

@media (max-width: 640px) {
  .bg-caption {
    left: 0.8rem;
    bottom: 0.8rem;
    padding: 0.6rem 0.85rem;
  }

  .bg-caption-text {
    font-size: 0.88rem;
  }
}

/* Sun glow */
.sun-glow {
  position: absolute;
  top: 6%;
  right: 8%;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 236, 153, 0.9) 0%,
    rgba(255, 236, 153, 0.28) 42%,
    rgba(255, 236, 153, 0) 72%
  );
  filter: blur(8px);
  animation: sunPulse 6s ease-in-out infinite;
}

/* Clouds */
.cloud {
  position: absolute;
  display: block;
  height: 56px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  filter: blur(1px);
  opacity: 0.8;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  width: 64px;
  height: 64px;
  left: 18px;
  top: -24px;
}

.cloud::after {
  width: 82px;
  height: 82px;
  right: 20px;
  top: -32px;
}

.cloud-1 {
  width: 180px;
  top: 12%;
  left: -220px;
  animation: cloudMove 42s linear infinite;
}

.cloud-2 {
  width: 140px;
  top: 24%;
  left: -180px;
  opacity: 0.68;
  animation: cloudMove 55s linear infinite 8s;
}

.cloud-3 {
  width: 220px;
  top: 8%;
  left: -260px;
  opacity: 0.58;
  animation: cloudMove 68s linear infinite 14s;
}

/* Hills */
.hill {
  position: absolute;
  bottom: -4%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hill-1 {
  left: -10%;
  width: 70%;
  height: 190px;
  background: linear-gradient(180deg, rgba(125, 211, 166, 0.85), rgba(74, 222, 128, 0.58));
}

.hill-2 {
  right: -12%;
  width: 62%;
  height: 150px;
  background: linear-gradient(180deg, rgba(134, 239, 172, 0.72), rgba(16, 185, 129, 0.42));
}

/* Ensure content stays above background */
header,
main,
footer {
  position: relative;
  z-index: 1;
}

/* Animations */
@keyframes bgZoom {
  0% {
    transform: scale(1.06) translateY(0px);
  }
  100% {
    transform: scale(1.12) translateY(-10px);
  }
}

@keyframes cloudMove {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(100vw + 420px));
  }
}

@keyframes sunPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.75;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-slide,
  .bg-slide.is-visible,
  .cloud,
  .sun-glow {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================
   Game Cards (Preview + Download)
========================= */
.game-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.game-preview {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f1f5f9;
}

.game-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.game-card:hover .game-preview img {
  transform: scale(1.08);
}

.platform-tag-float {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
}

.game-label-float {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.game-content {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-content h3 {
  color: #0f172a;
  margin-bottom: 0.3rem;
  font-size: 1.1rem;
}

.game-platform-text {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.game-content p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
}

/* =========================
   Game Buttons (Multiple)
========================= */
.game-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.game-download-btn {
  flex: 1;
  min-width: 130px;
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
  text-align: center;
  justify-content: center;
}


/* =========================
   Mod Image + Note
========================= */
.visual-image {
  position: relative;
  background: #f1f5f9;
  overflow: hidden;
}

.visual-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.6s ease;
}

.mod-card:hover .visual-image img {
  transform: scale(1.08);
}

.visual-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
  z-index: 1;
}

.visual-image .visual-chip,
.visual-image .visual-label {
  z-index: 2;
}

.visual-image .visual-label {
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.mod-note {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  color: #b45309;
  font-size: 0.85rem;
  font-weight: 600;
}