:root {
    --color-bg: #0a0411;
    --gradient-bg: linear-gradient(180deg, #2b0135 0%, #14001d 45%, #070010 100%);
    --color-surface: #130018;
    --color-card: rgba(30, 0, 25, 0.85);
    --color-panel: rgba(40, 5, 35, 0.9);
    --color-primary: #ff4d8d;
    --color-primary-dark: #c9184a;
    --color-secondary: #a855f7;
    --color-text: #f8e9ff;
    --color-muted: rgba(248, 233, 255, 0.7);
    --color-border: rgba(255, 255, 255, 0.12);
    --radius-xl: 36px;
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --shadow-md: 0 25px 80px rgba(8, 1, 17, 0.6);
    --container-width: 1220px;
    font-size: 16px;
    --blur: blur(40px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gradient-bg);
    color: var(--color-text);
    min-height: 100vh;
    position: relative;
}

.page-background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 4, 17, 0.7);
    z-index: 0;
    pointer-events: none;
}

.page-wrapper,
.admin-shell,
.admin-main {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    width: min(100%, var(--container-width));
    margin: 0 auto;
    padding: 0 24px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(5, 0, 7, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.header-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 18px 0;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-primary);
}

.main-nav {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Мобильное меню */
@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(5, 0, 7, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 24px;
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .main-nav.is-open {
        opacity: 1;
        visibility: visible;
    }

    .main-nav .nav-link {
        font-size: 1.2rem;
        padding: 16px 24px;
    }
}

.nav-link {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--color-muted);
    transition: 0.2s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--color-text);
    background: rgba(255, 77, 141, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-toggle {
    display: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    position: relative;
    z-index: 100;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.hero {
    padding: 100px 0 60px;
    position: relative;
    overflow: hidden;
}

.hero--split {
    background: transparent;
}

.hero-overlay {
    display: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

.hero-grid--split {
    grid-template-columns: minmax(320px, 1fr) minmax(260px, 360px);
}

.hero__text {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 520px;
}

.hero__title {
    font-size: clamp(2.8rem, 5vw, 3.8rem);
    line-height: 1.15;
    margin: 0;
}

.hero__title span {
    color: #ff7fb1;
    text-transform: lowercase;
}

.hero__subtitle {
    font-size: 1.1rem;
    color: var(--color-muted);
}

.profile-card {
    background: linear-gradient(135deg, rgba(50, 10, 45, 0.9), rgba(35, 5, 30, 0.85));
    border-radius: var(--radius-xl);
    padding: 28px;
    border: 1px solid rgba(255, 77, 141, 0.25);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: floatCard 4.5s ease-in-out infinite alternate;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 24px;
    background: transparent;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
}

.profile-avatar__circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: grid;
    place-items: center;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
}

.profile-card__body {
    text-align: center;
}

.profile-card__body h2 {
    margin: 0;
}

@keyframes floatCard {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-12px);
    }
}

.card {
    background: linear-gradient(135deg, rgba(45, 5, 40, 0.9), rgba(30, 0, 25, 0.85));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 77, 141, 0.2);
    padding: 32px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: var(--blur);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 77, 141, 0.2), transparent 45%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.card:hover::after {
    opacity: 1;
}

.card--accent {
    background: linear-gradient(135deg, rgba(255, 77, 141, 0.95), rgba(168, 85, 247, 0.85));
    border: none;
}

.avatar-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: grid;
    place-items: center;
    font-size: 2rem;
    font-weight: 700;
}

.roles {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.roles li {
    align-self: center;
}

.hero-buttons {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.text-panel {
    background: linear-gradient(135deg, rgba(40, 5, 35, 0.9), rgba(30, 0, 25, 0.85));
    border: 1px solid rgba(255, 77, 141, 0.2);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    color: var(--color-text);
    margin: 12px 0;
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.02);
    display: inline-flex;
    flex-direction: column;
    align-self: flex-start;
    width: fit-content;
    max-width: 100%;
}

.text-panel--hero {
    max-width: 520px;
}

.text-chip,
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    background: rgba(255, 77, 141, 0.18);
    color: var(--color-text);
    border: 1px solid rgba(255, 77, 141, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    width: fit-content;
}

.status-chip {
    background: rgba(168, 85, 247, 0.18);
    border-color: rgba(168, 85, 247, 0.4);
    align-self: flex-start;
}

.fade-up {
    animation: fadeUp 0.8s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 0.8rem;
    color: #ffe3ff;
}

.title {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin: 16px 0;
    line-height: 1.15;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 15px 30px rgba(255, 77, 141, 0.35);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 35px rgba(255, 77, 141, 0.45);
}

.stats-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.projects-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.card--active {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.08);
}

.gallery-directories-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    justify-items: center;
}

/* Базовые стили для карточек директорий */
.gallery-dir-card {
    width: 100%;
    max-width: 280px;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 77, 141, 0.2);
    background: linear-gradient(135deg, rgba(45, 5, 40, 0.9), rgba(30, 0, 25, 0.85));
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, padding 0.2s;
}

.gallery-dir-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.gallery-dir-count {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin: 0;
}

.gallery-dir-card .button {
    width: fit-content;
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Адаптивные размеры для 1 элемента */
.gallery-directories-grid.gallery-dirs-1 {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-directories-grid.gallery-dirs-1 .gallery-dir-card {
    max-width: 100%;
    padding: 32px 40px;
}

.gallery-directories-grid.gallery-dirs-1 .gallery-dir-card h3 {
    font-size: 1.5rem;
}

.gallery-directories-grid.gallery-dirs-1 .gallery-dir-card .button {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Адаптивные размеры для 2 элементов */
.gallery-directories-grid.gallery-dirs-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-directories-grid.gallery-dirs-2 .gallery-dir-card {
    max-width: 100%;
    padding: 32px 40px;
}

.gallery-directories-grid.gallery-dirs-2 .gallery-dir-card h3 {
    font-size: 1.5rem;
}

.gallery-directories-grid.gallery-dirs-2 .gallery-dir-card .button {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Адаптивные размеры для 3-4 элементов */
.gallery-directories-grid.gallery-dirs-3-4 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-directories-grid.gallery-dirs-3-4 .gallery-dir-card {
    max-width: 100%;
    padding: 24px 28px;
}

.gallery-directories-grid.gallery-dirs-3-4 .gallery-dir-card h3 {
    font-size: 1.25rem;
}

/* Для 5+ элементов - стандартная сетка, максимум 5 в строке */
.gallery-directories-grid.gallery-dirs-5plus {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    max-width: 100%;
}

/* Ограничение до 5 элементов в строке для больших экранов */
@media (min-width: 1200px) {
    .gallery-directories-grid.gallery-dirs-5plus {
        grid-template-columns: repeat(5, 1fr);
    }
}

.gallery-dir-card--active {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, rgba(255, 77, 141, 0.3), rgba(168, 85, 247, 0.25));
}

.gallery-media-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.gallery-media-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-media-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-media-thumb img,
.gallery-media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-media-thumb--audio,
.gallery-media-thumb--file {
    background: rgba(255, 255, 255, 0.03);
}

.gallery-media-thumb--audio svg,
.gallery-media-thumb--file svg {
    width: 48px;
    height: 48px;
    color: var(--color-muted);
}

.gallery-media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-media-item:hover .gallery-media-overlay {
    opacity: 1;
}

.gallery-media-overlay svg {
    width: 48px;
    height: 48px;
    color: white;
}

.gallery-media-name {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text);
    text-align: center;
    word-break: break-word;
}

.gallery-media-btn {
    width: 100%;
    justify-content: center;
}

.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.gallery-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    z-index: 1001;
}

.gallery-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.gallery-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-modal-body {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    overflow: auto;
}

.gallery-modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.gallery-modal-body video,
.gallery-modal-body audio {
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius-md);
}

.gallery-modal-body h3 {
    margin-top: 0;
    margin-bottom: 16px;
    text-align: center;
}

.gallery-dir-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.gallery-dir-actions form {
    margin: 0;
}

.skills-grid {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
    justify-content: center;
    gap: 16px 28px;
}

.stat-card {
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.skill-item {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    width: fit-content;
    min-width: 180px;
}

.skill-level {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.skill-level > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.section {
    padding: 60px 0;
}

.section--narrow {
    max-width: 640px;
    margin: 0 auto;
}

.section-title {
    margin-bottom: 16px;
    font-size: 2rem;
    text-align: center;
}

.projects-grid .card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card--success {
    border-color: rgba(35, 209, 255, 0.4);
}

.card--error {
    border-color: rgba(255, 86, 86, 0.6);
    color: #ffbaba;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.contacts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.contact-item {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    width: fit-content;
    max-width: 100%;
}

.contact-item__value a {
    font-weight: 600;
    color: var(--color-text);
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-card {
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 77, 141, 0.2);
    background: linear-gradient(135deg, rgba(45, 5, 40, 0.9), rgba(30, 0, 25, 0.85));
}

.message-card header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--color-muted);
}

.diary-edit summary {
    cursor: pointer;
    color: var(--color-secondary);
    margin-top: 12px;
}

.inline-delete {
    margin-top: 10px;
}

.pagination {
    margin-top: 16px;
    text-align: center;
    color: var(--color-muted);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

input,
textarea,
select {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text);
    font-size: 1rem;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f8e9ff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

select option {
    background: var(--color-surface);
    color: var(--color-text);
    padding: 8px;
}

input[type="file"] {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    padding: 8px 16px;
    margin-right: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    cursor: pointer;
    font-weight: 600;
}

input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

textarea {
    resize: none;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.checkbox-inline input {
    width: auto;
}

.site-footer {
    padding: 24px 0;
    border-top: 1px solid var(--color-border);
    background: rgba(5, 6, 10, 0.9);
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-content p {
    margin: 0;
    color: var(--color-muted);
}

.footer-content a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-content a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.stack-trace {
    margin-top: 20px;
    background: #000;
    padding: 16px;
    border-radius: var(--radius-sm);
    max-height: 300px;
    overflow: auto;
    font-size: 0.85rem;
}

.admin-body {
    background: var(--color-surface);
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: linear-gradient(135deg, rgba(45, 5, 40, 0.95), rgba(30, 0, 25, 0.9));
    border-right: 1px solid rgba(255, 77, 141, 0.2);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid var(--color-border);
}

.admin-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-nav__link {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
}

.admin-nav__link:hover {
    border-color: var(--color-border);
}

.admin-main {
    padding: 40px;
}

.admin-main--public {
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 24px;
    width: 100%;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.button--ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--color-text);
}

/* Мобильная навигация */
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    z-index: 100;
}

.nav-toggle span {
    height: 2px;
    width: 24px;
    background: var(--color-text);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

.main-nav.is-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 4, 17, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    z-index: 99;
    padding: 80px 24px 24px;
}

.main-nav.is-open .nav-link {
    font-size: 1.25rem;
    padding: 16px 24px;
}

/* Мобильная оптимизация */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .header-grid {
        grid-template-columns: 1fr auto;
        padding: 12px 0;
    }

    .main-nav {
        display: none;
    }

    .main-nav.is-open {
        display: flex;
    }

    .nav-toggle {
        display: inline-flex;
    }

    /* Hero секция */
    .hero {
        padding: 60px 0;
    }

    .hero__title {
        font-size: 2rem !important;
    }

    .hero__subtitle {
        font-size: 1rem !important;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .hero-buttons .button {
        width: 100%;
    }

    .hero-grid--split {
        grid-template-columns: 1fr !important;
        gap: 24px;
    }

    .profile-card {
        order: -1;
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
        padding: 20px;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .profile-avatar img {
        border-radius: 50%;
    }

    .profile-card__body h2 {
        font-size: 1.2rem;
    }

    .profile-card__body p {
        font-size: 0.9rem;
    }

    /* Секции */
    .section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.75rem !important;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    /* Карточки */
    .card {
        padding: 20px;
    }

    /* Сетки */
    .projects-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .admin-grid {
        grid-template-columns: 1fr !important;
    }

    .skills-grid {
        grid-template-columns: 1fr !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Галерея */
    .gallery-directories-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .gallery-directories-grid.gallery-dirs-2,
    .gallery-directories-grid.gallery-dirs-3-4 {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }

    .gallery-media-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .gallery-media-item {
        gap: 8px;
    }

    .gallery-media-thumb {
        aspect-ratio: 1;
    }

    .gallery-media-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .gallery-media-name {
        font-size: 0.8rem;
    }

    /* Формы */
    .contact-form {
        gap: 16px;
    }

    .contact-form label {
        font-size: 0.95rem;
    }

    .contact-form input,
    .contact-form textarea,
    .contact-form select {
        padding: 12px;
        font-size: 0.95rem;
    }

    .button {
        padding: 12px 20px;
        font-size: 0.95rem;
        width: 100%;
    }

    .button--ghost {
        width: 100%;
    }

    /* Админ панель */
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        gap: 12px;
        border-bottom: 1px solid var(--color-border);
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(5, 0, 7, 0.95);
        backdrop-filter: blur(20px);
    }

    .admin-sidebar .admin-nav {
        flex-direction: row;
        gap: 8px;
    }

    .admin-nav__link {
        padding: 8px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .admin-brand {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .admin-main {
        padding: 16px;
    }

    /* Модальные окна */
    .gallery-modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        margin: 20px;
    }

    /* Таблицы */
    .messages-list {
        gap: 12px;
    }

    .message-card {
        padding: 16px;
    }

    .message-card header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Footer */
    .site-footer {
        padding: 32px 0;
    }

    .footer-content {
        gap: 12px;
    }

    .footer-content p {
        font-size: 0.9rem;
    }
}

/* Планшеты */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .gallery-media-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .admin-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .hero__title {
        font-size: 1.5rem !important;
    }

    .section-title {
        font-size: 1.5rem !important;
    }

    .card {
        padding: 16px;
    }

    .profile-card {
        padding: 16px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .profile-card__body h2 {
        font-size: 1rem;
    }

    .profile-card__body p {
        font-size: 0.85rem;
    }

    .gallery-media-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .gallery-media-thumb {
        aspect-ratio: 1;
    }

    .gallery-directories-grid {
        gap: 12px;
    }

    .gallery-dir-card {
        padding: 16px;
    }

    .gallery-dir-card h3 {
        font-size: 1rem;
    }

    .button {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Горизонтальная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 40px 0;
    }

    .profile-card {
        max-width: 180px;
        padding: 16px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .hero-grid--split {
        grid-template-columns: 1fr auto !important;
        align-items: center;
    }

    .profile-card {
        order: 0;
    }
}

/* Модальное окно капчи */
.captcha-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.captcha-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 4, 17, 0.95);
    backdrop-filter: blur(8px);
}

.captcha-modal-content {
    position: relative;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    z-index: 1;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.captcha-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--color-border);
}

.captcha-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.captcha-modal-close {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.captcha-modal-close:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.1);
}

.captcha-modal-body {
    padding: 24px;
}

.captcha-description {
    color: var(--color-muted);
    margin: 0 0 20px;
    line-height: 1.6;
}

.captcha-question {
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 24px 0;
    padding: 20px;
    background: rgba(255, 77, 141, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 77, 141, 0.2);
}

.captcha-input-label {
    display: block;
    margin-bottom: 16px;
}

.captcha-input-label input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.1rem;
    text-align: center;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: all 0.2s ease;
}

.captcha-input-label input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 77, 141, 0.1);
}

.captcha-error {
    color: var(--color-primary-dark);
    background: rgba(201, 24, 74, 0.1);
    border: 1px solid rgba(201, 24, 74, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 0.9rem;
}

.captcha-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--color-border);
}

.captcha-modal-footer .button {
    min-width: 120px;
}

