/* ── Святая память — Public Design System ── */

:root {
    /* ── Backgrounds ──────────────────────────────────── */
    --bg-dark: #0a0c12;
    --bg-surface: #12151e;
    --bg-card: #1a1d28;
    --bg-hover: #222636;
    --bg-input: #0e1018;

    /* ── Borders ──────────────────────────────────────── */
    --border: #232840;
    --border-focus: #c8a854;

    /* ── Text ─────────────────────────────────────────── */
    --text-primary: #e8ebf2;
    --text-secondary: #8b92a8;
    --text-dim: #555b72;

    /* ── Brand: Gold ──────────────────────────────────── */
    --gold: #c8a854;
    --gold-light: #e4d292;
    --gold-dark: #9a7e30;
    --gold-glow: rgba(200, 168, 84, 0.15);

    /* ── Accent ───────────────────────────────────────── */
    --accent: #7b93c4;
    --accent-vivid: #8fa8e0;

    /* ── Semantic ─────────────────────────────────────── */
    --success: #5bb88a;
    --warning: #d4a04a;
    --danger: #c75050;

    /* ── Radius ───────────────────────────────────────── */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* ── Typography ───────────────────────────────────── */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
}

/* ── Light Theme ─────────────────────────────────────── */
[data-theme="light"] {
    --bg-dark: #f5f3ee;
    --bg-surface: #ece8df;
    --bg-card: #ffffff;
    --bg-hover: #f0ede5;
    --bg-input: #faf9f6;
    --border: #d8d3c7;
    --border-focus: #9a7e30;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-dim: #999999;
    --gold: #8b6914;
    --gold-light: #6b5210;
    --gold-dark: #5a4410;
    --gold-glow: rgba(139, 105, 20, 0.1);
    --accent: #3b5998;
    --accent-vivid: #2b4a88;
    --success: #2e7d57;
    --warning: #b8860b;
    --danger: #c0392b;
}
[data-theme="light"] body {
    background-image: radial-gradient(circle at 50% -20%, rgba(139, 105, 20, 0.04), transparent 60%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-dark);
    background-image: radial-gradient(circle at 50% -20%, rgba(212, 175, 55, 0.08), transparent 60%);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--accent-vivid); }

/* ── Typography ───────────────────────────────────── */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--gold-light);
}

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 1rem; }

/* ── Header ───────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 72px;
    background: rgba(10, 12, 18, 0.75);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-right: 15px;
}
.header__brand:hover { color: var(--gold-light); }
.header__logo-svg { width: 36px; height: 36px; overflow: visible; flex-shrink: 0; }
.header__icon { font-size: 28px; }

.header__nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}
.nav-link:hover, .nav-link--active {
    color: var(--text-primary);
}

.auth-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Hamburger button (hidden on desktop) ────────── */
.header__burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 210;
    -webkit-tap-highlight-color: transparent;
}
.header__burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
    margin: 6px 0;
}
.header__burger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.header__burger.active span:nth-child(2) {
    opacity: 0;
}
.header__burger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ── Mobile overlay ──────────────────────────────── */
.header__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.3s;
}
.header__overlay.active {
    opacity: 1;
}

/* ── Mobile nav drawer ───────────────────────────── */
@media (max-width: 768px) {
    .header__burger { display: block; }

    .header__nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        height: 100dvh;
        background: var(--bg-card);
        border-left: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 88px 28px 32px;
        gap: 0;
        z-index: 200;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: -8px 0 32px rgba(0,0,0,0.4);
    }
    .header__nav.open {
        transform: translateX(0);
    }
    .header__nav .nav-link {
        font-size: 18px;
        padding: 14px 0;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    .header__nav .nav-link:last-child {
        border-bottom: none;
    }

    .auth-block {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        padding: 0 28px;
        height: 72px;
        z-index: 201;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        justify-content: flex-start;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        border-left: 1px solid var(--border);
    }
    .auth-block.open {
        transform: translateX(0);
    }

    .header__overlay.active {
        display: block;
        opacity: 1;
    }

    .header__brand span {
        font-size: 20px;
    }
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn--primary {
    background: var(--gold);
    color: #000;
}
.btn--primary:hover {
    background: var(--gold-light);
    box-shadow: 0 0 12px var(--gold-glow);
}

.btn--secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn--secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-dim);
}

.btn--accent {
    background: var(--accent);
    color: #fff;
}
.btn--accent:hover {
    background: var(--accent-vivid);
}

.btn--outline {
    background: transparent;
    color: var(--gold);
    border-color: var(--gold);
}
.btn--outline:hover {
    background: rgba(200, 168, 84, 0.1);
}

/* ── Forms ────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(200, 168, 84, 0.1);
}

/* ── Layout ───────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Hero Section ─────────────────────────────────── */
.hero {
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(123, 147, 196, 0.05) 0%, transparent 50%);
    pointer-events: none;
}
.hero__title {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--gold);
}
.hero__subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 3rem;
    line-height: 1.6;
}
.hero__actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* ── Cards ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    word-break: break-word;
    overflow-wrap: break-word;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-color: var(--text-dim);
}

/* ── Footer ───────────────────────────────────────── */
.footer {
    padding: 40px 24px;
    border-top: 1px solid var(--border);
    margin-top: 80px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ── Перевод подсказок ForceGraph3D ───────────────────── */
.scene-nav-info {
    font-size: 0 !important;
}
.scene-nav-info::after {
    content: "ЛКМ: вращение, Колесо: зум, ПКМ: перемещение";
    font-size: 12px;
}

/* Leaflet Tooltip Customization */
.leaflet-tooltip.custom-tooltip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    padding: 10px;
    white-space: normal;
}
.leaflet-tooltip.custom-tooltip::before {
    border-top-color: var(--border);
}

/* ── Custom Scrollbars (Global) ─────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

[data-theme="light"] * {
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid transparent;
    background-clip: padding-box;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    background-clip: padding-box;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    background-clip: padding-box;
}
