/* style.css */

/* ==================== Корневые переменные ==================== */
:root {
    --content-width: 960px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;

    --transition: 0.25s ease;
}

:root[data-theme="dark"] {
    --primary-color: #15161c;
    --secondary-color: #1e212b;
    --secondary-color-opacity: #1e212bcc;
    --tertiary-color: #2c3150;
    --tertiary-color-opacity: #2c3150cc;

    --text-color: #f3f4ff;
    --text-color-hover: #aab4ff;
    --text-color-light: #9ca3c7;
    --text-color-opacity: #f3f4ff88;
}

:root[data-theme="light"] {
    --primary-color: #f4f5fb;
    --secondary-color: #e3e7f3;
    --secondary-color-opacity: #e3e7f399;
    --tertiary-color: #cfd8ff;
    --tertiary-color-opacity: #cfd8ffcc;

    --text-color: #1e1f2a;
    --text-color-hover: #4a4d6b;
    --text-color-light: #7a7e9a;
    --text-color-opacity: #1e1f2a88;
}

/* ==================== Шрифты ==================== */
@font-face {
    font-family: "Patefon";
    src: url("/static/fonts/Patefon Regular.otf") format("opentype");
    font-weight: normal;
    font-style: normal;
}

/* ==================== Базовые стили ==================== */
*,
body {
    font-family: "Patefon", Arial, sans-serif;
    font-weight: normal;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--primary-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==================== Контент ==================== */
.content-block {
    width: 100%;
    max-width: var(--content-width);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 24px;
}

.content-block iframe,
.bigbrain iframe,
.text-block iframe {
    width: 100%;
    height: 400px;
    border: none;
    border-radius: var(--radius-md);
}

/* ==================== Текстовые блоки ==================== */
.text-block {
    background: var(--secondary-color);
    padding: 24px;
    border-radius: var(--radius-lg);
    line-height: 1.6;
}

/* ==================== Заголовки ==================== */
.big-header {
    font-size: 2.5rem;
    font-weight: normal;
    text-align: center;
}

.med-header {
    font-size: 1.75rem;
    font-weight: normal;
    text-align: center;
}

.med-header img {
    max-width: 50vw;       /* максимум 50% ширины */
    width: auto;            /* сохраняем пропорции */
    height: auto;           /* сохраняем пропорции */
    display: block;
    margin: 0 auto;         /* центрируем по горизонтали */
}

.light-header {
    font-size: 1rem;
    font-weight: normal;
    color: var(--text-color-light);
    text-align: center;
}

/* ==================== Кнопки ==================== */
.button-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}

.button-block button {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: var(--secondary-color);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    font-weight: normal;
    font-size: 1rem;
}

.button-block button:hover {
    background: var(--tertiary-color);
}

/* Контент внутри кнопки */
.button-block button > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Картинки внутри кнопок */
.button-block button img {
    max-width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
}

button {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--secondary-color);
    color: var(--text-color);
    font-weight: normal;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent; /* iOS/Android */
    touch-action: manipulation; /* предотвращает странные hover эффекты */
}

@media (hover: hover) and (pointer: fine) {
    button:hover {
        background: var(--tertiary-color);
        color: var(--text-color-hover);
    }
}

/* ==================== GitHub кнопки ==================== */
.ghbutton {
    background: #0d1117;
    color: #f0f6fc;
}

.ghbutton:hover {
    background: #161b22;
    color: #f78166;
}

/* ==================== Галерея ==================== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.gallery-item {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--secondary-color);
    transition: transform var(--transition);
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-4px);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==================== Модалка ==================== */
.modal {
    display: none; /* Скрыта по умолчанию */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 1000;
}

.modal-content {
    background: var(--secondary-color);
    border-radius: var(--radius-lg);
    max-width: var(--content-width);
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    display: flex;
    justify-content: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain; /* Изображение не растягивается */
}

/* ==================== Спойлер ==================== */
.spoiler-label {
    font-weight: normal;
    cursor: pointer;
    text-align: center;
}

.spoiler-input {
    display: none;
}

.spoiler-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
}

/* Кнопки внутри спойлеров */
.spoiler-content .button-block button {
    background: var(--tertiary-color); /* немного контрастнее спойлера */
}

.spoiler-input:checked ~ .spoiler-content {
    max-height: 500px;
}

/* ==================== Футер ==================== */
.thin-footer {
    flex-shrink: 0;
    width: 100%;
    text-align: center;
    padding: 12px 0;
    font-weight: normal;
    font-size: 0.9rem;
    color: var(--text-color-opacity);
    background: var(--secondary-color-opacity);
}

.footer-text {
    font-weight: normal;
    font-size: 0.8rem;
}

/* ==================== Парящие кнопки ==================== */
.home-toggle,
.theme-toggle {
    position: fixed;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--secondary-color);
    color: var(--text-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 1000;
}

/* Кнопка "домой" — сверху слева */
.home-toggle {
    top: 20px;
    left: 20px;
}

/* Кнопка темы — снизу справа */
.theme-toggle {
    bottom: 20px;
    right: 20px;
}

.home-toggle:active,
.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:hover,
.home-toggle:hover {
    transform: scale(1.08);
}