:root {
  --ui-gradient: linear-gradient(45deg, #00BFFF, #1E90FF);
  --ui-gradient-negative: linear-gradient(45deg, #1E90FF, #00BFFF);
  --white: #e4e9fd;
  --black: #040c0e;
  --light-black: rgb(53, 50, 50);
}

/* ============== PRE LOADER ================= */
.loader-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* The Spinner (the rotating border) */
.spinner {
  width: 80px;
  /* Increased size to fit an image */
  height: 80px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* The Logo (stays still) */
.loader-logo {
  position: absolute;
  width: 40px;
  /* Adjust size based on your logo */
  height: 40px;
  border-radius: 50%;
  /* Optional: makes the image circular */
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Preloader Background */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: #ffffff;
  /* Change to match your theme */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  /* Ensures it stays on top of everything */
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Class to hide the preloader via JS */
.loader-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

* {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
}

body {
  overflow-x: hidden;
}

/* ================= NAVBAR ================= */
nav {
  background: var(--ui-gradient);
  height: 100px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  font-weight: bold;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-img {
  width: 80px;
  height: 80px;
}

.logo {
  font-size: 2rem;
  font-weight: bold;
}

.logo a {
  text-decoration: none;
  color: var(--black);
}

.nav-items ul {
  display: flex;
  gap: 8px;
  padding-top: 0;
  align-items: center;
}

.nav-items ul li {
  list-style: none;
}

.nav-items ul li a {
  text-decoration: none;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 8px 5px;
  margin: 0 10px;
  display: inline-block;
  position: relative;
  transition: color 0.25s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.nav-items ul li a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #fff;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}

.nav-items ul li a:hover::after {
  visibility: visible;
  width: 100%;
}

.nav-items ul li a:hover {
  color: #fff;
  transform: translateY(-1px);
}

.nav-items ul li a.active-nav::after {
  visibility: visible;
  width: 100%;
  height: 3px;
  background-color: #ff9800;
}

/* ======= ADD SEARCH BAR ======= */
.search {
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
  position: relative;
}

.search form {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  padding: 10px 25px;
  border-radius: 50px;
}

.search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 1.1rem;
  color: #666666;
}

.search input::placeholder {
  color: #999999;
}

.reset-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #999999;
  font-size: 1.2rem;
  padding-left: 10px;
  display: flex;
  align-items: center;
}

.reset-btn:hover {
  color: #333333;
}

#searchDiv {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  border-radius: 10px;
  margin-top: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* ================= HERO =================== */
.hero-section {
  position: relative;
  height: calc(100vh - 100px);
  background: #0b0715;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#waveCanvas {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.hero-section::after {
  z-index: 1;
}

.hero-content {
  z-index: 2;
  flex: 1;
  color: var(--white);
}

.hero-content h1 {
  padding-left: 130px;
  font-size: 60px;
  font-weight: bold;
  position: relative;
  top: 200px;
  left: 550px;
}

.hero-content p {
  font-size: 36px;
  position: relative;
  top: 200px;
  left: 240px;
}

.explore button {
  padding: 8px 20px;
  border: none;
  background: var(--ui-gradient);
  color: white;
  border-radius: 5px;
  cursor: pointer;
  position: absolute;
  top: 350px;
  left: 730px;
}

.explore button:hover {
  background: var(--ui-gradient-negative);
}

/* ================= SVG WAVE ================= */
.wave-wrapper {
  height: 120px;
  overflow: hidden;
}

.wave {
  fill: white;
  animation: move 8s linear infinite;
}

.wave2 {
  opacity: 0.5;
  animation-duration: 12s;
}

@keyframes move {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* ================= MATH CANVAS ==================== */
.glass-section {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

#mathCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.glass-section {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.glass-card {
  position: absolute;
  width: 180px;
  height: 180px;
  padding: 0;
  border-radius: 30px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid #00BFFF;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(40px) scale(0.9);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ======== REVEAL ANIMATION ========= */
@keyframes float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }

  100% {
    transform: translateY(0);
  }
}

.glass-card.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
  animation: float 4s ease-in-out infinite;
}

.glass-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#first {
  top: 90px;
  left: 80px;
  transform: translateX(-40px);
}

#second {
  top: 40px;
  right: 60px;
  transform: translateX(40px);
}

#third {
  bottom: 40px;
  left: 40%;
  transform: translateX(-50%);
  transform: translateY(40px);
}


/* ================= COMMON ================= */

.pop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 50px;
}

.compose button {
  background-color: #000;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.compose {
  text-decoration: none;
}

/* ================= POPULAR POSTS ================= */

.popular {
  display: flex;
  gap: 30px;
  padding: 0 50px;
  flex-wrap: wrap;
}

.post-box {
  width: 280px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  position: relative;
  cursor: pointer;
  transition: 0.4s;
}

.post-box:hover {
  background-color: #d1eee8;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.post-img-wrapper {
  height: 150px;
  margin-bottom: 10px;
}

.post-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.middle {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: 0.4s;
}

.post-box:hover .middle {
  opacity: 1;
}

.middle a {
  padding: 10px 15px;
  background: var(--ui-gradient);
  color: white;
  text-decoration: none;
  border-radius: 4px;
}

.middle a:hover {
  background: var(--ui-gradient-negative);
}

/* ================= RECENT POSTS ================= */

.recent-posts-container h1 {
  margin: 40px 50px 20px;
}

.recent-posts {
  display: flex;
  gap: 4%;
  padding: 0 50px 50px;
  flex-wrap: wrap;
}

.recent-post-box {
  width: 300px;
  height: 500px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  transition: 0.4s;
}

.recent-post-box:hover {
  box-shadow: 0 0 30px rgba(0, 157, 131, 0.35);
}

.img-container {
  height: 40%;
  padding: 1px;
  overflow: hidden;
}

.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.8s;
}

.recent-post-box:hover img {
  transform: scale(1.1);
}

.days {
  text-align: right;
  margin: 10px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #555;
}

.recent-post-box h2 {
  margin: 10px;
  height: 60px;
  overflow: hidden;
}

.post-desc {
  margin: 10px;
  height: 120px;
  line-height: 24px;
  color: #6b6b6b;
  overflow: hidden;
}

.post-footer {
  display: flex;
  justify-content: center;
}

.post-footer button {
  padding: 8px 20px;
  border: none;
  background: var(--ui-gradient);
  color: white;
  border-radius: 5px;
  cursor: pointer;
}

.post-footer button:hover {
  background: var(--ui-gradient-negative);
}

@media (max-width: 768px) {

  .popular,
  .recent-posts {
    justify-content: center;
  }
}


/* ================= DOT GRID ===================== */
canvas {
  margin-bottom: 10px;
}

.dot-grid-container {
  position: relative;
  height: 700px;
  background-color: #0b0715;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gridCanvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: block;
}

.dot-grid-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 40px;
  text-align: center;
  color: #ffffff;
  pointer-events: none;
}

.dot-grid-content h2 {
  font-size: 3rem;
  margin-bottom: 20px;
  background: var(--ui-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
}

.dot-grid-content p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.dot-grid-content a,
.read-more {
  pointer-events: auto !important;
}

.read-more {
  margin-top: 20px;
  padding: 12px 30px;
  border: none;
  background: var(--ui-gradient);
  color: white;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.read-more:hover {
  background: var(--ui-gradient-negative);
  transform: translateY(-2px);
}


/* ================= FOOTER ================= */
.footer {
  background: var(--ui-gradient);
  color: var(--black);
}

.headline {
  text-decoration: underline;
  text-decoration-color: var(--white);
  font-weight: bold;
}

.social-icons:hover {
  color: var(--black);
}

.footer-link {
  display: inline-block;
  transition: all 0.3s ease;
  text-decoration: none;
  font-weight: bold;
}

.footer-link:hover {
  color: var(--black) !important;
  transform: translateX(6px);
}

/* ================= BACK TO TOP ================= */
#back-to-top-button {
  position: fixed;
  right: 50px;
  bottom: 50px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #00ff7f;
  border: none;
  font-size: 22px;
  z-index: 100;
}