/* Component-Specific Styling: Pills, Buttons, Cards and Grid */

/* Frosted Glass Pills and Buttons styling */
.nav-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 152px;
  height: 60px;
  background-color: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 9999px;
  padding: 4px;
  gap: 0px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 12px var(--shadow-color);
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 52px;
  border-radius: 9999px;
  color: var(--text-color);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Navigation button active state style */
.nav-button.active {
  background-color: color-mix(in srgb, var(--text-color) 5%, transparent);
}

/* Standalone Theme Toggle Pill */
.theme-toggle-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 60px;
  border-radius: 9999px;
  background-color: var(--pill-bg);
  border: 1px solid var(--pill-border);
  color: var(--text-color);
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 12px var(--shadow-color);
  position: relative;
}

.theme-toggle-pill svg {
  position: absolute;
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-transitioning .theme-toggle-pill svg {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Toggle sun and moon icon visibility based on active theme with scale transitions */
[data-theme="light"] .theme-toggle-pill .sun-icon {
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
}
[data-theme="light"] .theme-toggle-pill .moon-icon {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

[data-theme="dark"] .theme-toggle-pill .sun-icon {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
[data-theme="dark"] .theme-toggle-pill .moon-icon {
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
}

/* Accessible outline for Pills and Buttons */
.nav-button:focus-visible,
.theme-toggle-pill:focus-visible,
.project-card:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 4px;
}

/* Projects Grid Layout */
.projects-grid {
  display: grid;
  gap: 40px;
  width: 100%;
}

/* Strict Column Breaks */
@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 639px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* Project Card Structure */
.project-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  outline: none;
}

/* Fixed 5:6 vertical aspect ratio image container */
.card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 6;
  background-color: var(--card-bg);
  border: none;
  border-radius: 40px;
  padding: 40px; /* Inset padding to keep images 40px away from card edges */
  overflow: hidden; /* Clip growing image and overlay */
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.3, 0, 0.3, 1);
}

/* Hover effects for Desktop & Mouse only */
@media (hover: hover) {
  .project-card:hover .card-image-wrapper img {
    transform: scale(1.04);
  }
}

/* Accessibility: Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .project-card:hover .card-image-wrapper img {
    transform: none !important;
  }
}

/* Touchscreen / Mobile constraints */
@media (max-width: 639px) or (hover: none) {
  /* Disable scale-up grow on mobile hover states */
  .project-card:hover .card-image-wrapper img {
    transform: none !important;
  }
}

/* Project Detail Page Styling */
.project-detail {
  width: 100%;
  padding: 0 0 40px 0;
}

.page-header {
  margin-top: 60px;
  margin-bottom: 48px;
}

.page-header h1 {
  font-size: 2.75rem;
  margin-bottom: 0;
}

.project-desc {
  font-size: 1.25rem;
  opacity: 0.7;
}

/* 1-9.png Images Grid */
.project-images-grid {
  display: grid;
  gap: 40px;
  margin-bottom: 60px;
}

/* Grid Breakpoints */
@media (min-width: 1024px) {
  .project-images-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .project-images-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 639px) {
  .project-images-grid {
    grid-template-columns: 1fr;
  }
}

/* 5:6 thumbnail slots on project detail page */
.project-image-item {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 6;
  background-color: var(--card-bg);
  border: none;
  border-radius: 40px;
  padding: 40px; /* 40px padding matching main cards */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-image-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
}

.project-content {
  margin-top: 48px;
  border-top: 1px solid var(--card-border);
  padding-top: 48px;
}

