/* The news story page (templates/story.html), 2026-10-07.

   Owner, looking at a story: "fix this design wtf". What was wrong:
   - article.css capped the headline at 24ch, so it wrapped into a narrow block with half the card empty beside it;
   - site.css floats .news-photo right at 36% (max 260px), written for a thumbnail beside a long text. With a
     one-line summary the photo dropped to the bottom right of the card, away from the headline;
   - in the one-column layout (about 820-1199px) the card is ~960px wide while the text kept a 68ch measure on the
     left, which left a wide empty band on the right.

   Now: one centred reading column (max 720px) inside the card for everything; the headline uses that whole width and
   scales with the card (24px phone .. 38px); the photo is a wide frame right under the headline, never upscaled much,
   with a soft blurred copy of itself filling the sides when it is narrower than the column; the text keeps a
   65-75 character measure. Scoped to .story-view so posts (post.html, also .post-view) are unchanged. Loaded from
   story.html's late_styles block, after every shared sheet. */

.post-view.story-view {
  --story-col: 720px;
  container-type: inline-size;   /* the headline size follows the card, not the window */
  padding: clamp(22px, 4.6%, 42px) clamp(18px, 5.6%, 48px) clamp(24px, 4.6%, 40px);
}

/* One column for the header, photo, text and credits; centred when the card is wider than a reading column. */
.post-view.story-view > * {
  width: 100%;
  max-width: var(--story-col);
  margin-inline: auto;
}

/* Running text keeps a 65-75 character line (34em) but starts at the column's left edge, under the headline. */
.post-view.story-view > .story-lede,
.post-view.story-view > .article-body,
.post-view.story-view > .post-body {
  max-width: 34em;
  margin-left: max(0px, (100% - var(--story-col)) / 2);
  margin-right: auto;
}

/* ---------------------------------------------------------------- header */
.post-view.story-view .post-header {
  margin-bottom: 0;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

/* With a photo right below, the space separates them; the rule is only needed above plain text. */
.post-view.story-view .post-header:has(+ .news-photo:not([hidden])) {
  padding-bottom: 0;
  border-bottom: 0;
}

.post-view.story-view .post-header .board-chip { font-size: 13px; }

.post-view.story-view .post-header h1 {
  max-width: none;
  margin-top: 14px;
  color: var(--ink);
  font-size: clamp(24px, 14.5px + 3.46cqi, 38px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.022em;
  text-wrap: pretty;
}

/* Press-release titles can run past 150 characters; a step smaller keeps them from filling the screen. */
.post-view.story-view .post-header h1.is-long { font-size: clamp(22px, 12px + 2.9cqi, 32px); line-height: 1.28; }

.post-view.story-view .post-meta {
  gap: 6px 16px;
  margin-top: 16px;
  color: #50627d;
  font-size: 14px;
  line-height: 1.5;
}

.post-view.story-view .post-meta .icon { width: 15px; height: 15px; }
.post-view.story-view .post-meta .story-source { color: #2a3b5c; font-weight: 700; }
.post-view.story-view .post-meta .story-source.is-ours { color: var(--blue-dark); }
.post-view.story-view .post-meta .content-kind { color: #8c603b; font-weight: 600; }

/* ----------------------------------------------------------------- photo */
.post-view.story-view .news-photo {
  float: none;
  margin: 26px auto 0;
}

.post-view.story-view .news-photo[hidden] { display: none; }

.story-view .news-photo-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  overflow: hidden;
  border-radius: 16px;
  background: #e8f1fb;
  isolation: isolate;
}

/* The same picture, blurred, fills the frame when the photo itself is narrower than the column. */
.story-view .news-photo-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  filter: blur(26px) saturate(1.15);
  transform: scale(1.2);
  pointer-events: none;
}

.post-view.story-view .news-photo .story-image {
  display: block;
  width: auto;
  min-width: min(100%, 540px);   /* small publisher photos are enlarged a little, never blown up */
  max-width: 100%;
  height: auto;
  max-height: min(460px, 72vh);
  margin: 0;
  border-radius: 0;
  background: none;
  object-fit: contain;
}

.post-view.story-view .news-photo figcaption {
  padding: 10px 2px 0;
  color: #5f6e86;
  font-size: 13.5px;
  line-height: 1.6;
}

/* The loading shimmer belongs on the picture's frame, not behind the caption too. */
.motion-ready .story-view .news-photo.is-loading-photo { background: none; animation: none; }
.motion-ready .story-view .news-photo.is-loading-photo .news-photo-frame {
  background-image: linear-gradient(100deg, #e6eef9 20%, #f4f8fd 40%, #e6eef9 60%);
  background-size: 220% 100%;
  animation: motion-shimmer 1.4s linear infinite;
}

/* ------------------------------------------------------------------ text */
/* 34em is about 72 latin characters (about 45 Korean) a line at 18px, about 75 at 20px. */
.post-view.story-view .story-lede {
  padding: 26px 0 0;
  color: #1f314f;
  font-size: 20px;
  line-height: 1.7;
  text-wrap: pretty;
}

.post-view.story-view .article-body,
.post-view.story-view .post-body {
  min-height: 0;
  padding-top: 28px;
  padding-bottom: 0;
  font-size: 18px;
}

.post-view.story-view .article-body > :last-child,
.post-view.story-view .post-body > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- credits */
.post-view.story-view .story-credit {
  gap: 14px 20px;
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid #dde8f5;
  border-radius: 14px;
  background: #f3f8fe;
  color: #44536b;
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.post-view.story-view .story-credit p { min-width: 220px; }
.post-view.story-view .story-credit .button { flex: 0 0 auto; background: #fff; }

.post-view.story-view .syndication-credit {
  margin-top: 30px;
  padding-top: 18px;
  color: #50627d;
  font-size: 14px;
  line-height: 1.75;
}

.post-view.story-view .syndication-credit a { color: #2a3b5c; }

.post-view.story-view .inline-ad { margin-top: 28px; }

/* The comments card under the story keeps the story's column, so both cards line up at every width. */
.story-view + .comments {
  padding-inline: clamp(18px, 5.6%, 48px);
}

.story-view + .comments > * {
  max-width: 720px;
  margin-inline: auto;
}

.story-view + .comments h2 { font-size: 19px; }

/* ----------------------------------------------------------------- phones */
@media (max-width: 620px) {
  .post-view.story-view .post-header { padding-bottom: 18px; }
  .post-view.story-view .post-header h1 { margin-top: 12px; line-height: 1.28; }
  .post-view.story-view .post-meta { gap: 4px 12px; margin-top: 12px; font-size: 13px; }
  .post-view.story-view .news-photo { margin-top: 20px; }
  .story-view .news-photo-frame { min-height: 160px; border-radius: 12px; }
  .post-view.story-view .story-lede { padding-top: 20px; font-size: 18px; line-height: 1.7; }
  .post-view.story-view .article-body,
  .post-view.story-view .post-body { padding-top: 22px; font-size: 17px; }
  .post-view.story-view .story-credit { margin-top: 22px; padding: 16px; font-size: 14px; }
  .post-view.story-view .story-credit p { min-width: 0; flex-basis: 100%; }
}
