/* Базовая дизайн-система. Токены тем — в /themes/{key}/theme.css */

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg, #101b28);
    color: var(--text, #f5f7fa);
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading, inherit);
    line-height: 1.12;
    margin: 0 0 .5em;
    font-weight: 600;
}

h1 { font-size: clamp(2.4rem, 5vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.8rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

p { margin: 0 0 1em; }

.container {
    width: min(100% - 40px, 1200px);
    margin-inline: auto;
}

.section {
    padding-block: var(--section-gap, 96px);
}

.section--tight {
    padding-block: calc(var(--section-gap, 96px) / 2);
}

.section-head {
    max-width: 760px;
    margin-inline: auto;
    margin-bottom: 48px;
    text-align: center;
}

.section-head .eyebrow {
    display: block;
}

.section-head::after {
    margin-inline: auto;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--primary, #e32026);
}

.section-title {
    font-family: var(--font-heading, inherit);
}

.muted { color: var(--muted, #a9b7c6); }
.text-center { text-align: center; }

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg, rgba(16, 27, 40, .92));
    backdrop-filter: blur(14px);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    min-height: 78px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: var(--primary, #e32026);
    color: #fff;
    font-family: var(--font-heading, inherit);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
    font-family: var(--font-heading, inherit);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.1;
    text-transform: uppercase;
}

.brand-text small {
    margin-top: 4px;
    font-family: var(--font-body, inherit);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: .18em;
    opacity: .7;
}

.brand-logo {
    display: none;
    height: 60px;
    width: auto;
    object-fit: contain;
    color: var(--primary, #e32026);
    flex-shrink: 0;
}

.brand--footer .brand-logo {
    height: 128px;
}

[data-theme="editorial"] .brand-logo {
    filter: grayscale(1) brightness(.35);
}

[data-theme="classic"] .brand-logo,
[data-theme="editorial"] .brand-logo,
[data-theme="vk"] .brand-logo {
    display: block;
}

[data-theme="classic"] .brand-mark,
[data-theme="editorial"] .brand-mark,
[data-theme="vk"] .brand-mark {
    display: none;
}

[data-theme="classic"] .brand--footer .brand-text,
[data-theme="editorial"] .brand--footer .brand-text,
[data-theme="vk"] .brand--footer .brand-text {
    display: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
    font-size: 14px;
}

.main-nav a {
    padding-block: 8px;
    opacity: .82;
    transition: opacity .18s ease, color .18s ease;
}

.main-nav a:hover,
.main-nav a.active {
    opacity: 1;
    color: var(--primary, #e32026);
}

.header-phone {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.header-cta {
    flex-shrink: 0;
}

.auth {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 78px);
    padding-block: 64px;
    background:
        radial-gradient(800px 400px at 80% 20%, color-mix(in srgb, var(--primary, #e32026) 10%, transparent), transparent),
        var(--bg);
}

.auth-card {
    width: min(100%, 460px);
    padding: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin-bottom: 8px;
    font-size: clamp(1.8rem, 3vw, 2.2rem);
}

.auth-card .form-field input {
    background: var(--surface-2);
}

.auth-card .form-check {
    align-items: center;
}

.auth-card .form-check input {
    min-height: 0;
    width: 18px;
    height: 18px;
}

.auth-submit {
    width: 100%;
}

.auth-links {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.auth-links a {
    color: var(--muted);
}

.auth-links a:hover {
    color: var(--primary);
}

.nav-toggle-checkbox {
    display: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    margin: 5px 0;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border: 1px solid transparent;
    background: var(--primary, #e32026);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-outline {
    background: transparent;
    border-color: var(--border, rgba(255, 255, 255, .2));
    color: var(--text, #fff);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text, #fff);
    padding-inline: 8px;
}

.btn-sm {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 13px;
}

/* Hero */

.hero {
    position: relative;
    overflow: hidden;
    min-height: 620px;
    display: grid;
    align-items: center;
    isolation: isolate;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(1200px 600px at 78% 40%, #2c4056 0%, #101b28 62%),
        linear-gradient(120deg, #101b28, #1e2c3c);
    background-size: cover;
    background-position: center;
}

.hero-art {
    display: none;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--hero-overlay, rgba(16, 27, 40, .8));
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    padding-block: 96px;
}

.hero h1 {
    margin-bottom: 24px;
}

.hero-lead {
    max-width: 620px;
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
    color: var(--muted, #c7d2dd);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}

.hero-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, .15));
}

.hero-fact strong {
    display: block;
    font-family: var(--font-heading, inherit);
    font-size: 30px;
    line-height: 1.1;
    color: var(--primary, #e32026);
}

.hero-fact span {
    font-size: 13px;
    color: var(--muted, #a9b7c6);
}

/* Cards and grids */

.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface, #1e2c3c);
    border: 1px solid var(--border, rgba(255, 255, 255, .12));
    border-radius: var(--radius, 4px);
    transition: border-color .18s ease, transform .18s ease;
}

.card-body {
    padding: 24px;
}

.card h3 {
    margin-bottom: 10px;
}

.card p {
    margin: 0;
    color: var(--muted, #a9b7c6);
}

.card-media {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    color: var(--primary, #e32026);
    font-size: 14px;
    font-weight: 600;
}

/* Forms */

.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field--full {
    grid-column: 1 / -1;
}

.form-field label {
    font-size: 13px;
    letter-spacing: .02em;
    color: var(--muted, #a9b7c6);
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    background: var(--surface, #1e2c3c);
    border: 1px solid var(--border, rgba(255, 255, 255, .16));
    border-radius: var(--radius, 4px);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.form-field textarea {
    min-height: 140px;
    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--primary, #e32026);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #e32026) 25%, transparent);
}

.form-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    color: var(--muted, #a9b7c6);
}

.form-check input { margin-top: 4px; }

.form-error {
    color: #ff6b6b;
    font-size: 13px;
}

.form-success {
    padding: 16px 20px;
    border: 1px solid var(--primary, #e32026);
    background: color-mix(in srgb, var(--primary, #e32026) 12%, transparent);
}

/* Footer */

.site-footer {
    padding-block: 64px 32px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, .12));
    background: var(--surface, #1e2c3c);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 40px;
}

.footer-title {
    margin-bottom: 16px;
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted, #a9b7c6);
}

.footer-links {
    display: grid;
    gap: 10px;
    font-size: 15px;
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, .12));
    font-size: 12px;
    color: var(--muted, #a9b7c6);
}

.footer-credit {
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted, #a9b7c6);
    text-align: right;
}

.footer-credit a {
    color: var(--primary, #e32026);
}

.footer-credit a:hover {
    text-decoration: underline;
}

/* Rich text */

.rich-text {
    max-width: 78ch;
    font-size: 17px;
}

.rich-text h2,
.rich-text h3 {
    margin-top: 1.6em;
}

.rich-text ul,
.rich-text ol {
    padding-left: 1.3em;
}

.rich-text li { margin-bottom: .4em; }

.rich-text blockquote {
    margin: 2em 0;
    padding: 8px 0 8px 24px;
    border-left: 3px solid var(--primary, #e32026);
    font-family: var(--font-heading, inherit);
    font-size: 1.2em;
}

.rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.rich-text th,
.rich-text td {
    padding: 12px 14px;
    border: 1px solid var(--border, rgba(255, 255, 255, .14));
    text-align: left;
}

.rich-text img {
    margin: 1.5em 0;
    border-radius: var(--radius, 4px);
}

/* Articles and public lists */

.post-card,
.case-card {
    height: 100%;
}

.post-card:hover,
.case-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary, #e32026);
}

.post-meta {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted, #a9b7c6);
}

.case-amount {
    display: inline-block;
    margin-top: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary, #e32026);
}

.article {
    max-width: 900px;
    margin-inline: auto;
}

.article-back {
    display: inline-block;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--muted, #a9b7c6);
}

.article-back:hover {
    color: var(--primary, #e32026);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--muted, #a9b7c6);
}

.breadcrumbs a:hover {
    color: var(--primary, #e32026);
}

.breadcrumbs span[aria-hidden="true"] {
    opacity: .45;
}

/* Admin: theme picker */

.theme-choices {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    text-align: center;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.theme-option:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.theme-option.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}

.theme-option.is-active .theme-swatch {
    box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px var(--primary);
}

.theme-swatch {
    width: 64px;
    height: 64px;
    border: 2px solid var(--border);
    border-radius: 50%;
}

.theme-swatch--card {
    background: linear-gradient(135deg, #e32026 0 50%, #101b28 50% 100%);
}

.theme-swatch--classic {
    background: linear-gradient(135deg, #c8a15a 0 50%, #15100d 50% 100%);
}

.theme-swatch--editorial {
    background: linear-gradient(135deg, #8e1b22 0 50%, #f6f3ee 50% 100%);
}

.theme-swatch--vk {
    background: linear-gradient(135deg, #c9a45c 0 50%, #1b1510 50% 100%);
}

.theme-option__title {
    font-size: 14px;
    font-weight: 600;
}

.theme-option__hint {
    font-size: 12px;
    line-height: 1.35;
    color: var(--muted);
}

@media (max-width: 900px) {
    .theme-choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .theme-choices {
        grid-template-columns: 1fr;
    }
}

.article-head h1 {
    margin-bottom: 0;
}

.article-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin: 28px 0 32px;
    border: 1px solid var(--border, rgba(255, 255, 255, .12));
    border-radius: var(--radius, 4px);
}

.article-lead {
    font-size: 19px;
    color: var(--muted, #a9b7c6);
    margin-bottom: 28px;
}

.article-text {
    max-width: none;
}

.article-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, .12));
}

.case-result {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 28px;
    padding: 16px 22px;
    border-left: 3px solid var(--primary, #e32026);
    background: color-mix(in srgb, var(--primary, #e32026) 10%, transparent);
}

.case-result span {
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted, #a9b7c6);
}

.case-result strong {
    font-family: var(--font-heading, inherit);
    font-size: 24px;
}

.empty-state {
    padding-block: 24px;
}

/* Admin */

.admin-thumb {
    width: 72px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.cover-preview {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

:root[data-theme="admin"] {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #eceff3;
    --text: #1c1f24;
    --muted: #5b6470;
    --primary: #b4232a;
    --primary-hover: #941c22;
    --accent: #b08d57;
    --border: #dfe3e8;
    --radius: 6px;
    --shadow: 0 12px 30px rgba(28, 31, 36, .08);
    --font-heading: "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --header-bg: #ffffff;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    padding: 24px 18px;
    background: #171b21;
    color: #e9edf2;
}

.admin-sidebar .brand {
    margin-bottom: 32px;
}

.admin-nav {
    display: grid;
    gap: 4px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    opacity: .78;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255, 255, 255, .08);
    opacity: 1;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.admin-content {
    padding: 28px;
}

.admin-card {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

/* Utilities */

.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

:focus-visible {
    outline: 3px solid var(--primary, #e32026);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

@media (max-width: 1024px) {
    .main-nav { display: none; }
    .header-inner { gap: 16px; }
    .header-phone { margin-left: auto; }
    .nav-toggle { display: block; }
    .nav-toggle-checkbox:checked ~ .main-nav {
        display: flex;
        position: absolute;
        inset: 78px 0 auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 20px;
        background: var(--header-bg, #101b28);
        border-bottom: 1px solid var(--border);
    }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
}

@media (max-width: 560px) {
    .header-phone {
        display: none;
    }

    .nav-toggle {
        margin-left: auto;
    }

    .nav-toggle-checkbox:checked ~ .main-nav {
        inset: 70px 0 auto;
    }

    .brand-logo {
        height: 48px;
    }

    .brand-text {
        font-size: 16px;
    }

    .header-inner {
        gap: 10px;
        min-height: 70px;
    }
}

@media (max-width: 720px) {
    .container { width: min(100% - 32px, 1200px); }
    .header-cta { display: none; }
    .section-head {
        margin-bottom: 32px;
    }
    .site-footer { padding-block: 40px 24px; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .brand--footer .brand-logo { height: 84px; }
    .footer-links { gap: 6px; }
    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        margin-top: 24px;
        padding-top: 16px;
    }
    .hero { min-height: 540px; }
    .hero-content { padding-block: 64px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .admin-content { padding: 18px; }
}
