@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'Space Mono', monospace;
  background-color: #000;
  color: #fff;
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-y: auto;
}

.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: url('images/w3wbg.png') center center no-repeat;
  background-size: cover;
  z-index: 0; /* was -1 — set to 0 so the background is visible */
}

#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.portal-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  text-align: center;
  z-index: 1;
  position: relative;
}

.magic-portal {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 3rem;
  border-radius: 20px;
  box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
  max-width: 500px;
  width: 90%;
  animation: fadeIn 1s ease-out forwards;
  opacity: 0;
}

.magic-portal.visible {
  opacity: 1;
}

.magic-portal h1 {
  font-size: 2.5rem;
  background: linear-gradient(90deg, #00f2ff, #ff00ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

.magic-portal p {
  font-size: 1rem;
  color: #ccc;
  margin-bottom: 2rem;
}

.enter-button {
  background: #00f2ff;
  color: #000;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.enter-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px #00f2ff;
}

.sigil {
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
  border: 2px dashed #00f2ff;
  border-radius: 50%;
  animation: rotate 10s linear infinite;
}

.architects, .chain-modules, .contact-terminal {
  padding: 8vh 5vw;
  background: rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 2;
  text-align: center;
}

.section-title {
  font-size: 2rem;
  color: #00f2ff;
  margin-bottom: 2rem;
  text-shadow: 0 0 10px #00f2ff;
}

.wizard-grid {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.wizard-card {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 2rem;
  width: 300px;
  box-shadow: 0 0 25px rgba(0, 242, 255, 0.1);
  backdrop-filter: blur(8px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: float 5s ease-in-out infinite;
}

.wizard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 20px #00f2ff;
}

.wizard-card h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.wizard-card p {
  color: #ccc;
  font-size: 1rem;
  line-height: 1.6;
}

.wizard-img {
  width: 120px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.frontend {
  border-color: #00f2ff;
  box-shadow: 0 0 15px #00f2ff22;
}

.backend {
  border-color: #ff00ff;
  box-shadow: 0 0 15px #ff00ff22;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.module-card {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #222;
  padding: 1.5rem;
  border-radius: 10px;
  font-size: 1.1rem;
  color: #00f2ff;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: float 5s ease-in-out infinite;
}

.module-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px #00f2ff;
}

.terminal-box {
  background: #000;
  border: 2px solid #00f2ff;
  border-radius: 10px;
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
  font-family: 'Space Mono', monospace;
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
  overflow-x: auto;
  white-space: nowrap;
}

.terminal-line {
  color: #00f2ff;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  white-space: nowrap;
  overflow-x: auto;
  word-break: break-word;
}

.terminal-line a {
  color: #ff00ff;
  text-decoration: none;
}

.terminal-line .live {
  color: #00ff00;
  font-weight: bold;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes sparkle {
  0% { transform: translate(-10%, -10%); }
  100% { transform: translate(10%, 10%); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: transform, opacity;
}

.fade-in.appear {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .magic-portal h1 { font-size: 2rem; }
  .magic-portal { padding: 2rem; }
  .enter-button { font-size: 0.9rem; padding: 0.6rem 1.5rem; }
  .wizard-grid { flex-direction: column; align-items: center; }
  .module-grid { grid-template-columns: 1fr; }
  .terminal-box { padding: 1.5rem; font-size: 0.9rem; }
  .terminal-line { font-size: 0.85rem; }
  .wizard-img { width: 160px; }
}

/* Footer */
.site-footer {
  background: rgba(0, 0, 0, 0.8);
  padding: 2rem 1rem;
  color: #0ff;
  font-family: 'Courier New', monospace;
  text-align: center;
  border-top: 2px solid #0ff;
  margin-top: 4rem;
  position: relative;
  overflow: hidden;
}

.site-footer .footer-links {
  margin-top: 1rem;
}

.site-footer .footer-links a {
  color: #0ff;
  margin: 0 0.75rem;
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-footer .footer-links a:hover {
  color: #fff;
}

.site-footer::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #0ff2, transparent 70%);
  top: 0;
  left: 0;
  animation: sparkle 5s linear infinite;
  opacity: 0.3;
  pointer-events: none;
}

/* 🔥 Meme Creator Styles */
.meme-section {
  padding: 8vh 5vw;
  background: rgba(0, 0, 0, 0.85);
  text-align: center;
  z-index: 2;
  position: relative;
}

.meme-section h2 {
  font-size: 2rem;
  color: #00f2ff;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 10px #00f2ff;
}

.meme-card {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #00f2ff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 700px;
  margin: 0 auto;
  box-shadow: 0 0 25px rgba(0, 242, 255, 0.2);
}

.upload-label {
  display: inline-block;
  padding: 0.6rem 1rem;
  background: #00f2ff;
  color: #000;
  border-radius: 50px;
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 1rem;
  box-shadow: 0 0 10px #00f2ff88;
}

#memeImageInput {
  display: none;
}

.meme-input {
  width: 90%;
  max-width: 300px;
  padding: 0.6rem 1rem;
  font-family: Impact, 'Arial Black', sans-serif;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #333;
  background: #111;
  color: #fff;
  text-transform: uppercase;
  margin: 0.5rem;
}

.meme-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.meme-buttons button {
  background: #00f2ff;
  color: #000;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 0 12px #00f2ff88;
  transition: transform 0.2s ease;
}

.meme-buttons button:hover {
  transform: scale(1.05);
}

#memeCanvas {
  display: block;
  max-width: 100%;
  margin: 2rem auto 0;
  border-radius: 12px;
  border: 2px solid #00f2ff;
  box-shadow: 0 0 20px #00f2ff88;
}

.meme-warning {
  color: #ccc;
  margin-top: 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.meme-resolution {
  margin-top: 1rem;
}

.meme-resolution select {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid #00f2ff;
  background: #111;
  color: #00f2ff;
  font-family: 'Space Mono', monospace;
}

/* ---------- Added: Mobile background optimization ---------- */
@media (max-width: 768px) {
  .background-container {
    background-image: url('images/w3wmbg.png') !important;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
}

/* ---------- Added: Demos page Services Grid ---------- */
.services-wrap {
  position: relative;
  z-index: 2;
  padding: 8vh 0 4rem;
}

.services-intro {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.service-card {
  grid-column: span 12;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(0, 242, 255, 0.18);
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.12);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 28px rgba(0, 242, 255, 0.22);
  border-color: rgba(0, 242, 255, 0.28);
}

.service-media {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.service-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.service-body {
  padding: 1rem 1.25rem 1.25rem;
}
.service-title {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
  letter-spacing: .3px;
}
.service-desc {
  margin: 0 0 .9rem;
  opacity: .85;
  line-height: 1.55;
  font-size: .98rem;
}
.service-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.service-actions a,
.service-actions button {
  text-decoration: none;
  cursor: pointer;
}

@media (min-width: 640px) {
  .service-card { grid-column: span 6; }
}
@media (min-width: 1024px) {
  .service-card { grid-column: span 4; }
}

/* Smooth anchor target for meme section on demos page */
#meme-creator {
  scroll-margin-top: 80px;
  padding-top: 2rem;
}

/* === Meme Creator: 500x500 Preview (while keeping 2K download) === */
.meme-card {
  max-width: 960px;
}

#memeCanvas {
  width: min(500px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 2rem auto 0;
}

.meme-input {
  max-width: 360px;
}

@media (max-width: 600px) {
  #memeCanvas {
    width: 92vw;
    max-width: 500px;
  }
  .meme-card {
    padding: 1.5rem;
  }
}

.meme-card {
  border-color: #00f2ff;
  box-shadow: 0 0 25px rgba(0, 242, 255, 0.25);
}
