/* ======================================
   Rampaga static-page.css — v1.0
   Назначение: тело статичных страниц
   в новой дизайн-системе
   ====================================== */

body.page--static {
  background: var(--page-background-color, #eef2f6);
  color: var(--text-color, #20262d);
}

/* ===== Shell ===== */

.page-shell {
  --page-shell-width: 960px;
  --page-shell-gap: 0.875rem;
  --page-shell-radius: 1.125rem;
  --page-shell-padding: 1.5625rem;

  --page-content-width: var(--layout-content-width, 720px);
  --page-flow-space: 1.375rem;
  --page-flow-space-lg: calc(var(--page-flow-space) * 1.5);

  padding: clamp(1.25rem, 2vw, 2rem) 0 clamp(2.5rem, 4vw, 4.5rem);
}

/* ===== Breadcrumbs ===== */

.page-breadcrumbs {
  width: min(100% - 2rem, var(--page-shell-width));
  margin: 0 auto var(--page-shell-gap);
  padding: 0.9375rem var(--page-shell-padding);
  border-radius: var(--page-shell-radius);
  background: var(--surface-color, #f7f9fb);

  & .page-breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-muted-color, #6b7280);
    font-size: 0.8125rem;
    line-height: 1.4;
    opacity: 0.85;
  }

  & .page-breadcrumbs__item {
    display: inline-flex;
    align-items: center;
    min-width: 0;

    &:not(:last-child)::after {
      content: "›";
      margin-left: 0.75rem;
      color: #9aa4ae;
    }
  }

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

    &:hover,
    &:focus-visible {
      color: var(--accent-color, #1677c8);
    }
  }

  & [aria-current="page"] {
    color: var(--text-soft-color, #475569);
  }
}

/* ===== Layout ===== */

.page-layout {
  width: min(100% - 2rem, var(--page-shell-width));
  margin: 0 auto;
}

.page-main {
  min-width: 0;
  padding: var(--page-shell-padding) 0;
  border-radius: var(--page-shell-radius);
  background: var(--surface-color, #f7f9fb);
}

/* ===== Page content ===== */

.page-content {
  max-width: calc(var(--page-content-width) + calc(var(--layout-padding-inline) * 2));
  margin: 0 auto;
  padding-inline: var(--layout-padding-inline);
  color: var(--article-text-color, #1f2933);
  font-family: var(--font-family-base, sans-serif);
  font-size: clamp(1.06rem, 1rem + 0.18vw, 1.14rem);
  line-height: 1.68;
  font-weight: 385;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  word-break: normal;

  & > * {
    margin-block: 0 var(--page-flow-space);
  }

  & > :first-child {
    margin-top: 0;
  }

  & > :last-child {
    margin-bottom: 0;
  }

  & p:empty {
    display: none;
  }

  & p,
  & ul,
  & ol,
  & blockquote,
  & pre,
  & figure,
  & table,
  & hr {
    margin-block: 0 var(--page-flow-space);
  }

  /* ===== Заголовки ===== */

  & h1,
  & h2,
  & h3,
  & h4,
  & h5,
  & h6 {
    margin: 0;
    color: var(--article-title-color, rgba(22, 21, 21, 0.92));
    font-weight: 700;
    letter-spacing: -0.02em;
    text-wrap: balance;
  }

  & h1 {
    font-size: clamp(1.75rem, 1.55rem + 1vw, 2.5rem);
    line-height: 1.12;
    margin-top: calc(var(--page-flow-space) * 0.25);
    margin-bottom: calc(var(--page-flow-space) * 0.85);
  }

  & h2 {
    font-size: clamp(1.375rem, 1.25rem + 0.65vw, 1.75rem);
    line-height: 1.22;
    margin-top: calc(var(--page-flow-space) * 1.75);
    margin-bottom: calc(var(--page-flow-space) * 0.6);
  }

  & h3 {
    font-size: 1.1875rem;
    line-height: 1.3;
    margin-top: calc(var(--page-flow-space) * 1.35);
    margin-bottom: calc(var(--page-flow-space) * 0.5);
  }

  & h4 {
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-top: calc(var(--page-flow-space) * 1.05);
    margin-bottom: calc(var(--page-flow-space) * 0.45);
  }

  & h5,
  & h6 {
    font-size: 1rem;
    line-height: 1.35;
    margin-top: calc(var(--page-flow-space) * 0.9);
    margin-bottom: calc(var(--page-flow-space) * 0.4);
  }

  /* ===== Текст ===== */

  & strong,
  & b {
    font-weight: 600;
  }

  & em,
  & i {
    font-style: italic;
  }

  & small,
  & .muted {
    color: var(--article-muted-color, rgba(64, 72, 82, 0.72));
  }

  & a {
    color: var(--article-link-color, #1677c8);
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
    transition:
      color var(--transition-fast, 150ms ease),
      text-decoration-thickness var(--transition-fast, 150ms ease);

    &:visited {
      color: var(--article-link-visited-color, #5f6fd9);
    }

    &:hover,
    &:focus-visible {
      text-decoration-thickness: 0.12em;
    }
  }

  /* ===== Списки ===== */

  & ul,
  & ol {
    padding-left: 1.2em;
  }

  & ul {
    list-style: disc;
  }

  & ol {
    list-style: decimal;
  }

  & li {
    margin: 0.35em 0;

    &::marker {
      color: rgba(64, 72, 82, 0.55);
    }
  }

  & li > ul,
  & li > ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }

  /* ===== Разделители и цитаты ===== */

  & hr {
    border: 0;
    border-top: 1px solid var(--article-rule-color, rgba(68, 66, 66, 0.12));
    margin-block: calc(var(--page-flow-space) * 1.4);
  }

  & blockquote {
    padding: 0.95rem 1rem;
    border-left: 3px solid rgba(31, 41, 55, 0.18);
    border-radius: 0 0.75rem 0.75rem 0;
    background: var(--article-card-background-color, rgba(31, 41, 55, 0.035));
    color: rgba(45, 45, 45, 0.82);

    & > *:last-child {
      margin-bottom: 0;
    }
  }

  /* ===== Код ===== */

  & code,
  & kbd,
  & samp {
    padding: 0.15em 0.35em;
    border-radius: 0.5rem;
    background: var(--article-code-background-color, rgba(31, 41, 55, 0.05));
    font-family: var(--font-family-mono, monospace);
    font-size: 0.92em;
  }

  & pre {
    overflow-x: auto;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 0.875rem;
    background: var(--article-code-background-color, rgba(31, 41, 55, 0.05));

    & code {
      padding: 0;
      border-radius: 0;
      background: transparent;
    }
  }

  /* ===== Медиа ===== */

  & img,
  & video {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
  }

  & figure {
    width: 100%;
  }

  & figure img {
    width: 100%;
  }

  & figcaption {
    margin-top: 0.625rem;
    color: var(--article-muted-color, rgba(64, 72, 82, 0.72));
    font-size: var(--font-size-caption, 0.875rem);
    line-height: 1.45;
  }

  /* ===== Таблицы ===== */

  & .table-wrap {
    overflow-x: auto;
    border-radius: 0.875rem;
  }

  & table {
    width: 100%;
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 0.875rem;
    border-collapse: collapse;
    border-spacing: 0;
    background: rgba(255, 255, 255, 0.55);
    font-size: 0.9375rem;
    line-height: 1.5;
    overflow: hidden;
  }

  & th,
  & td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid rgba(31, 41, 55, 0.08);
    text-align: left;
    vertical-align: top;
  }

  & tr:last-child td {
    border-bottom: 0;
  }

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

  /* ===== Встраивания ===== */

  & iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 0;
    border-radius: 0.875rem;
  }

  /* ===== Служебные блоки внутри статичных страниц ===== */

  & .note,
  & .info-box,
  & .page-note {
    padding: 0.95rem 1rem;
    border: 1px solid var(--border-color, rgba(17, 24, 39, 0.08));
    border-radius: 0.875rem;
    background: color-mix(in srgb, var(--surface-subtle-color, #e8eef3) 72%, white);

    & > *:last-child {
      margin-bottom: 0;
    }
  }

  & .warning,
  & .page-warning {
    padding: 0.95rem 1rem;
    border: 1px solid color-mix(in srgb, #d97706 18%, transparent);
    border-radius: 0.875rem;
    background: color-mix(in srgb, #f59e0b 10%, white);
    color: inherit;

    & > *:last-child {
      margin-bottom: 0;
    }
  }
}

/* ===== Optional dense sections ===== */

.page-content > h2:first-child,
.page-content > h3:first-child {
  margin-top: 0;
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
  .page-shell {
    --page-shell-gap: 0.75rem;
    --page-shell-padding: 1rem;
    --page-flow-space: 1.25rem;

    padding-top: 0.875rem;
  }

  .page-breadcrumbs,
  .page-layout {
    width: min(100% - 1.25rem, var(--page-shell-width));
  }

  .page-main {
    border-radius: 0.875rem;
  }

  .page-content {
    & img,
    & video,
    & figure img,
    & iframe,
    & table,
    & pre,
    & .table-wrap {
      border-radius: 0.75rem;
    }
  }
}
