/* Городская фотоколлекция — mockup-aligned editorial archive */
:root {
  --bg: #f8f6ef;
  --bg-soft: #f3efe6;
  --paper: #fffcf7;
  --line: #e8dccf;
  --line-strong: #d4c4b0;
  --text: #2e2e2e;
  --muted: #6b635a;
  --accent: #8b6f47;
  --accent-dark: #6e5738;
  --frame: #1a1816;
  --shadow: 0 4px 20px rgba(46, 46, 46, 0.07);
  --shadow-hover: 0 12px 32px rgba(46, 46, 46, 0.12);
  --font-serif: "Playfair Display", "Times New Roman", Georgia, serif;
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --container: min(92vw, 1120px);
  --header-h: 4.25rem;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--paper); padding: 0.5rem 1rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-header {
  background: rgba(248, 246, 239, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--header-h); gap: 1rem;
}
.site-logo {
  display: flex; flex-direction: column; gap: 0.1rem;
  text-decoration: none; color: var(--text);
}
.site-logo:hover { color: var(--accent-dark); }
.site-logo__title {
  font-family: var(--font-serif);
  font-size: 1.2rem; font-weight: 600; letter-spacing: 0.01em; line-height: 1.2;
}
.site-logo__sub {
  font-size: 0.7rem; color: var(--muted); letter-spacing: 0.02em; font-weight: 400;
}
.site-nav { display: flex; align-items: center; gap: 1.5rem; }
.site-nav__link {
  font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
  padding: 0.25rem 0; border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  color: var(--text); border-bottom-color: var(--accent);
}

.site-main { padding: 0 0 3rem; min-height: 50vh; }
.is-photo-view .site-main { padding-bottom: 2rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  font-size: 0.85rem; color: var(--muted);
}
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.75rem 1.5rem;
}
.site-footer__copy, .site-footer__note { margin: 0; }
.site-footer__top {
  text-decoration: none; color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase; font-size: 0.75rem;
}
.site-footer__top:hover { color: var(--accent); }

/* Home hero */
.hero {
  padding: 2.75rem 0 2.25rem;
  max-width: 34rem;
}
.hero__eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.hero__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.1rem);
  font-weight: 600; line-height: 1.15; color: var(--text);
}
.hero__lead {
  margin: 0 0 1.5rem;
  color: var(--muted); font-size: 1.05rem; line-height: 1.6;
  max-width: 28rem;
}
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.7rem 1.25rem; border-radius: 2px;
  font: inherit; font-size: 0.9rem; font-weight: 500;
  text-decoration: none; border: 0; cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn--accent {
  background: var(--accent); color: #fff;
}
.btn--accent:hover {
  background: var(--accent-dark); color: #fff;
  transform: translateY(-1px);
}

.section-galleries { padding: 0.5rem 0 1rem; }
.section-head {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem; font-weight: 600;
}
.section-head__line {
  flex: 1; height: 1px; background: var(--line); max-width: 8rem;
}
.empty-note { color: var(--muted); font-style: italic; }

/* Album cards */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.album {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}
.album:hover, .album:focus-visible {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
  color: inherit;
}
.album__cover {
  aspect-ratio: 4 / 3; overflow: hidden; background: #ebe4d8;
}
.album__cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.45s var(--ease);
}
.album:hover .album__cover img { transform: scale(1.04); }
.album__placeholder {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(145deg, #ebe6dc, #d9d0c4);
}
.album__meta {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.35rem;
}
.album__title {
  font-family: var(--font-serif);
  font-size: 1.05rem; font-weight: 600; line-height: 1.25;
}
.album__foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: var(--muted);
}
.album__arrow { color: var(--accent); transition: transform 0.2s var(--ease); }
.album:hover .album__arrow { transform: translateX(3px); }

/* Category grid page */
.category-page--grid { padding-top: 1.5rem; }
.crumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  margin: 0 0 1rem; font-size: 0.8rem; color: var(--muted);
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb__sep { opacity: 0.45; }
.cat-head {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.cat-head__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.5vw, 2.35rem); font-weight: 600;
}
.cat-head__count {
  margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted);
}
.cat-head__back {
  font-size: 0.85rem; text-decoration: none; color: var(--muted);
  white-space: nowrap;
}
.cat-head__back:hover { color: var(--accent); }
.cat-head__desc {
  margin: -0.5rem 0 1.5rem; max-width: 40rem; color: var(--muted); font-size: 0.95rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}
.photo-tile {
  display: block; overflow: hidden; border-radius: 3px;
  background: #e8e0d4; aspect-ratio: 4 / 3;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.photo-tile img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.photo-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.photo-tile:hover img { transform: scale(1.03); }

/* Photo viewer — first screen priority */
.photo-page { padding-top: 0.65rem; }

.photo-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.65rem;
  min-height: 1.5rem;
}
.crumb--inline { margin: 0; }
.photo-bar__counter {
  margin: 0;
  font-size: 0.8rem; letter-spacing: 0.12em;
  color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gallery__counter-sep { margin: 0 0.15em; opacity: 0.55; }

.gallery__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* Fit in first viewport: header + bar + meta estimate */
  height: calc(100vh - var(--header-h) - 7.5rem);
  min-height: 280px;
  max-height: 82vh;
}

.gallery__figure {
  margin: 0; flex: 1 1 auto; min-width: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.gallery__frame {
  height: 100%; width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
}
.gallery__image {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  box-shadow: var(--shadow);
  border-radius: 2px;
  transition: opacity 0.15s ease;
}
.gallery__image.is-fading { opacity: 0.4; }

.gallery__nav {
  flex: 0 0 auto;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.gallery__nav:hover:not(:disabled) {
  background: var(--accent); border-color: var(--accent); color: #fff;
  transform: scale(1.06);
}
.gallery__nav:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.gallery__nav:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }

.photo-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--line);
  max-width: 52rem;
}
.photo-meta__cat {
  margin: 0 0 0.2rem;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.photo-meta__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.45rem; font-weight: 600; line-height: 1.25;
}
.photo-meta__desc {
  margin: 0.4rem 0 0;
  color: var(--muted); font-size: 0.95rem; max-width: 36rem;
}
.photo-meta__side {
  margin: 0; color: var(--muted); font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.is-sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* Comments */
.comments {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--line); max-width: 40rem;
}
.comments h2, .comments h3 {
  font-family: var(--font-serif); font-weight: 600; margin: 0 0 1rem;
}
.comments h2 { font-size: 1.3rem; }
.comments h3 { font-size: 1.05rem; margin-top: 1.35rem; }
.comment {
  margin: 0 0 1rem; padding: 0.75rem 0 0.75rem 0.85rem;
  border-left: 2px solid var(--line);
}
.comment--highlight { background: rgba(139, 111, 71, 0.07); border-left-color: var(--accent); }
.comment--deleted { opacity: 0.7; font-style: italic; color: var(--muted); }
.comment header {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem;
  margin-bottom: 0.3rem; font-size: 0.9rem;
}
.comment header time { color: var(--muted); font-size: 0.8rem; }
.comment p { margin: 0.3rem 0; }
.comment__reply-btn, #comment-cancel-reply {
  margin-top: 0.25rem; padding: 0.2rem 0; border: 0; background: none;
  color: var(--accent); cursor: pointer; font-size: 0.85rem;
  text-decoration: underline; text-underline-offset: 0.12em;
}
.comment__children { margin: 0.7rem 0 0; padding-left: 0.85rem; }
.comments__hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
#comment-form-wrap label {
  display: block; margin: 0.8rem 0 0.25rem; font-size: 0.88rem; color: var(--muted);
}
#comment-form-wrap input, #comment-form-wrap textarea {
  width: 100%; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: 3px;
  background: var(--paper); font: inherit; color: var(--text);
}
#comment-form-wrap button[type="submit"] {
  margin-top: 0.9rem; padding: 0.55rem 1.2rem;
  border: 0; background: var(--accent); color: #fff;
  border-radius: 3px; cursor: pointer; font: inherit;
}
#comment-form-wrap button[type="submit"]:hover { background: var(--accent-dark); }
.flash { margin: 0.7rem 0; padding: 0.6rem 0.85rem; border-radius: 3px; }
.flash--success { background: #e8f0e6; color: #2d4a28; }
.flash--error { background: #f5e8e6; color: #7a2e28; }
.pagination {
  display: flex; flex-wrap: wrap; gap: 0.7rem 1rem;
  align-items: center; margin: 1.1rem 0; font-size: 0.9rem;
}

/* Admin */
.is-admin .site-header { background: #fff; }
.admin-login, .admin-form { max-width: 420px; }
.admin-login__form label, .admin-form label { display: block; margin: 12px 0 4px; }
.admin-login__form input, .admin-form input, .admin-form select, .admin-form textarea,
textarea, input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font: inherit;
}
button, .btn { font: inherit; }
.btn--secondary { background: #666; color: #fff; }
.admin-login__error, .field-error { color: #a4262c; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; }
.admin-table th, .admin-table td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.inline-form { display: inline; }
.admin-dashboard__nav a { margin-right: 16px; }
.is-hidden { display: none !important; }
.error-page { text-align: center; padding: 3rem 0; }
.error-page h1 { font-family: var(--font-serif); font-size: 2.4rem; margin: 0 0 0.5rem; }

/* Responsive */
@media (max-width: 1100px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  :root { --header-h: 3.75rem; }
  .site-logo__sub { display: none; }
  .hero { padding: 1.75rem 0 1.5rem; }
  .category-grid, .photo-grid { grid-template-columns: 1fr; gap: 1rem; }
  .gallery__stage {
    height: calc(100vh - var(--header-h) - 9rem);
    max-height: 62vh; gap: 0.25rem;
  }
  .gallery__nav { width: 2.65rem; height: 2.65rem; min-width: 2.65rem; }
  .cat-head { flex-direction: column; align-items: flex-start; }
  .photo-meta { flex-direction: column; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
  .comment__children { padding-left: 0.5rem; }
}
@media (min-width: 1400px) {
  .gallery__stage {
    height: calc(100vh - var(--header-h) - 6.5rem);
    max-height: 86vh;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .album:hover, .album:focus-visible, .photo-tile:hover { transform: none; }
  .album:hover .album__cover img, .photo-tile:hover img { transform: none; }
  .gallery__nav:hover:not(:disabled) { transform: none; }
}
