/* 晶讀 — reader site.
   A newspaper, not an app: hierarchy comes from type and rules, never from
   boxes. Serif display (Noto Serif TC) for the flag and headlines, the
   system sans for reading. One accent, newspaper red, used for kickers and
   the "why it matters" rule only. */

:root {
  --paper: #fcfbf8;
  --ink: #141413;
  --ink-2: #4b4944;
  --ink-3: #7a776f;
  --rule: #e3dfd6;
  --rule-strong: #141413;
  --accent: #b3242a;
  --accent-soft: #f7e9e6;
  --ok: #2f6b45;
  --warn: #946200;
  --bad: #a3322a;
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", serif;
  --sans: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 680px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211;
    --ink: #ecebe6;
    --ink-2: #bdbab2;
    --ink-3: #8c8981;
    --rule: #2c2b28;
    --rule-strong: #ecebe6;
    --accent: #ef6f68;
    --accent-soft: #3a1f1d;
    --ok: #8fc8a3;
    --warn: #e2b55a;
    --bad: #f08a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.02em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.25em; text-decoration-color: var(--rule); }
a:hover { text-decoration-color: currentColor; }
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 20px; }
.serif { font-family: var(--serif); }
/* Chinese headlines break at spaces and punctuation, the way an editor would
   break them by hand; a phrase longer than the line still wraps. */
h1, h2, h3, .lede p, .glance li { font-feature-settings: "palt"; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.nw { white-space: nowrap; }
p, li { text-wrap: pretty; }

/* ---------- Mastheads ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; font-size: 13px; color: var(--ink-3); letter-spacing: 0.08em; }
.topbar nav { display: flex; gap: 16px; }
.topbar a { text-decoration: none; }
.topbar a:hover { color: var(--ink); }

.flag { text-align: center; padding: 6px 0 0; }
.wordmark {
  display: block; text-decoration: none; font-family: var(--serif); font-weight: 900;
  font-size: clamp(64px, 22vw, 132px); line-height: 1; letter-spacing: 0.12em; margin-right: -0.12em;
}
.seal {
  display: inline-grid; place-items: center; vertical-align: top; margin: 0.16em 0 0 0.14em;
  width: 1.12em; height: 1.12em; font-family: var(--serif); font-weight: 900; font-size: 0.3em;
  line-height: 1; letter-spacing: 0; background: var(--accent); color: var(--paper); border-radius: 2px;
}
.motto { margin: 12px 0 18px; font-size: 13px; letter-spacing: 0.2em; color: var(--ink-2); }
.motto b { color: var(--accent); font-weight: 700; }
.dateline {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 14px;
  border-top: 2px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong);
  padding: 8px 0; font-size: 13px; color: var(--ink-2); letter-spacing: 0.06em;
}
.dateline .sep { color: var(--rule); }
.disclosure {
  display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700;
  font-size: 12px; letter-spacing: 0.1em; white-space: nowrap;
}
.disclosure::before { content: ""; width: 6px; height: 6px; background: currentColor; transform: rotate(45deg); }

.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 0 12px; border-bottom: 1px solid var(--rule-strong); }
.bar .wordmark { display: inline; font-size: 30px; letter-spacing: 0.1em; margin: 0; }
.bar nav { display: flex; gap: 16px; font-size: 13px; color: var(--ink-3); letter-spacing: 0.08em; }
.bar nav a { text-decoration: none; }

/* ---------- Section filter (focus) ---------- */
.sections {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; padding: 12px 0;
  border-bottom: 1px solid var(--rule); font-size: 14px; letter-spacing: 0.06em; white-space: nowrap;
}
.sections::-webkit-scrollbar { display: none; }
.chip { font: inherit; background: none; border: 0; padding: 2px 0; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }

/* ---------- Lede + glance ---------- */
.lede { margin-top: 30px; margin-bottom: 8px; text-align: center; max-width: 760px; }
.lede-label { display: block; font-size: 12px; letter-spacing: 0.4em; color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.lede p { margin: 0; font-family: var(--serif); font-size: 21px; line-height: 1.7; font-weight: 600; }

.glance { margin: 28px 0 8px; border-top: 1px solid var(--rule-strong); }
.glance h2, .section-head { font-size: 12px; letter-spacing: 0.4em; color: var(--ink); margin: 12px 0 6px; font-weight: 700; }
.glance ol { list-style: none; margin: 0; padding: 0; counter-reset: g; }
.glance li { counter-increment: g; display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 16px; line-height: 1.6; }
.glance li::before { content: counter(g); font-family: var(--serif); font-weight: 900; color: var(--accent); font-size: 18px; line-height: 1.4; }
.glance a { text-decoration: none; }
.glance a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.glance .cat { display: block; font-size: 11px; letter-spacing: 0.2em; color: var(--ink-3); }

/* ---------- Stories ---------- */
.stories { list-style: none; margin: 0; padding: 0; }
.story { padding: 34px 0 26px; border-top: 1px solid var(--rule); }
.story:first-child { border-top: 0; }
.story[hidden] { display: none; }
.kicker { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; font-size: 12px; letter-spacing: 0.24em; color: var(--accent); font-weight: 700; }
.kicker .num { font-family: var(--serif); font-size: 15px; letter-spacing: 0; }
.story h2 { font-family: var(--serif); font-weight: 700; font-size: 25px; line-height: 1.42; margin: 0 0 14px; }
.story h2 a { text-decoration: none; }
.story h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }
.story.lead h2 { font-size: 30px; line-height: 1.38; font-weight: 900; }
.story.lead .points { font-size: 17.5px; }
.dek { color: var(--ink-2); margin: -4px 0 14px; }

.points { list-style: none; margin: 0 0 18px; padding: 0; }
.points li { position: relative; padding-left: 20px; margin: 0 0 8px; }
.points li::before { content: ""; position: absolute; left: 2px; top: 0.78em; width: 6px; height: 6px; background: var(--ink); }
sup.ref { font-size: 10.5px; line-height: 0; margin-left: 2px; letter-spacing: 0; color: var(--ink-3); }
sup.ref a { text-decoration: none; font-family: var(--mono); }
sup.ref a:hover { color: var(--accent); }

.why { margin: 0 0 18px; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); font-size: 16px; color: var(--ink); }
.why b { display: block; font-size: 12px; letter-spacing: 0.3em; color: var(--accent); margin-bottom: 2px; }

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--ink-3); letter-spacing: 0.04em; }
.meta-row .sources a { text-decoration: none; }
.meta-row .sources a:not(:last-child)::after { content: "・"; color: var(--rule); }
.badge { font-weight: 700; letter-spacing: 0.06em; }
.badge.high { color: var(--ok); }
.badge.medium { color: var(--warn); }
.badge.low { color: var(--bad); }
.more { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: 0.06em; }
.more:hover { color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.actions .tools { display: flex; gap: 4px; }
.btn {
  font: inherit; font-size: 13px; letter-spacing: 0.06em; color: var(--ink-3); background: none;
  border: 0; padding: 4px 8px; border-radius: 4px; cursor: pointer;
}
.btn:hover { color: var(--ink); background: var(--accent-soft); }
.btn[aria-pressed="true"] { color: var(--accent); font-weight: 700; }

/* ---------- Panels: subscribe + survey ---------- */
.panel { margin: 40px 0; padding: 26px 0 0; border-top: 2px solid var(--rule-strong); }
.panel h3 { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; }
.panel p { margin: 0 0 14px; color: var(--ink-2); font-size: 15.5px; }
.subscribe { display: flex; gap: 10px; flex-wrap: wrap; }
.subscribe input[type="email"], .subscribe input[type="search"] {
  flex: 1 1 220px; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 2px;
  border: 1px solid var(--ink-3); background: var(--paper); color: var(--ink);
}
.primary {
  font: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.1em; color: var(--paper);
  background: var(--ink); border: 0; border-radius: 2px; padding: 11px 22px; cursor: pointer;
}
.primary:hover { background: var(--accent); }
.note { font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.survey fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.survey label { display: block; padding: 4px 0; font-size: 15.5px; }
.survey select, .survey textarea {
  font: inherit; font-size: 15px; padding: 8px; border-radius: 2px; border: 1px solid var(--ink-3);
  background: var(--paper); color: var(--ink); margin: 2px 0 12px;
}
.survey textarea { width: 100%; min-height: 70px; }

/* ---------- Article page ---------- */
.article { padding: 30px 0 8px; }
.article .kicker { margin-bottom: 12px; }
.article h1 { font-family: var(--serif); font-weight: 900; font-size: 30px; line-height: 1.4; margin: 0 0 16px; }
.standfirst { font-family: var(--serif); font-size: 19px; line-height: 1.75; color: var(--ink-2); margin: 0 0 20px; font-weight: 600; }
.byline { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); letter-spacing: 0.04em; margin-bottom: 26px; }
.byline .who { color: var(--ink); font-weight: 700; }
.article .section-head { margin: 34px 0 12px; padding-top: 12px; border-top: 1px solid var(--rule-strong); }
.keypoints .points { font-size: 17.5px; }
.article .why { font-size: 17px; margin: 24px 0; padding: 4px 0 4px 18px; }
.body p { margin: 0 0 1.15em; font-size: 18px; line-height: 1.95; }
.terms { display: grid; gap: 12px; }
.term { font-size: 15.5px; }
.term b { font-family: var(--mono); font-weight: 600; margin-right: 8px; }
.endnotes { margin: 0; padding: 0; list-style: none; counter-reset: n; font-size: 15px; }
.endnotes li { counter-increment: n; display: grid; grid-template-columns: 28px 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.endnotes li::before { content: counter(n); font-family: var(--mono); color: var(--accent); font-weight: 700; }
.endnotes li:target { background: var(--accent-soft); }
.endnotes .pub { font-weight: 700; }
.endnotes .when { display: block; color: var(--ink-3); font-size: 13px; }
.chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; font-size: 13.5px; }
.chain li { padding: 10px 12px 10px 0; border-top: 3px solid var(--rule); color: var(--ink-2); }
.chain li:last-child { border-top-color: var(--accent); }
.chain .t { display: block; font-family: var(--mono); color: var(--ink); font-size: 13px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 40px 0; padding-top: 16px; border-top: 2px solid var(--rule-strong); font-family: var(--serif); font-weight: 700; font-size: 16px; line-height: 1.5; }
.pager a { text-decoration: none; }
.pager .dir { display: block; font-family: var(--sans); font-weight: 400; font-size: 12px; letter-spacing: 0.2em; color: var(--ink-3); margin-bottom: 4px; }

/* ---------- Prose pages ---------- */
.prose { padding: 26px 0; }
.prose h1 { font-family: var(--serif); font-size: 30px; font-weight: 900; margin: 0 0 12px; }
.prose h2 { font-family: var(--serif); font-size: 20px; margin: 30px 0 6px; }
.prose p, .prose li { color: var(--ink-2); }
.archive { list-style: none; padding: 0; margin: 0; }
.archive li { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.archive a { font-family: var(--serif); font-weight: 700; text-decoration: none; }
.archive .d { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }

footer.site { margin-top: 56px; padding: 26px 0 48px; border-top: 2px solid var(--rule-strong); font-size: 13px; color: var(--ink-3); }
footer.site .wordmark { display: inline; font-size: 26px; letter-spacing: 0.1em; color: var(--ink); }
footer.site nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0; }
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--ink); }

.preview-banner { background: var(--accent); color: #fff; text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; padding: 6px; }

/* ---------- Wide screens: sticky contents rail ---------- */
@media (min-width: 720px) {
  body { font-size: 18px; }
  .story h2 { font-size: 28px; }
  .story.lead h2 { font-size: 38px; }
  .lede p { font-size: 24px; }
  .article h1 { font-size: 42px; }
  .standfirst { font-size: 21px; }
}
@media (min-width: 1120px) {
  .wrap.wide { max-width: calc(250px + 56px + var(--measure) + 40px); }
  .edition-grid { display: grid; grid-template-columns: 250px minmax(0, var(--measure)); gap: 56px; max-width: calc(250px + 56px + var(--measure)); margin: 0 auto; padding: 0 20px; }
  .edition-grid > .wrap { padding: 0; max-width: none; }
  .edition-grid .glance { position: sticky; top: 20px; align-self: start; margin-top: 30px; max-height: calc(100vh - 40px); overflow: auto; }
  .edition-grid .glance li { font-size: 14.5px; }
}
@media (max-width: 1119px) {
  .glance .cat { display: none; }
  .edition-grid { display: flex; flex-direction: column; }
  .edition-grid .glance { order: 0; }
  .edition-grid .glance-wrap { max-width: var(--measure); width: 100%; margin: 0 auto; padding: 0 20px; }
}
@media print {
  .actions, .sections, .panel, .topbar nav, footer.site nav { display: none; }
  .story { break-inside: avoid; }
}

/* ---------- Reading experience: in-place sources, progress, completion ---------- */
.sources-data { display: none; }
.ref-pop {
  position: absolute; z-index: 20; max-width: min(360px, calc(100vw - 32px)); padding: 14px 16px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink); border-radius: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); font-size: 14px; line-height: 1.6; letter-spacing: 0.02em;
}
.ref-pop .n { font-family: var(--mono); color: var(--accent); font-weight: 700; margin-right: 6px; }
.ref-pop .pub { font-weight: 700; }
.ref-pop .title { display: block; margin: 4px 0 6px; font-family: var(--serif); font-size: 15.5px; font-weight: 600; }
.ref-pop .when { display: block; color: var(--ink-3); font-size: 12.5px; }
.ref-pop a.open { display: inline-block; margin-top: 8px; font-weight: 700; color: var(--accent); text-decoration: none; }
.readbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 30; transition: width 0.2s ease-out; }
.glance h2 .progress { float: right; letter-spacing: 0.04em; color: var(--ink-3); font-weight: 400; }
.glance li.read a { color: var(--ink-3); }
.glance li.read::before { color: var(--ink-3); }
.story .read-mark { display: none; margin-left: auto; font-size: 11px; letter-spacing: 0.2em; color: var(--ink-3); font-weight: 400; }
.story.read .read-mark { display: inline; }
.finish { margin: 10px 0 0; padding: 30px 0 6px; border-top: 2px solid var(--rule-strong); text-align: center; }
.finish h3 { font-family: var(--serif); font-size: 24px; margin: 0 0 6px; }
.finish p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.finish .streak { display: inline-block; margin-top: 14px; font-size: 13px; letter-spacing: 0.12em; color: var(--accent); font-weight: 700; }
.kbd-hint { display: none; font-size: 12px; color: var(--ink-3); letter-spacing: 0.06em; }
@media (min-width: 1120px) and (hover: hover) { .kbd-hint { display: block; margin-top: 12px; } }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--rule); border-radius: 3px; padding: 0 5px; }
