/* Project 5 specific styles */
/* Animation components for Visual Anagrams and Hybrid Images */

/* =========================
   Visual Anagrams Grid
   ========================= */
.anagrams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  margin: 2rem auto;
  max-width: 1000px;
  padding: 10px 10px;
}

.anagram-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.anagram-frame {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-line);
  background: var(--content-bg);
  contain: layout;
}

[data-theme="dark"] .anagram-frame {
  background: #0d1117;
  border-color: #30363d;
}

.anagram-frame img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  background: transparent;
  contain: layout;
  backface-visibility: hidden;
}

/* Rotation animation states */
.anagram-frame.rotate-180 img {
  transform: rotate(180deg);
}

.anagram-frame.rotate-90 img {
  transform: rotate(90deg);
}

.anagram-frame.rotate-270 img {
  transform: rotate(270deg);
}

.anagram-frame.flip-h img {
  transform: scaleX(-1);
}

.anagram-frame.flip-v img {
  transform: scaleY(-1);
}

/* Prompt display with fade transition */
.anagram-prompts {
  text-align: center;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  position: relative;
  width: 100%;
}

.anagram-prompt {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  opacity: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  transition: opacity 0.5s ease;
  white-space: normal;
  max-width: 100%;
}

[data-theme="dark"] .anagram-prompt {
  color: #8b949e;
}

.anagram-prompt.active {
  opacity: 1;
}

.anagram-prompt strong {
  color: var(--link);
  font-weight: 600;
}

[data-theme="dark"] .anagram-prompt strong {
  color: #58a6ff;
}

/* Mobile adjustments */
@media (max-width: 680px) {
  .anagrams-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 20px 10px;
  }

  .anagram-frame {
    max-width: 100%;
  }

  .anagram-prompt {
    font-size: 0.85rem;
  }
}

/* Pause animation on hover */
.anagram-item:hover .anagram-frame img {
  animation-play-state: paused;
}

/* =========================
   Hybrid Images Grid
   ========================= */
.hybrids-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  margin: 2rem auto;
  max-width: 1000px;
  padding: 10px 10px;
}

.hybrid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.hybrid-frame {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-line);
  background: var(--content-bg);
  contain: layout;
}

[data-theme="dark"] .hybrid-frame {
  background: #0d1117;
  border-color: #30363d;
}

.hybrid-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  background: transparent;
  contain: layout;
  backface-visibility: hidden;
}

/* Zoom animation states */
.hybrid-frame.zoom-in img {
  transform: scale(1.8);
}

.hybrid-frame.zoom-out img {
  transform: scale(0.1);
}

/* Prompt display with fade transition */
.hybrid-prompts {
  text-align: center;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  position: relative;
  width: 100%;
}

.hybrid-prompt {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  opacity: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  transition: opacity 0.5s ease;
  white-space: normal;
  max-width: 100%;
}

[data-theme="dark"] .hybrid-prompt {
  color: #8b949e;
}

.hybrid-prompt.active {
  opacity: 1;
}

.hybrid-prompt strong {
  color: var(--link);
  font-weight: 600;
}

[data-theme="dark"] .hybrid-prompt strong {
  color: #58a6ff;
}

/* Mobile adjustments */
@media (max-width: 680px) {
  .hybrids-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 20px 10px;
  }

  .hybrid-frame {
    max-width: 100%;
  }

  .hybrid-prompt {
    font-size: 0.85rem;
  }
}

/* Pause animation on hover */
.hybrid-item:hover .hybrid-frame img {
  animation-play-state: paused;
}

/* =========================
   Scrollbar fix for proj_5
   ========================= */
html {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

body {
  min-height: 100%;
  overflow: hidden;
}

main.with-sidebar {
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  overflow-x: hidden;
}

.main-center {
  overflow: visible;
}
