.catalog-panel {
  position: fixed;
  left: 0;
  top: -100%;
  width: 100%;
  height: 100%;
  background: var(--card);
  z-index: 1000;
  transition: top 0.4s ease-out;
  display: flex;
  flex-direction: column;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.catalog-panel.active {
  top: 0;
  pointer-events: auto;
}

.catalog-header {
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--muted);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Убираем крупную подпись (оставляем центр) */
.catalog-header h2 {
  display: none;
}

.search-box {
  position: relative;
  width: 100%;
  justify-self: start;
  width: 100%;
  margin-left: -22px;
}

#studio-search {
  width: 100%;
  padding: 8px 15px 8px 30px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
}

#studio-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 65, 108, 0.2);
}

.close-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

/* Fonts grid and previews */
.font-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--card);
  margin-bottom: 12px;
}

.font-preview {
  height: 180px;
  width: 100%;
  object-fit: contain;
  border-bottom: none;
  padding-bottom: 0;
  transform: scale(1.2);
  transform-origin: left;
  overflow-x: hidden;
}

/* Стили для разделителя и текста под превью (если понадобится) */
.font-separator {
  width: 75%;
  height: 1px;
  background: transparent; /* скрыть по умолчанию */
  margin: 10px auto;
}

.font-description {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--secondary);
  word-break: break-word;
  hyphens: auto;  
}

.font-keywords {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Fonts header */
.fonts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20 !important;
  background: var(--card) !important;
  padding: 12px 20px !important;
  border-bottom: 2px solid var(--muted) !important;
  
}

/* Align buttons */
.align-buttons{ display:flex; gap:8px; }
.align-btn{ flex:1; min-width:auto; padding:6px; display:flex; align-items:center; justify-content:center; }
.align-btn svg{ width:18px; height:18px; }
.align-btn.active{ background:var(--accent-dark); color:white; border-color:var(--accent-dark); }

/* Glyphs navigation */
#glyphs-navigation{ display:flex; align-items:center; gap:10px; margin-left:15px; padding:4px 10px; background: rgba(255,255,255,0.1); border-radius:20px; border:1px solid rgba(255,255,255,0.2); }
.hidden{ display:none !important; }



.close-btn:hover {
  background: var(--accent);
  color: white;
}

.catalog-content {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 400px 1fr;
  overflow: hidden;
  min-height: 0;
  overflow-x: hidden;  
}

.studio-list {
  border-right: 1px solid var(--muted);
  overflow-y: auto;
  background: var(--primary);
  max-width: 400px;
  width: 100%;
}

.studio-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--muted);
  cursor: pointer;
  /* 4. Увеличить шрифт в 1.5 раза */
  font-size: 1.4rem;
  transition: background 0.2s ease;
  /* 3. Осветлить на 50% */
  background: rgba(255, 255, 255, 0.5);
}

.studio-row:hover {
  background: rgba(255, 65, 108, 0.15);
}

.studio-row.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.studio-details {
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--muted);
  max-width: 400px;
  width: 100%;
  overflow-x: hidden;  
}

.studio-details h3 {
  /* 5. Поднять имя выше */
  margin-top: -3px;
  color: var(--accent);
  /* 6. Одинаковый размер шрифта */
  font-size: 1.4rem;
  /* 6. Выравнивание по высоте */
  line-height: 1.2;
}

.studio-details p {
  font-size: 1.2rem;
  line-height: 1.4;
  white-space: pre-wrap;
  margin-bottom: 30px;
  word-break: break-word;
  hyphens: auto;
}

.studio-details .actions {
  margin-top: 40px;
}

.studio-details .actions button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  position: relative;
  top: -3px;
}

.studio-details .actions button:hover {
  background: var(--accent-dark);
}

.studio-fonts {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;  
  padding-top: 0px !important;
}

.studio-fonts h3 {
  /* 6. Уменьшить пространство над заголовком */
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--accent);
  /* 6. Одинаковый размер шрифта */
  font-size: 1.4rem;
  /* 6. Выравнивание по высоте */
  line-height: 1.2;
}

.fonts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.font-name {
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
}

.no-selection {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* 6. Выравниваем размер и положение */
.fonts-header h3 {
  font-size: 1.425rem; /* Совпадает с другими */
  font-weight: 600;
  color: var(--accent);
  margin: 0;
  line-height: 1.2; /* Совпадает с другими */
  position: relative;
  top: -3px;
}

.try-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  position: relative;
  top: -5px;
}

.try-btn:hover {
  background: var(--accent-dark);
}



/* Добавляем отступ под заголовком студии */
.studio-details h3 {
  margin-bottom: 20px;
}

/* Стили для разделителя и текста под превью */
.font-separator {
  width: 75%;
  height: 1px;
  background: var(--muted);
  margin: 10px auto;
}

.font-description {
  font-size: 0.9rem;
  text-align: left;
  margin-bottom: 5px;
}

.font-keywords {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: left;
}

/* Сдвигаем превью вниз */
.font-item {
  padding-top: 20px;
  cursor: pointer; /* Добавляем указатель для кликабельности */
}

.font-family {
    margin-bottom: 20px;
    border: 1px solid var(--muted);
    border-radius: 8px;
    overflow: hidden;
}

.font-family-header {
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--muted);
}

.font-family-header h4 {
    margin: 0 0 5px 0;
    color: var(--accent);
    font-size: 1.2rem;
}

.font-family-description {
    font-size: 0.9rem;
    color: var(--secondary);
}

.font-family-fonts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 15px;
}

.font-child {
    transform: scale(0.9);
    opacity: 0.9;
}

.font-child:hover {
    transform: scale(0.97);
    opacity: 1;
}

/* Заменяем существующий медиа-запрос на 1080px */
@media (max-width: 1080px) {
  .catalog-content {
    grid-template-columns: 2fr;
    height: 100vh; /* Добавляем явную высоту */
  }
  
  .studio-list, .studio-details {
    max-width: 100%;
    max-height: 30vh; /* Уменьшаем максимальную высоту */
    border-right: none;
    border-bottom: 1px solid var(--muted);
  }
  
  .studio-fonts {
    grid-column: 1;
    grid-row: 3;
    min-height: 40vh; /* Гарантируем минимальную высоту */
    height: 100%;
  }

  .catalog-header {
    grid-template-columns: 1fr auto; /* Меняем на 2 колонки */
    gap: 10px;
    padding: 8px 15px;
  }

  /* Скрываем заголовок на мобильных */
  .catalog-header h2 {
    display: none;
  }

  /* Поисковая строка занимает всё доступное пространство */
  .search-box {
    margin-left: 0;
    width: 100%;
    grid-column: 1;
  }

  /* Кнопка закрытия */
  .header-actions {
    grid-column: 2;
    display: flex;
    align-items: center;
  }

  /* Увеличиваем область клика для кнопки */
  .close-btn {
    width: 44px;
    height: 44px;
    padding: 8px;
  }

}
