/* ============ Палитра: 3 цвета ============ */
:root {
  --bg: #fafaf8;        /* нейтральный светлый фон */
  --ink: #141414;       /* почти чёрный текст */
  --muted: #8a8a86;     /* сероватый secondary */
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============ Шапка ============ */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 32px 0;
}

.site-logo {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 28px;
}

.nav-link {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 3px;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
}

/* ============ Основное ============ */
.site-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 32px 96px;
  min-height: 60vh;
}

.page-intro {
  max-width: 560px;
  margin-bottom: 56px;
}

.page-title {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.page-subtitle {
  color: var(--muted);
  font-size: 14px;
}

/* ============ Сетка альбомов ============ */
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 28px;
}

.album-card {
  display: block;
}

.album-cover {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--muted);
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, opacity 0.4s ease;
}

.album-card:hover .album-cover img {
  transform: scale(1.03);
  opacity: 0.9;
}

.album-lock {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
}

.album-info {
  padding-top: 16px;
}

.album-name {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.album-details {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ============ Страница альбома ============ */
.album-head {
  margin-bottom: 48px;
}

.back-link {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--ink);
}

.photo-grid {
  columns: 3;
  column-gap: 24px;
}

.photo-item {
  break-inside: avoid;
  margin-bottom: 24px;
  cursor: zoom-in;
  overflow: hidden;
}

.photo-item img {
  width: 100%;
  transition: opacity 0.3s;
}

.photo-item:hover img {
  opacity: 0.88;
}

/* ============ Футер ============ */
.site-footer {
  display: flex;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 40px;
  border-top: 1px solid var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ============ Модалка пароля ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  position: relative;
  background: var(--bg);
  width: 100%;
  max-width: 420px;
  padding: 48px 44px 44px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-kicker {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal-title {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.modal-text {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 28px;
}

#password-input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--muted);
  outline: none;
  text-align: center;
}

#password-input:focus {
  border-color: var(--ink);
}

.modal-error {
  font-size: 12.5px;
  color: var(--ink);
  margin-top: 12px;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--bg);
  color: var(--ink);
}

/* ============ Лайтбокс ============ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.lightbox img {
  max-width: 88vw;
  max-height: 86vh;
  object-fit: contain;
}

.lightbox-btn {
  position: absolute;
  background: none;
  border: none;
  color: var(--bg);
  font-size: 28px;
  font-weight: 300;
  padding: 16px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-btn:hover {
  opacity: 1;
}

.lightbox-close { top: 14px; right: 20px; font-size: 34px; }
.lightbox-prev  { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 14px; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--bg);
  font-size: 12px;
  letter-spacing: 0.14em;
  opacity: 0.7;
}

/* ============ Загрузка ============ */
.loading-note {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ============ Сердечки на фото ============ */
.photo-item {
  position: relative;
}

.fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  background: var(--bg);
  border: none;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}

.photo-item:hover .fav-btn,
.fav-btn.is-fav {
  opacity: 1;
}

.fav-btn:hover,
.fav-btn.is-fav {
  color: var(--ink);
}

/* ============ FAB ============ */
.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  transition: opacity 0.2s;
}

.fab:hover {
  opacity: 0.85;
}

.fab-heart {
  font-size: 16px;
  line-height: 1;
}

.fab-count {
  font-size: 13px;
  letter-spacing: 0.08em;
}

/* ============ Избранное ============ */
.fav-group {
  margin-bottom: 48px;
}

.fav-group-title {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.fav-group-date {
  margin-left: 14px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
}

.fav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.fav-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.fav-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fav-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  background: var(--bg);
  border: none;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
}

.fav-remove:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ============ Блок скачивания ============ */
.download-block {
  max-width: 480px;
  margin-top: 24px;
  padding-top: 40px;
  border-top: 1px solid var(--muted);
}

.download-title {
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.download-text {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 24px;
}

.download-form {
  display: flex;
  gap: 12px;
}

.download-form input {
  flex: 1;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--muted);
  outline: none;
}

.download-form input:focus {
  border-color: var(--ink);
}

.download-form .btn {
  width: auto;
  margin-top: 0;
  padding: 12px 22px;
  white-space: nowrap;
}

.download-success {
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--ink);
}

/* ============ Кнопка-призрак ============ */
.btn-ghost {
  background: var(--bg);
  color: var(--muted);
  border-color: var(--bg);
  margin-top: 8px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--bg);
}

/* ============ Адаптив ============ */
@media (max-width: 900px) {
  .album-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid { columns: 2; }
  .fav-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
  .site-header { flex-direction: column; gap: 12px; padding-top: 32px; }
  .site-main { padding: 48px 20px 64px; }
  .album-grid { grid-template-columns: 1fr; }
  .photo-grid { columns: 1; }
  .fav-grid { grid-template-columns: repeat(3, 1fr); }
  .download-form { flex-direction: column; }
  .fab { right: 16px; bottom: 16px; }
  .fav-btn { opacity: 1; }
  .site-footer { flex-direction: column; gap: 4px; padding: 20px; }
}
