/* ===========================
   Основные переменные и темы
=========================== */
:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --card: #f9fafb;
}

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s, color 0.25s;
}

body.dark {
  --bg: #0b1220;
  --text: #e6eef8;
  --muted: #9aa6b2;
  --card: #071025;
}

/* ===========================
   Header и навигация
=========================== */
header {
  background: linear-gradient(90deg, #0f172a, #0066ff);
  color: #fff;
  padding: 18px 12px;
  text-align: center;
}

nav {
  margin-top: 8px;
}

nav a {
  color: rgba(255, 255, 255, 0.95);
  margin: 0 8px;
  text-decoration: none;
  font-weight: 600;
}

#theme-toggle {
  margin-left: 12px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* ===========================
   Галерея и карточки
=========================== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.08);
  text-align: left;
}

.card img {
  width: 100%;
  height: 220px;           /* фиксированная высота */
  object-fit: cover;        /* центрирование и обрезка краёв */
  object-position: center;  
  display: block;
  background: #ddd;
}

.card img.noimg {
  display: none;
}

.card h2 {
  margin: 16px auto;
  padding: 0 16px;
  font-size: 20px;
  text-align: center;       /* заголовки по центру */
}

.desc {
  padding: 0 16px 20px;
}

.desc p {
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 10px;
  max-height: 100px;       /* для кнопки "Читать больше" */
  overflow: hidden;
  transition: max-height 0.25s;
}

.readmore {
  background: #0b1220;
  color: #fff;
  border: 0;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

/* ===========================
   Контент общий
=========================== */
.content {
  max-width: 900px;
  margin: 28px auto;
  padding: 0 16px;
  text-align: center;       /* центр текста */
}

/* ===========================
   Контактная форма
=========================== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.contact-form label {
  font-weight: 500;
  color: var(--text);
  text-align: left;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: #0066ff;
}

.contact-form button {
  background: #0b1220;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.25s;
}

.contact-form button:hover {
  background: #0066ff;
}

/* ===========================
   Footer
=========================== */
footer {
  background: #071025;
  color: #fff;
  text-align: center;
  padding: 14px;
  margin-top: 24px;
}

/* ===========================
   Адаптивность
=========================== */
@media (max-width: 420px) {
  .card img {
    height: 160px;
  }
  
  .content {
    padding: 0 12px;
  }
}
