:root {
  --bg-1: #0e0e0e;
  --bg-2: #1a1a1a;
  --text: #f5f5f5;
  --accent: #14b8a6;
  --celestial: #ffffff;
  --card-bg: rgba(26, 26, 26, 0.6);
  --cloud-op: 0.05;
  --star-op: 0.9;
  --lightbox-bg: rgba(0, 0, 0, 0.9);
  --glass-border: rgba(255, 255, 255, 0.1);
}

body.light-mode {
  --bg-1: #f8fafc;
  --bg-2: #e2e8f0;
  --text: #1e293b;
  --accent: #f59e0b;
  --celestial: #f59e0b;
  --card-bg: rgba(255, 255, 255, 0.7);
  --cloud-op: 0.1;
  --star-op: 0;
  --lightbox-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.05);
  background: var(--bg-1); /* Changed to use variable for cleaner light mode */
  color: var(--text);
}

body.light-mode #motion-btn {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.burger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(5px);
  color: var(--text);
  cursor: pointer;
  transition: 0.4s;
}

/* ⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣴⣶⣿⣿⣿⣿⣿⣿⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠀⠀⠀⠀⠀
⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀
⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀
⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠁⠀⠀⠀⠉⠻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀
⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⢠⣶⣶⣦⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⡆
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⢻⣿⠀⠀⠸⣿⣿⡿⠁⠀⢀⣿⠈⠉⠙⠛⠿⢿⣿⣷
⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠈⢿⣦⡀⠀⠈⠉⠀⠀⢀⣾⠏⠀⠀⠀⠀⠀⠀⢸⣿
⢿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠙⠿⣶⣤⣤⣴⡾⠟⠃⠀⠀⠀⠀⠀⠀⠀⢸⣿
⠸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⠇
⠀⢻⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡟⠀
⠀⠀⠻⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠟⠀⠀
⠀⠀⠀⠙⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡿⠋⠀⠀⠀
⠀⠀⠀⠀⠀⠙⠻⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⠟⠋⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⠷⣶⣶⣶⣶⣶⣶⠾⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀
*/

.burger-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-5px);
}

.side-nav {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--bg-1);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-border);
  padding: 120px 40px;
  flex-direction: column;
  transition: right 0.4s ease;
  z-index: 1400;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.side-nav a {
  font-size: 1.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: 0.3s;
}

.side-nav a svg {
  color: var(--accent);
  transition: 0.3s;
}

.side-nav a:hover {
  color: var(--accent);
  transform: translateX(10px);
}

.side-nav a:hover svg {
  transform: scale(1.1);
}

.side-nav.active {
  right: 0;
}

@keyframes floatParticle {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.3; }
  33% { transform: translate(var(--sway-1), -30vh) rotate(120deg); }
  66% { transform: translate(var(--sway-2), -65vh) rotate(240deg); }
  90% { opacity: 0.3; }
  100% { transform: translate(var(--sway-3), -105vh) rotate(360deg); opacity: 0; }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.5s ease;
  min-height: 100vh;
}

.star-bg,
.cloud-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star-container {
  position: absolute;
  pointer-events: none;
  z-index: -1;
  transition: transform 0.4s cubic-bezier(0.1, 0, 0.1, 1);
  will-change: transform; /* Prepares the GPU for motion */
  backface-visibility: hidden; /* Fixes flickering in Safari/iOS */
  perspective: 1000px; /* Gives the browser a hint about 3D space */
}

.star {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 50%;
  opacity: var(--star-op);
  box-shadow: 0 0 3px 0.5px rgba(255, 255, 255, 0.3);
  animation: starTwinkle var(--duration, 1s) infinite ease-in-out;
  will-change: transform;
  filter: blur(var(--blur, 0px));
}

@keyframes starTwinkle {
  0%, 100% { opacity: var(--star-op); transform: scale(0.8); filter: brightness(1); }
  50% { opacity: 1; transform: scale(1.2); filter: brightness(1.5) blur(0.5px); }
}

body.light-mode .star-container {
  display: none;
}

/* --- CLOUDS (Updated for JS Pull) --- */
.cloud {
  position: absolute;
  background: rgba(255, 255, 255, var(--cloud-op));
  border-radius: 50% 50% 40% 40% / 60% 60% 30% 30%;
  filter: blur(50px);
  box-shadow: 40px 20px 60px rgba(255, 255, 255, 0.1), -40px 10px 60px rgba(255, 255, 255, 0.1);
  transform: translate(var(--js-x, 0), var(--js-y, 0));
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  pointer-events: auto; 
}

.cloud1 { width: 500px; height: 250px; }
.cloud2 { width: 350px; height: 180px; }
.cloud3 { width: 600px; height: 300px; opacity: calc(var(--cloud-op) * 0.5); }

/* --- CELESTIAL TOGGLE (Updated with Micro-Animations) --- */
.celestial-container {
  position: fixed;
  top: 40px;
  left: 40px;
  width: 80px;
  height: 80px;
  z-index: 1001;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.celestial-body {
  display: block;
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  box-shadow: -10px 10px 0 0 var(--celestial);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.6s ease, background 1s ease;
  opacity: 0.8;
  pointer-events: none;
}

/* Moon Rocking Animation (Dark Mode Hover) */
body:not(.light-mode) .celestial-container:hover .celestial-body {
  animation: moonRock 2s ease-in-out infinite;
}

@keyframes moonRock {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(10deg); }
}

/* Sun Pulsing Animation (Light Mode Hover) */
body.light-mode .celestial-body {
  background: var(--celestial);
  box-shadow: 0 0 30px var(--celestial);
  transform: scale(1);
  border-radius: 50%;
}

body.light-mode .celestial-container:hover .celestial-body {
  animation: sunPulse 1.5s ease-in-out infinite;
}

@keyframes sunPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 30px var(--celestial); }
  50% { transform: scale(1.15); box-shadow: 0 0 50px var(--celestial); }
}

.moon-star {
  display: block;
  position: absolute;
  top: 40%;
  left: 65%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--celestial);
  box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.4);
  opacity: 0.6;
  animation: starFlicker 4s infinite ease-in-out;
}

body.light-mode .moon-star {
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent);
  opacity: 0.8;
}

@keyframes starFlicker {
  0%, 100% { opacity: 0.4; transform: scale(1); box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.2); }
  50% { opacity: 1; transform: scale(1.4); box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.6); }
}

/* --- LAYOUT & COMPONENTS --- */
.container {
  max-width: 1100px;
  margin: auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

header.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
}

h1 { font-size: 3.5rem; letter-spacing: -1px; min-height: 4.5rem; }
h2 { font-size: 2.2rem; margin-bottom: 2rem; color: var(--accent); display: inline-block; }
section { padding: 4rem 0; }

.nav-buttons { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.nav-buttons a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: 0.4s;
}

.nav-buttons a:hover { background: var(--accent); color: #fff; transform: translateY(-5px); }

.portfolio-grid { display: flex; flex-direction: column; gap: 4rem; }
.portfolio-item {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  transition: 0.5s ease;
}

.portfolio-item:nth-child(even) { flex-direction: row-reverse; }
.portfolio-item img {
  width: 50%;
  height: auto;
  max-height: 500px;
  border-radius: 15px;
  object-fit: contain;
  align-self: flex-start;
  cursor: zoom-in;
  transition: 0.5s ease;
  filter: grayscale(30%) brightness(0.9);
}

.portfolio-text { width: 50%; display: flex; flex-direction: column; justify-content: flex-start; gap: 1.2rem; }
.portfolio-item:hover { transform: translateY(-10px); border-color: #fff; }
.portfolio-item:hover img { transform: scale(1.02) rotate(1deg); filter: grayscale(0%) brightness(1); }

.typewriter-container { display: inline-block; min-height: 4.5rem; position: relative; }
.visual-typewriter::after {
  content: "|";
  animation: blink 0.7s infinite;
  color: var(--accent);
  margin-left: 2px;
  display: inline-block;
  vertical-align: baseline;
}

@keyframes blink { 50% { opacity: 0; } }

.fade-in { opacity: 0; transform: translateY(40px); transition: 1s cubic-bezier(0.22, 1, 0.36, 1); }
.fade-in.visible { opacity: 1; transform: translateY(0); }

#lightbox {
  position: fixed;
  inset: 0;
  background: var(--lightbox-bg);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  cursor: zoom-out;
  backdrop-filter: blur(15px);
}

#lightbox img { max-width: 90%; max-height: 80%; border-radius: 12px; transition: 0.3s; transform: scale(0.9); }
#lightbox.active img { transform: scale(1); }

.logo-link {
  position: fixed;
  top: 40px;
  right: 40px;
  z-index: 1001;
  display: block;
  transition: top 0.4s ease, right 0.4s ease, width 0.4s ease;
  width: 140px;
  animation: logoZoomIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.logo-link.shrink { top: 20px; right: 20px; width: 70px; }
.site-logo { width: 100%; height: auto; display: block; transition: transform 0.3s ease; }
.logo-link:hover .site-logo { animation: logoShake 0.5s ease-in-out infinite; cursor: pointer; }

@keyframes logoZoomIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes logoShake { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-3deg) scale(1.05); } 75% { transform: rotate(3deg) scale(1.05); } }

@media (max-width: 768px) {
  h1 { font-size: 2.5rem; }
  .portfolio-item, .portfolio-item:nth-child(even) {
    flex-direction: column; 
    padding: 1.5rem; 
    gap: 1.5rem; 
  }
  .portfolio-item img, .portfolio-text { width: 100%; }
  .celestial-container { top: 20px; left: 20px; transform: scale(0.7); }
}

/* --- EXTRAS --- */
.poem-viewport {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  height: 120px;
  overflow: hidden;
  z-index: 9999;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.poem-content { text-align: center; color: #ffffff; text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); animation: poemScrollUp 25s linear forwards; }
@keyframes poemScrollUp { 0% { transform: translateY(120px); opacity: 0; } 5% { opacity: 1; } 95% { opacity: 1; } 100% { transform: translateY(-100%); opacity: 0; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.faq-container { background: var(--card-bg); padding: 1.5rem 2.5rem; border-radius: 20px; border: 1px solid var(--glass-border); backdrop-filter: blur(12px); }
details { padding: 1rem 0; border-bottom: 1px solid var(--glass-border); }
summary { font-weight: 600; cursor: pointer; list-style: none; position: relative; padding-right: 2rem; font-size: 1.2rem; }
summary::after { content: "+"; position: absolute; right: 0; color: var(--accent); transition: transform 0.3s ease; }
details[open] summary::after { transform: rotate(45deg); }
.faq-content { padding-top: 1rem; opacity: 0.9; }

.shooting-star {
    position: fixed;
    width: 150px;
    height: 2px;
    z-index: 1000;
    pointer-events: none;
    border-radius: 2px;
    background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0));
    filter: drop-shadow(0 0 4px #fff);
}




#scroll-progress { position: fixed; top: 0; left: 0; width: 0%; height: 4px; background: var(--accent); z-index: 3000; }

.scroll-down-indicator {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text);
  z-index: 1000; pointer-events: none; opacity: 0; visibility: hidden; transition: 1s;
}
.scroll-down-indicator.visible { opacity: 1; visibility: visible; animation: pulseFlash 2s infinite; }
@keyframes pulseFlash { 0%, 100% { transform: translate(-50%, 0); opacity: 0.3; } 50% { transform: translate(-50%, 10px); opacity: 1; } }

footer { text-align: center; padding: 3rem 1.5rem; margin-top: 6rem; opacity: 0.6; border-top: 1px solid var(--glass-border); }
footer nav ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; margin: 1rem 0; }
footer nav ul li a, 
footer nav ul li a:visited {
  /* This variable switches between white (dark mode) and dark blue (light mode) */
  color: var(--text); 
  text-decoration: none;
  transition: 0.3s;
}

footer nav ul li a:hover {
  color: var(--accent); /* Uses teal in dark mode or orange in light mode */
}

p a { color: var(--text) !important; text-decoration: underline !important; }
p a:hover { color: var(--accent) !important; text-decoration: none !important; }
body.light-mode p a { color: var(--text) !important; }

.logo-link[data-tooltip]::before, .celestial-container[data-tooltip]::before {
  content: attr(data-tooltip); position: fixed; top: 140px; background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px); color: var(--text); padding: 6px 12px; border-radius: 8px; font-size: 0.8rem;
  opacity: 0; transition: 0.3s; z-index: 10000; border: 1px solid var(--glass-border);
}
.celestial-container[data-tooltip]::before { left: 50px; }
.logo-link[data-tooltip]::before { right: 40px; }
.logo-link:hover::before, .celestial-container:hover::before { opacity: 1; }

/* Game Component Styles */
.game-container { margin-top: 1.5rem; width: 100%; max-width: 400px; }
#game-stats { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.canvas-wrapper { position: relative; border: 1px solid var(--glass-border); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
#retroGame { display: block; width: 100%; height: auto; }
#start-btn { padding: 10px 20px; background: var(--accent); border: none; border-radius: 8px; color: white; cursor: pointer; transition: 0.2s; }
#start-btn:hover { transform: scale(1.05); }

#d-pad { display: none; flex-direction: column; align-items: center; margin-top: 25px; gap: 8px; }
.middle-row { display: flex; gap: 65px; }
.d-btn { width: 65px; height: 65px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); color: var(--text); border-radius: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.d-btn:active { background: var(--accent); transform: scale(0.92); }

@media (max-width: 768px) { #d-pad { display: flex; } }

#game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    /* ADD THESE TWO LINES */
    justify-content: center; 
    align-items: center;     
    /* ------------------- */
    z-index: 10;
    transition: opacity 0.3s ease;
}

#start-btn {
    /* Ensure the button doesn't have weird margins causing it to drift */
    margin: 0;
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    /* Optional: Ensure it stays on one line */
    white-space: nowrap;
}

/* Hide articles that shouldn't be seen yet */
.portfolio-item.hidden-article {
  display: none !important;
}

/* Specific styling for the Load More button to match your theme */
.load-more-btn-style {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: 0.4s;
}

.load-more-btn-style:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-5px);
}

/* This targets the specific link in your "About Me" text */
.portfolio-text a, 
.portfolio-text a:visited {
  color: var(--text) !important; /* Uses dark blue in Light Mode, white in Dark Mode */
  text-decoration: underline;
  font-weight: 600;
}

/* Lightbox Close Button Styles */
#close-lightbox {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: white; /* Keep white for contrast on the dark overlay */
  font-size: 50px;
  font-weight: 300;
  cursor: pointer;
  z-index: 2100;
  transition: transform 0.3s ease, color 0.3s ease;
  line-height: 1;
}

#close-lightbox:hover {
  color: var(--accent);
  transform: scale(1.1);
}

/* Ensure the button is accessible and visible in Light Mode too */
body.light-mode #close-lightbox {
  color: #1e293b; 
}


/* 1. Base style: Hidden on Desktop by default */
#motion-btn {
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  transition: 0.4s;
  display: none !important; /* Start hidden */
  -webkit-tap-highlight-color: transparent;
}

/* 2. Mobile override: Force it to show on iPhones/Androids */
@media (max-width: 768px) {
  #motion-btn {
    display: inline-flex !important; /* Force visibility on mobile */
    align-items: center;
    gap: 8px;
    cursor: pointer;
  }
}

#motion-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-5px);
}


.motion-active .star-container {
  transition: none !important;
}

@keyframes shoot {
  0% {
    /* Start bottom-left, scaled to 0 */
    transform: translate(0, 0) rotate(-45deg) scale(0);
    opacity: 1;
  }
  15% {
    /* Appear and scale up */
    transform: translate(5vw, -5vh) rotate(-45deg) scale(1);
  }
  100% {
    /* Move to top-right (positive X, negative Y) */
    transform: translate(100vw, -100vh) rotate(-45deg) scale(1);
    opacity: 0;
  }
}