/* A quiet reading layout, scoped to the blog index and its essays. */
.journal-page {
  --bg-page: #faf9f6;
  --text: #343936;
  --text-muted: #6d726d;
  --heading: #232d28;
  --accent: #426b59;
  --accent-hover: #284c3c;
  --border: #dedfd8;
  --figure-bg: #f0f2ed;
  padding: 0;
}

html[data-theme="dark"] .journal-page {
  --bg-page: #151a18;
  --text: #d2d8d1;
  --text-muted: #a3ada5;
  --heading: #edf0e8;
  --accent: #a4c6b0;
  --accent-hover: #d0e1d2;
  --border: #343e37;
  --figure-bg: #1e2722;
}

.journal-page [hidden] { display: none !important; }
.journal-page .site-navbar {
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
.journal-page .site-navbar-inner {
  max-width: 72rem;
  min-height: 4.75rem;
  padding: .75rem 2rem;
  justify-content: space-between;
  gap: 1rem;
}
.journal-page .site-navbar-links { display: flex; gap: 1.65rem; font-size: .9rem; }
.journal-page .site-navbar-links a { color: var(--text-muted); }
.journal-page .site-navbar-links a.current { color: var(--heading); font-weight: 500; }
.journal-page .site-navbar-links a:hover { color: var(--accent); text-decoration: none; }
.journal-page .nav-delimiter { display: none; }
.reading-controls { display: flex; align-items: center; gap: 1rem; }
.journal-page .theme-toggle {
  position: static;
  transform: none;
  width: 2rem;
  height: 2rem;
  color: var(--text-muted);
  border: 0;
  border-radius: 4px;
  background: transparent;
}
.journal-page .theme-toggle:hover { color: var(--accent); background: var(--figure-bg); }
.journal-page :focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 1100; padding: .5rem 1rem; background: var(--bg-page); }
.skip-link:focus { top: 1rem; }
.journal-shell { width: min(calc(100% - 4rem), 64rem); margin: 0 auto; padding: 9rem 0 3rem; }
.eyebrow {
  font: 500 .69rem/1.6 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent);
  margin: 0 0 1.65rem;
}
.index-header { padding: 1.75rem 0 3.75rem; }
.index-header h1 { font: 400 clamp(3rem, 7vw, 4.7rem)/1.1 var(--font-serif); letter-spacing: -.04em; margin: 0 0 1rem; }
.index-header .index-intro { font-size: 1.2rem; color: var(--text-muted); max-width: 34rem; margin: 0; }
.post-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.post-entry { padding: 2.65rem 0 3rem; border-bottom: 1px solid var(--border); }
.post-entry-link { display: grid; grid-template-columns: 1fr 15rem; gap: 4rem; align-items: center; color: inherit; border: 0; }
.post-entry-link:hover { color: inherit; border: 0; }
.post-entry-link .eyebrow { margin-bottom: 1rem; }
.post-entry h2 { font: 400 clamp(1.8rem, 3.4vw, 2.5rem)/1.2 var(--font-serif); letter-spacing: -.025em; padding: 0; margin: 0 0 .85rem; }
.post-entry-link:hover h2 { color: var(--accent); }
.post-entry .post-summary { color: var(--text-muted); font-size: 1.1rem; max-width: 34rem; margin: 0 0 1.65rem; }
.post-entry .post-meta { color: var(--text-muted); font: 400 .78rem/1.6 var(--font-sans); margin: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.post-entry .read-link { margin-left: auto; color: var(--accent); }
.post-thumbnail { color: var(--accent); background: var(--figure-bg); border-radius: 50%; width: 15rem; height: 15rem; }
.post-thumbnail .alternate-ray { stroke: var(--text-muted); opacity: .3; }
.journal-footer { border-top: 1px solid var(--border); margin-top: 4rem; padding-top: 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; font: 400 .8rem/1.6 var(--font-sans); color: var(--text-muted); }
.index-page .journal-footer { border: 0; margin-top: 6rem; }
.article-shell { max-width: 44rem; }
.article-header { margin: 0 0 3rem; }
.back-link { font: 400 .8rem/1.5 var(--font-sans); color: var(--text-muted); display: inline-block; margin-bottom: 3rem; }
.article-header .eyebrow { margin-bottom: 1.25rem; }
.article-header h1 { font: 400 clamp(2.75rem, 5.8vw, 4.25rem)/1.05 var(--font-serif); letter-spacing: -.045em; margin: 0 0 1.5rem; text-wrap: balance; }
.article-subtitle { font: 400 1.35rem/1.5 var(--font-serif); color: var(--text-muted); margin-bottom: 1.7rem; }
.article-meta { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font: 400 .77rem/1.6 var(--font-sans); color: var(--text-muted); }
.article-meta .author { color: var(--heading); }
.article-layout { display: block; }
.article-body { min-width: 0; font-size: 1.17rem; line-height: 1.85; }
.article-body p { line-height: inherit; margin-bottom: 1.25em; }
.article-body h2 { font: 500 1.7rem/1.3 var(--font-serif); letter-spacing: -.02em; margin: 3.5rem 0 1.5rem; padding: 1.75rem 0 0; border-top: 1px solid var(--border); scroll-margin-top: 7rem; }
.article-body h3 { font: 500 1.04rem/1.6 var(--font-sans); margin: 2.25rem 0 1rem; }
.section-number { display: block; font: 500 .67rem/1.5 var(--font-sans); color: var(--accent); letter-spacing: .1em; margin-bottom: .85rem; }
.equation { overflow-x: auto; overflow-y: hidden; padding: .65rem .25rem; margin: 1.5rem 0 1.8rem; scrollbar-width: thin; }
.equation .katex-display { margin: .4rem 0; }
.article-body .katex { font-size: 1em; }
.article-body .katex-display > .katex { display: block; width: max-content; min-width: 100%; }
.article-body blockquote { margin: 2.5rem 0 0; border-left: 2px solid var(--accent); padding: .2rem 0 .2rem 1.75rem; font-size: 1.4rem; font-style: italic; color: var(--heading); }
.article-body blockquote p { margin-bottom: 0; line-height: 1.7; }
.refraction-figure { margin: 2rem 0 2.5rem; }
.refraction-figure svg { display: block; width: 100%; height: auto; color: var(--accent); background: var(--figure-bg); border-radius: 4px; }
.refraction-figure text { font: 17px var(--font-serif); fill: currentColor; }
.refraction-figure .medium-label { font: 11px var(--font-sans); letter-spacing: .08em; }
.refraction-figure .figure-muted { stroke: var(--text-muted); opacity: .55; }
.refraction-figure figcaption { font: 400 .76rem/1.7 var(--font-sans); color: var(--text-muted); margin-top: .85rem; }
.article-end { margin-top: 3rem; text-align: center; color: var(--accent); letter-spacing: .5em; }
.citation { font: 400 .65em/0 var(--font-sans); vertical-align: baseline; position: relative; top: -.5em; white-space: nowrap; }
.citation a { scroll-margin-top: 7rem; }
.article-references { font-size: .95rem; line-height: 1.7; }
.article-references h2 { font-size: 1.4rem; margin-top: 3rem; }
.article-references ol { padding-left: 1.4em; margin: 0; }
.article-references li { padding-left: .35em; margin-bottom: 1.4em; scroll-margin-top: 7rem; }
.article-references li::marker { color: var(--text-muted); font-family: var(--font-sans); font-size: .8em; }
.article-references li:target { background: var(--figure-bg); border-radius: 3px; }
.reference-note { color: var(--text-muted); }
.reference-backlink { font: 400 .8rem/1 var(--font-sans); margin-left: .25em; }
.article-footer { margin-left: 0; }
.article-header:lang(zh-CN) h1 { font-size: clamp(2.4rem, 4.8vw, 3.6rem); line-height: 1.3; letter-spacing: .01em; }
.article-body:lang(zh-CN) { font-size: 1.06rem; line-height: 2; letter-spacing: .025em; }
.article-body:lang(zh-CN) h2 { font-size: 1.5rem; line-height: 1.6; letter-spacing: .01em; }
.article-body:lang(zh-CN) blockquote { font-size: 1.2rem; font-style: normal; }
.article-body:lang(zh-CN) em { font-style: normal; color: var(--heading); }

@media (max-width: 900px) {
  .post-entry-link { gap: 2rem; grid-template-columns: 1fr 11rem; }
  .post-thumbnail { width: 11rem; height: 11rem; }
}

@media (max-width: 560px) {
  .journal-page .site-navbar-inner { padding: .75rem 1.1rem; min-height: 4.25rem; gap: .75rem; }
  .journal-page .site-navbar-links { gap: .85rem; font-size: .77rem; }
  .reading-controls { gap: .4rem; }
  .journal-page .theme-toggle { width: 1.7rem; }
  .journal-page .theme-icon { width: 17px; height: 17px; }
  .journal-shell { width: calc(100% - 2.5rem); padding-top: 6.5rem; }
  .index-header { padding: 1rem 0 2.5rem; }
  .index-header .index-intro { font-size: 1.1rem; }
  .post-entry-link { grid-template-columns: 1fr; gap: 1.5rem; }
  .post-thumbnail { width: 8rem; height: 8rem; grid-row: 1; }
  .post-entry { padding-top: 2rem; }
  .post-entry .post-summary { font-size: 1rem; }
  .post-entry .read-link { width: 100%; margin: .5rem 0 0; }
  .article-header { margin-bottom: 2.25rem; }
  .article-header h1 { font-size: 2.85rem; }
  .article-subtitle { font-size: 1.2rem; }
  .back-link { margin-bottom: 2.25rem; }
  .article-body { font-size: 1.08rem; }
  .article-body h2 { font-size: 1.6rem; }
  .article-body blockquote { font-size: 1.25rem; padding-left: 1.2rem; }
  .equation { font-size: .91em; }
  .article-body:lang(zh-CN) { font-size: 1rem; }
  .journal-footer { font-size: .75rem; }
  .index-page .journal-footer { flex-direction: column; gap: .75rem; text-align: center; }
  .article-footer .site-view-count { order: 1; flex-basis: 100%; text-align: center; }
}

@media (max-width: 370px) {
  .journal-page .site-navbar-inner { padding-inline: .65rem; gap: .3rem; }
  .journal-page .site-navbar-links { gap: .6rem; font-size: .7rem; }
  .reading-controls { gap: .2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .journal-page *, .journal-page *::before, .journal-page *::after { transition: none !important; }
}

@media print {
  .journal-page { --bg-page: white; --text: black; --heading: black; --text-muted: #444; --accent: #333; --border: #ccc; background: white; color: black; }
  .journal-shell { width: 100%; padding: 0; }
  .back-link, .skip-link { display: none; }
  .article-body { font-size: 11pt; }
  .article-body h2, .article-body h3 { break-after: avoid; }
  .equation, .refraction-figure { break-inside: avoid; overflow: visible; }
  .journal-footer { margin-top: 2rem; }
}
