/*
 * DAR interlinks — quick switch between /olimp, /gong, /nikulinskaya/art
 * and the "Ещё в ДАР" block before the footer. Every selector is scoped to
 * .dar-switch* / .dar-related*; nothing here touches existing classes.
 */

/* ---------- Quick switch (fixed bottom bar) ---------- */

.dar-switch {
  position: fixed;
  z-index: 30; /* below dialogs/overlays (z-50), above page content */
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 32px));
  box-sizing: border-box;
  padding: 4px;
  border: 1px solid #d5c4b2;
  border-radius: 14px;
  background: #faf9f7;
  color: #3b2000;
  font-family: inherit;
}

.dar-switch__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dar-switch__item {
  margin: 0;
  min-width: 0;
}

.dar-switch__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: #3b2000;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
  -webkit-tap-highlight-color: transparent;
}

.dar-switch__link:hover {
  background: #efe6db;
}

.dar-switch__link[aria-current] {
  background: #4d2c05;
  color: #faf9f7;
}

.dar-switch__link:focus-visible {
  outline: 2px solid #4d2c05;
  outline-offset: 2px;
}

.dar-switch__link[aria-current]:focus-visible {
  outline-color: #3b2000;
}

.dar-switch__label--short {
  display: none;
}

/* Keeps the footer from ever sitting under the bar at the end of the page. */
.dar-switch-spacer {
  height: 86px; /* bar 54px + bottom 16px + 16px air */
}

.dar-switch-spacer--common {
  background: #efece4; /* continues the common footer surface */
}

/* ---------- "Ещё в ДАР" ---------- */

.dar-related {
  color: inherit;
  font-family: inherit;
}

.dar-related__inner {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 24px 64px;
}

.dar-related__title {
  margin: 0 0 28px;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.dar-related__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dar-related__item {
  margin: 0;
  min-width: 0;
}

.dar-related__link {
  display: block;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.dar-related__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.dar-related__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px;
  background: #efe6db;
}

.dar-related__text {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}

.dar-related__name {
  margin: 0;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.dar-related__link:hover .dar-related__name {
  text-decoration-line: underline;
}

.dar-related__desc {
  max-width: 60ch;
  margin: 6px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: color-mix(in srgb, currentColor 80%, transparent);
}

.dar-related__more {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 32px 0 0;
  font-size: 15px;
  line-height: 1.4;
}

.dar-related__more a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

.dar-related__more a:hover {
  text-decoration-color: currentColor;
}

.dar-related__more a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 640px) {
  .dar-switch {
    /* The existing analytics preferences button occupies the bottom 36px. */
    bottom: calc(48px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 24px);
  }

  .dar-switch__link {
    padding: 0 6px;
    font-size: 14px;
  }

  .dar-switch__label--long {
    display: none;
  }

  .dar-switch__label--short {
    display: inline;
  }

  .dar-switch-spacer {
    height: calc(114px + env(safe-area-inset-bottom, 0px)); /* 54 + 48 + 12 */
  }

  .dar-related__inner {
    padding: 48px 16px 40px;
  }

  .dar-related__title {
    margin-bottom: 8px;
  }

  .dar-related__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .dar-related__item + .dar-related__item {
    border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  }

  .dar-related__link {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding-block: 16px;
  }

  .dar-related__image {
    aspect-ratio: 4 / 3;
    border-radius: 10px;
  }

  .dar-related__text {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .dar-related__name {
    font-size: 18px;
  }

  .dar-related__desc {
    font-size: 15px;
  }

  .dar-related__more {
    margin-top: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dar-switch__link {
    transition: none;
  }
}

@media print {
  .dar-switch,
  .dar-switch-spacer {
    display: none;
  }
}
