/* === Global Styles === */
body {
  padding-top: 0;
  background: none !important;
  overflow-x: visible;
}


.background-overlay {
  position: fixed;
  top: -50px;
  left: -50px;
  right: -50px;
  bottom: -50px;
  background-image: url('images/persian.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: hue-rotate(15deg) saturate(1.3);
  z-index: -2;
  pointer-events: none;
  /* Safari mobile optimizations */
  min-height: 100vh;
  min-height: 100dvh;
  transform: translateZ(0); /* Force hardware acceleration */
}

/* Keep Persian background on all pages - only remove overrides for specific pages that need white */
/* Note: Work and dotfiles pages may have specific white background requirements */

.background-gradient {
  position: fixed;
  top: -50px;
  left: -50px;
  right: -50px;
  bottom: -50px;
  background: linear-gradient(to right, 
    rgba(255, 255, 255, 0.85) 0%,     /* More translucent at left */
    rgba(255, 255, 255, 0.92) 8%,     /* Start visible area - less translucent */
    rgba(255, 255, 255, 0.92) 92%,    /* Keep visible area - less translucent */
    rgba(255, 255, 255, 0.85) 100%    /* More translucent at right */
  );
  pointer-events: none;
  z-index: -1;
  /* Safari mobile optimizations */
  min-height: 100vh;
  min-height: 100dvh;
  transform: translateZ(0); /* Force hardware acceleration */
}

/* === Fonts === */
@font-face {
  font-family: 'Icona Sans';
  src: url('fonts/icona-font/IconaSansTRIAL-Regular-BF6683702d1fa41.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Icona Sans';
  src: url('fonts/icona-font/IconaSansTRIAL-Bold-BF6683702c976d7.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
}

/* === Header + Name === */
.subtitle,
.copywrite {
  font-size: 0.75rem;
  color: #000;
  font-weight: 400;
  padding: 15px 0px;
  display: block;
  margin-top: -15px;
}

.left-indent {
  padding-left: 64px;
}

.container {
  padding-top: 40px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 32px 4px 32px;
  background-color: transparent;
  font-family: 'Roboto', sans-serif;
}

body.detail-page .container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  pointer-events: none;
}

body.detail-page .header {
  background-color: transparent;
  transition: all 0.3s ease;
  pointer-events: all;
}

.header-name  {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #000;
}

.copywrite {
  color: #000;
}

/* Detail page header styling */
body.detail-page .header .header-name,
body.detail-page .header .copywrite {
  color: #E8E3D3;
  transition: color 0.3s ease;
}

body.detail-page .header .social-links img {
  filter: invert(1);
  transition: filter 0.3s ease;
}

body.detail-page .header.scrolled {
  position: fixed;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  top: 0;
  left: 0;
  right: 0;
}

body.detail-page.scrolled {
  padding-top: 100px;
}

body.detail-page .header.scrolled .header-name,
body.detail-page .header.scrolled .copywrite {
  color: #000;
}

body.detail-page .header.scrolled .social-links img {
  filter: invert(0);
}

/* Header size reduction on scroll for mandelbrot page */
.header.scrolled-small {
  padding: 12px 64px 4px 64px;
  transition: all 0.3s ease;
}

.header.scrolled-small .header-name {
  font-size: 0.85rem;
  transition: font-size 0.3s ease;
}

.header.scrolled-small .copywrite {
  font-size: 0.65rem;
  line-height: 1.3;
  transition: font-size 0.3s ease;
}

.header.scrolled-small .social-links {
  gap: 8px;
}

.header.scrolled-small .animated-icon {
  width: 18px;
  height: 18px;
  transition: all 0.3s ease;
}

/* Responsive header sizing */
@media (max-width: 1200px) {
  .header {
    padding: 8px 24px 4px 24px; /* Adjusted padding */
  }
  
  .header-name {
    font-size: 0.9rem;
  }
  
  .copywrite {
    font-size: 0.7rem;
  }
  
  .social-links {
    gap: 10px;
  }
  
  .animated-icon {
    width: 18px;
    height: 18px;
  }
}

}

.inter-caption {
  font-family: "Inter", sans-serif;
  font-optical-sizing: auto;
  font-weight: <weight>;
  font-style: normal;
}


.archivo-header {
  font-family: "Archivo", sans-serif;
  font-optical-sizing: auto;
  font-weight: <weight>;
  font-style: normal;
  font-variation-settings:
    "wdth" 100;
}



.header-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  line-height: 1.2;
}

/* === Social Icons === */
.social-links {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 0px 32px 0 0;
  margin-top: 0px;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px; /* Minimum touch target size */
  min-height: 44px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  margin: 0 -4px; /* Negative margin to overlap touch targets */
}

.animated-icon {
  width: 20px;   /* Smaller default size for large desktop screens */
  height: 20px;
  object-fit: contain;
}

/* Mobile touch target optimization */


.social-icon:hover {
  transform: scale(1.05);
}

/* === Intro Section === */
.intro {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 400;
  color: #000;
  line-height: 1.3;
  text-decoration: none;
  margin: 0;
  padding: 80px 32px 0 32px;
  max-width: 1000px;
  font-family: 'Icona Sans', sans-serif;
}

/* Mobile intro adjustments */
@media (max-width: 768px) {
  .intro {
    padding: 40px 16px 0 16px;
    font-size: clamp(1.5rem, 5vw, 2rem);
  }
}

.intro b {
  font-weight: 700;
}

.intro a {
  font-weight: 700;
  color: #000;
  text-decoration: none;
}

.intro a:hover {
  opacity: 0.7;
}

/* === Projects Section === */
.projects {
  margin-top: 250px;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  padding-left: 32px;
}

/* Mobile projects section adjustments */
@media (max-width: 768px) {
  .projects {
    margin-top: 150px;
    padding-left: 16px;
  }
}

/* Visible when scrolled into view */
.projects.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === Grid Layout === */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 80px;
  padding-left: 32px; /* Less padding to allow cards to extend beyond text */
  padding-right: 32px;
  perspective: 1000px;
}

/* Mobile grid layout - single column */
@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Small mobile - even more compact */
@media (max-width: 480px) {
  .project-grid {
    gap: 32px;
    padding-left: 8px;
    padding-right: 8px;
  }
}



/* === Project Card === */
.project-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px; /* Smaller radius for square effect */
  width: 100%; /* Full width of grid cell */
  aspect-ratio: 1; /* Perfect square */
  cursor: pointer;
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  background-size: cover; /* Force into square shape */
  background-position: center; /* Center the image */
  background-repeat: no-repeat;
  background-color: #f8f8f8;
  display: flex;
  align-items: flex-end;
}

/* Optional: if you ever use a nested <div class="project-image"> */
.project-image {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;

}

/* Specific styling for linear algebra card to show full image */
.project-card[style*="lin-alg-photo.png"] {
  background-image: url('images/lin-alg-photo.png'), url('images/color.png') !important;
  background-size: contain, cover !important;
  background-position: center, center !important;
  background-repeat: no-repeat, no-repeat !important;
  background-color: transparent !important;
}

/* Stretch the chess photo to fill the whole card */
.project-card[style*="chess.png"] {
  background-size: 101% !important;
}

/* Make the sudoku icon smaller */
.project-card[style*="sudoku-icon.png"] {
  background-size: 60% !important;
  background-position: center !important;
}

/* Make the PartyPass icon smaller */
.project-card[style*="light-party.png"] {
  background-size: 60% !important;
  background-position: center !important;
}

/* Position text right below the icon content */
.info-only-wrapper {
  position: relative;
}

.info-only-wrapper .project-caption {
  position: absolute;
  bottom: -30px;
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
}

.info-only-wrapper .project-caption-bar {
  justify-content: center;
  margin-bottom: 0;
}

.info-only-wrapper .project-caption p {
  text-align: center;
}

.project-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

/* Icon-only card for special cards like Emacs - shows PNG only with no background */
.icon-only-card {
  background-color: transparent !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: none !important;
}

/* Info-only cards for dotfiles - no captions, hover info icon */
.info-only-card {
  background-color: transparent !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: none !important;
  position: relative;
}

.info-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  cursor: pointer;
  font-family: 'Icona Sans', sans-serif;
  z-index: 10;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform: scale(0.9);
}

.info-only-card:hover .info-icon {
  opacity: 1;
  transform: scale(1);
}

.info-icon:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: scale(1.05);
}

/* Popup for info display - hyperprofessional liquid glass */
.info-popup {
  position: absolute;
  background: 
    linear-gradient(135deg, 
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.90) 25%,
      rgba(255, 255, 255, 0.85) 50%,
      rgba(255, 255, 255, 0.80) 75%,
      rgba(255, 255, 255, 0.75) 100%
    );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #1a1a1a;
  padding: 18px 22px;
  border-radius: 20px;
  font-family: 'Icona Sans', sans-serif;
  font-size: 13px;
  max-width: 240px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
  pointer-events: none;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.25),
    0 4px 16px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.6);
  position: relative;
  overflow: hidden;
}

.info-popup::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.8) 50%, 
    transparent 100%);
}

.info-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.info-popup h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 600;
  color: #0a0a0a;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.info-popup .meta {
  font-size: 10px;
  color: #4a4a4a;
  margin-bottom: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: 
    linear-gradient(135deg, 
      rgba(0, 0, 0, 0.08) 0%, 
      rgba(0, 0, 0, 0.04) 100%);
  padding: 4px 8px;
  border-radius: 10px;
  display: inline-block;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.info-popup .description {
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
  color: #2a2a2a;
  font-weight: 400;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

.project-caption {
  font-family: 'Icona Sans', sans-serif;
  padding: 0 0px;
  top-padding: 10px;
  color: #333;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 500;
  width: 100%;
  min-width: 0;
}

.project-caption-bar {
  display: flex;
  gap: 24px; /* adds a little breathing room between items */
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px; /* space below the bar */
  color: #111;
  width: 100%;
  min-width: 0;
}

.project-caption-bar span {
  white-space: nowrap;
  font-weight: 600;
}

/* Enhanced mobile project caption layout */
@media (max-width: 768px) {
  .project-caption {
    font-size: 0.85rem;
    padding: 0;
    width: 100% !important;
    overflow: visible !important;
  }
  
  .project-caption-bar {
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
    width: 100% !important;
    overflow: visible !important;
    margin-bottom: 6px;
  }
  
  .project-caption-bar span {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    width: auto !important;
    font-size: 0.8rem;
    line-height: 1.3;
  }
  
  .project-caption-bar .caption-left {
    font-weight: 600;
    color: #111;
    font-size: 0.9rem;
  }
  
  .project-caption-bar .caption-center {
    color: #666;
    font-size: 0.75rem;
  }
  
  .project-caption-bar .caption-right {
    color: #888;
    font-size: 0.75rem;
    font-style: italic;
  }
  
  .project-caption p {
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
  }
  
  .project-card-wrapper {
    width: 100% !important;
    overflow: visible !important;
    min-width: 0 !important;
  }
}

.project-caption p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #333;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}






.pt-sans-bold {
  font-family: "PT Sans Caption", sans-serif;
  font-weight: 700;
  font-style: normal;
}

/* === Bottom Navigation === */
.bottom-nav {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(120, 60, 160, 0.65), rgba(80, 30, 120, 0.55));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: 999px;
  display: flex;
  padding: 14px 32px;
  gap: 32px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
}

/* Back to portfolio navigation for detail pages */
.detail-page .bottom-nav,
.project-page .bottom-nav {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(120, 60, 160, 0.65), rgba(80, 30, 120, 0.55));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: 999px;
  display: flex;
  padding: 14px 32px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
  width: auto;
  min-width: 160px;
  max-width: none;
  justify-content: center;
  white-space: nowrap;
}

.nav-item {
  color: rgba(255, 255, 255, 1);
  font-size: 16px;
  text-decoration: none;
  transition: color 0.25s ease;
  font-family: 'Inter', sans-serif;
}

.nav-item.active {
  color: #fff;
  font-weight: 600;
  position: relative;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
}

.nav-item:hover {
  color: rgba(255, 255, 255, 0.85);
}

.nav-back-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 1);
  font-size: 16px;
  text-decoration: none;
  transition: color 0.25s ease;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

.nav-back-item:hover {
  color: rgba(255, 255, 255, 0.85);
}

.nav-back-item svg {
  transition: transform 0.2s ease;
}

.nav-back-item:hover svg {
  transform: translateX(-2px);
}
.footer-spacer {
  background-color: transparent;
  height: 120px; /* More space above navbar for better breathing room */
  width: 100%;
}

/* === Simple Modern Card Transitions === */

/* Clean fade out */
.card-wave-exit {
  animation: modernFadeOut 0.3s ease-out forwards;
  pointer-events: none;
}

.card-wave-exit:nth-child(1) { animation-delay: 0s; }
.card-wave-exit:nth-child(2) { animation-delay: 0.03s; }
.card-wave-exit:nth-child(3) { animation-delay: 0.06s; }
.card-wave-exit:nth-child(4) { animation-delay: 0.03s; }
.card-wave-exit:nth-child(5) { animation-delay: 0s; }
.card-wave-exit:nth-child(6) { animation-delay: 0.03s; }

@keyframes modernFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.card-wave-enter {
  opacity: 0;
  transform: translateY(4px);
  animation: modernFadeIn 0.4s ease-out forwards;
}

.card-wave-enter:nth-child(1) { animation-delay: 0s; }
.card-wave-enter:nth-child(2) { animation-delay: 0.03s; }
.card-wave-enter:nth-child(3) { animation-delay: 0.06s; }
.card-wave-enter:nth-child(4) { animation-delay: 0.03s; }
.card-wave-enter:nth-child(5) { animation-delay: 0s; }
.card-wave-enter:nth-child(6) { animation-delay: 0.03s; }

@keyframes modernFadeIn {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Simple slide */
.card-flip-exit {
  animation: modernSlideOut 0.3s ease-out forwards;
  pointer-events: none;
}

.card-flip-exit:nth-child(odd) { 
  animation-delay: 0s;
}
.card-flip-exit:nth-child(even) { 
  animation-delay: 0.02s;
}

@keyframes modernSlideOut {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-8px);
  }
}

.card-flip-enter {
  opacity: 0;
  transform: translateX(8px);
  animation: modernSlideIn 0.4s ease-out forwards;
}

.card-flip-enter:nth-child(odd) { 
  animation-delay: 0.02s;
}
.card-flip-enter:nth-child(even) { 
  animation-delay: 0s;
}

@keyframes modernSlideIn {
  0% {
    opacity: 0;
    transform: translateX(8px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Simple scale */
.card-ripple-exit {
  animation: modernScaleOut 0.3s ease-out forwards;
  pointer-events: none;
}

.card-ripple-exit:nth-child(1) { animation-delay: 0.04s; }
.card-ripple-exit:nth-child(2) { animation-delay: 0.02s; }
.card-ripple-exit:nth-child(3) { animation-delay: 0s; }
.card-ripple-exit:nth-child(4) { animation-delay: 0.02s; }
.card-ripple-exit:nth-child(5) { animation-delay: 0.04s; }
.card-ripple-exit:nth-child(6) { animation-delay: 0.06s; }

@keyframes modernScaleOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.95);
  }
}

.card-ripple-enter {
  opacity: 0;
  transform: scale(0.95);
  animation: modernScaleIn 0.4s ease-out forwards;
}

.card-ripple-enter:nth-child(1) { animation-delay: 0.06s; }
.card-ripple-enter:nth-child(2) { animation-delay: 0.04s; }
.card-ripple-enter:nth-child(3) { animation-delay: 0.02s; }
.card-ripple-enter:nth-child(4) { animation-delay: 0.04s; }
.card-ripple-enter:nth-child(5) { animation-delay: 0.06s; }
.card-ripple-enter:nth-child(6) { animation-delay: 0.08s; }

@keyframes modernScaleIn {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Gentle text transitions */
.text-experimental-out {
  animation: textGentleFade 0.25s ease-out forwards;
}

.text-experimental-in {
  animation: textGentleSlide 0.4s ease-out 0.15s forwards;
  opacity: 0;
  transform: translateY(5px);
}

@keyframes textGentleFade {
  0% {
    opacity: 1;
    transform: translateY(0px);
  }
  100% {
    opacity: 0;
    transform: translateY(-3px);
  }
}

@keyframes textGentleSlide {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0px);
  }
}

.page-transitioning {
  overflow-x: hidden;
}

/* === Modern Project Detail Page === */
.project-detail {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  background: transparent; /* Allow Persian background to show through */
  overflow-y: auto;
  z-index: 1000;
}

.project-detail.active {
  opacity: 1;
  visibility: visible;
}

.project-hero {
  position: relative;
  height: 100vh;
  min-height: 500px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  transition: all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 10;
  transform-origin: center center;
}

.project-hero.scrolled {
  height: 65vh;
  margin: 40px;
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transition: all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-hero-content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  width: 100%;
}

.project-hero-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 24px 0;
  line-height: 0.9;
  letter-spacing: -0.03em;
  transition: all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-hero-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 40px 0;
  font-weight: 400;
  line-height: 1.4;
  max-width: 600px;
  transition: all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-hero-meta {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  transition: all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.hero-meta-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-meta-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.hero-meta-value {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: #ffffff;
  font-weight: 600;
}

.project-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0px 40px 80px 40px;
  opacity: 0;
  transform: translateY(50px);
  transition: all 2s cubic-bezier(0.23, 1, 0.32, 1);
  background: transparent; /* Let Persian background show through */
  position: relative;
  z-index: 5;
}

.project-content.visible {
  opacity: 1;
  transform: translateY(0);
  padding-top: 80px;
}

.content-section {
  margin-bottom: 100px;
}

.section-title {
  font-family: 'Inter', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  color: #666;
  margin: 0 0 48px 0;
  font-weight: 400;
  line-height: 1.6;
  max-width: 800px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
  margin-bottom: 80px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 32px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.feature-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  margin-bottom: 24px;
}

.feature-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 12px 0;
}

.feature-description {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: #666;
  margin: 0;
  line-height: 1.6;
}

.tech-showcase {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 24px;
  padding: 48px;
  margin: 48px 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.tech-item {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #1a1a1a;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tech-item:hover {
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-2px);
}

.code-showcase {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 32px;
  margin: 48px 0;
  position: relative;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.code-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f56;
}

.code-dot:nth-child(2) {
  background: #ffbd2e;
}

.code-dot:nth-child(3) {
  background: #27c93f;
}

.code-content {
  color: #e0e0e0;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin: 48px 0;
  text-align: center;
}

.stat-item {
  position: relative;
}

.stat-value {
  font-family: 'Inter', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: #667eea;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: #666;
  margin: 0;
}

.project-cta {
  display: flex;
  gap: 16px;
  margin-top: 64px;
  flex-wrap: wrap;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.cta-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
}

.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.cta-secondary {
  background: #ffffff;
  color: #667eea;
  border: 2px solid #667eea;
}

.cta-secondary:hover {
  background: #667eea;
  color: #ffffff;
}

/* Simple Top Navigation */
.project-nav {
  position: relative;
  background: #ffffff;
  padding: 24px 40px;
  border-bottom: 1px solid #e5e7eb;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-back:hover {
  color: #667eea;
}

.nav-back svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.nav-back:hover svg {
  transform: translateX(-4px);
}

/* Responsive Design */
/* Comprehensive mobile detail page fixes */
@media (max-width: 768px) {
  .project-hero {
    height: 100vh;
    min-height: 400px;
    margin: 0;
    border-radius: 0;
  }
  
  .project-hero.scrolled {
    height: 60vh;
    margin: 20px;
    border-radius: 24px;
  }
  
  .project-hero-content {
    padding: 60px 16px !important;
    max-width: 100% !important;
  }
  
  .project-hero-title {
    font-size: clamp(2rem, 8vw, 3.5rem) !important;
  }
  
  .project-hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.2rem) !important;
  }
  
  .project-content {
    padding: 60px 20px;
    max-width: 100% !important;
    overflow-x: hidden;
  }
  
  /* Fix all inline-styled grids for mobile */
  div[style*="grid-template-columns"],
  section[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    max-width: 100% !important;
  }
  
  /* Clean professional mobile hero layout */
  .project-hero-content[style*="grid-template-columns: 1fr 1fr"],
  .project-hero-content {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 80px 20px !important;
    text-align: left !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-height: 70vh !important;
  }
  
  /* Ensure all text elements align left */
  .project-hero-content h1,
  .project-hero-content p,
  .project-hero-content div {
    text-align: left !important;
  }
  
  /* Meta information styling */
  .project-hero-meta {
    margin-top: 24px !important;
    gap: 20px !important;
  }
  
  /* Move game previews below header on mobile */
  .project-hero-content > div:last-child {
    order: 2;
  }
  
  .project-hero-content > div:first-child {
    order: 1;
  }
  
  /* Hide previews in header on mobile */
  .project-hero-content .game-container,
  .project-hero-content .demo-container,
  .project-hero-content .live-preview-container,
  .project-hero-content #mandelbrot-container {
    display: none !important;
  }
  
  /* Mobile preview section below header */
  .mobile-preview-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 20px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .mobile-preview-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #333;
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .mobile-preview-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
  }
  
  .mobile-preview-toggle::after {
    content: '▼';
    margin-left: 8px;
    transition: transform 0.3s ease;
  }
  
  .mobile-preview-toggle.collapsed::after {
    transform: rotate(-90deg);
  }
  
  .mobile-preview-content {
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    transition: max-height 0.4s ease, padding 0.4s ease;
  }
  
  .mobile-preview-content.expanded {
    max-height: 600px;
    padding: 16px;
  }
  
  .mobile-preview-content .game-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 500px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    overflow: auto !important;
  }
  
  .mobile-preview-content .demo-container {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }
  
  .mobile-preview-content .live-preview-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 450px !important;
    margin: 0 !important;
  }
  
  /* Improve iframe error handling - remove shadows */
  .mobile-preview-content iframe,
  .live-preview-container iframe {
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: #f8f8f8 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
  }
  
  /* Remove shadows from preview containers */
  .mobile-preview-content .live-preview-container,
  .mobile-preview-content .live-preview-container * {
    box-shadow: none !important;
  }
  
  /* Hide external site errors on mobile */
  .mobile-preview-content iframe {
    pointer-events: auto;
    isolation: isolate;
  }
  
  /* Mobile preview functionality - automatically creates preview sections */
  .mobile-preview-section:not(.mobile-preview-processed) {
    display: none;
  }
  
  /* Fix wide padding on all sections */
  section[style*="padding: 80px 64px"],
  section[style*="padding: 80px 60px"],
  div[style*="padding: 80px 64px"],
  div[style*="padding: 80px 60px"],
  div[style*="padding: 100px 64px"] {
    padding: 40px 16px !important;
    max-width: 100% !important;
  }
  
  section[style*="padding: 60px"],
  div[style*="padding: 60px"] {
    padding: 30px 16px !important;
    max-width: 100% !important;
  }
  
  /* Fix game containers and demos */
  .game-container,
  div[style*="min-width"],
  iframe[style*="width"],
  canvas[style*="width"] {
    min-width: auto !important;
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
  }
  
  /* Fix code blocks */
  .code-block,
  .code-showcase,
  pre[style*="width"] {
    overflow-x: auto;
    max-width: calc(100vw - 32px) !important;
  }
  
  /* Fix network demo canvas */
  .network-canvas {
    width: 100% !important;
    height: 250px !important;
  }
}
  
  .features-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 0 16px;
  }
  
  .tech-showcase {
    padding: 24px 16px !important;
    margin: 24px 0 !important;
  }
  
  .tech-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
    gap: 12px !important;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 24px !important;
  }
  
  .stat-value {
    font-size: 2rem;
  }
  
  /* Fix feature cards */
  .feature-card {
    padding: 20px 16px !important;
    margin: 0 !important;
  }
  
  /* Fix code blocks responsiveness */
  .code-showcase {
    padding: 20px 16px !important;
    overflow-x: auto;
  }
  
  .code-content {
    font-size: 0.8rem !important;
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  .project-detail-content {
    grid-template-columns: 1fr;
  }
  
  .project-sidebar {
    display: none;
  }
  
  .project-main {
    padding: 80px 32px;
  }
  
  .project-title {
    font-size: 2.2rem;
  }
  
  .nav-back-mode {
    padding-left: 32px;
  }
}

/* === Clean PartyPass Styles === */
.partypass-clean {
  background: linear-gradient(135deg, #8B7355 0%, #A0826D 50%, #B8956A 100%);
  position: relative;
  color: white;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero-badge-clean {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 24px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.clean-title {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 300;
  color: white;
  margin: 0 0 32px 0;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.clean-subtitle {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  max-width: 600px;
  margin-bottom: 48px;
  font-weight: 300;
}

.hero-meta-clean {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 48px;
  padding: 32px 0;
  border-top: 1px solid rgba(255,255,255,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.meta-item {
  text-align: center;
}

.meta-label {
  display: block;
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.meta-value {
  display: block;
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 1rem;
  color: white;
  font-weight: 400;
}

.hero-action {
  margin-top: 16px;
}

.live-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 12px 24px;
  border-radius: 2px;
  text-decoration: none;
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  letter-spacing: 0.05em;
}

.live-link:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #90EE90;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.section-divider {
  padding: 40px 0;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.divider-line {
  height: 1px;
  background: #E5E5E5;
  max-width: 1200px;
  margin: 0 auto;
}

.project-content.clean {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: #2A2A2A;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.content-section-clean {
  padding: 80px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.content-section-clean.final {
  padding-bottom: 120px;
}

.section-container {
  max-width: 800px;
  margin: 0 auto;
}

.section-heading {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  color: #2A2A2A;
  margin: 0 0 32px 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-text {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 1.1rem;
  line-height: 1.7;
  color: #555;
  font-weight: 300;
  margin: 0;
}

.features-grid-clean {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 48px;
  margin-top: 64px;
}

.feature-item-clean {
  padding: 0;
}

.feature-title {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  color: #2A2A2A;
  margin: 0 0 16px 0;
  letter-spacing: -0.005em;
}

.feature-description {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #666;
  font-weight: 300;
  margin: 0;
}

.tech-stack-clean {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 48px;
  margin-top: 64px;
}

.tech-category-clean {
  padding: 0;
}

.tech-category-label {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: #2A2A2A;
  margin: 0 0 24px 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.tech-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tech-item-clean {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 0.95rem;
  color: #666;
  font-weight: 300;
  padding: 8px 0;
  border-bottom: 1px solid #F0F0F0;
}

.code-block-clean {
  background: #2A2A2A;
  border-radius: 4px;
  padding: 40px;
  margin-top: 40px;
  overflow-x: auto;
}

.code-content-clean {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #E8E8E8;
  margin: 0;
}

.code-comment-clean { color: #888; }
.code-decorator-clean { color: #8be9fd; }
.code-keyword-clean { color: #ff79c6; }

.impact-metrics-clean {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin-top: 64px;
}

.metric-clean {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid #E5E5E5;
}

.metric-number-clean {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 2.5rem;
  font-weight: 300;
  color: #8B7355;
  margin-bottom: 12px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.metric-label-clean {
  font-family: 'Icona Sans', 'Archivo', sans-serif;
  font-size: 0.9rem;
  color: #666;
  font-weight: 400;
  letter-spacing: 0.05em;
}

@media (max-width: 768px) {
  .hero-meta-clean {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  
  .content-section-clean {
    padding: 60px 40px;
  }
  
  .features-grid-clean,
  .tech-stack-clean {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .impact-metrics-clean {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  /* Targeted mobile overflow prevention */
  * {
    box-sizing: border-box !important;
  }
  
  body {
    overflow-x: visible;
  }
  
  /* Fix any inline grid styles that might overflow */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(300px"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(280px"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(250px"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  
  /* Fix wide containers */
  section[style*="max-width: 1200px"],
  section[style*="max-width: 1400px"] {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* === Keep Bottom Nav Styles === */
.nav-back-mode {
  display: none;
}

/* === PartyPass Card Animation === */
.partypass-card {
  position: relative;
  overflow: hidden;
  background-image: url('images/light-party.png');
  background-size: cover;
  background-position: center;
}

/* Subtle depth effect with gentle glow */
.partypass-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.1) 40%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.3);
  transition: all 1s ease-out;
  z-index: 2;
  pointer-events: none;
}

.partypass-card.animate::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(3);
  animation: gentlePulse 6s infinite ease-in-out;
}

@keyframes gentlePulse {
  0%, 100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(3);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(3.5);
  }
}

/* Smooth scrolling and performance optimizations */
html {
  scroll-behavior: smooth;
}



html, body {
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
  overflow-x: visible;
  width: 100%;
}

/* Performance optimizations for Safari */
.background-overlay,
.background-gradient {
  contain: layout style;
  will-change: auto;
}

.project-card,
.nav-item {
  contain: layout style paint;
  will-change: transform;
  transform: translateZ(0);
}

.project-grid {
  contain: layout;
}

/* Remove unnecessary will-change from non-animated elements */
.project-card-wrapper,
.partypass-card,
.live-preview-container {
  will-change: auto;
}

/* Touch interaction optimizations */
@media (hover: hover) and (pointer: fine) {
  /* Desktop hover effects only */
  .project-card:hover {
    transform: translateY(-4px);
  }
  
  .social-icon:hover {
    transform: scale(1.05);
  }
  
  .nav-item:hover {
    color: rgba(255, 255, 255, 0.85);
  }
}

@media (hover: none) and (pointer: coarse) {
  /* Mobile touch optimizations */
  .project-card {
    transition: transform 0.1s ease;
  }
  
  .project-card:active {
    transform: scale(0.98);
  }
  
  .nav-item:active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
  }
  
  .social-links a:active {
    background-color: rgba(0, 0, 0, 0.1);
  }
}

/* Targeted transitions for interactive elements */
.interactive,
.project-card,
.nav-item,
.social-links a,
.animated-icon {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Live preview responsive sizing */
.live-preview-container {
  transition: all 0.8s ease-in-out;
}

.project-hero.scrolled .live-preview-container {
  max-width: 600px !important;
  height: 400px !important;
}

.project-hero.scrolled .live-preview-container .browser-chrome {
  border-radius: 12px 12px 0 0 !important;
  padding: 12px 16px !important;
  gap: 8px !important;
}

.project-hero.scrolled .live-preview-container .browser-chrome > div[style*="width: 16px"] {
  width: 12px !important;
  height: 12px !important;
}

.project-hero.scrolled .live-preview-container .browser-chrome > div[style*="margin-left: 20px"] {
  margin-left: 16px !important;
  border-radius: 6px !important;
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
}

.project-hero.scrolled .live-preview-container .preview-frame {
  height: 360px !important;
  border-radius: 0 0 12px 12px !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important;
}

.project-hero.scrolled .live-preview-container .preview-overlay {
  border-radius: 12px !important;
}

/* Hide preview when scrolling */
.project-hero.hide-preview .live-preview-container {
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease-in-out;
}

/* Small mobile optimizations */
@media (max-width: 480px) {
  .project-card {
    aspect-ratio: 1.2; /* Slightly taller for better mobile viewing */
    border-radius: 12px;
  }
  
  .project-caption {
    font-size: 0.8rem;
  }
  
  .project-caption-bar .caption-left {
    font-size: 0.85rem;
  }
  
  .project-caption-bar .caption-center,
  .project-caption-bar .caption-right {
    font-size: 0.7rem;
  }
}

/* ===== CONSOLIDATED MOBILE STYLES (max-width: 768px) ===== */
@media (max-width: 768px) {
  
  /* === GLOBAL LAYOUT === */
  body {
    background: none !important;
    overflow-x: visible;
  }
  
  html {
    scroll-behavior: auto;
  }
  
  .left-indent {
    padding-left: 16px;
  }
  
  .container {
    padding-top: 40px;
  }
  
  /* === SAFARI-PROOF BACKGROUND POSITIONING === */
  .background-overlay,
  .background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for mobile browsers */
    background-attachment: scroll; /* Force scroll instead of fixed for better mobile compatibility */
    /* Ensure no clipping on Safari */
    right: 0;
    bottom: 0;
  }
  
  /* === PERFORMANCE: DISABLE BACKDROP FILTERS ON MOBILE === */
  * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  /* === HEADER === */
  .header {
    padding: 8px 16px 4px 16px;
  }
  
  .header-name {
    font-size: 0.85rem;
  }
  
  .copywrite {
    font-size: 0.7rem;
  }
  
  /* === NAVIGATION === */
  .bottom-nav {
    bottom: 16px !important;
    left: 16px !important;
    right: 16px !important;
    transform: none !important;
    width: auto !important;
    padding: 8px 16px !important;
    justify-content: space-between !important;
    max-width: calc(100vw - 32px);
    font-size: 0.8rem;
  }
  
  /* Back navigation on detail pages - keep centered and compact */
  .detail-page .bottom-nav,
  .project-page .bottom-nav {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    min-width: 140px !important;
    max-width: none !important;
    justify-content: center !important;
    padding: 8px 16px !important;
    white-space: nowrap !important;
  }
  
  .nav-item {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .nav-item.active::after {
    bottom: -6px;
  }
  
  /* === SOCIAL ICONS === */
  .social-links {
    gap: 4px;
    margin: 0 8px 0 auto;
    justify-content: flex-end;
    width: auto;
    padding-right: 0;
  }
  
  .animated-icon {
    width: 18px;
    height: 18px;
  }
  
  /* === PROJECTS === */
  .projects {
    margin-top: 40px;
    padding: 0 16px 120px; /* More bottom padding for better spacing */
  }
  
  .project-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: none;
    margin: 0;
  }
  
  .project-card {
    height: 280px;
    border-radius: 12px;
    transition: transform 0.1s ease;
  }
  
  .project-card:active {
    transform: scale(0.98);
  }
  
  .project-caption {
    font-size: 0.8rem;
    margin-top: 8px;
    line-height: 1.4;
  }
  
  /* Specific adjustment for illegal empire podcast caption */
  .project-card-wrapper:nth-child(6) .project-caption {
    margin-top: 24px;
  }
  
  /* Hide project name for illegal empire podcast on mobile only since title is in the card */
  @media (max-width: 768px) {
    .project-card-wrapper:nth-child(6) .project-caption .caption-left {
      opacity: 0;
    }
  }
  
  /* === DETAIL PAGES === */
  .detail-container {
    padding: 20px;
    margin-top: 20px;
  }
  
  .project-detail {
    padding: 20px;
  }
  
  .back-to-portfolio {
    text-align: center;
    font-size: 0.9rem;
    padding: 10px 20px;
  }
  
  /* === INTRO === */
  .intro {
    margin-top: 20px;
    padding: 0 16px;
    font-size: 0.9rem;
  }
  
  /* === TOUCH OPTIMIZATIONS === */
  .nav-item:active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
  }
  
  .social-links a:active {
    background-color: rgba(0, 0, 0, 0.1);
  }
}

/* === iOS SAFARI SPECIFIC BACKGROUND FIXES === */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari specific - Make background scroll with content to prevent white gaps */
  @media screen and (max-device-width: 768px) {
    .background-overlay {
      position: absolute !important; /* Move with content, not fixed */
      top: 0 !important;
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      min-height: 100% !important;
      height: 100% !important; /* Match content height */
      background-image: url('images/persian.jpg') !important;
      background-size: 100% auto !important;
      background-position: top center !important;
      background-repeat: repeat-y !important; /* Repeat vertically if needed */
      background-attachment: scroll !important;
    }
    
    .background-gradient {
      position: absolute !important; /* Move with content, not fixed */
      top: 0 !important;
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      min-height: 100% !important;
      height: 100% !important; /* Match content height */
      background-attachment: scroll !important;
    }
    
    /* Make sure body has enough height for background */
    body {
      position: relative;
      min-height: 100vh;
    }
  }
}
