:root {
  color-scheme: dark;
  --background: #212121;
  --panel: #292929;
  --border: #3b3b3b;
  --text: #ededed;
  --muted: #b5b5b5;
  --accent: #dcdcdc;
  --font-text: 'Golos Text', system-ui, sans-serif;
  --font-heading: Literata, Georgia, serif;
  font: 100%/1.55 var(--font-text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; color: var(--text); background: var(--background); }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
h1, h2, p, figure { margin: 0; }
h1, h2 { font-family: var(--font-heading); line-height: 1.2; font-weight: 400; letter-spacing: -.02em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.625rem, 2.35vw, 2rem); }
h2 { font-size: clamp(1.22rem, 1.8vw, 1.4rem); }
img { display: block; max-width: 100%; }

.shell { width: min(calc(100% - 4rem), 86rem); margin-inline: auto; }
.skip-link { position: fixed; top: 1rem; left: 1rem; z-index: 1; transform: translateY(-200%); padding: .65rem 1rem; color: var(--background); background: var(--accent); }
.skip-link:focus { transform: translateY(0); }
.site-header { background: #1b1b1b; border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: .7rem 3rem; min-height: 3.7rem; padding-block: .85rem; }
.brand, .footer-admin { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.15rem; color: var(--muted); }
.camera-icon { position: relative; width: 1.5rem; height: 1.06rem; border: 1.5px solid currentColor; border-radius: .22rem; }
.camera-icon::before { content: ""; position: absolute; inset: .18rem auto auto .36rem; width: .58rem; height: .58rem; border: 1px solid currentColor; border-radius: 50%; }
.camera-icon::after { content: ""; position: absolute; left: .19rem; top: -.24rem; width: .42rem; height: .24rem; border: 1.5px solid currentColor; border-radius: .14rem .14rem 0 0; }
.lock-icon { position: relative; width: .8rem; height: .63rem; margin-top: .28rem; border: 1.25px solid currentColor; border-radius: .13rem; }
.lock-icon::before { content: ""; position: absolute; left: .12rem; top: -.43rem; width: .42rem; height: .43rem; border: 1.25px solid currentColor; border-bottom: 0; border-radius: .28rem .28rem 0 0; }
.site-nav { display: flex; flex-wrap: wrap; gap: .35rem 1.6rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav [aria-current] { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); }
main { flex: 1; padding-bottom: clamp(3rem, 8vw, 7rem); }
.section-intro { padding-block: clamp(1.5rem, 3vw, 2.65rem) clamp(1.1rem, 2vw, 1.6rem); }
.section-intro p, .section-intro .prose { margin-top: 1.15rem; }
.prose { max-width: 70ch; overflow-wrap: anywhere; }
.prose p + p { margin-top: .85rem; }
.flickr-copy { white-space: pre-line; }
.flickr-copy a[href]:empty::after { content: "Ссылка из Flickr"; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: clamp(.55rem, 1.25vw, 1rem); }
.stream-grid { margin-top: clamp(1.1rem, 3vw, 2rem); }
.album-grid { gap: clamp(.9rem, 2vw, 1.75rem); }
.card { display: flex; flex-direction: column; min-width: 0; color: var(--muted); text-decoration: none; }
.cover { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; }
.cover-empty { background: var(--panel); }
.card-title { padding-top: .6rem; text-align: center; font-size: .875rem; line-height: 1.35; font-weight: 400; overflow-wrap: anywhere; }
.card:hover .card-title { text-decoration: underline; }
.empty { grid-column: 1 / -1; padding: clamp(1.6rem, 6vw, 5rem); color: var(--muted); text-align: center; background: var(--panel); }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem 2rem; margin-top: 2rem; color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem 1.5rem; padding-block: 1.5rem; border-top: 1px solid var(--border); }
.site-footer a { color: var(--muted); font-size: .9rem; }
.site-footer a:hover { color: var(--text); }

.photo-detail {
  --text: #cacaca;
  --accent: #c5c5c5;
  --muted: #a8a8a8;
  padding-top: calc(1.25rem + 20px);
  color: var(--text);
}
.photo-stage {
  display: grid;
  grid-template-columns: minmax(2rem, 1fr) minmax(0, max-content) minmax(2rem, 1fr);
  place-items: center;
  margin-bottom: 20px;
}
.photo-stage img { width: auto; height: auto; max-height: 78svh; object-fit: contain; }
.photo-expand { display: block; grid-area: 1 / 2; max-width: 100%; cursor: zoom-in; }
.photo-step {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 2.75rem;
  height: 2.75rem;
  color: #818181;
}
.photo-step-previous { grid-area: 1 / 1; }
.photo-step-next { grid-area: 1 / 3; }
.photo-step::after { content: ""; width: .73rem; height: .73rem; border-top: 2px solid; border-right: 2px solid; transform: rotate(45deg); }
.photo-step-previous::after { transform: rotate(-135deg); }
.photo-step:is(:hover, :focus-visible) { color: var(--text); }

html:has(.photo-viewer[open]) { overflow: hidden; }
.photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #111;
}
.photo-viewer:not([open]) { display: none; }
.photo-viewer:focus { outline: none; }
.photo-viewer::backdrop { background: #111; }
.photo-viewer-content { position: relative; width: 100%; height: 100%; background: #111; }
.photo-viewer-frame { width: 100%; height: 100%; overflow: hidden; }
.photo-viewer-image {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.photo-viewer-image img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.photo-viewer-image:focus-visible { outline: none; }
.photo-viewer-frame.is-actual {
  overflow: auto;
  overscroll-behavior: none;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}
.photo-viewer-frame.is-actual::-webkit-scrollbar { display: none; }
.photo-viewer-frame.is-actual .photo-viewer-image {
  grid-template: none;
  width: max-content;
  height: max-content;
  min-width: 100%;
  min-height: 100%;
  cursor: zoom-out;
}
.photo-viewer-frame.is-actual img { width: auto; height: auto; max-width: none; }
.photo-viewer-status {
  position: absolute;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
  pointer-events: none;
}
.photo-viewer-status:not(:empty) { padding: .45rem .75rem; border-radius: .35rem; background: #111; }
.photo-viewer-controls {
  position: absolute;
  top: max(.75rem, env(safe-area-inset-top));
  right: max(.75rem, env(safe-area-inset-right));
  margin: 0;
}
.photo-viewer-close {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  color: #e2e2e2;
  background: transparent;
  font: 1.65rem/1 var(--font-text);
  text-shadow: 0 1px 3px #000, 0 0 7px #000;
  cursor: pointer;
}
.photo-viewer-close:is(:hover, :focus-visible) { color: #fff; }
.photo-viewer-close:focus-visible { outline: none; text-decoration: underline; text-underline-offset: .2em; }

.reading-width { width: min(100%, 52rem); margin-inline: auto; }
.photo-heading { padding-block: clamp(1.25rem, 3vw, 2rem); }
.photo-heading h1 { font-size: clamp(1.45rem, 2.25vw, 1.85rem); }
.metadata { display: flex; flex-wrap: wrap; gap: .35rem 1.2rem; margin-block: .9rem 1.25rem; color: var(--muted); font-size: .9rem; }
.metadata:first-child { margin-top: 0; }
.discussion { border-top: 1px solid var(--border); padding-top: 1.65rem; }
.discussion h2 { margin-bottom: 1rem; }
.comment { padding-block: 1.1rem; }
.comment + .comment { border-top: 1px solid var(--border); }
.comment-byline { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .85rem; margin-bottom: .4rem; color: var(--muted); font-size: .875rem; }
.author { color: var(--text); font-weight: 500; font-size: 1rem; overflow-wrap: anywhere; }
a.author { color: var(--accent); }
.comment-form { display: grid; gap: 1rem; margin-top: 1.75rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.comment-form h2 { margin: 0; font-size: 1rem; font-weight: 500; }
.comment-field { display: grid; gap: .35rem; }
.comment-field label { font-size: .9rem; color: var(--muted); }
.comment-field :is(input, textarea) {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid #696969;
  border-radius: .35rem;
  background: #1b1b1b;
  color: var(--text);
  font: inherit;
}
.comment-field input { max-width: 26rem; }
.comment-field textarea { resize: vertical; }
.comment-form .errorlist { margin: 0; padding-inline-start: 1.2rem; color: #ffaaa6; }
.comment-form button {
  justify-self: start;
  padding: .55rem .9rem;
  border: 1px solid var(--accent);
  border-radius: .35rem;
  background: var(--accent);
  color: var(--background);
  font: inherit;
  cursor: pointer;
}
.comment-form button:hover { background: var(--text); }

@media (max-width: 55rem) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 36rem) {
  .shell { width: calc(100% - 2rem); }
  .header-inner { align-items: flex-start; flex-direction: column; }
  .site-nav { column-gap: 1.1rem; }
  .grid { grid-template-columns: 1fr; }
  .photo-stage { margin-inline: -.7rem; }
}
