/* Biplabi Sambad Darpan — direction B (broadsheet structure, Anek Bangla type).
   Tokens mirror Status/DECISIONS.md; change them there too. */

:root {
  color-scheme: light;
  --newsprint: #F4F1EA;
  --surface:   #FFFFFF;
  --ink:       #12100D;
  --ink-soft:  #4A443A;
  --muted:     #6B6355;
  --red:       #8E1B14;
  --on-red:    #FFFFFF;
  --fire:      #C93D14; /* hot topics in the nav */
  --hairline:  #D8D1C3;
  --hairline-soft: #E4DFD3;

  --nav-bottom: 48px; /* the pinned bar's bottom edge; nav.js keeps it current */
  --measure: 700px;
  --gutter: 52px;
}

/* Reader themes. With no data-theme the page follows the OS (Auto); the
   picker in the menu sets data-theme="light|sepia|dark" (theme.js, and an
   inline line in <head> so the choice applies before first paint). Tokens
   flip, layout does not. The dark set appears twice because CSS cannot share
   one block between a media query and an attribute selector. Every text
   pair here is at least 4.5:1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --newsprint: #14120F;
    --surface:   #1B1815;
    --ink:       #F2EEE6;
    --ink-soft:  #C9C2B5;
    --muted:     #9A9081;
    --red:       #F08C82;
    --on-red:    #14120F;
    --fire:      #FFB627;
    --hairline:  #332E27;
    --hairline-soft: #262220;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --newsprint: #14120F; --surface: #1B1815; --ink: #F2EEE6; --ink-soft: #C9C2B5;
  --muted: #9A9081; --red: #F08C82; --on-red: #14120F; --fire: #FFB627; --hairline: #332E27; --hairline-soft: #262220;
}
/* Warm cream page and brown ink, after Apple Books' sepia themes. */
:root[data-theme="sepia"] {
  --newsprint: #EEE2CC; --surface: #F6EDDC; --ink: #33281C; --ink-soft: #4F4130;
  --muted: #6A5943; --red: #8A2A1C; --fire: #B8360F; --hairline: #D6C6A8; --hairline-soft: #E2D4B9;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Anek Bangla', system-ui, -apple-system, sans-serif;
  background: var(--newsprint);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; display: block; }

.shell { width: 100%; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--newsprint); padding: 12px 20px;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- masthead */

.topline {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 12px; font-size: 13px; color: var(--muted);
  letter-spacing: 0.04em; border-bottom: 1px solid var(--hairline);
}
.topline__center { text-align: center; }

.masthead { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-block: 30px 20px; }
/* The logo, with no white tile, so it sits on all three themes. Its black
   parts are painted --ink and its red parts the brand red, each through a
   mask cut from the original artwork (static/img/logo-source.jpeg):
   *-ink.png and *-red.png are white with the share of that colour as alpha. */
.logo-art { display: block; position: relative; forced-color-adjust: none; }
.logo-art::before, .logo-art::after {
  content: ""; position: absolute; inset: 0;
  -webkit-mask: var(--logo-mask) center / contain no-repeat;
  mask: var(--logo-mask) center / contain no-repeat;
}
.logo-art::before { background: var(--ink); }
.logo-art::after { background: #DE2D1B; }
.logo-art--icon::before { --logo-mask: url(/static/img/icon-ink.png); }
.logo-art--icon::after { --logo-mask: url(/static/img/icon-red.png); }

/* Symbol and name scale together off one font size, sized to the viewport so
   the name stays on one line down to a 320px phone. */
.masthead__logo {
  display: flex; align-items: center; gap: 0.2em;
  font-size: clamp(24px, 8.2vw, 70px); color: var(--ink);
}
.masthead__logo:hover { color: var(--ink); }
.masthead__logo .logo-art { height: 1.1em; aspect-ratio: 1; flex-shrink: 0; }
.masthead__name { font-weight: 800; line-height: 1.1; white-space: nowrap; }
/* The brand red: large text, so 3:1 is enough (≥3.6:1 on every theme). */
.masthead__name-red { color: #DE2D1B; }
.masthead__rule { display: flex; align-items: center; gap: 16px; width: 100%; }
.masthead__rule::before, .masthead__rule::after { content: ""; height: 1px; background: var(--ink); flex-grow: 1; }
/* The theme's --red, not the brand red: small text needs 4.5:1. */
.masthead__tag { font-size: 15px; font-weight: 600; letter-spacing: 0.2em; color: var(--red); white-space: nowrap; }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--newsprint);
  border-bottom: 3px double var(--ink);
  box-shadow: 0 6px 14px -10px rgb(0 0 0 / 0.45);
}
.nav__bar { display: flex; align-items: center; gap: 22px; }
.nav__list {
  display: flex; align-items: center; gap: 26px;
  margin: 0; padding: 10px 0; list-style: none;
  font-size: 17px; font-weight: 600;
  white-space: nowrap; flex-grow: 1; min-width: 0;
  /* Scrolls sideways when the sections don't fit. overflow-x: auto clips
     vertically too, so dropdowns inside the list must not be positioned
     against anything inside it — see .nav__list .dd below. */
  overflow-x: auto; scrollbar-width: none;
}
.nav__list::-webkit-scrollbar { display: none; }
.nav__list > li { flex: 0 0 auto; }
/* Desktop: a dropdown in the list hangs from the bar, which does not clip,
   instead of from its own item (which the list's overflow would cut off).
   Phones get the full-width sheet in the 720px block instead. */
@media (min-width: 721px) {
  .nav__bar { position: relative; }
  .nav__list .dd { position: static; }
  .nav__list .dd__panel { top: calc(100% + 3px); left: var(--gutter); }
}

/* Dropdowns are native <details>: they work with no JS and take keyboard
   focus for free. nav.js only adds click-outside and Escape dismissal. */
.dd { position: relative; }
.dd__summary {
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; list-style: none; user-select: none;
}
.dd__summary::-webkit-details-marker { display: none; }
.dd__chev { width: 14px; height: 14px; transition: transform 0.15s ease; }
.dd[open] > .dd__summary > .dd__chev { transform: rotate(180deg); }
.dd[open] > .dd__summary { color: var(--red); }

.dd__panel {
  position: absolute; top: calc(100% + 12px); left: 0; z-index: 60;
  min-width: 520px; padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--hairline); border-top: 3px solid var(--red);
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.5);
}
.dd__panel--right { left: auto; right: 0; }
.dd__panel--menu { min-width: 560px; display: flex; flex-direction: column; gap: 20px; }
.dd__all {
  display: inline-block; margin-bottom: 14px; padding-bottom: 10px;
  font-weight: 700; color: var(--red); border-bottom: 1px solid var(--hairline-soft); width: 100%;
}
.dd__grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 24px;
  font-size: 16px; font-weight: 500;
}
.dd__grid > a { padding: 7px 0; }
.dd__block { display: flex; flex-direction: column; gap: 8px; }
.dd__head {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 6px; border-bottom: 1px solid var(--hairline-soft);
}

.nav__burger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  cursor: pointer; list-style: none; border: 1px solid var(--hairline); border-radius: 3px;
}
.nav__burger::-webkit-details-marker { display: none; }
.nav__burger svg { width: 21px; height: 21px; }
.dd--menu[open] > .nav__burger,
.dd--search[open] > .nav__burger { background: var(--red); color: var(--on-red); border-color: var(--red); }
.dd--search + .dd--menu { margin-left: -12px; } /* the two buttons read as one group */
.dd__panel--search { min-width: 440px; }
/* E-paper sits with search and the menu as a third button. */
.nav__epaper {
  display: inline-flex; align-items: center; height: 44px; padding-inline: 12px; flex-shrink: 0;
  border: 1px solid var(--hairline); border-radius: 3px;
  font-size: 15px; font-weight: 700; white-space: nowrap;
}
.nav__epaper + .dd--search { margin-left: -12px; }

/* Breaking news: a red strip under the logo while a story is flagged
   (articles.breaking_until). One line; a long headline ends in an ellipsis. */
.breaking { background: var(--red); color: var(--on-red); }
.breaking__bar { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.breaking__label {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  font-size: 14px; font-weight: 800; letter-spacing: 0.06em;
  padding: 2px 10px; border: 1.5px solid currentColor; border-radius: 3px;
}
.breaking__label::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  animation: breaking-pulse 1.4s ease-in-out infinite;
}
@keyframes breaking-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .breaking__label::before { animation: none; } }
.breaking__link {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 17px; font-weight: 700;
}
.breaking__link:hover { color: inherit; text-decoration: underline; }

/* Festival greeting: a ribbon under the menu while an admin's greeting
   runs, shown once per reader and faded out after a few seconds
   (greeting.js). */
.greeting { background: var(--surface); border-bottom: 1px solid var(--hairline); border-top: 3px solid var(--fire);
  transition: opacity 0.8s ease; }
.greeting--out { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .greeting { transition: none; } }
.greeting__bar { display: flex; align-items: center; gap: 14px; min-height: 56px; padding-block: 8px; }
.greeting__img { height: 64px; width: auto; max-width: 120px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.greeting__text { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.greeting__close {
  flex-shrink: 0; min-width: 44px; min-height: 44px; border: 1px solid var(--hairline); border-radius: 3px;
  background: transparent; color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}
.greeting__close:hover { border-color: var(--ink); }

/* Live coverage. The badge marks a running live blog wherever its headline
   appears; the blog itself is a timeline, newest first. */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: 0.15em;
  padding: 1px 7px; border-radius: 3px; background: var(--red); color: var(--on-red);
  font-size: 0.55em; font-weight: 800; letter-spacing: 0.06em; line-height: 1.5;
}
.card__title .live-badge, .brief__title .live-badge { font-size: 12px; }
.live-badge::before {
  content: ""; width: 0.55em; height: 0.55em; min-width: 6px; min-height: 6px; border-radius: 50%;
  background: currentColor; animation: breaking-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .live-badge::before { animation: none; } }

.live { border-top: 3px solid var(--red); padding-top: 14px; }
.live__head { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.live__head .live-badge { font-size: 13px; }
.live__list { list-style: none; margin: 0; padding: 0; }
.live__item {
  position: relative; padding: 14px 0 14px 22px;
  border-left: 2px solid var(--hairline); border-bottom: 1px solid var(--hairline-soft);
}
.live__item::before {
  content: ""; position: absolute; left: -6px; top: 20px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--red);
}
.live__item--new { background: var(--surface); }
.live__time { display: block; font-size: 14px; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.live__body { margin: 4px 0 0; font-size: 18px; line-height: 1.7; white-space: pre-line; }

/* Live TV: the player and its caption, and the video cards. On the front
   page they sit as a strip above the news, the recent videos beside the
   player (under it, scrolling sideways, on a phone); /live-tv/ lists all. */
.tv-player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.tv-player iframe, .tv-player__poster { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tv-player__poster { display: flex; align-items: center; justify-content: center; }
.tv-player__poster img, .tv-card__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tv-player__caption { margin: 10px 0 0; font-size: 20px; font-weight: 800; line-height: 1.35; }
.tv-player__caption .live-badge { font-size: 13px; }
/* YouTube's red, so it reads as "play" at a glance on any still. */
.tv-play {
  position: relative; width: 68px; height: 48px; border-radius: 12px; background: #DE2D1B;
  display: flex; align-items: center; justify-content: center;
}
.tv-play::after { content: ""; margin-left: 4px; border-left: 20px solid #fff; border-block: 12px solid transparent; }
.tv-card { display: flex; flex-direction: column; gap: 6px; }
.tv-card__thumb {
  position: relative; aspect-ratio: 16 / 9; background: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.tv-card__thumb .tv-play { transform: scale(0.6); }
.tv-card__text { display: flex; flex-direction: column; gap: 2px; }
.tv-card__title { font-size: 15px; font-weight: 700; line-height: 1.35; }
.tv-card__title .live-badge { font-size: 11px; }
.tv-card__date { font-size: 13px; color: var(--muted); }

.tv-strip { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; padding-block: 22px 6px; }
.tv-strip__side { display: flex; flex-direction: column; gap: 12px; }
.tv-strip__side .tv-card { flex-direction: row; gap: 10px; }
.tv-strip__side .tv-card__thumb { width: 120px; flex-shrink: 0; align-self: flex-start; }
.tv-strip__all { font-weight: 700; color: var(--red); }

/* ---------------------------------------------------------------- air quality */
/* CPCB's band colours; the number beside them carries the meaning too. */
.aqi--1 { --aqi: #009933; --aqi-ink: #fff; }
.aqi--2 { --aqi: #58C322; --aqi-ink: #1A1A1A; }
.aqi--3 { --aqi: #F2D024; --aqi-ink: #1A1A1A; }
.aqi--4 { --aqi: #FF9900; --aqi-ink: #1A1A1A; }
.aqi--5 { --aqi: #E3241B; --aqi-ink: #fff; }
.aqi--6 { --aqi: #8B0000; --aqi-ink: #fff; }
.aqi-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--aqi); vertical-align: middle; }
.aqi-chip { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; white-space: nowrap; }
.aqi-chip:hover .aqi-chip__text { text-decoration: underline; }
.aqi-page { padding-block: 24px 10px; display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.aqi-page__meta, .aqi-page__source, .aqi-page__stations { color: var(--muted); font-size: 14px; }
.aqi-page__pick select { font: inherit; padding: 4px 8px; margin-inline-start: 6px; }
.aqi-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.aqi-table th, .aqi-table td { text-align: start; padding: 9px 8px; border-bottom: 1px solid var(--hairline); }
.aqi-table th { font-size: 13px; color: var(--muted); font-weight: 600; }
.aqi-table td:nth-child(n+4), .aqi-table th:nth-child(n+4) { text-align: end; font-variant-numeric: tabular-nums; }
.aqi-badge { display: inline-block; min-width: 3em; padding: 2px 8px; border-radius: 4px; text-align: center; font-weight: 700; background: var(--aqi); color: var(--aqi-ink); font-variant-numeric: tabular-nums; }
.aqi-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.aqi-legend .aqi-dot { margin-inline-end: 5px; }

.tv-page { padding-block: 24px 10px; display: flex; flex-direction: column; gap: 16px; max-width: 1000px; }
.tv-page__sub { margin-top: 14px; }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.feed-more { display: block; margin: 30px auto 0; }

@media (max-width: 720px) {
  .tv-strip { grid-template-columns: 1fr; }
  .tv-strip__side { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .tv-strip__side .tv-card { flex-direction: column; width: 160px; flex-shrink: 0; scroll-snap-align: start; }
  .tv-strip__side .tv-card__thumb { width: 100%; }
  .tv-strip__all { align-self: center; flex-shrink: 0; padding-inline: 8px; }
  .tv-player__caption { font-size: 17px; }
  .tv-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* The masthead in miniature, shown in the bar once the real one has scrolled
   away. It takes the home button's place, so the bar never gets more crowded. */
.nav__brand {
  display: none; align-items: center; gap: 8px; flex-shrink: 0;
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap;
}
.nav__brand .logo-art { width: 30px; height: 30px; }
.nav--pinned .nav__brand { display: inline-flex; animation: brand-in 0.2s ease-out; }
.nav--pinned .nav__home { display: none; }
@keyframes brand-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .nav--pinned .nav__brand { animation: none; } }

/* Reader theme picker, top of the menu. Real radio buttons, so it works with
   the keyboard and a screen reader; hidden until theme.js is running. Each
   swatch shows its own theme's page and ink, whatever the current theme. */
.theme-picker { margin: 0; padding: 0; border: 0; min-width: 0; }
.theme-picker[hidden] { display: none; }
.theme-picker__options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.theme-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.theme-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-option__swatch {
  display: flex; align-items: center; justify-content: center;
  width: 100%; max-width: 72px; height: 48px; border-radius: 8px;
  border: 1px solid var(--hairline); font-size: 18px; font-weight: 700;
}
.theme-option--auto  .theme-option__swatch { background: linear-gradient(135deg, #F4F1EA 50%, #14120F 50%); }
.theme-option--light .theme-option__swatch { background: #F4F1EA; color: #12100D; }
.theme-option--sepia .theme-option__swatch { background: #EEE2CC; color: #33281C; }
.theme-option--dark  .theme-option__swatch { background: #14120F; color: #F2EEE6; }
.theme-option input:checked + .theme-option__swatch { outline: 3px solid var(--red); outline-offset: 2px; }
.theme-option input:checked ~ .theme-option__name { color: var(--ink); }
.theme-option input:focus-visible + .theme-option__swatch { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Home sits at the start as an icon so the pinned bar stays compact. */
.nav__home {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; background: var(--red); color: var(--on-red); border-radius: 3px;
  flex-shrink: 0;
}
.nav__home:hover { color: var(--on-red); opacity: 0.88; }
.nav__home svg { width: 19px; height: 19px; }
.nav__link[aria-current="page"] { color: var(--red); }
/* A pinned hot-event section: flame colour and a small flame-dot, in the bar
   and at the head of the menu. */
.nav__link--hot { color: var(--fire); display: inline-flex; align-items: center; gap: 6px; }
.nav__link--hot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}

/* District rail — the 24-district problem. Horizontal scroll, current first. */
.rail {
  display: flex; gap: 8px; padding-block: 12px;
  background: var(--newsprint);
  overflow-x: auto; scrollbar-width: thin;
  border-bottom: 1px solid var(--hairline);
}
.rail::-webkit-scrollbar { height: 4px; }
.rail__label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em;
  text-transform: uppercase; white-space: nowrap; align-self: center; }
.rail__chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 3px;
  font-size: 16px; white-space: nowrap;
}
.rail__chip--current { background: var(--red); border-color: var(--red); color: var(--on-red); font-weight: 600; }
.rail__chip--current:hover { color: var(--on-red); }

/* ---------------------------------------------------------------- layout */

.front { display: grid; grid-template-columns: 250px minmax(0, 1fr) 288px; gap: 0; }
.front__left  { padding: 24px 24px 24px 0;  border-right: 1px solid var(--hairline); }
.front__main  { padding: 24px 28px; min-width: 0; }
.front__right { padding: 24px 0 24px 24px;  border-left: 1px solid var(--hairline); }

/* Ads (the paper's own; a slot is rendered only while an ad runs in it).
   From 1280px: a 120×600 column either side of the page, staying in view
   under the pinned bar (they stand in for the side margins, so the gutter
   narrows); the wide banner then gives way to them. Narrower: a 728×90
   banner under the bar, or a 320×100 one on phones. Ads in a slot take
   turns (ads.js); each carries a small বিজ্ঞাপন tag. */
.ad-slot { position: relative; display: block; overflow: hidden; background: var(--surface); }
.ad, .ad img { display: block; width: 100%; height: 100%; }
.ad img { object-fit: contain; }
.ad--in { animation: ad-in 0.5s ease; }
@keyframes ad-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ad--in { animation: none; } }
.ad-slot__label {
  position: absolute; top: 0; left: 0; padding: 1px 5px; pointer-events: none;
  font-size: 10px; letter-spacing: 0.05em; color: var(--muted); background: rgb(255 255 255 / 0.85);
}
.ad-slot--banner { width: 100%; max-width: 728px; aspect-ratio: 728 / 90; margin: 18px auto 0; }
.ad-slot--phone-banner { width: 320px; max-width: 100%; aspect-ratio: 320 / 100; margin: 14px auto 0; }
.ad-slot--side { display: none; }
.ad-banner--phone { display: none; }
@media (max-width: 720px) {
  .ad-banner--wide { display: none; }
  .ad-banner--phone { display: block; }
}
@media (min-width: 1280px) {
  .with-ads--side { display: grid; grid-template-columns: 120px minmax(0, 1fr) 120px; padding-inline: 16px; }
  .with-ads--side > main { grid-column: 2; --gutter: 24px; }
  .with-ads--side > .ad-slot--side { display: block; position: sticky; top: 80px; align-self: start; width: 120px; height: 600px; margin-top: 26px; }
  .ad-banner--beside-side { display: none; }
}
/* Between phone and wide screen the banner pins under the bar instead of
   scrolling away (owner, 2026-10-30). nav.js keeps --nav-height current;
   the fallback is the bar's usual height. Phones keep the docked ad below. */
@media (min-width: 721px) and (max-width: 1279px) {
  .ad-banner--wide {
    position: sticky; top: var(--nav-height, 50px); z-index: 45;
    padding-block: 10px; background: var(--newsprint); border-bottom: 1px solid var(--hairline);
  }
  .ad-banner--wide .ad-slot--banner { margin-top: 0; }
}
/* Phones: a 320×50 ad docked at the bottom of the screen; ads.js shows it
   once the phone banner (or, without one, the masthead) has scrolled away.
   The page gets room under the footer so the dock never hides its last line. */
.ad-dock { display: none; }
@media (max-width: 720px) {
  body:has(.ad-dock) { padding-bottom: 66px; }
  .ad-dock {
    display: flex; justify-content: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    background: var(--newsprint); border-top: 1px solid var(--hairline);
    box-shadow: 0 -6px 14px -10px rgb(0 0 0 / 0.45);
    transform: translateY(100%); visibility: hidden;
    transition: transform 0.2s ease-out, visibility 0.2s;
  }
  .ad-dock--shown { transform: none; visibility: visible; }
  .ad-slot--dock { width: 320px; height: 50px; }
  .ad-dock__close {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; padding: 0; cursor: pointer;
    background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); border-radius: 50%;
    font: inherit; font-size: 20px; line-height: 1;
  }
}
@media (prefers-reduced-motion: reduce) { .ad-dock { transition: none; } }

.page { display: grid; grid-template-columns: minmax(0, 1fr) 328px; gap: 44px; padding-block: 26px; }
.page__rail { padding-left: 26px; border-left: 1px solid var(--hairline); }

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack--tight { gap: 12px; }

/* ---------------------------------------------------------------- type */

.kicker { font-size: 13px; font-weight: 700; color: var(--red); letter-spacing: 0.08em; text-transform: uppercase; }
.kicker--sm { font-size: 11px; letter-spacing: 0.06em; }

.lead__title { margin: 0; font-size: 44px; line-height: 1.22; font-weight: 800; letter-spacing: -0.025em; text-wrap: pretty; }
.article__title { margin: 0; font-size: 46px; line-height: 1.24; font-weight: 800; letter-spacing: -0.025em; text-wrap: pretty; max-width: 740px; }
.standfirst { margin: 0; font-size: 21px; line-height: 1.62; color: var(--ink-soft); max-width: var(--measure); font-weight: 400; }
.standfirst--sm { font-size: 19px; }

.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.byline__name { color: var(--red); font-weight: 700; }

.caption { font-size: 13px; color: var(--muted); font-style: italic; }

.section-head {
  margin: 0; font-size: 16px; font-weight: 700;
  padding-bottom: 8px; border-bottom: 2px solid var(--ink);
}
.section-head--red { border-bottom-color: var(--red); }

.prose { font-size: 19px; line-height: 1.9; color: var(--ink-soft); max-width: var(--measure); }
.prose p { margin: 0 0 20px; }
.prose p:last-child { margin-bottom: 0; }
.prose img { margin-block: 22px; height: auto; }
.prose figure { margin: 22px 0; }
.prose figcaption { font-size: 13px; color: var(--muted); font-style: italic; margin-top: 6px; }
.prose a { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.prose h2, .prose h3 { font-weight: 700; line-height: 1.35; margin: 30px 0 12px; color: var(--ink); }
.prose h2 { font-size: 26px; }
.prose h3 { font-size: 22px; }
.prose blockquote { margin: 24px 0; padding: 20px 24px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); font-size: 23px; line-height: 1.5; font-weight: 700; color: var(--ink); }
.prose iframe { max-width: 100%; aspect-ratio: 16 / 9; height: auto; width: 100%; border: 0; }

.pullquote { max-width: var(--measure); padding: 22px 26px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.pullquote p { margin: 0; font-size: 25px; line-height: 1.5; font-weight: 700; }

/* ---------------------------------------------------------------- cards */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; }
/* The infinite feed tiles across the whole width — the front-page rails end
   long before it does, and a narrow column in a wide viewport looks broken. */
.cards--dense { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 26px 24px; }
.feed-section { padding-top: 30px; border-top: 3px double var(--ink); margin-top: 8px; }
.feed-section__head { margin-bottom: 20px; }
.card { display: flex; flex-direction: column; gap: 10px; }
.card__img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--hairline-soft); }
.card__title { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 700; }
.card__dek {
  margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-soft);
  /* Excerpts run to full paragraphs in the archive; without a clamp one long
     one stretches its whole grid row. */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden;
}
.cards--dense .card__title { font-size: 19px; line-height: 1.32; }
.cards--dense .card__dek { -webkit-line-clamp: 2; font-size: 14px; }
/* Align card tops in a row so the grid reads as rows, not a ragged mess. */
.cards--dense .card { align-content: start; }

.brief { display: flex; flex-direction: column; gap: 5px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline-soft); }
.brief:last-child { border-bottom: 0; padding-bottom: 0; }
.brief__title { font-size: 17px; line-height: 1.4; font-weight: 600; }

.ranked { display: flex; gap: 13px; align-items: baseline; padding-bottom: 13px; border-bottom: 1px solid var(--hairline-soft); }
.ranked:last-child { border-bottom: 0; padding-bottom: 0; }
.ranked__n { font-size: 22px; font-weight: 800; color: var(--hairline); flex-shrink: 0; }
.ranked__t { font-size: 17px; line-height: 1.42; font-weight: 600; }

.thumb-row { display: flex; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline-soft); }
.thumb-row:last-child { border-bottom: 0; padding-bottom: 0; }
.thumb-row__img { width: 104px; height: 78px; object-fit: cover; flex-shrink: 0; background: var(--hairline-soft); }

/* ---------------------------------------------------------------- bits */

.rule      { height: 1px;  background: var(--hairline); }
.rule--bold{ height: 2px;  background: var(--ink); }

.search { display: flex; gap: 8px; }
.search__input {
  height: 46px; padding: 0 16px; font-family: inherit; font-size: 15px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 3px; color: var(--ink);
  min-width: 0; flex-grow: 1;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px; font-family: inherit; font-size: 15px; font-weight: 600;
  background: var(--ink); color: var(--newsprint); border: 1px solid var(--ink);
  border-radius: 3px; cursor: pointer;
}
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-block: 16px;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.share__label { font-size: 14px; color: var(--muted); font-weight: 600; }

/* Article byline: author on the left, share targets on the right; they stack
   on a narrow screen. */
.byline-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 24px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline);
}
.author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.author__avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--hairline); }
.author__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.author__name { font-weight: 700; font-size: 16px; color: var(--ink); }
.author__meta { font-size: 14px; color: var(--muted); }

.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; color: #fff;
}
.share-btn svg { width: 22px; height: 22px; fill: currentColor; }
.share-btn:hover, .share-btn:focus-visible { color: #fff; filter: brightness(1.1); }
.share-btn--facebook { background: #1877F2; }
.share-btn--whatsapp { background: #25D366; }
.share-btn--x { background: #000; border: 1px solid var(--hairline); }
.share-native {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px 0 18px;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
  background: transparent; border: 1px solid var(--hairline); border-radius: 22px; cursor: pointer;
}
.share-native[hidden] { display: none; }
.share-native svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%;
  background: var(--ink); color: var(--newsprint); }
.share-native:hover { border-color: var(--ink); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-block: 34px; }
.pager__status { font-size: 15px; color: var(--muted); }
.pager[hidden] { display: none; }

/* Infinite scroll. The sentinel is what the observer watches; the status line
   is the only thing a reader sees. */
.feed-sentinel { height: 1px; }
.feed-status {
  padding-block: 26px; text-align: center;
  font-size: 15px; color: var(--muted); min-height: 1em;
}
.feed-status:empty { padding-block: 0; }

.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs__current { color: var(--red); font-weight: 600; }

.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 19px; }

.footer { margin-top: 40px; padding-block: 32px; border-top: 3px double var(--ink); font-size: 15px; color: var(--muted); }
.footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 26px; }
.footer__links { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 1100px) {
  :root { --gutter: 20px; }
  .front { grid-template-columns: minmax(0, 1fr); }
  .front__left, .front__right { border: 0; padding: 24px 0; border-top: 1px solid var(--hairline); }
  .front__main { padding: 24px 0; }
  .page { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .page__rail { padding-left: 0; border-left: 0; border-top: 1px solid var(--hairline); padding-top: 26px; margin-top: 26px; }
}

@media (max-width: 720px) {
  :root { --gutter: 14px; }
  body { font-size: 16px; }
  .masthead { padding-block: 16px 12px; }
  .masthead__tag { font-size: 13px; letter-spacing: 0.1em; }
  .topline { font-size: 11px; }
  .topline__side { display: none; }
  .topline .topline__aqi:not(:empty) { display: block; }
  .nav__list { gap: 18px; font-size: 16px; padding-block: 8px; }
  .nav__home { width: 34px; height: 34px; }
  .nav__bar { gap: 14px; }
  .dd--search + .dd--menu { margin-left: -6px; }
  .nav__burger { width: 40px; height: 40px; }
  .nav__epaper { height: 40px; padding-inline: 8px; font-size: 13px; }
  .nav__epaper + .dd--search { margin-left: -6px; }
  .nav__brand { font-size: 15px; gap: 6px; }
  .nav__brand .logo-art { width: 26px; height: 26px; }

  /* Fixed-width panels blew past a 390px screen. On a phone a dropdown is a
     full-width sheet hanging from the bottom of the nav bar: .dd stops being
     positioned, so the panel's containing block is .nav (sticky) itself. That
     keeps it under the bar whether or not the bar has pinned yet — anchoring
     to the viewport covered the bar, and the button that closes the sheet,
     at the top of the page — and escapes the nav list's overflow clip. */
  .dd { position: static; }
  .dd__panel,
  .dd__panel--right,
  .dd__panel--menu {
    top: 100%; left: 0; right: 0;
    min-width: 0; width: 100%;
    /* All the screen below the bar; scroll inside without moving the page. */
    max-height: calc(100vh - var(--nav-bottom));
    max-height: calc(100dvh - var(--nav-bottom));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 18px var(--gutter);
    border-left: 0; border-right: 0;
  }
  .dd__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; }
  .dd__grid > a { padding: 10px 0; }
  .lead__title { font-size: 25px; line-height: 1.32; letter-spacing: -0.02em; }
  .article__title { font-size: 27px; line-height: 1.3; letter-spacing: -0.02em; }
  .standfirst { font-size: 17px; }
  .prose { font-size: 17px; line-height: 1.85; }
  .card__title { font-size: 19px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

/* Ghost's download cards, as imported on the E-Papers page. Without these
   the card's icon fills the column (700px per card). */
.kg-file-card { margin: 0 0 14px; }
.kg-file-card-container {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; min-height: 44px;
  border: 1px solid var(--hairline); border-radius: 4px; background: var(--surface); color: var(--ink);
}
.kg-file-card-container:hover { border-color: var(--red); color: var(--ink); }
.kg-file-card-contents { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kg-file-card-title { font-weight: 700; line-height: 1.4; }
.kg-file-card-caption:empty { display: none; }
.kg-file-card-metadata { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; color: var(--muted); }
.kg-file-card-filename { overflow-wrap: anywhere; }
.kg-file-card-icon { flex: none; width: 36px; height: 36px; color: var(--red); }
.kg-file-card-icon svg { width: 100%; height: 100%; }

/* Embedded widgets on static pages (the stock-market chart is 800px wide
   with autosize off) must not push the page sideways on a phone. */
/* TradingView adds its own wrapper with an inline 800px width between the
   container and the iframe, hence every div inside the container. */
.static-page iframe, .static-page .tradingview-widget-container,
.static-page .tradingview-widget-container div { max-width: 100%; }
