@font-face {
  font-family: 'Eitai';
  src: url('fonts/Eitai.otf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {  height: 100%;}

body {
  font-family: 'Eitai', Eitai;
  background: #f2f2f2;
  color: #222;

  display: flex;
  flex-direction: column;
}

.topbar {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #d7d7d7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 36px;
}


.logo img {
  height: 55px;
  display: block;
}


.main-nav {
  display: flex;
  gap: 28px;
}

.main-nav a {
  text-decoration: none;
  color: #333;
  font-size: 15px;
  transition: 0.2s ease;
}

.main-nav a:hover {
  color: #2b8ac6;
}

.header-actions .join-btn {
  background: #49a6df;
  border: none;
  color: white;
  padding: 12px 26px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.header-actions .join-btn:hover {
  background: #2f96d6;
}

.category-bar {
  background: #2a2a2a;
  color: white;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 36px;
  font-size: 14px;
}

.category-bar a {
  color: #d9d9d9;
  text-decoration: none;
  transition: 0.2s;
}

.category-bar a:hover {
  color: white;
}

.page-content {
  max-width: 1800px;
  margin: 0 auto;
  padding: 30px 24px 50px;
  flex: 1;
}

.section-title {
  text-align: center;
  margin-bottom: 28px;
}

.section-title h1 {
  font-size: 34px;
  margin-bottom: 8px;
}

.section-title p {
  font-size: 16px;
  color: #666;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(5,  1fr);
  gap: 22px;
}

.model-card {
  background: white;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  transition: 0.2s ease;
}

.model-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.card-image {
  width: 100%;
  height: 220px;
  background: #ececec;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 16px;
}

.card-author {
  font-size: 13px;
  color: #6ea8c4;
  margin-bottom: 10px;
}

.card-body h3 {
  font-size: 19px;
  margin-bottom: 8px;
}

.card-body p {
  font-size: 14px;
  line-height: 1.5;
  color: #555;
  margin-bottom: 16px;
  min-height: 42px;
}

.card-body button {
  width: 100%;
  background: #0a8d26;
  color: white;
  border: none;
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Eitai', Eitai;
  cursor: pointer;
}

.card-body button:hover {
  background: #016619;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal.hidden .modal-overlay {
  opacity: 0;
}

.modal-content {
  position: relative;
  width: 92vw;
  height: 88vh;
  max-width: 1600px;
  margin: 4vh auto;

  background: #ffffff;
  border-radius: 20px;
  padding: 16px;

  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  z-index: 2;

  display: flex;
  flex-direction: column;

  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.modal-body {
  min-height: 0;
}

.modal-side-panel {
  min-height: 0;
  overflow-y: auto;
}

.modal-viewer-wrapper {
  min-height: 0;
}

.modal.hidden .modal-content {
  transform: translateY(40px) scale(0.96);
  opacity: 0;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  font-size: 28px;
  cursor: pointer;
}

.modal-close:hover {
  background: #e2e2e2;
}

.modal-header {
  margin-bottom: 10px;
  flex-shrink: 0;
  
}

.modal-header h2 {
  font-size: 40px;
  color: #222;
  text-align: center;
}

.modal-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  height: 100%;
  align-items: stretch;
}

.modal-side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.modal-description {
  background: #f7f7f7;
  border-radius: 14px;
  padding: 24px;

  font-size: 20px;     
  line-height: 1.9;   
  text-align: justify;

  color: #333;
}

.controls-box {
  background: #ffffff;
  border: 2px solid #dcdcdc;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  min-height: 140px;
}

.controls-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #2b8ac6;
}

.control-item {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 6px;
  color: #333;
}

.control-item:last-child {
  margin-bottom: 0;
}

.modal-viewer-wrapper {
  background: #f3f3f3;
  border-radius: 16px;
  padding: 10px;

  height: 100%;
}

.modal-viewer {
  width: 100%;
  height: 100%; /* теперь занимает всю высоту */
  background: #dcdcdc;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

.modal-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: #444;
}

.open-model-btn {
  width: 100%;
  background: #7cc44d;
  color: white;
  border: none;
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.open-model-btn:hover {
  background: #6ab33d;
}


.download-model-btn {
  width: 100%;
  background: #0a8d26;
  color: white;
  border: none;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  font-family: 'Eitai', Eitai;
  cursor: pointer;
  transition: 0.2s ease;
  margin-top: auto;
  flex-shrink: 0;
}

.download-model-btn:hover {
  background: #016619;
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-content {
    height: 95vh;
  }

  .modal-viewer {
    height: 300px;
  }


.controls-box {
  margin-top: 20px;

  background: linear-gradient(145deg, #ffffff, #f3f3f3);
  border: 1px solid #dcdcdc;
  border-radius: 12px;

  padding: 18px;

  box-shadow:
    0 10px 25px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.6);
}
.controls-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.control-item {
  font-size: 15px;
  margin-bottom: 6px;
}

.controls-box:hover {
  transform: translateY(-2px);
  transition: 0.2s;
}

}

.footer {
  width: 100%;
  background: #2a2a2a;
  color: white;
  margin-top: 40px;
}

.footer-content {
  max-width: 1800px;
  margin: 0 auto;
  padding: 20px 24px;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  font-size: 20px;
  font-weight: bold;
  color: #7cc44d;
}

.footer-text {
  font-size: 14px;
  color: #ccc;
}
 

#infoModal .modal-body {
  font-size: 30px;
  line-height: 1.8;
}

/* Оптимизация под разные экраны */

/* Планшеты */
@media (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal-content {
    width: 96vw;
    height: 94vh;
  }

  .modal-body {
    grid-template-columns: 1.5fr 1fr;
  }
}

/* Небольшие планшеты */
@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    padding: 14px 20px;
  }

  .logo img {
    height: 45px;
  }

  .modal-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .modal-content {
    width: 96vw;
    height: 96vh;
    padding: 14px;
  }

  .modal-header h2 {
    font-size: 28px;
  }

  .modal-viewer {
    height: 320px;
  }

  .modal-description {
    font-size: 16px;
    line-height: 1.6;
  }
}

/* Телефоны */
@media (max-width: 600px) {
  .page-content {
    padding: 20px 14px 40px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .section-title h1 {
    font-size: 26px;
  }

  .card-image {
    height: 200px;
  }

  .modal-content {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .modal-close {
    top: 10px;
    right: 10px;
  }

  .modal-viewer {
    height: 280px;
  }

  .footer-content {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* Очень маленькие телефоны */
@media (max-width: 380px) {
  .section-title h1 {
    font-size: 22px;
  }

  .card-body h3 {
    font-size: 18px;
  }

  .modal-header h2 {
    font-size: 24px;
  }

  .modal-viewer {
    height: 240px;
  }
}
/* Телефонная версия шапки */
@media (max-width: 600px) {
  .topbar {
    padding: 8px 12px;
  }

  .logo img {
    height: 32px;
  }

  .main-nav {
    gap: 10px;
  }

  .main-nav a {
    font-size: 11px;
  }

  .header-actions .join-btn {
    padding: 7px 10px;
    font-size: 11px;
  }

  .category-bar {
    padding: 8px 12px;
    gap: 10px;
    font-size: 11px;
    overflow-x: auto;
    white-space: nowrap;
  }
}