/* Portfolio page specific styles */
.portfolio-page {
  background: var(--bg);
  padding: 0;
}

/* Instagram-style grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 0;
  margin: 0;
}

.portfolio-item {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--card);
  width: 100%;
  height: auto;
}

/* Thumbnail placeholder and loading states */
.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  background: var(--card);
  position: relative;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.loading-shimmer {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #1a1a1a 25%,
    #2a2a2a 50%,
    #1a1a1a 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.thumbnail-placeholder.loaded .loading-shimmer {
  display: none;
}

.thumbnail-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.error-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 1.2em;
}

.portfolio-item:active {
  opacity: 0.8;
}

/* Fullscreen viewer optimizations */
.fullsize-placeholder {
  width: 100%;
  height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullsize-placeholder.loaded .loading-shimmer {
  display: none;
}

.fullsize-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

/* Full-screen viewer */
.fullscreen-viewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-viewer.active {
  display: block;
  opacity: 1;
}

.viewer-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 1001;
  pointer-events: none;
}

.viewer-back-btn {
  position: absolute;
  top: 20px;
  left: 16px;
  pointer-events: auto;
  background: var(--card);
  border: 1px solid var(--ring-weak);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.viewer-back-btn:active {
  background: var(--card-hover);
  transform: scale(.95);
}

.photo-scroll-container {
  height: 100vh;
  overflow-y: auto;
  padding-top: 0;
  margin-top: 0;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

.photo-item {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  scroll-snap-align: start;
  position: relative;
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
  }

  .viewer-header {
    height: 50px;
    padding: 0 16px;
  }

  .viewer-back-btn {
    font-size: 14px;
    padding: 8px 12px;
  }

  .photo-scroll-container {
    height: 100vh;
    margin-top: 0;
  }

  .photo-item {
    height: 100vh;
    padding: 0;
  }

  .fullsize-placeholder {
    height: 100vh;
  }
}
/* Loading indicator */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ring-weak);
  border-top: 3px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.loading-text {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
}
