/* dashboard.css — layout owned by code, not by the agent.
   Palette: paper #FBFAF7 / ink #16130F / rule #D8D3C9 / muted #5C564D / red #A8231B */

:root {
  --paper: #FBFAF7;
  --paper-tint: #F2EFE7;
  --ink: #16130F;
  --ink-2: #3A342C;
  --muted: #5C564D;
  --faint: #8B8479;
  --rule: #D8D3C9;
  --rule-light: #E7E3DA;
  --red: #A8231B;
  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --sans: 'Libre Franklin', system-ui, sans-serif;
  --hk: 'Noto Serif HK', var(--serif);

  /* Everything below used to be hardcoded further down the file. Tokenised so
     the dark block is a palette swap and not a second copy of the layout. */
  --desk: #EFECE4;        /* the surface the sheet sits on */
  --edge: #E2DDD3;        /* the sheet's hairline edge */
  --field: #fff;          /* form controls */
  --strike: #B9B2A6;      /* line-through on read stories */
  --ok: #2E6B3E;
  --photo-filter: none;
  color-scheme: light;
}

/* Three states, in the order they must appear:
   1. no data-theme  -> follow the system (the default)
   2. data-theme=dark -> forced dark, even on a light system
   3. data-theme=light -> forced light, which is why the media query below is
      guarded with :not([data-theme="light"]) -- otherwise a system-dark machine
      would ignore the user picking Light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #191712;
    --paper-tint: #211E18;
    --ink: #EDE9E0;
    --ink-2: #C9C3B6;
    --muted: #9A9285;
    --faint: #776F63;
    --rule: #38342C;
    --rule-light: #2A2721;
    --red: #E2685E;
    --desk: #0E0D0A;
    --edge: #2A2721;
    --field: #201D18;
    --strike: #6A6255;
    --ok: #5FA97A;
    /* Press photos are exposed for white paper; at full brightness they glare
       against a dark sheet. */
    --photo-filter: brightness(.9) contrast(1.02);
    /* Makes the date input's native calendar glyph light instead of near-black. */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #191712;
    --paper-tint: #211E18;
    --ink: #EDE9E0;
    --ink-2: #C9C3B6;
    --muted: #9A9285;
    --faint: #776F63;
    --rule: #38342C;
    --rule-light: #2A2721;
    --red: #E2685E;
    --desk: #0E0D0A;
    --edge: #2A2721;
    --field: #201D18;
    --strike: #6A6255;
    --ok: #5FA97A;
    /* Press photos are exposed for white paper; at full brightness they glare
       against a dark sheet. */
    --photo-filter: brightness(.9) contrast(1.02);
    /* Makes the date input's native calendar glyph light instead of near-black. */
    color-scheme: dark;
}

* { box-sizing: border-box; }

/* The UA's [hidden] rule is a bare `display:none` and loses to any class that
   sets display -- .row and .brief are grids, so the category filter set the
   attribute and the card stayed on screen (while the section's empty-state,
   which tests for :not([hidden]), fired at the same time). */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

.paper {
  background: var(--paper);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 40px;
  box-shadow: 0 0 0 1px var(--edge);
}

/* ---------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar-left, .topbar-right { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.topbar .accent { color: var(--red); }
.topbar input, .topbar button {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  background: var(--field);
  color: var(--ink);
  padding: 5px 10px;
  cursor: pointer;
}
.topbar button:last-child { background: var(--ink); color: var(--paper); border-color: var(--ink); }

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

.masthead { text-align: center; padding: 26px 0 14px; }
.masthead h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(40px, 5.3vw, 76px);
  line-height: .95;
  letter-spacing: -.015em;
}
.standfirst {
  margin-top: 12px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------- chips */

.chips {
  border-top: 3px double var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 9px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 11px;
  min-height: 30px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.chip b { font-weight: 500; color: var(--faint); }
.chip--on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip--on b { color: var(--paper); opacity: .65; }

/* ---------------------------------------------------------- bands + columns */

.band {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr) minmax(0, .66fr);
  align-items: start;
}
.band + .band { border-top: 3px double var(--ink); }
.col { min-width: 0; padding: 22px 26px 26px; border-right: 1px solid var(--rule); }
.col:first-child { padding-left: 0; }
.rail { min-width: 0; padding: 22px 0 26px 22px; display: flex; flex-direction: column; gap: 26px; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
  margin-bottom: 16px;
}
.sec-head h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.sec-meta {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------------------------------------------------------- story parts */

.kicker {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.kicker--accent { font-size: 10px; color: var(--red); margin-bottom: 7px; }
.star { color: var(--red); }

.photo { width: 100%; background: var(--rule-light); border: 1px solid var(--rule); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: var(--photo-filter); }
.credit {
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 12px;
}

.lead-title {
  margin: 0;
  font-size: clamp(26px, 2.8vw, 40px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -.01em;
  text-wrap: pretty;
}
.col:not(:first-child) .lead-title { font-size: clamp(24px, 2.2vw, 31px); line-height: 1.08; }
.lead--boxed { background: var(--paper-tint); border: 1px solid var(--rule); padding: 18px 18px 20px; }
.lead--boxed .photo { margin-top: 14px; aspect-ratio: 16/9; }
.lead--side { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; }

.zh { font-family: var(--hk); font-size: 17px; line-height: 1.4; color: var(--ink-2); margin-top: 8px; }
.zh--lead { font-size: 19px; margin-top: 9px; }
/* Language swap. Every bilingual string is rendered as an .l-en / .l-zh pair,
   so switching shows one and hides the other -- headline, kicker, chip, section
   head, rail, status bar alike. A string with no translation is emitted bare
   (no pair at all) and therefore survives in both modes: a missing translation
   degrades to English rather than to an empty line. */
.l-zh { display: none; }
body.zh-only .l-en { display: none; }
body.zh-only .l-zh { display: inline; }
/* There is deliberately no Chinese subhead under an English headline any more:
   printing title_zh a second time made every "English" card half-Chinese. The
   headline is the pair, and exactly one language shows at a time. */

.dek {
  margin: 9px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 38em;
  text-wrap: pretty;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.cell h3 { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 700; text-wrap: pretty; }
.cell .photo { aspect-ratio: 4/3; margin-bottom: 8px; }
.cell .dek { font-size: 15px; line-height: 1.45; }

.rows { margin-top: 18px; border-top: 1px solid var(--rule); }
.row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-light);
}
.row-text { flex: 1; min-width: 0; }
.row h3 { margin: 0; font-size: 19px; line-height: 1.2; font-weight: 600; text-wrap: pretty; }
.row .dek { font-size: 14.5px; line-height: 1.45; margin-top: 5px; }
.row .thumb { width: 112px; aspect-ratio: 4/3; flex: none; background: var(--rule-light); border: 1px solid var(--rule); overflow: hidden; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row--read { opacity: .5; }
.row--read h3 { text-decoration: line-through; text-decoration-color: var(--strike); }
.row--read .dek { display: none; }

.brief-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--ink); }
.brief-head {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.briefs--2up { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 22px; }
.brief { padding: 7px 0; border-top: 1px solid var(--rule-light); font-size: 15.5px; line-height: 1.3; }
.brief-src {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------- rail */

.rail-head {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
  margin-bottom: 12px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.rail-head--accent { border-color: var(--red); color: var(--red); }
.rail-note, .cont-meta {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-note { margin-top: 8px; }

.tp-group {
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 8px;
}
.tp-group:first-of-type { margin-top: 0; }
.tp-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule-light); font-size: 15px; line-height: 1.3; }
.tp-score { font-family: var(--sans); font-size: 11px; font-weight: 700; color: var(--red); flex: none; width: 34px; }
.tp-meta { font-family: var(--sans); font-size: 10px; color: var(--muted); }
.tp-note { font-size: 12px; line-height: 1.45; color: var(--muted); font-style: italic; margin: 12px 0 0; }

.cont-row { padding: 9px 0; border-top: 1px solid var(--rule-light); font-size: 15px; line-height: 1.3; }
.cont-meta { display: block; margin-top: 3px; }

.arc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.arc {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-light);
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
}
.arc--now { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 700; }

.mix-row { display: flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 11px; color: var(--ink-2); margin-bottom: 7px; }
.mix-name { width: 78px; flex: none; }
.mix-bar { height: 8px; background: var(--ink-2); }
.mix-n { color: var(--muted); }

/* ---------------------------------------------------------- status + colophon */

.status {
  border-top: 3px double var(--ink);
  margin-top: 6px;
  padding: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: center;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--red); }
.status span:first-child { color: var(--ink); }

.colophon {
  padding: 14px 0 26px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* ---------------------------------------------------------- reflow */

@media (max-width: 1180px) {
  .band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rail { grid-column: 1 / -1; padding: 22px 0 26px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; }
  .briefs--2up { grid-template-columns: minmax(0, 1fr); }
  .lead--side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .paper { padding: 0 18px; }
  .band { grid-template-columns: minmax(0, 1fr); }
  .col { padding: 20px 0 22px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .row .thumb { width: 88px; }
}

/* ---------------------------------------------------------- print */

@media print {
  @page { size: A4; margin: 12mm; }
  /* Restore the light palette: a dark-mode screen must not print white on white. */
  :root {
    --paper: #fff; --paper-tint: #F2EFE7; --ink: #16130F; --ink-2: #3A342C;
    --muted: #5C564D; --faint: #8B8479; --rule: #D8D3C9; --rule-light: #E7E3DA;
    --red: #A8231B; --desk: #fff; --edge: #E2DDD3; --field: #fff;
    --strike: #B9B2A6; --ok: #2E6B3E; --photo-filter: none;
  }
  body { background: #fff; }
  .paper { max-width: none; padding: 0; box-shadow: none; }
  .topbar-right, .chips, .status { display: none; }
  .band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rail { grid-column: 1 / -1; }
  .col, .lead, .row, .brief-block { break-inside: avoid; }
  .row .thumb, .photo { filter: grayscale(1); }
  a[href^="http"]::after { content: ""; }
}


/* ---------------------------------------------------------- added chrome */

.date-msg {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--red);
}

/* A category chip can hide every card in a section; say so rather than
   leaving the column blank. */
.sec-empty {
  font-family: var(--serif);
  font-style: italic;
  color: var(--faint);
  padding: 26px 0;
  text-align: center;
}
.sec-empty .zh { font-style: normal; display: block; margin-top: 4px; font-size: 14px; }

.topbar button[disabled] { opacity: .55; cursor: progress; }


/* Chinese headlines want a touch more leading than the Latin faces, and the HK
   serif needs to be the family in use once it *is* the headline. */
body.zh-only .lead-title, body.zh-only h3 { font-family: var(--hk); line-height: 1.25; }
body.zh-only .lead-title { letter-spacing: 0; }
