/* Locally hosted font subsets used by the original page. */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('assets/fonts/montserrat-cyrillic-wght-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('assets/fonts/montserrat-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Raleway';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('assets/fonts/raleway-cyrillic-wght-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Raleway';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('assets/fonts/raleway-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --site-width: 1200px;
    --primary: #8f7ed6;
    --primary-dark: #7260c2;
    --primary-light: #a897e8;
    --secondary: #ff6b6b;
    --accent: #4ecdc4;
    --link-color: #3498db;
    --link-hover: #2980b9;
    --light: #ffffff;
    --text: #333333;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 12px 25px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.18);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Raleway', sans-serif;
    background: #8f7ed6;
    color: white;
    line-height: 1.6;
    overflow-x: hidden;
    padding: 20px;
}

/* Keep all outer page blocks aligned with the navigation and footer. */
body > .header,
body > main {
    width: 100%;
    max-width: var(--site-width);
    margin-left: auto;
    margin-right: auto;
}

h1, h2, h3, h4, h5 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-strong);
    margin-bottom: 40px;
}

.main-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    text-align: center;
}

.logo {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25); /* Более выраженная тень */
}

.title-text h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.title-text p {
    font-size: 1.5rem;
    opacity: 0.9;
}

.contacts-section {
    margin-top: 30px;
}

.contacts-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    text-decoration: none;
    transition: var(--transition);
}

.contact-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

.contact-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

/* Mission Section */
.mission {
    padding: 60px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-strong);
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-title h2 {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.section-title:after {
    content: '';
    position: absolute;
    width: 80px;
    height: 4px;
    background: var(--secondary);
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

.mission-content {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
}

.mission-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    z-index: 1;
    border-left: 4px solid var(--primary);
}

.mission-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.mission-card i {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.mission-card h3 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.mission-card p {
    color: var(--text);
    font-size: 0.95rem;
}

/* Directions Section */
.directions {
    padding: 60px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-strong);
}

.directions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.direction-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    z-index: 1;
    text-align: center;
    border-top: 4px solid var(--primary);
}

.direction-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.direction-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.direction-card h3 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.direction-card p {
    color: var(--text);
    font-size: 0.95rem;
}

/* Teacher Section */
.teacher {
    padding: 60px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-strong);
}

.teacher-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

.teacher-photo {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    text-align: center;
}

.teacher-photo img {
    width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: var(--shadow-strong);
}

.teacher-info {
    flex: 2;
    min-width: 300px;
}

.teacher-name {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.teacher-position {
    color: #bd3d3d;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.teacher-description {
    color: var(--text);
    margin-bottom: 20px;
}

/* Details Section */
.details {
    padding: 60px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-strong);
}

.details-container {
    max-width: 800px;
    margin: 0 auto;
}

.detail-item {
    background: linear-gradient(to right, #f0eeff, #e6e4f7);
    border-left: 5px solid var(--accent);
    padding: 20px;
    margin: 15px 0;
    border-radius: 0 10px 10px 0;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.detail-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-hover);
}

.detail-icon {
    margin-right: 15px;
    font-size: 1.8rem;
    color: var(--accent);
}

.detail-content strong {
    color: var(--primary-dark);
}

.detail-content {
    color: var(--text);
}

.kryak-link {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
}

.kryak-link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Address Section */
.address {
    padding: 60px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-strong);
}

.address .map-section {
    margin-top: 40px;
}

.address .map-container {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-strong);
    margin-top: 20px;
}

.address .map-container iframe {
    width: 100%;
    height: 400px;
    border: none;
}

.address-description {
    text-align: center;
    margin-top: 25px;
    font-size: 1.2rem;
    color: var(--text);
    line-height: 1.6;
}

.address-description p {
    margin-bottom: 10px;
}

.address-description strong {
    color: var(--primary-dark);
    font-size: 1.3rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .title-text h1 {
        font-size: 2.5rem;
    }
    .title-text p {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .header {
        padding: 30px 20px;
    }

    .title-text h1 {
        font-size: 2.2rem;
    }

    .title-text p {
        font-size: 1.2rem;
    }

    .logo {
        width: 180px;
        height: 180px;
    }

    .section-title h2 {
        font-size: 1.8rem;
    }

    .mission-content {
        flex-direction: column;
        align-items: center;
    }

    .mission-card {
        max-width: 100%;
    }

    .directions-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .teacher-container {
        flex-direction: column;
        text-align: center;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    .contact-link {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }

    .address .map-container iframe {
        height: 350px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .title-text h1 {
        font-size: 1.9rem;
    }

    .logo {
        width: 160px;
        height: 160px;
    }

    .section-title h2 {
        font-size: 1.6rem;
    }

    .directions-grid {
        grid-template-columns: 1fr;
    }

    .detail-item {
        flex-direction: column;
        text-align: center;
    }

    .detail-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .mission-card, .direction-card {
        padding: 20px;
    }

    .address .map-container iframe {
        height: 300px;
    }

    .address-description {
        font-size: 1rem;
    }

    .address-description strong {
        font-size: 1.1rem;
    }
}

/* Navigation */
html {
    scroll-behavior: smooth;
}

#home, #contacts, #main-content, main section[id] {
    scroll-margin-top: 112px;
}

a:focus-visible, button:focus-visible, summary:focus-visible {
    outline: 3px solid #ffb047;
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 20px;
    padding: 10px 16px;
    color: #403177;
    background: white;
    border-radius: 10px;
    transform: translateY(-180%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Navigation layout adapted from the supplied КРЯК page. */
.site-nav {
    position: sticky;
    top: 12px;
    z-index: 50;
    width: 100%;
    max-width: var(--site-width);
    margin: 0 auto 24px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 18px;
    color: #333;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(14px);
}

.nav-brand {
    color: #7260c2;
    font: 800 1.15rem/1.3 'Montserrat', sans-serif;
    text-decoration: none;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 9px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    color: #4b4659;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
    background: #f1eefc;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: currentColor;
    border-radius: 3px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-list {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    margin-left: auto;
    list-style: none;
}

.nav-list > li {
    position: relative;
    max-width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 9px 13px;
    color: #4b4659;
    border-radius: 10px;
    font: 600 0.9rem/1.4 'Montserrat', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-dropdown[open] > .nav-link {
    color: #6c58b7;
    background: #f1eefc;
}

.nav-dropdown summary {
    list-style: none;
}

.nav-dropdown summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown summary::marker {
    content: '';
}

.nav-chevron,
.nav-sub-chevron {
    flex: none;
    width: 10px;
    height: 10px;
    transition: transform 0.2s ease;
}

.nav-dropdown[open] > summary .nav-chevron,
.nav-submenu[open] > summary .nav-sub-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1;
    width: 330px;
    max-width: calc(100vw - 40px);
    padding: 8px;
    color: #4b4659;
    background: #fff;
    border: 1px solid #e8e3f5;
    border-radius: 14px;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    font: 600 0.9rem/1.5 'Montserrat', sans-serif;
}

.nav-dropdown:not([open]) .nav-dropdown-panel {
    display: none;
}

.nav-journals-panel,
.nav-projects-panel {
    /* Leave room for a wrapped sticky bar when text is enlarged. */
    max-height: max(80px, calc(100vh - 200px));
    max-height: max(80px, calc(100dvh - 200px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nav-menu-list,
.nav-submenu-list {
    list-style: none;
}

.nav-menu-list > li + li {
    margin-top: 3px;
}

.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    padding: 9px 13px;
    color: #4b4659;
    border-radius: 10px;
    font: 600 0.9rem/1.4 'Montserrat', sans-serif;
    text-decoration: none;
}

.nav-menu-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.nav-submenu > summary {
    cursor: pointer;
}

.nav-submenu > summary:hover,
.nav-submenu[open] > summary,
.nav-menu-item[href]:hover,
.nav-menu-item[aria-current="page"] {
    color: #6c58b7;
    background: #f1eefc;
}

.nav-submenu-list {
    margin: 4px 0 0;
    padding: 5px 0 5px 10px;
    border-left: 2px solid #e8e3f5;
    background: #faf9fe;
}

.nav-submenu:not([open]) > .nav-submenu-list {
    display: none;
}

.nav-menu-note {
    margin: 8px 13px 4px;
    color: #615674;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
}

@media (max-width: 720px) {
    .site-nav {
        gap: 4px 10px;
        padding: 7px 12px;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* Without JavaScript the menu remains visible and usable. */
    .site-nav.nav-ready .nav-toggle {
        display: flex;
        margin-left: auto;
    }

    .site-nav.nav-ready:not(.is-open) .nav-list {
        display: none;
    }

    .nav-list {
        flex: 0 0 100%;
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        padding-top: 4px;
        border-top: 1px solid #e8e3f5;
    }

    .nav-link {
        justify-content: space-between;
        width: 100%;
    }

    .nav-link span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .nav-dropdown-panel {
        position: static;
        width: 100%;
        max-width: none;
        max-height: none;
        margin-top: 4px;
        overflow: visible;
        box-shadow: none;
    }

    .site-nav.is-open .nav-toggle span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .site-nav.is-open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    .site-nav.is-open .nav-toggle span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* Show the address even if the map service cannot load. */
.address .map-container {
    position: relative;
    min-height: 400px;
    background: #eeeafa;
}

.address .map-container > :not(script):not(.map-fallback) {
    position: relative;
    z-index: 1;
}

.map-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 25px;
    color: #4f427b;
    background:
        linear-gradient(140deg, transparent 42%, rgba(255, 255, 255, 0.6) 42%, rgba(255, 255, 255, 0.6) 45%, transparent 45%),
        linear-gradient(30deg, transparent 51%, rgba(255, 255, 255, 0.65) 51%, rgba(255, 255, 255, 0.65) 54%, transparent 54%),
        #eeeafa;
    text-align: center;
    font-weight: 600;
}

.map-fallback-icon {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    color: white;
    background: var(--primary-dark);
    border-radius: 50%;
    font-size: 1.4rem;
    box-shadow: 0 8px 18px rgba(86, 63, 160, 0.25);
}

/* Footer adapted from the supplied КРЯК page. */
.site-footer {
    width: 100%;
    max-width: var(--site-width);
    margin: 40px auto 0;
    padding: 24px 28px;
    color: #4b4659;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    font-family: 'Montserrat', sans-serif;
    text-align: left;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.footer-text {
    flex: 1;
    min-width: 0;
}

.footer-credit {
    margin: 0 0 10px;
    color: #7260c2;
    font-size: 1rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.footer-notice {
    margin: 0;
    color: #4b4659;
    font-size: 0.82rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .address .map-container {
        min-height: 350px;
    }

    .footer-content {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    .site-footer {
        margin-top: 28px;
        padding: 20px 18px;
    }

    .footer-credit {
        font-size: 0.92rem;
    }

    .footer-notice {
        font-size: 0.76rem;
    }
}

@media (max-width: 480px) {
    .mission-card, .teacher-info, .teacher-photo {
        min-width: 0;
        width: 100%;
    }

    .address .map-container {
        min-height: 300px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
