:root{
  --text: #D3D3D3;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --border: #e6e6e6;
}

/* Reset / base */
* { box-sizing: border-box; }
html,body { margin:0; padding:0; background:var(--bg); color:var(--text); font-family: Helvetica, Helvetica, sans-serif; }

/* Header/footer */
header, footer {
  background: var(--bg);
  color: var(--text);
  padding: 14px 12px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  top: 0;
  z-index: 20;
}

h1{ margin:0; font-size:1.8rem; color:var(--text); } /* +20% */
nav a{ margin:0 8px; text-decoration:none; color:var(--text); font-size:0.95rem; }

/* Grid container */
main.grid{
  max-width:1200px;
  margin: 12px auto;
  padding: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr); /* default = portrait phones: 3 cols */
}

/* On landscape and wider screens -> 4 columns */
@media (orientation: landscape) {
  main.grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  main.grid { grid-template-columns: repeat(4, 1fr); }
}

/* Card */
.project-card{
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: transform .15s ease, box-shadow .15s ease;
}

/* hover lift */
.project-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* Thumb: fixed aspect to keep uniform grid and avoid giant images */
.thumb{
  width: 100%;
  aspect-ratio: 3 / 2; /* чуть выше, чем 16:9 */
  overflow: hidden;
  background: #f2f2f2;
  display: block;
}

/* Image fills the thumb area but is cropped (uniform) */
.thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover; /* аккуратный кроп */
  display: block;
  -webkit-user-drag: none;
  -webkit-touch-callout: none; /* предотвращает меню "Открыть/Сохранить" при долгом нажатии в iOS */
}

/* Caption under thumb */
.project-card h2{
  margin: 8px 10px 12px;
  font-size: 0.90rem;
  color: var(--text);
  line-height: 0.80;
   text-align: center;
}

/* Links color */
a { color: var(--text); }

/* Small screens: slightly larger gaps */
@media (max-width: 450px) {
  main.grid { gap: 6px; padding: 4px; }
  h1 { font-size: 0.65rem; }
}


.gallery {
  display: flex;
  flex-direction: column; /* Располагает дочерние элементы вертикально */
  align-items: center;    /* Центрирует изображения по горизонтали */
  gap: 10px;              /* Задает равный вертикальный и горизонтальный отступ между элементами */
  width: 100%;
  padding: 10px 0;        /* Отступы сверху и снизу у контейнера */
}

.gallery a {
  width: 85vw;           /* Ширина ссылки (обертки изображения) 85% от ширины экрана */
  max-width: 85%;        /* На случай больших экранов ограничение по ширине */
  display: block;
}

.gallery img {
  width: 100%;           /* Изображение занимает всю ширину контейнера a */
  height: auto;          /* Сохраняет пропорции */
  display: block;        /* Убирает нижние отступы под изображением */
  border-radius: 4px;    /* При желании можно добавить скругление углов */
}


 .project h2 {
  text-align: center;      /* Центрирует заголовок */
  text-decoration: none;   /* Убирает подчеркивание, если оно есть */
}

footer p a {
  text-decoration: none;   /* Убирает подчеркивание у ссылки */
  color: inherit;          /* Сохраняет цвет текста (опционально) */
  cursor: pointer;         /* Курсор в виде руки при наведении */
}

/* Если хотите, чтобы ссылки не подчеркивались при наведении */
footer p a:hover {
  text-decoration: none;
}


.contacts {
  display: flex;
  gap: 18px;
  justify-content: center;
  padding: 10px 0;
}
.contacts a img {
  filter: grayscale(0.4);
  transition: filter 0.3s ease;
}
.contacts a:hover img {
  filter: grayscale(0);
  cursor: pointer;
}
footer p {
  text-align: center;
  font-weight: 600;
  margin-bottom: 6px;
}

.contact-sidebar {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1000;
}

.contact-sidebar a img {
  width: 28px;
  height: 28px;
  filter: grayscale(0.5);
  transition: filter 0.3s;
}

.contact-sidebar a:hover img {
  filter: grayscale(0);
  cursor: pointer;
}
