:root {
  --bg: #02060b;
  --bg-soft: #0a111a;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eaf7ff;
  --muted: #9ac4d6;
  --cyan: #00f2ff;
  --lime: #0aff84;
  --purple: #bd00ff;
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --glass: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(0, 0, 0, 0.1);
  --line: rgba(0, 0, 0, 0.1);
  --text: #0f172a;
  --muted: #475569;
  --cyan: #0284c7;
  --lime: #16a34a;
  --purple: #9333ea;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

html {
  background: var(--bg);
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  min-height: 100%;
  scroll-behavior: smooth;
  cursor: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 5px;
  border: 2px solid var(--bg);
}

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

body {
  background: transparent;
  position: relative;
  overflow-x: hidden;
}

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  z-index: 1000;
  transition: width 0.1s;
}

#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line);
  border-bottom-color: var(--cyan);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.4;
  pointer-events: none;
  z-index: -1;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  z-index: -2;
  opacity: 0.6;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: drift 12s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--purple) 0%, transparent 70%);
  right: -10%;
  top: 20%;
  animation: drift 15s ease-in-out infinite reverse;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--lime) 0%, transparent 70%);
  bottom: 10%;
  left: 20%;
  animation: drift 20s ease-in-out infinite 2s;
}

.theme-bg {
  position: fixed;
  inset: 0;
  background-size:cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: -5;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  filter: brightness(0.9) contrast(1.1);
  pointer-events: none;
}

@keyframes drift {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(26px); }
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 7vw;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
  background: transparent;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  backdrop-filter: blur(16px) saturate(180%);
  background: rgba(5, 10, 16, 0.7);
  border-bottom: 1px solid var(--glass-border);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-family: "Orbitron", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.12rem;
  font-weight: 900;
}

.brand:hover {
  animation: glitch 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
  color: var(--cyan);
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

.brand span {
  color: var(--lime);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
}

.nav-links {
  display: flex;
  gap: 1.1rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--cyan);
}

.nav-links a.active {
  color: var(--lime);
  text-shadow: 0 0 10px rgba(10, 255, 132, 0.4);
}

#theme-toggle {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

main {
  width: min(1400px, 92vw);
  margin: 0 auto;
  padding: 3rem 0 5rem;
  position: relative;
  z-index: 1;
}

section[id] {
  scroll-margin-top: 6rem;
}

.hero {
  padding: 3.4rem 0 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.hero-text {
  flex: 1;
  max-width: 650px;
}

.hero-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

#hero-particles {
  width: 100%;
  max-width: 500px;
  height: 400px;
  display: block;
  z-index: 5;
  filter: drop-shadow(0 0 20px rgba(0, 242, 255, 0.2));
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column-reverse;
    text-align: center;
    padding-top: 2rem;
  }
  
  .hero-visual {
    width: 100%;
    margin-bottom: 2rem;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  h1, .hero-copy {
    margin-left: auto;
    margin-right: auto;
  }
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.82rem;
  letter-spacing: 0.13rem;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

h1,
h2,
h3 {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.04rem;
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  max-width: 14ch;
  line-height: 1.05;
  margin-bottom: 0.9rem;
}

.hero-copy {
  color: var(--muted);
  max-width: 62ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.4rem 0 2rem;
}

.btn {
  display: inline-block;
  padding: 0.72rem 1.15rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

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

.btn-primary {
  background: linear-gradient(90deg, var(--cyan), #69ffc4);
  color: #042030;
  box-shadow: 0 10px 30px rgba(87, 233, 255, 0.3);
}

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(12, 21, 31, 0.5);
}

.btn-outline {
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: transparent;
}

.btn-outline:hover {
  background: rgba(0, 242, 255, 0.1);
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

.quick-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
  max-width: 700px;
}

.quick-stats li {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-radius: 15px;
  padding: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.quick-stats strong {
  display: block;
  font-size: 1.4rem;
  color: var(--lime);
}

.quick-stats span {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  margin: 2rem 0;
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.panel p {
  color: var(--muted);
  max-width: 72ch;
}

.skill-category {
  font-size: 1.1rem;
  color: var(--cyan);
  margin: 1.5rem 0 0.8rem;
}

.chip-grid {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.chip-grid span {
  border: 1px solid var(--glass-border);
  padding: 0.44rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  color: #d4f2ff;
  background: rgba(255, 255, 255, 0.05);
}

.section-title {
  margin-top: 3rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.project-card {
  position: relative;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.1rem;
  background: var(--glass);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, border-color 0.22s ease;
  cursor: pointer;
  overflow: hidden;
}

/* Spotlight effect container */
.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255,255,255,0.06), transparent 40%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.project-card:hover {
  border-color: var(--cyan);
}

.project-card:hover::before {
  opacity: 1;
}

.project-preview {
  display: none;
}

.project-card p {
  color: var(--muted);
}

.tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tags span {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 242, 255, 0.1);
  color: var(--cyan);
}

.project-links {
  margin-top: 1.2rem;
  display: flex;
  gap: 1rem;
}

.project-links a {
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.project-links a:hover {
  text-decoration: underline;
}

footer {
  text-align: center;
  padding: 3rem 1rem 2rem;
  color: var(--muted);
  border-top: 1px solid var(--glass-border);
  margin-top: 4rem;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-socials {
  margin-bottom: 0;
  justify-content: center;
}

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

.reveal.show {
  opacity: 1;
  transform: none;
}

.contact-info {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.email-wrapper {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

#copy-email-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--cyan);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#copy-email-btn:hover {
  background: rgba(0, 242, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.contact-form {
  display: grid;
  gap: 1rem;
  max-width: 600px;
  margin-top: 1rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.9rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--cyan);
}

@media (max-width: 760px) {
  .menu-toggle {
    display: inline-block;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 1px);
    right: 7vw;
    display: none;
    flex-direction: column;
    background: rgba(4, 11, 18, 0.92);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem;
    min-width: 150px;
  }

  .nav-links.open {
    display: flex;
  }

  main {
    padding-top: 1.6rem;
  }

  .panel {
    padding: 1rem;
  }
}

#scrollTopBtn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--cyan);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(87, 233, 255, 0.4);
}

#scrollTopBtn.show {
  opacity: 1;
  pointer-events: all;
}

#scrollTopBtn:hover {
  transform: translateY(-3px);
}

.typing-cursor {
  display: inline-block;
  width: 10px;
  height: 1em;
  background-color: var(--cyan);
  margin-left: 5px;
  animation: blink 1s infinite;
  vertical-align: text-bottom;
}

.typing-cursor.typing {
  animation: none;
  opacity: 1;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.modal.show {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: rgba(10, 17, 26, 0.9);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.modal.show .modal-content {
  transform: translateY(0);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-modal:hover {
  color: var(--cyan);
}

/* Tag Cloud Styles */
#tag-cloud-container {
  position: relative;
  width: 100%;
  height: 400px;
  margin: 0 auto;
  overflow: hidden;
}

.tag-cloud-item {
  position: absolute;
  top: 50%;
  left: 50%;
  color: var(--cyan);
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  transition: color 0.3s ease;
  cursor: default;
  user-select: none;
  will-change: transform, opacity, filter;
}

/* Custom Cursor */
.cursor-dot,
.cursor-outline {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 10001;
  pointer-events: none;
}

.cursor-dot {
  width: 8px;
  height: 8px;
  background-color: var(--cyan);
}

.cursor-outline {
  width: 40px;
  height: 40px;
  border: 1px solid var(--cyan);
  transition: width 0.2s, height 0.2s, background-color 0.2s;
}

@media (max-width: 768px) {
  .cursor-dot, .cursor-outline { display: none; }
  html, body { cursor: auto; }
}

/* Timeline Styles */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--glass-border);
  margin: 2rem 0 1rem 0.5rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}

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

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-2rem - 9px);
  top: 0.3rem;
  width: 16px;
  height: 16px;
  background: var(--bg);
  border: 2px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.4);
  z-index: 1;
}

.timeline-date {
  display: inline-block;
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.05rem;
}

/* Social Links */
.social-links {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--muted);
  transition: all 0.3s ease;
}

.social-links a:hover {
  background: var(--cyan);
  color: var(--bg);
  transform: translateY(-3px);
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

/* Blog Section */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.blog-card {
  padding: 1.5rem;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition: transform 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-5px);
  border-color: var(--purple);
}

.blog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.blog-date {
  font-size: 0.85rem;
  color: var(--cyan);
  margin-bottom: 0;
}

.share-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.share-btn:hover {
  color: var(--lime);
}

.read-more {
  display: inline-block;
  margin-top: 1rem;
  color: var(--lime);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.timeline-content h4 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-weight: 500;
}

/* Testimonial Slider */
.testimonial-container {
  position: relative;
  height: 220px;
  overflow: hidden;
  margin-top: 1rem;
}

.testimonial-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  opacity: 0;
  transition: opacity 0.8s ease;
  text-align: center;
  padding: 0 1rem;
  pointer-events: none;
}

.testimonial-slide.active {
  opacity: 1;
  pointer-events: all;
}

.testimonial-slide blockquote {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text);
  margin: 0 0 1.2rem 0;
  line-height: 1.6;
}

.testimonial-slide cite {
  color: var(--cyan);
  font-weight: 700;
  font-style: normal;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.05rem;
}

/* Lazy Load Image Styles */
img[data-src] {
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.5s ease-in-out, filter 0.5s ease-in-out;
}

img[data-src].loaded {
  opacity: 1;
  filter: blur(0);
}

/* Certifications Section */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.cert-card {
  padding: 1.5rem;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition: transform 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}

.cert-card:hover {
  transform: translateY(-5px);
  border-color: var(--lime);
}

.cert-provider {
  color: var(--cyan);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

#p5-canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  height: 400px;
  background: var(--glass);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

#p5-canvas-container canvas {
  cursor: pointer;
}

#game-canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  height: 400px;
  background: var(--glass);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

#game-canvas-container canvas {
  cursor: pointer;
}

#music-toggle {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 999;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#music-toggle:hover {
  background: var(--cyan);
  color: var(--bg);
  transform: scale(1.1);
}

#music-toggle.playing {
  border-color: var(--lime);
  color: var(--lime);
  box-shadow: 0 0 15px rgba(10, 255, 132, 0.3);
}

/* Idle Animation */
@keyframes idle-sway {
  0% { transform: perspective(2000px) rotate3d(0, 1, 0, 0deg); }
  25% { transform: perspective(2000px) rotate3d(1, 1, 0, 3deg); }
  50% { transform: perspective(2000px) rotate3d(0, 1, 0, 0deg); }
  75% { transform: perspective(2000px) rotate3d(-1, 1, 0, 3deg); }
  100% { transform: perspective(2000px) rotate3d(0, 1, 0, 0deg); }
}

body.idle main {
  animation: idle-sway 10s ease-in-out infinite;
  transform-origin: center 300px;
}

body.idle .site-header,
body.idle #music-toggle,
body.idle #scrollTopBtn {
  opacity: 0.3;
  filter: blur(2px);
  transition: all 0.5s ease;
}

/* Easter Egg Styles */
.debug-mode * {
  outline: 1px solid rgba(255, 0, 0, 0.5) !important;
  background: rgba(255, 0, 0, 0.05) !important;
}

.matrix-mode {
  --bg: #000000;
  --text: #00ff00;
  --muted: #008f00;
  --cyan: #00ff00;
  --lime: #00ff00;
  --purple: #00ff00;
  --glass: rgba(0, 20, 0, 0.9);
  --glass-border: #003300;
  font-family: "Courier New", monospace;
}

.matrix-mode img {
  filter: grayscale(100%) brightness(0.8) sepia(100%) hue-rotate(50deg) saturate(500%);
}

@keyframes rainbow-cycle {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.rainbow-mode {
  animation: rainbow-cycle 2s linear infinite;
}

.mirror-mode {
  transform: scaleX(-1);
}

/* Flashlight / Lumos Mode */
.flashlight-mode::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle 400px at var(--cursor-x, 50%) var(--cursor-y, 50%), transparent 20%, rgba(0, 0, 0, 1) 70%);
  pointer-events: none;
}

/* Cinematic Noise Overlay */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
}

/* Ensure tilt works on other cards */
.cert-card, .panel {
  position: relative;
  overflow: hidden;
}

.cert-card::before, .panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255,255,255,0.06), transparent 40%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.cert-card:hover::before, .panel:hover::before {
  opacity: 1;
}

/* Command Palette Styles */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cmd-palette-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.cmd-palette-modal {
  width: 100%;
  max-width: 600px;
  background: var(--bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.cmd-palette-overlay.show .cmd-palette-modal {
  transform: scale(1);
}

.cmd-header {
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

#cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
}

.cmd-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem;
}

.cmd-item {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.1s;
}

.cmd-item:hover, .cmd-item.active {
  background: var(--cyan);
  color: var(--bg);
}

.cmd-hint {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  border: 1px solid var(--glass-border);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

/* Scanlines */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1) 1px, transparent 1px, transparent 2px);
  pointer-events: none; z-index: 9998; opacity: 0.2;
}

/* Theme Switcher Panel */
.theme-switcher {
  position: fixed;
  top: 0;
  right: -400px; /* Start off-screen */
  width: 100%;
  max-width: 350px;
  height: 100%;
  background: var(--glass);
  backdrop-filter: blur(5px);
  border-left: 1px solid var(--glass-border);
  z-index: 1001;
  transition: right 0.4s ease-in-out;
  display: flex;
  flex-direction: column;
}

.theme-switcher.open {
  right: 0;
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}

.theme-switcher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.theme-switcher-header h3 {
  margin: 0;
}

#close-theme-switcher {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

.theme-list {
  padding: 1rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.theme-button {
  padding: 1rem;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.9rem;
}

.theme-button:hover {
  transform: translateY(-3px);
  border-color: var(--cyan);
  background: rgba(0, 242, 255, 0.1);
}

.theme-button.active {
  border-color: var(--lime);
  color: var(--lime);
  box-shadow: 0 0 10px rgba(10, 255, 132, 0.3);
}

/* --- THEME DEFINITIONS --- */

/* Game of Thrones Theme */
[data-theme="got"] {
  --bg: #1a1a1a; --bg-soft: #2d2d2d; --glass: rgba(0, 0, 0, 0.2); --glass-border: #4a4a4a; --line: #4a4a4a; --text: #e0e0e0; --muted: #a0a0a0; --cyan: #d4af37; --lime: #c0c0c0; --purple: #8b4513;
  font-family: 'Cinzel', serif;
}
[data-theme="got"] h1, [data-theme="got"] h2, [data-theme="got"] h3, [data-theme="got"] .brand { font-family: 'Cinzel Decorative', cursive; font-weight: 700; }

/* Breaking Bad Theme */
[data-theme="breakingbad"] {
  --bg: #f0f0e0; --bg-soft: #ffffff; --glass: rgba(255, 255, 255, 0.7); --glass-border: #d3d3c3; --line: #d3d3c3; --text: #333; --muted: #555; --cyan: #006747; --lime: #ffc107; --purple: #795548;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
[data-theme="breakingbad"] body { filter: sepia(0.2) saturate(0.9); }

/* Marvel Theme */
[data-theme="marvel"] {
  --bg: #10141f; --bg-soft: #1c212e; --glass: rgba(237, 28, 36, 0.05); --glass-border: rgba(237, 28, 36, 0.2); --line: rgba(237, 28, 36, 0.2); --text: #ffffff; --muted: #b0b0b0; --cyan: #00a4e4; --lime: #fef200; --purple: #ed1c24;
  font-family: 'Bangers', cursive;
}
[data-theme="marvel"] h1, [data-theme="marvel"] h2, [data-theme="marvel"] h3 { letter-spacing: 2px; text-transform: uppercase; }

/* Harry Potter Theme */
[data-theme="harrypotter"] {
  --bg: #0c0c1e; --bg-soft: #1a1a3a; --text: #e0e0e0; --cyan: #946b2d; --lime: #740001; --purple: #aaaaaa;
  font-family: 'Garamond', serif;
}

/* Star Wars Theme */
[data-theme="starwars"] {
  --bg: #000000; --bg-soft: #111111; --text: #f0f0f0; --cyan: #49daff; --lime: #ffe81f; --purple: #ff0000;
  font-family: 'Orbitron', sans-serif;
}

/* Pirates Theme */
[data-theme="pirates"] {
  --bg: #3b2f2f; --bg-soft: #544545; --text: #eaddc0; --cyan: #d4af37; --lime: #ffffff; --purple: #8b0000;
  font-family: 'Pirata One', cursive;
}

/* Stranger Things Theme */
[data-theme="strangerthings"] {
  --bg: #000000; --bg-soft: #111111; --text: #e0e0e0; --muted: #999999; --cyan: #ff073a; --lime: #ff073a; --purple: #ff073a;
  font-family: 'Space Grotesk', sans-serif;
}
[data-theme="strangerthings"] h1, [data-theme="strangerthings"] h2, [data-theme="strangerthings"] h3, [data-theme="strangerthings"] .brand {
  font-family: 'Cinzel Decorative', cursive;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 7, 58, 0.7);
}

body.is-scrolling .panel,
body.is-scrolling .site-header.scrolled {
    backdrop-filter: blur(4px) saturate(120%);
    transition: backdrop-filter 0.5s ease;
}
