/* =========================================================
   Фотографии — личный альбом
   ========================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "PT Serif", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #f5f0e8;
  --bg-soft: #ebe4d7;
  --ink: #26211d;
  --muted: #756a5d;
  --line: #e1d7c6;
  --accent: #8b5e3c;
  --accent-quiet: #b98f6f;

  --topbar-h: 4rem;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #121214;
  --bg-soft: #1b1b1f;
  --ink: #ece7dd;
  --muted: #a29b90;
  --line: #2b2b31;
  --accent: #d9a77e;
  --accent-quiet: #8f6c4f;
  color-scheme: dark;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 55%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s ease, color 0.35s ease;
}

::selection {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

main {
  min-height: 60vh;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.14);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.2s ease;
}

.brand::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.brand:hover {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--accent-quiet);
}

.theme-toggle .icon {
  width: 1.05rem;
  height: 1.05rem;
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun,
html[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- общая ширина ---------- */

.wrap {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
}

/* ---------- вступление ---------- */

.hero {
  padding: clamp(2.6rem, 7vw, 4.8rem) 0 2.1rem;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.71rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0.85rem 0 0;
  font-size: clamp(2.5rem, 7.5vw, 4rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

.hero-sub {
  margin: 1.15rem 0 0;
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.65;
}

.hero-meta {
  margin: 1.6rem 0 0;
  font-family: var(--sans);
  font-size: 0.73rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- галерея ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.15rem;
  padding-top: 2.2rem;
}

.gallery[data-layout="masonry"] {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
}

.gallery-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.shot {
  margin: 0;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

.shot-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-soft);
  cursor: zoom-in;
  line-height: 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.shot-open:hover img {
  transform: scale(1.02);
}

.shot-open:focus-visible {
  outline-offset: 4px;
}

.shot figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.55rem;
  font-family: var(--sans);
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---------- примечание ---------- */

.note {
  max-width: 40rem;
  margin: 2.2rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 0.79rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- подвал ---------- */

.site-footer {
  margin-top: 4.5rem;
  border-top: 1px solid var(--line);
}

.site-footer .inner {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
  padding: 1.9rem 0 2.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 2rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

/* ---------- просмотр ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(14 13 12 / 0.96);
  color: #f1ece4;
  display: none;
  flex-direction: column;
}

.lightbox[open] {
  display: flex;
  animation: lb-in 0.22s ease-out;
}

.lightbox::backdrop {
  background: rgb(10 9 8 / 0.8);
}

@keyframes lb-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lb-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.2rem 4.8rem 3.4rem;
}

.lb-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.55);
}

.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 1.6rem 1.35rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgb(241 236 228 / 0.72);
  pointer-events: none;
}

.lb-caption {
  margin: 0;
}

.lb-counter {
  margin: 0;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.07);
  color: #f4efe8;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.lb-btn:hover {
  background: rgb(255 255 255 / 0.16);
  border-color: rgb(255 255 255 / 0.3);
}

.lb-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.lb-close {
  top: 1.1rem;
  right: 1.1rem;
}

.lb-prev {
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
}

body.lb-open {
  overflow: hidden;
}

/* ---------- адаптив ---------- */

@media (max-width: 620px) {
  :root {
    --topbar-h: 3.6rem;
  }

  .topbar-inner {
    width: calc(100% - 1.5rem);
  }

  .wrap,
  .site-footer .inner {
    width: calc(100% - 2rem);
  }

  .gallery {
    padding-top: 1.6rem;
  }

  .brand {
    font-size: 0.84rem;
    letter-spacing: 0.12em;
  }

  .hero {
    padding-top: 2.2rem;
  }

  .lb-frame {
    padding: 3.6rem 0.75rem 4.2rem;
  }

  .lb-prev,
  .lb-next {
    top: auto;
    bottom: 0.9rem;
    transform: none;
    width: 2.7rem;
    height: 2.7rem;
  }

  .lb-prev {
    left: 1rem;
  }

  .lb-next {
    right: 1rem;
  }

  .lb-bar {
    bottom: 3.8rem;
    padding-inline: 1rem;
  }

  .lb-close {
    top: 0.8rem;
    right: 0.8rem;
  }

  .site-footer {
    margin-top: 3rem;
  }
}

/* ---------- движение и печать ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .topbar,
  .skip-link,
  .lightbox,
  .site-footer,
  .note {
    display: none !important;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  body {
    background: #fff;
    color: #000;
  }
}
