/* Haywebs prototype — the blog: the list (blog.html) and the article
   (post.html). Load after base.css. Both pages are dark throughout, with no
   pinned hero and no seal: the fixed header sits over a plain ground, so
   each page's first block clears it (--hdr).

   Covers are plates (.media) with a canvas[data-art="cover"] seeded by the
   post's slug; --c in the markup is the same hue for the CSS fallback. */

/* ------------------------------------------------------------ helpers --- */
/* a heading for screen readers only (the list's «Другие статьи») */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* any word may break in a heading, so a 60-letter word never overflows */
.blog :is(h1, h2, h3), .post :is(h1, h2, h3), .more :is(h2, h3), .post-cta h2 { overflow-wrap: anywhere; }

/* the date and the reading time: Manrope 500, the caption size */
.meta { font: 500 var(--fs-small) / 1.4 var(--sans); color: var(--text-3); }

/* --------------------------------------------------------- the list --- */
.blog { padding: calc(var(--hdr) + clamp(40px, 7vw, 104px)) max(var(--g), (100% - var(--measure)) / 2) clamp(96px, 11vw, 160px); }
/* the title on the left; the count and the lead on the right, at its foot */
.blog-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 28px clamp(32px, 5vw, 96px);
  margin-bottom: clamp(48px, 6vw, 96px);
}
.blog-intro { width: min(44ch, 100%); font-size: var(--fs-lead); } /* ch in the lead's size */
.blog-intro .kicker { margin-bottom: 20px; }
.blog-intro .lead { max-width: 44ch; }
/* no posts yet: one line under a hairline and the way to the form */
.blog-empty { display: grid; justify-items: start; gap: 16px; padding-top: clamp(32px, 4vw, 56px); border-top: 1px solid var(--line); }
.blog-empty-title { font: 600 var(--fs-h3) / 1.3 var(--sans); letter-spacing: -0.012em; }
.blog-empty p { max-width: 44ch; font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--text-2); }
.blog-empty .btn { margin-top: 8px; }

/* A post links from its heading; the link's ::after spans the whole post,
   so the cover and the excerpt are part of the target. z-index 1 lifts it
   over the cover, which is positioned (.media) and, in a row, comes after
   the heading; the hover scale is keyed on the post, so it still applies. */
:is(.feature, .row) { position: relative; }
:is(.feature, .row) :is(h2, h3) a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
@supports selector(:has(a)) {
  /* the ring goes around the post, not the heading's text */
  :is(.feature, .row) :is(h2, h3) a:focus-visible { outline: none; }
  :is(.feature, .row):has(:is(h2, h3) a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 8px; border-radius: var(--r); }
}

/* The newest post, large: the 16:9 cover over seven columns and, beside
   it at its foot, the date, the h2 and the excerpt (so the title is on the
   first screen); below 1180 px the cover runs across and the text follows. */
.feature {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-rows: 1fr auto auto; column-gap: clamp(32px, 4vw, 72px);
  margin-bottom: clamp(56px, 7vw, 112px);
}
.feature .cover { grid-column: 1; grid-row: 1 / 4; aspect-ratio: 16 / 9; }
.feature .meta { grid-column: 2; grid-row: 1; align-self: end; margin-bottom: 16px; }
.feature h2 { grid-column: 2; grid-row: 2; }
.feature .excerpt { grid-column: 2; grid-row: 3; align-self: end; max-width: 40ch; margin-top: 20px; font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--text-2); }
/* The other posts as rows between hairlines:
   date · minutes | h3 | excerpt | a 4:3 cover on the right. */
.row {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr) minmax(0, 2fr); align-items: start;
  column-gap: clamp(20px, 2.4vw, 40px); padding: clamp(24px, 2.8vw, 40px) 0; border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
.row .meta { grid-column: 1; grid-row: 1; padding-top: 0.25em; }
.row h3 { grid-column: 2; grid-row: 1; font: 600 var(--fs-h3) / 1.3 var(--sans); letter-spacing: -0.012em; }
.row .excerpt { grid-column: 3; grid-row: 1; font-size: 15px; line-height: 1.6; color: var(--text-2); max-width: 36ch; }
.row .cover { grid-column: 4; grid-row: 1; aspect-ratio: 4 / 3; }

@media (hover: hover) {
  :is(.feature, .row):hover .cover { transform: scale(1.02); }
  :is(.feature, .row) :is(h2, h3) a { text-decoration: underline 1px transparent; text-underline-offset: 0.18em; transition: text-decoration-color var(--t-fast) var(--soft); }
  :is(.feature, .row):hover :is(h2, h3) a { text-decoration-color: currentColor; }
}

/* 1023 px and below: the date, the h3 and the excerpt stack beside the cover */
@media (max-width: 1023px) {
  .row { grid-template-columns: minmax(0, 1fr) minmax(150px, 0.42fr); grid-template-rows: auto auto 1fr; row-gap: 10px; }
  .row .meta { grid-column: 1; grid-row: 1; padding-top: 0; }
  .row h3 { grid-column: 1; grid-row: 2; }
  .row .excerpt { grid-column: 1; grid-row: 3; }
  .row .cover { grid-column: 2; grid-row: 1 / -1; }
}
@media (max-width: 1179px) {
  .feature { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .feature .cover { grid-row: auto; margin-bottom: clamp(24px, 3vw, 40px); }
  .feature :is(.meta, h2, .excerpt) { grid-column: 1; grid-row: auto; }
  .feature h2 { max-width: 20ch; }
  .feature .excerpt { margin-top: 18px; }
}
@media (max-width: 760px) {
  .blog-head { grid-template-columns: minmax(0, 1fr); }
  .blog-intro { width: 100%; }
}
/* below 640 px a row is text only */
@media (max-width: 639px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .row .cover { display: none; }
}

/* ------------------------------------------------------ the article --- */
.post { padding: calc(var(--hdr) + clamp(32px, 5vw, 72px)) max(var(--g), (100% - var(--measure)) / 2) 0; }
/* the head is a size container: the title is held to its width */
.post-head { container-type: inline-size; }
.back {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: clamp(28px, 4vw, 48px);
  font: 500 var(--fs-small) / 1.4 var(--sans); color: var(--text-2); transition: color var(--t-fast) var(--soft);
}
.back:hover { color: var(--text); }
.back span { transition: transform var(--t-fast) var(--ease); }
.back:hover span { transform: translateX(-4px); }
/* the kicker reads as one phrase here: date · minutes */
.post-head .kicker { display: block; margin-bottom: clamp(20px, 2.6vw, 36px); line-height: 1.4; }
/* --fs-title at most; held to 4.85 % of the column so that a 90-character
   title fits in three lines, mask padding included (in the wordmark's face
   5.24 % is the measured limit for free text), and never under 32 px: on
   phones a long title runs longer instead. */
.post-title { font-size: clamp(32px, 4.85cqi, var(--fs-title)); }
.post-cover { aspect-ratio: 16 / 9; margin-top: clamp(32px, 4.4vw, 64px); }

/* The text: one centred 760 px column, Manrope 17/1.75. */
.prose { width: min(760px, 100%); margin: clamp(48px, 6vw, 96px) auto 0; font: 400 17px / 1.75 var(--sans); color: var(--text-2); }
.prose > * + * { margin-top: 1.2em; }
.prose a { color: var(--text); text-decoration: underline 1px; text-underline-offset: 0.2em; text-decoration-color: var(--line-strong); }
.prose a:hover { text-decoration-color: currentColor; }
.prose h2 { margin-top: 2.1em; font: 400 34px / 1.15 var(--serif); letter-spacing: -0.012em; color: var(--text); }
.prose h3 { margin-top: 1.9em; font: 600 22px / 1.3 var(--sans); letter-spacing: -0.012em; color: var(--text); }
.prose :is(h2, h3) + * { margin-top: 0.8em; }
.prose ul { margin-bottom: 0; padding: 0; list-style: none; }
.prose li { position: relative; padding-left: 1.6em; }
.prose li + li { margin-top: 0.5em; }
/* the list's dot: one of the accent's three uses */
.prose li::before { content: ""; position: absolute; left: 0.35em; top: 0.75em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.prose blockquote { margin: 1.8em 0; padding: 4px 0 4px 28px; border-left: 1px solid var(--text-3); font: 400 24px / 1.4 var(--serif); color: var(--text); }
.prose figure { margin: 2.4em 0; }
.prose figure .media { aspect-ratio: 16 / 10; }
.prose figcaption { margin-top: 14px; font: 500 var(--fs-small) / 1.4 var(--sans); color: var(--text-3); }
.prose hr { height: 1px; margin: 3em 0; border: 0; background: var(--line); }

/* The call to action across the page, then «Другие статьи». */
.post-cta {
  position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 32px 48px;
  margin-top: clamp(96px, 11vw, 160px); padding: clamp(48px, 6vw, 88px) max(var(--g), (100% - var(--measure)) / 2) 0;
}
.post-cta::before { content: ""; position: absolute; left: max(var(--g), (100% - var(--measure)) / 2); right: max(var(--g), (100% - var(--measure)) / 2); top: 0; height: 1px; background: var(--line); }
.post-cta h2 { max-width: 20ch; }
.more { padding: clamp(96px, 11vw, 160px) max(var(--g), (100% - var(--measure)) / 2); }
.more-title { margin-bottom: clamp(24px, 3vw, 40px); font: italic 800 30px / 1.1 var(--brand); letter-spacing: var(--ls-display); }

@media (max-width: 760px) {
  .prose { font-size: 16px; }
  .prose h2 { font-size: 30px; }
  .prose h3 { font-size: 20px; }
  .prose blockquote { padding-left: 20px; font-size: 21px; }
}

/* ----------------------------------------------- the placeholder footer --- */

/* ------------------------------------------------------- the entrance --- */
/* The title rises first (base.css: .ln-in, 0–1.0 s). On the list, a
   reveal that starts during the entrance waits for it: until html.settled
   (set by blog.html's inline script 1.2 s after go) the delay is 0.8 s plus
   the 90 ms steps, so the cover and the rows come in from 0.8 s; a reveal
   scrolled to later has no lag. (A lag held by a CSS animation or
   transition would be "animation-tainted" and ignored by transition-delay.)
   On the article the date and the cover take 0.8–1.4 s, the text 1.2–2.0 s. */
@media (prefers-reduced-motion: no-preference) {
  .js:not(.settled) .blog [data-reveal] { transition-delay: calc(0.8s * var(--tempo) + var(--d, 0) * 90ms); }
  .js.go .post :is(.back, .kicker, .post-cover).a-2 { animation-duration: calc(0.6s * var(--tempo)); }
  /* the article's title may wrap inside its masks: it rises without the
     shared tracking change (0.06em → none), so no word jumps lines mid-rise */
  .js.go .post-title .ln-in { animation-name: rise-flat; }
}
@keyframes rise-flat { from { transform: translateY(112%); } }
/* touch targets on a phone (see base.css) */
@media (max-width: 760px) { .back { min-height: 44px; } }
