/* весь сайт — на чёрном фоне */
:root {
  color-scheme: dark;
  --bg: #000;
  --ink: #ecebe6;
  --muted: #8f8b83;
  --line: #262523;
  --card: #141413;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --row: 330px;   /* высота ряда в альбоме */
  --gap: 6px;
  --pad: clamp(16px, 4vw, 56px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { color: transparent; }

/* шапка */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 30px var(--pad) 26px;
}
.brand {
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: .01em;
  text-decoration: none;
}
.site-header nav { display: flex; gap: 24px; }
.site-header nav a {
  text-decoration: none;
  font-size: 12.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current] { color: var(--ink); border-bottom-color: currentColor; }

main { flex: 1; padding: 0 var(--pad) 72px; width: 100%; }

.intro {
  max-width: 62ch;
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 17px;
}

/* главная: альбомы */
.albums {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 44px 28px;
}
.albums a { display: block; text-decoration: none; }
.cover {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--c, var(--card));
}
.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1), opacity .3s;
}
.albums a:hover .cover img { transform: scale(1.025); }
.meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 13px;
}
.meta .t { font-family: var(--serif); font-size: 22px; line-height: 1.25; }
.meta .y { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* страница альбома */
.album-head { max-width: 68ch; margin: 6px 0 30px; }
.album-head h1, .about-text h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.08;
  letter-spacing: -.005em;
  margin: 0 0 10px;
}
.album-head .sub { margin: 0; color: var(--muted); }
.album-head .desc { margin-top: 16px; }
.album-head .desc p { margin: 0 0 .8em; }

/* выровненная сетка: каждый снимок в своих пропорциях, ряды одной высоты */
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
.grid::after { content: ""; flex-grow: 999999; }
.ph {
  position: relative;
  display: block;
  flex-grow: var(--r);
  flex-basis: calc(var(--r) * var(--row));
  overflow: hidden;
  background: var(--c, var(--card));
}
.ph i { display: block; padding-bottom: calc(100% / var(--r)); }
.ph img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .3s;
}
.ph:hover img { opacity: .9; }
.ph:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.album-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.album-nav a { text-decoration: none; color: var(--muted); }
.album-nav a:hover { color: var(--ink); }
.album-nav > :first-child { flex: 1; }
.album-nav > :last-child { flex: 1; text-align: right; }

/* обо мне */
.about {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 62ch);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  margin-top: 6px;
}
.about.no-photo { grid-template-columns: minmax(0, 62ch); }
.about-photo { background: var(--c, var(--card)); }
.about-photo img { display: block; width: 100%; height: auto; }
.about-text { font-size: 17px; }
.about-text h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 1.6em 0 .4em; }
.about-text p { margin: 0 0 1em; }
.links {
  list-style: none;
  padding: 18px 0 0;
  margin: 28px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  font-size: 15px;
}

.site-footer {
  padding: 22px var(--pad) 30px;
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 800px) {
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 420px; }
}
@media (max-width: 700px) {
  :root { --row: 190px; --gap: 4px; }
  .site-header { padding-top: 22px; padding-bottom: 20px; }
  .albums { gap: 34px; }
}

/* просмотр снимка */
html.lb-open { overflow: hidden; }
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .97);
  color: #eceae4;
  touch-action: pan-y pinch-zoom;
}
.lb[hidden] { display: none; }
.lb figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}
.lb img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  transition: opacity .25s;
  user-select: none;
}
.lb img.loading { opacity: 0; }
.lb figcaption {
  max-width: min(70ch, calc(100vw - 32px));
  text-align: center;
  font-size: 14px;
  color: #b9b5ad;
}
.lb-btn {
  position: absolute;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  opacity: .65;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-btn:hover, .lb-btn:focus-visible { opacity: 1; }
.lb-btn:focus-visible { outline: 1px solid currentColor; outline-offset: -6px; }
.lb-prev, .lb-next { top: 70px; bottom: 70px; width: min(16vw, 120px); }
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-close { top: 10px; right: 10px; width: 52px; height: 52px; }
.lb-count {
  position: absolute;
  top: 24px;
  left: 22px;
  font-size: 13px;
  letter-spacing: .08em;
  color: #9a968d;
  font-variant-numeric: tabular-nums;
}
@media (hover: none) {
  .lb-prev, .lb-next { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
