:root {
    --bg: #f4f2ef;
    --surface: #fffefb;
    --ink: #1a1917;
    --muted: #5c5954;
    --line: #e2ddd4;
    --accent: #c45c26;
    --accent-hover: #a34d20;
    --shadow: 0 4px 24px rgba(26, 25, 23, 0.06);
    --radius: 12px;
    --font-sans: "DM Sans", system-ui, sans-serif;
    --font-serif: "Newsreader", Georgia, serif;
    --space: clamp(1rem, 3vw, 1.5rem);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 120% 80% at 100% 0%, rgba(196, 92, 38, 0.08), transparent 50%),
        radial-gradient(ellipse 80% 60% at 0% 100%, rgba(90, 120, 140, 0.06), transparent 45%);
}

img,
svg,
video {
    max-width: 100%;
}

a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: rgba(196, 92, 38, 0.18);
}

a {
    overflow-wrap: anywhere;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 254, 251, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--space);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.site-header__inner--split {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.site-header__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
}

.site-header__nav-link {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--accent);
    text-decoration: none;
}

.site-header__nav-link:hover {
    text-decoration: underline;
}

@media (min-width: 640px) {
    .site-header__inner:not(.site-header__inner--split) {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        justify-content: space-between;
    }
}

.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.brand__mark {
    font-size: 2rem;
    line-height: 1;
    color: var(--accent);
}

.brand__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand__tag {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

@media (min-width: 640px) {
    .toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        max-width: 48rem;
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.field--grow {
    flex: 1 1 12rem;
}

.field__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.field__control {
    font: inherit;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}

.field__control:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn {
    font: inherit;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    min-height: 2.75rem;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    align-self: stretch;
}

@media (min-width: 640px) {
    .btn--primary {
        align-self: flex-end;
    }
}

.btn--primary:hover {
    background: var(--accent-hover);
}

.btn--ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--line);
}

.btn--ghost:hover {
    border-color: var(--accent);
    background: rgba(196, 92, 38, 0.06);
}

.main {
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--space);
    min-width: 0;
}

.status {
    min-height: 1.5rem;
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.status--error {
    color: #a32020;
}

.feed {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .feed {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .feed {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feed__cell {
    display: flex;
    min-width: 0;
    list-style: none;
}

.feed__cell .card--clickable {
    flex: 1;
    min-width: 0;
}

a.card--clickable {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.card--clickable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: 100%;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: 0 8px 32px rgba(26, 25, 23, 0.1);
    transform: translateY(-2px);
}

.card__media {
    aspect-ratio: 16 / 9;
    background: linear-gradient(145deg, #e8e4dc, #d4cfc5);
    overflow: hidden;
}

.card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card__body {
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.card__source {
    font-weight: 600;
    color: var(--accent);
}

.card__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.card__excerpt {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.pager {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.admin {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 var(--space) 3rem;
}

.admin__title {
    margin: 0;
}

.admin__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    font: inherit;
    font-weight: 600;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--ink);
}

.admin__toggle:hover {
    border-color: var(--accent);
}

.admin__chevron {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.2s;
}

.admin__toggle[aria-expanded="true"] .admin__chevron {
    transform: rotate(-135deg);
}

.admin__panel {
    margin-top: 0.75rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.admin__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .admin__form {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
    }

    .admin__form .field--grow {
        flex: 2 1 16rem;
    }

    .admin__form .field:not(.field--grow) {
        flex: 1 1 10rem;
    }
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    user-select: none;
}

.admin__msg {
    margin: 1rem 0 0;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.admin__msg--ok {
    color: #2d6a4f;
}

.admin__msg--err {
    color: #a32020;
}

.site-footer {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1rem var(--space) 2rem;
    text-align: center;
}

.site-footer__sep {
    margin: 0 0.5rem;
    color: var(--muted);
    user-select: none;
}

.site-footer__link {
    font-size: 0.8125rem;
    color: var(--muted);
}

.site-footer__link:hover {
    color: var(--accent);
}

.static-section {
    max-width: 42rem;
    margin: 0 auto;
    padding: 2.5rem var(--space) 2rem;
    border-top: 1px solid var(--line);
}

.static-section--alt {
    background: rgba(255, 254, 251, 0.6);
}

.static-section__inner {
    margin: 0 auto;
}

.static-section__title {
    margin: 0 0 0.75rem;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
}

.static-section__text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.article-page {
    min-height: 100dvh;
}

.article-page__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem var(--space);
    background: rgba(255, 254, 251, 0.95);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

.article-page__back {
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.article-page__back:hover {
    text-decoration: underline;
}

.article-page__source {
    font-size: 0.8125rem;
    color: var(--muted);
}

.article-page__main {
    max-width: 42rem;
    margin: 0 auto;
    padding: 1.25rem var(--space) 3rem;
    min-width: 0;
}

.article-page__title {
    margin: 0 0 1.25rem;
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.article-page__meta {
    margin: -0.5rem 0 1.25rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

.article-page__image {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 0 1.25rem;
    border-radius: 10px;
}

.article-page__image[hidden] {
    display: none;
}

.article-page__foot {
    margin: 2rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.article-page__external {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.article-page__external:hover {
    text-decoration: underline;
}

.reader-article {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.reader-article p {
    margin: 0 0 1rem;
}

.reader-article h2,
.reader-article h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin: 1.25rem 0 0.5rem;
}

.reader-article ul,
.reader-article ol {
    margin: 0 0 1rem;
    padding-left: 1.35rem;
}

.reader-article a {
    color: var(--accent);
    word-break: break-word;
}

.reader-article figure {
    margin: 0 0 1.25rem;
}

.reader-article img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.reader-article figure img {
    margin: 0;
}

.reader-article figcaption {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    color: var(--muted);
    line-height: 1.4;
}

.reader-article picture {
    display: block;
    margin: 0 0 1rem;
}

.reader-article blockquote {
    margin: 0 0 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--line);
    color: var(--muted);
}

.reader-article table,
.reader-article pre {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.reader-article iframe,
.reader-article embed,
.reader-article object {
    max-width: 100%;
}

/* Юридические страницы */
.legal-prose {
    max-width: 42rem;
    margin: 0 auto;
    padding: 1.5rem var(--space) 3rem;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--ink);
}

.legal-prose__warn {
    padding: 1rem 1.1rem;
    margin: 0 0 1.5rem;
    border-radius: var(--radius);
    background: rgba(196, 92, 38, 0.1);
    border: 1px solid rgba(196, 92, 38, 0.25);
    color: var(--ink);
}

.legal-prose__meta {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.legal-placeholder {
    font-style: italic;
    color: var(--muted);
}

.legal-prose__h {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    margin: 1.75rem 0 0.5rem;
}

.legal-prose ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.25rem;
}

.legal-prose a {
    color: var(--accent);
    font-weight: 600;
}

/* Баннер cookie */
.cookie-banner {
    position: fixed;
    z-index: 100;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem var(--space) calc(0.75rem + env(safe-area-inset-bottom, 0));
    background: rgba(26, 25, 23, 0.92);
    color: #f8f6f2;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.cookie-banner__inner {
    max-width: 52rem;
    margin: 0 auto;
}

.cookie-banner__text {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(248, 246, 242, 0.92);
}

.cookie-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.cookie-banner .btn--ghost {
    border-color: rgba(248, 246, 242, 0.35);
    color: #f8f6f2;
}

.cookie-banner .btn--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
}

.cookie-banner .btn--primary {
    background: var(--accent);
    border-color: var(--accent);
}

.cookie-banner__links {
    margin: 0;
    font-size: 0.8125rem;
}

.cookie-banner__links a {
    color: #f0dcc8;
    font-weight: 600;
}

.cookie-banner__links a:hover {
    color: #fff;
}

@media (max-width: 639px) {
    :root {
        --space: clamp(0.875rem, 4vw, 1rem);
        --radius: 10px;
    }

    body {
        font-size: 0.9375rem;
        line-height: 1.55;
    }

    .site-header {
        position: static;
    }

    .site-header__inner,
    .site-header__inner--split {
        flex-direction: column;
        align-items: stretch;
        gap: 0.9rem;
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .brand {
        align-items: flex-start;
    }

    .brand__mark {
        font-size: 1.6rem;
        margin-top: 0.1rem;
    }

    .brand__title {
        font-size: 1.45rem;
        line-height: 1.1;
    }

    .site-header__nav {
        width: 100%;
        gap: 0.5rem;
    }

    .site-header__nav-link {
        flex: 1 1 auto;
        min-height: 2.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0.7rem;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: rgba(255, 254, 251, 0.7);
        text-align: center;
    }

    .toolbar {
        gap: 0.65rem;
    }

    .field__control,
    .btn {
        font-size: 1rem;
    }

    .feed {
        gap: 0.9rem;
    }

    .card {
        border-radius: 10px;
        box-shadow: 0 2px 14px rgba(26, 25, 23, 0.06);
    }

    .card:hover {
        transform: none;
    }

    .card__body {
        padding: 0.9rem 0.95rem 1rem;
    }

    .card__title {
        font-size: 1.08rem;
        line-height: 1.25;
    }

    .card__excerpt {
        -webkit-line-clamp: 3;
    }

    .pager {
        margin-top: 1.25rem;
    }

    .pager .btn {
        width: 100%;
    }

    .static-section {
        padding: 1.6rem var(--space);
    }

    .main > .static-section {
        padding-left: 0;
        padding-right: 0;
    }

    .article-page__bar {
        position: static;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .article-page__main {
        padding-top: 1rem;
    }

    .article-page__title {
        font-size: 1.45rem;
        line-height: 1.22;
    }

    .article-page__image {
        width: calc(100% + (2 * var(--space)));
        max-width: none;
        margin-left: calc(-1 * var(--space));
        margin-right: calc(-1 * var(--space));
        border-radius: 0;
    }

    .reader-article {
        font-size: 1rem;
        line-height: 1.65;
    }

    .reader-article h2,
    .reader-article h3 {
        font-size: 1.12rem;
        line-height: 1.28;
    }

    .reader-article ul,
    .reader-article ol {
        padding-left: 1.1rem;
    }

    .legal-prose {
        padding-top: 1rem;
    }

    .site-footer {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
    }

    .site-footer__sep {
        margin: 0 0.3rem;
    }

    .cookie-banner__actions {
        flex-direction: column;
    }

    .cookie-banner .btn {
        width: 100%;
    }
}

.admin-login-legal {
    margin-top: 1rem;
    font-size: 0.8125rem;
}

.admin-field-hint {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.admin-login-legal a {
    color: var(--accent);
    font-weight: 600;
}
