/* Strict Business Design CSS with Pop-Art Accents */
:root {
    /* Strict Color Palette */
    --color-black: #0F0F0F;
    --color-dark: #1A1A1A;
    --color-grey-dark: #333333;
    --color-grey-light: #F4F4F4;
    --color-white: #FFFFFF;
    --color-border: #E0E0E0;
    --color-accent: #FF2A2A;
    /* A pop of Lichtenstein red */

    /* Typography */
    --font-heading: 'Oswald', sans-serif;
    --font-text: 'Manrope', sans-serif;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: 70px;
    overflow-x: hidden;
}

body {
    font-family: var(--font-text);
    color: var(--color-black);
    background-color: var(--color-white);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Typography Utilities */
.tracking-tight {
    letter-spacing: -0.03em;
    text-transform: uppercase;
    font-family: var(--font-heading);
}

.tracking-wide {
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: var(--font-heading);
    font-size: 0.9rem;
}

.d-block {
    display: block;
}

.text-center {
    text-align: center;
}

.text-white {
    color: var(--color-white) !important;
}

.text-grey {
    color: #888888;
}

.text-accent {
    color: var(--color-accent);
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mt-5 {
    margin-top: 3rem;
}

.pt-4 {
    padding-top: 1.5rem;
}

.border-top {
    border-top: 1px solid #333;
}

/* Backgrounds & Unique Pop-Art Patterns */
.hero {
    position: relative;
    overflow: hidden;
    background-color: var(--color-white);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0 !important;
}

.hero-centering-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.hero-spacer {
    flex: 1;
    min-height: 20px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Pure white background for the whole section blend */
    background-color: #0056b3;
    background-image: url('images/vector-bright-black-and-white-rays-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    /* Screen mode: Black rays become the BG color (Blue), White stays White */
    background-blend-mode: screen;

    /* High contrast makes the blue more vibrant and the white more 'pure' */
    filter: contrast(1.8) brightness(1.2);

    opacity: 0.35;
    /* Visible but professional */
    z-index: 0;
    pointer-events: none;
}

.hero-layout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
    z-index: 2;
    gap: 40px;
}

.hero-content {
    flex: 1;
    perspective: 1000px;
    text-align: left;
}

.hero-title {
    font-size: 5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 40px;
    font-weight: 500;
    text-transform: uppercase;
}

.hero-image-wrapper {
    flex: 1;
    perspective: 1000px;
    overflow: visible;
    position: relative;
    margin-top: 40px;
    margin-bottom: 40px; /* Standard gap to Button (mobile/stack) */
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Custom Thought Bubble */
.speech-bubble {
    position: absolute;
    top: -40px;
    right: -20px;
    max-width: 70%;
    background: var(--color-white);
    padding: 25px 30px;
    border: 3px solid var(--color-black);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-black);
    box-shadow: 10px 10px 0px rgba(0, 0, 0, 1);
    transform: rotate(3deg);
    text-align: center;
    line-height: 1.2;
    z-index: 10;
}

/* Small circles for thought bubble effect */
.speech-bubble::after,
.speech-bubble::before {
    content: '';
    position: absolute;
    background: var(--color-white);
    border: 3px solid var(--color-black);
    border-radius: 50%;
    z-index: 1;
}

/* Medium circle */
.speech-bubble::after {
    width: 25px;
    height: 25px;
    bottom: -30px;
    left: 20%;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

/* Smallest circle */
.speech-bubble::before {
    width: 15px;
    height: 15px;
    bottom: -50px;
    left: 10%;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 1);
}

.bubble-wide {
    max-width: 95% !important;
    width: 95% !important;
    border-radius: 40px !important;
}

/* Hero Marquee */
.hero-marquee-container {
    position: relative;
    width: 100%;
    background-color: var(--color-black);
    color: var(--color-white);
    padding: 15px 0;
    overflow: hidden;
    z-index: 10;
    border-top: 2px solid var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
    display: flex;
}

.hero-marquee {
    display: flex;
    white-space: nowrap;
    -webkit-animation: marquee-scroll-reverse 80s linear infinite;
    animation: marquee-scroll-reverse 80s linear infinite;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-marquee:hover {
    -webkit-animation-play-state: paused;
    animation-play-state: paused;
}

.hero-marquee span {
    display: inline-flex;
    align-items: center;
}

.hero-marquee span::after {
    content: "•";
    display: inline-block;
    color: var(--color-accent);
    margin: 0 40px;
    font-size: 2rem;
    vertical-align: middle;
    line-height: 0;
}

@-webkit-keyframes marquee-scroll {
    0% {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
    100% {
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
    }
}

@keyframes marquee-scroll {
    0% {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
    100% {
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
    }
}

@-webkit-keyframes marquee-scroll-reverse {
    0% {
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
    }
    100% {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}

@keyframes marquee-scroll-reverse {
    0% {
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
    }
    100% {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}

/* Trust Logos Section */
.trust-section {
    margin-top: 80px;
    margin-bottom: 20px;
}

.trust-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    text-transform: uppercase;
    color: var(--color-grey-dark);
    letter-spacing: 0.1em;
    margin-bottom: 40px;
}

.trust-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 60px;
}

.trust-logos img {
    max-height: 40px;
    width: auto;
    filter: grayscale(100%);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.trust-logos img:hover {
    opacity: 1;
    filter: grayscale(0%);
}

/* About Animated Text */
.about-text-container {
    margin-top: 100px !important;
    margin-bottom: auto;
    text-align: justify;
    max-width: 100%;
}

.stagger-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    line-height: 1.3;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-align: justify;
}

.stagger-char {
    display: inline-block;
    will-change: transform, opacity;
}

/* 01 Legend Section - Pop-Art Halftone Dots Background */
.legend-section {
    background-color: var(--color-white);
    background-image: radial-gradient(rgba(0, 0, 0, 0.05) 20%, transparent 20%);
    background-size: 15px 15px;
    /* Classic pop-art dot size */
}

/* Ensure About content layout is at the top, while animated text centers in the rest */
.legend-section .legend-layout {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 02 Director & Myths Sections - Blue Rays Pattern */
.director-section,
.myths-section {
    position: relative;
    overflow: hidden;
    background-color: var(--color-white) !important;
    z-index: 20 !important;
    /* Гарантирует, что никто сверху не перекроет секцию */
}

.director-section::before,
.myths-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0056b3;
    background-image: url('images/vector-bright-black-and-white-rays-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: screen;
    filter: contrast(1.8) brightness(1.1);
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.director-section>.container,
.myths-section>.container {
    position: relative;
    z-index: 1;
}

/* Enhanced Readability for Ray Backgrounds */
.hero-title,
.hero-subtitle,
.director-section .section-title,
.myths-section .section-title {
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 5px rgba(255, 255, 255, 0.5);
}

.director-text p,
.myths-section .faq-item p {
    position: relative;
    z-index: 2;
}

/* 02 Today Section - Classic Grid Pattern */
.today-section {
    background-color: var(--color-white);
    background-image: linear-gradient(rgba(0, 0, 0, 0.04) 1.5px, transparent 1.5px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1.5px, transparent 1.5px);
    background-size: 35px 35px;
}

/* 03 Code Section - Dense Halftone dots for dark bg */
.bg-dark.code-section {
    background-color: var(--color-dark);
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 8px 8px;
}

/* Footer - Sparse Dots */
.bg-black.site-footer {
    background-color: var(--color-black);
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 20px);
    background-size: 40px 40px;
}

.bg-accent {
    background-color: var(--color-accent);
}

/* Container */
.container {
    width: 100%;
    max-width: 1400px;
    /* Wider container for strict business feel */
    margin: 0 auto;
    padding: 0 40px;
}

/* UI Elements */
.btn-primary {
    display: inline-block;
    padding: 16px 40px;
    background-color: var(--color-black);
    color: var(--color-white);
    text-decoration: none;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.3s ease;
    border: 1px solid var(--color-black);
}

.btn-primary:hover {
    background-color: var(--color-white);
    color: var(--color-black);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    background: transparent;
    border-bottom: none;
    padding: 15px 0; /* Roughly 70px total height */
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.navbar-scrolled {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.navbar-scrolled .logo {
    font-size: 1.8rem;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    text-decoration: none;
    font-size: 2rem;
    color: var(--color-black);
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.05em;
    transition: all 0.4s ease;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 40px;
}

.nav-links li a {
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--color-grey-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    padding: 5px 0;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.nav-links li a:hover {
    color: var(--color-accent);
    font-weight: 800;
}

.nav-links li a:hover::after {
    transform: scaleX(1);
}

.burger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.burger span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--color-black);
    transition: 0.3s;
}

/* Sections General */
.strict-section {
    padding: 110px 0 140px 0; /* Header (70px) + Gap (40px) */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    -webkit-display: flex;
    flex-direction: column;
    -webkit-flex-direction: column;
}

.strict-section>.container {
    margin-top: auto;
    margin-bottom: auto;
}

.section-label {
    color: var(--color-accent);
    /* Focus color */
    margin-bottom: 20px;
    font-weight: 600;
}

.section-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 40px; /* Standard gap to text */
}

.contact-title {
    font-size: 3rem;
    white-space: nowrap;
}

.section-desc {
    font-size: 1.25rem;
    color: var(--color-grey-dark);
    max-width: 600px;
    line-height: 1.8;
}

/* ART FRAMES - The Lichtenstein Accents */
.art-frame {
    background: var(--color-white);
    padding: 12px;
    /* Elegant white frame */
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Softer shadow */
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    position: relative;
    overflow: visible;
}

.art-frame:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.art-frame img {
    width: 100%;
    height: auto;
    display: block;
    outline: none;
    border-radius: 0 !important;
}

.border-grey {
    border-color: #333;
}

/* For dark theme caption */

/* Hero Layout */
/* Hero title and description styles */

.hero-title {
    font-size: 5.5rem;
    line-height: 1;
    margin-bottom: 15px;
}

.hero-desc {
    font-size: 1.5rem;
    color: var(--color-grey-dark);
    margin-bottom: 40px;
    font-weight: 300;
}

/* Hero Legend Animation States */
.hero-image-wrapper,
.title-word,
.char,
.hero-btn {
    visibility: hidden;
    opacity: 0;
}

.title-word {
    display: inline-block;
    transform-origin: 0% 50% -50px;
}

.char {
    display: inline-block;
}

/* Professional Accordion Animation */
.faq-item {
    position: relative;
    z-index: 10;
}

.faq-item summary {
    display: block;
    /* Убирает стандартный маркер списка */
    list-style: none;
    position: relative;
    padding: 25px 0;
    /* Перенесли padding с details на summary для расширения зоны клика */
    padding-left: 40px;
    padding-right: 0;
    /* Место для иконки крестика слева */
    outline: none;
    transition: color 0.3s ease;
    cursor: pointer;
    user-select: none;
    /* Убирает выделение при быстром клике */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Отключает системную задержку тапа в 300мс на мобильных устройствах */

    /* Стили текста из инлайна */
    font-weight: bold;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    text-transform: uppercase;
    color: var(--color-black);
    z-index: 10;
}

/* Полностью скрываем дефолтные треугольники во всех браузерах */
.faq-item summary::-webkit-details-marker,
.faq-item summary::marker {
    display: none;
    content: "";
}

/* Кастомная иконка плюс/минус */
.faq-item summary::after,
.faq-item summary::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 18px;
    height: 3px;
    background-color: var(--color-accent);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    pointer-events: none;
    /* Гарантирует, что клики не будут блокироваться самой иконкой */
}

/* Горизонтальная линия */
.faq-item summary::before {
    transform: translateY(-50%);
}

/* Вертикальная линия (формирует плюс) */
.faq-item summary::after {
    transform: translateY(-50%) rotate(90deg);
}

/* Состояние "Открыто": вертикальная линия ложится на горизонтальную (получается минус) */
details[open].faq-item summary::after {
    transform: translateY(-50%) rotate(0deg);
}

/* Эффект при наведении на заголовок */
.faq-item summary:hover {
    color: var(--color-accent) !important;
}

/* Плавное выпадение текста */
details[open].faq-item p {
    animation: faqReveal 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes faqReveal {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Legend & Director Layout */
.legend-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px 80px;
    align-items: flex-start;
}

.director-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px 80px;
    align-items: flex-start;
}

.legend-layout .section-label,
.director-layout .section-label,
.code-layout .section-label {
    grid-column: 1 / -1;
    margin-bottom: 40px; /* Standard gap to Image/Sidebar */
}

.stats-strip {
    display: flex;
    gap: 60px;
    margin-top: 50px;
    padding-top: 50px;
    border-top: 1px solid var(--color-border);
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-val {
    font-size: 4rem;
    font-family: var(--font-heading);
    line-height: 1;
    color: var(--color-accent) !important;
    font-weight: 500;
}

.stat-name {
    margin-top: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-grey-dark);
}

/* Today Section Layout */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.strict-card {
    padding: 50px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.strict-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 15px 40px rgba(255, 42, 42, 0.1);
}

.card-num {
    display: block;
    font-size: 1rem;
    color: var(--color-accent);
    font-family: var(--font-heading);
    margin-bottom: 20px;
}

.strict-card h3 {
    font-size: 1.8rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    margin-bottom: 15px;
}

.strict-card p {
    color: var(--color-grey-dark);
    font-size: 1.1rem;
}

/* Code Layout */
.code-section {
    padding: 120px 0 60px 0 !important;
    height: 100vh !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: flex-start !important;
    overflow: hidden !important;
}

.code-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 0 80px;
    width: 100%;
    align-items: flex-start;
}

.code-layout .section-label {
    grid-column: 1 / -1;
    margin-bottom: 30px;
}

.code-sidebar {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 40px; /* Standard gap within sidebar */
    text-align: center;
}

.code-main-title {
    margin: 0 !important;
    padding-top: 0;
}

.code-intro-img {
    margin-bottom: 0 !important;
}

.code-text-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 80px), transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 80px), transparent 100%);
}

.code-list {
    display: flex;
    flex-direction: column;
    padding-right: 20px;
}

/* Custom scrollbar for code list */
.code-list::-webkit-scrollbar {
    width: 4px;
}

.code-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.code-list::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 2px;
}

.code-item {
    display: flex;
    gap: 30px;
    padding: 20px 0;
    /* Balanced padding */
    border-bottom: 1px solid #333333;
}

.code-num {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-accent);
    line-height: 1.2;
}

.code-content h4 {
    font-size: 1.5rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.code-content p {
    color: #AAAAAA;
    font-size: 1.1rem;
}

/* Footer Layout */
.site-footer {
    padding: 100px 0 40px 0;
}

.footer-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.footer-cta {
    font-size: 4rem;
    transition: transform 0.3s ease, color 0.3s ease;
    cursor: default;
}

.footer-cta:hover {
    color: var(--color-accent);
    transform: scale(1.02);
}

.vibrate-mark {
    display: inline-block;
    animation: flipAndStand 4s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
    color: var(--color-white);
    margin-left: 5px;
    transform-origin: center;
}

@keyframes flipAndStand {
    0% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(360deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hero-rotate-a1 {
    display: inline-block;
    animation: flipAndStand 4s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
    transform-origin: center;
}



.email-link {
    font-size: 2rem;
    color: var(--color-accent);
    text-decoration: none;
    font-family: var(--font-heading);
    display: inline-block;
    border-bottom: 2px solid transparent;
    transition: 0.3s;
}

.email-link:hover {
    border-bottom-color: var(--color-accent);
}

.footer-info {
    text-align: right;
    font-size: 1.2rem;
}

/* Responsive: Mobile & Portable (up to 1320px) */
@media (max-width: 1320px) {
    .hero-title {
        font-size: 4rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .hero {
        padding-top: 140px;
        /* Больше места под шапку */
        align-items: flex-start;
        height: auto;
        min-height: 100vh;
    }

    .hero-layout {
        flex-direction: column;
        justify-content: flex-start;
        text-align: center;
        gap: 60px;
        margin-top: 0;
    }

    .hero-content {
        text-align: center;
        padding-bottom: 40px;
    }

    .hero-image-wrapper {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        overflow: visible;
    }

    .hero-image-wrapper .speech-bubble {
        top: -30px;
        /* Опускаем облако пониже на средних экранах */
        right: 0;
        left: 0;
        margin: 0 auto;
    }

    .legend-layout,
    .director-layout,
    .code-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .director-text {
        order: 2;
    }

    .director-img {
        order: 1;
    }
}

/* Mobile Nav Bar Fixes (900px and below) */
@media (max-width: 900px) {
    .about-text-container,
    .stagger-text {
        text-align: center !important;
    }

    #code .section-label,
    #code .code-main-title {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    #code .section-label {
        position: relative !important;
        padding-top: 20px;
        padding-bottom: 5px;
    }

    #code .code-main-title {
        position: relative !important;
        padding-bottom: 0px; 
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }
 
    .code-intro-img {
        position: relative !important;
        z-index: 20 !important;
        text-align: center;
        flex-shrink: 0;
        margin-bottom: 40px !important; /* Unified Standard Gap */
    }

    .code-intro-img .art-frame {
        max-width: 100%;
        margin: 0 auto;
        padding: 15px; /* same as base .art-frame */
    }

    .code-intro-img img {
        height: auto !important;
        width: 100% !important;
        object-fit: cover !important;
    }

    .code-section {
        height: auto !important;
        min-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        padding-top: 40px !important; 
        padding-bottom: 60px !important;
        overflow: visible !important;
    }

    .code-layout {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        gap: 0 !important;
        flex: 1;
        overflow: visible !important;
    }

    .code-text-content {
        display: flex !important;
        flex-direction: column !important;
        flex: 1;
        min-height: 0;
        overflow: visible !important;
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }

    .code-list {
        width: 100% !important;
        padding-right: 0 !important;
        position: relative !important;
        margin-top: 0 !important;
        overflow: visible !important;
    }
}

@media (max-width: 768px) {
    .section-label {
        text-align: center !important;
        display: block !important;
        width: 100%;
    }

    .container {
        padding: 0 20px;
    }

    .strict-section {
        min-height: 100vh; /* Consistent base */
    }

    .hero {
        padding-top: 80px !important;
    }

    .hero-layout.container {
        margin-top: 0 !important;
        padding-top: 0;
        /* Lifted higher */
    }

    .hero-layout {
        flex-direction: column;
        gap: 30px;
        justify-content: flex-start !important;
    }

    .hero-content {
        flex: none !important;
        width: 100%;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-title {
        font-size: 2.8rem;
        margin-bottom: 10px;
    }

    .hero-subtitle {
        font-size: 1.2rem;
        margin-bottom: 0;
        /* Closer to button */
        width: 100%;
    }

    .hero-btn {
        display: block !important;
        margin: 30px auto 0 auto !important;
        width: fit-content !important;
        visibility: visible !important;
        opacity: 0;
        animation: heroBtnAppear 1.2s ease-out 0.8s forwards;
    }

    @keyframes heroBtnAppear {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .hero-image-wrapper {
        flex: none !important;
        width: 100%;
        max-width: 100%;
        margin-top: 20px !important;
        /* Reduced from 80px to bring image higher on mobile */
        overflow: visible !important;
    }

    .hero-image {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        /* Гарантируем полный показ */
    }

    .hero-image-wrapper .speech-bubble {
        top: -60px;
        right: 0;
        left: 0;
        margin: 0 auto;
        max-width: 90%;
        font-size: 1.1rem;
        padding: 12px 20px;
    }

    /* Форсируем видимость на мобильных, если GSAP задержится */
    .hero-image-wrapper,
    .title-word,
    .char,
    .hero-btn {
        visibility: visible;
    }

    .section-title {
        font-size: 2.2rem;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .legend-content,
    .director-text {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
    }

    .code-text-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }

    .legend-content *,
    .director-text * {
        text-align: center !important;
    }

    /* Code section title remains centered */
    .code-text-content h2 {
        text-align: center !important;
    }

    .section-desc {
        text-align: center;
    }

    .art-frame {
        margin-left: auto;
        margin-right: auto;
    }

    .contact-title {
        font-size: 2rem !important;
    }

    .nav-links,
    .navbar.menu-open {
        background: rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        max-height: 85vh;
        overflow-y: auto;
        border: none;
        flex-direction: column;
        align-items: center;
        padding: 25px 0;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
        z-index: 9999;
    }

    .nav-links.nav-active {
        display: flex;
        animation: glassAppear 0.4s ease forwards;
    }

    @keyframes glassAppear {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-links li {
        margin: 8px 0;
        width: 100%;
        text-align: center;
    }

    .nav-links li a {
        font-size: 1.1rem;
        color: var(--color-grey-dark);
        letter-spacing: 2px;
        font-weight: 700;
    }

    .burger {
        display: flex;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .stats-strip {
        flex-direction: column;
        gap: 30px;
    }

    .footer-info {
        text-align: left;
    }

    /* Code list items on mobile */
    .code-item {
        gap: 15px;
        padding: 20px 0;
        flex-direction: row;
        /* Put number on the left */
        text-align: left;
        align-items: flex-start;
    }

    .code-num {
        font-size: 1.5rem;
    }

    .code-content h4 {
        font-size: 1.2rem;
    }

    .code-content p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Form grid fix for mobile */
    #contactForm div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .footer-contacts {
        flex-direction: column !important;
        gap: 25px !important;
    }

    .footer-contact-group {
        gap: 25px !important;
    }

    /* Return Dot Nav to the right since pluses are now on the left */
    .dot-nav {
        right: 15px !important;
        left: auto !important;
    }

    .faq-item summary {
        font-size: 1.1rem;
        padding: 20px 0;
        padding-left: 35px;
        padding-right: 0;
    }

    .faq-item summary::before,
    .faq-item summary::after {
        left: 0;
    }
    html {
        scroll-padding-top: 70px !important;
    }

    .strict-section {
        padding: 110px 0 60px 0 !important;
    }

    .legend-layout, .director-layout, .code-layout {
        gap: 40px !important;
    }

    .section-label {
        margin-bottom: 40px !important;
    }

    .section-title {
        margin-bottom: 40px !important;
    }

    .code-sidebar {
        gap: 40px !important;
    }

    .art-frame {
        margin-bottom: 40px !important;
    }
}

/* Dot Navigation */
.dot-nav {
    position: fixed !important;
    top: 50% !important;
    right: 20px !important;
    transform: translateY(-50%) !important;
    z-index: 9000 !important;
    pointer-events: none !important;
    display: block !important;
}

.dot-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dot-nav a {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(128, 128, 128, 0.6);
    background-color: transparent;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    pointer-events: auto !important;
    /* subtle shadow to ensure visibility on light and dark alike */
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2), inset 0 0 2px rgba(0, 0, 0, 0.2);
}

.dot-nav a::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
}

.dot-nav a:hover {
    border-color: #fff;
    background-color: rgba(255, 255, 255, 0.5);
}

.dot-nav a.active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: none;
}

.dot-nav a.active::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 1px solid var(--color-accent);
}

@media (max-width: 900px) {
    .dot-nav {
        display: none !important;
        /* Hide dots on mobile/tablets to avoid overlap */
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Сама подложка не скроллится */
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    /* Центрируем по вертикали */
    justify-content: center;
    /* Центрируем по горизонтали */
}

.modal.active {
    display: flex;
    /* Используем flex для центрирования при активации */
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 20px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    width: 90%;
    max-width: 750px;
    max-height: 85vh;
    height: auto;
    /* Высота подстраивается под текст */
    border-radius: 20px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.modal-body {
    padding: 20px 20px 40px 20px;
    overflow-y: auto;
    /* Прокрутка только для текста */
    flex: 1;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--color-black);
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
}

.close-modal:hover {
    color: var(--color-accent);
}

.modal-body h3 {
    font-family: var(--font-heading);
    margin: 20px 0 10px;
    text-transform: uppercase;
    font-size: 1.2rem;
}

.modal-body p {
    font-size: 0.95rem;
    color: var(--color-grey-dark);
    margin-bottom: 15px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .modal-content {
        margin: 20% auto;
        padding: 25px;
    }
}

/* Specific centering for About text on mobile */
@media (max-width: 900px) {
    .about-text-container,
    .stagger-text {
        text-align: center !important;
    }
}

/* --- Smooth Scroll Stacking Accordion GSAP --- */
.projects-section {
    display: block !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
    min-height: auto !important;
    position: relative;
    z-index: 1;
    background-color: var(--color-grey-light) !important;
    /* Layer 1: Corner Glows for depth, Layer 2: Halftone Circle Pattern */
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 42, 42, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 42, 42, 0.04) 0%, transparent 40%),
        radial-gradient(rgba(255, 42, 42, 0.12) 2px, transparent 0) !important;
    background-size: 100% 100%, 100% 100%, 32px 32px !important;
    background-repeat: no-repeat, no-repeat, repeat !important;
}

.projects-section .container {
    max-width: 1400px !important;
}

.cards-grid.stacking-accordion {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 60px;
    padding-bottom: 60px;
}

.stacking-accordion .strict-card {
    background: #fff;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.08); /* Upward shadow for stack overlap */
    border-radius: 20px;
    border: 1px solid var(--color-border);
    position: relative;
    z-index: 2;
    overflow: hidden; /* Important for height collapse */
    width: 100%;
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .cards-grid.stacking-accordion {
        gap: 25px !important;
        padding-bottom: 50px !important;
        margin-top: 30px !important;
    }

    .stacking-accordion .strict-card {
        border-radius: 15px;
        padding: 25px !important;
        margin-bottom: 0 !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important; /* Standard shadow for mobile */
        overflow: visible !important; /* Ensure nothing is cut off */
    }

    .card-collapse-content {
        height: auto !important;
        overflow: visible !important;
    }
}

