/* ============================================================
   The Daily Ledger — Newspaper Template
   Design tokens restored from the Ardot design file:
   paper #FBFAF7 / ink #111111 / press-red #8A2A1E
   hairline #C9C4B8 / body #23201B / deck #444036
   secondary #55503F / meta #6B6659 / muted #8B8574
   ============================================================ */

:root {
    --paper: #FBFAF7;
    --ink: #111111;
    --body: #23201B;
    --deck: #444036;
    --secondary: #55503F;
    --meta: #6B6659;
    --muted: #8B8574;
    --red: #8A2A1E;
    --hairline: #C9C4B8;
    --white: #FFFFFF;
    --serif-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --sans: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;
    --serif-italic: 'Lora', Georgia, serif;
    --serif-text: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--paper);
}

body {
    background: var(--paper);
    color: var(--body);
    font-family: var(--serif-text);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--red);
}

img {
    max-width: 100%;
    display: block;
}

/* ---------- Masthead ---------- */

.masthead {
    padding: 36px 36px 0;
    max-width: 1440px;
    margin: 0 auto;
}

.dateline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
}

.dateline span {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--ink);
    text-transform: uppercase;
}

.rule-thin {
    height: 1px;
    background: #1A1A1A;
}

.masthead-title {
    font-family: var(--serif-display);
    font-weight: 900;
    font-size: 84px;
    line-height: 1.1;
    color: var(--ink);
    text-align: center;
    padding: 10px 0 16px;
}

.masthead-motto {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--meta);
    text-align: center;
    text-transform: uppercase;
    max-width: 1100px;
    line-height: 1.8;
    margin: 0 auto;
    padding-bottom: 12px;
}

.rule-double {
    border-top: 3px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    height: 6px;
}

.mainnav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 36px;
    padding: 10px 0;
}

.mainnav .navitem {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.5px;
    color: var(--ink);
    text-transform: uppercase;
}

.mainnav .navitem:hover {
    color: var(--red);
}

.mainnav .navitem.active {
    color: var(--red);
}

.mainnav .navitem.nav-search {
    border: 1px solid var(--ink);
    padding: 6px 10px;
}

.mainnav .navitem.nav-search.active {
    background: var(--ink);
    color: var(--white);
}

.mainnav .navitem.nav-search.active:hover {
    color: var(--white);
}

.rule-heavy {
    height: 3px;
    background: var(--ink);
}

/* ---------- Page body ---------- */

.pagebody {
    max-width: 1440px;
    margin: 0 auto;
    padding: 44px 48px 48px;
}

.section-gap {
    height: 44px;
}

/* ---------- Section headers (double rules + label) ---------- */

.section-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.section-header .line {
    flex: 1;
    height: 2px;
    background: var(--ink);
}

.section-header .label {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 4px;
    color: var(--ink);
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---------- Homepage lead ---------- */

.lead {
    text-align: center;
}

.lead .headline {
    font-family: var(--serif-display);
    font-weight: 800;
    font-size: 40px;
    line-height: 48px;
    color: var(--ink);
    margin: 14px auto 0;
    max-width: 980px;
}

.lead .deck {
    font-family: var(--serif-italic);
    font-style: italic;
    font-size: 18px;
    line-height: 28px;
    color: var(--deck);
    margin: 14px auto 0;
    max-width: 820px;
}

.lead .lead-date {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.5px;
    color: var(--red);
    text-transform: uppercase;
    margin-top: 14px;
}

/* ---------- Secondary rows (homepage) ---------- */

.secondary {
    margin-top: 26px;
    border-top: 1px solid var(--hairline);
    padding-top: 22px;
}

.secondary-item {
    text-align: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--hairline);
}

.secondary-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.secondary-item .headline {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 22px;
    line-height: 28px;
    color: var(--ink);
}

.secondary-item .snippet {
    font-family: var(--serif-text);
    font-size: 14px;
    line-height: 21px;
    color: var(--secondary);
    max-width: 780px;
    margin: 5px auto 0;
}

.secondary-item .meta {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--red);
    text-transform: uppercase;
    margin-top: 8px;
}

/* ---------- Tag cloud ---------- */

.tagcloud {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 12px 16px;
}

.tagcloud a {
    white-space: nowrap;
    color: var(--ink);
    line-height: 1.3;
}

.tagcloud a:hover {
    color: var(--red);
}

.tagcloud .tag-xl {
    font-family: var(--serif-display);
    font-weight: 700;
}

.tagcloud .tag-lg {
    font-family: var(--serif-display);
    font-weight: 700;
    color: var(--ink);
}

.tagcloud .tag-md {
    font-family: var(--serif-text);
    font-weight: 400;
    color: var(--ink);
}

.tagcloud .tag-sm {
    font-family: var(--serif-text);
    font-weight: 400;
    color: var(--secondary);
}

.tagcount {
    font-family: var(--sans);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.5px;
}

/* ---------- Latest articles (homepage) ---------- */

.latest-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.latest-item {
    text-align: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--hairline);
}

.latest-list .latest-item:last-child {
    border-bottom: none;
}

.latest-item .headline {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 23px;
    line-height: 31px;
    color: var(--ink);
}

.latest-item .headline a:hover {
    color: var(--red);
}

.latest-item .snippet {
    font-family: var(--serif-text);
    font-size: 15px;
    line-height: 22px;
    color: var(--secondary);
    max-width: 860px;
    margin: 6px auto 0;
}

.metarow {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.metarow .date {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--red);
    text-transform: uppercase;
}

.tagchip {
    display: inline-block;
    border: 1px solid var(--hairline);
    padding: 5px 10px;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--ink);
    white-space: nowrap;
}

a.tagchip:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ---------- List page (All Articles) ---------- */

.pagetitle-block {
    text-align: center;
    margin-bottom: 24px;
}

.pagetitle-block h1 {
    font-family: var(--serif-display);
    font-weight: 800;
    font-size: 46px;
    line-height: 58px;
    color: var(--ink);
}

.pagetitle-block .subtitle {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--meta);
    text-transform: uppercase;
    margin-top: 8px;
}

.rule-double-2 {
    border-top: 3px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    height: 5px;
    margin-bottom: 26px;
}

.featured {
    text-align: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 22px;
}

.featured .headline {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 30px;
    line-height: 38px;
    color: var(--ink);
    margin: 10px auto 0;
    max-width: 980px;
}

.featured .snippet {
    font-family: var(--serif-text);
    font-size: 16px;
    line-height: 24px;
    color: var(--secondary);
    max-width: 820px;
    margin: 10px auto 0;
}

.featured .meta {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--red);
    text-transform: uppercase;
    margin-top: 10px;
}

.article-rows {
    display: flex;
    flex-direction: column;
}

.article-row {
    text-align: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--hairline);
}

.article-row .headline {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 21px;
    line-height: 28px;
    color: var(--ink);
}

.article-row .snippet {
    font-family: var(--serif-text);
    font-size: 15px;
    line-height: 22px;
    color: var(--secondary);
    max-width: 860px;
    margin: 6px auto 0;
}

.article-row .meta {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--red);
    text-transform: uppercase;
    margin-top: 8px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 26px 0 0;
}

.pagination a {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--meta);
    border: 1px solid var(--hairline);
    padding: 8px 14px;
    text-transform: uppercase;
}

.pagination a:hover {
    border-color: var(--red);
    color: var(--red);
}

.pagination a.cur {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}

/* ---------- Tags page ---------- */

.alphabet-strip {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 6px;
    color: var(--meta);
    text-align: center;
    text-transform: uppercase;
    padding: 4px 0 26px;
}

.tags-columns {
    display: flex;
    gap: 48px;
}

.tags-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tag-group {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.tag-group .letter {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 34px;
    line-height: 1;
    color: var(--ink);
    width: 44px;
    flex-shrink: 0;
}

.tag-group .cloud {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 12px;
}

.tag-group .cloud a {
    white-space: nowrap;
    color: var(--ink);
    line-height: 1.3;
}

.tag-group .cloud a:hover {
    color: var(--red);
}

.tag-group .cloud .tag-xl,
.tag-group .cloud .tag-lg {
    font-family: var(--serif-display);
    font-weight: 700;
}

.tag-group .cloud .tag-md {
    font-family: var(--serif-text);
    font-weight: 400;
    color: var(--ink);
}

.tag-group .cloud .tag-sm {
    font-family: var(--serif-text);
    font-weight: 400;
    color: var(--secondary);
}

/* ---------- Search page ---------- */

.searchbar {
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px solid var(--ink);
    background: var(--white);
    padding: 8px 8px 8px 18px;
    margin-bottom: 22px;
}

.searchbar input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--serif-text);
    font-style: italic;
    font-size: 16px;
    color: var(--body);
}

.searchbar input[type="text"]::placeholder {
    color: var(--muted);
    font-style: italic;
}

.searchbar button {
    border: none;
    outline: none;
    cursor: pointer;
    background: var(--ink);
    color: var(--white);
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 14px 20px;
    text-transform: uppercase;
}

.searchbar button:hover {
    background: var(--red);
}

.results-meta {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--red);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.search-results {
    display: flex;
    flex-direction: column;
}

.search-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--hairline);
}

.search-item .meta {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

.search-item .headline {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 22px;
    line-height: 28px;
    color: var(--ink);
    margin-top: 8px;
}

.search-item .headline a:hover {
    color: var(--red);
}

.search-item .snippet {
    font-family: var(--serif-text);
    font-size: 14px;
    line-height: 22px;
    color: var(--secondary);
    margin-top: 8px;
}

.search-empty {
    text-align: center;
    padding: 30px 0;
    font-family: var(--serif-italic);
    font-style: italic;
    font-size: 16px;
    color: var(--meta);
}

.popular-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 24px;
}

.popular-row .label {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

/* ---------- Article detail ---------- */

.article-layout {
    display: flex;
    gap: 36px;
    align-items: stretch;
}

.article-main {
    flex: 1;
    min-width: 0;
}

.article-divider {
    width: 1px;
    background: var(--hairline);
    flex-shrink: 0;
}

.article-main h1 {
    font-family: var(--serif-display);
    font-weight: 800;
    font-size: 40px;
    line-height: 48px;
    color: var(--ink);
    margin-top: 14px;
}

.article-main .deck {
    font-family: var(--serif-italic);
    font-style: italic;
    font-size: 19px;
    line-height: 29px;
    color: var(--deck);
    margin-top: 14px;
}

.article-byline {
    margin-top: 16px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.article-byline .date {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--meta);
    text-transform: uppercase;
}

.article-byline .views::before {
    content: '\00B7';
    margin-right: 12px;
    font-weight: 700;
}

.rule-double-3 {
    border-top: 3px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    height: 5px;
    margin: 16px 0 20px;
}

.article-content {
    font-family: var(--serif-text);
    font-size: 16px;
    line-height: 28px;
    color: var(--body);
}

.article-content p {
    margin-bottom: 18px;
}

.article-content p:first-of-type::first-letter {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 58px;
    line-height: 0.85;
    float: left;
    padding: 6px 12px 0 0;
    color: var(--ink);
}

.article-content a {
    color: var(--red);
    text-decoration: underline;
}

.article-tags {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--meta);
    text-transform: uppercase;
    margin-top: 22px;
    border-top: 1px solid var(--hairline);
    padding-top: 16px;
}

.article-tags a {
    color: var(--red);
}

/* ---------- Sidebar ---------- */

.article-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 18px;
    align-self: flex-start;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.article-sidebar::-webkit-scrollbar {
    width: 4px;
}

.article-sidebar::-webkit-scrollbar-thumb {
    background: var(--hairline);
}

.sidebar-block .sidebar-label {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 4px;
    color: var(--ink);
    text-transform: uppercase;
}

.sidebar-block .sidebar-rule {
    height: 2px;
    background: var(--ink);
    margin: 12px 0 16px;
}

.mostread-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 9px 0;
}

.mostread-item .num {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 20px;
    line-height: 1.2;
    color: var(--ink);
    width: 22px;
    flex-shrink: 0;
}

.mostread-item:first-of-type .num {
    color: var(--red);
}

.mostread-item .title {
    font-family: var(--serif-text);
    font-size: 14px;
    line-height: 21px;
    color: var(--ink);
}

.mostread-item .title a:hover {
    color: var(--red);
}

/* ---------- Sidebar: in-article section navigation ---------- */

.toc-block {
    position: static;
}

.toc-block .toc-now {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--hairline);
}

.toc-block .toc-now-label {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--red);
    text-transform: uppercase;
}

.toc-block .toc-now-title {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 15px;
    line-height: 21px;
    color: var(--ink);
}

.toc-nav {
    display: flex;
    flex-direction: column;
}

.toc-link {
    position: relative;
    display: flex;
    gap: 9px;
    align-items: baseline;
    padding: 8px 0 8px 9px;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--hairline);
    color: var(--secondary);
    font-family: var(--serif-text);
    font-size: 13.5px;
    line-height: 19px;
    transition: color .15s ease, border-color .15s ease;
}

.toc-link:last-child {
    border-bottom: none;
}

.toc-link .toc-num {
    flex-shrink: 0;
    width: 16px;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 9.5px;
    letter-spacing: 1px;
    color: var(--muted);
    padding-top: 2px;
}

.toc-link.toc-l3 {
    padding-left: 28px;
    font-size: 12.5px;
    color: var(--meta);
}

.toc-link:hover {
    color: var(--red);
}

.toc-link:hover .toc-text {
    text-decoration: underline;
}

.toc-link.active {
    color: var(--ink);
    font-weight: 700;
    border-left-color: var(--red);
}

.toc-link.active .toc-num {
    color: var(--red);
}

.toc-block .toc-progress {
    height: 2px;
    margin-top: 14px;
    background: var(--hairline);
}

.toc-block .toc-progress span {
    display: block;
    height: 2px;
    width: 0;
    background: var(--red);
    transition: width .12s linear;
}

.toc-block .toc-empty {
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--muted);
    text-transform: uppercase;
}

.article-content h2,
.article-content h3 {
    scroll-margin-top: 24px;
}

.stats-box {
    border: 2px solid var(--ink);
    background: var(--white);
    padding: 22px;
}

.stats-box .stats-title {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 22px;
    color: var(--ink);
    margin-bottom: 14px;
}

.stats-box .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--hairline);
}

.stats-box .stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stats-box .stat-label {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--meta);
    text-transform: uppercase;
}

.stats-box .stat-value {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
}

/* ---------- Single page ---------- */

.page-content {
    font-family: var(--serif-text);
    font-size: 16px;
    line-height: 28px;
    color: var(--body);
    max-width: 900px;
    margin: 0 auto;
}

.page-content p {
    margin-bottom: 18px;
}

/* ---------- Footer ---------- */

.footer {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 36px 36px;
}

.footer .footer-rule {
    height: 3px;
    background: var(--ink);
    margin-bottom: 16px;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-row span,
.footer-row a {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--secondary);
    text-transform: uppercase;
}

.footer-row a:hover {
    color: var(--red);
}

/* ===== 标签详情视图（tags.html?tag=xxx） ===== */
.tag-backlink {
    text-align: center;
    margin: 28px 0 4px;
}
.tag-backlink a {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
}
.tag-backlink a:hover {
    color: var(--red);
}
.tag-articles {
    margin-top: 24px;
}

/* ===== 浏览量 ===== */
.article-byline .views {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--meta);
    text-transform: uppercase;
}

/* ===== 列表项标签行（独立于日期行） ===== */
.tagrow {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.tagrow .tagchip {
    margin: 0;
}

/* ===== 首页最新文章：滚动加载 ===== */
.latest-item.hidden-item {
    display: none;
}
.latest-item.revealed-item {
    animation: latestReveal .4s ease both;
}
@keyframes latestReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.latest-sentinel {
    height: 1px;
}
.latest-morewrap {
    text-align: center;
    margin-top: 24px;
}
.latest-end {
    display: none;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

/* ===== SEO 语义化标签 ===== */
h2.headline {
    margin: 0;
}
article.featured h2.headline,
article.article-row h2.headline,
article.secondary-item h2.headline,
article.latest-item h2.headline {
    margin: 0 auto;
}
article.featured h2.headline {
    margin: 10px auto 0;
}
