/*
 * "Three from the Table" — /news and /news/<date>
 *
 * This file is the single source of the news design. The standalone previews
 * produced by data-systems/publisher-social/render_news.py read this file and
 * inline it, so there is exactly one copy of these rules and the preview can
 * never drift from what ships.
 *
 * Everything is scoped under `.mf-news`. The markup uses short, generic class
 * names (.row, .copy, .tag, .logo, .wrap) that would otherwise collide with the
 * site's global styles in both directions — the descendant scope keeps this
 * page's rules in and everyone else's out. The design tokens are declared on
 * `.mf-news` rather than `:root` for the same reason.
 *
 * Committed to MindForge's own dark identity (style-guide.php). The site is
 * dark; a light inversion would be a different brand, so the tokens hold in
 * both theme contexts.
 */

.mf-news {
  --bg: #1a222f;
  --bg-primary: #1f2937;
  --bg-deep: #111827;
  --bg-raised: #26303f;
  --accent: #f97316;
  --accent-hover: #fb923c;
  --text: #e5e7eb;
  --text-2: #9ca3af;
  --text-3: #6b7686;
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-2: rgba(255, 255, 255, 0.2);
  --info: #3b82f6;

  --display: "Arial Narrow", "Liberation Sans Narrow", "Helvetica Neue Condensed",
             "Roboto Condensed", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --data: ui-monospace, "SF Mono", "Liberation Mono", Menlo, Consolas, monospace;

  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
.mf-news *,
.mf-news *::before,
.mf-news *::after { box-sizing: border-box; }
.mf-news .wrap { max-width: 60rem; margin: 0 auto; }
.mf-news a { color: var(--accent-hover); }

/* ── masthead, matching the card ── */
.mf-news .mast {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; padding: 2.25rem 0 0;
}
.mf-news .eyebrow {
  font-family: var(--data); font-size: .7rem; letter-spacing: .3em;
  text-transform: uppercase; color: var(--text-2);
}
.mf-news .wordmark {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.2rem, 8vw, 3.4rem); line-height: .95;
  text-transform: uppercase; margin: .35rem 0 0;
  color: var(--text);
}
.mf-news .wordmark em { font-style: normal; color: var(--accent); }
.mf-news .mast-right { display: flex; flex-direction: column; align-items: flex-end; gap: .55rem; }
.mf-news .logo { width: 52px; height: 52px; display: block; }
.mf-news .issue {
  font-family: var(--data); font-size: .7rem; line-height: 1.6;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-2); text-align: right;
}
.mf-news .issue b { color: var(--text); }
.mf-news .rule {
  height: 3px; margin: 1.4rem 0 1.6rem;
  background: linear-gradient(90deg, var(--accent) 0 10%, var(--hairline-2) 10% 100%);
}
.mf-news .hint {
  font-family: var(--data); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
  margin: -0.9rem 0 1.5rem;
}

/* ── story rows ── */
.mf-news .rows { display: flex; flex-direction: column; gap: 1.1rem; }

.mf-news .row {
  /* Deliberately no `isolation: isolate` here. On narrow screens the tray
     is a fixed bottom sheet, and a stacking context on the row would trap
     it underneath the rows that follow it in the document. */
  position: relative;
  min-height: 15.5rem;
  border-radius: 14px; overflow: hidden;
  background: var(--bg-deep); border: 1px solid var(--hairline);
  box-shadow: 0 10px 24px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .18s ease, transform .18s ease;
}
.mf-news .row:hover,
.mf-news .row.open { border-color: rgba(249,115,22,.45); }
.mf-news .row.open { z-index: 50; }

.mf-news .shot {
  position: absolute; top: 0; bottom: 0; left: 0; width: 64%;
  background-size: cover; background-position: center;
  -webkit-mask-image: linear-gradient(to right, #000 0 46%, rgba(0,0,0,.55) 74%, transparent 100%);
  mask-image: linear-gradient(to right, #000 0 46%, rgba(0,0,0,.55) 74%, transparent 100%);
}
.mf-news .row.flip .shot {
  left: auto; right: 0;
  -webkit-mask-image: linear-gradient(to left, #000 0 46%, rgba(0,0,0,.55) 74%, transparent 100%);
  mask-image: linear-gradient(to left, #000 0 46%, rgba(0,0,0,.55) 74%, transparent 100%);
}
.mf-news .scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(17,24,39,.92) 0%, rgba(17,24,39,.45) 9%, rgba(17,24,39,.12) 20%, rgba(17,24,39,0) 32%),
    linear-gradient(to bottom, rgba(17,24,39,.34) 0%, rgba(17,24,39,0) 26% 74%, rgba(17,24,39,.34) 100%),
    linear-gradient(to right, rgba(17,24,39,.15) 0%, rgba(17,24,39,.30) 40%, rgba(17,24,39,.86) 66%, var(--bg-deep) 88%);
}
.mf-news .row.flip .scrim {
  background:
    linear-gradient(to left, rgba(17,24,39,.92) 0%, rgba(17,24,39,.45) 9%, rgba(17,24,39,.12) 20%, rgba(17,24,39,0) 32%),
    linear-gradient(to bottom, rgba(17,24,39,.34) 0%, rgba(17,24,39,0) 26% 74%, rgba(17,24,39,.34) 100%),
    linear-gradient(to left, rgba(17,24,39,.15) 0%, rgba(17,24,39,.30) 40%, rgba(17,24,39,.86) 66%, var(--bg-deep) 88%);
}

.mf-news .copy {
  position: relative; z-index: 1;
  margin-left: auto; width: 57%;
  min-height: 15.5rem;
  padding: 1.5rem 1.6rem 1.5rem 1rem;
  display: flex; flex-direction: column; justify-content: center; gap: .55rem;
}
.mf-news .row.flip .copy { margin-left: 0; margin-right: auto; text-align: right;
                           align-items: flex-end; padding: 1.5rem 1rem 1.5rem 1.6rem; }

.mf-news .meta { display: flex; align-items: center; gap: .6rem; }
.mf-news .row.flip .meta { flex-direction: row-reverse; }
.mf-news .num { font-family: var(--display); font-weight: 700; font-size: 1.6rem;
                color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.mf-news .tag {
  font-family: var(--data); font-size: .66rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent-hover);
  border: 1px solid rgba(249,115,22,.42); background: rgba(249,115,22,.1);
  border-radius: 4px; padding: .2rem .5rem; white-space: nowrap;
}
.mf-news .blurb {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.5rem, 4.4vw, 2.1rem); line-height: 1.05;
  margin: 0; text-wrap: balance; color: var(--text);
}
.mf-news .blurb .hl { color: var(--accent); }
.mf-news .pub { font-family: var(--data); font-size: .72rem; letter-spacing: .12em;
                text-transform: uppercase; color: var(--text-2); }
.mf-news .spec { font-family: var(--data); font-size: .82rem; color: var(--text); }
.mf-news .spec span { color: var(--text-3); padding: 0 .35rem; }
.mf-news .summary { font-size: .95rem; color: var(--text-2); margin: .2rem 0 0; max-width: 46ch; }
.mf-news .row.flip .summary { margin-left: auto; }

.mf-news .opener {
  margin-top: .35rem;
  font-family: var(--data); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-hover);
  display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-weight: 700;
}
.mf-news .opener::after { content: "\2192"; transition: transform .18s ease; }
.mf-news .row:hover .opener::after { transform: translateX(3px); }

/* "Read in English" is a <button> in the tray styled as one more link row;
   undo the button defaults the anchors never had. */
.mf-news button.lk { width: 100%; font: inherit; text-align: left; cursor: pointer; }
/* `.lk { display: flex }` outranks the UA's `[hidden] { display: none }`, so
   news.js setting `hidden` on the button (no showModal) needs this to stick. */
.mf-news .lk[hidden] { display: none; }
.mf-news .lk.xl8-open { border-color: rgba(249,115,22,.3); }
.mf-news .lk.xl8-open .lk-kind { color: var(--accent-hover); }

/* ── "Read in English" modal ──
   A native <dialog> opened with showModal(): it sits in the top layer, so the
   row's `overflow: hidden` and the site header's z-index can't clip it, and
   focus trapping + Escape come from the browser. Its own colours are set here
   because the top layer is still inside `.mf-news` for inheritance. */
.mf-news .xl8 {
  /* The theme's global reset zeroes `margin` on everything, which un-centres
     a modal dialog (the UA centres it with `margin: auto` + `inset: 0`).
     Restated here so the page doesn't depend on the reset leaving it alone. */
  position: fixed; inset: 0; margin: auto;
  width: min(36rem, calc(100vw - 2rem)); height: fit-content; max-height: min(80vh, 44rem);
  padding: 0; border-radius: 14px;
  background: var(--bg-deep); color: var(--text);
  border: 1px solid rgba(249,115,22,.45);
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  text-align: left; overflow-y: auto;
}
/* Padding lives on the inner wrapper, so every click on the <dialog> element
   itself is a backdrop click (news.js closes on exactly that). */
.mf-news .xl8-body { padding: 1.3rem 1.4rem 1.1rem; }
.mf-news .xl8::backdrop { background: rgba(8, 12, 20, .72); backdrop-filter: blur(2px); }
.mf-news .xl8-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.mf-news .xl8-eyebrow {
  font-family: var(--data); font-size: .66rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent-hover);
}
.mf-news .xl8-title {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: 1.6rem; line-height: 1.05; margin: .3rem 0 0; color: var(--text);
}
.mf-news .xl8-close {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%; cursor: pointer;
  background: none; border: 1px solid var(--hairline-2); color: var(--text-2);
  font-size: 1.2rem; line-height: 1;
}
.mf-news .xl8-close:hover { color: var(--text); border-color: var(--accent); }
.mf-news .xl8-intro { margin: .9rem 0 0; color: var(--text); line-height: 1.5; }
.mf-news .xl8-points { margin: .8rem 0 0; padding-left: 1.1rem; list-style: disc outside; display: grid; gap: .45rem;
                       color: var(--text-2); line-height: 1.45; font-size: .95rem; }
.mf-news .xl8-points li { display: list-item; list-style: inherit; }
.mf-news .xl8-points li::marker { color: var(--accent); }
.mf-news .xl8-points b { color: var(--text); }
.mf-news .xl8-note {
  margin: 1.1rem 0 0; padding-top: .7rem; border-top: 1px solid var(--hairline);
  font-size: .76rem; color: var(--text-3);
}

/* ── the link tray ── */
.mf-news .tray {
  position: absolute; inset: 0; z-index: 2;
  background: rgba(10, 15, 24, .96);
  backdrop-filter: blur(3px);
  border-radius: 14px;
  padding: 1.15rem 1.3rem;
  display: flex; flex-direction: column; gap: .6rem; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .16s ease, visibility .16s ease;
}
.mf-news .row.open .tray { opacity: 1; visibility: visible; }
/* Hover-to-open is gated on WIDTH as well as pointer type, and must stay that
   way. A desktop browser narrower than 46rem — a half-screen window, a snapped
   window, browser zoom >=175% at 1280px — matches `(hover: hover) and
   (pointer: fine)` AND `(max-width: 46rem)` at the same time. Without the width
   gate the hover rule opened the tray while the narrow rule below converted it
   to a `position: fixed` bottom sheet: the sheet detached from the row that
   opened it, and when that row was not near the bottom of the viewport there
   was no overlap at all, so moving the pointer toward the sheet dropped
   `:hover` and the sheet vanished before it could be entered. Below 46rem the
   tray is tap/click-driven through `.opener` (news.js binds `click`, which a
   mouse fires too) with a visible `.closer` and Escape to dismiss. */
@media (hover: hover) and (pointer: fine) and (min-width: 46.01rem) {
  .mf-news .row:hover .tray { opacity: 1; visibility: visible; }
}
.mf-news .tray-head {
  font-family: var(--data); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-3);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.mf-news .tray-head b { color: var(--accent); font-weight: 700; }
.mf-news .closer {
  background: none; border: 1px solid var(--hairline-2); color: var(--text-2);
  border-radius: 4px; font-family: var(--data); font-size: .68rem;
  padding: .15rem .45rem; cursor: pointer;
}
/* Same width gate as the hover-open rule above: the closer may only be hidden
   where hover is what opens the tray. Below 46rem the tray is click-driven even
   on a fine pointer, so this is the only visible way back out of a sheet that
   covers the row. */
@media (hover: hover) and (pointer: fine) and (min-width: 46.01rem) {
  .mf-news .closer { display: none; }
}

/* Wide tracks on purpose: link labels are sentences, and a four-up grid
   wraps every one of them to three lines. */
.mf-news .tray-links { display: grid; gap: .45rem;
                       grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.mf-news .lk {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: 8px; text-decoration: none;
  background: rgba(255,255,255,.04); border: 1px solid var(--hairline);
  color: var(--text); transition: background .14s ease, border-color .14s ease;
}
.mf-news .lk:hover { background: rgba(255,255,255,.09); border-color: var(--hairline-2); }
.mf-news .lk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mf-news .lk-kind {
  font-family: var(--data); font-size: .6rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
  width: 5.6rem; flex: none;
}
/* `min-width: 0` is the load-bearing half: a flex item defaults to
   `min-width: auto`, so it refuses to shrink below its content's intrinsic
   minimum and a long label pushes out through the button's border instead of
   wrapping inside it. `anywhere` then handles the strings with nothing to
   wrap AT — a URL, a German compound — which is what actually escaped. */
.mf-news .lk-label { font-size: .88rem; line-height: 1.25;
                     min-width: 0; overflow-wrap: anywhere; }
.mf-news .lk-label small { display: block; color: var(--text-3); font-size: .74rem; }
.mf-news .lk.own { background: rgba(249,115,22,.13); border-color: rgba(249,115,22,.45); }
.mf-news .lk.own:hover { background: rgba(249,115,22,.2); }
.mf-news .lk.own .lk-kind, .mf-news .lk.own .lk-label { color: var(--accent-hover); }
.mf-news .lk.own .lk-label small { color: rgba(251,146,60,.7); }
.mf-news .lk.vid { border-color: rgba(59,130,246,.4); }
.mf-news .lk.vid .lk-kind { color: #93bbfc; }
.mf-news .lk.missing {
  border-style: dashed; color: var(--text-3);
  pointer-events: none; background: none;
}
.mf-news .lk.missing .lk-label { color: var(--text-3); }

/* ── narrow screens: image on top, copy below, tray becomes a sheet ── */
@media (max-width: 46rem) {
  .mf-news .row { min-height: 0; }
  .mf-news .shot,
  .mf-news .row.flip .shot {
    position: relative; width: 100%; height: 9.5rem; left: auto; right: auto;
    -webkit-mask-image: linear-gradient(to bottom, #000 0 52%, rgba(0,0,0,.5) 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0 52%, rgba(0,0,0,.5) 80%, transparent 100%);
  }
  /* The scrim has to track the image strip, not the row — stacked rows are
     twice the image's height, so a full-row gradient puts its solid end
     far below the copy it was meant to be backing. */
  .mf-news .scrim,
  .mf-news .row.flip .scrim {
    bottom: auto; height: 9.5rem;
    background:
      linear-gradient(to bottom, rgba(17,24,39,.35) 0%, rgba(17,24,39,0) 26%,
                      rgba(17,24,39,.72) 52%, var(--bg-deep) 70%);
  }
  .mf-news .copy,
  .mf-news .row.flip .copy {
    width: 100%; margin: 0; min-height: 0; text-align: left; align-items: stretch;
    padding: 0 1.1rem 1.3rem; margin-top: -3.2rem;
  }
  .mf-news .row.flip .meta { flex-direction: row; }
  .mf-news .row.flip .summary { margin-left: 0; }
  /* The sheet is a modal-class overlay, so it has to clear the site's overlay
     tier: the feedback widget's FAB is fixed bottom-left at z-index 9999 and
     otherwise lands on top of the sheet's bottom-most link — hiding its kind
     label and stealing the tap. `.row.open`'s z-index goes back to auto at this
     breakpoint so raising the sheet does not also drag the row's artwork over
     the sticky site header (z-index 1000); the sheet is fixed to the viewport
     here, so it no longer needs the row lifted to sit above the rows below it.
     10000 matches the site's modal tier (.signin-modal__content), and the
     feedback panel — later in the document — still wins if both are open. */
  .mf-news .row.open { z-index: auto; }
  .mf-news .tray { position: fixed; inset: auto 0 0 0; top: auto; border-radius: 16px 16px 0 0;
                   max-height: 82vh; overflow-y: auto; padding: 1.1rem 1rem 1.6rem;
                   z-index: 10000; }
  .mf-news .tray-links { grid-template-columns: 1fr; }
}

/* ── footer nav ── */
.mf-news .foot {
  margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  font-family: var(--data); font-size: .74rem; letter-spacing: .06em;
  color: var(--text-2);
}
.mf-news .foot a { text-decoration: none; }

/* ── /news — the archive index ──
   Narrower measure than an issue page: this one is a list, not a layout. */
.mf-news.is-index .wrap { max-width: 52rem; }
.mf-news.is-index .rule { margin: 1.4rem 0 1rem; }
.mf-news .lede { color: var(--text-2); max-width: 46ch; margin: 0 0 2rem; }

.mf-news .issues { display: flex; flex-direction: column; gap: .8rem; }
.mf-news .iss {
  display: grid; grid-template-columns: 11rem 1fr; gap: 0 1.5rem;
  padding: 1.15rem 1.3rem; text-decoration: none; color: inherit;
  background: var(--bg-deep); border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .16s ease, transform .16s ease;
}
.mf-news .iss:hover { border-color: rgba(249,115,22,.45); transform: translateY(-1px); }
.mf-news .iss:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mf-news .iss-date { font-family: var(--display); font-weight: 700; font-size: 1.5rem;
                     line-height: 1.15; text-transform: uppercase; }
.mf-news .iss-no { grid-column: 1; font-family: var(--data); font-size: .7rem;
                   letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.mf-news .iss-heads { grid-column: 2; grid-row: 1 / span 2; margin: 0; padding: 0;
                      list-style: none; display: flex; flex-direction: column; gap: .3rem; }
.mf-news .iss-heads li { font-size: .95rem; line-height: 1.35;
                         display: flex; gap: .6rem; align-items: baseline; }
.mf-news .iss-heads span { font-family: var(--data); font-size: .64rem;
                           letter-spacing: .1em; text-transform: uppercase;
                           color: var(--text-3); width: 8rem; flex: none;
                           text-align: right; }
.mf-news .iss:hover .iss-heads li { color: var(--accent-hover); }

/* Before the first issue ships, and any time the manifest is empty — say so
   rather than rendering a bare masthead over nothing. */
.mf-news .empty {
  padding: 2.5rem 1.3rem; border-radius: 12px; text-align: center;
  background: var(--bg-deep); border: 1px dashed var(--hairline-2);
  color: var(--text-2);
}

@media (max-width: 40rem) {
  .mf-news .iss { grid-template-columns: 1fr; gap: .2rem; }
  .mf-news .iss-heads { grid-column: 1; grid-row: auto; margin-top: .7rem;
                        padding-top: .7rem; border-top: 1px solid var(--hairline); }
  .mf-news .iss-heads li { flex-direction: column; gap: .05rem; }
  .mf-news .iss-heads span { width: auto; text-align: left; }
}
