:root {
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-color: #2563eb;
  --gitverse-color: #00c354;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  padding: 50px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

header {
  text-align: center;
  margin-bottom: 50px;
  max-width: 600px;
}

header h1 {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Блок "О себе" */
.about-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  width: 100%;
  max-width: 1140px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 50px;
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.18), 0 6px 12px -2px rgba(15, 23, 42, 0.12);
}

.about-content {
  flex: 1;
}

.about-content h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.about-content p {
  color: var(--text-muted);
  font-size: 1.05rem;
  text-align: justify;
}

.about-photo-wrapper {
  flex-shrink: 0;
  width: 210px;
  aspect-ratio: 3 / 4;
}

.about-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .about-section {
    flex-direction: column-reverse;
    text-align: center;
    padding: 30px 20px;
  }

  .about-photo-wrapper {
    width: 200px;
    height: 200px;
  }

  .about-content p {
    text-align: center;
  }
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 30px;
  width: 100%;
  max-width: 1140px;
}

.project-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px 32px 48px; 
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.18), 0 6px 12px -2px rgba(15, 23, 42, 0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ИСПРАВЛЕНО: Объединены состояния ховера в одно надежное правило */
.project-card:hover { 
  transform: translateY(-12px); 
  box-shadow: 0 35px 50px -10px rgba(15, 23, 42, 0.28), 0 15px 25px -10px rgba(15, 23, 42, 0.18); 
  border-color: #94a3b8;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.project-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background-color: #eff6ff;
  color: var(--accent-color);
  border-radius: 12px;
}

.project-status-online {
  background-color: #f0fdf4;
  color: #16a34a;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.project-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}

.project-description {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px; 
  flex-grow: 1;
  text-align: justify;
}

/* Стили превью-изображения */
.product-image-container {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 24px;
  background-color: #f1f5f9;
}

.product-image-container img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.product-image-container:hover img {
  transform: scale(1.05);
}

/* ИСПРАВЛЕНО: Удалено свойство margin-top:auto, которое ломало поток документа */
.card-actions {
  display: flex;
  gap: 12px;
  /* Задана минимальная высота, чтобы кнопки не прыгали при разном количестве строк текста */
  min-height: 48px; 
  align-items: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 16px;
  border-radius: 10px;
  flex: 1;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: #ffffff;
  color: #1e293b;
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

/* Заглушки новых проектов */
.project-card.placeholder {
  border: 2px dashed #cbd5e1;
  background-color: rgba(241, 245, 249, 0.5);
  box-shadow: none;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 320px;
}

/* ИСПРАВЛЕНО: Явный запрет анимации только для заглушек */
.project-card.placeholder:hover {
  transform: none;
  box-shadow: none;
  border-color: #94a3b8;
}

.placeholder-icon {
  color: #94a3b8;
  margin-bottom: 12px;
}

.placeholder-text {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 600;
}


/* МОДАЛЬНОЕ ОКНО (ЛАЙТБОКС) */
#overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  backdrop-filter: blur(5px);
}

#imageModal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1001;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}

#imageModal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: black;
}

#closeBtn {
  position: absolute;
  top: 15px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  transition: all 0.2s ease;
}

#closeBtn:hover {
  background-color: white;
  transform: rotate(90deg) scale(1.1);
}

#closeBtn svg {
  width: 20px;
  height: 20px;
  stroke: #334155;
}