:root {
  --bg: #faf8f5;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e1db;
  --accent: #8b5e3c;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; }
img { display: block; max-width: 100%; }

/* Шапка */
.header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(250, 248, 245, .9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--serif); font-size: 1.25rem; text-decoration: none; }
.nav { display: flex; gap: clamp(.75rem, 3vw, 2rem); }
.nav a { text-decoration: none; color: var(--muted); font-size: .95rem; transition: color .2s; }
.nav a:hover { color: var(--text); }

/* Первый экран */
.hero { text-align: center; padding: clamp(4rem, 12vw, 8rem) 1rem clamp(3rem, 8vw, 5rem); }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 7vw, 4.5rem); line-height: 1.1; }
.hero p { margin-top: 1rem; color: var(--muted); letter-spacing: .15em; text-transform: uppercase; font-size: .85rem; }

/* Секции */
.section { max-width: 1300px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem); }
.section__title { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 2rem; }

/* Галерея */
.gallery { columns: 3 280px; column-gap: 1.5rem; }
.card { break-inside: avoid; margin-bottom: 1.5rem; }
.card__btn {
  display: block; width: 100%;
  border: 0; padding: 0;
  background: var(--line);
  cursor: zoom-in; overflow: hidden;
}
.card__btn img { width: 100%; height: auto; transition: transform .5s ease; }
.card__btn:hover img { transform: scale(1.03); }
.card__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card figcaption { padding-top: .6rem; }
.card__title { font-family: var(--serif); font-size: 1.05rem; }
.card__meta { color: var(--muted); font-size: .85rem; }
.gallery__empty { color: var(--muted); text-align: center; padding: 3rem 0; }

/* Обо мне */
.about { max-width: 680px; font-size: 1.05rem; }
.about p + p { margin-top: 1rem; }

/* Контакты */
.contacts { list-style: none; max-width: 680px; }
.contacts li { display: flex; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.contacts span { width: 110px; flex-shrink: 0; color: var(--muted); }
.contacts a { text-decoration: none; border-bottom: 1px solid var(--line); }
.contacts a:hover { border-color: var(--accent); color: var(--accent); }

.footer { text-align: center; padding: 2rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* Просмотрщик */
.viewer {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 10, .96); color: #fff;
  display: flex; flex-direction: column;
}
.viewer[hidden] { display: none; }
.viewer__top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .75rem 1rem; position: relative; z-index: 2;
}
.viewer__counter { font-size: .9rem; opacity: .7; }
.viewer__tools { display: flex; gap: .4rem; }
.vbtn {
  min-width: 40px; height: 40px; padding: 0 .6rem;
  border: 0; border-radius: 20px;
  background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 1.1rem; cursor: pointer; transition: background .2s;
}
.vbtn:hover { background: rgba(255, 255, 255, .22); }
.vbtn--wide { font-size: .85rem; min-width: 64px; }
.vbtn:focus-visible, .vnav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.viewer__stage {
  flex: 1; min-height: 0;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.viewer__img {
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 1rem);
  object-fit: contain;
  transform-origin: center center;
  transition: transform .2s ease;
  will-change: transform;
  cursor: zoom-in;
  -webkit-user-drag: none;
}
.viewer__stage.is-zoomed .viewer__img { cursor: grab; }
.viewer__stage.is-dragging .viewer__img { transition: none; cursor: grabbing; }

.vnav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 2rem; line-height: 1; cursor: pointer;
}
.vnav:hover { background: rgba(255, 255, 255, .22); }
.vnav--prev { left: 1rem; }
.vnav--next { right: 1rem; }
.vnav[hidden] { display: none; }

.viewer__caption { padding: .75rem 1rem 1.25rem; text-align: center; position: relative; z-index: 2; }
.viewer__caption h3 { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; }
.viewer__caption p { font-size: .85rem; opacity: .65; }

@media (max-width: 640px) {
  .header { flex-direction: column; gap: .4rem; padding: .75rem 1rem; }
  .vnav { display: none; }
  .contacts li { flex-direction: column; gap: .1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
