/* Sharov artist site — visualization mockup */

:root {
  --bg: #f7f5f1;
  --bg-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  --surface: rgba(255, 255, 255, 0.78);
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --nav-bg: #b8c8d6;
  --nav-bg-hover: #a8bac8;
  --nav-strip-bg: rgba(228, 235, 242, 0.96);
  --nav-strip-border: rgba(160, 178, 194, 0.75);
  --footer-strip-bg: rgba(210, 222, 232, 0.92);
  --nav-text: #141414;
  --accent: #2f6699;
  --accent-soft: #4a7ca8;
  --border: rgba(30, 28, 24, 0.12);
  --frame-shadow: 0 4px 22px rgba(20, 24, 28, 0.08), 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  --font-serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --font-sans: Arial, Helvetica, sans-serif;
  /* Шкала из PDF: 1rem = 13pt (задаётся на html) */
  --size-title: calc(38 / 13 * 1rem);
  --size-subtitle: calc(24 / 13 * 1rem);
  --size-nav: calc(15 / 13 * 1rem);
  --size-contacts: calc(18 / 13 * 1rem);
  --size-body: 1rem;
  --size-body-sm: calc(12 / 13 * 1rem);
  --size-lead: calc(14 / 13 * 1rem);
  --size-section: calc(18 / 13 * 1rem);
  --size-footer: calc(12.85 / 13 * 1rem);
  --size-footer-sm: calc(9 / 13 * 1rem);
  --max-width: 1180px;
  --header-bg: rgba(247, 245, 241, 0.94);
}

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

html {
  scroll-behavior: smooth;
  font-size: 13pt;
  scrollbar-gutter: stable;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.42;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-grain);
  background-size: 180px 180px;
  background-repeat: repeat;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

/* Header */

.site-header {
  padding: 1.25rem 0 0;
}

.site-header__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 0;
}

.site-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--size-title);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}

.site-title__link {
  color: inherit;
  text-decoration: none;
}

.site-title__link:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-subtitle {
  margin: 0.15em 0 0;
  font-family: var(--font-serif);
  font-size: var(--size-subtitle);
  font-weight: 400;
  line-height: 1.1;
  color: var(--text);
}

.site-contacts {
  text-align: right;
  font-family: var(--font-serif);
  font-size: var(--size-contacts);
  line-height: 1.35;
  color: var(--text);
}

.site-contacts a {
  color: var(--text);
  text-decoration: none;
}

.site-contacts a:hover {
  text-decoration: underline;
}

.site-contacts__mail {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.site-contacts__icon {
  flex-shrink: 0;
  width: 0.95em;
  height: 0.95em;
  margin-top: 0.05em;
}

.site-contacts a:hover .site-contacts__icon {
  color: var(--accent);
}

/* Navigation */

.site-nav-wrap {
  position: sticky;
  top: 0;
  z-index: 200;
  margin-top: 1rem;
  padding: 0.8rem 0;
  isolation: isolate;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
}

.site-nav-wrap.is-scrolled {
  box-shadow: 0 1px 0 var(--nav-strip-border), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.site-nav-wrap::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
  width: auto;
  background: var(--nav-strip-bg);
  border-top: 1px solid var(--nav-strip-border);
  border-bottom: 1px solid var(--nav-strip-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  padding-top: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 0.35em 0;
  font-family: var(--font-serif);
  font-size: var(--size-nav);
  font-weight: 400;
  line-height: 1.2;
  color: var(--nav-text);
  text-decoration: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.is-active {
  background: transparent;
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* Main layout blocks */

.page-main {
  flex: 1 0 auto;
  padding: 1.75rem 0 2.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 2rem 2.5rem;
  align-items: start;
  margin: 0;
  padding: 0;
}

.hero-photo {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--frame-shadow);
  aspect-ratio: 3 / 4;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-contacts p {
  margin: 0;
}

.hero-text {
  margin: 0;
  padding: 0;
  font-size: var(--size-body);
  line-height: 1.42;
}

.hero-text p {
  margin: 0 0 0.85em;
  text-align: justify;
  hyphens: auto;
}

@media (max-width: 900px) {
  .hero-text p,
  .history-content p {
    text-align: left;
    hyphens: none;
  }
}

.hero-text p:last-child {
  margin-bottom: 0;
}

.home-history-hero {
  margin-top: 0;
}

.home-thanks {
  margin-top: 1.75rem;
}

.thanks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.12em 2.5rem;
  margin: 0;
  font-size: var(--size-body-sm);
  line-height: 1.35;
  color: var(--text-muted);
}

.thanks-col p {
  margin: 0;
}

.history-hero {
  margin-bottom: 0.75rem;
  padding: 0.65rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--frame-shadow);
}

.history-hero__photo {
  cursor: zoom-in;
}

.history-hero__photo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.history-hero img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.history-hero .figure-caption {
  margin: 0.65rem 0 0 auto;
  max-width: 100%;
  width: fit-content;
  font-family: var(--font-sans);
  font-size: var(--size-body-sm);
  line-height: 1.35;
  color: var(--text-muted);
  text-align: right;
}

.history-content {
  max-width: none;
  font-size: var(--size-body-sm);
  line-height: 1.42;
}

.history-content p {
  margin: 0 0 0.85em;
  text-align: justify;
  hyphens: auto;
}

.history-content .history-lead {
  margin-bottom: 1em;
  font-family: var(--font-serif);
  font-size: var(--size-lead);
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  hyphens: none;
}

.home-section {
  margin-top: 3.25rem;
  scroll-margin-top: 5.5rem;
}

.home-section:first-child {
  margin-top: 0;
}

.section-heading {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: var(--size-section);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.section-heading__note {
  display: block;
  margin-top: 0.35em;
  font-family: var(--font-sans);
  font-size: var(--size-body-sm);
  font-weight: 400;
  color: var(--text-muted);
}

.section-footer {
  margin-top: 1.25rem;
  text-align: right;
}

.section-link {
  font-family: var(--font-serif);
  font-size: var(--size-nav);
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.section-link:hover {
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.gallery-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.gallery-preview .gallery-item {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.gallery-preview .gallery-item__image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 0.55rem;
  background: #ebe6dc;
}

.gallery-preview .gallery-item__image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-preview .gallery-item__title {
  flex-shrink: 0;
  margin-top: auto;
}

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

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

.gallery-preview--books .gallery-item {
  width: 100%;
}

.gallery-preview--books .gallery-item__image {
  aspect-ratio: 3 / 4;
  width: 100%;
  max-height: 240px;
  padding: 0.5rem;
}

.gallery-preview--books .gallery-item__title {
  font-size: var(--size-body-sm);
  min-height: 2.6em;
}

/* Section pages */

.page-heading {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: var(--size-subtitle);
  font-weight: 700;
  line-height: 1.1;
}

.page-intro {
  max-width: 72ch;
  margin-bottom: 1.5rem;
  font-size: var(--size-body-sm);
  line-height: 1.42;
  color: var(--text);
}

.page-intro--subtitle {
  margin: -0.35rem 0 0.5rem;
  font-family: var(--font-serif);
  font-size: var(--size-lead);
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-muted);
}

/* Painting gallery */

.subnav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-bottom: 1.5rem;
  padding: 0.3rem;
  background: var(--nav-strip-bg);
  border: 1px solid var(--nav-strip-border);
  border-radius: 4px;
}

.subnav a {
  padding: 0.45em 1em;
  font-family: var(--font-serif);
  font-size: var(--size-nav);
  font-weight: 400;
  line-height: 1.2;
  color: var(--nav-text);
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.subnav a.is-active,
.subnav a:hover {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.gallery-toolbar__views {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.gallery-more[hidden] {
  display: none;
}

.gallery-more-sentinel {
  height: 1px;
  pointer-events: none;
}

.gallery-empty {
  margin: 0;
  grid-column: 1 / -1;
  color: var(--text-muted);
}

.search-box {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.15rem;
  background: var(--nav-strip-bg);
  border: 1px solid var(--nav-strip-border);
  border-radius: 4px;
}

.search-box input {
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  font-family: var(--font-sans);
  font-size: var(--size-body-sm);
  line-height: 1.35;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
  overflow: hidden;
  transition: width 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box.is-open input,
.search-box:focus-within input {
  width: 14rem;
  padding: 0.28em 0.35em 0.28em 0.7em;
  opacity: 1;
  pointer-events: auto;
}

.search-box__clear {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: 0.1rem;
  color: var(--text-muted);
}

.search-box__clear[hidden] {
  display: none;
}

.search-box__clear:hover {
  color: var(--accent);
  background: transparent;
}

.search-box.is-open input:focus,
.search-box:focus-within input:focus {
  outline: none;
}

.search-box.is-open .search-box__toggle,
.search-box:focus-within .search-box__toggle {
  color: var(--accent);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.search-box input::-webkit-search-decoration,
.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.layout-toggle,
.columns-toggle {
  display: inline-flex;
  padding: 0.15rem;
  background: var(--nav-strip-bg);
  border: 1px solid var(--nav-strip-border);
  border-radius: 4px;
}

.gallery-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.gallery-tool-btn svg {
  display: block;
}

.gallery-tool-btn.is-active {
  color: var(--accent);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.gallery-tool-btn:hover:not(.is-active) {
  color: var(--accent-soft);
  background: rgba(255, 255, 255, 0.55);
}

.gallery-grid {
  display: grid;
  gap: 1rem;
}

.gallery-grid[data-columns="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.gallery-grid[data-columns="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.gallery-grid[data-columns="4"] {
  grid-template-columns: repeat(4, 1fr);
}

.gallery-grid--masonry {
  display: block;
  column-gap: 1rem;
}

.gallery-grid--masonry[data-columns="2"] {
  columns: 2;
}

.gallery-grid--masonry[data-columns="3"] {
  columns: 3;
}

.gallery-grid--masonry[data-columns="4"] {
  columns: 4;
}

.gallery-grid--masonry .gallery-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 1rem;
  break-inside: avoid;
}

.gallery-grid--masonry .gallery-item__image {
  aspect-ratio: auto;
  height: auto;
}

.gallery-grid--masonry .gallery-item__image img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.gallery-item {
  cursor: pointer;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--frame-shadow);
  text-decoration: none;
  color: inherit;
}

.gallery-item:hover {
  text-decoration: none;
}

.gallery-item__image {
  background: #c8bfb0;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.gallery-grid:not(.gallery-grid--masonry) .gallery-item {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.gallery-grid:not(.gallery-grid--masonry) .gallery-item__image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 0.6rem;
  background: #ebe6dc;
}

.gallery-grid:not(.gallery-grid--masonry) .gallery-item__image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-grid:not(.gallery-grid--masonry) .gallery-item__title {
  flex-shrink: 0;
  margin-top: auto;
}

.gallery-item__image img {
  display: block;
  transition: transform 0.45s ease;
}

.gallery-item__title {
  min-height: 2.6em;
  padding: 0.4em 0.45em;
  font-family: var(--font-sans);
  font-size: var(--size-body-sm);
  line-height: 1.3;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-item:hover .gallery-item__image img {
    transform: scale(1.04);
  }

  .gallery-item:hover .gallery-item__title {
    color: var(--accent);
  }
}

.publications-list {
  display: grid;
  gap: 1rem;
}

.publication-card {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.publication-card:hover {
  border-color: rgba(47, 102, 153, 0.35);
  background: rgba(255, 255, 255, 0.92);
}

.publication-card:hover .publication-card__title {
  color: var(--accent);
}

.publication-card__cover {
  width: 72px;
  height: 96px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.publication-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.publication-card__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 88px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: linear-gradient(180deg, #4a7ca8 0%, #356392 100%);
  border-radius: 2px;
}

.publication-card__title {
  margin: 0 0 0.25em;
  font-family: var(--font-sans);
  font-size: var(--size-body);
  font-weight: 700;
  line-height: 1.35;
  transition: color 0.25s ease;
}

.publication-card__meta {
  margin: 0;
  font-size: var(--size-body-sm);
  line-height: 1.35;
  color: var(--text-muted);
}

.publication-card__body {
  min-width: 0;
}

.publication-card__action {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  min-width: 9.5rem;
}

.publication-card__action .btn {
  width: 100%;
  white-space: nowrap;
}

.publication-card__size {
  display: block;
  text-align: center;
  font-size: var(--size-body-sm);
  line-height: 1.2;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 0.45em 1em;
  font-family: var(--font-sans);
  font-size: var(--size-body-sm);
  font-weight: 400;
  line-height: 1.2;
  color: var(--accent);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--nav-bg);
  border-radius: 2px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--nav-bg);
  color: var(--text);
  text-decoration: none;
}

.btn--secondary {
  color: var(--text);
  border-color: var(--border);
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent);
  border-color: var(--accent-soft);
}

/* Footer */

.site-footer {
  position: relative;
  z-index: 0;
  flex-shrink: 0;
  margin-top: 2.5rem;
  padding: 0 0 1.15rem;
  isolation: isolate;
}

.site-footer::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: linear-gradient(
    180deg,
    rgba(228, 235, 242, 0.45) 0%,
    var(--footer-strip-bg) 18%,
    var(--footer-strip-bg) 100%
  );
  border-top: 1px solid var(--nav-strip-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.site-footer .container {
  padding-top: 1.15rem;
}

.site-footer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.footer-logo {
  flex-shrink: 0;
  display: block;
  width: auto;
  height: 40px;
}

.footer-brand__contact {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--size-footer);
  line-height: 1.3;
}

.footer-brand__contact a {
  color: var(--accent);
  text-decoration: none;
}

.footer-brand__contact a:hover {
  text-decoration: underline;
}

.footer-copy {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--size-footer-sm);
  line-height: 1.3;
  color: var(--text-muted);
}

.footer-legal {
  margin-top: 0.7rem;
  font-family: var(--font-sans);
  font-size: var(--size-footer-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.footer-legal p {
  margin: 0 0 0.25rem;
}

.footer-legal p:last-child {
  margin-bottom: 0;
}

/* PhotoSwipe: непрозрачный чёрный фон, страница не просвечивает */

.pswp {
  --pswp-bg: #000;
}

/* PhotoSwipe caption (bottom-right) */

.pswp__sharov-caption {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 10;
  max-width: min(22rem, calc(100vw - 2.5rem));
  padding: 0.75rem 1rem;
  color: #f2f2f2;
  text-align: right;
  pointer-events: none;
  background: rgba(12, 12, 12, 0.55);
}

.pswp__sharov-caption-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.3;
}

.pswp__sharov-caption-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(242, 242, 242, 0.88);
}

.pswp__sharov-caption.is-below {
  max-height: 42vh;
  overflow: auto;
  pointer-events: auto;
  overscroll-behavior: contain;
}

.pswp__sharov-caption[hidden] {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --size-title: calc(32 / 13 * 1rem);
    --size-subtitle: calc(20 / 13 * 1rem);
    --size-contacts: calc(16 / 13 * 1rem);
  }
}

@media (max-width: 560px) {
  :root {
    --size-title: calc(28 / 13 * 1rem);
    --size-subtitle: calc(18 / 13 * 1rem);
    --size-nav: calc(14 / 13 * 1rem);
    --size-contacts: calc(15 / 13 * 1rem);
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .history-hero .figure-caption {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
}

/* Responsive */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .pswp__sharov-caption {
    right: 0.75rem;
    bottom: 0.75rem;
    max-width: calc(100vw - 1.5rem);
  }

  /* Превью на главной: одна карточка на экран + лёгкий peek следующей */
  .gallery-preview {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .gallery-preview::-webkit-scrollbar {
    display: none;
  }

  .gallery-preview .gallery-item,
  .gallery-preview--books .gallery-item {
    flex: 0 0 calc(100% - 1.75rem);
    max-width: calc(100% - 1.75rem);
    scroll-snap-align: start;
  }

  .site-contacts {
    text-align: left;
  }

  .site-footer__bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-grid[data-columns="4"] {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid--masonry[data-columns="3"],
  .gallery-grid--masonry[data-columns="4"] {
    columns: 2;
  }

  .thanks-grid {
    grid-template-columns: 1fr;
    gap: 2.75rem;
    line-height: 1.55;
  }

  .thanks-col p {
    margin: 0 0 0.65em;
  }

  .thanks-col p:last-child {
    margin-bottom: 0;
  }

  .thanks-col + .thanks-col {
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.14);
  }

  .publication-card {
    grid-template-columns: 72px 1fr;
  }

  .publication-card__action {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }

  .publication-card__action .btn {
    width: auto;
    flex: 1 1 auto;
  }

  .publication-card__size {
    flex: 1 0 100%;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .site-nav-wrap {
    padding: 0;
  }

  .site-nav-wrap .container {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .site-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
  }

  .site-nav a {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 0.55em 0.5rem;
    text-align: center;
    border-top: none;
    border-bottom: 2px solid transparent;
  }

  .gallery-grid[data-columns="2"],
  .gallery-grid[data-columns="3"],
  .gallery-grid[data-columns="4"] {
    grid-template-columns: 1fr;
  }

  .gallery-grid--masonry[data-columns="2"],
  .gallery-grid--masonry[data-columns="3"],
  .gallery-grid--masonry[data-columns="4"] {
    columns: 1;
  }

  .layout-toggle,
  .columns-toggle {
    display: none;
  }

  .gallery-toolbar {
    align-items: stretch;
  }

  .gallery-toolbar__views {
    margin-left: 0;
    width: 100%;
  }

  .search-box {
    flex: 1 1 auto;
    width: 100%;
  }

  .search-box input {
    width: 100%;
    min-width: 0;
    padding: 0.4em 0.55em 0.4em 0.75rem;
    opacity: 1;
    pointer-events: auto;
  }
}

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

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

