/* Rehes — архив истории науки.
   Макет: постоянная колонка-указатель слева, текст справа.
   Никаких карточек — списки набраны как оглавление книги, с выносками. */

:root {
    --paper:     #f7f4ee;
    --paper-2:   #efe9de;
    --ink:       #1d2a35;
    --ink-2:     #4d5a66;
    --rule:      #d8cfbf;
    --accent:    #8a5a2b;
    --accent-lt: #b98a52;
    --rail-bg:   #1d2a35;
    --rail-fg:   #cfd7de;
    --rail-dim:  #8b98a4;
    --rail-w:    286px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 17px/1.7 Georgia, 'Iowan Old Style', 'Times New Roman', serif;
}

.glyph-sprite { display: none; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

h1, h2, h3 { font-weight: normal; line-height: 1.22; }
h1 { font-size: 2.15rem; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 {
    font-size: 1.28rem;
    margin: 2.2em 0 .7em;
    padding-bottom: .35em;
    border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.08rem; margin: 1.8em 0 .5em; }
img { max-width: 100%; height: auto; }

/* --- каркас --- */

.shell { display: flex; align-items: flex-start; min-height: 100vh; }

.column {
    flex: 1;
    min-width: 0;
    max-width: 900px;
    padding: 46px 48px 0;
}

/* --- колонка-указатель --- */

.rail {
    width: var(--rail-w);
    flex: 0 0 var(--rail-w);
    align-self: stretch;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    background: var(--rail-bg);
    color: var(--rail-fg);
    padding: 28px 22px 32px;
}

.mast {
    display: block;
    text-decoration: none;
    color: inherit;
    padding-bottom: 20px;
    border-bottom: 3px double var(--rail-dim);
}
.mast img { display: block; margin-bottom: 10px; }
.mast-name {
    display: block;
    font-size: 1.5rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #fff;
}
.mast-sub {
    display: block;
    margin-top: 4px;
    font-size: .82rem;
    font-style: italic;
    color: var(--rail-dim);
}

.rail-label {
    margin: 24px 0 8px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .68rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--rail-dim);
}

.rail-sections, .rail-pages { list-style: none; margin: 0; padding: 0; }

.rail-sections a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 0;
    color: var(--rail-fg);
    text-decoration: none;
    font-size: .93rem;
    line-height: 1.3;
}
.rail-sections .g {
    width: 17px; height: 17px;
    flex: 0 0 17px;
    fill: none;
    stroke: var(--rail-dim);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.rail-sections .t { flex: 1; }
.rail-sections .n {
    font-family: Arial, Helvetica, sans-serif;
    font-size: .72rem;
    color: var(--rail-dim);
}
.rail-sections a:hover, .rail-sections .on > a { color: #fff; }
.rail-sections a:hover .g, .rail-sections .on > a .g { stroke: var(--accent-lt); }
.rail-sections .on > a .t { text-decoration: underline; text-underline-offset: 3px; }

.rail-more { margin: 12px 0 0; font-size: .86rem; }
.rail-more a { color: var(--accent-lt); text-decoration: none; }
.rail-more a:hover { color: #fff; }

.rail-pages li { margin-bottom: 5px; }
.rail-pages a { color: var(--rail-fg); text-decoration: none; font-size: .93rem; }
.rail-pages a:hover, .rail-pages .on > a { color: #fff; text-decoration: underline; }

/* --- надзаголовок вместо хлебных крошек --- */

.overline {
    margin: 0 0 22px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .7rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink-2);
}
.overline a { color: inherit; text-decoration: none; }
.overline a:hover { color: var(--accent); }
.overline .sep { margin: 0 8px; color: var(--rule); }

/* --- текст --- */

main { max-width: 42em; }
main p { margin: 0 0 1.15em; }

.lead {
    font-size: 1.13rem;
    line-height: 1.62;
    color: var(--ink-2);
    border-left: 3px solid var(--accent);
    padding-left: 18px;
    margin-bottom: 1.6em;
}

.byline {
    margin: -.2em 0 2em;
    padding-bottom: .8em;
    border-bottom: 1px solid var(--rule);
    font-family: Arial, Helvetica, sans-serif;
    font-size: .84rem;
    color: var(--ink-2);
}
.byline b { color: var(--ink); font-weight: 600; }
.byline a { color: var(--ink-2); }

blockquote {
    margin: 1.6em 0;
    padding-left: 1.2em;
    border-left: 3px solid var(--rule);
    color: var(--ink-2);
    font-style: italic;
}

/* --- титул главной --- */

.masthead {
    border-top: 3px double var(--ink);
    border-bottom: 3px double var(--ink);
    padding: 26px 0 22px;
    margin-bottom: 34px;
    max-width: 42em;
}
.masthead h1 { font-size: 2.5rem; margin: 0 0 .3em; }
.masthead p { margin: 0; color: var(--ink-2); font-size: 1.08rem; }

.figures { display: block; margin: 26px 0 0; }

/* --- указатель материалов (оглавление с выносками) --- */

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc > li > a {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: var(--ink);
}
.toc .num {
    flex: 0 0 2.2em;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .74rem;
    color: var(--ink-2);
    letter-spacing: .04em;
}
.toc .name { flex: 0 1 auto; }
.toc > li > a:hover .name { color: var(--accent); text-decoration: underline; }
.toc .dots {
    flex: 1 1 auto;
    min-width: 1.5em;
    align-self: center;
    border-bottom: 1px dotted var(--rule);
    transform: translateY(-.15em);
}
.toc .who {
    flex: 0 0 auto;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .78rem;
    color: var(--ink-2);
    white-space: nowrap;
}

/* Знак раздела в заголовке. Без явных размеров встроенный svg
   разворачивается на всю ширину — поэтому они заданы жёстко. */
.title-glyph {
    width: 30px; height: 30px;
    vertical-align: -3px;
    margin-right: 8px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- перечень разделов на главной и в указателе --- */

.sections { list-style: none; margin: 0; padding: 0; }
.sections > li {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--rule);
}
.sections .g {
    width: 30px; height: 30px;
    flex: 0 0 30px;
    margin-top: 3px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sections h3 { margin: 0 0 .2em; font-size: 1.1rem; }
.sections h3 a { text-decoration: none; color: var(--ink); }
.sections h3 a:hover { color: var(--accent); }
.sections p { margin: 0; font-size: .93rem; color: var(--ink-2); line-height: 1.55; }
.sections .count {
    display: block;
    margin-top: .35em;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .76rem;
    color: var(--ink-2);
}

/* --- блок раздела в указателе --- */

.chapter { margin: 0 0 42px; }
.chapter > h2 { margin-top: 0; }
.chapter .intro { font-size: .95rem; color: var(--ink-2); margin: -.3em 0 1em; }

/* --- врезки --- */

.note {
    margin: 2em 0;
    padding: 16px 20px;
    background: var(--paper-2);
    border-left: 3px solid var(--accent);
    font-size: .96rem;
}
.note p:last-child { margin-bottom: 0; }

.origin {
    margin: 3em 0 0;
    padding-top: 18px;
    border-top: 3px double var(--rule);
    font-size: .9rem;
    color: var(--ink-2);
}
.origin b { color: var(--ink); }

/* --- картинки --- */

.wp-block-image { margin: 2em 0; }
.wp-block-image img {
    display: block;
    width: 100%;
    border: 1px solid var(--rule);
    background: #fff;
}
.wp-block-image figcaption {
    margin-top: .6em;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .8rem;
    line-height: 1.5;
    color: var(--ink-2);
}

/* --- подвал --- */

.colophon {
    margin: 64px 0 0;
    padding: 22px 0 40px;
    border-top: 1px solid var(--rule);
    font-size: .86rem;
    color: var(--ink-2);
    max-width: 42em;
}
.colophon p { margin: 0 0 .8em; }
.colophon-links a { margin-right: 16px; white-space: nowrap; }
.colophon-rule {
    font-family: Arial, Helvetica, sans-serif;
    font-size: .76rem;
    letter-spacing: .1em;
    color: var(--rule);
}

/* --- узкий экран: колонка уходит наверх и сжимается --- */

@media (max-width: 900px) {
    .shell { display: block; }
    .rail {
        width: auto;
        position: static;
        max-height: none;
        padding: 22px 20px 24px;
    }
    .mast { padding-bottom: 14px; }
    .mast img { width: 38px; height: 38px; }
    .mast-name { font-size: 1.3rem; }
    /* Список из шестнадцати разделов на телефоне только мешает —
       вместо него ссылка на полный указатель. */
    .rail-sections { display: none; }
    .rail-label:first-of-type { display: none; }
    .rail-more { margin-top: 16px; font-size: .95rem; }
    .rail-pages { display: flex; flex-wrap: wrap; gap: 4px 18px; }
    .rail-pages li { margin: 0; }
    .column { padding: 30px 20px 0; max-width: none; }
    h1 { font-size: 1.65rem; }
    .masthead h1 { font-size: 1.85rem; }
    .masthead { padding: 20px 0 18px; margin-bottom: 26px; }
    .toc > li > a { flex-wrap: wrap; }
    .toc .dots { display: none; }
    /* На узком экране выноска переносится под строку, и запрет переноса
       внутри неё выталкивал длинные подписи за край экрана. */
    /* Отступ именно внутренний: внешний прибавлялся бы к базе в 100%
       и выталкивал строку за край экрана. */
    .toc .who { flex-basis: 100%; padding-left: 3em; white-space: normal; }
    .toc .name { overflow-wrap: anywhere; }
    .colophon-links a { display: inline-block; margin-bottom: 4px; }
}
