:root {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-surface: #FEF7FF;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-outline: #79747E;
    --radius-large: 28px;
    --radius-medium: 16px;
    --radius-small: 8px;
    --radius-round: 50%;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

body::before {
    content: "";
    position: fixed; /* Фиксируем намертво */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Уводим на задний план */
    background-image: url('images/back.jpg');
    background-repeat: no-repeat;
    background-position: bottom right;
    background-size: cover;
    /* Теперь картинка не зависит от высоты контента или анимаций */
}

body {
    background-color: var(--md-sys-color-surface);
    color: #1C1B1F;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    min-height: 100vh; /* Чтобы body всегда был во весь экран */
}

.container {
    max-width: 900px;
    width: 100%;
}

/* Animations */
.fade-in {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Header & Photo */
.profile-card {
    background: var(--md-sys-color-primary-container);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px;
    margin-bottom: 24px;
    border-radius: var(--radius-large);
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.header-main-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.avatar-wrapper {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-round);
    overflow: hidden;
    border: 4px solid var(--md-sys-color-primary);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--md-sys-color-surface);
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.avatar-wrapper:hover {
    transform: scale(1.05) rotate(-2deg);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.avatar-wrapper:hover .profile-photo {
    transform: scale(1.1);
}

/* Typography */
h1 { margin: 0; font-size: 2.2rem; font-weight: 500; color: #1C1B1F; }
h2 { color: var(--md-sys-color-primary); margin: 40px 0 24px 0; display: flex; align-items: center; gap: 12px; }
h3 { display: flex; align-items: center; gap: 12px; margin-top: 0; color: var(--md-sys-color-primary); }
h4 { margin: 0; font-size: 1.1rem; color: #1C1B1F; }
.subtitle { margin: 4px 0 0; font-size: 1.1rem; color: var(--md-sys-color-primary); font-weight: 500; }

/* Cards */
.card {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-large);
    padding: 24px;
    margin-bottom: 16px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

/* Layout Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 16px;
    margin-bottom: 40px;
}

/* Chips & UI Elements */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 8px 16px;
    border-radius: var(--radius-medium);
    font-size: 0.85rem;
    font-weight: 500;
}

.timeline-item .date { font-size: 0.85rem; opacity: 0.7; margin-bottom: 4px; }
.timeline-item .position { font-weight: 500; margin: 0; }

/* Cases Section */
.cases-section { margin-top: 40px; }

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

.case-card {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-large);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.case-card:hover {
    transform: translateY(-5px);
    border-color: rgba(103, 80, 164, 0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.case-header {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    gap: 16px;
    transition: background-color 0.3s ease;
}

.case-header:hover {
    background-color: rgba(103, 80, 164, 0.05);
}

.case-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-medium);
    overflow: hidden;
    flex-shrink: 0;
}

.case-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.case-title { flex-grow: 1; }

.case-date { font-size: 0.8rem; color: var(--md-sys-color-outline); margin-top: 4px; }

.expand-icon { transition: transform 0.3s ease; color: var(--md-sys-color-primary); }

.case-card.active .expand-icon { transform: rotate(180deg); }

.case-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.case-card.active .case-content { max-height: 500px; }

.case-description { padding: 0 16px 16px; border-top: 1px solid rgba(0,0,0,0.05); }

.case-description p { margin-top: 0; margin-bottom: 12px; line-height: 1.5; }

.case-description ul { margin: 12px 0; padding-left: 20px; }

.case-description li { margin-bottom: 8px; line-height: 1.4; }

.case-tech { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.tech-tag {
    background: rgba(103, 80, 164, 0.1);
    color: var(--md-sys-color-primary);
    padding: 4px 12px;
    border-radius: var(--radius-small);
    font-size: 0.8rem;
    font-weight: 500;
}

/* FAB Button */
.fab {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-medium);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Cases Header Card */
.cases-header-card {
    background: var(--md-sys-color-surface-variant);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border-radius: var(--radius-medium);
    margin: 0 auto 24px auto;
    max-width: 400px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cases-header-card h2 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Media Queries for Mobile */
@media (max-width: 650px) {
    .grid { grid-template-columns: 1fr; gap: 16px; }
    .cases-grid { grid-template-columns: 1fr; gap: 16px; }
    .header-main-content { flex-direction: column; text-align: center; gap: 16px; }
    .profile-card { flex-direction: column; gap: 20px; }
    body { background-attachment: scroll; }
}

@media (max-width: 480px) {
    .container { padding: 10px; }
    .avatar-wrapper { width: 80px; height: 80px; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1rem; }
    .subtitle { font-size: 0.95rem; }
    .card { padding: 16px; }
    .grid { gap: 12px; }
    .cases-grid { gap: 12px; }
    .header-main-content { gap: 12px; }
    .case-header { flex-direction: column; align-items: flex-start; }
    .case-image { width: 100%; height: auto; margin-bottom: 8px; }
}