/* launch.css: the launch layout proposal (branch awan_launch_edits). Loaded
   after article.css on the public pages and in the admin preview. Remove the
   two <link>s (news_public_templates.go, handleAdminNews.go) to go back to the
   15 November template; nothing else depends on this file.

   What it changes (docs/launch-design-proposal.md):
   - Articles use the width of the screen: a 660 px reading column, and from
     1100 px a right-hand column ("Latest news", sticky) beside it — the
     template guide's open `layout.rail: right` option.
   - A larger headline and summary; the byline and the story tools (Listen,
     Share) on one line; "How this story was made" and "Not investment advice"
     on the line below instead of three stacked rows.
   - The main picture spans the reading column and the right-hand column on
     wide screens, and runs edge to edge on phones. Pictures inside the text
     keep Peter's rule (never wider than the text, never stretched).
   - The footer's section list in two columns.

   Layout follows the space the story has, not the window (container
   queries), so the admin preview shows the same layout at its own width.
   The story's design object still sets fonts, colours and spacing; this file
   only sets the sizes below. When this file changes, bump newsCSSVersion. */

.nv2-article-wrap--template, .preview-body { container: newsa / inline-size; }
.da-rail { display: none; }

/* ---------------------------------------------------------------- every size */
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0;
  grid-template-areas: "kick kick" "head head" "dek dek" "by by" "how how" "adv adv" "op op" "tools tools";
}
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-kicker { grid-area: kick; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-headline { grid-area: head; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-dek { grid-area: dek; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-byline { grid-area: by; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-how { grid-area: how; align-self: center; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-advice { grid-area: adv; justify-self: end; align-self: center; margin: 0.55rem 0 0; white-space: nowrap; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-opinion-line { grid-area: op; }
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-tools { grid-area: tools; }
/* phones: the advice under "How this story was made", on the left */
:is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-advice { justify-self: start; }
.news-a .da-headline { text-wrap: balance; }
.news-a .da-dek { text-wrap: pretty; }

/* ---------------------------------------------------------------- phones */
@container newsa (max-width: 639.98px) {
  :is(.nv2-article-wrap--template, .preview-body) .news-a { --headline-size: 2rem; --headline-lh: 1.12; }
  /* the main picture edge to edge, its caption back on the margin */
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top > .da-hero.da-hero:not(.da-hero--overlay) {
    width: calc(100% + var(--margin) * 2); max-width: none; margin-left: calc(var(--margin) * -1); margin-right: calc(var(--margin) * -1);
  }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-hero:not(.da-hero--overlay) .da-media { width: 100%; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top > .da-hero figcaption { padding-left: var(--margin); padding-right: var(--margin); }
}

/* ---------------------------------------------------------------- tablets and up */
@container newsa (min-width: 640px) {
  :is(.nv2-article-wrap--template, .preview-body) .news-a {
    --column: 40rem; --headline-size: 2.875rem; --headline-lh: 1.07; --headline-track: -0.01em;
    --dek-size: 1.375rem; --dek-lh: 1.42; --body-size: 1.1875rem; --body-lh: 1.62;
  }
  /* byline left, story tools right, on one rule */
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head { grid-template-areas: "kick kick" "head head" "dek dek" "by tools" "how adv" "op op"; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-tools { justify-self: stretch; justify-content: flex-end; align-self: stretch; align-items: center; padding: 0.875rem 0 0 1rem; border-top: 1px solid var(--c-rule-strong); }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-tools:empty { display: flex; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-advice { justify-self: end; }
  /* a story without "How this story was made" puts the advice on the left */
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head:not(:has(> .da-how)) > .da-advice { grid-area: how; justify-self: start; }
}

/* ---------------------------------------------------------------- wide: column + right-hand column */
@container newsa (min-width: 1100px) {
  :is(.nv2-article-wrap--template, .preview-body) .news-a {
    --column: 41.25rem; --rail-w: 18.75rem; --rail-gap: 4rem;
    --layout-w: calc(var(--column) + var(--rail-gap) + var(--rail-w));
    --max: calc(var(--layout-w) + var(--margin) * 2);
    --headline-size: 3.5rem; --headline-lh: 1.05; --headline-track: -0.015em;
    --dek-size: 1.5rem; --dek-lh: 1.4; --body-size: 1.25rem; --body-lh: 1.65; --h2-size: 1.875rem;
  }
  /* the top of the story spans both columns, its text aligned with the reading column */
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top { max-width: var(--layout-w); margin-left: auto; margin-right: auto; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top > .da-head.da-col { max-width: none; margin: 0; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-headline { max-width: 16em; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-head > .da-dek { max-width: 34em; }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top > .da-hero.da-hero:not(.da-hero--overlay) { max-width: var(--layout-w); }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-hero:not(.da-hero--overlay) .da-media { width: min(100%, var(--img-w, 100%)); }
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top > .da-points,
  :is(.nv2-article-wrap--template, .preview-body) .news-a .da-top > .da-figures { max-width: var(--column); margin-left: 0; }

  .news-a .da-layout--rail { display: grid; grid-template-columns: var(--column) var(--rail-w); column-gap: var(--rail-gap); justify-content: center; align-items: start; max-width: var(--layout-w); margin: 0 auto; }
  .news-a .da-layout--rail .da-main { min-width: 0; }
  .news-a .da-layout--rail .da-main .da-col { max-width: none; margin-left: 0; margin-right: 0; }
  /* "wide" and edge-to-edge pictures stay inside the reading column beside the right-hand column */
  .news-a .da-layout--rail .da-body > .da-pos-bleed { width: auto; margin-left: 0; margin-right: 0; }

  .news-a .da-rail { display: block; position: sticky; top: 5.5rem; }
  .news-a .da-rail .da-end-label { margin-bottom: 0.25rem; }
  .da-rail-list { list-style: none; margin: 0; padding: 0; counter-reset: rail; }
  .da-rail-list li { counter-increment: rail; border-bottom: 1px solid var(--c-rule); }
  .news-a .da-rail-item { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); padding: 0.85rem 0; color: var(--c-ink); text-decoration: none; }
  .news-a .da-rail-item::before { content: counter(rail); grid-row: 1 / span 3; font: 600 1.375rem/1.1 var(--f-serif); color: var(--c-accent); }
  .da-rail-cat { display: block; font: 700 0.6875rem/1.4 var(--f-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-muted); }
  .da-rail-title { font: 600 1.0625rem/1.3 var(--f-serif); text-wrap: pretty; }
  .news-a .da-rail-item:hover .da-rail-title { text-decoration: underline; text-underline-offset: 0.18em; }
  .da-rail-time { margin-top: 0.3rem; font: 400 0.8125rem/1.3 var(--f-sans); color: var(--c-muted); }
  .news-a .da-rail .da-more-section { margin-top: 0.25rem; }
}

/* ---------------------------------------------------------------- large screens: one step up */
@container newsa (min-width: 1500px) {
  :is(.nv2-article-wrap--template, .preview-body) .news-a {
    --column: 43.75rem; --rail-w: 20rem; --rail-gap: 5rem;
    --headline-size: 4rem; --dek-size: 1.625rem; --body-size: 1.3125rem; --h2-size: 2rem;
  }
}

/* ---------------------------------------------------------------- footer: the 18 sections in two newspaper columns */
.footer-grid > .footer__col:first-child { display: block; columns: 2; column-gap: 24px; }
.footer-grid > .footer__col:first-child > .footer__col-head { column-span: all; margin-bottom: 13px; }
.footer-grid > .footer__col:first-child > a { display: block; margin-bottom: 9px; break-inside: avoid; white-space: nowrap; }
@media (min-width: 901px) { .footer-grid { grid-template-columns: minmax(0, 2.2fr) repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 32px; }
  .footer-grid > .footer__col:first-child { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- home: the top story picture first, full width of the lead column */
@media (min-width: 961px) {
  .front .nws-cluster.nws-feature--img:not(.nws-feature--stack) .nws-cluster__grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .front .nws-cluster.nws-feature--img:not(.nws-feature--stack) .nws-feature__thumb { order: -1; margin: 0; }
  .front .nws-cluster.nws-feature--img:not(.nws-feature--stack) .nws-feature__title { font-size: clamp(34px, 3.2vw, 48px); line-height: 1.05; letter-spacing: -0.012em; text-wrap: balance; }
  .front .nws-cluster.nws-feature--img:not(.nws-feature--stack) .nws-feature__dek { font-size: clamp(18px, 1.45vw, 21px); max-width: 52ch; }
}

/* ---------------------------------------------------------------- AI disclosure as fine print (Awan, 16 November):
   present wherever a picture appears, but small and in the margin, like an ad's disclaimer */
.nws-card__thumb, .nws-rcard__thumb, .nws-sub__thumb, .nws-feature__thumb { position: relative; }
.nws-ai-tag { position: absolute; right: 5px; bottom: 5px; z-index: 1; padding: 1px 4px; border-radius: 2px; background: rgba(10, 10, 12, 0.32); color: rgba(255, 255, 255, 0.82); font: 600 8.5px/1.3 var(--font, system-ui, sans-serif); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; pointer-events: none; }
/* small square thumbnails: just "AI" */
.nws-sub__thumb .nws-ai-tag { font-size: 0; padding: 1px 3px; right: 3px; bottom: 3px; }
.nws-sub__thumb .nws-ai-tag::after { content: "AI"; font-size: 8px; }
@media (min-width: 961px) { .nws-sub__thumb .nws-ai-tag { font-size: 8.5px; padding: 1px 4px; right: 5px; bottom: 5px; } .nws-sub__thumb .nws-ai-tag::after { content: none; } }
/* the credit under a picture in the story: fine print beside the caption */
.news-a .da-credit { font-size: 0.75rem; color: var(--c-muted); opacity: 0.85; letter-spacing: 0.01em; }
