/* ==========================================================================
   Shis Space — единый CSS
   Развитие тёмного минимализма (жёлтый акцент #fbbf24, blob, glass).
   v1.0: добавлены светлая тема (через CSS-переменные) и layout с sidebar.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700;900&display=swap');

/* --- Тема: переменные ---
   Тёмная = по умолчанию (data-theme="dark" или отсутствие атрибута).
   Светлая = data-theme="light".
   localStorage('theme') ставится в theme.js ДО первого paint (без мигания). */
:root,
[data-theme="dark"] {
    --bg: #050505;
    --bg-soft: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.06);
    --border-active: #fbbf24;
    --fg: #e5e5e5;
    --fg-muted: #71717a;
    --fg-dim: #a1a1aa;
    --accent: #fbbf24;
    --accent-rgb: 251, 191, 36;
    --shadow: rgba(0, 0, 0, 0.4);
    --blob-opacity: 0.15;
    --code-bg: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
    --bg: #fafafa;
    --bg-soft: #f4f4f5;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-card-hover: rgba(0, 0, 0, 0.05);
    --border: rgba(0, 0, 0, 0.08);
    --border-active: #d97706;
    --fg: #18181b;
    --fg-muted: #71717a;
    --fg-dim: #52525b;
    --accent: #d97706;
    --accent-rgb: 217, 119, 6;
    --shadow: rgba(0, 0, 0, 0.08);
    --blob-opacity: 0.22;
    --code-bg: rgba(0, 0, 0, 0.04);
}

/* --- Базовый сброс --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::selection { background: var(--accent); color: var(--bg); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.15s ease;
}
a:hover { opacity: 0.8; }

/* --- Фоновый эффект (blob) --- */
.blob {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background-color: var(--accent);
    filter: blur(120px);
    opacity: var(--blob-opacity);
    animation: float 20s infinite alternate;
    z-index: 0;
    pointer-events: none;
}

@keyframes float {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(50px, 100px); }
}

/* ==========================================================================
   Layout: sidebar + main
   ========================================================================== */

.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--border);
    background: var(--bg-soft);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    z-index: 40;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
}

.sidebar-brand .name {
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}
.sidebar-brand .name span { color: var(--accent); }

.sidebar-brand .role {
    font-size: 0.7rem;
    color: var(--fg-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.6rem;
    color: var(--fg-dim);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sidebar-link:hover {
    background: var(--bg-card-hover);
    color: var(--fg);
    opacity: 1;
}
.sidebar-link.active {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}
.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-social {
    display: flex;
    gap: 0.25rem;
}
.sidebar-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    color: var(--fg-dim);
    transition: all 0.15s ease;
}
.sidebar-social a:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
    opacity: 1;
}
.sidebar-social svg { width: 18px; height: 18px; }

/* --- Переключатель темы --- */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--fg-dim);
    cursor: pointer;
    transition: all 0.15s ease;
}
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--border-active);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* --- Burger (мобила) --- */
.sidebar-burger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--fg);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.sidebar-burger svg { width: 22px; height: 22px; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 35;
}
.sidebar-backdrop.show { display: block; }

/* --- Main --- */
.main {
    flex: 1;
    min-width: 0;
    padding: 3rem 2.5rem;
    max-width: 900px;
}

.page-header { margin-bottom: 2.5rem; }
.page-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}
.page-header h1 span { color: var(--accent); }
.page-header .lead {
    font-size: 1.05rem;
    color: var(--fg-muted);
    max-width: 60ch;
}

/* --- Анимация появления контента --- */
.animate-enter {
    animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Компоненты
   ========================================================================== */

/* --- Glass-кнопка (унаследована из старого дизайна) --- */
.glass-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--fg);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    cursor: pointer;
}
.glass-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(var(--accent-rgb), 0.2);
    opacity: 1;
}
.glass-btn svg { width: 20px; height: 20px; }

/* --- Карточка --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.2s ease;
}
.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(var(--accent-rgb), 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -12px var(--shadow);
}

/* --- Сетка карточек --- */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* --- Карточка-ссылка (проект) --- */
.project-card {
    display: block;
    text-decoration: none;
    color: inherit;
}
.project-card .card { height: 100%; }
.project-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.project-card h3 .ext-icon {
    width: 14px;
    height: 14px;
    opacity: 0.4;
}
.project-card p {
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-bottom: 0.85rem;
}
.project-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.project-card .tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
    font-weight: 500;
}

/* --- Бейдж (для стека/ролей) --- */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.7rem;
    border-radius: 99px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--fg-dim);
    font-weight: 500;
}

/* --- Список --- */
.list-clean { list-style: none; }
.list-clean li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.list-clean li:last-child { border-bottom: none; }

/* --- Timeline (резюме) --- */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1.75rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.4rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--bg);
}
.timeline-item .period {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.timeline-item h3 { font-size: 1.05rem; font-weight: 700; margin: 0.15rem 0 0.35rem; }
.timeline-item .org { color: var(--fg-muted); font-size: 0.85rem; margin-bottom: 0.4rem; }
.timeline-item p { font-size: 0.9rem; color: var(--fg-dim); }

/* --- Контент / типографика для статичных страниц --- */
.prose h1, .prose h2, .prose h3 { color: var(--accent); margin-top: 1.5rem; }
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 0.85rem; color: var(--fg-dim); }
.prose ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 0.85rem; }
.prose ul li { color: var(--fg-dim); margin-bottom: 0.3rem; padding: 0; border: none; }
.prose strong { color: var(--fg); }
.prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--fg-muted);
    margin-bottom: 1.5rem;
}
.breadcrumbs a { color: var(--fg-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { opacity: 0.5; }
.breadcrumbs .current { color: var(--fg-dim); }

/* --- Footer (внутри main) --- */
.page-footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--fg-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}
.page-footer .subdomains {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* --- Контакт-ссылки --- */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    color: var(--fg);
}
.contact-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateX(4px);
    opacity: 1;
}
.contact-link svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.contact-link .label { font-weight: 600; }
.contact-link .value { color: var(--fg-muted); font-size: 0.85rem; font-family: monospace; }

/* ==========================================================================
   Плашка «Условия взаимодействия» (rules-banner.js)
   ========================================================================== */

.rules-banner-overlay {
    position: fixed;
    inset: 0;
    z-index: 90; /* выше sidebar (40) и burger (50), ниже cookie-баннеров */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Контент сайта под плашкой остаётся доступным для чтения и индексации. */
}

.rules-banner-overlay.rules-banner--visible {
    opacity: 1;
}

.rules-banner {
    width: 100%;
    max-width: 460px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 24px 64px -16px var(--shadow);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rules-banner-overlay.rules-banner--visible .rules-banner {
    transform: translateY(0) scale(1);
}

.rules-banner__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.rules-banner__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 0.6rem;
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
    flex-shrink: 0;
}
.rules-banner__icon svg { width: 20px; height: 20px; }

.rules-banner__head h2 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.rules-banner__text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--fg-dim);
    margin-bottom: 1.25rem;
}

.rules-banner__actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.rules-banner__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.6rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    min-height: 44px; /* комфортный тап на мобиле */
}
.rules-banner__btn svg { width: 17px; height: 17px; }

.rules-banner__btn--primary {
    background: var(--accent);
    color: var(--bg);
    flex: 1 1 auto;
}
.rules-banner__btn--primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.rules-banner__btn--ghost {
    background: transparent;
    color: var(--fg-dim);
    border-color: var(--border);
    flex: 1 1 auto;
}
.rules-banner__btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.rules-banner__legal {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--fg-muted);
}
.rules-banner__legal:hover { color: var(--accent); }

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media (max-width: 1024px) {
    .main { padding: 2.5rem 2rem; }
}

@media (max-width: 768px) {
    /* Sidebar → drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-burger { display: flex; }
    .main {
        padding: 4.5rem 1.25rem 2rem;
    }
    .grid-cards { grid-template-columns: 1fr; }

    /* Увеличенные tap-target для соцсетей (рекомендация 44×44px). */
    .sidebar-social { gap: 0.5rem; }
    .sidebar-social a {
        width: 44px;
        height: 44px;
    }

    /* Плашка правил: читаемо на узких экранах. */
    .rules-banner-overlay { padding: 1rem; align-items: flex-end; }
    .rules-banner {
        padding: 1.25rem;
        border-radius: 1rem 1rem 0 0;
        max-width: 100%;
    }
    .rules-banner__btn { width: 100%; flex-basis: 100%; }
}

/* --- Reveal on scroll (IntersectionObserver в main.js) --- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .blob, .animate-enter { animation: none; }
    [data-reveal] { opacity: 1; transform: none; transition: none; }
    * { transition: none !important; }
}
