/*
Theme Name: Knowlesta
Theme URI: https://knowlesta.com/
Author: Knowlesta
Description: A reading room of long essays on the history of money and digital cash, built on primary sources. Educational only.
Version: 1.0.0
Requires PHP: 7.4
Text Domain: knowlesta
*/

:root {
  --paper: #FAF5F0;
  --paper-2: #F3EBE1;
  --sheet: #FFFDF9;
  --ink: #2B2622;
  --ink-2: #4A423C;
  --muted: #6B6058;
  --wine: #7A2E2E;
  --wine-2: #5E2222;
  --gold: #B08D57;
  --rule: #E6DCCF;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --column: 680px;
  --wide: 1120px;
  --cc-bg: #FFFDF9; --cc-fg: #2B2622; --cc-btn-bg: #7A2E2E; --cc-btn-fg: #FFFDF9; --cc-focus: #B08D57; --cc-border: #E6DCCF;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 19px/1.72 var(--serif); overflow-x: hidden;
  font-kerning: normal; font-variant-ligatures: common-ligatures; text-rendering: optimizeLegibility; overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--wine); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: var(--gold); }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.18; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.35rem); margin: .25em 0 .35em; font-weight: 500; }
h2 { font-size: clamp(1.45rem, 3vw, 1.95rem); margin: 1.9em 0 .55em; font-weight: 500; }
h3 { font-size: 1.2rem; margin: 1.4em 0 .4em; }
p { margin: 0 0 1.05em; }
cite { font-style: italic; }

.shell { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 16px; }
.column { max-width: calc(var(--column) + 32px); }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }
.muted, .meta { color: var(--muted); font-size: .86rem; }
.eyebrow, .section-label, .part-num, .t-date, .toc-title, .footer-title, .masthead-note, .kind {
  font-variant: small-caps; text-transform: lowercase; letter-spacing: .12em; font-size: .95rem; color: var(--wine); font-weight: 600;
}
.eyebrow { margin: 0; }
.standfirst { font-size: 1.22rem; line-height: 1.55; color: var(--ink-2); font-style: italic; }

/* шапка: журнальный «мастхед» */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); position: relative; }
.masthead::after { content: ""; display: block; height: 3px; border-top: 1px solid var(--rule); margin-top: 3px; }
.masthead-inner { display: grid; grid-template-columns: 1fr; justify-items: center; padding-top: 14px; padding-bottom: 6px; }
.masthead-note { margin: 0; font-size: .82rem; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); margin: 4px 0 8px; }
.brand .mark { width: 38px; height: 38px; }
.brand-name { font-size: 2.1rem; letter-spacing: .06em; font-weight: 500; }
.nav { display: flex; gap: 0; flex-wrap: wrap; justify-content: center; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 16px; font-size: 1rem; letter-spacing: .03em; }
.nav a + a { border-left: 1px solid var(--rule); }
.nav a:hover { color: var(--wine); }
.menu-toggle { display: none; background: none; border: 1px solid var(--rule); padding: 6px 14px; font: 600 .95rem var(--serif); color: var(--ink); cursor: pointer; }

/* кнопки */
.btn { display: inline-block; background: var(--wine); color: var(--sheet); border: 1px solid var(--wine); padding: 11px 24px; font: 600 1rem/1.3 var(--serif); letter-spacing: .03em; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--wine-2); border-color: var(--wine-2); color: var(--sheet); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-quiet:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* главная: hero */
.hero { padding: 46px 0 36px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.3em 0 1.1em; }
.hero-note { font-size: .9rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; max-width: 560px; }
.hero-art svg, .hero-art img { width: 100%; background: var(--sheet); }

.section { padding: 46px 0 34px; }
.section h2:first-child { margin-top: 0; }
.section-lead { color: var(--muted); max-width: 640px; }
.section-tint { background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.section-rule { border-top: 1px solid var(--rule); }
.section-label { font-size: 1.05rem; margin: 0 0 14px; }

.feature { display: grid; grid-template-columns: 120px 1fr; gap: 28px; background: var(--sheet); border: 1px solid var(--rule); border-top: 3px double var(--gold); padding: 28px 32px 18px; }
.feature-num { font-size: 6rem; line-height: .9; color: var(--gold); margin: 0; font-weight: 400; text-align: center; }
.feature h3 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: .2em 0 .35em; font-weight: 500; }
.feature h3 a, .essay-grid h3 a, .essay-list h3 a { color: var(--ink); text-decoration: none; }
.feature h3 a:hover, .essay-grid h3 a:hover, .essay-list h3 a:hover { color: var(--wine); }
.feature-toc { font-size: .92rem; color: var(--muted); }
.feature-toc span { color: var(--wine); font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; }

.essay-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.essay-grid li { border-top: 1px solid var(--rule); padding: 18px 0 8px; }
.essay-grid h3 { margin: .1em 0 .35em; font-size: 1.32rem; font-weight: 500; }
.essay-grid p { font-size: .98rem; color: var(--ink-2); }
.essay-num { font-size: .9rem; color: var(--gold); margin: 0; font-variant-numeric: oldstyle-nums; letter-spacing: .1em; }

.timeline { list-style: none; padding: 0 0 0 26px; margin: 10px 0 24px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; border-left: 1px solid var(--gold); }
.timeline li { position: relative; padding: 0 0 18px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 9px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 1px solid var(--wine); }
.timeline h3 { margin: 0 0 .2em; font-size: 1.12rem; }
.timeline p { margin: 0 0 .3em; }
.t-date { margin: 0; font-size: .92rem; }
.t-essay { display: block; font-size: .88rem; color: var(--muted); margin-top: 4px; }

.books { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin-bottom: 22px; }
.book { background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--wine); padding: 18px 18px 8px; }
.book h3 { margin: .1em 0 .3em; font-size: 1.08rem; font-style: italic; font-weight: 500; }
.book-year { margin: 0; color: var(--gold); font-size: .9rem; letter-spacing: .1em; }
.book-author { font-size: .88rem; color: var(--muted); }
.book p:last-child { font-size: .93rem; }

.principles { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.principles li { border-top: 1px solid var(--ink); padding-top: 12px; }
.principles h3 { margin: .2em 0 .4em; font-size: 1.12rem; }
.principles p { font-size: .96rem; color: var(--ink-2); }
.roman { color: var(--gold); font-size: 1.4rem; }

.faq details { border-bottom: 1px solid var(--rule); }
.faq details:first-child { border-top: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; position: relative; padding-right: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; color: var(--wine); font-size: 1.2rem; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; color: var(--ink-2); }

/* внутренние страницы */
.page-head { padding: 34px 0 20px; border-bottom: 1px solid var(--rule); margin-bottom: 26px; }
.crumbs ol { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; font-size: .84rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--gold); }
.crumbs a { color: var(--muted); }
.prose { padding-bottom: 20px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin-bottom: .45em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0 1.5em; font-size: .9rem; line-height: 1.5; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 9px 10px; text-align: left; vertical-align: top; }
.prose th { color: var(--wine); font-weight: 600; }
.kv th { width: 36%; }
.note { background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--wine); padding: 12px 16px; }

/* эссе */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 0; background: var(--wine); }
.essay-head h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); }
.toc { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 12px 0 6px; margin: 0 0 30px; }
.toc-title { margin: 0 0 6px; }
.toc ol { margin: 0; padding-left: 22px; columns: 2; column-gap: 32px; font-size: .95rem; }
.toc li { margin-bottom: .3em; break-inside: avoid; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover, .toc a.is-current { color: var(--wine); text-decoration: underline; }
.essay-body h2, .keydates h2, .reading h2 { scroll-margin-top: 20px; }
.essay-body > p:first-of-type::first-letter {
  float: left; font-size: 4.6em; line-height: .82; padding: .06em .08em 0 0; color: var(--wine); font-weight: 500;
}
.pull { margin: 2em 0; padding: 18px 0 14px; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); text-align: center; }
.pull p { font-size: 1.38rem; line-height: 1.45; font-style: italic; color: var(--wine); margin: 0 auto .4em; max-width: 560px; }
.pull .pull-src { font-size: .85rem; font-style: normal; color: var(--muted); margin: 0; }
.keydates { background: var(--sheet); border: 1px solid var(--rule); padding: 4px 24px 10px; margin: 34px 0 10px; }
.keydates h2 { margin-top: .7em; font-size: 1.4rem; }
.keydates dl { margin: 0 0 8px; }
.keydates dl div { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 8px 0; border-top: 1px solid var(--rule); }
.keydates dt { color: var(--wine); font-weight: 600; font-size: .95rem; }
.keydates dd { margin: 0; font-size: .97rem; }
.reading h2 { font-size: 1.4rem; }
.reading ul { padding-left: 20px; font-size: .95rem; }
.reading li { margin-bottom: .55em; }
.more-link { font-size: .92rem; }
.essay-disclaimer { font-size: .86rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 24px; font-style: italic; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid var(--ink); padding-top: 16px !important; padding-bottom: 30px !important; margin-top: 20px; }
.pager a { text-decoration: none; color: var(--ink); font-size: 1.02rem; }
.pager a:hover { color: var(--wine); }
.pager span { display: block; font-variant: small-caps; text-transform: lowercase; letter-spacing: .12em; color: var(--wine); font-size: .85rem; }
.pager-next { text-align: right; }

/* список эссе */
.part { margin-bottom: 26px; }
.part-num { margin: 22px 0 0; }
.part h2 { margin-top: .1em; }
.part-lead { color: var(--muted); }
.essay-list { list-style: none; padding: 0; margin: 0; }
.essay-list li { display: grid; grid-template-columns: 54px 1fr; gap: 14px; border-top: 1px solid var(--rule); padding: 16px 0 4px; }
.essay-list .essay-num { font-size: 2rem; line-height: 1; padding-top: 8px; }
.essay-list h3 { margin: .1em 0 .3em; font-size: 1.32rem; font-weight: 500; }
.essay-list p { font-size: .98rem; color: var(--ink-2); }

/* хронология, библиотека, люди */
.era-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; margin-top: 8px; }
.era-nav a { color: var(--muted); }
.era h2, .shelf h2 { scroll-margin-top: 20px; }
.era-range { display: block; font-size: .9rem; color: var(--gold); letter-spacing: .08em; margin-top: 4px; }
.biblio { list-style: none; padding: 0; margin: 0; }
.biblio li { border-top: 1px solid var(--rule); padding: 14px 0 4px; }
.cite { margin: 0 0 .3em; }
.b-author { font-variant: small-caps; letter-spacing: .03em; }
.annot { font-size: .95rem; color: var(--ink-2); margin-bottom: .35em; }
.kind { font-size: .82rem; margin-right: 6px; }
.b-links { font-size: .88rem; color: var(--muted); }
.person { border-top: 1px solid var(--rule); padding-top: 6px; scroll-margin-top: 20px; }
.person h2 { margin: .5em 0 .1em; }
.person-meta { color: var(--wine); font-size: .95rem; font-style: italic; }

/* подвал */
.site-footer { background: var(--ink); color: #D9CFC4; margin-top: 40px; padding: 34px 0 20px; font-size: .92rem; line-height: 1.6; }
.site-footer a { color: #F3EBE1; }
.footer-disclaimer { border-top: 1px solid var(--gold); border-bottom: 1px solid rgba(176,141,87,.4); padding: 14px 0; margin-bottom: 24px; }
.footer-disclaimer p { margin: 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; color: #FFFDF9; letter-spacing: .05em; margin-bottom: .4em; }
.footer-brand .mark { width: 32px; height: 32px; }
.footer-col { display: flex; flex-direction: column; gap: 4px; }
.footer-col a { text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.site-footer .footer-title { color: var(--gold); margin-bottom: .3em; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 6px 0; border-top: 1px solid rgba(217,207,196,.2); margin-top: 22px; padding-top: 14px; }
.footer-legal a { text-decoration: none; padding: 0 12px; border-left: 1px solid rgba(217,207,196,.3); font-size: .88rem; }
.footer-legal a:first-child { padding-left: 0; border-left: 0; }
.footer-legal a:hover { text-decoration: underline; }
.copyright { margin: 14px 0 0; font-size: .8rem; color: #A99D92; }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 520px; }
  .books, .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 18px; }
  .masthead-inner { grid-template-columns: 1fr auto; justify-items: start; align-items: center; padding-bottom: 10px; }
  .masthead-note { display: none; }
  .brand { margin: 0; }
  .brand-name { font-size: 1.6rem; }
  .menu-toggle { display: block; }
  .nav { display: none; grid-column: 1 / -1; flex-direction: column; width: 100%; margin-top: 8px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 0; border-top: 1px solid var(--rule); }
  .nav a + a { border-left: 0; }
  .essay-grid, .books, .principles, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .feature { grid-template-columns: 1fr; padding: 20px 18px 10px; gap: 6px; }
  .feature-num { font-size: 3.4rem; text-align: left; }
  .toc ol { columns: 1; }
  .keydates { padding: 4px 16px 8px; }
  .keydates dl div { grid-template-columns: 1fr; gap: 2px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
  .standfirst { font-size: 1.12rem; }
  .pull p { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  .masthead nav, .menu-toggle, .site-footer, .pager, .read-progress, .toc { display: none; }
  body { background: #fff; font-size: 12pt; }
}
