/* Item pages (article, opinion, news, photo, video) and standard pages: header details, bylines,
   tags and author box, «Читайте также», share, table of contents, previous/next, the photo and
   video stages, the lightbox and the StreamField blocks (docs/design-system.md §7.1–§7.2).
   Loaded after tokens.css + site.css by the templates that need it ({% block extra_css %}); the
   cascade layer order is declared once in tokens.css, so these rules slot into the same layers. */

@layer components {
  /* Bylines and datelines of item pages */
  .byline, .dateline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans);
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
  }
  .byline a { font-weight: var(--weight-medium); }

  /* Article page (§7.1): header, lead figure and body share the reading grid (layout) */
  .article { padding-block: var(--space-xl) var(--space-2xl); }
  .article > * + * { margin-block-start: var(--space-xl); }
  .article > .article__footer { margin-block-start: var(--space-2xl); }
  .article__top, .article__footer { row-gap: var(--space-l); }
  .article__header { display: grid; gap: var(--space-s); }
  .article__header h1 { margin-block-start: var(--space-3xs); }
  .article__lead { margin-block-start: var(--space-3xs); max-inline-size: 34.85em; /* 60ch of Literata, swap-proof */ font-size: var(--step-1); line-height: var(--leading-lead); color: var(--ink-2); text-wrap: pretty; }
  .article__meta { column-gap: var(--space-s); }
  .article__meta > :not(:last-child)::after { content: none; }
  .article__meta a { color: var(--ink-2); text-decoration-color: var(--rule-strong); }
  .article__meta a:hover { color: var(--link-hover); text-decoration-color: var(--neon); }

  /* Byline: portrait, name, date (§7) */
  .byline { margin-block-start: var(--space-3xs); }
  .byline__portrait, .author-box__portrait {
    flex: none;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    overflow: hidden;
    background: var(--sunken);
    border-radius: 50%;
  }
  :is(.byline__portrait, .author-box__portrait) { display: grid; }
  :is(.byline__portrait, .author-box__portrait) img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .byline__text { display: grid; }
  .byline__name { font-weight: var(--weight-label); color: var(--ink); }
  .byline__name a { font-weight: inherit; color: inherit; text-decoration-color: var(--rule-strong); }
  .byline__name a:hover { color: inherit; text-decoration-color: var(--neon); }

  /* Tags and the author box at the end of an item */
  .tag-list { display: grid; gap: var(--space-2xs); }
  .tag-list__label, .author-box__label {
    font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans);
    letter-spacing: var(--tracking-kicker);
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .author-box { display: flex; align-items: flex-start; gap: var(--space-s); padding-block: var(--space-m); border-block: 1px solid var(--rule); }
  .author-box__portrait { inline-size: 4.5rem; block-size: 4.5rem; }
  .author-box__text { display: grid; gap: var(--space-2xs); min-inline-size: 0; }
  .author-box__name { font-size: var(--step-1); line-height: var(--leading-h3); }
  .author-box__label { display: block; margin-block-end: 0.2rem; }
  .author-box__bio { font-size: var(--step--1); line-height: 1.55; color: var(--ink-2); }
  .author-box__more { display: inline-flex; align-items: center; gap: 0.35rem; font: var(--weight-medium) var(--step--1) / var(--leading-ui) var(--font-sans); }
  :is(.author-box__more, .video__note, .embed__url) .icon { inline-size: 1rem; block-size: 1rem; }

  /* «Читайте также»: M cards (§7); S cards for the inline block */
  .related { padding-block: var(--space-xl) var(--space-2xl); border-block-start: 1px solid var(--rule); }
  .related > * { grid-column: wide; }
  .related:not(:has(.card)) { display: none; } /* every related page withdrawn */
  .related__title { margin-block-end: var(--space-l); }
  .gallery__list > li { margin: 0; } /* no .prose list spacing */

  /* Lightbox (components/lightbox.html, site.js): a full-viewport modal dialog on paper; the
     picture is never framed or tinted (§10.5), neon only in the focus ring. Rows: close,
     picture, caption, gallery navigation. Opacity fade only, off under reduced motion. */
  .js [data-lightbox] { cursor: zoom-in; }
  :root:has(.lightbox[open]) { overflow: hidden; scrollbar-gutter: stable; }
  .lightbox[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: var(--space-xs);
    inline-size: 100%;
    max-inline-size: none;
    block-size: 100dvh;
    max-block-size: none;
    margin: 0;
    padding: var(--space-xs) var(--gutter) var(--space-s);
    color: var(--ink);
    background: var(--paper);
    border: 0;
  }
  .lightbox, .lightbox::backdrop {
    opacity: 0;
    transition: opacity var(--duration) var(--ease), overlay var(--duration) allow-discrete, display var(--duration) allow-discrete;
  }
  .lightbox[open], .lightbox[open]::backdrop { opacity: 1; }
  @starting-style { .lightbox[open], .lightbox[open]::backdrop { opacity: 0; } }
  .lightbox::backdrop { background: var(--paper); }
  .lightbox__close { justify-self: end; }
  .lightbox__figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: var(--space-xs); min-block-size: 0; }
  .lightbox__stage { display: grid; place-items: center; min-block-size: 0; touch-action: pan-y pinch-zoom; }
  .lightbox__stage picture { display: contents; }
  .lightbox__stage img { max-block-size: 100%; object-fit: contain; background: var(--sunken); }
  .lightbox__caption {
    justify-self: center;
    max-inline-size: var(--measure-narrow);
    max-block-size: 25dvh;
    overflow-y: auto;
    font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans);
    color: var(--ink-2);
    text-align: center;
    text-wrap: pretty;
  }
  .lightbox__nav { display: flex; align-items: center; justify-content: center; gap: var(--space-s); }
  .lightbox__counter { min-inline-size: 5.5em; font: var(--weight-label) var(--step--1) / 1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: center; }
  .lightbox__button {
    display: inline-grid;
    place-items: center;
    inline-size: var(--target);
    block-size: var(--target);
    padding: 0;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color var(--duration) var(--ease);
  }
  .lightbox__button:hover { background: var(--sunken); }

  /* Breadcrumbs: light, above the kicker (seo-spec §7.10); the current page is read, not shown */
  .breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-3); }
  .breadcrumbs li + li::before { content: "/"; content: "/" / ""; margin-inline-end: 0.5rem; color: var(--rule-strong); }
  .breadcrumbs a { color: inherit; text-decoration-color: transparent; }
  .breadcrumbs a:hover { color: var(--link-hover); text-decoration-color: var(--neon); }
  .article__top > .breadcrumbs { margin-block-end: calc(-1 * var(--space-s)); }

  /* Header details: kicker separators, reading time, the news dateline */
  .kicker__sep { color: var(--ink-3); }
  .byline__meta, .dateline time { display: flex; flex-wrap: wrap; column-gap: 0.45rem; }
  :is(.byline__meta, .dateline time) > :not(:last-child)::after { content: "·"; content: "·" / ""; margin-inline-start: 0.45rem; }

  /* Opinion: a voice — portrait, name, bio; the title in Literata italic (§7 «Opinion card») */
  .voice { display: flex; align-items: center; gap: var(--space-s); }
  .voice__portrait { flex: none; display: grid; inline-size: 4rem; block-size: 4rem; overflow: hidden; background: var(--sunken); border-radius: 50%; box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--neon); }
  .voice__portrait img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .voice__text { display: grid; gap: 0.15rem; min-inline-size: 0; font-family: var(--font-sans); line-height: var(--leading-ui); }
  .voice__name { font-size: var(--step-0); font-weight: var(--weight-label); color: var(--ink); }
  .voice__name a { color: inherit; text-decoration-color: var(--rule-strong); }
  .voice__name a:hover { color: inherit; text-decoration-color: var(--neon); }
  .voice__bio { display: -webkit-box; overflow: hidden; font-size: var(--step--1); color: var(--ink-3); -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .opinion__title { font-style: italic; font-weight: var(--weight-display); }
  .opinion__title--derived { font-size: var(--step-3); font-weight: var(--weight-medium); text-wrap: pretty; }
  h1.title--long { font-size: var(--step-3); } /* 80+ characters: fewer broken words */
  .disclaimer { padding-block-start: var(--space-s); font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-3); border-block-start: 1px solid var(--rule); }

  /* «По материалам» of news */
  .sources { font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-3); overflow-wrap: anywhere; }
  .sources__label { font-weight: var(--weight-label); color: var(--ink-2); }
  .sources p { display: inline; }
  .sources p + p::before { content: ", "; }

  /* Share row (§7): plain links in 44 px rings; copy and system share appear with JS */
  .share { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-s); }
  .share__title { font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans); letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--ink-3); }
  .share__list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .share__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-inline-size: var(--target);
    min-block-size: var(--target);
    padding: 0 0.7rem;
    font: var(--weight-medium) var(--step--1) / 1 var(--font-sans);
    color: var(--ink-2);
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  }
  .share__button:hover { color: var(--ink); border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon), 0 0 12px var(--glow); }
  .share__button .icon { inline-size: 1.25rem; block-size: 1.25rem; }
  .share__button--text { padding-inline: 0.9rem 1.1rem; }
  .share__status { flex-basis: 100%; font: var(--weight-medium) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-2); }
  .share__status:empty { display: none; }

  /* Table of contents (§7.1 item 7): <details> before the body; a sticky rail at ≥ 80em, where
     the body's wide pictures keep to the text column so they never run under it */
  .article__main { position: relative; }
  .toc-rail { display: none; }
  .toc__title { display: flex; align-items: center; gap: 0.5rem; font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans); letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--ink-3); }
  .toc__list { display: grid; padding: 0; font: var(--weight-body) var(--step--1) / 1.35 var(--font-sans); hyphens: manual; }
  .toc__list li { margin: 0; }
  .toc__list a { display: block; padding: 0.4rem 0 0.4rem 0.9rem; color: var(--ink-2); text-decoration: none; border-inline-start: 2px solid var(--rule); transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease); }
  .toc__sub a { padding-inline-start: 1.6rem; }
  .toc__list a:hover { color: var(--ink); border-color: var(--rule-strong); }
  .toc__list a[aria-current] { color: var(--ink); border-color: var(--neon); box-shadow: -4px 0 10px -6px var(--glow); }
  .toc--details { border-block: 1px solid var(--rule); }
  .toc--details summary { min-block-size: var(--target); list-style: none; }
  .toc--details summary::-webkit-details-marker { display: none; }
  .toc--details summary::after { content: "+"; content: "+" / ""; margin-inline-start: auto; font: var(--weight-body) 1.25rem / 1 var(--font-sans); color: var(--ink-3); }
  .toc--details[open] summary::after { content: "−"; content: "−" / ""; }
  .toc--details summary .icon { inline-size: 1.1rem; block-size: 1.1rem; }
  .toc--details .toc__list { padding-block-end: var(--space-s); }
  @media (min-width: 80em) {
    .toc-rail {
      display: block;
      position: absolute;
      inset-block: 0;
      inset-inline-start: var(--gutter);
      inline-size: calc((100% - var(--measure)) / 2 - var(--gutter) - var(--space-l));
      font-size: var(--step-0);
    }
    .toc--aside { position: sticky; inset-block-start: var(--space-l); display: grid; gap: var(--space-xs); max-inline-size: 16rem; margin-inline-start: auto; max-block-size: calc(100dvh - 2 * var(--space-l)); overflow-y: auto; }
    .article__main:has(.toc-rail) .toc--details { display: none; }
  }

  /* Previous/next item */
  .item-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--space-s) var(--column-gap); }
  .item-nav__link { display: grid; align-content: start; gap: 0.3rem; padding-block: var(--space-s); color: var(--ink); text-decoration: none; border-block-start: 1px solid var(--rule-strong); }
  .item-nav__link--next { grid-column: -2; text-align: end; justify-items: end; }
  .item-nav__direction { display: inline-flex; align-items: center; gap: 0.35rem; font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans); letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--link); }
  .item-nav__direction .icon { inline-size: 1rem; block-size: 1rem; }
  .item-nav__title { font-size: var(--step-1); font-weight: var(--weight-display); line-height: var(--leading-h3); text-wrap: balance; }
  .item-nav__date { font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-3); }
  .item-nav__link:hover { color: var(--ink); }
  .item-nav__link:is(:hover, :focus-visible) .item-nav__title { text-decoration: underline 2px var(--neon); text-underline-offset: 0.16em; }

  /* Sections after an item: news of the day, neighbouring photos and videos */
  :is(.day-news, .neighbours, .more-by) { padding-block: var(--space-xl) var(--space-2xl); border-block-start: 1px solid var(--rule); }
  :is(.day-news, .neighbours, .more-by) > div { display: grid; gap: var(--space-l); }
  :is(.neighbours, .more-by) > div { grid-column: wide; }
  .day-news__list { border-block-start: 1px solid var(--rule); }
  .day-news__list li { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); gap: var(--space-s); padding-block: 0.7rem; border-block-end: 1px solid var(--rule); }
  .day-news__time { padding-block-start: 0.2rem; font: var(--weight-medium) var(--step--1) / 1.3 var(--font-sans); color: var(--ink-3); }
  .day-news__list a { font-weight: var(--weight-display); line-height: var(--leading-h3); color: var(--ink); text-decoration: none; }
  .day-news__list a:hover { text-decoration: underline 2px var(--neon); text-underline-offset: 0.16em; }
  .day-news__archive { font: var(--weight-medium) var(--step--1) / var(--leading-ui) var(--font-sans); }
  .more-by__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: var(--space-m) var(--column-gap); }
  .more-by + .more-by { padding-block-start: 0; border-block-start: 0; } /* «По теме», «Статьи автора», «Ещё от автора» read as one block */
  .more-by__list li { display: grid; align-content: start; gap: 0.3rem; padding-block-start: var(--space-s); border-block-start: 1px solid var(--rule); }
  .more-by__list a { font-size: var(--step-1); font-weight: var(--weight-display); line-height: var(--leading-h3); color: var(--ink); text-decoration: none; text-wrap: balance; }
  .more-by__list a:hover { text-decoration: underline 2px var(--neon); text-underline-offset: 0.16em; }

  /* Photo of the day: the picture on a sunken wall, as large as the screen allows */
  .photo-hero { display: grid; justify-items: center; gap: var(--space-s); padding: var(--space-l) var(--gutter); background: var(--sunken); }
  .photo-hero__link { display: block; max-inline-size: min(100%, 80rem); }
  .photo-hero img { inline-size: auto; max-inline-size: 100%; max-block-size: 82dvh; }
  .photo-hero__caption { max-inline-size: var(--measure-narrow); font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-2); text-align: center; text-wrap: pretty; }
  .photo-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(6.5rem, 1fr); gap: var(--space-s); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-block-end: var(--space-2xs); }
  .photo-strip li { position: relative; scroll-snap-align: start; }
  .photo-strip__item { display: grid; align-content: start; gap: 0.4rem; color: var(--ink-2); text-decoration: none; }
  .photo-strip__item img { inline-size: 100%; block-size: auto; aspect-ratio: 1; object-fit: cover; background: var(--sunken); }
  .photo-strip__title { display: -webkit-box; overflow: hidden; font: var(--weight-body) var(--step--2) / 1.35 var(--font-sans); -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  a.photo-strip__item:hover { color: var(--ink); }
  a.photo-strip__item:hover .photo-strip__title { text-decoration: underline 1px var(--neon); }
  .photo-strip [aria-current] { padding-block-end: 0.5rem; }
  .photo-strip [aria-current]::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 2px; background: var(--neon); box-shadow: 0 0 8px var(--glow); }

  /* Video of the day: the player in the wide column, edge to edge on phones */
  .video-stage > * { grid-column: wide; }
  @media (max-width: 47.99em) {
    .video-stage > * { grid-column: full; }
    .video-stage :is(.video__label, .video__note) { padding-inline: var(--gutter); }
  }

  @media (forced-colors: active) {
    .toc__list a[aria-current] { border-inline-start-width: 4px; }
    .photo-strip [aria-current]::after { forced-color-adjust: none; background: CanvasText; }
  }

  @media print {
    :is(.breadcrumbs, .share, .toc, .toc-rail, .item-nav, .neighbours, .day-news, .more-by, .archive-banner .badge, .video__play, .video__note) { display: none !important; }
    .photo-hero { padding: 0; }
    .photo-hero img { max-block-size: 18cm; }
    .voice__portrait { display: none; }
  }

  /* Standard pages: the reading column only */
  .standard { padding-block: var(--space-xl) var(--space-2xl); row-gap: var(--space-l); align-content: start; }
  .standard__header { display: grid; gap: var(--space-xs); }
  .standard__title { font-size: var(--step-4); }
  .standard__empty { font-size: var(--step-1); line-height: var(--leading-lead); color: var(--ink-2); }
}

/* ===== blocks: StreamField block hooks inside the reading column ================== */
@layer blocks {
  /* Placement in the reading grid (§6): the text column unless a block needs more room */
  .reading > :is(.figure--wide, .gallery--grid, .table-block) { grid-column: wide; }
  .reading > .figure--full { grid-column: full; }
  :is(.gallery, .embed, .aside, .related-inline),
  :is(.gallery, .embed, .aside, .related-inline) + :not(h2, h3, h4) { --flow: 1.75em; }
  @media (max-width: 47.99em) { /* phones: wide pictures run edge to edge */
    .reading > .figure--wide { grid-column: full; }
    .figure--wide .figure__caption { padding-inline: var(--gutter); }
  }
  @media (min-width: 80em) { /* beside the table-of-contents rail (§items) nothing runs wide */
    .article__main:has(.toc-rail) .reading > :is(.figure--wide, .figure--full, .gallery--grid, .table-block) { grid-column: text; }
  }

  /* figure: pictures keep their own width (never stretched); caption and credit in Inter */
  .figure { display: grid; justify-items: start; gap: 0.6rem; }
  .figure--full { justify-items: center; }
  .figure__link { display: block; max-inline-size: 100%; }
  :is(.figure, .gallery__link, .legacy-html) img { background: var(--sunken); }
  .figure__caption, .gallery__caption {
    max-inline-size: var(--measure-narrow);
    margin: 0;
    font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans);
    color: var(--ink-3);
    hyphens: manual;
    text-wrap: pretty;
  }
  .figure--full .figure__caption { padding-inline: var(--gutter); text-align: center; }
  .caption-text + .credit::before { content: "· "; content: "· " / ""; }
  .credit a { color: inherit; text-decoration-color: var(--rule-strong); }
  .credit a:hover { color: var(--link-hover); text-decoration-color: var(--neon); }

  /* gallery: a grid of 4:3 thumbnails (2–3 columns) or a photo-essay strip; each opens the lightbox */
  .gallery { container-type: inline-size; }
  .gallery__list { display: grid; gap: var(--space-xl); padding: 0; } /* no .prose list indent */
  .gallery--grid .gallery__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-m) var(--space-s); }
  @container (min-width: 40rem) {
    .gallery--grid .gallery__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  .gallery__item { display: grid; align-content: start; gap: 0.5rem; }
  .gallery__link { position: relative; display: block; inline-size: fit-content; max-inline-size: 100%; }
  .gallery--grid .gallery__link { inline-size: auto; }
  .gallery--grid .gallery__link img { inline-size: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

  /* video facade (§7.2): poster or drawn placeholder, neon play ring; a link without JS, a
     <button> with it (site.js), then the provider's iframe */
  .video { display: grid; gap: 0.5rem; }
  .video__facade { display: grid; gap: 0.6rem; inline-size: 100%; padding: 0; color: var(--link); font: inherit; text-align: start; text-decoration: none; background: none; border: 0; cursor: pointer; }
  .video__screen--placeholder { background: radial-gradient(ellipse 60% 70% at 50% 50%, var(--glow-far), transparent 70%), var(--sunken); box-shadow: inset 0 0 0 1px var(--rule); }
  .video__provider { position: absolute; inset-inline-start: var(--space-s); inset-block-end: var(--space-xs); font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans); letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--ink-3); }
  .video__frame { display: block; inline-size: 100%; block-size: auto; aspect-ratio: 16 / 9; border: 0; background: #000; }
  .video:has(.video__frame) .video__note, .video__note-js, .js .video__note-link { display: none; }
  .js .video__note-js, .video__note-link { display: inline-flex; align-items: center; gap: 0.35rem; }
  .video__unavailable { display: grid; justify-items: center; gap: 0.35rem; max-inline-size: 32rem; padding: var(--space-m); font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-2); text-align: center; text-wrap: pretty; }
  .video__unavailable strong { font: var(--weight-display) var(--step-1) / var(--leading-h3) var(--font-serif); color: var(--ink); }
  .video__screen { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; background: var(--sunken); }
  .video__screen picture { position: absolute; inset: 0; }
  .video__screen img { inline-size: 100%; block-size: 100%; object-fit: cover; }
  .video__play {
    position: relative;
    display: grid;
    place-items: center;
    inline-size: 4.5rem;
    block-size: 4.5rem;
    color: var(--ink);
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--neon), 0 0 14px var(--glow), 0 0 32px var(--glow-far);
    transition: box-shadow var(--duration) var(--ease);
  }
  .video__play .icon { inline-size: 1.75rem; block-size: 1.75rem; margin-inline-start: 0.2rem; }
  .video__facade:is(:hover, :focus-visible) .video__play { box-shadow: 0 0 0 3px var(--neon), 0 0 20px var(--glow), 0 0 44px var(--glow-far); }
  .video__label { font: var(--weight-label) var(--step--1) / var(--leading-ui) var(--font-sans); text-decoration: underline 1px; text-underline-offset: 0.18em; }
  .video__facade:hover .video__label { color: var(--link-hover); text-decoration-color: var(--neon); text-decoration-thickness: 2px; }
  .video__note, .embed__url { display: flex; align-items: center; gap: 0.35rem; font: var(--weight-body) var(--step--1) / var(--leading-ui) var(--font-sans); color: var(--ink-3); }

  /* external_embed and social_post: quiet cards, the original is one click away */
  .embed__card, .social-post {
    display: grid;
    gap: 0.35rem;
    padding: var(--space-s) var(--space-m);
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
  }
  .embed__card { color: var(--ink); text-decoration: none; transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
  .embed__card:hover { color: var(--ink); border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon), 0 0 12px var(--glow); }
  .embed__provider { font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans); letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--ink-3); }
  .embed__title { font-size: var(--step-1); font-weight: var(--weight-display); line-height: var(--leading-h3); }
  .embed__url { min-inline-size: 0; color: var(--link); overflow-wrap: anywhere; }
  .embed__url .icon { flex: none; }
  .social-post__text { padding: 0; border: 0; }
  .social-post__platform { font-weight: var(--weight-label); color: var(--ink-2); }
  .social-post__meta { margin: 0; }

  /* quote, pull_quote, epigraph (§7.1) */
  .quote blockquote { padding-inline-start: 1.25rem; border-inline-start: 2px solid var(--neon); }
  :is(.quote, .epigraph) blockquote > * + *, .aside__text > * + * { margin-block-start: 0.75em; }
  .legacy-html > * + * { margin-block-start: 1em; }
  .quote__source, .pull-quote__source {
    max-inline-size: none;
    margin-block-start: 0.6rem;
    font: var(--weight-medium) var(--step--1) / var(--leading-ui) var(--font-sans);
    color: var(--ink-3);
  }
  .quote__source { padding-inline-start: calc(1.25rem + 2px); }
  .quote__source::before { content: "— "; content: "— " / ""; }
  .quote__source a { color: inherit; }
  .pull-quote { --flow: 2em; position: relative; padding-block: var(--space-m); padding-inline-start: 2.75rem; border-block: 1px solid var(--rule); }
  .pull-quote + * { --flow: 2em; }
  .pull-quote::before {
    content: "«";
    content: "«" / "";
    position: absolute;
    inset-block-start: var(--space-s);
    inset-inline-start: 0;
    font: italic var(--weight-medium) 3.5rem / 1 var(--font-serif);
    color: var(--neon);
  }
  .pull-quote blockquote { padding: 0; border: 0; font: italic var(--weight-medium) var(--step-2) / var(--leading-h2) var(--font-serif); text-wrap: balance; }
  .epigraph { max-inline-size: 28rem; margin-inline-start: auto; text-align: end; color: var(--ink-2); }
  .epigraph blockquote { padding: 0; border: 0; font-style: italic; }
  .epigraph__source {
    max-inline-size: none;
    margin-block-start: 0.5rem;
    font: var(--weight-medium) var(--step-0) / var(--leading-ui) var(--font-serif);
    font-variant-caps: all-small-caps;
    letter-spacing: 0.05em;
    color: var(--ink-3);
  }

  /* notes: numbered, small, the target note is highlighted */
  .notes { --flow: 2.5em; padding-block-start: var(--space-s); font-size: var(--step--1); line-height: 1.55; color: var(--ink-2); border-block-start: 1px solid var(--rule); }
  .notes__title, .aside__title { margin-block-end: var(--space-xs); }
  .notes__title { font: var(--weight-label) var(--step--2) / 1.3 var(--font-sans); letter-spacing: var(--tracking-kicker); text-transform: uppercase; color: var(--ink-3); }
  .notes__list { margin: 0; padding-inline-start: 1.75em; }
  .notes__list li { padding-inline-start: 0.25em; border-radius: var(--radius); }
  .notes__list li + li { margin-block-start: 0.5em; }
  .notes__list li::marker { font-family: var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink-3); }
  .notes__list li:target { background: var(--mark-bg); box-shadow: 0 0 0 0.3em var(--mark-bg); color: var(--ink); }
  .notes__list li > p:last-of-type { display: inline; } /* the back-link follows the text */
  .notes__back { margin-inline-start: 0.2em; font-family: var(--font-sans); text-decoration: none; }
  .prose a[id^="note-ref-"]:target { background: var(--mark-bg); box-shadow: 0 0 0 0.15em var(--mark-bg); border-radius: var(--radius); }

  /* table: scrolls inside its own focusable region; Handsontable alignment classes */
  .table-block__scroll { overflow-x: auto; overscroll-behavior-x: contain; }
  .table-block caption { padding-block-end: 0.5rem; font-weight: var(--weight-medium); color: var(--ink-2); text-align: start; }
  .table-block .htCenter { text-align: center; }
  .table-block .htRight { text-align: end; }
  .table-block .htMiddle { vertical-align: middle; }
  .table-block .htBottom { vertical-align: bottom; }

  /* aside «Справка», inline «Читайте также», archival HTML */
  .aside { padding: var(--space-m); background: var(--sunken); border: 1px solid var(--rule); border-radius: var(--radius); }
  .related-inline { display: grid; gap: var(--space-xs); padding-block: var(--space-s); border-block: 1px solid var(--rule); }
  .legacy-html:has(table) { overflow-x: auto; }
  .legacy-html :is(h2, h3, h4) { margin-block-start: 1.8em; }
}


/* ===== overrides: item pages and blocks under user preferences and print (§5.3) ===== */
@layer overrides {
  @media (prefers-contrast: more) {
    .quote blockquote { border-inline-start-color: var(--ink); }
    .pull-quote::before { color: var(--ink); }
    .video__play { box-shadow: 0 0 0 2px var(--ink) !important; }
    .embed__card:hover { border-color: var(--ink); box-shadow: none; }
  }
  @media (forced-colors: active) {
    .video__play, .voice__portrait { border: 1px solid CanvasText; }
  }
  /* Articles: one column, captions, notes and link URLs kept; navigation aids dropped */
  @media print {
    .aside, .notes__list li { break-inside: avoid; }
    .related, .tag-list, .video__play, .byline__portrait, .author-box__portrait, .author-box__more,
    .video__screen:not(:has(img)) { display: none !important; }
    .article { padding: 0; }
    .article__lead { font-size: 13pt; }
    .table-block__scroll { overflow: visible; }
    .notes__list li:target { background: none; box-shadow: none; }
  }
}

/* Phase 4 (SEO): the «Обновлено …» date (content_updated_at) in bylines and datelines. */
@layer components {
  .updated time { color: var(--ink-2); }
}
