/* ======================================
   Rampaga article page — v1.1
   ====================================== */

body.page--entry {
  background: #f0f4f7;
  color: #20262d;
  font: 16px/1.3 var(--font);
}

.page--entry .skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 1000;
  padding: 10px 14px;
  background: #111827;
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
}

.page--entry .skip-link:focus {
  top: 12px;
}

.page--entry .visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.article-page {
  padding: clamp(20px, 2vw, 32px) 0 clamp(40px, 4vw, 72px);

  --a-max: 720px;
  --a-fs: 17px;
  --a-lh: 1.65;
  --a-vr: 22px;

  --a-text: #1f2933;
  --a-title: rgba(22, 21, 21, 0.92);
  --a-muted: rgba(64, 72, 82, 0.72);
  --a-rule: rgba(68, 66, 66, 0.12);

  --a-link: #1677c8;
  --a-link-visited: #5f6fd9;

  --a-code-bg: rgba(31, 41, 55, 0.05);
  --a-card: rgba(31, 41, 55, 0.035);
}

.article-page__wrap {
  width: min(100% - 32px, var(--grid-width));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--aside-width);
  gap: clamp(24px, 3vw, 40px);
  align-items: start;
}

.article-main,
.article-aside {
  min-width: 0;
}

/* ===== article head ===== */

.article-head {
  margin-bottom: 24px;
}

.article-breadcrumbs {
  margin-bottom: 14px;
}

.article-breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #6e7881;
}

.article-breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.article-breadcrumbs__item:not(:last-child)::after {
  content: "/";
  margin-left: 12px;
  color: #9aa4ae;
}

.article-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.article-breadcrumbs a:hover,
.article-breadcrumbs a:focus-visible {
  color: #111827;
}

.article-head__meta-top {
  margin-bottom: 12px;
}

.article-head__section {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e7edf2;
  color: #42505f;
  text-decoration: none;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.article-head__section:hover,
.article-head__section:focus-visible {
  background: #dce5ec;
  color: #111827;
}

.article-title {
  max-width: 32ch;
  margin: 0 0 16px;
  font-size: clamp(26px, 2vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #181c22;
  /* text-wrap: balance; */
  hyphens: auto;
  word-break: normal;
  overflow-wrap: break-word;
}

.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.article-meta__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #6b7280;
}

.article-meta__author-wrap {
  display: inline-flex;
  align-items: center;
}

.article-meta__author {
  color: #111827;
  font-weight: 600;
  text-decoration: none;
}

.article-meta__author:hover,
.article-meta__author:focus-visible {
  color: #0f6f8f;
}

.article-meta__separator {
  color: #98a2ad;
}

.article-meta__reads {
  color: #6b7280;
}

.article-meta__share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-meta__share a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8eef3;
  color: #344150;
  font-size: 12px;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.article-meta__share a:hover,
.article-meta__share a:focus-visible {
  background: #dbe5ec;
  color: #111827;
}

/* ===== hero ===== */

.article-hero {
  margin: 0 0 24px;
  border-radius: 18px;
  overflow: hidden;
  background: #dde5ea;
}

.article-hero img {
  display: block;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* ===== entry body typography ===== */

.entry-body {
  font-size: var(--text-font-size);
  line-height: var(--text-line-height);
  font-weight: 385;
  letter-spacing: 0.01em;
  max-width: var(--a-max);
  margin: 0 auto;
  color: var(--a-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

.entry-body > p:first-of-type {
  font-size: clamp(18px, 1rem + 0.25vw, 20px);
  line-height: 1.7;
  color: #3a4552;
}

.entry-body p,
.entry-body ul,
.entry-body ol,
.entry-body blockquote,
.entry-body pre,
.entry-body figure,
.entry-body table {
  margin: 0 0 var(--a-vr);
}

.entry-body p:empty {
  display: none;
}

.entry-body h1,
.entry-body h2,
.entry-body h3,
.entry-body h4 {
  margin: 0;
  color: var(--a-title);
}

.entry-body h1 {
  font-size: clamp(28px, 3.2vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 calc(var(--a-vr) * 0.8);
}

.entry-body h2 {
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin: calc(var(--a-vr) * 1.6) 0 calc(var(--a-vr) * 0.6);
  text-wrap: balance;
}

.entry-body h3 {
  font-size: 19px;
  line-height: 1.3;
  margin: calc(var(--a-vr) * 1.2) 0 calc(var(--a-vr) * 0.5);
}

.entry-body h4 {
  font-size: 17px;
  line-height: 1.35;
  margin: calc(var(--a-vr) * 1) 0 calc(var(--a-vr) * 0.45);
}

.entry-body em {
  font-style: italic;
}

.entry-body strong {
  font-weight: 600;
}

.entry-body a {
  color: var(--a-link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.entry-body a:visited {
  color: var(--a-link-visited);
}

.entry-body a:hover,
.entry-body a:focus-visible {
  text-decoration-thickness: 0.12em;
}

.entry-body ul,
.entry-body ol {
  padding-left: 1.2em;
}

.entry-body li {
  margin: 0.35em 0;
}

.entry-body li::marker {
  color: rgba(64, 72, 82, 0.55);
}

.entry-body hr {
  border: 0;
  border-top: 1px solid var(--a-rule);
  margin: calc(var(--a-vr) * 1.4) 0;
}

.entry-body blockquote {
  padding: 14px 16px;
  border-left: 3px solid rgba(31, 41, 55, 0.18);
  background: var(--a-card);
  color: rgba(45, 45, 45, 0.82);
  border-radius: 0 12px 12px 0;
}

.entry-body blockquote p {
  margin-bottom: 0;
}

.entry-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  background: var(--a-code-bg);
  padding: 0.15em 0.35em;
  border-radius: 8px;
}

.entry-body pre {
  padding: 14px 16px;
  overflow: auto;
  background: var(--a-code-bg);
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.entry-body pre code {
  background: transparent;
  padding: 0;
}

.entry-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}

.entry-body figure img {
  width: 100%;
}

.entry-body figcaption {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--a-muted);
}

.entry-body table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  background: rgba(255, 255, 255, 0.55);
}

.entry-body th,
.entry-body td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.08);
  text-align: left;
  vertical-align: top;
}

.entry-body tr:last-child td {
  border-bottom: 0;
}

.entry-body th {
  font-weight: 600;
  background: rgba(31, 41, 55, 0.035);
}

.entry-body iframe {
  max-width: 100%;
}

/* ===== video ===== */

.entry-body .fr-video,
.entry-body .video {
  display: block;
  margin: 0 0 var(--a-vr);
  margin-top: calc(var(--a-vr) * 1.5);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.08);
  position: relative;
  background: #e9eef2;
}

.entry-body .fr-video::before,
.entry-body .video::before {
  content: "Загрузка видео…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #6b7280;
  letter-spacing: 0.03em;
  background: linear-gradient(90deg, #e9eef2 0%, #f6f9fb 50%, #e9eef2 100%);
  background-size: 400px 100%;
  animation: video-skeleton 1.6s linear infinite;
}

@keyframes video-skeleton {
  from {
    background-position: -400px 0;
  }
  to {
    background-position: 400px 0;
  }
}

.entry-body .fr-video iframe,
.entry-body .video iframe {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  background: transparent;
  z-index: 1;
}

/* ===== gallery ===== */

.gallery {
  display: grid;
  gap: 0.75rem;
  overflow: hidden;
  margin-block: var(--a-vr);
}

.gallery .gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background-color: #e9eef2;
}

.gallery .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.gallery.gallery--size-1 {
  grid-template-columns: 1fr;
}

.gallery.gallery--size-2 {
  grid-template-columns: repeat(2, 1fr);
}

.gallery.gallery--size-3 {
  grid-template-columns: 1.75fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.gallery.gallery--size-3 .gallery-item:nth-child(1) {
  grid-row: 1 / span 2;
  grid-column: 1;
}

.gallery.gallery--size-3 .gallery-item:nth-child(2) {
  grid-row: 1;
  grid-column: 2;
}

.gallery.gallery--size-3 .gallery-item:nth-child(3) {
  grid-row: 2;
  grid-column: 2;
}

.gallery.gallery--size-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.gallery.gallery--size-5 {
  grid-template-columns: 2fr 1fr 1fr 2fr;
  grid-template-rows: 1.5fr 1fr;
}

.gallery.gallery--size-5 .gallery-item:nth-child(1) {
  grid-row: 1;
  grid-column: 1 / span 2;
}

.gallery.gallery--size-5 .gallery-item:nth-child(2) {
  grid-row: 1;
  grid-column: 3 / span 2;
}

.gallery.gallery--size-5 .gallery-item:nth-child(3) {
  grid-row: 2;
  grid-column: 1;
}

.gallery.gallery--size-5 .gallery-item:nth-child(4) {
  grid-row: 2;
  grid-column: 2 / span 2;
}

.gallery.gallery--size-5 .gallery-item:nth-child(5) {
  grid-row: 2;
  grid-column: 4;
}

.gallery.gallery--size-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.gallery.gallery--size-7 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.gallery.gallery--size-7 .gallery-item:nth-child(1) {
  grid-row: 1 / span 2;
  grid-column: 1;
  aspect-ratio: 2 / 3;
}

.gallery.gallery--size-7 .gallery-item:nth-child(2) {
  grid-row: 1;
  grid-column: 2;
}

.gallery.gallery--size-7 .gallery-item:nth-child(3) {
  grid-row: 1;
  grid-column: 3;
}

.gallery.gallery--size-7 .gallery-item:nth-child(4) {
  grid-row: 1;
  grid-column: 4;
}

.gallery.gallery--size-7 .gallery-item:nth-child(5) {
  grid-row: 2;
  grid-column: 2;
}

.gallery.gallery--size-7 .gallery-item:nth-child(6) {
  grid-row: 2;
  grid-column: 3;
}

.gallery.gallery--size-7 .gallery-item:nth-child(7) {
  grid-row: 2;
  grid-column: 4;
}

.gallery.gallery--size-9 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.entry-body small,
.entry-body .muted {
  color: var(--a-muted);
}

/* ===== tags ===== */

.article-tags {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0;
}

.article-tags::before {
  content: "Теги";
  display: block;
  width: 100%;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.article-tags .entAllCats {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: #4b5563;
  background: #e9eef2;
  font-size: 13px;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.article-tags .entAllCats:hover,
.article-tags .entAllCats:focus-visible {
  background: #dfe8ef;
  color: #111827;
  transform: translateY(-1px);
}

/* ===== related ===== */

.related-posts {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.related-posts__head {
  margin-bottom: 18px;
}

.related-posts__title {
  margin: 0;
  font-size: clamp(26px, 1.45rem + 0.4vw, 34px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #181c22;
}

.related-posts__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

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

.related-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.related-card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 14px;
  background: #e9eef2;
  margin-bottom: 10px;
}

.related-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

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

.related-card__meta {
  margin-bottom: 6px;
  font-size: 11px;
  line-height: 1.25;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.related-card__title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
  color: #111111;
}

.related-card__link:hover .related-card__title,
.related-card__link:focus-visible .related-card__title {
  color: #0f6f8f;
}

.related-card__link:hover .related-card__media img,
.related-card__link:focus-visible .related-card__media img {
  transform: scale(1.03);
}

/* ===== comments wrapper ===== */

.article-comments {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

/* ===== aside ===== */

/* ===== aside ===== */

.article-aside__box {
  position: sticky;
  top: 18px;
}

.article-aside__featured {
  margin: 0 0 14px;
}

.article-aside__featured-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.article-aside__featured-media {
  overflow: hidden;
  border-radius: 16px;
  background: #dde5ea;
  margin-bottom: 10px;
}

.article-aside__featured-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.article-aside__featured-body {
  padding: 0 2px;
}

.article-aside__featured-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  color: #18202a;
}

.article-aside__featured-link:hover .article-aside__featured-title,
.article-aside__featured-link:focus-visible .article-aside__featured-title {
  color: #0f6f8f;
}

.article-aside__featured-link:hover .article-aside__featured-thumb,
.article-aside__featured-link:focus-visible .article-aside__featured-thumb {
  transform: scale(1.03);
}

.article-aside__list {
  display: grid;
  gap: 10px;
}

.article-aside__item {
  display: block;
  padding: 0 2px 10px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.article-aside__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.article-aside__text {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
}

.article-aside__item:hover .article-aside__text,
.article-aside__item:focus-visible .article-aside__text {
  color: #0f6f8f;
}

/* ===== focus ===== */

.page--entry a:focus-visible,
.page--entry button:focus-visible,
.page--entry [tabindex]:focus-visible {
  outline: 2px solid #0f6f8f;
  outline-offset: 2px;
}

/* ===== responsive ===== */

@media (max-width: 1100px) {
  .article-page__wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-aside {
    order: 2;
  }

  .article-main {
    order: 1;
  }

  .article-aside__box {
    position: static;
  }
}

@media (max-width: 800px) {
  .article-title {
    max-width: none;
  }

  .article-meta {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .gallery.gallery--size-5,
  .gallery.gallery--size-7,
  .gallery.gallery--size-9 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }

  .gallery.gallery--size-5 .gallery-item,
  .gallery.gallery--size-7 .gallery-item,
  .gallery.gallery--size-9 .gallery-item {
    grid-column: auto !important;
    grid-row: auto !important;
    aspect-ratio: auto;
  }
}

@media (max-width: 640px) {
  .article-page {
    padding-top: 14px;
    --a-fs: 16px;
    --a-lh: 1.62;
    --a-vr: 20px;
  }

  .article-page__wrap {
    width: min(100% - 20px, var(--grid-width));
    gap: 24px;
  }

  .article-title {
    font-size: clamp(28px, 8vw, 40px);
    line-height: 1.06;
  }

  .article-hero {
    border-radius: 14px;
  }

  .entry-body img,
  .gallery .gallery-item,
  .related-card__media {
    border-radius: 12px;
  }

  .related-posts__grid {
    grid-template-columns: 1fr;
  }

  .article-aside__link {
    grid-template-columns: 22px 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .article-aside__num {
    font-size: 24px;
  }

  .gallery.gallery--size-2,
  .gallery.gallery--size-3,
  .gallery.gallery--size-4,
  .gallery.gallery--size-6 {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .gallery.gallery--size-3 .gallery-item,
  .gallery.gallery--size-4 .gallery-item,
  .gallery.gallery--size-6 .gallery-item {
    grid-column: auto !important;
    grid-row: auto !important;
  }
}
