:root {
  --color-bg: #05060a;
  --color-surface: #0c0d16;
  --color-panel: #141527;
  --color-panel-alt: #1c1d33;
  --color-text: #f5f5f7;
  --color-muted: #9ea4c7;
  --color-accent: #7f5af0;
  --color-accent-alt: #4ad9c5;
  --color-border: rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 20px 60px rgba(5, 6, 10, 0.55);
  --shadow-card: 0 25px 50px rgba(8, 10, 25, 0.65);
  --radius-large: 32px;
  --radius-medium: 20px;
  --radius-small: 12px;
  --nav-height: 80px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Global Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

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

/* Prevent body scroll when modal is open */
body.no-scroll {
  overflow: hidden;
}

#particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none; /* Allow clicking through */
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.container {
  width: min(1200px, 95vw);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  background: var(--color-accent);
  color: #050505;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  transform: translateY(-200%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(18px);
  background: rgba(5, 6, 10, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.header-wrapper {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  transition: transform 0.3s ease, filter 0.3s ease;
  animation: logoFloat 4s ease-in-out infinite;
}

.logo:hover .logo-img {
  animation: none;
  transform: rotate(-5deg) scale(1.05);
  filter: drop-shadow(0 0 8px rgba(127, 90, 240, 0.5));
}

.logo-text {
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: var(--color-muted);
}

.site-nav {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--color-muted);
  font-weight: 500;
  transition: color 0.3s ease;
}

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

.nav-resume {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-resume:hover {
  background: var(--color-accent);
  border-color: transparent;
  color: #050505;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  position: relative;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-bar::before {
  top: -6px;
}

.nav-toggle-bar::after {
  top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar {
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before {
  transform: rotate(-90deg) translateX(-6px);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after {
  opacity: 0;
}

.hero,
.about,
.skills,
.portfolio,
.contact {
  padding: 6rem 0;
}

.clients-marquee {
  padding: 2rem 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  position: relative;
}

.clients-marquee::before,
.clients-marquee::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 150px;
  z-index: 2;
  pointer-events: none;
}

.clients-marquee::before {
  left: 0;
  background: linear-gradient(to right, var(--color-bg), transparent);
}

.clients-marquee::after {
  right: 0;
  background: linear-gradient(to left, var(--color-bg), transparent);
}

.marquee-track {
  display: flex;
  overflow: hidden;
  user-select: none;
  gap: 4rem;
  width: 100%;
  padding: 3rem 0; /* Add padding to prevent glow cropping */
  margin: -3rem 0; /* Negative margin to offset padding layout shift if needed, or just let it be taller */
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-group {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4rem;
  min-width: 100%;
  animation: marquee-scroll 40s linear infinite;
}

.marquee-group img {
  height: 32px;
  width: auto;
  opacity: 0.5;
  /* Force any image to be a white silhouette */
  filter: brightness(0) invert(1);
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
  will-change: transform, filter;
}

.marquee-track:hover .marquee-group {
  animation-play-state: paused;
}

.marquee-track:hover .marquee-group img {
  opacity: 0.3;
}

.marquee-group img:hover {
  opacity: 1;
  transform: scale(1.15); /* Slightly less scale to keep it sharp */
  cursor: pointer;
  animation: plasma-pulse 0.1s infinite alternate; /* Fast vibration for plasma effect */
}

/* --- Project Card Flip Animation --- */
.project-card {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.project-card.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

.project-card-clone {
  position: fixed;
  z-index: 2001;
  transform-style: preserve-3d;
  transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  pointer-events: none; /* Initially none, enabled when active */
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-card);
}

.project-card-clone.is-active {
  pointer-events: auto;
}

.project-card-clone .card-front,
.project-card-clone .card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: inherit;
  overflow: hidden;
}

.project-card-clone .card-front {
  background: rgba(20, 21, 39, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2;
}

.project-card-clone .card-back {
  background: rgba(20, 21, 39, 0.65); /* More translucent */
  backdrop-filter: blur(20px); /* Stronger blur */
  -webkit-backdrop-filter: blur(20px);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden; /* Container doesn't scroll */
  box-shadow: 0 25px 50px rgba(0,0,0,0.5); /* Strong shadow to separate from bg */
}

.card-scroll-view {
  flex: 1;
  overflow-y: auto;
  padding: 3.5rem;
  padding-right: 4rem; /* Space for custom scrollbar */
  
  /* Hide native scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* Prevent scroll chaining */
}

.card-scroll-view::-webkit-scrollbar {
  display: none;
}

@media (max-width: 768px) {
  .card-scroll-view {
    padding: 2rem 1.5rem;
    padding-top: 5rem; /* Space for close button on mobile */
  }

  .project-card-clone.is-active {
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 0 !important;
  }
}

/* Close button inside the card back */
.project-card-clone .modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 50; /* Higher z-index */
  background: rgba(20, 21, 39, 0.6); /* Semi-transparent dark */
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  width: 44px; /* Larger touch target */
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.project-card-clone .modal-close:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  transform: rotate(90deg);
}

.modal-image {
  width: 100%;
  border-radius: var(--radius-small);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}

/* Gallery Styles */
.gallery-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius-small);
  overflow: hidden;
  margin-bottom: 1rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  width: 100%;
  position: relative;
  /* Aspect ratio fallback or let image define height? 
     For a consistent slider, aspect-ratio is good, but images might vary.
     Let's rely on the image's natural height but ensure they don't break layout.
  */
}

.gallery-slide img {
  width: 100%;
  height: auto;
  max-height: 600px; /* Prevent overly tall images */
  object-fit: contain; /* Ensure full image is visible */
  background: rgba(0,0,0,0.1);
  display: block;
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 21, 39, 0.6);
  backdrop-filter: blur(4px);
  color: white;
  border: 1px solid rgba(255,255,255,0.1);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
  opacity: 0;
  transition: all 0.3s ease;
}

.gallery-nav-btn:hover {
  background: var(--color-accent);
  opacity: 1;
}

.gallery-container:hover .gallery-nav-btn {
  opacity: 1;
}

.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.gallery-dots {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
  background: rgba(0,0,0,0.3);
  padding: 6px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: background 0.3s;
}

.gallery-dot.active {
  background: white;
  transform: scale(1.2);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 3000;
  pointer-events: none;
}

.toast {
  background: rgba(20, 21, 39, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 1rem;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
  min-width: 300px;
}

.toast.is-visible {
  transform: translateX(0);
}

.toast-success { border-left: 4px solid var(--color-accent-alt); }
.toast-error { border-left: 4px solid #ff4444; }
.toast-info { border-left: 4px solid var(--color-accent); }

/* Custom Confirm Modal */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 3001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.confirm-modal.is-visible {
  opacity: 1;
  visibility: visible;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 10, 0.8);
  backdrop-filter: blur(4px);
}

.confirm-dialog {
  position: relative;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  padding: 2rem;
  border-radius: var(--radius-medium);
  width: min(400px, 90vw);
  box-shadow: var(--shadow-card);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.confirm-modal.is-visible .confirm-dialog {
  transform: scale(1);
}

.confirm-title {
  font-size: 1.2rem;
  margin: 0 0 1rem;
  color: var(--color-text);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
}

/* Stats Dashboard Improvements */
#tab-stats {
  overflow-y: auto;
  padding: 2rem;
}

.stats-dashboard {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-bottom: 2rem;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: rgba(20, 21, 39, 0.4);
  backdrop-filter: blur(12px);
  padding: 2rem;
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-accent);
}

.stat-card h4 {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-card p {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-text);
  text-shadow: 0 0 20px rgba(127, 90, 240, 0.3);
}

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

.chart-container {
  background: rgba(20, 21, 39, 0.4);
  backdrop-filter: blur(12px);
  padding: 2rem;
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.05);
  height: 400px;
  display: flex;
  flex-direction: column;
}

.chart-container h4 {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  color: var(--color-text);
  font-weight: 500;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-container {
    height: 300px;
    padding: 1.5rem;
  }
}

/* Ensure modal doesn't just pop in */
.project-modal {
  transition: opacity 0.3s ease;
}

.project-modal.is-visible {
  opacity: 1;
}

.project-modal:not(.is-visible) {
  opacity: 0;
  pointer-events: none;
}

@keyframes marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Editor Modal Styles */
.editor-modal .modal-container {
  max-width: 1000px;
  width: 95vw;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

.editor-modal .modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

.editor-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20, 21, 39, 0.5);
}

.editor-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-close-inline {
  background: transparent;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-inline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

.editor-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.editor-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.project-list-sidebar {
  width: 250px;
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  background: rgba(5, 6, 10, 0.3);
}

/* Custom Scrollbar for Editor */
.project-list-sidebar,
.project-editor-form,
#tab-stats {
  position: relative;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.project-list-sidebar::-webkit-scrollbar,
.project-editor-form::-webkit-scrollbar,
#tab-stats::-webkit-scrollbar {
  display: none;
}

.editor-scrollbar {
  top: 0.5rem;
  bottom: 0.5rem;
  right: 0.5rem;
  width: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.editor-modal:hover .custom-scrollbar,
.project-list-sidebar:hover .custom-scrollbar,
.project-editor-form:hover .custom-scrollbar,
#tab-stats:hover .custom-scrollbar {
  opacity: 1;
  pointer-events: auto;
}

#editor-project-list {
  padding: 0;
  margin: 0;
}

#editor-project-list li {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.2s ease;
}

#editor-project-list li:hover {
  background: rgba(255, 255, 255, 0.05);
}

#editor-project-list li.active {
  background: rgba(127, 90, 240, 0.1);
  border-left: 3px solid var(--color-accent);
}

.project-editor-form {
  flex: 1;
  padding: 2rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-editor-form form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  background: rgba(5, 6, 10, 0.5);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-family: inherit;
  transition: border-color 0.3s ease;
}

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

.code-input {
  font-family: monospace;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.right-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.btn-danger {
  background: rgba(255, 50, 50, 0.1);
  color: #ff4444;
  border: 1px solid rgba(255, 50, 50, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 50, 50, 0.2);
}

.save-status {
  font-size: 0.9rem;
  color: var(--color-accent-alt);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.save-status.visible {
  opacity: 1;
}

.hero {
  background: radial-gradient(circle at top, rgba(127, 90, 240, 0.25), transparent 55%), var(--color-bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  margin: 0 0 1.5rem;
}

.hero-copy .lead {
  font-size: 1.2rem;
  color: var(--color-muted);
  max-width: 40ch;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-accent-alt);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.cta-group {
  display: flex;
  gap: 1rem;
  margin: 2rem 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 1.8rem;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.btn-accent {
  background: linear-gradient(120deg, var(--color-accent), var(--color-accent-alt));
  color: #050505;
  box-shadow: 0 15px 30px rgba(127, 90, 240, 0.4);
}

.btn-aurora {
  position: relative;
  background: transparent;
  color: #fff;
  padding: 0.95rem 2.4rem;
  border-radius: 999px;
  overflow: visible;
  z-index: 1;
  transition: transform 0.3s ease, letter-spacing 0.3s ease;
}

.btn-aurora::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -2;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--color-accent),
    var(--color-accent-alt),
    #ffffff,
    var(--color-accent-alt),
    var(--color-accent)
  );
  background-size: 200% auto;
  animation: aurora-flow 3s linear infinite;
  box-shadow: 0 0 20px rgba(127, 90, 240, 0.5);
}

.btn-aurora::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: inherit;
  background: var(--color-bg);
  transition: background 0.3s ease;
}

.btn-aurora:hover {
  transform: translateY(-2px);
  letter-spacing: 0.05em;
  color: #fff;
}

.btn-aurora:hover::after {
  background: rgba(5, 6, 10, 0.8);
}

.btn-aurora:hover::before {
  box-shadow: 0 0 30px rgba(74, 217, 197, 0.6);
}

@keyframes aurora-flow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered animation delays */
.delay-100 { transition-delay: 100ms; animation-delay: 100ms; }
.delay-200 { transition-delay: 200ms; animation-delay: 200ms; }
.delay-300 { transition-delay: 300ms; animation-delay: 300ms; }
.delay-400 { transition-delay: 400ms; animation-delay: 400ms; }
.delay-500 { transition-delay: 500ms; animation-delay: 500ms; }

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

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

.hero-meta {
  display: grid;
  gap: 0.5rem;
  color: var(--color-muted);
}

.hero-media {
  position: relative;
  padding: 2rem;
  background: var(--color-panel);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-card);
}

.hero-media img {
  width: 100%;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.5));
}

.media-stat {
  position: absolute;
  right: 2rem;
  background: rgba(5, 6, 10, 0.8);
  backdrop-filter: blur(10px);
  padding: 1rem 1.2rem;
  border-radius: var(--radius-medium);
  border: 1px solid var(--color-border);
  text-align: right;
}

.media-stat:nth-of-type(1) {
  top: 2rem;
}

.media-stat:nth-of-type(2) {
  bottom: 2rem;
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.about-wrapper {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: stretch;
}

.about-visual,
.expertise-visual {
  position: relative;
  background: rgba(20, 21, 39, 0.4);
  border-radius: var(--radius-large);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.about-visual:hover,
.expertise-visual:hover {
  border-color: rgba(127, 90, 240, 0.3);
  transform: translateY(-2px);
}

.tech-card-bg {
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at top right, black, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at top right, black, transparent 80%);
  z-index: -1;
  pointer-events: none;
}

.about-content,
.expertise-content {
  position: relative;
  padding: 2.5rem;
  z-index: 1;
}

.expertise-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.expertise-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-medium);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.3s ease;
}

/* Glass highlight + rim glow driven by mouse position */
.expertise-card,
.value-item,
.skill-group {
  --mx: 50%; /* mouse X (percent) */
  --my: 50%; /* mouse Y (percent) */
  --glow: 0; /* intensity (0..1) - set by JS on hover/mousemove */
  position: relative;
  overflow: hidden;
}

.expertise-card::before,
.value-item::before,
.skill-group::before {
  /* soft inner highlight that follows the cursor */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,0.08), rgba(255,255,255,0.02) 12%, rgba(255,255,255,0) 30%);
  mix-blend-mode: overlay;
  opacity: calc(var(--glow) * 1);
  transition: opacity 220ms ease, background-position 120ms linear;
  transform-origin: center center;
}

.expertise-card::after,
.value-item::after,
.skill-group::after {
  /* thin rim / accent glow that sits at the bottom and moves horizontally with cursor */
  content: '';
  position: absolute;
  left: -40%;
  right: -40%;
  height: 30%;
  bottom: -18%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 10%, rgba(127,90,240,0.95) 35%, rgba(74,217,197,0.95) 60%, transparent 90%);
  filter: blur(14px) saturate(1.2);
  opacity: calc(var(--glow) * 0.9);
  transform: translateX(calc(var(--mx) - 50%));
  transition: transform 160ms linear, opacity 220ms ease;
  z-index: 0;
}

/* keep content above the pseudo elements */
.expertise-card > *,
.value-item > *,
.skill-group > * {
  position: relative;
  z-index: 1;
}

/* reduce/disable motion for prefer-reduced-motion & small touch devices */
@media (prefers-reduced-motion: reduce), (hover: none) {
  .expertise-card::after,
  .value-item::after,
  .expertise-card::before,
  .value-item::before,
  .skill-group::after,
  .skill-group::before {
    display: none;
  }
}

.expertise-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.expertise-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(127, 90, 240, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(127, 90, 240, 0.2);
  transition: all 0.3s ease;
}

.expertise-card:hover .expertise-icon {
  background: rgba(127, 90, 240, 0.2);
  transform: scale(1.05);
}

.expertise-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.expertise-info h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.expertise-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.why-hire-me {
  margin: 2rem 0;
}

.why-hire-me h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.check-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-accent-alt);
  font-weight: bold;
}

.value-proposition-wrapper {
  margin-top: 2rem;
}

.value-visual {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 21, 39, 0.8), rgba(5, 6, 10, 1));
  border-radius: var(--radius-large);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.value-visual:hover {
  border-color: rgba(74, 217, 197, 0.3);
  transform: translateY(-2px);
}

.value-content {
  position: relative;
  padding: 2.5rem;
  z-index: 1;
}

.value-content h3 {
  margin-top: 0;
  margin-bottom: 2rem;
  font-size: 1.4rem;
  text-align: center;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.value-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  height: 100%;
}

.value-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-5px);
  border-color: var(--color-accent);
  box-shadow: 0 10px 30px -10px rgba(127, 90, 240, 0.2);
}

.value-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.value-icon {
  font-size: 1.5rem;
  background: rgba(127, 90, 240, 0.1);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.value-label {
  font-weight: 700;
  color: var(--color-text);
  font-size: 1.1rem;
}

.value-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.value-desc {
  color: var(--color-muted);
}

/* Legacy media query removed for new grid layout */

@media (max-width: 900px) {
  .about-wrapper {
    grid-template-columns: 1fr;
  }
}

.skills {
  background: linear-gradient(180deg, rgba(20, 21, 39, 0.8), rgba(5, 6, 10, 1));
}

.section-headline {
  margin-bottom: 2.5rem;
}

.section-headline h2 {
  margin-bottom: 0.3rem;
  font-size: 2.2rem;
}

.section-headline p {
  color: var(--color-muted);
}

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

.skill-group {
  background: rgba(255, 255, 255, 0.03);
  padding: 1.8rem;
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(10px);
}

.skill-group:hover,
.skill-group.is-visible:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  border-color: rgba(127, 90, 240, 0.3);
  z-index: 1;
}

.skill-group h3 {
  margin: 0;
  font-size: 1.1rem;
}

.skill-list {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

.skill-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: transform 0.2s ease;
}

.skill-item:hover {
  transform: translateX(4px);
}

.skill-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--color-muted);
  transition: color 0.2s ease;
}

.skill-item:hover .skill-info span:first-child {
  color: var(--color-text);
  text-shadow: 0 0 10px rgba(127, 90, 240, 0.3);
}

.skill-value {
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.8rem;
}

.skill-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.skill-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-alt));
  border-radius: 999px;
  width: 0;
  transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: 0.2s;
  box-shadow: 0 0 10px rgba(127, 90, 240, 0.3);
  position: relative;
  overflow: hidden;
}

.skill-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: translateX(-100%);
  animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skill-group.is-visible .skill-progress {
  width: var(--target-width);
}

/* Project Tags */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  color: var(--color-muted);
  font-weight: 600;
  border: 1px solid var(--color-border);
  transition: all 0.3s ease;
}

.project-card:hover .tag {
  border-color: rgba(127, 90, 240, 0.3);
  background: rgba(127, 90, 240, 0.1);
  color: var(--color-text);
}

/* Filter Buttons */
.portfolio-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 4rem; /* Increased padding */
  justify-content: center;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-weight: 500;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(127, 90, 240, 0.3);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  perspective: 1000px; /* Enable 3D space */
}

.project-card {
  background: rgba(20, 21, 39, 0.6); /* Translucent panel color */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-medium);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* 3D Flip Animation States - High Specificity to override hover/reveal states */
.portfolio-grid .project-card.flip-out {
  transform: rotateY(90deg) scale(0.9) !important;
  opacity: 0 !important;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.portfolio-grid .project-card.flip-in-start {
  transform: rotateY(-90deg) scale(0.9) !important;
  opacity: 0 !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.project-card:focus-visible {
  border-color: var(--color-accent);
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-card);
}

.project-image {
  height: 200px;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(127, 90, 240, 0.2), transparent 70%);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-card:hover .project-image img {
  transform: scale(1.08);
}

.project-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-category {
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.project-link {
  margin-top: auto;
  align-self: flex-start;
  border: none;
  background: none;
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
}

.will-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.will-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  background: var(--color-panel);
  padding: 3rem;
  border-radius: var(--radius-large);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}

.contact-copy ul {
  margin: 1.5rem 0;
  color: var(--color-muted);
  display: grid;
  gap: 0.5rem;
}

.contact-copy span {
  color: var(--color-text);
  font-weight: 600;
  margin-right: 0.5rem;
}

.contact-social {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.contact-social a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--color-muted);
}

.contact-form {
  display: grid;
  gap: 0.8rem;
}

.contact-form label {
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-small);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text);
  font-size: 1rem;
}

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

.form-status {
  min-height: 1.5rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--color-muted);
}

.project-modal {
  position: fixed;
  inset: 0;
  /* display: none;  <-- Removed to allow transition */
  display: flex; /* Always flex, but hidden via opacity/visibility */
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.project-modal.is-visible {
  /* display: flex; <-- Already flex */
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 10, 0.3); /* Much lighter overlay */
  /* Removed backdrop-filter so the card's blur is the star */
}

.modal-dialog {
  position: relative;
  width: min(900px, 90vw);
  height: min(90vh, 800px); /* Fixed max height to ensure scrolling triggers */
  display: flex;
  flex-direction: column;
  background: var(--color-panel-alt);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  overflow: hidden; /* Hide container overflow */
}

.modal-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 3.5rem;
  padding-right: 4rem; /* Space for custom scrollbar */
  
  /* Hide native scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-scroll-area::-webkit-scrollbar {
  display: none;
}

.custom-scrollbar {
  position: absolute;
  top: 5rem; /* Start below the close button */
  bottom: 2rem;
  right: 1.5rem; /* Padding to the right of scrollbar */
  width: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Allow clicks to pass through if hidden */
}

.modal-dialog:hover .custom-scrollbar,
.project-card-clone:hover .custom-scrollbar,
.custom-scrollbar.is-active {
  opacity: 1;
  pointer-events: auto;
}

.custom-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s ease, height 0.1s linear;
  backdrop-filter: blur(4px);
}

.custom-scrollbar-thumb:hover,
.custom-scrollbar-thumb.is-dragging {
  background: var(--color-accent);
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: rgba(20, 21, 39, 0.8); /* More opaque to sit over content */
  backdrop-filter: blur(10px);
  color: var(--color-text);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 30; /* Above scrollbar */
  transition: all 0.2s ease;
  display: grid;
  place-items: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-accent);
  transform: rotate(90deg);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-category {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.8rem;
  color: var(--color-muted);
}

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

.modal-tools li {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.modal-media {
  display: grid;
  gap: 1rem;
}

.modal-media iframe,
.modal-media img {
  width: 100%;
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-link {
  align-self: flex-start;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Project page tweaks */
.body-project .site-header {
  position: relative;
}

.body-project .case-hero {
  padding: 6rem 0 3rem;
}

.case-hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}

.case-meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  color: var(--color-muted);
}

.case-section {
  margin-bottom: 3rem;
}

.case-gallery {
  display: grid;
  gap: 1rem;
}

.case-gallery img,
.case-gallery iframe {
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .header-wrapper {
    height: auto;
    padding: 1.5rem 0;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: calc(var(--nav-height) - 10px);
    right: 1rem;
    flex-direction: column;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    border-radius: var(--radius-medium);
    width: min(280px, 80vw);
    transform-origin: top right;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .nav-links.is-open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }

  .hero,
  .about,
  .skills,
  .portfolio,
  .contact {
    padding: 4rem 0;
  }

  .hero-grid,
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .cta-group {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-grid {
    padding: 2rem;
  }
}

@media (max-width: 600px) {
  .container {
    width: 90vw;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: 320px;
  }
}

/* Showreel Section */
.showreel-section {
  padding: 2rem 0 6rem;
  position: relative;
}

.showreel-wrapper {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: transparent;
  border-radius: var(--radius-large);
  border: none;
  overflow: visible;
  position: relative;
  box-shadow: none;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.showreel-wrapper:hover {
  transform: scale(1.01);
}

.showreel-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(127, 90, 240, 0.1) 0%, rgba(22, 22, 26, 0.8) 100%);
  gap: 1.5rem;
}

.play-button {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.showreel-wrapper:hover .play-button {
  background: var(--color-accent);
  transform: scale(1.1);
  box-shadow: 0 0 30px var(--color-accent);
  border-color: transparent;
}

.showreel-label {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

/* Universal Modal Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 10, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-card);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-backdrop.is-visible .modal-container {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s ease, color 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

/* Login Modal Specifics */
.login-modal .modal-container {
  background: rgba(20, 21, 39, 0.95);
  border: 1px solid rgba(127, 90, 240, 0.3);
  box-shadow: 0 0 40px rgba(127, 90, 240, 0.15);
}

.login-modal h2 {
  text-align: center;
  color: var(--color-text);
}

/* Editor Tabs */
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
}

.editor-tabs {
  display: flex;
  gap: 1rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s ease;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1.6rem; /* Align with border-bottom of header */
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
}

.editor-tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

.editor-tab-content.active {
  display: flex;
}

/* Client Manager */
.clients-manager {
  padding: 2rem;
}

.clients-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.clients-grid-editor {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1.5rem;
}

.client-item-editor {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.3s ease;
}

.client-item-editor:hover {
  border-color: var(--color-accent);
}

.client-item-editor img {
  width: 100%;
  height: 80px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  filter: grayscale(100%) brightness(0.8);
}

.client-item-editor:hover img {
  filter: grayscale(0%) brightness(1);
}

.client-name {
  font-size: 0.8rem;
  color: var(--color-muted);
  word-break: break-all;
}

/* File Upload Input Group */
.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input[type="text"] {
  flex: 1;
}

.file-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
}

/* Custom Video Player */
.custom-video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-medium);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

#youtube-player {
  width: 100%;
  height: 100%;
  pointer-events: none; /* Prevent interaction with YT iframe directly */
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s ease;
  z-index: 2;
  cursor: pointer;
  overflow: hidden;
}

.video-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--video-thumb);
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.6);
  transform: scale(1.1);
  z-index: -1;
  transition: transform 0.5s ease;
}

.video-overlay:hover::before {
  transform: scale(1.15);
}

.video-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.play-button-large {
  width: 80px;
  height: 80px;
  background: rgba(127, 90, 240, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 0 30px rgba(127, 90, 240, 0.4);
}

.video-overlay:hover .play-button-large {
  transform: scale(1.1);
  background: var(--color-accent);
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  display: flex;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.custom-video-player:hover .video-controls,
.custom-video-player.is-paused .video-controls {
  opacity: 1;
}

.control-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-accent);
}

.progress-container {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: height 0.2s ease;
}

.progress-container:hover {
  height: 8px;
}

.progress-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.progress-filled {
  width: 0%;
  height: 100%;
  background: var(--color-accent);
  position: relative;
}

.progress-filled::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.progress-container:hover .progress-filled::after {
  opacity: 1;
}

.time-display {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: #ddd;
  min-width: 80px;
  text-align: center;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.volume-slider {
  width: 0;
  overflow: hidden;
  transition: width 0.3s ease;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.volume-container:hover .volume-slider,
.volume-slider:focus {
  width: 80px;
}

.volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background: #fff;
  margin-top: -4px;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Ambilight Effect */
.showreel-wrapper {
  position: relative;
  z-index: 1;
}

.ambilight-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  transform: scale(1.15);
  filter: blur(60px) saturate(1.5) brightness(1.2);
  opacity: 0.6;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--radius-medium);
}

#ambilight-player {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  margin-right: 10px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
   transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--color-accent);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--color-accent);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.label-text {
  font-weight: 500;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
}

.file-upload-btn {
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
}
