/*
Theme Name: dds_jurinica.ru
Theme URI: https://jurinica.ru/
Author: Марина Григорьева
Description: Тема информационно-образовательной платформы для специалистов библиотечного и архивного дела: переплётная кожа, бумага верже, золотое тиснение, каталожные карточки.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: jurin
*/

/* ---------- Служебные правила hidden ---------- */
.cookie-banner[hidden] { display: none !important; }
.mainnav-list[hidden] { display: none !important; }

:root {
    --leather: #1B3A2F;
    --marble: #14261F;
    --cloth: #22302A;
    --plate: #16211B;
    --paper: #E8DFC8;
    --paper-deep: #DCCFB0;
    --ink: #241C14;
    --ink-soft: #3A2E22;
    --ink-muted: #6B5B45;
    --on-dark: #EDE3C8;
    --on-dark-muted: #A79B7A;
    --gold: #C9A227;
    --gold-light: #E3CB86;
    --wax: #8C2F22;
    --green: #2F5D45;
    --line-brown: #6B5B45;
    --f-title: "Old Standard TT", "PT Serif", Georgia, "Times New Roman", serif;
    --f-text: "PT Serif", Georgia, "Times New Roman", serif;
    --f-hand: "Marck Script", "Segoe Script", cursive;
    --grain: url("images/tex-grain.png");
    --paper-tex: url("images/tex-paper.webp");
    --marble-tex: url("images/tex-marble.webp");
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
    margin: 0;
    overflow-x: hidden;
    background-color: var(--marble);
    background-image: var(--grain), var(--marble-tex);
    background-size: 128px 128px, 512px 512px;
    color: var(--on-dark);
    font-family: var(--f-text);
    font-size: 1.0625rem;
    line-height: 1.65;
}

p, li, h1, h2, h3, h4, h5, h6, dd, dt, td, th, figcaption, blockquote {
    overflow-wrap: break-word;
    hyphens: auto;
}

p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }
a { color: inherit; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--f-title);
    font-weight: 400;
    line-height: 1.15;
    margin: 0 0 .6em;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}
.skip-link {
    position: absolute;
    left: 1rem; top: -4rem;
    z-index: 100;
    background: var(--paper);
    color: var(--ink);
    padding: .6rem 1rem;
    border: 1px solid var(--gold);
}
.skip-link:focus { top: 1rem; }

/* ---------- Контейнер ---------- */
.shell { width: min(92%, 1180px); margin-inline: auto; }
@media (min-width: 960px) {
    .shell { width: min(85%, 1180px); }
}

/* ---------- Переплёт: корешок и золотая линия ---------- */
.binding { position: relative; min-height: 100vh; }
@media (min-width: 960px) {
    .binding { padding-left: 92px; }
    .binding::before {
        content: "";
        position: absolute;
        top: 0; bottom: 0; left: 0;
        width: 72px;
        background-image:
            var(--grain),
            linear-gradient(to bottom,
                transparent 0 330px,
                rgba(201, 162, 39, .55) 330px 332px, #0E1C16 332px 346px, rgba(201, 162, 39, .55) 346px 348px,
                transparent 348px 430px,
                rgba(201, 162, 39, .55) 430px 432px, #0E1C16 432px 446px, rgba(201, 162, 39, .55) 446px 448px,
                transparent 448px 530px,
                rgba(201, 162, 39, .55) 530px 532px, #0E1C16 532px 546px, rgba(201, 162, 39, .55) 546px 548px,
                transparent 548px 630px,
                rgba(201, 162, 39, .55) 630px 632px, #0E1C16 632px 646px, rgba(201, 162, 39, .55) 646px 648px,
                transparent 648px),
            linear-gradient(90deg, #0C1A14 0, #1A3A2E 28%, #24493B 52%, #183428 78%, #0B1712 100%);
        background-size: 128px 128px, 100% 100%, 100% 100%;
        background-repeat: repeat, no-repeat, no-repeat;
        box-shadow: inset -3px 0 6px rgba(0, 0, 0, .45);
    }
    .binding::after {
        content: "";
        position: absolute;
        top: 0; bottom: 0; left: 86px;
        width: 2px;
        background: var(--gold);
        opacity: .85;
    }
}

/* ---------- Шапка ---------- */
.masthead {
    background-color: var(--leather);
    background-image: var(--grain);
    background-size: 128px 128px;
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .5);
    padding: 2.2rem 0;
}
.masthead-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 2.2rem;
}
.brand-mark { display: block; line-height: 0; }
.brand-svg { display: block; width: 104px; height: auto; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.brand-logo { display: block; max-width: 120px; max-height: 130px; width: auto; height: auto; }
.brand-text { min-width: 0; }
.site-title {
    display: block;
    font-family: var(--f-title);
    font-size: clamp(1.5rem, 2.5vw, 2.35rem);
    line-height: 1.12;
    color: var(--gold-light);
    text-decoration: none;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .55), 0 -1px 0 rgba(255, 236, 170, .12);
    max-width: 30ch;
}
.site-title:hover { color: #F1DEA3; }
.site-desc {
    margin: .8rem 0 0;
    font-size: .92rem;
    line-height: 1.5;
    color: var(--on-dark);
    max-width: 68ch;
    opacity: .92;
}

.mainnav { position: relative; }
.nav-toggle { display: none; }
.mainnav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 13rem;
}
.mainnav-list li { position: relative; padding: .5rem 0; }
.mainnav-list li + li { border-top: 1px solid rgba(201, 162, 39, .5); }
.mainnav-list li + li::before {
    content: "";
    position: absolute;
    top: -4px; left: 50%;
    width: 7px; height: 7px;
    margin-left: -3.5px;
    background: var(--gold);
    transform: rotate(45deg);
}
.mainnav-list a {
    display: inline-block;
    color: var(--on-dark);
    text-decoration: none;
    font-variant-caps: small-caps;
    font-size: 1.08rem;
    letter-spacing: .05em;
    padding: .1rem 0;
    border-bottom: 1px solid transparent;
    transition: color .2s, border-color .2s;
}
.mainnav-list a:hover,
.mainnav-list .current-menu-item > a { color: var(--gold-light); border-bottom-color: var(--gold); }

/* ---------- Кнопка-ярлык ---------- */
.tag-btn,
.comment-form .submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.7rem .55rem 1.2rem;
    background-color: var(--paper);
    background-image: var(--paper-tex);
    color: var(--ink);
    border: 1px solid var(--gold);
    font-family: var(--f-text);
    font-size: 1rem;
    font-variant-caps: small-caps;
    letter-spacing: .06em;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    box-shadow: inset 0 0 0 2px rgba(232, 223, 200, .9), inset 0 0 0 3px rgba(201, 162, 39, .45);
    transition: background-color .2s, transform .15s, color .2s;
}
.tag-btn::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 12px; height: 12px;
    background: linear-gradient(to bottom left, transparent 50%, #B8A47A 50%, #D9CBA8 100%);
}
.tag-btn:hover,
.comment-form .submit:hover {
    background-color: var(--gold-light);
    background-image: none;
    color: var(--ink);
    transform: translateY(-1px);
}
.tag-btn--sm { font-size: .9rem; padding: .35rem 1.35rem .35rem .9rem; }

/* ---------- Секции главной ---------- */
.fs { position: relative; padding: 4.5rem 0; }
.fs-title {
    font-size: clamp(2.1rem, 4.4vw, 3.5rem);
    line-height: 1.06;
    margin: 0 0 .35em;
    letter-spacing: -.005em;
}
.fs-sub {
    font-size: 1.15rem;
    margin: 0 0 1rem;
    letter-spacing: .03em;
}
.fs-lead { max-width: 62ch; margin: 0 0 2rem; font-size: 1rem; }

.fs-fond,
.fs-atlas {
    background-color: var(--leather);
    color: var(--on-dark);
}
.fs-fond {
    background-image:
        var(--grain),
        radial-gradient(ellipse 55% 70% at 100% 30%, rgba(27, 58, 47, 0) 0, rgba(27, 58, 47, .55) 55%, var(--leather) 100%),
        var(--marble-tex);
    background-size: 128px 128px, 100% 100%, 512px 512px;
}
.fs-atlas {
    background-image:
        var(--grain),
        radial-gradient(ellipse 45% 80% at 0 60%, rgba(27, 58, 47, 0) 0, rgba(27, 58, 47, .55) 55%, var(--leather) 100%),
        var(--marble-tex);
    background-size: 128px 128px, 100% 100%, 512px 512px;
}
.fs-fond .fs-title,
.fs-atlas .fs-title,
.fs-latest .fs-title {
    color: var(--gold-light);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 -1px 0 rgba(255, 236, 170, .15);
}
.fs-fond .fs-sub,
.fs-latest .fs-sub { color: var(--on-dark-muted); }

/* Блок 1: устройство фонда */
.fond-head { max-width: 760px; }
.fond-body {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .72fr) minmax(0, 1fr);
    gap: 2.4rem;
    align-items: center;
}
.fond-plan {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 9.6rem) minmax(0, 1fr);
    background: var(--plate);
    border: 1px solid rgba(201, 162, 39, .55);
    padding: 1.3rem 1.3rem 1.3rem 1.1rem;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}
.fond-plan::before,
.fond-plan::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border-color: var(--gold);
    border-style: solid;
}
.fond-plan::before { top: 5px; left: 5px; border-width: 1px 0 0 1px; }
.fond-plan::after { bottom: 5px; right: 5px; border-width: 0 1px 1px 0; }
.fond-marks { position: relative; list-style: none; margin: 0; padding: 0; min-width: 0; }
.fond-mark {
    position: absolute;
    left: 0; right: 0;
    transform: translateY(-100%);
    padding-bottom: .2rem;
    border-bottom: 1px solid var(--gold);
    font-size: .8rem;
    line-height: 1.25;
    color: var(--on-dark);
    padding-right: .3rem;
}
.fond-mark--t { top: 42.8%; }
.fond-mark--h { top: 72%; }
.fond-mark--l { top: 98%; }
.fond-drawing { margin: 0; min-width: 0; }
.fond-drawing img { display: block; width: 100%; height: auto; aspect-ratio: 948 / 852; object-fit: cover; }

.fond-scale { display: flex; gap: .9rem; align-items: stretch; min-width: 0; }
.fond-scale-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: 0;
    text-align: center;
    font-variant-caps: small-caps;
    letter-spacing: .12em;
    font-size: .95rem;
    color: var(--on-dark-muted);
}
.fond-scale-list {
    list-style: none;
    margin: 0;
    padding: .3rem 0;
    border-left: 1px solid var(--gold);
    min-width: 0;
}
.fond-scale-list li { position: relative; padding: .42rem 0 .42rem 1.05rem; }
.fond-scale-list li::before {
    content: "";
    position: absolute;
    left: 0; top: 1.05rem;
    width: 10px; height: 1px;
    background: var(--gold);
}
.fond-scale-list .mat { display: block; font-size: .98rem; line-height: 1.3; color: var(--on-dark); }
.fond-scale-list .reg { display: block; font-size: .8rem; color: var(--on-dark-muted); letter-spacing: .02em; }

.fond-photo {
    margin: 0;
    padding: 6px;
    border: 2px solid var(--gold);
    background: var(--plate);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .4);
    min-width: 0;
}
.fond-photo img { display: block; width: 100%; height: auto; aspect-ratio: 972 / 993; object-fit: cover; }

/* Блок 2: реставрация по слоям */
.fs-layers,
.fs-diary {
    background-color: var(--paper);
    background-image:
        radial-gradient(circle at 6% 22%, rgba(150, 110, 60, .14) 0 3px, transparent 4px),
        radial-gradient(circle at 92% 70%, rgba(150, 110, 60, .12) 0 4px, transparent 5px),
        radial-gradient(circle at 97% 12%, rgba(150, 110, 60, .1) 0 2px, transparent 3px),
        var(--paper-tex);
    color: var(--ink);
}
.fs-layers .fs-title,
.fs-diary .fs-title { color: var(--ink); }
.layers-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
}
.layers-visual { min-width: 0; }
.layers-leaf { margin: 0; }
.layers-leaf img { display: block; width: 100%; height: auto; aspect-ratio: 992 / 566; object-fit: cover; mix-blend-mode: darken; }
.layers-list { min-width: 0; }
.layer {
    border-bottom: 1px solid rgba(107, 91, 69, .45);
    padding: .15rem 1rem;
    transition: background-color .2s;
}
.layer[open] {
    border: 1px solid var(--line-brown);
    background: rgba(255, 252, 240, .4);
    padding: .4rem 1rem .2rem;
    margin-bottom: .3rem;
}
.layer summary {
    display: flex;
    align-items: center;
    gap: .75rem;
    list-style: none;
    cursor: pointer;
    padding: .55rem 0;
    font-family: var(--f-title);
    font-size: 1.3rem;
    line-height: 1.25;
}
.layer summary::-webkit-details-marker { display: none; }
.layer summary::before {
    content: "";
    flex: 0 0 auto;
    width: 0; height: 0;
    border-style: solid;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent var(--ink-soft);
    transition: transform .2s;
}
.layer[open] summary::before { transform: rotate(90deg); }
.layer summary:hover .layer-name { color: var(--wax); }
.layer-name { min-width: 0; }
.layer-no {
    margin-left: auto;
    flex: 0 0 auto;
    font-family: var(--f-text);
    font-size: .72rem;
    letter-spacing: .08em;
    color: var(--ink-muted);
    border: 1px solid var(--ink-muted);
    padding: .1rem .4rem;
    transform: rotate(-3deg);
}
.layer p { margin: 0 0 .9rem 1.4rem; font-size: .95rem; line-height: 1.55; color: var(--ink-soft); }

/* Последние записи */
.fs-latest {
    background-color: var(--cloth);
    background-image:
        var(--grain),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 3px);
    background-size: 128px 128px, auto, auto;
    color: var(--on-dark);
    border-top: 1px solid rgba(201, 162, 39, .5);
    border-bottom: 1px solid rgba(201, 162, 39, .5);
}
.latest-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem 2rem;
    margin-bottom: 2.2rem;
}
.latest-head .fs-sub { margin: 0; }
.empty-note { font-style: italic; color: inherit; opacity: .85; }

/* ---------- Карточки записей ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .35));
}
.card-grid--list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-single .card-grid--list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background-color: var(--paper);
    background-image: var(--paper-tex);
    color: var(--ink);
    padding: 2rem 1.1rem 1.1rem;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), calc(100% - 30px) 100%, 0 100%);
}
.card::after {
    content: "";
    position: absolute;
    right: 0; bottom: 0;
    width: 30px; height: 30px;
    background: linear-gradient(to top left, transparent 50%, #B5A27A 50%, #DCCFB0 78%, #EFE7D3 100%);
}
.card-thumb {
    border: 1px solid var(--ink-muted);
    padding: 4px;
    background: rgba(255, 252, 240, .35);
    margin: 0 0 1rem;
}
.card-thumb a { display: block; }
.card-thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    filter: sepia(.12);
}
.card-stamp {
    position: absolute;
    top: .45rem; right: 1rem;
    font-size: .74rem;
    letter-spacing: .06em;
    color: var(--wax);
    border: 1px solid rgba(140, 47, 34, .7);
    padding: 0 .45rem;
    transform: rotate(-2deg);
    background: rgba(255, 252, 240, .3);
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(107, 91, 69, .12) 27px 28px);
}
.card-pin {
    align-self: flex-start;
    font-size: .72rem;
    font-variant-caps: small-caps;
    letter-spacing: .08em;
    color: var(--paper);
    background: var(--wax);
    padding: .05rem .5rem;
    margin-bottom: .5rem;
}
.card-title { font-size: 1.38rem; line-height: 1.2; margin: 0 0 .55rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--wax); }
.card-excerpt { flex: 1; font-size: .92rem; line-height: 1.55; color: var(--ink-soft); }
.card-excerpt p { margin: 0 0 .5em; background: none; }
.card-excerpt a { color: var(--green); }
.card-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .6rem;
    margin-top: .6rem;
    padding: .75rem 1.5rem 0 0;
    border-top: 1px dashed rgba(107, 91, 69, .45);
}
.card-cat {
    min-width: 0;
    font-size: .82rem;
    font-variant-caps: small-caps;
    letter-spacing: .05em;
    color: var(--ink-muted);
    text-decoration: none;
}
a.card-cat:hover { color: var(--wax); text-decoration: underline; }

/* Блок 3: полевой дневник */
.diary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
    gap: 2.6rem;
    align-items: center;
}
.diary-notes { min-width: 0; }
.diary-log {
    border-left: 1px solid var(--line-brown);
    padding-left: 1.1rem;
    background-image: repeating-linear-gradient(to bottom, transparent 0 calc(2.1rem - 1px), rgba(107, 91, 69, .35) calc(2.1rem - 1px) 2.1rem);
}
.diary-hand {
    margin: 0;
    font-family: var(--f-hand);
    font-size: 1.32rem;
    line-height: 2.1rem;
    color: #2E2418;
}
.diary-plain { margin: 0; font-size: .95rem; line-height: 2.1rem; color: var(--ink-soft); }
.diary-photo-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 12rem);
    align-items: stretch;
    min-width: 0;
}
.diary-photo { margin: 0; min-width: 0; box-shadow: 0 10px 24px rgba(36, 28, 20, .28); }
.diary-photo img { display: block; width: 100%; height: auto; aspect-ratio: 1149 / 594; object-fit: cover; }
.diary-callouts { position: relative; list-style: none; margin: 0; padding: 0; min-width: 0; }
.callout {
    position: absolute;
    left: 0; right: 0;
    padding-left: 3rem;
    transform: translateY(-.8rem);
}
.callout::before {
    content: "";
    position: absolute;
    left: 0; top: .8rem;
    width: 2.6rem; height: 1px;
    background: var(--ink);
}
.callout--1 { top: 25%; }
.callout--2 { top: 54%; }
.callout--3 { top: 92%; }
.callout b { display: block; font-family: var(--f-title); font-weight: 400; font-size: 1.2rem; line-height: 1.6rem; }
.callout span { display: block; font-size: .78rem; line-height: 1.3; color: var(--ink-muted); }

/* Блок 4: атлас материалов */
.atlas-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem 3rem;
    align-items: end;
    margin-bottom: 2rem;
}
.atlas-head .fs-lead { margin: 0 0 .6rem; color: var(--on-dark-muted); }
.atlas-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1.4rem;
}
.swatch { min-width: 0; }
.swatch-tile {
    position: relative;
    margin: 0 0 .8rem;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}
.swatch-tile img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%; height: 100%;
    object-fit: cover;
}
.swatch-tile::after {
    content: "";
    position: absolute;
    right: 0; bottom: 0;
    width: 24px; height: 24px;
    background: linear-gradient(to top left, transparent 50%, #B5A27A 50%, #E8DFC8 100%);
}
.swatch-inv,
.swatch-name {
    position: absolute;
    left: .5rem;
    max-width: calc(100% - 2.2rem);
    background: rgba(232, 223, 200, .9);
    color: var(--ink);
    padding: .05rem .4rem;
    line-height: 1.35;
}
.swatch-inv { top: .5rem; font-size: .7rem; letter-spacing: .04em; }
.swatch-name { bottom: .5rem; font-size: .82rem; font-variant-caps: small-caps; letter-spacing: .05em; }
.swatch-note { margin: 0; font-size: .84rem; line-height: 1.5; color: var(--on-dark-muted); }

/* ---------- Внутренние страницы ---------- */
.inner {
    padding: 2rem 0 4.5rem;
    background-color: var(--leather);
    background-image: var(--grain);
    background-size: 128px 128px;
}
.crumbs {
    font-size: .88rem;
    color: var(--on-dark-muted);
    margin: 0 0 1.8rem;
    padding-bottom: .7rem;
    border-bottom: 1px solid rgba(201, 162, 39, .35);
}
.crumbs a { color: var(--gold-light); text-decoration: none; border-bottom: 1px solid rgba(201, 162, 39, .45); }
.crumbs a:hover { color: var(--on-dark); }
.crumbs .sep { color: var(--gold); margin: 0 .25rem; }
.crumbs span:last-child { color: var(--on-dark); }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    column-gap: 6%;
    align-items: start;
}
.layout-single { display: block; }
.layout-single .content-area { width: 85%; margin-left: auto; margin-right: auto; }
.content-area { min-width: 0; }

.page-head { margin-bottom: 2rem; }
.page-title {
    font-size: clamp(2rem, 4vw, 3.1rem);
    color: var(--gold-light);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
    margin: 0 0 .4rem;
}
.page-sub { color: var(--on-dark-muted); max-width: 62ch; margin: 0; }

.sheet {
    position: relative;
    background-color: var(--paper);
    background-image: var(--paper-tex);
    color: var(--ink);
    padding: 2.6rem clamp(1.3rem, 4vw, 3.2rem);
    border: 1px solid rgba(107, 91, 69, .5);
    box-shadow: 0 16px 34px rgba(0, 0, 0, .38), inset 0 0 0 6px rgba(232, 223, 200, .7), inset 0 0 0 7px rgba(201, 162, 39, .5);
    margin-bottom: 2rem;
}
.entry-head { margin-bottom: 1.6rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(107, 91, 69, .4); }
.entry-title { font-size: clamp(1.9rem, 3.6vw, 2.8rem); color: var(--ink); margin: 0 0 .5rem; }
.entry-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .88rem; color: var(--ink-muted); font-variant-caps: small-caps; letter-spacing: .05em; }
.entry-meta a { color: var(--green); }
.entry-cover { margin: 0 0 1.8rem; border: 1px solid var(--ink-muted); padding: 5px; }
.entry-cover img { display: block; width: 100%; height: auto; }

.entry-content { font-size: 1.06rem; line-height: 1.75; }
.entry-content > *:last-child { margin-bottom: 0; }
.entry-content p { margin: 0 0 1.1em; }
.entry-content h2 { font-size: 1.9rem; margin: 1.6em 0 .55em; color: var(--ink); }
.entry-content h3 { font-size: 1.5rem; margin: 1.4em 0 .5em; color: var(--ink); }
.entry-content h4 { font-size: 1.25rem; margin: 1.3em 0 .5em; }
.entry-content a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.entry-content a:hover { color: var(--wax); }
.entry-content ul,
.entry-content ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.entry-content li { margin-bottom: .35em; }
.entry-content ul li::marker { color: var(--wax); }
.entry-content blockquote {
    margin: 1.6em 0;
    padding: 1.1rem 1.5rem;
    border-left: 3px solid var(--wax);
    background: rgba(140, 47, 34, .06);
    font-style: italic;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; border: 1px solid var(--ink-muted); font-size: .95rem; }
.entry-content th,
.entry-content td { border: 1px solid var(--ink-muted); padding: .55rem .75rem; text-align: left; vertical-align: top; }
.entry-content th { background: rgba(47, 93, 69, .12); font-weight: 700; }
.entry-content img { display: block; max-width: 100%; height: auto; }
.entry-content figure { margin: 1.5em 0; }
.entry-content figcaption { font-size: .85rem; color: var(--ink-muted); margin-top: .4rem; }
.entry-content pre { overflow-x: auto; background: rgba(36, 28, 20, .06); padding: 1rem; border: 1px solid rgba(107, 91, 69, .35); }
.entry-content hr { border: 0; height: 1px; background: var(--ink-muted); margin: 2em 0; }
.page-links { margin-top: 1.5rem; font-variant-caps: small-caps; }
.entry-tags { margin-top: 1.8rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.entry-tags a {
    font-size: .82rem;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid var(--ink-muted);
    padding: .15rem .6rem;
}
.entry-tags a:hover { border-color: var(--wax); color: var(--wax); }

/* ---------- Сайдбар и виджеты ---------- */
.sidebar {
    min-width: 0;
    background-color: var(--cloth);
    background-image: var(--grain);
    background-size: 128px 128px;
    border: 1px solid rgba(201, 162, 39, .55);
    padding: 1.6rem 1.4rem;
    color: var(--on-dark);
}
.sidebar .widget + .widget { margin-top: 2rem; padding-top: 1.6rem; border-top: 1px solid rgba(201, 162, 39, .35); }
.sidebar .widget-title { font-size: 1.45rem; color: var(--gold-light); margin: 0 0 1rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { position: relative; padding: .45rem 0 .45rem 1.1rem; border-bottom: 1px dashed rgba(167, 155, 122, .35); color: var(--on-dark); }
.sidebar li:last-child { border-bottom: 0; }
.sidebar li::before {
    content: "";
    position: absolute;
    left: 0; top: 1.05rem;
    width: 6px; height: 6px;
    background: var(--gold);
    transform: rotate(45deg);
}
.sidebar a { color: var(--on-dark); text-decoration: none; }
.sidebar a:hover { color: var(--gold-light); text-decoration: underline; }
.sidebar .post-date { display: block; font-size: .8rem; color: var(--on-dark-muted); }
.sidebar p, .sidebar .textwidget { color: var(--on-dark); font-size: .95rem; }

/* ---------- Пагинация ---------- */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: 2.5rem 0 0;
}
.pager .page-numbers {
    display: inline-block;
    min-width: 2.6rem;
    text-align: center;
    padding: .4rem .8rem;
    background-color: var(--paper);
    color: var(--ink);
    border: 1px solid var(--gold);
    text-decoration: none;
    font-variant-caps: small-caps;
    letter-spacing: .04em;
    transition: background-color .2s;
}
.pager a.page-numbers:hover { background-color: var(--gold-light); }
.pager .page-numbers.current { background-color: var(--gold); color: var(--ink); font-weight: 700; }
.pager .page-numbers.dots { background: none; border: 0; color: var(--on-dark-muted); min-width: 0; }

/* ---------- Поиск ---------- */
.search-form { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.2rem 0; }
.search-field {
    flex: 1 1 14rem;
    min-width: 0;
    padding: .6rem .8rem;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: rgba(255, 252, 240, .85);
    border: 1px solid var(--ink-muted);
}
.search-field:focus { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 0; }
.sidebar .search-field { background: var(--paper); }

/* ---------- 404 ---------- */
.lost { text-align: left; }
.lost-code {
    font-family: var(--f-title);
    font-size: clamp(4rem, 12vw, 7rem);
    line-height: 1;
    color: var(--wax);
    margin: 0 0 .5rem;
    opacity: .85;
}

/* ---------- Комментарии ---------- */
.notes-title { font-size: 1.8rem; color: var(--ink); }
.note-list,
.note-list .children { list-style: none; margin: 0; padding: 0; }
.note-list .children { padding-left: clamp(1rem, 4vw, 2.5rem); }
.note-card {
    border: 1px solid rgba(107, 91, 69, .45);
    background: rgba(255, 252, 240, .45);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}
.note-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; margin-bottom: .5rem; }
.note-author { font-weight: 700; }
.note-date { font-size: .82rem; color: var(--ink-muted); }
.note-wait { font-style: italic; color: var(--wax); font-size: .9rem; }
.note-text p { margin: 0 0 .6em; }
.note-reply a { font-size: .85rem; color: var(--green); font-variant-caps: small-caps; letter-spacing: .05em; }
.notes-closed { font-style: italic; color: var(--ink-muted); }
.comment-respond { margin-top: 1.8rem; }
.comment-reply-title { font-size: 1.6rem; color: var(--ink); }
.comment-reply-title small { font-family: var(--f-text); font-size: .85rem; margin-left: .6rem; }
.comment-reply-title small a { color: var(--wax); }
.comment-form p { margin: 0 0 1rem; }
.comment-form label { display: block; font-size: .9rem; margin-bottom: .3rem; color: var(--ink-soft); }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: .6rem .8rem;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: rgba(255, 252, 240, .85);
    border: 1px solid var(--ink-muted);
}
.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 0; }
.comment-form .comment-form-cookies-consent { display: flex; gap: .5rem; align-items: flex-start; }
.comment-form .comment-form-cookies-consent label { display: inline; margin: 0; }
.comment-notes, .logged-in-as { font-size: .88rem; color: var(--ink-muted); }
.logged-in-as a, .must-log-in a { color: var(--green); }

/* ---------- Подвал ---------- */
.colophon {
    background-color: var(--marble);
    background-image: var(--grain);
    background-size: 128px 128px;
    border-top: 2px solid var(--gold);
    color: var(--paper);
    padding: 3.5rem 0 0;
}
.colophon-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
}
.colophon-col { min-width: 0; }
.colophon .widget + .widget { margin-top: 1.5rem; }
.colophon .widget-title { font-size: 1.6rem; color: var(--gold-light); margin: 0 0 .7rem; }
.colophon p, .colophon .textwidget { color: var(--paper); font-size: .98rem; line-height: 1.55; }
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { margin: 0 0 .35rem; color: var(--paper); }
.colophon a {
    color: var(--paper);
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 162, 39, .7);
    transition: color .2s;
}
.colophon a:hover { color: var(--gold-light); }
.colophon-bottom {
    margin-top: 2.8rem;
    padding: 1.2rem 0 1.6rem;
    border-top: 1px solid rgba(201, 162, 39, .35);
}
.colophon-bottom p { margin: 0; font-size: .88rem; color: var(--on-dark-muted); }

/* ---------- Cookie-баннер ---------- */
.cookie-banner {
    position: fixed;
    left: 1rem; right: 1rem; bottom: 1rem;
    z-index: 60;
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .9rem 1.4rem;
    padding: 1rem 1.4rem;
    background-color: var(--paper);
    background-image: var(--paper-tex);
    color: var(--ink);
    border: 1px solid var(--gold);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 0 0 4px rgba(232, 223, 200, .8), inset 0 0 0 5px rgba(201, 162, 39, .45);
}
.cookie-text { flex: 1 1 18rem; margin: 0; font-size: .92rem; line-height: 1.5; }

/* ---------- Адаптив: планшет ---------- */
@media (max-width: 959px) {
    .masthead-row { grid-template-columns: auto minmax(0, 1fr); gap: 1.2rem 1.6rem; }
    .mainnav { grid-column: 1 / -1; }
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: .6rem;
        background: none;
        border: 1px solid var(--gold);
        color: var(--on-dark);
        font: inherit;
        font-variant-caps: small-caps;
        letter-spacing: .06em;
        padding: .45rem 1rem;
        cursor: pointer;
    }
    .nav-toggle-bar,
    .nav-toggle-bar::before,
    .nav-toggle-bar::after {
        display: block;
        width: 18px; height: 2px;
        background: var(--gold);
        position: relative;
    }
    .nav-toggle-bar::before,
    .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
    .nav-toggle-bar::before { top: -6px; }
    .nav-toggle-bar::after { top: 6px; }
    .mainnav-list { display: none; margin-top: .8rem; border-top: 1px solid rgba(201, 162, 39, .5); }
    .mainnav-list.is-open { display: block; }
    .mainnav-list li + li::before { left: 0; margin-left: 0; }

    .fond-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .fond-plan { grid-column: 1 / -1; }
    .layers-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .layout-single .card-grid--list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .diary-grid { grid-template-columns: minmax(0, 1fr); }
    .atlas-head { grid-template-columns: minmax(0, 1fr); }
    .atlas-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .layout-with-sidebar { grid-template-columns: minmax(0, 1fr); row-gap: 2.5rem; }
    .layout-single .content-area { width: 100%; }
    .colophon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Адаптив: телефон ---------- */
@media (max-width: 600px) {
    body { font-size: 1rem; }
    .masthead { padding: 1.5rem 0; }
    .brand-svg { width: 64px; }
    .site-desc { font-size: .85rem; }
    .fs { padding: 3rem 0; }
    .fond-body { grid-template-columns: minmax(0, 1fr); }
    .fond-plan { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
    .fond-marks { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: .8rem; }
    .fond-mark { position: static; transform: none; }
    .card-grid,
    .card-grid--list,
    .layout-single .card-grid--list { grid-template-columns: minmax(0, 1fr); }
    .diary-photo-wrap { grid-template-columns: minmax(0, 1fr); }
    .diary-callouts { margin-top: 1rem; }
    .callout { position: static; transform: none; padding: 0 0 .7rem 1.4rem; }
    .callout::before { width: .9rem; top: .8rem; }
    .atlas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
    .colophon-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
    .sheet { padding: 1.8rem 1.2rem; }
    .sidebar { padding: 1.4rem 1.2rem; }
    .cookie-banner { padding: 1rem 1.1rem; }
    .layer { padding-left: .8rem; padding-right: .8rem; }
    .layer[open] { padding-left: .8rem; padding-right: .8rem; }
}
