:root {
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --badge-bg: #f1f5f9;
    --badge-text: #334155;
    --btn-bg: #1e1b4b;
    /* Тёмно-фиолетовый */
    --btn-hover: #312e81;
    --btn-accent: #f59e0b;
    /* Amber-400 fallback */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --radius-card: 24px;
    --radius-badge: 999px;
    --radius-btn: 999px;
}


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

.page-header {
    max-width: 1280px;
    margin: 2rem auto 1rem auto;
    padding: 0 2rem;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #1e293b, #2d3a4f);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #475569;
    font-size: 1rem;
    border-left: 3px solid #e2e8f0;
    padding-left: 1rem;
}

.teachers-grid {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.teacher-card {
    background: var(--card-bg);
    border: .1rem solid var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.teacher-card:hover {
    /* transform: translateY(-6px); */
    box-shadow: var(--shadow-lg);
    border-color: var(--btn-accent);
}

.avatar-wrapper {
    width: 100%;
    height: 280px;
    background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
    overflow: hidden;
    position: relative;
}

.avatar-wrapper::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.9), transparent);
    pointer-events: none;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.teacher-card:hover .avatar {
    transform: scale(1.03);
}

.teacher-card:hover .avatar {
    transform: scale(1.04);
}

.teacher-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.teacher-name {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}


.teacher-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 28px;
}

.teacher-position {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    color: #4b5563;
    background: #f1f5f9;
    padding: 0.2rem 0.8rem;
    border-radius: 40px;
    letter-spacing: -0.2px;
    margin: .2rem;
}

.badge.position {
    background: var(--badge-bg);
    color: var(--badge-text);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-badge);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.badge.position:hover {
    background: #cbd5e1;
    transform: translateY(-1px);
}

.btn-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--btn-bg);
    color: #fff;
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: auto;
    /* Прижимает кнопку к низу */
    width: 100%;
    font-family: inherit;
}

.btn-arrow {
    transition: transform 0.2s ease;
    width: 16px;
    height: 16px;
}

.btn-details:hover {
    background: var(--btn-hover);
    border-color: var(--btn-accent);
    transform: translateY(-1px);
}

.btn-details:hover .btn-arrow {
    transform: translateX(3px);
}

.btn-details:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    border-radius: 32px;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #1e293b;
    width: 40px;
    height: 40px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: #f1f5f9;
    transform: scale(1.05);
}

.portfolio {
    padding: 1.5rem 2rem 2rem 2rem;
}

.portfolio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eef2ff;
    padding-bottom: 1rem;
    padding-right: 2rem;
}

.portfolio-name {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    flex-shrink: 0;
}

.portfolio-positions-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    /* фиксируем выравнивание по левому краю */
    align-items: center;
    gap: 0.75rem;
    /* единый фиксированный отступ для всех */
    margin: 1rem 0;
}

.position-badge {
    background: var(--indigo-50);
    padding: 0.35rem 1rem;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
}

.position-badge:hover {
    background: #cbd5e1;
    transform: translateY(-1px);
}


/* На мобильных устройствах */
@media (max-width: 767px) {
    .portfolio-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .portfolio-positions-wrapper {
        width: 100%;
        flex-wrap: wrap;
    }
}

.portfolio-role {
    background: #e2e8f0;
    padding: 0.25rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
}

.portfolio-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: #3b82f6;
    font-size: 1.2rem;
}

.section-text {
    color: #334155;
    line-height: 1.6;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 20px;
    font-size: 0.95rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #f8fafc;
    border-radius: 20px;
    padding: 1rem;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5b6e8c;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
}

.languages-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.lang-tag {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.25rem 0.9rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
}

.education-card {
    background: #f8fafc;
    border-radius: 20px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.education-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #5b6e8c;
    margin-bottom: 0.5rem;
}

.education-value {
    font-weight: 600;
    color: #0f172a;
    font-size: 1rem;
}

.contacts-link {
    background: #f1f5f9;
    border-radius: 24px;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
    text-align: center;
}

.contacts-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.contacts-link a:hover {
    gap: 12px;
    color: #1e40af;
}

/* Адаптив */
@media (max-width: 768px) {
    .teachers-grid {
        padding: 0 1rem;
        gap: 1.5rem;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    .avatar-wrapper {
        height: 240px;
    }

    .teacher-info {
        padding: 1.25rem;
    }

    .teacher-name {
        font-size: 1.2rem;
    }
}