/* --- LOADING SCREEN --- */
#loader {
  position: fixed;
  inset: 0;
  background: #140a1e;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5000;
  flex-direction: column;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loader h1 {
  color: #c77dff;
  font-size: 2rem;
  margin-bottom: 1em;
  text-shadow: 0 0 10px rgba(200, 100, 255, 0.3);
}

#loader .dots {
  display: flex;
  gap: 0.5em;
}

#loader .dots span {
  width: 12px;
  height: 12px;
  background: #c77dff;
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1s infinite ease-in-out;
}

#loader .dots span:nth-child(2) {
  animation-delay: 0.2s;
}

#loader .dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

#loader.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* --- IMPORT FONT --- */
@import url('https://fonts.googleapis.com/css2?family=Chivo+Mono:wght@400;700&display=swap');

/* --- BASE --- */
body {
  font-family: 'Chivo Mono', monospace;
  background:
    repeating-conic-gradient(
      #2b185b 0% 25%,
      #24104d 0% 50%
    );
  background-size: 60px 60px;
  color: #eee;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 1s ease;
  letter-spacing: 0.5px;
  position: relative;
  overflow-x: hidden;
}

/* --- FULLSCREEN VIMEO BACKGROUND --- */
.intro-video-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: -2;
}

.intro-video-bg iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.77vh;
  height: 100%;
  transform: translate(-50%, -50%);
  border: none;
  pointer-events: none;
  filter: blur(30px);
  opacity: 0.2;
}

.video-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(to top, rgba(20,10,30,0.7), rgba(20,10,30,0));
  z-index: -1;
  pointer-events: none;
}

/* --- FOREGROUND VIDEO --- */
.intro-video {
  width: 100%;
  max-width: 960px;
  margin: 1.5em auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(160, 100, 255, 0.3);
}

.intro-video iframe {
  width: 100%;
  height: 540px;
  border: none;
  pointer-events: none;
}

.intro-video:hover {
  transform: none;
  box-shadow: 0 0 25px rgba(160, 100, 255, 0.3);
}

.video-gradient {
  display: none;
}

/* --- HEADER --- */
header {
  background: rgba(255, 255, 255, 0.06);
  padding: 1em 2em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 2;
}

h1 {
  font-size: 2rem;
  color: #c77dff;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(200, 100, 255, 0.3);
}

nav a {
  color: #e0e0ff;
  text-decoration: none;
  margin: 0 0.8em;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  font-size: 1.1em;
}

nav a:hover,
nav a.active {
  color: #c77dff;
  text-shadow: 0 0 10px rgba(200, 120, 255, 0.5);
}

/* --- MAIN --- */
main {
  flex: 1;
  padding: 2em;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* --- FOOTER --- */
footer {
  padding: 1em;
  text-align: center;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 2;
}

/* --- PROJECT GRID --- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2em;
  justify-items: center;
  padding-top: 1em;
}

.project-card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-6px) scale(1.03);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 25px rgba(180, 100, 255, 0.3);
}

.project-card img {
  width: 100%;
  height: auto;
  display: block;
}

.project-card h3 {
  margin: 0.8em;
  color: #c77dff;
  font-size: 1.4em;
  text-align: center;
  text-shadow: 0 0 8px rgba(150, 80, 255, 0.3);
}

/* --- SCROLL ARROW ICON --- */
.scroll-arrow {
  display: block;
  margin: 40px auto 0 auto;
  width: 50px;
  height: auto;
  opacity: 0.3;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.scroll-arrow:hover {
  transform: translateY(-5px);
}

/* --- ANIMATION --- */
.fade-in {
  animation: fadeIn 0.6s ease forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* --- MODAL --- */
#project-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 30, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
}

#project-modal.hidden {
  opacity: 0;
  visibility: hidden;
}

.modal-content {
  background: rgba(30, 20, 50, 0.95);
  padding: 2em;
  border-radius: 14px;
  width: 80%;
  max-width: 650px;
  position: relative;
  box-shadow: 0 0 40px rgba(160, 100, 255, 0.4);
  animation: popIn 0.3s ease;
  overflow-y: auto;
  max-height: 80vh;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
  color: #d8b4ff;
  margin-bottom: 0.5em;
}

.modal-content p {
  margin-bottom: 1em;
  line-height: 1.5;
  color: #ddd;
}

.modal-content strong {
  color: #bb86fc;
}

.modal-images img,
.modal-video video {
  width: 100%;
  border-radius: 10px;
  margin-top: 1em;
  box-shadow: 0 0 15px rgba(180, 100, 255, 0.3);
}

.modal-video video {
  display: block;
  outline: none;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.8em;
  cursor: pointer;
  color: #c77dff;
  transition: transform 0.3s ease, color 0.3s ease;
}

.close-btn:hover {
  transform: rotate(90deg) scale(1.2);
  color: #e0aaff;
}

/* --- IMAGE ZOOM OVERLAY --- */
#image-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 2000;
  cursor: zoom-out;
}

#image-zoom-overlay.active {
  opacity: 1;
  visibility: visible;
}

#image-zoom-overlay img {
  max-width: 90%;
  max-height: 90%;
  transition: transform 0.1s ease-out;
  cursor: grab;
  user-select: none;
  border-radius: 8px;
}

/* --- MOBILE STYLES --- */
@media (max-width: 480px) {
  body { padding: 0 1em; }

  header { flex-direction: column; align-items: flex-start; padding: 1em; }

  nav { margin-top: 0.5em; }
  nav a { display: block; margin: 0.5em 0; font-size: 1em; }

  h1 { font-size: 1.6rem; }

  .projects { grid-template-columns: 1fr; gap: 1.5em; }
  .project-card { max-width: 100%; aspect-ratio: auto; }

  .intro-video { width: 100%; max-width: 100%; }
  .intro-video-bg { height: 40vh; }
  .intro-video-bg iframe { width: 120vh; }

  footer { font-size: 0.8em; padding: 0.8em; }

  header, .project-card, .modal-content { backdrop-filter: blur(6px); box-shadow: 0 0 15px rgba(180, 100, 255, 0.2); }
  .modal-content { width: 90%; max-width: 90%; padding: 1.5em; }

  .close-btn { font-size: 1.5em; top: 8px; right: 10px; }

  #image-zoom-overlay img { max-width: 95%; max-height: 95%; }
}
