/* «Статьи»: reading pages on top of collection.css, which already gives the header, footer, night backdrop,
   buttons, paper label and closing call. Reading column up to 68 characters; the contents sit beside it on wide
   screens and above it on phones. The paper material stays the one accent: notes are paper, like the labels.
   Shape rule as on collection pages: gift tiles 13%, buttons and screenshots 8px, paper 3px. */
:root {
  --a-text: #d7dde4;
  --a-link: #33b1ff;
  --a-measure: 68ch;
}

/* Words like «NFT-подарок» never break at their hyphen in titles */
.nowrap {
  white-space: nowrap;
}

/* Article header: title and lead, the cover gift beside them on wide screens */
.article-head {
  display: grid;
  gap: 32px;
  padding-top: 24px;
  padding-bottom: clamp(40px, 2rem + 3vw, 72px);
}

.article-head h1 {
  margin-top: 20px;
  max-width: 22ch;
  font-weight: 600;
  font-size: clamp(2.125rem, 1.4rem + 2.4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.article-head__lead {
  margin-top: 20px;
  max-width: 56ch;
  color: var(--c-muted);
  font-size: 1.1875rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.article-head__meta {
  margin-top: 20px;
  color: var(--c-muted);
  font-size: 0.9375rem;
}

/* Phones: the cover sits under the title as a 4:3 frame (the subject stays in it); from 900 px a tilted square on the right */
.article-head__cover {
  display: block;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
}

@media (min-width: 900px) {
  .article-head {
    grid-template-columns: minmax(0, 1fr) 260px;
    align-items: end;
    gap: 72px;
  }

  .article-head__cover {
    max-width: none;
    aspect-ratio: 1;
    border-radius: 13%;
    rotate: 3deg;
    box-shadow: 0 30px 44px -26px rgba(0, 0, 0, 0.85);
  }
}

/* Body: contents + reading column */
.article-body {
  display: grid;
  gap: 40px;
  padding-bottom: var(--c-section);
}

.toc {
  padding: 20px 22px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.toc__title {
  color: var(--c-text);
  font-weight: 600;
}

.toc ol {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.toc a {
  color: var(--c-muted);
  transition: color 0.2s var(--c-ease);
}

.toc a:hover {
  color: var(--c-text);
}

@media (min-width: 1100px) {
  .article-body--toc {
    grid-template-columns: 240px minmax(0, var(--a-measure));
    gap: 80px;
  }

  .toc {
    position: sticky;
    top: 32px;
    align-self: start;
    padding: 0 0 0 20px;
    border: 0;
    border-left: 1px solid var(--c-line);
    border-radius: 0;
  }
}

/* Reading typography */
.prose {
  max-width: var(--a-measure);
  min-width: 0;
  color: var(--a-text);
  font-size: 1.125rem;
  line-height: 1.7;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2 {
  margin-top: 2.2em;
  color: var(--c-text);
  font-weight: 600;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
  scroll-margin-top: 24px;
}

.prose h3 {
  margin-top: 1.8em;
  color: var(--c-text);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  scroll-margin-top: 24px;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.7em;
}

.prose strong {
  color: var(--c-text);
  font-weight: 600;
}

.prose p a,
.prose li a,
.prose td a,
.shelf-more a {
  color: var(--a-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose p a:hover,
.prose li a:hover,
.prose td a:hover,
.shelf-more a:hover {
  text-decoration-thickness: 2px;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li + li {
  margin-top: 0.45em;
}

.prose li::marker {
  color: var(--c-muted);
}

.prose blockquote {
  margin-inline: 0;
  padding-left: 20px;
  border-left: 2px solid var(--c-accent);
  color: var(--c-text);
}

/* Screenshots: phone screens stay phone-sized instead of filling the column */
.prose figure {
  display: grid;
  justify-items: start;
}

.prose figure img,
.prose p > img {
  width: auto;
  max-width: 100%;
  max-height: min(72vh, 680px);
  height: auto;
  border-radius: 8px;
}

.prose figcaption {
  margin-top: 10px;
  color: var(--c-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Tables wrap their cells; a table that still does not fit scrolls inside its own box */
.prose .table {
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

@media (min-width: 640px) {
  .prose table {
    font-size: 1rem;
  }
}

.prose th {
  color: var(--c-text);
  font-weight: 600;
  text-align: left;
}

.prose th,
.prose td {
  padding: 12px 16px 12px 0;
  vertical-align: top;
}

.prose thead th {
  border-bottom: 1px solid rgba(242, 245, 248, 0.22);
}

.prose tbody tr + tr td {
  border-top: 1px solid var(--c-line);
}

/* Paper note: the same material as the labels on the collection pages */
.prose .admonition {
  padding: 18px 24px 20px;
  border-radius: 3px;
  background: var(--c-paper);
  color: var(--c-ink);
  font-size: 1.0625rem;
  line-height: 1.6;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.7);
}

.prose .admonition-title {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(20, 22, 27, 0.35);
  font-weight: 600;
}

.prose .admonition p + p {
  margin-top: 0.6em;
}

.prose .admonition strong,
.prose .admonition a {
  color: var(--c-ink);
}

/* The bot button inside the text */
.prose .cta {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-block: 2em;
  padding: 28px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: rgba(14, 21, 34, 0.55);
}

.cta__title {
  color: var(--c-text);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1.25;
}

.cta__text {
  color: var(--c-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.cta .button {
  margin-top: 10px;
}

/* Collection pages inside the text: a small shelf, three to a row on phones and one row of six in the column */
.prose .shelf--inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 12px;
  margin-top: 1.4em;
}

@media (min-width: 640px) {
  .prose .shelf--inline {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
  }
}

.prose .shelf--inline .label {
  min-width: 0;
  width: 100%;
  margin-top: -10px;
  padding: 5px 6px;
}

.prose .shelf--inline .label__name {
  padding-block: 4px;
  font-size: 0.75rem;
  white-space: normal;
}

.shelf-more {
  font-size: 1rem;
}

/* Article list: the gift tile and the text, no cards */
.posts {
  display: grid;
  gap: 40px;
  max-width: 880px;
  margin-top: 48px;
}

.post {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (min-width: 768px) {
  .post {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 32px;
  }
}

.post__cover {
  width: 100%;
  border-radius: 13%;
  transition: translate 0.4s var(--c-ease);
}

.posts .post__title {
  font-weight: 600;
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.625rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.post__desc {
  margin-top: 8px;
  color: var(--c-muted);
  font-size: 1rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.post__meta {
  margin-top: 10px;
  color: var(--c-muted);
  font-size: 0.875rem;
}

.post:hover .post__cover {
  translate: 0 -4px;
}

.post:hover .post__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
