/* ==========================================================================
   Folio signature
   What makes this theme a journal rather than a page set in a serif, gathered
   in one place and loaded last.

   A printed journal is known by a few fixed habits: a nameplate centred
   between rules with a dateline beneath it, stories numbered in the order
   they ran, a standfirst that is larger than the text it introduces, bylines
   in small capitals, and a mark where a piece ends. This file gives Folio
   those habits on every page, and the comfort a present-day page is expected
   to have: text large enough to read at ease, room between sections, and
   titles that answer the pointer.

   Kept from the theme's definition: no card backgrounds, rules instead of
   boxes, serif and sans only.
   ========================================================================== */

:root {
  --ease: cubic-bezier(.2, .7, .2, 1);
  --rule-strong: var(--text);
  --ornament: "\2766"; /* floral heart, the printer's end mark */
}

/* ==========================================================================
   Three faces, each for a job
   Display (Cormorant Garamond): the nameplate and the italic ornaments, that
     is the tagline, story numbers, years, the colophon and the drop cap.
   Text serif (Source Serif 4): headlines and prose.
   Sans (Instrument Sans): what labels and operates the page.

   Headlines used to be in the display face. Its bold is a fine line (600 and
   700 are almost the same weight), and beside the system's bold Song a Latin
   word looked a size lighter: "Fake Work" over "工作十年" in one list,
   "CloudCode" beside "一站式云端" in one title. The text serif's semibold has
   the colour of the Song bold, so a headline in two scripts reads as one line.
   Do not move headlines back to the display face, and do not try to tell the
   scripts apart with :lang(): <html lang> follows the reader's interface
   language, not the language the piece is written in.

   Chinese falls to the system's Song faces. Installs name the same family
   differently (Google Fonts: "Noto Serif SC"; Linux packages: "Noto Serif CJK
   SC"; Adobe: "Source Han Serif SC"), so each is listed.
   ========================================================================== */
:root {
  --font-serif-cjk: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun";
  --font-display: "Cormorant Garamond", var(--font-serif-cjk), Georgia, serif;
  --font-prose: "Source Serif 4", var(--font-serif-cjk), Georgia, serif;
  --font-heading: var(--font-prose);
}
.journal-masthead h1, .folio-logo, .year-label, .posts-listing .year-label, .error-title { font-family: var(--font-display); }
/* One weight for each rank, whatever the page: a page's own title is bold,
   a section's heading and a story's title are semibold. Some were 500, which
   Chinese faces do not have: "读者圈" stood in regular beside a bold "文章". */
.page-title, .reader-circle-intro h1, .public-profile-name h1, .account-heading h1, .account-authorizations > h1, .account-clients > h1 { font-weight: 700; }
.account-settings .account-card h2, .book-section > h2, .book-nav > h2, .account-authorizations .authorization-heading h2, .account-clients .account-card h2,
.book-chapter-list .chapter-title, .book-continue .sibling-title, .comments-heading { font-weight: 600; }
/* Headings inside a piece had no weight of their own and stood lighter than
   the paragraph under them. */
.app-prose :is(h1, h2, h3, h4, h5, h6) { font-weight: 600; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); }
/* Italics are for text that has an italic: the display face does, Chinese,
   Japanese and Korean faces do not. Without this a browser slants those
   glyphs mechanically, and a Chinese tagline or quotation leans like a
   falling fence. Latin text still gets the true italic. */
html { font-synthesis-style: none; }
/* Figures stand at full height. The display face sets old-style figures by
   default; beside Chinese they read as stray lower-case letters ("10k" and
   "1年" in a headline looked like "ıok" and "ı年"). It is set on every
   element and marked important because the theme styles most headings with
   the font shorthand, which resets both font-variant-numeric and
   font-feature-settings on the element it is used on: set once on html, the
   nameplate and the page titles lost it again. Only this one feature is
   touched; tabular figures (font-variant-numeric) keep working beside it. */
*, *::before, *::after { font-feature-settings: "lnum" 1 !important; }

/* Small capitals for the lines that label things: bylines, kickers, the dateline. */
.section-label, .journal-edition, .journal-subscribe, .hero-meta > a, .hero-meta > span:first-child,
.article-card-meta > a, .article-card-meta > span:first-child {
  text-transform: uppercase; letter-spacing: .09em;
}

/* --------------------------------------------------------------------------
   Navigation: a quiet bar; the section you are in is underscored
   -------------------------------------------------------------------------- */
.folio-nav a { transition: color .2s ease; }
.folio-nav a::after { height: 2px; bottom: 6px; transition: width .3s var(--ease); }
.folio-nav a[aria-current="page"] { color: var(--accent); }
.folio-nav a[aria-current="page"]::after { width: 100%; }
/* On the front page the bar holds only the sections, so it centres over the nameplate. */
@media (min-width: 768px) {
  .folio-header-home .folio-logo { display: none; }
  .folio-header-home .folio-header-inner { justify-content: center; }
}

/* --------------------------------------------------------------------------
   Nameplate: the title centred between rules, the dateline beneath
   -------------------------------------------------------------------------- */
.journal-masthead { display: block; padding: 2.25rem 0 0; border-bottom: 0; text-align: center; }
.journal-masthead > div:first-child { padding-bottom: 1.6rem; }
.journal-masthead h1 { font-size: clamp(2.75rem, 7vw, 5.25rem); line-height: 1; letter-spacing: -.04em; text-wrap: balance; }
.journal-masthead h1 + p { margin: .9rem 0 0; color: var(--muted); font: italic 500 1.2rem/1.4 var(--font-display); letter-spacing: .01em; }
.journal-masthead .journal-tools {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1.5rem;
  flex: none; padding: .15rem 0; border-top: 3px double var(--rule-strong); border-bottom: 1px solid var(--rule-strong);
  text-align: left;
}
.journal-edition { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 600; }
.journal-edition time { color: var(--text); margin-left: .35rem; }
.journal-masthead .journal-subscribe { justify-self: center; font-size: .75rem; font-weight: 600; min-height: 44px; }
.journal-masthead .journal-tools .home-search-form { justify-self: end; width: min(100%, 15rem); border-bottom: 0; }
.journal-masthead .journal-tools .search-input { font-size: .82rem; text-align: right; }
.journal-masthead .journal-tools .search-input::placeholder { font-style: italic; }

/* --------------------------------------------------------------------------
   Front page: a lead with a standfirst, and stories numbered as they ran
   -------------------------------------------------------------------------- */
.hero-featured .section-label, .journal-front-secondary > .section-label { color: var(--accent); font-weight: 600; }
.hero-title { font-size: clamp(2.2rem, 4.2vw, 3.5rem); line-height: 1.12; letter-spacing: 0; text-wrap: balance; }
.hero-title a, .journal-secondary-story h2 a, .article-card-title, .search-result-title {
  background-image: linear-gradient(var(--accent), var(--accent)); background-repeat: no-repeat;
  background-position: 0 100%; background-size: 0 1px; transition: background-size .35s var(--ease), color .2s ease;
}
.hero-title a:hover, .journal-secondary-story h2 a:hover, .article-card:hover .article-card-title, .search-result-title:hover { background-size: 100% 1px; }
/* The standfirst: in the display face and a size above the text, so the lead
   reads as the opening of the edition and not as one more list entry. */
.hero-excerpt { max-width: 34em; color: var(--text); font: 500 1.4rem/1.5 var(--font-heading); letter-spacing: .003em; }
.journal-read-link { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.journal-read-link span { transition: transform .25s var(--ease); }
.journal-read-link:hover span { transform: translate(2px, -2px); }

.journal-section-heading { align-items: center; border-top: 3px double var(--rule-strong); padding: 1.1rem 0 1rem; }
.journal-section-heading h2 { font-size: 1.85rem; letter-spacing: 0; }
.journal-section-heading > a { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }

/* Stories carry their running number in the margin. */
.journal-story-grid { counter-reset: story; }
.journal-story-grid .article-list-item { counter-increment: story; display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); column-gap: .6rem; padding: 1.25rem 0 1.35rem; }
.journal-story-grid .article-list-item::before {
  content: counter(story, decimal-leading-zero); grid-column: 1; padding-top: .28rem;
  color: var(--accent); font: italic 500 1.35rem/1 var(--font-display); font-variant-numeric: lining-nums;
}
.journal-story-grid .article-list-item > .article-card { grid-column: 2; min-width: 0; }
/* Headlines are not tracked in: the text serif is drawn to stand at its own
   spacing, and Chinese characters are never set tighter than solid. (The
   negative tracking here dated from the display face.) */
.article-card-title, .article-list .article-card-title { letter-spacing: 0; }
.article-card-excerpt { font-size: .93rem; line-height: 1.7; }
.article-card-meta, .hero-meta { font-size: .78rem; }
.article-card-meta > a, .hero-meta > a { font-weight: 600; font-size: .75rem; }
.journal-secondary-story h2 { letter-spacing: 0; }

/* Departments are named in small capitals in the margin. */
.journal-department-label h3.section-label { font-weight: 600; }
.topic-card { transition: border-color .25s ease; }

/* --------------------------------------------------------------------------
   Inner pages: the same double rule opens every page
   -------------------------------------------------------------------------- */
.page-title { letter-spacing: 0; }
.year-label { color: var(--accent); font-style: italic; }

/* --------------------------------------------------------------------------
   Reading: the text at ease, and a mark where the piece ends
   -------------------------------------------------------------------------- */
.article-title { letter-spacing: 0; text-wrap: balance; }
.reading-content { font-size: 1.08rem; line-height: 1.9; }
.reading-content > p { margin-block: 1.15em; }
.reading-content :is(h2, h3) { letter-spacing: 0; }
/* A quotation stands upright, a size up, behind its rule. In italic only the
   Latin words leaned (Chinese has no italic): "写给 10 年后的自己：keep
   shipping" came out with a slanted "10" in an upright sentence. */
.reading-content blockquote { margin: 1.75rem 0; padding: .25rem 0 .25rem 1.5rem; border-left: 2px solid var(--accent); background: none; color: var(--text); font: 400 1.3rem/1.6 var(--font-prose); }
.reading-content blockquote p { margin: .4em 0; }
.reading-content :is(pre, img, video) { border-radius: 3px; }
.reading-content::after { content: var(--ornament); display: block; margin: 2.5rem 0 .5rem; color: var(--accent); font-size: 1.25rem; line-height: 1; text-align: center; }

/* --------------------------------------------------------------------------
   Colophon
   -------------------------------------------------------------------------- */
.folio-footer { border-top: 0; padding: 0 0 2.5rem; }
.folio-footer-inner { padding-top: 1.75rem; border-top: 3px double var(--rule-strong); }
.folio-footer-inner::before { content: var(--ornament); flex: 0 0 100%; margin-bottom: .25rem; color: var(--accent); font-size: 1.1rem; line-height: 1; text-align: center; }
.folio-footer-left { font: italic 500 1.05rem/1.5 var(--font-display); letter-spacing: .01em; }
.folio-footer-right ul { gap: 1.5rem; }
.folio-footer-right a { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
/* What an owner puts inside a menu link is theirs: an icon, a counter with
   its own size and border. The spaced capitals are for the link's own words
   and stop there (a subscriber badge inherited the letter-spacing, outgrew
   its border and spread over the icon beside it). */
.folio-footer-right a > * { letter-spacing: normal; text-transform: none; }

@media (max-width: 767px) {
  .journal-masthead { padding-top: 1.5rem; display: block; }
  .journal-masthead > div:first-child { padding-bottom: 1.1rem; }
  /* The dateline keeps one line; the subscription and the search share the next. */
  .journal-masthead .journal-tools { grid-template-columns: minmax(0, 1fr) auto; gap: 0 1rem; margin-top: 0; padding: .25rem 0; }
  .journal-edition { grid-column: 1 / -1; padding: .55rem 0; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
  .journal-masthead .journal-tools .home-search-form { grid-column: 1; grid-row: 2; justify-self: stretch; width: auto; }
  .journal-masthead .journal-tools .search-input { text-align: left; }
  .journal-masthead .journal-subscribe { grid-column: 2; grid-row: 2; justify-self: end; }
  .hero-excerpt { font-size: 1.2rem; }
  .journal-story-grid .article-list-item { grid-template-columns: 2.1rem minmax(0, 1fr); padding: 1.1rem 0; }
  .folio-footer-inner { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-title a, .journal-secondary-story h2 a, .article-card-title, .journal-read-link span, .folio-nav a::after { transition: none; }
}

/* --------------------------------------------------------------------------
   Reading measure
   The reading column is 46rem (layout.css): about 80 characters of Latin text
   or 40 of Chinese to a line. At 58rem a line ran past a hundred. The freed
   margin holds the contents from 1300px up (reading.css).
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Section fronts: every inner page opens like the nameplate
   The archive, the tags and the search were titled flush left in a smaller
   size, so they read as a different publication from the front page. They
   now open centred, with the description as an italic deck.
   -------------------------------------------------------------------------- */
.page-header { text-align: center; padding-top: .75rem; }
.page-header .page-title { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; }
.page-header .page-description { margin: .7rem auto 0; font: italic 500 1.2rem/1.45 var(--font-display); }
.page-header .page-eyebrow { justify-content: center; }

/* Search in the bar, and the name of the current colour scheme in the phone menu. */
.folio-nav a.nav-search { width: 44px; justify-content: center; font-size: .95rem; }
.folio-nav a.nav-search::after { content: none; }
.folio-nav a.nav-search:hover { color: var(--accent); }
.theme-state { margin-left: .5rem; color: var(--muted); font-size: .8em; }
.theme-state:not(:empty)::before { content: "\00b7"; margin-right: .5rem; }

/* ==========================================================================
   Reading in a serif
   A journal's running text is a serif made for long reading. The display
   face (Cormorant Garamond) is too fine for body sizes and the interface sans
   reads as a web page, so prose, standfirsts and excerpts are set in Source
   Serif 4; the sans stays on what labels and operates the page. Chinese text
   falls to the system's Song faces listed after it.
   ========================================================================== */
.reading-content { font-family: var(--font-prose); font-size: 1.2rem; line-height: 1.75; font-optical-sizing: auto; }
.reading-content > p { margin-block: 1.05em; }
.reading-content :is(pre, code, kbd, table, .vditor-copy) { font-size: .85em; }
.reading-content table { font-family: var(--font-body); }
.hero-excerpt { font-family: var(--font-prose); font-size: 1.2rem; font-weight: 400; line-height: 1.6; }
/* A few lines whatever the script. The excerpt is cut by characters, and a
   Chinese character is twice as wide as a Latin one: the same 240 that make
   three or four lines of English ran to twelve lines of Chinese on a phone,
   a screenful before the reader reached the link or the next story. Beside
   the two picks on a wide screen there is room for a little more. */
.hero-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
@media (min-width: 768px) { .hero-excerpt { -webkit-line-clamp: 6; } }
.article-card-excerpt { font-family: var(--font-prose); font-size: 1rem; line-height: 1.6; }
.comment-body, .journal-community .home-comment-excerpt, .topic-content { font-family: var(--font-prose); }
.comment-body { font-size: 1.05rem; line-height: 1.7; }
.journal-community .home-comment-excerpt { font-size: 1rem; line-height: 1.55; }

/* ==========================================================================
   Pictures
   The lead runs with its picture and a story in a list carries a small one,
   when the piece has any. Without pictures the page was type from edge to
   edge; a printed journal is not.
   ========================================================================== */
.hero-cover { display: block; margin-bottom: 1.25rem; background: none; overflow: hidden; border-radius: 3px; }
.hero-cover img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface); transition: transform .6s var(--ease); }
.hero-featured:hover .hero-cover img { transform: scale(1.015); }
.article-card:has(> .article-card-thumb) { display: grid; grid-template-columns: minmax(0, 1fr) 7rem; column-gap: 1.25rem; align-items: start; }
.article-card:has(> .article-card-thumb) > :not(.article-card-thumb) { grid-column: 1; }
.article-card-thumb { grid-column: 2; grid-row: 1 / span 4; display: block; background: none; overflow: hidden; border-radius: 3px; }
.article-card-thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface); }
.journal-secondary-story .article-card-thumb, .compact-list .article-card-thumb { display: none; }

/* ==========================================================================
   The byline and the contributor's note
   ========================================================================== */
.article-meta .reading-time, .hero-meta .reading-time { color: var(--accent); }
.hero-meta .reading-time::before { content: "\00b7"; margin-right: .45rem; color: var(--muted); }
.author-card { display: flex; align-items: flex-start; gap: 1.25rem; margin-top: 2rem; padding: 1.5rem 0 .5rem; border-top: 3px double var(--rule-strong); }
.author-card-avatar { width: 64px; height: 64px; flex: none; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); }
.author-card-body { min-width: 0; }
.author-card .section-label { margin: 0; color: var(--muted); }
.author-card-name { display: inline-block; margin: .15rem 0 .1rem; color: var(--text); font: 600 1.6rem/1.25 var(--font-heading); background-image: linear-gradient(var(--accent), var(--accent)); background-repeat: no-repeat; background-position: 0 100%; background-size: 0 1px; transition: background-size .35s var(--ease), color .2s ease; }
.author-card-name:hover { color: var(--accent); background-size: 100% 1px; }
.author-card-bio { margin: .25rem 0 0; color: var(--muted); font: 400 1rem/1.6 var(--font-prose); overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .reading-content { font-size: 1.1rem; }
  /* A small square on a phone, so the title keeps most of the line. */
  .article-card:has(> .article-card-thumb) { grid-template-columns: minmax(0, 1fr) 4.5rem; column-gap: .85rem; }
  .article-card-thumb img { aspect-ratio: 1; }
}
@media (prefers-reduced-motion: reduce) { .hero-cover img { transition: none; } .hero-featured:hover .hero-cover img { transform: none; } }

/* ==========================================================================
   What reading real pieces showed (Chinese and English mixed, long archives)
   ========================================================================== */
/* The mark that links to a heading waits for the pointer. Shown always, it
   hung a grey chain after every heading of a piece. Without a pointer to
   hover with it stays, faint, so a heading can still be linked to. */
@media (hover: hover) {
  .app-prose .vditor-anchor { opacity: 0; transition: opacity .15s var(--ease); }
  .app-prose :is(h1, h2, h3, h4, h5, h6):hover .vditor-anchor, .app-prose .vditor-anchor:focus-visible { opacity: 1; }
}
/* The opening paragraph holds its own drop cap. A one-line opening let the
   floated capital hang into whatever came next: it sat on top of the first
   heading. */
.reading-content > p:first-child { display: flow-root; }
/* A note is a few lines, set a little larger and without the capital. */
.folio-note .reading-content { font-size: 1.35rem; line-height: 1.7; }
.folio-note .reading-content > p:first-child::first-letter { float: none; font: inherit; color: inherit; padding: 0; margin: 0; }

/* The neighbours at the foot of a piece are titles, set as titles. */
.sibling-title { color: var(--text); font: 600 1.15rem/1.4 var(--font-heading); transition: color .2s var(--ease); }
.sibling-nav a:hover .sibling-title { color: var(--accent); }

/* "Comments" and "Leave a comment" were the same size, the first lighter than
   the second. With no comment yet the first has nothing under it and only
   the form's heading shows. */
.comments-heading { font-size: 1.6rem; }
.comment-form h3 { font-size: 1.25rem; }
.comments-heading:has(+ .comment-form) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The archive is a ruled index like the front page's list. Its rows were
   8px apart with nothing between them: an excerpt ran into the next title. */
.posts-listing:not(.posts-listing-books) .year-group .article-list { row-gap: 0; }
.posts-listing:not(.posts-listing-books) .year-group .article-list-item { padding: 1.1rem 0; border-top: 1px solid var(--border); }
.posts-listing:not(.posts-listing-books) .year-group .article-list-item:first-child { padding-top: 0; border-top: 0; }
@media (min-width: 768px) {
  .posts-listing:not(.posts-listing-books) .year-group .article-list-item:nth-child(2) { padding-top: 0; border-top: 0; }
}

/* Tags are an index: several columns of short ruled lines, the count beside
   the name. Two columns of tall rows made sixty tags a page of 2400px, with
   each count a column's width away from its name. */
.tag-cloud { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 2.5rem; }
.tag-cloud .tag-cloud-item { justify-content: flex-start; gap: .5rem; min-height: 44px; padding: .65rem 0; font: 600 1.1rem/1.4 var(--font-heading); overflow-wrap: anywhere; }
.tag-cloud-item sup { font-size: .75rem; }
@media (max-width: 1023px) { .tag-cloud { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 2rem; } }
@media (max-width: 767px) { .tag-cloud { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; } .tag-cloud .tag-cloud-item { font-size: 1.05rem; } }

/* A search result's passage is prose, like every other excerpt. */
.search-result-excerpt { font-family: var(--font-prose); font-size: .95rem; }
.comments-section > hr:has(+ .comments-heading + .comment-form) { display: none; }
