/*
============================================
=        Models/References Page            =
============================================
*/
main {
  background-color: var(--togichu-black);
  min-height: 100vh;
}

.models-container {
  background-color: var(--togichu-black);
  padding: 2rem 1.5rem;
}

.models-hero {
  max-width: 1280px;
  margin: 0 auto 4rem;
}

.models-header {
  text-align: center;
  margin-bottom: 3rem;
}

.models-title {
  font-family: var(--font-grotesk);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--togichu-magenta);
  margin-bottom: 0.5rem;
}

.models-subtitle {
  font-family: var(--font-grotesk);
  font-size: 1.375rem;
  color: #32b8c6;
  font-weight: 500;
  margin: 0;
}

.models-grid-section {
  max-width: 1400px;
  margin: 0 auto;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.model-card-wrapper {
  cursor: pointer;
}

.model-card {
  border-radius: 0.75rem;
  border: 1px solid rgba(223, 64, 120, 0.2);
  background-color: #262828;
  overflow: hidden;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  outline: none;
}

.model-card:hover {
  border-color: rgba(223, 64, 120, 0.5);
  box-shadow: 0 0 20px rgba(223, 64, 120, 0.3);
}

.model-image-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
}

.model-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  display: block;
}

.model-card:hover .model-image {
  transform: scale(1.1);
}

.model-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.model-name {
  font-family: var(--font-grotesk);
  font-size: 1.125rem;
  font-weight: 600;
  color: #32b8c6;
  margin: 0;
}

.model-description {
  font-size: 0.875rem;
  color: #a7a9a9;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.model-gallery-data {
  display: none !important;
}

.model-credits-data {
  display: none !important;
}

.models-loading,
.models-error,
.models-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: #a7a9a9;
  font-size: 1.125rem;
  font-family: var(--font-mono);
}

/*
============================================
=              Modal Styles                =
============================================
*/
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

/* Hidden by default; JS toggles this */
.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: #262828;
  border-radius: 16px;
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(223, 64, 120, 0.15);
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  font-size: 20px;
}

.modal-close:hover {
  background: rgba(223, 64, 120, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  padding: 2rem;
}

.modal-thumbnail {
  position: relative;
  width: 100%;
  height: 500px;
  border-radius: 12px;
  overflow: hidden;
}

.modal-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-title {
  font-family: var(--font-grotesk);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--togichu-magenta);
  margin: 0;
  line-height: 1.2;
}

.modal-description {
  font-size: 1rem;
  color: #a7a9a9;
  margin: 0;
  line-height: 1.6;
}

.modal-info-item {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.75rem 0;
}

.modal-label {
  color: #32b8c6;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  min-width: 70px;
}

.modal-value {
  color: #fff;
  font-size: 0.95rem;
}

/* Credits */
.modal-credits {
  max-width: 25rem;
}

.modal-credits-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #32b8c6;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.modal-credits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-credit-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  text-decoration: none;
  color: inherit;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.modal-credit-link:hover {
  background: rgba(50, 184, 198, 0.15);
}

.modal-credit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  background: rgba(50, 184, 198, 0.08);
  border-left: 3px solid #32b8c6;
  border-radius: 4px;
  cursor: default;
}

.modal-credit-item:has(.modal-credit-link) {
  cursor: pointer;
  padding: 0;
}

.modal-credit-name {
  font-weight: 600;
  color: #f5f5f5;
  flex: 1;
}

.modal-credit-role {
  color: #32b8c6;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  background: rgba(50, 184, 198, 0.15);
  border-radius: 3px;
  flex-shrink: 0;
}

/* Gallery - Full Width Below */
.modal-gallery {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0 2rem 2rem 2rem;
  margin-top: 1rem;
}

.modal-gallery-carousel {
  position: relative;
  width: 100%;
  height: 350px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(223, 64, 120, 0.15);
}

.modal-gallery-image-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-gallery-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.9));
  color: white;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  margin: 0;
  z-index: 5;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(50, 184, 198, 0.3);
  color: #32b8c6;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  font-size: 22px;
}

.modal-gallery-arrow:hover {
  background: rgba(50, 184, 198, 0.25);
  border-color: #32b8c6;
  transform: translateY(-50%) scale(1.1);
}

.modal-gallery-arrow-left {
  left: 1rem;
}

.modal-gallery-arrow-right {
  right: 1rem;
}

.modal-gallery-arrow.visible {
  opacity: 1;
}

.modal-gallery-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-gallery-counter {
  text-align: center;
  color: #a7a9a9;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/*
============================================
=           Lightbox Styles (unused)       =
============================================
*/
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.lightbox-content {
  position: relative;
  width: 90vw;
  height: 90vh;
  max-width: 1400px;
  max-height: 900px;
}

.lightbox-content img {
  width: 100%;
  height: 100%;
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.lightbox-close:hover {
  transform: scale(1.1);
}

.lightbox-caption {
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  color: white;
  text-align: center;
  font-size: 1rem;
  margin: 0;
  padding: 1rem;
}

@media (max-width: 1024px) {
  .models-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .modal-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .modal-gallery {
    grid-column: 1;
    padding: 0 1.5rem 1.5rem 1.5rem;
  }

  .modal-thumbnail {
    height: 400px;
  }

  .modal-credits {
    max-width: 100%;
  }

  .modal-gallery-carousel {
    height: 300px;
  }

  .modal-gallery-arrow {
    width: 40px;
    height: 40px;
  }

  .modal-content {
    padding: 1.5rem 0;
  }

  .models-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .models-title {
    font-size: 2rem;
  }
}
