/* Shared styles for the monthly report pages (public/reports/YYYY-MM/).
   Pages are rendered by scripts/reports/build_reports.py. Colours are the
   site's own: warm black, warm white, one accent. */
:root {
  --bg: #1C1C1A;
  --fg: #F5F2EC;
  --fg2: #C8C4BA;
  --muted: #A6A39B;
  --accent: #7FB5A3;
  --line: #3A3A36;
  --head-h: 64px;
}
@media (max-width: 800px) { :root { --head-h: 104px; } }

* { box-sizing: border-box; }
html {
  background: var(--bg);
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--head-h) + 20px);
}
@media (min-width: 1024px) { html { font-size: 18px; } }
@media (min-width: 1680px) { html { font-size: 19px; } }
@media (min-width: 2200px) { html { font-size: 20px; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--bg); padding: 8px 14px; border-radius: 6px;
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 16px; }

/* Site header: same as every other page on the site */
.site-head { position: sticky; top: 0; z-index: 40; background: #1C1C1A; border-bottom: 1px solid #2e2e2a; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 6.6vw; flex-wrap: wrap; line-height: 1.75; font-size: 18px; }
.site-head .brand { font-weight: 700; letter-spacing: -.02em; color: #F5F2EC; text-decoration: none; }
.site-end { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.site-links { display: flex; align-items: center; gap: 28px; margin: 0; font-size: 15px; }
.site-links a { color: #C8C4BA; text-decoration: none; }
.site-links a[aria-current="page"] { color: #F5F2EC; box-shadow: inset 0 -1px 0 #7FB5A3; }
.lang-switch { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .04em; color: #C8C4BA; text-decoration: none; white-space: nowrap; }
.lang-switch .is-current { color: #F5F2EC; font-weight: 700; }
@media (max-width: 800px) {
  .site-end { margin-left: 0; width: 100%; justify-content: space-between; }
  .site-links { gap: 16px; }
}

/* ---------- layout ---------- */
.report-layout {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "toc" "body" "pager" "index";
}
.report-head { grid-area: head; }
.report-toc { grid-area: toc; }
.report-body { grid-area: body; min-width: 0; }
.issue-pager { grid-area: pager; }
.report-index { grid-area: index; }

/* ---------- issue header ---------- */
.report-head { padding-bottom: 1.75rem; border-bottom: 1px solid var(--line); }
.back-row { margin: 0 0 1.75rem; font-size: .9rem; line-height: 1.5; }
.back-link { color: var(--fg2); text-decoration: none; }
.back-link:hover { color: var(--accent); }
.kicker {
  font-family: "Inter", system-ui, sans-serif; font-size: .75rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .75rem;
}
h1 {
  font-size: clamp(1.85rem, 1.1rem + 2.4vw, 2.7rem); line-height: 1.25;
  font-weight: 700; letter-spacing: -.02em; margin: 0 0 1rem; text-wrap: balance;
}
.lede { font-size: 1.12rem; line-height: 1.75; margin: 0 0 1rem; }
.meta { color: var(--muted); font-size: .94rem; line-height: 1.7; margin: 0 0 1rem; }
.report-facts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0 0; }
.report-facts span {
  font-size: .82rem; line-height: 1.5; color: var(--fg2);
  border: 1px solid var(--line); border-radius: 999px; padding: .2rem .75rem;
}

/* ---------- table of contents ---------- */
.report-toc { margin: 1.5rem 0 .5rem; }
.toc-inner { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem .75rem; }
.toc-title { font-size: .8rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; line-height: 1.5; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list a {
  display: flex; gap: .65rem; align-items: baseline;
  padding: .38rem .6rem; margin: 0 -.6rem; border-radius: 6px;
  color: var(--fg2); text-decoration: none; font-size: .88rem; line-height: 1.5;
}
.toc-list a:hover { color: var(--fg); background: rgba(245, 242, 236, .05); }
.toc-list a[aria-current="true"] { color: var(--fg); background: rgba(127, 181, 163, .1); box-shadow: inset 2px 0 0 var(--accent); }
.toc-date { flex: none; color: var(--accent); font-family: "Inter", system-ui, sans-serif; font-variant-numeric: tabular-nums; font-weight: 600; }
.toc-text { min-width: 0; }
.toc-block a { color: var(--muted); }
@media (min-width: 1024px) {
  .toc-list a { margin: 0; }
}

/* ---------- report text ---------- */
.report-body section { padding-top: 2.25rem; }
.report-body section + section { margin-top: 2.25rem; border-top: 1px solid var(--line); }
.report-body h2 { font-size: 1.42rem; line-height: 1.45; letter-spacing: -.01em; font-weight: 700; margin: 0 0 .9rem; text-wrap: balance; }
.s-date { color: var(--accent); font-family: "Inter", system-ui, sans-serif; font-weight: 600; font-variant-numeric: tabular-nums; }
.s-sep { color: var(--muted); }
.session-meta { margin: -.4rem 0 1.1rem; color: var(--muted); font-size: .88rem; line-height: 1.6; font-family: "Inter", "Noto Sans TC", system-ui, sans-serif; }
.report-body h3 { font-size: 1.1rem; line-height: 1.55; font-weight: 700; margin: 1.9rem 0 .45rem; }
.report-body h3:first-of-type { margin-top: 1.25rem; }
.report-body p { margin: 0 0 .95rem; }
.report-body ul { margin: 0 0 1.1rem; padding-left: 1.3rem; }
.report-body li { margin: 0 0 .65rem; padding-left: .2rem; }
.report-body li::marker { color: var(--muted); }
.report-body .labels { display: flex; flex-wrap: wrap; gap: .45rem .5rem; margin: .4rem 0 1.1rem; }
.report-body .labels span {
  max-width: 100%; overflow-wrap: anywhere;
  font-size: .82rem; line-height: 1.5; color: var(--fg2);
  border: 1px solid var(--line); border-radius: 6px; padding: .12rem .55rem;
}
.report-body .tag { font-family: "Inter", system-ui, sans-serif; font-size: .8rem; letter-spacing: .03em; color: var(--accent); margin: -.2rem 0 .4rem; }
.report-body .h-num { color: var(--accent); font-family: "Inter", system-ui, sans-serif; font-variant-numeric: tabular-nums; margin-right: .5em; }
.report-body .attrib { color: var(--muted); font-size: .9rem; margin-top: -.4rem; }

/* ---------- previous / next ---------- */
.issue-pager { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 3rem 0 0; padding-top: 2rem; border-top: 1px solid var(--line); }
.pager-link {
  display: flex; flex-direction: column; gap: .15rem; min-width: 0;
  padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px;
  color: var(--fg); text-decoration: none; line-height: 1.5;
}
a.pager-link:hover { border-color: var(--accent); }
.pager-next { grid-column: 2; text-align: right; align-items: flex-end; }
.pager-dir { font-size: .8rem; color: var(--muted); }
.pager-month { font-weight: 700; }
.pager-none { border-style: dashed; color: var(--muted); }
.pager-none .pager-month { font-weight: 400; font-size: .9rem; }

/* ---------- month index ---------- */
.report-index { margin-top: 2.5rem; }
.index-title { font-size: .8rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin: 0 0 .8rem; line-height: 1.5; }
.index-year { display: flex; gap: .75rem; align-items: flex-start; margin: 0 0 .8rem; }
.index-y { flex: none; width: 2.6rem; margin: .3rem 0 0; font-family: "Inter", system-ui, sans-serif; font-size: .85rem; color: var(--fg2); line-height: 1.5; }
.index-year ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 2.2rem); gap: .35rem; }
.index-year a {
  display: block; text-align: center; padding: .3rem 0; line-height: 1.4;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--fg2); text-decoration: none;
  font-family: "Inter", system-ui, sans-serif; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.index-year a:hover { border-color: var(--accent); color: var(--fg); }
.index-year a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.index-all { margin: 1rem 0 0; font-size: .9rem; line-height: 1.5; }

/* ---------- wide screens (kept last so they override the rules above) ---------- */
/* two columns: contents on the left, text on the right */
@media (min-width: 1024px) {
  .report-layout {
    max-width: 62rem;
    padding: 3rem 2rem 6rem;
    grid-template-columns: 13rem minmax(0, 40rem);
    column-gap: 3rem;
    justify-content: center;
    grid-template-areas: "toc head" "toc body" "toc pager" "toc index";
  }
  .report-toc { margin: 0; }
  .toc-inner {
    position: sticky; top: calc(var(--head-h) + 1.5rem);
    max-height: calc(100vh - var(--head-h) - 3rem);
    overflow-y: auto; overscroll-behavior: contain;
  }
}
/* three columns: contents · text · month index */
@media (min-width: 1280px) {
  .report-layout {
    max-width: 78rem;
    grid-template-columns: 14rem minmax(0, 40rem) 11.5rem;
    column-gap: 3.5rem;
    grid-template-areas: "toc head index" "toc body index" "toc pager index";
  }
  .report-index {
    margin: 0; align-self: start;
    position: sticky; top: calc(var(--head-h) + 1.5rem);
  }
  .index-year { flex-direction: column; gap: .4rem; }
  .index-y { width: auto; margin: 0; }
  .index-year ol { grid-template-columns: repeat(4, 2.2rem); }
}

/* ---------- English (?lang=en) ---------- */
/* Hold the page back until report.js has swapped the text, so Chinese never
   flashes; if the script never gets there, show the page after 1.2s anyway. */
html.en-pending .site-head, html.en-pending .report-layout { visibility: hidden; animation: en-reveal 0s linear 1.2s forwards; }
@keyframes en-reveal { to { visibility: visible; } }
/* the English summary line that already sits in the Chinese header repeats the translated lede */
html[lang="en"] .report-head .meta[lang="en"] { display: none; }
.en-note { margin: 0 0 1.5rem; padding: .5rem .9rem; border-left: 3px solid var(--accent); color: var(--fg2); font-size: .94rem; line-height: 1.6; }
