
/* ===== CSS Variables ===== */
:root {
  /* Light Mode */
  --primary: #3a5ba0;
  --primary-dark: #2c3f66;
  --secondary: #10b981;
  --accent: #e76f51;
  --light: #f5f7fa;
  --dark: #1e293b;
  --gray: #cbd5e1;
  --white: #ffffff;
  --black: #000000;
  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 12px;
  --max-width: 1200px;
  --nav-height: 80px;
  --font-primary: "Inter", system-ui, sans-serif;
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--dark);
  background-color: var(--light);
  overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
  background: var(--gray);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h4 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

p {
  font-size: clamp(1rem, 2vw, 1.1rem);
  margin-bottom: 1.5rem;
  color: var(--dark);
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* ===== Utility Classes ===== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
  /* Scroll animation initial state - applied by JS */
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.section-title {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
   /* Scroll animation initial state - applied by JS */
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

 .section-title.visible {
  transform: scale(1);
  opacity: 1;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%) scaleX(0); /* Scroll animation initial state */
  width: 80px;
  height: 4px;
  background: var(--secondary);
  border-radius: 2px;
  transition: transform 0.6s ease 0.3s;
}

.section-title.visible::after {
   transform: translateX(-50%) scaleX(1);
}


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

.btn {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  background: var(--secondary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: left 0.4s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: var(--primary);
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-hover);
}

 /* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary);
  color: var(--white);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 1000;
  transform: scale(0.8);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px) scale(1.1);
}

/* ===== Header & Navigation ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000; /* Ensure header is above most content */
  background: var(--white);
  box-shadow: var(--shadow);
  transition: var(--transition);
  height: var(--nav-height);
}

.header-scrolled {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--nav-height);
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
   /* Removed initial hidden state */
   /* transform: translateY(10px); */
   /* opacity: 0; */
  transition: transform 0.6s ease 0.2s, opacity 0.6s ease 0.2s;
}

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

.logo-img {
  height: 70px;
  width: auto;
  transition: transform 0.4s ease;
}

.logo:hover .logo-img {
  transform: scale(1.1);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text h1 {
  font-size: 1.1rem;
  margin-bottom: 0;
  color: var(--primary);
}

.logo-text span {
  font-size: 1.1rem;
  color: var(--secondary);
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links > li {
  position: relative;
   /* Removed initial hidden state */
   /* opacity: 0; */
   /* transform: translateY(10px); */
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.nav-links > li:nth-child(1) { transition-delay: 0.1s; }
.nav-links > li:nth-child(2) { transition-delay: 0.2s; }
.nav-links > li:nth-child(3) { transition-delay: 0.3s; }
.nav-links > li:nth-child(4) { transition-delay: 0.4s; }
.nav-links > li:nth-child(5) { transition-delay: 0.5s; }
.nav-links > li:nth-child(6) { transition-delay: 0.6s; }
.nav-links > li:nth-child(7) { transition-delay: 0.7s; }
.nav-links > li:nth-child(8) { transition-delay: 0.8s; }


 .nav-links.visible > li {
  opacity: 1;
  transform: translateY(0);
}

.nav-links a {
  font-weight: 600;
  color: var(--dark);
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.nav-links a i {
  font-size: 0.9rem;
  color: var(--dark);
  transition: var(--transition);
}

.nav-links a:hover i,
.nav-links .current a i {
  color: var(--secondary);
  transform: scale(1.2);
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--secondary);
  transition: width 0.4s ease;
}

.nav-links a:hover::after,
.nav-links .current a::after {
  width: 100%;
}

.nav-links .current a { color: var(--secondary); }

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  min-width: 220px;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
  z-index: 1001; /* Increased z-index to appear above main content */
  padding: 0.5rem 0;
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-content a {
  display: block;
  padding: 0.8rem 1.5rem;
  color: var(--dark);
  transition: var(--transition);
}

.dropdown-content a:hover,
.dropdown-content a:focus {
  background: var(--light);
  color: var(--secondary);
  padding-left: 1.8rem;
  transform: translateX(5px);
}

.dropdown-content a i { color: var(--dark); }

.dropdown-content a:hover i,
.dropdown-content a:focus i {
  color: var(--secondary);
}

.hamburger {
  display: none;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary);
  transition: transform 0.4s ease;
}

.hamburger:hover {
  transform: rotate(90deg);
}

/* Mobile Menu Backdrop */
.nav-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.nav-backdrop.active {
  display: block;
  opacity: 1;
}

/* ===== Rules Section Specific Styles ===== */
.rules-main {
  padding-top: calc(var(--nav-height) + 3rem); /* Adjust padding to account for fixed header */
}

.rules-container {
  max-width: 1000px; /* Slightly wider container for rules */
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.rules-section {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
  overflow: hidden;
  transition: var(--transition);
   /* Scroll animation initial state - applied by JS */
  opacity: 0;
  transform: scale(0.98) translateY(20px);
  z-index: 1; /* Ensure rules sections are below dropdowns */
  position: relative; /* Needed for z-index to work */
}

 .rules-section.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}


.section-header {
  background: linear-gradient(to right, var(--primary), #5dade2);
  color: var(--white);
  padding: 1.2rem 1.8rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition);
  position: relative;
  font-size: clamp(1.3rem, 2.5vw, 1.6rem);
  z-index: 2; /* Ensure header is above content within section */
}

 .section-header h2 {
   margin: 0;
   font-size: inherit;
   font-weight: 600;
   color: var(--white);
 }


.section-header:hover {
  background: linear-gradient(to right, #2980b9, var(--primary-dark));
}

.section-header .toggle-icon {
  width: 24px;
  height: 24px;
  stroke: var(--white);
  stroke-width: 2.5;
  transition: transform var(--transition);
}

.section-header.active .toggle-icon {
  transform: rotate(180deg);
}

.section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease-in-out, padding 0.6s ease-in-out;
  background-color: var(--white);
  border-top: 1px solid var(--gray);
  padding: 0 2rem;
  z-index: 1; /* Ensure content is below header within section */
  position: relative;
}

.section-content.active {
  max-height: 3000px; /* Sufficiently large value */
  padding: 2rem 2rem;
}

.rule-item {
  margin-bottom: 1.8rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px dashed var(--gray);
  transition: var(--transition);
}

.rule-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.rule-title {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: flex-start; /* Align number and text nicely */
  font-size: 1.1rem;
}

.rule-title .rule-number {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--secondary), #f39c12);
  color: var(--white);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 12px;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.rule-item:hover .rule-number {
  transform: scale(1.15) rotate(-10deg);
  box-shadow: 0 4px 8px rgba(230, 126, 34, 0.4);
}

.rule-description {
  color: #555;
  padding-left: 44px; /* Align description with rule title text */
}

.sub-rule {
  margin-top: 1.5rem;
  padding: 1rem 1rem 1rem 1.8rem;
  border-left: 4px solid var(--accent);
  background-color: #fdfdff;
  border-radius: 0 var(--radius) var(--radius) 0;
  position: relative;
  overflow: hidden;
}

.sub-rule-item {
  margin-bottom: 1rem;
}

.sub-rule-item:last-child {
  margin-bottom: 0;
}

.sub-rule-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
  display: inline-block;
}

.sub-rule-description {
  color: #666;
  font-size: 0.98rem;
}


/* ===== Footer ===== */
.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

 .footer-column {
  /* Scroll animation initial state - applied by JS */
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.footer-column:nth-child(1) { transition-delay: 0.1s; }
.footer-column:nth-child(2) { transition-delay: 0.2s; }
.footer-column:nth-child(3) { transition-delay: 0.3s; }
.footer-column:nth-child(4) { transition-delay: 0.4s; }

.footer-column.visible {
  opacity: 1;
  transform: translateY(0);
}

footer {
  background: var(--primary);
  color: var(--white);
  padding: 4rem 0 2rem;
  position: relative; /* Needed for z-index */
  z-index: 1; /* Ensure footer is below dropdowns */
}

.footer-column p {
  color: rgba(255, 255, 255, 0.7);
}

.footer-column h3 {
  color: var(--white);
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 10px;
}

.footer-column h3::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 2px;
  background: var(--secondary);
  transform: scaleX(0); /* Scroll animation initial state */
  transform-origin: left;
  transition: transform 0.4s ease;
}

 .footer-column.visible h3::after {
  transform: scaleX(1);
}

.footer-links { list-style: none; }

.footer-links li { 
  
  margin-bottom: 0.8rem; }

.footer-links a {
  color: #bdc3c7;
  transition: var(--transition);
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--secondary);
  transform: translateX(10px);
}

.contact-info { list-style: none; }

.contact-info li {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.contact-info i {
  margin-top: 3px;
  color: var(--secondary);
  transition: transform 0.4s ease;
}

.contact-info li:hover i {
  transform: scale(1.2);
}

.social {
  display: flex;
  gap: 25px;
}

.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: var(--dark);
  color: var(--dark);
  font-size: 1.3rem;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.social a:nth-child(1) { color: #3b5998; }
.social a:nth-child(2) { color: #1da1f2; }
.social a:nth-child(3) { color: #e1306c; }
.social a:nth-child(4) { color: #25d366; }

.social a:hover,
.social a:focus {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--shadow-hover);
}

.social a:nth-child(1):hover,
.social a:nth-child(1):focus { background: #3b5998; color: white; }
.social a:nth-child(2):hover,
.social a:nth-child(2):focus { background: #1da1f2; color: white; }
.social a:nth-child(3):hover,
.social a:nth-child(3):focus { background: #e1306c; color: white; }
.social a:nth-child(4):hover,
.social a:nth-child(4):focus { background: #25d366; color: white; }

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  /* Scroll animation initial state - applied by JS */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease 0.5s, transform 0.6s ease 0.5s;
}

 .footer-bottom.visible {
  opacity: 1;
  transform: translateY(0);
}
.footer-bottom p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}
.tech-badge {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #03fa6e;
  border-radius: 4px;
  background: rgba(0, 10, 20, 0.4);
  backdrop-filter: blur(4px);
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tech-badge span {
  font-size: 0.7em;
  color: #03fa6e;
  display: block;
}

.tech-badge strong {
  font-size: 0.9em;
  color: white;
  font-weight: 500;
}

.tech-badge:hover {
  background: rgba(0, 243, 255, 0.1);
  color: #03fa6e;
}

/* ===== Mobile Styles ===== */
@media (max-width: 992px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: -100%;
    width: 80%;
    height: calc(100vh - var(--nav-height));
    background: var(--white);
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
    gap: 1rem;
    transition: left 0.4s ease;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  .nav-links.active {
    left: 0;
  }

  .nav-links > li {
    opacity: 1; /* Ensure visibility in mobile menu */
    transform: translateY(0); /* Ensure correct position in mobile menu */
    transition: none; /* Disable delay for better mobile experience */
  }


  .dropdown-content {
    position: static;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.02);
    display: none;
    margin-left: 1rem;
    margin-top: 0.5rem;
    z-index: auto; /* Reset z-index for mobile */
  }

  .dropdown.active .dropdown-content {
    display: block;
  }

  .hamburger {
    display: block;
  }

   .rules-main {
       padding-top: calc(var(--nav-height) + 1rem);
   }

  .rules-container {
    padding: 0 1rem;
    margin: 2rem auto;
  }

  .section-header h2 {
    font-size: 1.2rem;
  }

  .section-header {
    padding: 1rem 1.2rem;
  }

  .section-content {
    padding: 0 1.5rem;
  }
  .section-content.active {
    padding: 1.5rem 1.5rem;
  }

   .rule-description {
     padding-left: 0;
     margin-top: 0.5rem;
   }

  .rule-title {
    font-size: 1rem;
    align-items: flex-start;
  }

  .rule-title .rule-number {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    margin-right: 8px;
  }
   .sub-rule {
     padding: 0.8rem 0.8rem 0.8rem 1.2rem;
   }
   .sub-rule-description {
     font-size: 0.9rem;
   }
}

@media (max-width: 768px) {
  .section { padding: 3rem 0; }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }

   .rules-main {
       padding-top: calc(var(--nav-height) + 1rem);
   }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
