/* Городская фотоколлекция — editorial photo archive */
:root {
  --bg: #f5f1e8;
  --paper: #fbf8f1;
  --paper-deep: #eee7da;
  --line: #d9d0c1;
  --line-dark: #b9ab96;
  --text: #2d2b28;
  --muted: #746d63;
  --accent: #8a6840;
  --accent-dark: #6d5031;
  --white: #fffdf8;
  --shadow: 0 5px 18px rgba(55, 46, 35, .09);
  --shadow-hover: 0 13px 30px rgba(55, 46, 35, .14);
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --container: 1280px;
  --header-h: 66px;
  --ease: cubic-bezier(.25,.1,.25,1);
}

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

.container { width: min(calc(100% - 48px), var(--container)); margin: 0 auto; }
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 1000;
  padding: 8px 12px; background: var(--paper); color: var(--text);
}
.skip-link:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(245,241,232,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(5px);
}
.site-header__inner {
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.site-logo {
  display: inline-flex; flex-direction: column; gap: 1px;
  color: var(--text); text-decoration: none;
}
.site-logo:hover { color: var(--text); }
.site-logo__title {
  font-family: var(--font-serif); font-size: 19px; font-weight: 600; line-height: 1.15;
  letter-spacing: .005em;
}
.site-logo__sub {
  color: var(--muted); font-size: 10px; line-height: 1.2; letter-spacing: .02em;
}
.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav__link {
  position: relative; padding: 7px 0;
  color: var(--text); text-decoration: none;
  font-size: 11px; letter-spacing: .11em; text-transform: uppercase;
}
.site-nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 1px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: right;
  transition: transform .25s var(--ease);
}
.site-nav__link:hover::after,
.site-nav__link[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

.site-main { min-height: 58vh; padding: 0 0 72px; }
.is-photo-view .site-main { padding-bottom: 0; }

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

/* Home */
.hero {
  position: relative; display: grid; grid-template-columns: minmax(280px, .82fr) minmax(0, 1.18fr);
  min-height: 355px; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.hero__text { position: relative; z-index: 2; padding: 64px 36px 54px 0; align-self: center; max-width: 520px; }
.hero__eyebrow, .photo-meta__cat {
  margin: 0 0 12px; color: var(--accent); font-size: 10px; font-weight: 600;
  letter-spacing: .19em; text-transform: uppercase;
}
.hero__title {
  margin: 0 0 15px; font-family: var(--font-serif); font-size: clamp(38px, 4.2vw, 58px);
  font-weight: 600; line-height: 1.02; letter-spacing: -.025em;
}
.hero__lead { max-width: 410px; margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.65; }
.hero__media { position: relative; min-height: 355px; overflow: hidden; background: var(--paper-deep); }
.hero__media::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, var(--paper) 0%, rgba(251,248,241,.55) 8%, transparent 28%);
}
.hero__media img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.88) contrast(.97); transition: transform .8s var(--ease); }
.hero__media:hover img { transform: scale(1.015); }
.hero__media--empty {
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ece5d9, #ddd3c4);
}
.hero__media--empty::after {
  content: "ГОРОДСКОЙ АРХИВ"; color: rgba(85,72,55,.32); font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 42px); letter-spacing: .08em;
}
.btn {
  display: inline-flex; align-items: center; gap: 16px; min-height: 38px; padding: 9px 14px;
  border: 1px solid transparent; border-radius: 2px; background: var(--accent); color: #fffdf8;
  text-decoration: none; font-size: 12px; font-weight: 500;
  transition: transform .22s var(--ease), background .22s var(--ease), box-shadow .22s var(--ease);
}
.btn:hover { color: #fffdf8; background: var(--accent-dark); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(70,50,30,.16); }
.btn span { font-size: 15px; line-height: 1; }

.section-galleries { padding: 42px 0 0; }
.section-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.section-head__title { margin: 0; font-family: var(--font-serif); font-size: 25px; font-weight: 600; }
.section-head__line { width: 48px; height: 1px; background: var(--line-dark); }
.empty-note { color: var(--muted); font-style: italic; }

.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.album {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  color: inherit; background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--shadow); text-decoration: none;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease);
}
.album:hover, .album:focus-visible { color: inherit; transform: translateY(-4px); border-color: var(--line-dark); box-shadow: var(--shadow-hover); }
.album__cover { position: relative; display: block; aspect-ratio: 1.28 / 1; overflow: hidden; background: var(--paper-deep); }
.album__cover::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.18); pointer-events: none; }
.album__cover img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.94); transition: transform .5s var(--ease); }
.album:hover .album__cover img { transform: scale(1.035); }
.album__placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(145deg, #eee8dd, #dcd2c3); }
.album__meta { display: block; padding: 13px 14px 14px; border-top: 1px solid var(--line); }
.album__title { display: block; margin-bottom: 5px; font-family: var(--font-serif); font-size: 16px; font-weight: 600; line-height: 1.2; }
.album__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.album__arrow { color: var(--accent); font-size: 16px; transition: transform .22s var(--ease); }
.album:hover .album__arrow { transform: translateX(4px); }

/* Category page */
.category-page--grid { padding-top: 28px; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 14px; color: var(--muted); font-size: 11px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb__sep { opacity: .45; }
.cat-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.cat-head__title { margin: 0; font-family: var(--font-serif); font-size: clamp(32px, 4vw, 48px); font-weight: 600; line-height: 1.05; letter-spacing: -.02em; }
.cat-head__count { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.cat-head__back { color: var(--text); font-size: 11px; text-decoration: none; white-space: nowrap; }
.cat-head__back:hover { color: var(--accent); }
.cat-head__desc { max-width: 640px; margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.photo-tile { display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--paper-deep); box-shadow: var(--shadow); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), filter .5s var(--ease); }
.photo-tile:hover { box-shadow: var(--shadow-hover); }
.photo-tile:hover img { transform: scale(1.025); filter: saturate(1.02); }

/* Photo viewer */
.is-photo-view .container { width: min(calc(100% - 48px), 1320px); }
.photo-page { padding-top: 10px; }
.photo-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 27px; margin-bottom: 4px;
}
.crumb--inline { margin: 0; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.photo-bar__counter { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .13em; font-variant-numeric: tabular-nums; }
.gallery__counter-sep { margin: 0 4px; opacity: .5; }

.gallery__stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 100%; height: calc(100vh - 185px); min-height: 420px; max-height: 720px;
  padding: 0 54px;
}
.gallery__figure { width: 100%; height: 100%; margin: 0; display: flex; align-items: center; justify-content: center; min-width: 0; }
.gallery__frame { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-width: 0; }
.gallery__image {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
  object-fit: contain; background: transparent; border: 1px solid rgba(80,65,48,.13);
  box-shadow: 0 7px 24px rgba(42,34,25,.12); border-radius: 1px;
  transition: opacity .15s ease;
}
.gallery__image.is-fading { opacity: .45; }
.gallery__nav {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 1px solid rgba(255,253,248,.9); border-radius: 50%;
  background: rgba(54,47,39,.62); color: #fffdf8; cursor: pointer;
  box-shadow: 0 4px 14px rgba(25,20,15,.18); font-size: 21px; line-height: 1;
  transition: background .2s var(--ease), transform .2s var(--ease), opacity .2s var(--ease);
}
.gallery__nav--prev { left: 7px; }
.gallery__nav--next { right: 7px; }
.gallery__nav:hover:not(:disabled) { background: var(--accent); transform: translateY(-50%) scale(1.07); }
.gallery__nav:disabled { opacity: .22; cursor: default; }
.gallery__nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.photo-meta {
  display: grid; grid-template-columns: minmax(190px, 1fr) minmax(260px, 1.4fr) auto;
  align-items: start; gap: 24px; margin: 2px 54px 0; padding: 11px 0 15px;
  border-top: 1px solid var(--line);
}
.photo-meta__cat { margin: 0 0 3px; font-size: 9px; }
.photo-meta__title { margin: 0; font-family: var(--font-serif); font-size: 21px; font-weight: 600; line-height: 1.15; }
.photo-meta__desc { margin: 1px 0 0; max-width: 560px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.photo-meta__side { margin: 0; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.photo-meta__num { white-space: nowrap; }

.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 { width: min(100%, 720px); margin: 38px 54px 0; padding: 24px 0 50px; border-top: 1px solid var(--line); }
.comments h2, .comments h3 { margin: 0 0 14px; font-family: var(--font-serif); font-weight: 600; }
.comments h2 { font-size: 23px; }
.comments h3 { margin-top: 25px; font-size: 18px; }
.comment { margin: 0 0 14px; padding: 11px 0 11px 13px; border-left: 2px solid var(--line); }
.comment--highlight { background: rgba(138,104,64,.07); border-left-color: var(--accent); }
.comment--deleted { opacity: .7; font-style: italic; color: var(--muted); }
.comment header { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 4px; font-size: 13px; }
.comment header time { color: var(--muted); font-size: 11px; }
.comment p { margin: 4px 0; }
.comment__reply-btn, #comment-cancel-reply { margin-top: 4px; padding: 2px 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: .12em; }
.comment__children { margin: 10px 0 0; padding-left: 14px; }
.comments__hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
#comment-form-wrap label { display: block; margin: 13px 0 5px; color: var(--muted); font-size: 12px; }
#comment-form-wrap input, #comment-form-wrap textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); color: var(--text); }
#comment-form-wrap button[type="submit"] { margin-top: 13px; padding: 9px 18px; border: 0; border-radius: 2px; background: var(--accent); color: #fff; cursor: pointer; }
#comment-form-wrap button[type="submit"]:hover { background: var(--accent-dark); }
.flash { margin: 10px 0; padding: 8px 11px; border-radius: 2px; }
.flash--success { background: #e7eee3; color: #2d4a28; }
.flash--error { background: #f4e6e3; color: #7a2e28; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 15px 0; font-size: 12px; }

/* 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: 3px; background: #fff; color: var(--text);
}
.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 { margin: 0 0 .5rem; font-family: var(--font-serif); font-size: 2.4rem; }

/* Responsive */
@media (max-width: 1100px) {
  :root { --container: 960px; }
  .category-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr 1fr; }
  .hero__text { padding-left: 0; }
}
@media (max-width: 700px) {
  :root { --header-h: 58px; }
  .container, .is-photo-view .container { width: min(calc(100% - 28px), 1320px); }
  .site-logo__title { font-size: 16px; }
  .site-logo__sub { display: none; }
  .site-nav { gap: 12px; }
  .site-nav__link { font-size: 10px; }
  .site-main { padding-bottom: 45px; }

  .hero { display: flex; flex-direction: column; min-height: 0; }
  .hero__text { order: 1; max-width: none; padding: 34px 0 28px; }
  .hero__title { font-size: 38px; }
  .hero__lead { font-size: 14px; }
  .hero__media { order: 2; min-height: 220px; aspect-ratio: 4 / 3; }
  .hero__media::before { background: linear-gradient(180deg, var(--paper) 0%, transparent 30%); }
  .section-galleries { padding-top: 30px; }
  .category-grid, .photo-grid { grid-template-columns: 1fr; gap: 14px; }
  .album__cover { aspect-ratio: 1.45 / 1; }

  .category-page--grid { padding-top: 20px; }
  .cat-head { align-items: flex-start; flex-direction: column; }
  .cat-head__title { font-size: 34px; }
  .cat-head__back { margin-top: 2px; }

  .photo-page { padding-top: 7px; }
  .photo-bar { min-height: 23px; }
  .crumb--inline { max-width: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gallery__stage {
    height: calc(100svh - var(--header-h) - 145px);
    min-height: 300px; max-height: none; padding: 0 29px;
  }
  .gallery__nav { width: 36px; height: 36px; font-size: 18px; }
  .gallery__nav--prev { left: 0; }
  .gallery__nav--next { right: 0; }
  .photo-meta { grid-template-columns: 1fr auto; gap: 10px 18px; margin: 2px 0 0; padding: 10px 0 14px; }
  .photo-meta__main { grid-column: 1 / -1; }
  .photo-meta__side { grid-column: 2; grid-row: 1; }
  .photo-meta__title { font-size: 20px; }
  .photo-meta__desc { font-size: 12px; }
  .comments { width: 100%; margin: 28px 0 0; padding-bottom: 35px; }
  .site-footer__inner { align-items: flex-start; flex-direction: column; }
}
@media (min-width: 1400px) {
  .gallery__stage { height: calc(100vh - 185px); max-height: 720px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .album:hover, .photo-tile:hover, .btn:hover { transform: none; }
  .album:hover .album__cover img, .photo-tile:hover img, .hero__media:hover img { transform: none; }
  .gallery__nav:hover:not(:disabled) { transform: translateY(-50%); }
}
