* {
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', 'Palatino', serif;
  margin: 0;
  padding: 0;
  background-image: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('images/555.PNG');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 {
  text-align: center;
  margin-bottom: 5px;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
  color: #fff;
  font-size: 3em;
  font-weight: 700;
  letter-spacing: 1px;
  padding-top: 30px;
}

p {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 50px;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
  color: #fff;
  font-size: 1.1em;
  line-height: 1.6;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 20px 40px;
  max-width: 1400px;
  margin: 0 auto;
  flex-grow: 1;
}

.knife-item {
  text-align: center;
}

.image-container {
  position: relative;
  display: inline-block;
}

.photo-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
}

.gallery-image {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  object-fit: cover;
  aspect-ratio: 4/3;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-image:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.knife-item figcaption {
  margin-top: 8px;
  font-size: 0.95em;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Модальне вікно */
.modal {
  display: none !important;
  position: fixed;
  z-index: 1000;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0);
  opacity: 0;
  transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.modal.show {
  display: block !important;
  background-color: rgba(0,0,0,0.9);
  opacity: 1;
}

.modal-content-wrapper {
  position: relative;
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 90%;
  max-height: 80vh;
  width: 100%;
  height: 100%;
}

.modal-content {
  max-width: 100%;
  max-height: 80vh;
  transform: scale(0.7);
  opacity: 0;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  cursor: default;
  position: relative;
  z-index: 1;
  touch-action: pan-x; /* Дозволяє горизонтальні свайпи */
  user-select: none; /* Запобігає виділенню тексту при свайпах */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.modal.show .modal-content {
  transform: scale(1);
  opacity: 1;
}

.modal-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
  padding: 0 20px;
}

.prev-btn, .next-btn {
  background: transparent;
  color: white;
  border: none;
  padding: 15px 20px;
  font-size: 24px;
  cursor: pointer;
  border-radius: 0;
  pointer-events: auto;
  transition: color 0.3s, opacity 0.3s ease-in-out;
  opacity: 0;
  position: relative;
  z-index: 3;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.modal.show .prev-btn,
.modal.show .next-btn {
  opacity: 1;
}

.prev-btn:hover, .next-btn:hover {
  color: #ccc;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 1);
}

.image-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.modal.show .image-counter {
  opacity: 1;
}

.close {
  position: absolute;
  top: 30px;
  right: 50px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.modal.show .close {
  opacity: 1;
}

/* Додаткові правила для впевненості в позиціонуванні */
.modal .modal-content-wrapper .modal-nav {
  position: absolute !important;
  top: 50% !important;
  left: 0 !important;
  right: 0 !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  justify-content: space-between !important;
  pointer-events: none !important;
  z-index: 2 !important;
  padding: 0 20px !important;
}

.modal .modal-content-wrapper .modal-nav .prev-btn,
.modal .modal-content-wrapper .modal-nav .next-btn {
  position: relative !important;
  pointer-events: auto !important;
  z-index: 3 !important;
  background: transparent !important;
  border-radius: 0 !important;
}

footer {
  margin-top: auto;
  padding: 40px 20px;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

footer h2 {
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
  font-size: 1.5em;
  margin: 20px 0 15px;
}

footer p {
  margin: 10px auto;
  max-width: 800px;
  text-align: center;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
  font-size: 0.95em;
}

footer a {
  color: #ffd700;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 600;
}

footer a:hover {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
   text-decoration: underline;
}

/* Покращення кнопок на мобільних */
@media (max-width: 768px) {
  .prev-btn, .next-btn {
    padding: 15px 20px;
    font-size: 24px;
    border-radius: 0;
  }
  
  .modal-nav {
    padding: 0 10px;
  }
  
  .image-counter {
    bottom: 30px;
    font-size: 16px;
    padding: 10px 20px;
  }
  
  .close {
    top: 20px;
    right: 20px;
    font-size: 50px;
  }
}

/* Іконки в footer більші і кольорові */
footer a i {
  font-size: 1.1em;
  margin-right: 4px;
}

footer a[href*="t.me"] i         { color: #2AABEE; }
footer a[href*="instagram"] i    { color: #E1306C; }
footer a[href*="youtube"] i      { color: #FF0000; }
footer a[href*="mailto"] i       { color: #ffd700; }

/* Плавна поява галереї */
.knife-item {
  animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Підпис під фото трохи кращий */
.knife-item figcaption {
  margin-top: 8px;
  font-size: 0.88em;
  color: #ddd;
  line-height: 1.4;
  min-height: 2.8em; /* щоб картки були однакової висоти */
}

/* YouTube посилання під карткою */
.knife-item a {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.85em;
  color: #FF0000;
  text-decoration: none;
  transition: opacity 0.2s;
}
.knife-item a:hover { opacity: 0.75; }

/* Мобільний відступ галереї */
@media (max-width: 600px) {
  .gallery {
    padding: 10px 15px;
    gap: 20px;
  }
  h1 { font-size: 2em; }
}
.logo-corner {
  position: fixed;
  top: 15px;
  left: 15px;
  width: 60px;
  opacity: 0.85;
  z-index: 100;
  transition: opacity 0.3s;
}
.logo-corner:hover { opacity: 1; }
.header-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 30px;
  padding: 30px 40px 0;
}

.header-logo {
  width: 90px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7));
  margin-top: 50px;
}

/* Прибираємо padding-top з h1 бо він тепер у flex */
.header-wrap h1 {
  padding-top: 0;
  text-align: left;
}

.header-wrap p {
  text-align: left;
  margin: 8px 0 0;
}

/* На мобільному — логотип зверху по центру */
@media (max-width: 600px) {
  .header-wrap {
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 0;
  }
  .header-wrap h1,
  .header-wrap p {
    text-align: center;
  }
}
