:root {
    --paper: #f5f2ea;
    --surface: #fffdf8;
    --surface-2: #efeadd;
    --ink: #1d2738;
    --muted: #5d6678;
    --line: #ddd6c6;
    --accent: #15605a;
    --accent-soft: #e4efea;
    --accent-ink: #0e423e;
    --warn: #9a3b2e;
    --radius: 4px;
    --serif: Georgia, "Times New Roman", "PT Serif", serif;
    --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --measure: 68ch;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    background-image: linear-gradient(180deg, #f8f5ee 0%, var(--paper) 240px);
}

h1, h2, h3, h4 {
    font-family: var(--serif);
    line-height: 1.2;
    color: var(--ink);
    font-weight: 700;
}

h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem); margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); margin: 1.8em 0 .6em; }
h3 { font-size: 1.2rem; margin: 1.4em 0 .4em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }

p { margin: 0 0 1em; }

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

.container { width: min(1080px, 92vw); margin-inline: auto; }

.skip-link {
    position: absolute; left: -999px; top: 0;
    background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 2px solid var(--ink);
    position: sticky; top: 0; z-index: 40;
}
.site-header__row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1.5rem; padding: .85rem 0; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand__name { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.brand__role { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: .15rem; }

.site-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.site-nav a {
    color: var(--muted); padding: .35rem .6rem; font-size: .95rem; border-radius: var(--radius);
    border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.site-nav a.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

.nav-toggle { display: none; }
.nav-burger { display: none; cursor: pointer; color: var(--ink); }
.nav-burger svg { width: 28px; height: 28px; }

@media (max-width: 860px) {
    .nav-burger { display: inline-flex; }
    .site-nav {
        flex-basis: 100%; flex-direction: column; gap: 0;
        max-height: 0; overflow: hidden; transition: max-height .25s ease;
    }
    .nav-toggle:checked ~ .site-nav { max-height: 600px; }
    .site-nav a { padding: .7rem .2rem; border-bottom: 1px solid var(--line); border-radius: 0; }
    .site-nav a.is-active { border-bottom-color: var(--line); border-left: 3px solid var(--accent); padding-left: .6rem; }
}

/* Hero */
.hero { padding: 3rem 0 1rem; display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: center; }
.hero__eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--accent); font-weight: 600; }
.hero__lead { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.hero__photo { width: 100%; aspect-ratio: 4/5; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 40px -28px rgba(29,39,56,.6); }
.hero__photo--empty {
    display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
    font-family: var(--serif); font-size: 3rem;
}
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding-top: 2rem; } .hero__media { order: -1; max-width: 280px; } }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    background: var(--accent); color: #fff; padding: .65rem 1.2rem;
    border-radius: var(--radius); border: 1px solid var(--accent); cursor: pointer;
    font: inherit; font-weight: 600; font-size: .98rem;
}
.btn:hover { background: var(--accent-ink); color: #fff; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--accent-ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); color: var(--accent-ink); }
.btn--warn { background: var(--warn); border-color: var(--warn); }
.btn--warn:hover { background: #7d2f25; }
.btn--sm { padding: .4rem .75rem; font-size: .85rem; }
.btn svg { width: 18px; height: 18px; }

.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* Section heading */
.section-head { border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin: 2.4rem 0 1.4rem; }
.section-head h1, .section-head h2 { margin: 0; }
.section-head p { margin: .5rem 0 0; color: var(--muted); }
.page-intro { color: var(--muted); max-width: var(--measure); font-size: 1.05rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.2rem 1.25rem; display: flex; flex-direction: column; gap: .5rem;
}
.card h3 { margin: 0; font-size: 1.1rem; }
.card__meta { font-size: .82rem; color: var(--muted); }
.card p { color: var(--muted); margin: 0; }
.card__foot { margin-top: auto; padding-top: .6rem; }

.badge {
    display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--accent-ink); background: var(--accent-soft); padding: .2rem .55rem; border-radius: 999px;
}

/* Home blocks */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; margin: 1.5rem 0; }
.home-card {
    display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.3rem; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.home-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 12px 28px -22px rgba(29,39,56,.7); }
.home-card__icon { color: var(--accent); margin-bottom: .6rem; }
.home-card__icon svg { width: 26px; height: 26px; }
.home-card h3 { margin: 0 0 .3rem; }
.home-card p { color: var(--muted); margin: 0; font-size: .92rem; }

/* Definition list (визитка) */
.facts { display: grid; grid-template-columns: minmax(180px, max-content) 1fr; gap: .1rem 1.5rem; margin: 1.5rem 0; }
.facts dt { color: var(--muted); padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.facts dd { margin: 0; padding: .55rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 620px) { .facts { grid-template-columns: 1fr; } .facts dt { padding-bottom: 0; border: 0; } .facts dd { padding-top: .15rem; } }

/* Prose / markdown */
.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: .3em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; }
.prose th { background: var(--surface-2); }
.prose blockquote { border-left: 3px solid var(--accent); margin: 1em 0; padding: .2em 1em; color: var(--muted); }

/* Doc / file list */
.filelist { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .6rem; }
.filelist li {
    display: flex; align-items: center; gap: .9rem; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem;
}
.filelist .file-ico { color: var(--accent); flex: none; }
.filelist .file-ico svg { width: 22px; height: 22px; }
.filelist .file-main { flex: 1; }
.filelist .file-main strong { display: block; font-weight: 600; }
.filelist .file-main span { font-size: .82rem; color: var(--muted); }

/* Timeline (достижения) */
.timeline { border-left: 2px solid var(--line); margin: 1.4rem 0; padding-left: 1.4rem; display: grid; gap: 1.4rem; }
.timeline__item { position: relative; }
.timeline__item::before {
    content: ""; position: absolute; left: -1.65rem; top: .35rem; width: 11px; height: 11px;
    background: var(--accent); border-radius: 50%; border: 2px solid var(--paper);
}
.timeline__date { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* Gallery */
.gallery { columns: 3 240px; column-gap: 1rem; margin: 1.4rem 0; }
.gallery figure { break-inside: avoid; margin: 0 0 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery img { width: 100%; }
.gallery figcaption { padding: .6rem .8rem; font-size: .88rem; color: var(--muted); }

/* News list */
.news-list { display: grid; gap: 1.4rem; margin: 1.4rem 0; }
.news-item { border-bottom: 1px solid var(--line); padding-bottom: 1.4rem; }
.news-item h2 { margin: .2rem 0 .4rem; font-size: 1.4rem; }
.news-item__date { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* Forms */
.form { max-width: 560px; display: grid; gap: 1rem; margin: 1.5rem 0; }
.form--wide { max-width: 760px; }
.field { display: grid; gap: .35rem; }
.field label { font-size: .9rem; font-weight: 600; color: var(--ink); }
.field input, .field textarea, .field select {
    font: inherit; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.field textarea { min-height: 140px; resize: vertical; }
.field--hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.alert { padding: .8rem 1rem; border-radius: var(--radius); margin: 1rem 0; border: 1px solid; }
.alert--ok { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.alert--err { background: #f7e6e2; border-color: var(--warn); color: #7d2f25; }
.field-error { color: var(--warn); font-size: .85rem; }

.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 1.5rem 0; }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; margin: 2rem 0; }
.admin-side { position: sticky; top: 90px; align-self: start; display: grid; gap: .2rem; }
.admin-side a { color: var(--muted); padding: .5rem .7rem; border-radius: var(--radius); font-size: .95rem; }
.admin-side a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.admin-side a.is-active { background: var(--ink); color: #fff; }
.admin-side .admin-side__head { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1rem 0 .3rem; }
@media (max-width: 760px) { .admin-shell { grid-template-columns: 1fr; } .admin-side { position: static; grid-auto-flow: column; overflow-x: auto; } }

.table { width: 100%; border-collapse: collapse; margin: 1rem 0; background: var(--surface); }
.table th, .table td { border: 1px solid var(--line); padding: .6rem .7rem; text-align: left; font-size: .92rem; vertical-align: top; }
.table th { background: var(--surface-2); }
.table td .row-actions { display: flex; gap: .4rem; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }

.login-wrap { max-width: 380px; margin: 4rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; }

/* Footer */
.site-footer { background: var(--ink); color: #cfd5e0; margin-top: 4rem; padding: 2.5rem 0 1.5rem; }
.site-footer a { color: #fff; }
.site-footer__grid { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.site-footer__name { font-family: var(--serif); font-size: 1.2rem; color: #fff; }
.site-footer__role { color: #aeb6c4; font-size: .9rem; }
.site-footer__muted { color: #8e97a8; font-size: .85rem; margin-top: .3rem; }
.site-footer__contacts { display: grid; gap: .5rem; }
.site-footer__contacts a { display: inline-flex; align-items: center; gap: .5rem; }
.site-footer__contacts svg { width: 18px; height: 18px; }
.site-footer__bottom { border-top: 1px solid #33415a; margin-top: 1.8rem; padding-top: 1rem; font-size: .82rem; color: #8e97a8; }
