/* ========================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ======================================== */
:root {
  /* Background Colors */
  --color-bg-primary: #1f2937;
  --color-bg-secondary: #1a202c;
  --color-bg-tertiary: #374151;
  --color-bg-light: #4b5563;
  --color-bg-lighter: #6b7280;
  
  /* Text Colors */
  --color-text-primary: #ffffff;
  --color-text-secondary: #9ca3af;
  --color-text-tertiary: #6b7280;
  --color-text-lighter: #e5e7eb;
  
  /* Accent Colors */
  --color-accent-blue: #3b82f6;
  --color-accent-blue-dark: #2563eb;
  --color-accent-purple: #8b5cf6;
  --color-accent-success: #10b981;
  --color-accent-error: #ef4444;
  
  /* Shared Properties */
  --transition-standard: all 0.3s ease;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* ========================================
   BASE STYLES
   ======================================== */
html {
  scroll-behavior: smooth;
}

/* Alpine.js utility to prevent flash of unstyled content */
[x-cloak] {
  display: none !important;
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */
.container-padded {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--color-bg-light);
  border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-bg-lighter);
}

/* ========================================
   NAVIGATION COMPONENTS
   ======================================== */
.nav-link {
  transition: var(--transition-standard);
}

.nav-link:hover {
  background-color: var(--color-bg-tertiary);
}

/* ========================================
   BUTTON COMPONENTS
   ======================================== */
.btn-primary {
  background-image: linear-gradient(to right, var(--color-accent-blue), var(--color-accent-purple));
  color: var(--color-text-primary);
  transition: var(--transition-standard);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background-image: linear-gradient(to right, #4f8df9, #9d6ffc);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.filter-button {
  transition: colors 0.2s;
}

.filter-dropdown {
  max-height: 400px;
  overflow-y: auto;
}

/* GitHub Button Styles */
.github-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-standard);
}

.github-button-active {
  background-color: var(--color-accent-blue);
  color: white;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.github-button-active:hover {
  background-color: var(--color-accent-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.github-button-disabled {
  background-color: var(--color-bg-light);
  color: var(--color-text-secondary);
  cursor: not-allowed;
  box-shadow: none;
}

/* ========================================
   PROJECT COMPONENTS
   ======================================== */
.project-card {
  background-color: var(--color-bg-tertiary);
  transform: translateY(0);
  transition: var(--transition-standard);
  box-shadow: var(--shadow-sm);
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.skill-tag {
  background-color: var(--color-bg-secondary);
}

/* ========================================
   ABOUT SECTION - VIDEO BACKGROUND
   ======================================== */
#about {
  position: relative;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.video-container {
  height: 85vh;
  position: relative;
  overflow: hidden;
  padding: 0;
  margin: 0;
  background-color: var(--color-bg-secondary);
  min-height: 500px;
}

#about video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: opacity 0.5s ease;
}

#about .absolute {
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Profile Picture Sizing */
#profile-pic {
  margin-bottom: 8px;
}

#profile-pic img {
  width: 180px;
  height: 180px;
}

/* ========================================
   MODAL COMPONENTS
   ======================================== */
/* Modal Close Button */
.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.5rem;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 30;
}

/* Project Modal Container */
#projectDetails > div {
  width: auto;
  height: auto;
  margin: auto;
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - 100px);
}

/* Iframe Container */
.iframe-container {
  position: relative;
  width: 100%;
  background-color: var(--color-bg-secondary);
  overflow: hidden;
  transition: height 0.3s ease;
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
}

/* Loading Overlay */
.iframe-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.5s ease;
}

/* External Demo Styles */
.external-demo-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-bg-secondary);
}

.external-demo-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.external-demo-button {
  position: absolute;
  bottom: 33%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background-color: var(--color-accent-blue);
  color: white;
  transition: var(--transition-standard);
  z-index: 2;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.external-demo-button:hover {
  background-color: var(--color-accent-blue-dark);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.external-demo-button:active {
  transform: translateX(-50%) translateY(0);
}

/* Resume Modal Styles */
#resumeModal .bg-white {
  width: 90%;
  max-width: 900px;
  height: 85vh;
  margin: 0;
}

#resumeModal iframe {
  background-color: #ffffff;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#resumeModal .bg-white > div:first-child {
  margin: 0;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: var(--shadow-sm);
}

#resumeModal .flex-grow {
  padding: 0;
}

/* Resume Modal Scrollbar */
#resumeModal iframe::-webkit-scrollbar {
  width: 8px;
}

#resumeModal iframe::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}

#resumeModal iframe::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
  border-radius: 0.25rem;
}

#resumeModal iframe::-webkit-scrollbar-thumb:hover {
  background-color: #a1a1a1;
}

#resumeModal .loading-spinner {
  border-top-color: var(--color-accent-blue);
}

/* ========================================
   FORM COMPONENTS
   ======================================== */
.form-control {
  position: relative;
  margin-bottom: 1rem;
}

.form-input {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border: 2px solid var(--color-bg-light);
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--color-accent-blue);
  outline: none;
}

/* Form State Messages */
.form-success {
  background-color: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--color-accent-success);
  color: var(--color-accent-success);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.form-error {
  background-color: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--color-accent-error);
  color: var(--color-accent-error);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

/* ========================================
   UTILITY COMPONENTS
   ======================================== */
/* Loading Spinner */
.loading-spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 3px solid var(--color-accent-blue);
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* Social Icons */
.social-icon {
  color: var(--color-text-tertiary);
  transition: color 0.3s;
}

.social-icon:hover {
  color: var(--color-text-primary);
}

/* Gallery Components */
.gallery-image {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.gallery-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ========================================
   PROSE/MARKDOWN STYLING
   ======================================== */
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-weight: bold;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.prose h1 { font-size: 2em; }
.prose h2 { font-size: 1.5em; }
.prose h3 { font-size: 1.25em; }
.prose h4 { font-size: 1.1em; }

.prose p {
  margin-bottom: 1em;
  line-height: 1.6;
}

.prose img {
  margin: 1.5em 0;
  max-width: 100%;
  height: auto;
}

.prose code {
  background-color: rgba(55, 65, 81, 0.5);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-family: monospace;
}

.prose pre {
  background-color: rgba(55, 65, 81, 0.5);
  padding: 1em;
  border-radius: 0.375rem;
  overflow-x: auto;
}


/* ========================================
   CAROUSEL COMPONENTS
   ======================================== */
.carousel-container {
  position: relative;
  width: 100%;
  min-height: 500px;
  overflow: visible; /* Allow cards to extend beyond viewport */
}

.carousel-wrapper {
  position: relative;
  width: 100%;
  height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1500px;
  overflow: visible; /* Allow cards to extend beyond wrapper */
  user-select: none; /* Prevent text selection during drag */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.carousel-card {
  position: absolute;
  width: 350px;
  height: 400px;
  background-color: var(--color-bg-tertiary);
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.carousel-card-image {
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.carousel-card-content {
  padding: 1.5rem;
  height: 200px;
  overflow: hidden;
}

.carousel-nav-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Carousel Card States - Positioning controlled by GSAP in deck.js */
.carousel-card[data-position="hidden"] {
  pointer-events: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
/* Medium-Small Viewport Adjustments */
@media (max-height: 700px) {
  #profile-pic img { 
    width: 120px; 
    height: 120px; 
  }
  
  #about h2 { 
    font-size: 1.75rem; 
    margin-bottom: 0.5rem; 
  }
  
  #about p { 
    font-size: 1rem; 
    margin-bottom: 1rem; 
  }
}

/* Very Small Viewport Adjustments */
@media (max-height: 500px) {
  #profile-pic img { 
    width: 80px; 
    height: 80px; 
  }
  
  #about h2 { 
    font-size: 1.5rem; 
    margin-bottom: 0.25rem; 
  }
  
  #about p { 
    font-size: 0.875rem; 
    margin-bottom: 0.5rem; 
  }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  #projectDetails {
    padding: 16px;
  }

  #projectDetails > div {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
  }

  .iframe-container {
    min-height: 300px;
  }

  #resumeModal .bg-white {
    width: 95%;
    height: 80vh;
  }

  .external-demo-container {
    padding: 0.75rem;
  }

  .external-demo-image {
    max-height: calc(100% - 50px);
  }

  .external-demo-button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

}