/**
 * IDEO Project Modal & Grid Styles
 * 
 * Styling for:
 * - Project grid (responsive, hover states)
 * - Modal container and chrome
 * - Sticky close button
 * - One-pager carousel viewer
 * - Focus indicators and accessibility
 */

/* ========================================
   PROJECT GRID STYLES
   ======================================== */

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

@media (max-width: 768px) {
  .ideo-project-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .ideo-project-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Project Tile */
.ideo-project-tile {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

.ideo-project-tile:hover,
.ideo-project-tile:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .ideo-project-tile {
    transition: none;
  }
}

/* Tile Image */
.ideo-project-tile-image {
  position: relative;
  overflow: hidden;
  background-color: #f5f5f5;
  padding-bottom: 100%; /* 1:1 aspect ratio */
}

.ideo-project-tile-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease-out;
}

.ideo-project-tile:hover .ideo-project-tile-image img {
  transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
  .ideo-project-tile-image img {
    transition: none;
  }
}

/* Tile Overlay (subtle hover effect) */
.ideo-project-tile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(31, 199, 193, 0.05);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.ideo-project-tile:hover .ideo-project-tile-overlay {
  opacity: 1;
}

/* Tile Content */
.ideo-project-tile-content {
  padding: 1.25rem;
  background: #fff;
}

.ideo-project-tile-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: #1a1a1a;
  letter-spacing: -0.2px;
}

/* Focus indicator */
.ideo-project-tile:focus-visible {
  outline: 3px solid rgba(31, 199, 193, 0.3);
  outline-offset: 2px;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.ideo-project-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

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

.ideo-project-modal-content {
  background: #fff;
  border-radius: 6px;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ideo-project-modal-overlay,
  .ideo-project-modal-content {
    animation: none;
  }
}

@media (max-width: 768px) {
  .ideo-project-modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 0;
  }
}

/* Modal Chrome (header with close button) */
.ideo-project-modal-chrome {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

/* Close Button - STICKY */
.ideo-project-modal-close {
  position: sticky;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: color 0.2s ease-out;
  flex-shrink: 0;
}

.ideo-project-modal-close:hover,
.ideo-project-modal-close:focus {
  color: #1a1a1a;
  outline: none;
}

.ideo-project-modal-close:focus-visible {
  outline: 3px solid rgba(31, 199, 193, 0.3);
  outline-offset: 2px;
  border-radius: 4px;
}

.ideo-project-modal-close svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Modal Body */
.ideo-project-modal-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  padding: 2rem;
}

@media (max-width: 768px) {
  .ideo-project-modal-body {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .ideo-project-modal-body {
    padding: 1rem;
  }
}

/* Project Info */
.ideo-project-info {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.ideo-project-title {
  margin: 0 0 1rem 0;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.3;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

@media (max-width: 768px) {
  .ideo-project-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .ideo-project-title {
    font-size: 1.25rem;
  }
}

.ideo-project-footer {
  margin: 0;
  font-size: 0.875rem;
  color: #999;
  font-style: italic;
  line-height: 1.5;
}

/* ========================================
   ONE-PAGER CAROUSEL STYLES
   ======================================== */

.ideo-onepager-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.ideo-onepager-carousel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

/* Slides Container */
.carousel-slides-container {
  position: relative;
  flex: 1;
  background: linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-slide {
    transition: none;
  }
}

.carousel-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  border-radius: 2px;
}

/* Controls */
.carousel-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.5rem;
}

.carousel-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.2s ease-out;
  flex-shrink: 0;
}

.carousel-button:hover {
  border-color: #1fc7c1;
  color: #1fc7c1;
  background: rgba(31, 199, 193, 0.05);
}

.carousel-button:focus-visible {
  outline: 3px solid rgba(31, 199, 193, 0.3);
  outline-offset: 2px;
  border-radius: 4px;
}

.carousel-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Dots / Pagination */
.carousel-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.carousel-dot {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease-out;
  font-size: 0.75rem;
  color: #999;
  font-weight: 500;
}

.carousel-dot.active {
  background: #1fc7c1;
  border-color: #1fc7c1;
  color: #fff;
}

.carousel-dot:hover {
  border-color: #1fc7c1;
  color: #1fc7c1;
}

.carousel-dot:focus-visible {
  outline: 3px solid rgba(31, 199, 193, 0.3);
  outline-offset: 2px;
}

/* Slide Counter / Indicator */
.carousel-indicator {
  text-align: center;
  font-size: 0.875rem;
  color: #999;
  padding: 0.5rem 0;
}

.carousel-indicator span {
  color: #1a1a1a;
  font-weight: 500;
}

/* Responsive carousel */
@media (max-width: 768px) {
  .carousel-slides-container {
    min-height: 300px;
  }

  .carousel-controls {
    gap: 0.75rem;
  }

  .carousel-button {
    width: 40px;
    height: 40px;
  }

  .carousel-dot {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 480px) {
  .carousel-slides-container {
    min-height: 250px;
  }

  .carousel-controls {
    gap: 0.5rem;
  }

  .carousel-button {
    width: 36px;
    height: 36px;
  }

  .carousel-dot {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .carousel-indicator {
    font-size: 0.8rem;
  }
}

/* ========================================
   ACCESSIBILITY & FOCUS MANAGEMENT
   ======================================== */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .ideo-project-tile {
    border: 1px solid #1a1a1a;
  }

  .carousel-button,
  .carousel-dot {
    border-width: 2px;
  }

  .ideo-project-modal-close:focus-visible,
  .carousel-button:focus-visible,
  .carousel-dot:focus-visible,
  .ideo-project-tile:focus-visible {
    outline-width: 4px;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .ideo-project-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  .ideo-project-modal-content {
    background: #1a1a1a;
    color: #e0e0e0;
  }

  .ideo-project-tile {
    background: #2a2a2a;
  }

  .ideo-project-tile-content {
    background: #2a2a2a;
  }

  .ideo-project-tile-title {
    color: #e0e0e0;
  }

  .ideo-project-modal-chrome {
    border-bottom-color: #333;
  }

  .ideo-project-modal-close {
    color: #999;
  }

  .ideo-project-modal-close:hover {
    color: #e0e0e0;
  }

  .ideo-project-info {
    border-bottom-color: #333;
  }

  .ideo-project-title {
    color: #e0e0e0;
  }

  .ideo-project-footer {
    color: #666;
  }

  .carousel-slides-container {
    background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
  }

  .carousel-button,
  .carousel-dot {
    border-color: #444;
    background: #2a2a2a;
    color: #999;
  }

  .carousel-button:hover {
    border-color: #1fc7c1;
    background: rgba(31, 199, 193, 0.1);
  }

  .carousel-dot.active {
    background: #1fc7c1;
    border-color: #1fc7c1;
    color: #1a1a1a;
  }

  .carousel-indicator {
    color: #999;
  }

  .carousel-indicator span {
    color: #e0e0e0;
  }
}
