:root {
    --bg-color: #fefefe;
    --text-color: #333;
    --line-color: rgba(0, 0, 0, 0.15);
    --accent-color: #a8d8ea;
    --secondary-color: #ffd5cd;
    --tertiary-color: #e8f6ef;
    --grid-size: 200px;
    --grid-size-h: 220px;
}

.dark-theme {
    --bg-color: #1a1a2e;
    --text-color: #e6e6e6;
    --line-color: rgba(255, 255, 255, 0.2);
    --accent-color: #16213e;
    --secondary-color: #0f3460;
    --tertiary-color: #1b3a57;
}

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

body {
    font-family: 'Ubuntu', sans-serif;
    
    font-weight: lighter;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
    padding: 0;
}

a {
    font-family: 'Stack Sans Notch', sans-serif;
    color: inherit;
    text-decoration: none;
    font-weight: 300;
    text-transform: uppercase;
}

/* Основной контейнер с сеткой */
.grid-container {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: repeat(6, var(--grid-size));
    grid-auto-rows: var(--grid-size-h);
    justify-content: center;
    align-content: start;
    padding: var(--grid-size);
    gap: 0;
}

/* Блоки контента */
.grid-block {
    position: relative;
    z-index: 2;
    background: var(--bg-color);
    border-radius: 0;
    padding: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.grid-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--line-color);
    z-index: 3;
}

.grid-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-color);
    z-index: -1;
    opacity: 0.1;
}

.grid-block.secondary::before {
    background: var(--secondary-color);
}

.grid-block.tertiary::before {
    background: var(--tertiary-color);
}

.grid-block.hero-block::before {
    background: transparent;
    opacity: 1;
}

/* Блоки с видео */
.video-block {
    position: relative;
    background: #000;
    transition: transform 0.3s ease;
}

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
}

/* Фильтры для видео в темной теме */
.dark-theme .video-container video {
    filter: sepia(0.4) hue-rotate(180deg) saturate(0.7) brightness(0.8);
}

/* Фильтры для видео в светлой теме */
body:not(.dark-theme) .video-container video {
    filter: sepia(0.3) hue-rotate(30deg) saturate(0.8) brightness(1.1);
}

/* Убираем фильтр и запускаем видео при наведении */
.video-block:hover .video-container video {
    filter: none !important;
}

/* Индикатор воспроизведения */
.play-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.play-indicator::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 20px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 5px;
}

.video-block:hover .play-indicator {
    opacity: 0;
}

/* Размеры блоков пропорциональные сетке */
.size-1x1 { width: calc(var(--grid-size) * 1); height: calc(var(--grid-size-h) * 1); }
.size-2x1 { width: calc(var(--grid-size) * 2); height: calc(var(--grid-size-h) * 1); }
.size-1x2 { width: calc(var(--grid-size) * 1); height: calc(var(--grid-size-h) * 2); }
.size-2x2 { width: calc(var(--grid-size) * 2); height: calc(var(--grid-size-h) * 2); }
.size-3x1 { width: calc(var(--grid-size) * 3); height: calc(var(--grid-size-h) * 1); }
.size-3x2 { width: calc(var(--grid-size) * 3); height: calc(var(--grid-size-h) * 2); }
.size-4x2 { width: calc(var(--grid-size) * 4); height: calc(var(--grid-size-h) * 2); }
.size-4x1 { width: calc(var(--grid-size) * 4); height: calc(var(--grid-size-h) * 1); }

/* Специфичные блоки */
.hero-block {
    background: var(--bg-color) !important;
    justify-content: center;
}

.contact-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

/* Типография */
.hero-title {
    font-size: 4rem;
    font-weight: 300;
    line-height: 1.1;
    margin-bottom: 20px;
    font-family: 'Stack Sans Notch', sans-serif;
}

.hero-subtitle {
    font-size: 1.3rem;
    line-height: 1.4;
    opacity: 0.8;
    font-weight: lighter;
}

.block-title {
    font-size: 1.6rem;
    font-weight: 300;
    margin-bottom: 15px;
    line-height: 1.2;
    font-family: 'Stack Sans Notch', sans-serif;
}

.block-text {
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0.7;
    font-weight: lighter;
}

.contact-info {
    font-size: 0.85rem;
    line-height: 1.5;
}

.contact-info p {
    margin-bottom: 10px;
}

/* Кнопка */
.btn {
    padding: 12px 30px;
    background: var(--accent-color);
    border: none;
    border-radius: 0;
    color: var(--text-color);
    font-family: 'Ubuntu', sans-serif;
    font-size: 0.9rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

/* Оверлей и форма */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.overlay.active {
    display: flex;
}

.contact-form {
    background: var(--bg-color);
    padding: 40px;
    width: 90%;
    max-width: 500px;
    border-radius: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: transparent;
    border: 1px solid var(--line-color);
    border-radius: 0;
    color: var(--text-color);
    font-family: 'Ubuntu', sans-serif;
    font-size: 0.85rem;
    font-weight: lighter;
}

.contact-form textarea {
    min-height: 120px;
    resize: none;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.form-buttons .btn {
    flex: 1;
}

.btn-secondary {
    background: var(--secondary-color);
}

/* Динамические линии */
.block-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.dynamic-line {
    position: absolute;
    background: var(--line-color);
    pointer-events: none;
    transition: all 0.5s ease;
    opacity: 0.8;
}

.dynamic-line.horizontal {
    height: 0.8px;
}

.dynamic-line.vertical {
    width: 0.8px;
}

/* Переключение темы */
.theme-toggle {
    position: fixed;
    top: 40px;
    right: 40px;
    z-index: 1000;
    background: var(--accent-color);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 28px;
    height: 28px;
    fill: var(--text-color);
}

/* Адаптивность */
@media (max-width: 1400px) {
    :root {
        --grid-size: 180px;
    }
    .grid-container {
        grid-template-columns: repeat(5, var(--grid-size));
    }
}

@media (max-width: 1200px) {
    :root {
        --grid-size: 160px;
    }
    .grid-container {
        grid-template-columns: repeat(4, var(--grid-size));
        padding: calc(var(--grid-size) / 2);
    }
    .hero-title {
        font-size: 2.8rem;
    }
}

@media (max-width: 900px) {
    :root {
        --grid-size: 140px;
    }
    .grid-container {
        grid-template-columns: repeat(3, var(--grid-size));
    }
    .hero-title {
        font-size: 2.2rem;
    }
    .block-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 600px) {
    :root {
        --grid-size: 120px;
    }
    .grid-container {
        grid-template-columns: repeat(2, var(--grid-size));
        padding: 30px;
    }
    .hero-title {
        font-size: 1.8rem;
    }
    
    /* Адаптация для мобильных устройств */
    .theme-toggle {
        top: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .theme-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    .grid-block {
        padding: 20px;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .block-title {
        font-size: 1.2rem;
    }
    
    .contact-info {
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.8rem;
    }
}

/* Мобильная адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    :root {
        --grid-size: 100px;
        --grid-size-h: 120px;
    }
    .grid-container {
        grid-template-columns:100%;
        padding: 20px;
        overflow: hidden;
    }
    .grid-block:first-child {
        width: 100%;
        grid-column: 1/2 !important;
        grid-row: 1/3 !important;
        grid-column-start: 1 !important;
        grid-column-end: 2 !important;
        grid-row-start: 1 !important;
        grid-row-end: 3 !important;
    }
    .grid-block:not(:first-child) {
        grid-column: 1/2 !important;
        grid-row: initial !important;
        grid-column-start: 1 !important;
        grid-column-end: 2 !important;
        grid-row-start: initial !important;
        grid-row-end: initial !important;
    }
    .hero-title {
        font-size: 1.5rem;
    }
    .hero-subtitle {
        font-size: 0.9rem;
    }
    .grid-block {
        padding: 15px;
    }
}