:root {
  --color-bg: #fbf8ff;
  --color-bg-soft: #f7f1ff;
  --color-surface: #ffffff;
  --color-surface-2: #fffafe;
  --color-primary: #4d23a5;
  --color-primary-2: #6f35d4;
  --color-primary-hover: #3d168f;
  --color-primary-soft: #eee4ff;
  --color-accent: #c8902f;
  --color-accent-soft: #fff2d6;
  --color-danger: #b42318;
  --color-text: #201143;
  --color-muted: #6d6282;
  --color-border: #e8dcfb;
  --color-focus: #ffb84d;
  --font-base: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-main: var(--font-base);
  --font-headings: var(--font-display);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --border-radius-sm: var(--radius-sm);
  --border-radius-md: var(--radius-md);
  --border-radius-lg: var(--radius-lg);
  --shadow-sm: 0 8px 24px rgb(77 35 165 / 8%);
  --shadow-md: 0 18px 44px rgb(77 35 165 / 14%);
  --transition-fast: 160ms ease;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --container: 2560px;
  --bp-mobile: 640px;
  --bp-tablet: 900px;
  --bp-desktop: 1180px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.5;
}

body.is-accessible-mode {
  --color-bg: #ffffff;
  --color-bg-soft: #f2f2f2;
  --color-surface: #ffffff;
  --color-surface-2: #ffffff;
  --color-primary: #111111;
  --color-primary-2: #111111;
  --color-primary-hover: #000000;
  --color-primary-soft: #eeeeee;
  --color-accent: #000000;
  --color-accent-soft: #f4f4f4;
  --color-text: #000000;
  --color-muted: #333333;
  --color-border: #000000;
  --color-focus: #ffbf00;
  font-size: 18px;
}

body.is-accessible-mode .hero,
body.is-accessible-mode .button-primary,
body.is-accessible-mode .event-date {
  background: var(--color-surface);
}

body.is-accessible-mode .button-primary,
body.is-accessible-mode .button-secondary {
  border-color: var(--color-text);
  color: var(--color-text);
  box-shadow: none;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--color-primary);
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--color-text);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 0;
  background: linear-gradient(180deg, rgb(251 248 255 / 94%), rgb(251 248 255 / 72%));
  backdrop-filter: blur(12px);
}

.header-inner,
.section-shell,
.footer-inner {
  width: min(calc(100% - 48px), var(--container));
  margin-inline: auto;
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  gap: var(--space-5);
  align-items: center;
  min-height: 86px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 64px;
}

.brand > span:last-child {
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 76px;
  height: 64px;
  flex: 0 0 auto;
  overflow: hidden;
  color: transparent;
  background: url("../images/brand-book.svg") center / contain no-repeat;
  font-size: 0;
}

.brand-title,
.brand-subtitle {
  display: block;
  overflow-wrap: anywhere;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
}

.brand-subtitle {
  max-width: 260px;
  color: var(--color-muted);
  font-size: 13px;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 2vw, 28px);
  min-width: 0;
  font-weight: 600;
}

.menu-list {
  display: contents;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a,
.mobile-menu a,
.text-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.main-nav a {
  max-width: 156px;
  justify-content: center;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-2);
}

.desktop-search {
  display: grid;
  grid-template-columns: minmax(220px, 420px) 48px;
  align-items: center;
  min-width: min(32vw, 468px);
}

.desktop-search input {
  min-height: 48px;
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--color-surface);
}

.desktop-search-submit {
  min-width: 48px;
  min-height: 48px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-primary);
  color: #fff;
}

.desktop-search-submit:hover,
.desktop-search-submit:active {
  background: var(--color-primary-hover);
  color: #fff;
}

.hero-search {
  display: none;
}

.search-toggle {
  display: none;
}

.access-link,
.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.access-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.access-link .ui-icon {
  width: 20px;
  height: 20px;
}

.header-actions .search-toggle {
  display: none;
}

.icon-button:hover,
.icon-button:active,
.access-link:hover,
.access-link:active,
.access-link[aria-pressed="true"] {
  background: var(--color-primary-soft);
}

.menu-toggle {
  display: none;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.site-search {
  display: none;
  width: min(calc(100% - 32px), 760px);
  margin: 0 auto var(--space-4);
  gap: var(--space-2);
}

.site-search.is-open,
.mobile-menu.is-open {
  display: flex;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: var(--color-text);
  font: inherit;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  width: min(calc(100% - 32px), var(--container));
  margin: 0 auto var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.hero {
  display: grid;
  grid-template-columns: minmax(420px, 0.72fr) minmax(520px, 1.28fr);
  gap: var(--space-6);
  align-items: stretch;
  margin-top: var(--space-4);
  padding: clamp(24px, 3vw, 44px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.96) 36%, rgba(255, 255, 255, 0.72) 52%, rgba(238, 228, 255, 0.72) 100%),
    url("../images/ref-hero-zlatoust-library.webp") right center / cover no-repeat,
    linear-gradient(135deg, #fff 0%, #f3e9ff 52%, #eadfff 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  align-self: center;
}

.eyebrow {
  color: var(--color-primary);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  max-width: 780px;
  font-family: var(--font-display);
  font-size: clamp(42px, 4vw, 72px);
  overflow-wrap: normal;
  hyphens: none;
}

h2 {
  font-size: 24px;
}

.hero-lead {
  max-width: 620px;
  color: var(--color-muted);
  font-size: 19px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 800;
}

.ui-icon,
.service-icon,
.library-meta-icon,
.stat-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.icon-arrow { --icon-url: url("../images/icon-arrow.svg"); }
.icon-book { --icon-url: url("../images/icon-book.svg"); }
.icon-calendar { --icon-url: url("../images/icon-calendar.svg"); }
.icon-renew { --icon-url: url("../images/icon-renew.svg"); }
.icon-image { --icon-url: url("../images/icon-image.svg"); }
.icon-litres { --icon-url: url("../images/icon-litres.svg"); }
.icon-neb { --icon-url: url("../images/icon-neb.svg"); }
.icon-building { --icon-url: url("../images/icon-building.svg"); }
.icon-search { --icon-url: url("../images/icon-search.svg"); }
.icon-eye { --icon-url: url("../images/icon-eye.svg"); }
.icon-pin { --icon-url: url("../images/icon-pin.svg"); }
.icon-phone { --icon-url: url("../images/icon-phone.svg"); }
.icon-clock { --icon-url: url("../images/icon-clock.svg"); }
.icon-mail { --icon-url: url("../images/icon-mail.svg"); }
.icon-stack { --icon-url: url("../images/icon-stack.svg"); }
.icon-users { --icon-url: url("../images/icon-users.svg"); }

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  color: #fff;
  box-shadow: 0 10px 22px rgb(77 35 165 / 24%);
}

.button-primary:hover {
  color: #fff;
  transform: translateY(-1px);
}

.button-secondary {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.button-secondary:hover {
  background: var(--color-primary-soft);
}

.button:active {
  transform: translateY(1px);
}

.hero-art {
  position: relative;
  min-height: clamp(340px, 24vw, 470px);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(to top, rgb(77 35 165 / 24%), transparent 52%),
    linear-gradient(90deg, rgb(255 255 255 / 6%), rgb(238 228 255 / 16%)),
    url("../images/ref-hero-zlatoust-library.webp") center right / cover no-repeat;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 36%);
}

.hero-art .sun,
.hero-art .mountains {
  display: none;
}

.sun {
  position: absolute;
  top: 38px;
  right: 58px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  box-shadow: 0 0 0 18px rgb(200 144 47 / 10%);
}

.mountains {
  position: absolute;
  inset: 74px 28px 80px;
  background:
    linear-gradient(135deg, transparent 48%, rgb(77 35 165 / 22%) 49% 52%, transparent 53%) 0 30% / 42% 70% no-repeat,
    linear-gradient(45deg, transparent 48%, rgb(77 35 165 / 28%) 49% 52%, transparent 53%) 42% 40% / 54% 64% no-repeat,
    linear-gradient(135deg, transparent 48%, rgb(200 144 47 / 30%) 49% 51%, transparent 52%) 60% 10% / 40% 80% no-repeat;
}

.anniversary-card {
  position: absolute;
  right: 28px;
  bottom: 28px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px;
  align-items: end;
  min-width: 270px;
  padding: 18px 22px 20px;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 94%), rgb(255 250 254 / 88%)),
    linear-gradient(135deg, rgb(255 255 255 / 72%), rgb(238 228 255 / 52%));
  border: 1px solid rgb(200 144 47 / 48%);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 38px rgb(77 35 165 / 16%);
  text-align: center;
}

.anniversary-number {
  color: var(--color-accent);
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 0 rgb(255 255 255 / 62%);
}

.anniversary-years {
  padding-bottom: 12px;
  color: var(--color-accent);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.anniversary-card strong,
.anniversary-card small,
.anniversary-card em {
  grid-column: 1 / -1;
}

.anniversary-card strong {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
}

.anniversary-card em {
  margin-top: 6px;
  color: #8f3a25;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.panel,
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: var(--space-5);
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.text-link {
  color: var(--color-primary);
  font-weight: 800;
}

.text-link:hover {
  text-decoration: underline;
}

.text-link:active {
  color: var(--color-primary-hover);
}

.news-card,
.event-card,
.project-card,
.library-card,
.service-card {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  min-height: 44px;
}

.news-card:hover,
.event-card:hover,
.project-card:hover,
.library-card:hover {
  color: var(--color-primary);
}

.news-card:active,
.event-card:active,
.project-card:active,
.library-card:active {
  transform: translateY(1px);
}

.news-card {
  position: relative;
  grid-template-columns: 150px 1fr;
  align-items: center;
  min-height: 124px;
  padding: 8px;
  border: 1px solid rgb(232 220 251 / 70%);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgb(255 255 255 / 86%), rgb(251 248 255 / 78%));
}

.card-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding-right: 28px;
}

.content-chip {
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.card-arrow {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}

.news-list,
.event-list {
  display: grid;
  gap: 0;
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.news-list a {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  min-height: 66px;
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
}

.news-list a:hover,
.news-list a:active {
  color: var(--color-primary);
}

.news-mini-thumb {
  display: block;
  min-height: 54px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft) center / cover no-repeat;
}

.news-mini-library {
  background-image: url("../images/ref-library-branch.webp");
}

.news-mini-project {
  background-image: url("../images/ref-project-local-history.webp");
}

.thumb {
  display: block;
  min-height: 112px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary-soft), #fff);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--color-border);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 42%);
}

.thumb-news {
  background-image: url("../images/ref-news-reading-club.webp");
  background-position: center;
}

.thumb-project {
  background-image: url("../images/ref-project-local-history.webp");
  background-position: center right;
}

.thumb-library {
  background-image: url("../images/ref-library-branch.webp");
  background-position: center;
}

.thumb-youth {
  background-image: url("../images/ref-youth-reading.webp");
  background-position: center;
}

.news-card strong,
.news-list strong,
.event-card strong,
.project-card strong,
.service-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  hyphens: auto;
}

small,
em {
  color: var(--color-muted);
  font-style: normal;
  overflow-wrap: anywhere;
}

.news-list strong {
  font-size: 14px;
  line-height: 1.2;
}

.news-list small {
  font-size: 11px;
}

.event-card {
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  padding: var(--space-3);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(105deg, rgba(104, 55, 196, 0.11), rgba(255, 255, 255, 0.86) 48%, rgba(224, 212, 255, 0.72)),
    var(--color-bg-soft);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 52%);
}

.event-card-featured {
  grid-template-columns: 76px minmax(0, 1fr) minmax(112px, 0.56fr);
  min-height: 150px;
}

.event-info {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.event-date,
.event-mini-date {
  display: grid;
  place-items: center;
  color: #fff;
  text-align: center;
}

.event-date {
  min-height: 82px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  box-shadow: 0 12px 24px rgba(104, 55, 196, 0.2);
}

.event-date strong {
  font-size: 28px;
}

.event-date small,
.event-mini-date small {
  line-height: 1.1;
}

.event-date small {
  color: #fff;
}

.event-thumb {
  display: block;
  align-self: stretch;
  min-height: 126px;
  border: 1px solid rgba(104, 55, 196, 0.14);
  border-radius: var(--radius-md);
  background: url("../images/ref-event-speaker.webp") center right / cover no-repeat;
}

.event-list a {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  min-height: 58px;
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
}

.event-list a:hover,
.event-list a:active {
  color: var(--color-primary);
}

.event-mini-date {
  min-height: 48px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-primary);
}

.event-mini-date strong {
  font-size: 13px;
  line-height: 1.1;
}

.event-mini-date small,
.event-list small {
  font-size: 11px;
}

.event-list strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.project-card {
  position: relative;
  padding: 8px;
  border: 1px solid rgb(232 220 251 / 70%);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgb(255 255 255 / 86%), rgb(248 244 255 / 72%));
}

.project-card .thumb {
  min-height: 172px;
}

.youth-card {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: stretch;
  padding: 8px;
  border: 1px solid rgb(232 220 251 / 70%);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgb(255 255 255 / 86%), rgb(248 244 255 / 72%));
}

.youth-card .thumb {
  min-height: 166px;
  background-position: center left;
}

.youth-links {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.youth-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-primary);
  font-weight: 700;
}

.youth-links a::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("../images/icon-arrow.svg") center / contain no-repeat;
  mask: url("../images/icon-arrow.svg") center / contain no-repeat;
}

.youth-links a:hover,
.youth-links a:active {
  background: var(--color-primary-soft);
}

.libraries,
.services,
.stats {
  margin-top: var(--space-4);
}

.home-lower {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.home-lower .libraries,
.home-lower .services {
  margin-top: 0;
}

.libraries-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.map-placeholder {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: url("../images/ref-zlatoust-library-map.webp") center / cover no-repeat;
}

.map-placeholder span {
  display: none;
}

.map-callout {
  position: absolute;
  left: 22%;
  right: 28%;
  bottom: 9%;
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 10px 18px;
  border: 1px solid rgb(232 220 251 / 88%);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 12px 24px rgb(77 35 165 / 10%);
}

.map-callout strong {
  color: var(--color-primary);
  font-size: 14px;
  line-height: 1.15;
}

.map-callout small {
  font-size: 12px;
}

.map-placeholder span:nth-child(1) { left: 18%; top: 36%; }
.map-placeholder span:nth-child(2) { left: 44%; top: 52%; }
.map-placeholder span:nth-child(3) { right: 24%; top: 28%; }
.map-placeholder span:nth-child(4) { right: 14%; bottom: 24%; }

.library-card {
  grid-template-columns: 180px 1fr;
  align-items: center;
}

.library-card > div {
  min-width: 0;
}

.library-meta {
  display: grid;
  gap: 7px;
  margin: var(--space-2) 0 var(--space-2);
  padding: 0;
  list-style: none;
}

.library-meta li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.25;
}

.library-meta-icon {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

.library-card-link {
  gap: 6px;
  min-height: 36px;
}

.library-card-link .ui-icon {
  width: 18px;
  height: 18px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
}

.service-card {
  place-items: center;
  min-height: 112px;
  padding: var(--space-4);
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 96%), rgb(248 244 255 / 88%)),
    var(--color-surface-2);
  box-shadow: 0 10px 24px rgb(77 35 165 / 6%);
}

.service-card:hover {
  background:
    linear-gradient(145deg, rgb(255 255 255 / 98%), rgb(238 228 255 / 94%)),
    var(--color-primary-soft);
  transform: translateY(-2px);
}

.service-card:active {
  transform: translateY(1px);
}

.service-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--color-primary);
  background:
    linear-gradient(145deg, rgb(238 228 255), rgb(255 255 255));
  box-shadow: inset 0 0 0 1px rgb(111 53 212 / 16%);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 8% 50%, rgb(200 144 47 / 16%), transparent 28%),
    linear-gradient(135deg, rgba(238, 228, 255, 0.78), rgba(255, 255, 255, 0.94)),
    var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 14px 18px;
  text-align: left;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.stat-card + .stat-card {
  border-left: 1px solid var(--color-border);
}

.stat-icon {
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 14px;
  color: var(--color-primary);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 82%), rgb(238 228 255 / 92%));
  box-shadow: inset 0 0 0 1px rgb(111 53 212 / 14%);
}

.stat-card strong {
  display: block;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
}

.stat-card small {
  display: block;
  margin-top: 4px;
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.2;
}

.stat-card-pending strong {
  font-family: var(--font-base);
  font-size: 18px;
  font-weight: 800;
}

.stat-card-pending small {
  color: var(--color-muted);
}

.heritage-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-5);
  align-items: center;
  margin-top: var(--space-4);
  min-height: 150px;
  padding: var(--space-5) clamp(24px, 4vw, 54px);
  overflow: hidden;
  border: 1px solid rgb(200 144 47 / 36%);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(100deg, rgb(255 255 255 / 94%) 0%, rgb(255 255 255 / 86%) 46%, rgb(238 228 255 / 70%) 100%),
    url("../images/ref-hero-zlatoust-library.webp") right center / cover no-repeat;
  box-shadow: var(--shadow-sm);
}

.heritage-copy {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 34px);
  min-width: 0;
}

.heritage-number {
  flex: 0 0 auto;
  color: var(--color-accent);
  font-family: var(--font-display);
  font-size: clamp(72px, 7vw, 116px);
  font-weight: 700;
  line-height: 0.88;
  text-shadow: 0 2px 0 rgb(255 255 255 / 72%);
}

.heritage-banner h2 {
  max-width: 720px;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.04;
}

.heritage-banner p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--color-text);
  font-size: 17px;
}

.heritage-link {
  gap: 8px;
  min-width: max-content;
  padding: 10px 14px;
  border: 1px solid rgb(111 53 212 / 22%);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 82%);
}

.heritage-link .ui-icon {
  width: 18px;
  height: 18px;
}

.site-footer {
  margin-top: var(--space-4);
  padding: var(--space-5) 0;
  background:
    radial-gradient(circle at 12% 12%, rgb(200 144 47 / 10%), transparent 24%),
    linear-gradient(180deg, rgb(247 241 255 / 72%), #fff);
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(240px, 1fr) minmax(180px, 0.8fr) minmax(280px, 1fr);
  gap: var(--space-5);
  align-items: start;
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 92%), rgb(251 248 255 / 86%)),
    var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.footer-brand-col,
.footer-contact,
.footer-nav,
.footer-subscribe {
  display: grid;
  gap: var(--space-2);
}

.footer-brand-col p,
.footer-contact span {
  color: var(--color-muted);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-2);
}

.footer-social span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgb(77 35 165 / 14%);
}

.footer-social span:nth-child(1) { background: #2f78c6; }
.footer-social span:nth-child(2) { background: #ee8b22; }
.footer-social span:nth-child(3) { background: #2aabee; }
.footer-social span:nth-child(4) { background: #e53935; }

.footer-contact {
  font-style: normal;
}

.footer-contact strong,
.subscribe-form label {
  font-weight: 800;
}

.footer-contact span {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 30px;
  overflow-wrap: anywhere;
}

.footer-inner nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-primary);
  font-weight: 700;
}

.subscribe-form label {
  display: block;
  margin-bottom: var(--space-2);
}

.subscribe-form div {
  display: grid;
  grid-template-columns: 1fr auto;
}

.footer-subscribe {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 94%), rgb(248 244 255 / 86%)),
    var(--color-surface-2);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 52%);
}

.footer-subscribe input {
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.footer-subscribe .button {
  width: 52px;
  min-width: 52px;
  padding-inline: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.archive-hero {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding: clamp(28px, 4vw, 48px);
  background: linear-gradient(135deg, #fff, var(--color-bg-soft));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--color-muted);
  font-size: 14px;
}

.breadcrumbs a {
  color: var(--color-primary);
  font-weight: 700;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.archive-hero h1 {
  max-width: 860px;
  font-size: clamp(34px, 5vw, 58px);
}

.archive-hero p:last-child {
  max-width: 760px;
  color: var(--color-muted);
  font-size: 18px;
}

.archive-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  width: fit-content;
  max-width: 100%;
  margin-top: var(--space-2);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 78%);
}

.archive-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  color: var(--color-text);
  font-weight: 800;
  border-right: 1px solid var(--color-border);
}

.archive-tabs a:last-child {
  border-right: 0;
}

.archive-tabs a:hover,
.archive-tabs a:active,
.archive-tabs a[aria-current="page"] {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.archive-tabs a[aria-current="page"] {
  box-shadow: inset 0 -3px 0 var(--color-primary);
}

.archive-content {
  margin-top: var(--space-4);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.archive-card {
  min-width: 0;
}

.archive-card-link {
  display: grid;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.archive-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.archive-card-link:active {
  transform: translateY(1px);
}

.archive-card-thumb {
  display: block;
  min-height: 180px;
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  border-bottom: 1px solid var(--color-border);
}

.archive-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
}

.archive-card-events .archive-card-thumb {
  background:
    radial-gradient(circle at 22% 28%, #fff 0 8%, transparent 9%),
    linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
}

.archive-card-branches .archive-card-thumb {
  background:
    linear-gradient(90deg, transparent 12%, rgb(77 35 165 / 18%) 13% 16%, transparent 17% 32%, rgb(77 35 165 / 18%) 33% 36%, transparent 37%),
    linear-gradient(135deg, #fff, var(--color-primary-soft));
}

.archive-card-projects .archive-card-thumb {
  background:
    linear-gradient(135deg, rgb(77 35 165 / 16%), transparent),
    linear-gradient(45deg, transparent 49%, rgb(77 35 165 / 28%) 50% 52%, transparent 53%);
}

.archive-card-body {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-5);
}

.archive-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.archive-card-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 800;
}

.archive-card-meta {
  display: inline-grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: var(--color-muted);
}

.archive-card-meta .library-meta-icon {
  width: 17px;
  height: 17px;
  color: var(--color-primary);
}

.archive-card-body strong {
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.archive-card-body em {
  overflow-wrap: anywhere;
}

.archive-card-arrow {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: var(--space-2);
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-primary);
}

.archive-card-link:hover .archive-card-arrow,
.archive-card-link:active .archive-card-arrow {
  background: var(--color-primary);
  color: #fff;
}

.archive-card-arrow .ui-icon {
  width: 18px;
  height: 18px;
}

.pagination-nav {
  margin-top: var(--space-5);
}

.pagination-nav .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pagination-nav a,
.pagination-nav span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.pagination-nav .current {
  background: var(--color-primary);
  color: #fff;
}

.empty-state {
  max-width: 720px;
}

.single-entry {
  margin-top: var(--space-5);
}

.single-hero {
  display: grid;
  gap: var(--space-3);
  padding: clamp(28px, 4vw, 48px);
  background: linear-gradient(135deg, #fff, var(--color-bg-soft));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.single-hero h1 {
  max-width: 920px;
  font-size: clamp(34px, 5vw, 62px);
}

.single-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.single-back-link {
  display: inline-flex;
  gap: 6px;
  justify-self: start;
}

.single-back-link .ui-icon {
  width: 18px;
  height: 18px;
}

.single-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-4);
  align-items: start;
  margin-top: var(--space-4);
}

.single-main {
  min-width: 0;
}

.single-featured-image {
  margin: 0 0 var(--space-5);
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.single-featured-image img {
  display: block;
  width: 100%;
  height: auto;
}

.single-content {
  max-width: 820px;
}

.single-content > *:first-child {
  margin-top: 0;
}

.single-content p,
.single-content li {
  color: var(--color-text);
  font-size: 18px;
}

.single-content a {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.single-content img {
  max-width: 100%;
  height: auto;
}

.single-content figure {
  max-width: 100%;
  margin: var(--space-5) 0;
}

.single-content figcaption {
  margin-top: var(--space-2);
  color: var(--color-muted);
  font-size: 14px;
}

.single-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}

.single-content th,
.single-content td {
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.single-content iframe,
.single-content embed,
.single-content object,
.single-content video {
  max-width: 100%;
}

.single-content iframe {
  border: 0;
}

.single-content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.single-content code {
  overflow-wrap: anywhere;
}

.single-content blockquote {
  margin: var(--space-5) 0;
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.single-meta {
  position: sticky;
  top: 110px;
}

.fact-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fact-list li {
  display: grid;
  gap: 2px;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.fact-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.fact-list span {
  color: var(--color-muted);
  font-size: 14px;
}

.fact-list strong {
  white-space: pre-line;
}

.single-meta-link {
  margin-top: var(--space-4);
}

/* ── taxonomy terms block ───────────────────────────── */
.single-meta-terms {
  margin-top: var(--space-4);
}

.single-meta-terms-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.single-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.single-meta-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.single-meta-tag:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}

/* ── related posts block ────────────────────────────── */
.single-meta-related {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.related-list li {
  display: grid;
  gap: 2px;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.related-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.related-list a {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.related-list a:hover {
  color: var(--color-primary);
}

.related-date {
  color: var(--color-muted);
  font-size: 12px;
}

.single-post-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.single-post-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-weight: 800;
}

.utility-list-section {
  margin-top: var(--space-4);
}

.utility-list,
.resource-list-grid {
  display: grid;
  gap: var(--space-3);
}

.resource-list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.utility-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  min-height: 96px;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.resource-item {
  grid-template-columns: 1fr;
  align-items: start;
}

.utility-item h2 {
  margin: var(--space-1) 0;
  font-size: 22px;
}

.utility-item p {
  margin: var(--space-2) 0 0;
  color: var(--color-muted);
}

.utility-arrow-link {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  justify-self: end;
}

.utility-arrow-link .archive-card-arrow {
  margin-top: 0;
}

.utility-arrow-link:hover .archive-card-arrow,
.utility-arrow-link:active .archive-card-arrow {
  background: var(--color-primary);
  color: #fff;
}

.page-content {
  margin-top: var(--space-4);
}

.page-content > *:first-child {
  margin-top: 0;
}

.contact-grid,
.reader-service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.contact-card,
.reader-service-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 180px;
}

.contact-card h2,
.reader-service-card h2 {
  font-size: 22px;
}

.contact-card p,
.reader-service-card p,
.contact-note p {
  color: var(--color-muted);
}

.contact-note {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.compliance-grid,
.vacancy-layout,
.not-found-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.vacancy-layout,
.not-found-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compliance-card,
.vacancy-card,
.not-found-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 180px;
}

.not-found-card {
  color: var(--color-text);
}

.not-found-card strong {
  font-size: 22px;
}

.not-found-card span,
.compliance-card p,
.vacancy-card p,
.legal-note p {
  color: var(--color-muted);
}

.legal-note {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

@media (max-width: 1180px) {
  .main-nav {
    display: none;
  }

  .header-inner {
    grid-template-columns: 1fr auto;
  }

  .access-link {
    min-width: 44px;
    padding: 0;
  }

  .access-label {
    display: none;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .desktop-search {
    display: none;
  }

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

  .hero-art {
    min-height: 280px;
  }

  .search-toggle,
  .header-actions .search-toggle {
    display: inline-grid;
  }

  .content-grid,
  .home-lower,
  .libraries-grid,
  .footer-inner,
  .archive-grid,
  .single-layout,
  .resource-list-grid,
  .contact-grid,
  .reader-service-grid,
  .compliance-grid,
  .vacancy-layout,
  .not-found-grid {
    grid-template-columns: 1fr;
  }

  .single-meta {
    position: static;
  }

  .service-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1181px) and (max-width: 1399px) {
  .header-inner {
    grid-template-columns: minmax(300px, 1fr) auto;
  }

  .main-nav {
    display: none;
  }

  .desktop-search {
    display: none;
  }

  .search-toggle,
  .header-actions .search-toggle {
    display: inline-grid;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .hero {
    grid-template-columns: minmax(480px, 0.82fr) minmax(0, 1.18fr);
    gap: var(--space-5);
    padding: 28px 32px;
  }

  .hero h1 {
    font-size: 52px;
    line-height: 1.03;
  }

  .hero-lead {
    margin-block: 12px;
    font-size: 17px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
  }

  .hero-actions .button {
    width: auto;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.15;
  }

  .hero-actions .button span:nth-child(2) {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .hero-copy,
  .hero-art {
    min-height: 360px;
  }

  .hero-art {
    min-height: 360px;
  }

  .anniversary-card {
    right: 22px;
    bottom: 22px;
    min-width: 340px;
    padding: 14px 18px 16px;
  }

  .anniversary-number {
    font-size: 70px;
  }

  .anniversary-years {
    padding-bottom: 10px;
    font-size: 23px;
  }

  .anniversary-card strong {
    font-size: 18px;
  }
}

@media (min-width: 1400px) and (max-width: 1699px) {
  .header-inner {
    grid-template-columns: minmax(300px, auto) minmax(0, 1fr) auto;
    gap: var(--space-4);
  }

  .main-nav {
    gap: 10px;
    font-size: 14px;
  }

  .main-nav a {
    max-width: 118px;
  }

  .desktop-search {
    grid-template-columns: minmax(260px, 340px) 48px;
    min-width: 388px;
  }

  .access-link {
    min-width: 44px;
    padding: 0;
  }

  .access-label {
    display: none;
  }
}

@media (min-width: 1181px) and (max-width: 1599px) {
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-lower {
    grid-template-columns: 1fr;
  }

  .event-card-featured {
    grid-template-columns: 76px minmax(0, 1fr) minmax(128px, 0.48fr);
  }

  .service-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .hero {
    grid-template-columns: minmax(0, 0.72fr) minmax(720px, 1.28fr);
    gap: 36px;
    min-height: 300px;
    padding: clamp(24px, 2vw, 36px) clamp(48px, 4vw, 80px);
  }

  .hero h1 {
    max-width: 720px;
    font-size: clamp(52px, 2.8vw, 64px);
    line-height: 1;
  }

  .hero-lead {
    max-width: 680px;
    font-size: 18px;
  }

  .hero-art {
    min-height: 260px;
  }

  .content-grid {
    grid-template-columns: minmax(340px, 1.05fr) minmax(430px, 1.25fr) minmax(320px, 0.95fr) minmax(340px, 1fr);
    gap: var(--space-5);
  }

  .news-card {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .home-lower {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.38fr);
    gap: var(--space-5);
  }

  .panel {
    padding: 16px;
  }

  .section-heading {
    margin-bottom: 12px;
  }

  .map-placeholder {
    min-height: 128px;
  }

  .home-lower .libraries-grid {
    align-items: start;
  }

  .home-lower .library-card {
    grid-template-columns: 118px minmax(0, 1fr);
    align-items: start;
  }

  .home-lower .library-card .thumb {
    min-height: 118px;
  }

  .home-lower .library-card h3 {
    font-size: 16px;
    line-height: 1.15;
  }

  .home-lower .library-meta {
    margin: 5px 0;
    gap: 4px;
  }

  .home-lower .library-meta li {
    font-size: 13px;
    line-height: 1.2;
  }

  .home-lower .library-meta-icon {
    width: 16px;
    height: 16px;
  }

  .home-lower .library-card-link {
    min-height: 36px;
    font-size: 14px;
  }

  .service-card {
    gap: var(--space-2);
    min-height: 96px;
    padding: var(--space-3);
  }

  .service-card .service-icon {
    width: 38px;
    height: 38px;
  }

  .service-card strong {
    font-size: 13px;
    line-height: 1.15;
  }

  .stats {
    gap: 0;
    margin-top: var(--space-2);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }

  .stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 14px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    text-align: left;
  }

  .stat-card + .stat-card {
    border-left: 1px solid var(--color-border);
  }

  .stat-card strong {
    font-size: 28px;
  }

  .site-footer {
    margin-top: var(--space-2);
    padding: 16px 0;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 6px 0;
  }

  .header-inner,
  .section-shell,
  .footer-inner {
    width: min(calc(100% - 24px), var(--container));
  }

  .header-inner {
    min-height: 72px;
    gap: var(--space-2);
    padding: 0 var(--space-3);
  }

  .brand {
    gap: var(--space-2);
    min-height: 50px;
  }

  .brand-mark {
    width: 44px;
    height: 38px;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand-subtitle {
    max-width: 140px;
    font-size: 11px;
    line-height: 1.25;
  }

  .header-actions {
    gap: 6px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: var(--space-4);
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.86) 52%, rgba(238, 228, 255, 0.64) 100%),
      url("../images/ref-hero-zlatoust-library.webp") center / cover no-repeat,
      linear-gradient(135deg, #fff 0%, #f3e9ff 52%, #eadfff 100%);
  }

  .hero .eyebrow {
    display: none;
  }

  h1 {
    font-size: 38px;
  }

  .hero-lead {
    font-size: 16px;
  }

  .hero-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin-top: var(--space-4);
  }

  .hero-search input {
    min-height: 52px;
    border-right: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    background: rgb(255 255 255 / 92%);
  }

  .hero-search-submit {
    min-width: 52px;
    min-height: 52px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--color-primary);
    color: #fff;
  }

  .site-search.is-open {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    width: 100%;
    max-width: 100%;
    margin-top: var(--space-4);
  }

  .hero-actions .button {
    flex-wrap: wrap;
    width: auto;
    min-width: 0;
    min-height: 64px;
    padding: 10px;
    font-size: 14px;
    line-height: 1.2;
  }

  .hero-actions .button span:nth-child(2) {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .hero-art {
    min-height: 210px;
    margin-top: var(--space-2);
    background-position: center right;
  }

  .anniversary-card {
    right: 14px;
    bottom: 14px;
    min-width: 190px;
    padding: 12px 14px 14px;
    border-radius: var(--radius-md);
  }

  .anniversary-number {
    font-size: 56px;
  }

  .anniversary-years {
    padding-bottom: 7px;
    font-size: 20px;
  }

  .anniversary-card strong {
    font-size: 15px;
  }

  .anniversary-card small,
  .anniversary-card em {
    font-size: 11px;
    line-height: 1.2;
  }

  .panel {
    padding: var(--space-4);
  }

  .archive-tabs {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .archive-tabs a {
    flex: 0 0 auto;
    padding-inline: 18px;
  }

  .content-grid {
    gap: var(--space-3);
  }

  .section-heading {
    align-items: flex-start;
  }

  .news-card,
  .event-card,
  .project-card,
  .library-card {
    grid-template-columns: 1fr;
  }

  .thumb {
    min-height: 150px;
  }

  .youth-card {
    grid-template-columns: 1fr;
  }

  .map-callout {
    left: 14px;
    right: 14px;
    bottom: 14px;
    min-height: 0;
    padding: 10px 14px;
  }

  .service-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .heritage-banner {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-4);
    background-position: center right;
  }

  .heritage-copy {
    align-items: flex-start;
    gap: var(--space-3);
  }

  .heritage-number {
    font-size: 62px;
  }

  .heritage-banner h2 {
    font-size: 25px;
  }

  .heritage-banner p {
    font-size: 15px;
  }

  .heritage-link {
    width: 100%;
    justify-content: center;
    min-width: 0;
  }

  .stat-card + .stat-card {
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }

  .service-card {
    grid-template-columns: 44px 1fr;
    justify-items: start;
    min-height: 72px;
    text-align: left;
  }

  .utility-item {
    grid-template-columns: 1fr;
    align-items: start;
    padding: var(--space-4);
  }

  .single-content p,
  .single-content li {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .site-header {
    padding: 4px 0;
  }

  .header-inner {
    min-height: 60px;
  }

  .brand {
    gap: 8px;
    max-width: 132px;
    min-height: 44px;
  }

  .brand-mark {
    width: 38px;
    height: 34px;
  }

  .brand-title {
    font-size: 18px;
    line-height: 1.05;
  }

  .brand-subtitle {
    display: none;
  }

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

@media (prefers-reduced-motion: no-preference) {
  .button,
  .news-card,
  .news-list a,
  .event-card,
  .event-list a,
  .project-card,
  .library-card,
  .service-card,
  .archive-card-link,
  .text-link,
  .single-post-nav a {
    transition: transform var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
  }
}

@media (prefers-reduced-motion: reduce) {
  .button:hover,
  .button:active,
  .news-card:hover,
  .news-card:active,
  .news-list a:hover,
  .news-list a:active,
  .event-card:hover,
  .event-card:active,
  .event-list a:hover,
  .event-list a:active,
  .project-card:hover,
  .project-card:active,
  .library-card:hover,
  .library-card:active,
  .service-card:hover,
  .service-card:active,
  .archive-card-link:hover,
  .archive-card-link:active {
    transform: none;
  }
}

/* =============================================================================
   ГАЛЕРЕЯ-СЛАЙДЕР (замена Widgetkit)
   ============================================================================= */

.zlatcbs-gallery-container {
  margin: var(--space-5) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.zlatcbs-gallery-main {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  background: var(--color-surface-2);
  aspect-ratio: 4 / 3;
}

.zlatcbs-gallery-slides {
  width: 100%;
  height: 100%;
}

.zlatcbs-gallery-slide {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
}

.zlatcbs-gallery-slide.is-active {
  display: flex;
}

.zlatcbs-gallery-slide img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

.zlatcbs-gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgb(0 0 0 / 48%);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
  transition: background var(--transition-fast);
  line-height: 1;
}

.zlatcbs-gallery-btn:hover,
.zlatcbs-gallery-btn:focus-visible {
  background: var(--color-primary);
  outline: none;
}

.zlatcbs-gallery-prev {
  left: 12px;
}

.zlatcbs-gallery-next {
  right: 12px;
}

.zlatcbs-gallery-counter {
  position: absolute;
  bottom: 12px;
  right: 14px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(0 0 0 / 48%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.zlatcbs-gallery-thumbs {
  display: flex;
  gap: 6px;
  margin-top: var(--space-2);
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.zlatcbs-gallery-thumb {
  flex: 0 0 72px;
  height: 54px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity var(--transition-fast), border-color var(--transition-fast);
}

.zlatcbs-gallery-thumb:hover {
  opacity: 0.85;
}

.zlatcbs-gallery-thumb.is-active {
  border-color: var(--color-primary);
  opacity: 1;
}

.zlatcbs-gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 640px) {
  .zlatcbs-gallery-main {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
  }

  .zlatcbs-gallery-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .zlatcbs-gallery-prev { left: 8px; }
  .zlatcbs-gallery-next { right: 8px; }

  .zlatcbs-gallery-thumb {
    flex: 0 0 56px;
    height: 44px;
  }
}

/* =============================================================================
   ВНУТРЕННЯЯ СТРАНИЦА НОВОСТИ — ТИПОГРАФИКА И АДАПТИВНОСТЬ
   ============================================================================= */

/* Уменьшить H1 заголовка новости (он меньше чем заголовок раздела) */
.single-entry .single-hero h1 {
  font-size: clamp(24px, 3.2vw, 44px);
  line-height: 1.15;
}

/* Улучшить отступы и межстрочник параграфов */
.single-content p {
  margin-top: 0;
  margin-bottom: 0.85em;
  line-height: 1.8;
}

.single-content p + p {
  margin-top: 0;
}

/* Скрыть пустые параграфы из Joomla-миграции */
.single-content p:empty,
.single-content p:is(.ds-markdown-paragraph):empty {
  display: none;
}

/* Скрыть параграфы только с пробелами или &nbsp; */
.single-content p:has(> br:only-child) {
  display: none;
}

/* Убрать лишний класс от DeepSeek/AI */
.single-content .ds-markdown-paragraph:empty {
  display: none;
}

/* Заголовки внутри статьи */
.single-content h2,
.single-content h3,
.single-content h4,
.single-content h5 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  line-height: 1.25;
}

.single-content h2 {
  font-size: clamp(20px, 2.4vw, 28px);
}

.single-content h3 {
  font-size: clamp(18px, 2vw, 22px);
}

/* Списки */
.single-content ul,
.single-content ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-3);
}

.single-content li {
  margin-bottom: var(--space-1);
  line-height: 1.7;
}

/* Навигация между записями — улучшить */
.single-post-nav {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  margin-top: var(--space-5);
  justify-content: space-between;
}

.single-post-nav a:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: none;
}

/* Убрать лишние переносы строк в конце статьи */
.single-content > br {
  display: none;
}

/* Адаптивность: планшет */
@media (max-width: 1024px) and (min-width: 641px) {
  .single-entry .single-hero {
    padding: clamp(20px, 3vw, 36px);
  }

  .single-entry .single-hero h1 {
    font-size: clamp(22px, 3vw, 38px);
  }

  .single-layout {
    gap: var(--space-3);
  }
}

/* Адаптивность: мобильный */
@media (max-width: 640px) {
  .single-entry {
    margin-top: var(--space-4);
  }

  .single-entry .single-hero {
    padding: var(--space-4);
    border-radius: var(--radius-md);
  }

  .single-entry .single-hero h1 {
    font-size: clamp(20px, 5.5vw, 30px);
    line-height: 1.2;
  }

  .single-content p,
  .single-content li {
    font-size: 16px;
    line-height: 1.75;
  }

  .single-post-nav {
    flex-direction: column;
    gap: var(--space-2);
    padding-top: var(--space-3);
    margin-top: var(--space-4);
  }

  .single-post-nav a {
    width: 100%;
    justify-content: center;
  }

  .single-featured-image {
    margin-bottom: var(--space-4);
  }

  .breadcrumbs {
    font-size: 13px;
  }
}
