/* Original reader visual system, retained as one stylesheet for migration parity. */
/* This file exceeds 5 KB because shared responsive rules are reviewed together. */
:root {
  color-scheme: light;
  --paper: #f7f5f1;
  --surface: #fffefa;
  --ink: #171716;
  --body: #333430;
  --muted: #71726e;
  --line: #d3d0c9;
  --link: #1457b8;
  --link-hover: #073b82;
  --serif: "Newsreader", Georgia, serif;
  --sans: "IBM Plex Sans", sans-serif;
  --mono: "DM Mono", monospace;
  --body-size: 18px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #181917;
  --surface: #20211f;
  --ink: #f0ede7;
  --body: #d3d1cb;
  --muted: #969791;
  --line: #3a3b37;
  --link: #8fb7ed;
  --link-hover: #bad5f7;
}
[data-text-size="compact"] { --body-size: 16px; }
[data-text-size="large"] { --body-size: 20px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 48% -18%, color-mix(in srgb, var(--surface) 84%, transparent), transparent 45%), var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.reading-progress { position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: 2px; }
.reading-progress span { display: block; height: 100%; width: 0; background: var(--link); transition: width .1s linear; }

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  height: 86px;
  display: grid;
  grid-template-columns: 360px minmax(180px, 1fr) auto;
  align-items: center;
  padding: 0 38px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(18px);
}
.brand { color: var(--ink); text-decoration: none; font: 400 24px/1 var(--serif); letter-spacing: -.01em; }
.issue-picker {
  justify-self: start;
  min-width: 184px;
  height: 46px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
}
.issue-picker:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.issue-picker svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; transition: transform .2s; }
.issue-picker[aria-expanded="true"] svg { transform: rotate(180deg); }

.top-actions { height: 100%; display: flex; align-items: center; }
.language-picker { height: 44px; max-width: 100px; padding: 0 8px; border: 0; border-radius: 4px; color: var(--ink); background: var(--paper); font: inherit; font-size: 14px; cursor: pointer; }
.language-picker:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.language-picker:disabled { cursor: progress; opacity: .6; }
html:lang(zh-CN) .article-body { line-height: 1.85; }
html:lang(zh-CN) .article h1 { line-height: 1.18; }
.utility-button {
  height: 46px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.utility-button:first-child { border-left: 0; }
.utility-button:hover { color: var(--link); }
.utility-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.35; }
.utility-button b { font-weight: 500; }
.utility-button.saved { color: var(--link); }
.utility-button.saved svg { fill: currentColor; }
.icon-only { width: 45px; padding: 0; justify-content: center; }

.issue-rail {
  position: fixed;
  z-index: 60;
  top: 74px;
  left: 365px;
  width: 360px;
  max-height: min(560px, calc(100vh - 110px));
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 22px 70px rgba(20, 20, 18, .15);
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: .18s ease;
}
.issue-rail.open { opacity: 1; visibility: visible; transform: translateY(0); }
.rail-heading { padding: 12px 12px 14px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font: 500 10px/1 var(--mono); letter-spacing: .12em; }
.rail-close { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.issue-list { display: grid; }
.issue-item { position: relative; padding: 15px 42px 15px 14px; display: grid; grid-template-columns: 90px 1fr; gap: 6px 14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.issue-item:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.issue-item.active::after { content: "✓"; position: absolute; right: 16px; top: 20px; color: var(--link); }
.issue-item > span { grid-row: 1 / span 2; color: var(--link); font: 500 12px/1.3 var(--mono); }
.issue-item strong { font: 500 15px/1.25 var(--serif); }
.issue-item small { color: var(--muted); font-size: 11px; }

.app-shell { min-height: 100vh; padding-top: 86px; }
.reader { min-width: 0; padding: 50px 40px 150px; outline: none; }
.reader-loading { padding-top: 22vh; text-align: center; color: var(--muted); font: 11px/1.5 var(--mono); }

.article { width: min(1240px, 100%); margin: 0 auto; animation: article-in .55s cubic-bezier(.22,.8,.26,1) both; }
@keyframes article-in { from { opacity: 0; transform: translateY(12px); } }
.article-header { width: min(820px, calc(100% - 340px)); padding: 0 0 38px; }
.article-date { margin-bottom: 18px; color: var(--muted); font: 500 11px/1 var(--mono); letter-spacing: .12em; }
.article h1 { margin: 0; font: 400 clamp(56px, 6.1vw, 88px)/.98 var(--serif); letter-spacing: -.045em; text-wrap: balance; }
.article-deck { margin: 26px 0 0; color: var(--body); font: 400 clamp(21px, 2vw, 27px)/1.43 var(--sans); letter-spacing: -.015em; text-wrap: pretty; }

.article-layout { display: grid; grid-template-columns: minmax(0, 790px) minmax(250px, 1fr); gap: clamp(55px, 8vw, 120px); align-items: start; }
.article-body { min-width: 0; padding-top: 2px; color: var(--body); font: 400 var(--body-size)/1.62 var(--sans); }
.article-body p { margin: 0 0 22px; }
.article-body h2 { scroll-margin-top: 115px; margin: 54px 0 15px; color: var(--ink); font: 400 35px/1.12 var(--serif); letter-spacing: -.025em; }
.article-body h3 { scroll-margin-top: 115px; margin: 40px 0 13px; color: var(--ink); font: 500 20px/1.25 var(--serif); }
.article-body strong { color: var(--ink); font-weight: 600; }
.article-body em { font-family: var(--serif); font-size: 1.06em; }
.article-body code { padding: .12em .38em; border: 1px solid var(--line); border-radius: 3px; background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink); font: .84em var(--mono); }
.article-body .inline-link { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-body .inline-link:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
.footnote-ref { margin-left: 2px; color: var(--link); text-decoration: none; font: 500 10px/1 var(--mono); }
.article-body ul, .article-body ol { margin: 18px 0 28px; padding-left: 25px; }
.article-body li { margin: 7px 0; padding-left: 3px; }
.article-body li::marker { color: var(--link); }
.article-body blockquote { margin: 38px 0; padding: 6px 0 6px 27px; border-left: 1px solid var(--muted); color: var(--ink); font: 400 24px/1.42 var(--serif); }
.article-body blockquote p { margin: 0; }
.article-body hr { margin: 54px 0 24px; border: 0; border-top: 1px solid var(--line); }
.article-body hr + p { color: var(--muted); font-size: .78em; line-height: 1.6; }

.eyebrow { color: var(--muted); font: 500 9px/1 var(--mono); letter-spacing: .13em; }
.source-notes { position: sticky; top: 126px; padding-top: 245px; display: grid; }
.source-notes > .eyebrow { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.source-note { padding: 13px 0; display: grid; grid-template-columns: 24px 1fr; gap: 8px; border-bottom: 1px solid var(--line); color: var(--body); text-decoration: none; font-size: 12px; line-height: 1.4; }
.source-note:hover strong { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.source-note > span:first-child { color: var(--muted); font: 10px/1.4 var(--mono); }
.source-note > span:last-child { display: grid; gap: 5px; }
.source-note strong { color: var(--body); font-weight: 400; }
.source-note small { color: var(--link); font-size: 10px; }

.reading-dock {
  position: fixed;
  z-index: 40;
  top: 148px;
  right: max(38px, calc((100vw - 1240px) / 2));
  width: 328px;
  height: 90px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 12px 35px rgba(20, 20, 18, .1);
  backdrop-filter: blur(16px);
}
.reading-dock button { display: grid; place-content: center; justify-items: center; gap: 9px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; }
.reading-dock button:first-child { border-left: 0; }
.reading-dock button:hover { color: var(--link); background: color-mix(in srgb, var(--link) 5%, transparent); }
.reading-dock svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(18, 18, 16, .46); backdrop-filter: blur(4px); }
.search-dialog { width: min(700px, calc(100% - 32px)); max-height: min(650px, calc(100vh - 64px)); padding: 0; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.24); }
.search-box { display: grid; grid-template-columns: 24px 1fr auto; gap: 14px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.search-box svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.search-box input { border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search-box kbd { padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font: 9px/1 var(--mono); }
.search-results { overflow-y: auto; max-height: 520px; padding: 10px; }
.search-result { display: block; padding: 18px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.search-result:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.search-result span { color: var(--link); font: 9px/1 var(--mono); letter-spacing: .06em; }
.search-result strong { display: block; margin: 8px 0 5px; font: 400 25px/1.1 var(--serif); }
.search-result p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty-search { padding: 44px 20px; text-align: center; color: var(--muted); font: 12px/1.5 var(--mono); }

.sources-dialog { width: min(620px, calc(100% - 30px)); max-height: min(720px, calc(100vh - 40px)); padding: 0; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.24); }
.sources-dialog header { position: sticky; top: 0; padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: var(--surface); }
.sources-dialog header > div { display: grid; gap: 8px; }
.sources-dialog header strong { font: 400 27px/1 var(--serif); }
.sources-dialog header button { border: 0; background: transparent; color: var(--ink); font-size: 26px; cursor: pointer; }
.sources-dialog-list { padding: 8px 24px 28px; }
.dialog-source { padding: 17px 2px; font-size: 14px; }

.email-dialog { width: min(920px, calc(100% - 28px)); height: calc(100vh - 28px); padding: 0; border: 0; background: #d7d7d4; }
.email-toolbar { position: sticky; top: 0; z-index: 2; min-height: 74px; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; color: #181916; background: #f7f5f1; border-bottom: 1px solid #c8c3b8; }
.email-toolbar > div:first-child { display: grid; gap: 7px; }
.email-toolbar strong { font: 500 13px/1.2 var(--sans); }
.email-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.email-toolbar button { padding: 9px 13px; border: 1px solid #aaa69d; background: transparent; color: #181916; cursor: pointer; }
#closeEmail { font-size: 20px; border: 0; }
.email-canvas { padding: 36px 16px 70px; overflow: auto; }
#emailContent { width: min(680px, 100%); margin: auto; background: #fff; box-shadow: 0 15px 50px rgba(0,0,0,.12); }

.toast { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translate(-50%, 16px); padding: 11px 16px; background: var(--ink); color: var(--paper); font-size: 11px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 300px 1fr auto; padding: 0 24px; }
  .article-header { width: min(760px, calc(100% - 260px)); }
  .article-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 55px; }
  .reading-dock { right: 24px; width: 250px; }
  .source-notes { padding-top: 205px; }
  .utility-button { padding: 0 13px; }
}

@media (max-width: 1000px) {
  .topbar { height: 116px; grid-template-columns: 1fr auto; align-items: start; padding: 0 17px; }
  .brand { font-size: 20px; }
  .brand, .top-actions { height: 70px; display: flex; align-items: center; }
  .issue-picker { position: absolute; inset: auto 0 0; width: auto; height: 46px; padding: 0 18px; border-left: 0; border-top: 1px solid var(--line); background: var(--paper); }
  .top-actions { grid-column: 2; }
  .utility-button { width: 42px; padding: 0; justify-content: center; border-left: 0; }
  .utility-button span { display: none; }
  .icon-only { display: flex; }
  .issue-rail { top: 116px; left: 0; width: 100%; max-height: calc(100vh - 116px); border-width: 0 0 1px; }
  .app-shell { padding-top: 116px; }
  .reader { padding: 42px 20px 125px; }
  .article-header { width: 100%; padding-bottom: 35px; }
  .article h1 { font-size: clamp(50px, 14vw, 70px); }
  .article-deck { font-size: 21px; }
  .article-layout { display: block; }
  .article-body { font-size: var(--body-size); line-height: 1.68; }
  .article-body h2 { font-size: 32px; }
  .source-notes { position: static; padding-top: 58px; }
  .reading-dock { top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; height: 64px; border-radius: 10px; }
  .reading-dock button { display: flex; gap: 8px; font-size: 11px; }
  .reading-dock svg { width: 19px; }
  .email-toolbar strong { display: none; }
}

@media (max-width: 600px) {
  .topbar { height: 152px; grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px 54px; align-content: start; }
  .brand { height: 52px; }
  .top-actions { grid-column: 1; height: 54px; width: 100%; justify-content: flex-end; }
  .language-picker { margin-right: auto; }
  .issue-rail { top: 152px; max-height: calc(100vh - 152px); }
  .app-shell { padding-top: 152px; }
}

@media (max-width: 430px) {
  .brand { font-size: 18px; }
  .article-date { margin-bottom: 14px; }
  .article h1 { font-size: 48px; }
  .article-deck { font-size: 19px; }
  .article-body blockquote { padding-left: 20px; font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Historical attribution is editorial framing, separate from unchanged source content. */
.editor-credit { font: 14px/1.6 "IBM Plex Sans", sans-serif; color: var(--muted, #69665e); margin: 20px 0 0; }
.editor-credit a { color: inherit; text-underline-offset: 3px; }
.article-body { overflow-wrap: anywhere; }
.article-body img { max-width: 100%; height: auto; }

/* Language requests share the reader palette and native modal focus behavior. */
.language-picker { max-inline-size: 180px; }
.language-dialog { inline-size: min(480px, calc(100vw - 32px)); max-block-size: calc(100dvh - 32px); overflow: auto; padding: 24px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.language-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.language-dialog header { display: flex; align-items: start; gap: 16px; justify-content: space-between; }
.language-dialog h2 { font-size: 22px; margin: 0; }
.language-dialog p { line-height: 1.6; overflow-wrap: anywhere; }
.language-dialog button, .language-request-actions a { min-block-size: 44px; padding: 10px; }
.language-request-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.language-request-actions a { color: var(--link); }
.language-dialog :focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Searchable language cards echo the reader typography and paper palette. */
.language-picker { display: inline-flex; align-items: center; gap: 7px; max-width: none; white-space: nowrap; }
.language-picker svg, .language-filter svg { inline-size: 18px; block-size: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; flex-shrink: 0; }
.language-picker-dialog { inline-size: min(760px, calc(100vw - 40px)); max-block-size: min(760px, calc(100dvh - 48px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.language-picker-dialog[open] { display: flex; flex-direction: column; }
.language-picker-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 8px; gap: 16px; flex-shrink: 0; }
.language-picker-dialog h2 { margin: 0; font: 500 26px/1.2 var(--serif); }
.language-picker-dialog header button { inline-size: 44px; block-size: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 26px; cursor: pointer; }
.language-filter { display: flex; align-items: center; gap: 12px; margin-inline: 24px; border-block-end: 1px solid var(--line); flex-shrink: 0; }
.language-filter:focus-within { border-color: var(--link); }
.language-filter input { min-inline-size: 0; inline-size: 100%; padding-block: 16px; border: 0; outline: none; color: var(--ink); background: transparent; font: inherit; font-size: 16px; }
.language-options { padding: 12px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
.language-options h3 { margin: 18px 0 12px; font: 500 13px/1.4 var(--sans); color: var(--body); }
.language-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.language-grid button { position: relative; display: flex; flex-direction: column; gap: 6px; min-block-size: 76px; padding: 13px 12px; padding-inline-end: 28px; text-align: start; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; font: 400 15px/1.3 var(--sans); }
.language-grid button:hover { background: var(--paper); }
.language-grid button[aria-pressed="true"] { border-color: var(--ink); background: var(--paper); }
.language-grid button > span:not(.language-current) { font-size: 12px; color: var(--body); overflow-wrap: anywhere; }
.language-current { position: absolute; inset-inline-end: 10px; inset-block-start: 14px; }
.language-picker-dialog button:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
#languageFilterEmpty { padding: 24px; margin: 0; color: var(--body); }
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 600px) {
  .language-picker-dialog { inline-size: 100%; max-inline-size: 100%; max-block-size: 85dvh; margin: auto 0 0; border-end-start-radius: 0; border-end-end-radius: 0; }
  .language-picker-dialog header { padding-inline: 20px; }
  .language-filter { margin-inline: 20px; }
  .language-options { padding-inline: 20px; padding-block-end: max(20px, env(safe-area-inset-bottom)); }
  .language-grid { grid-template-columns: 1fr; gap: 4px; }
  .language-grid button { min-block-size: 68px; }
}

.language-grid bdi { align-self: flex-start; }
