:root {
    --bg: #e0e5ec;
    --shadow-light: #ffffff;
    --shadow-dark: #a3b1c6;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --accent: #4a90d9;
    --glow: rgba(110, 170, 255, 0.85);
    --hero-title-size: 5rem;
    --hero-subtitle-size: 1.5rem;
    --hero-features-size: 1.1rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 60px;
}

.neu-raised {
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 12px 24px;
    font-weight: 600;
}

.neu-raised:hover {
    box-shadow: 12px 12px 20px var(--shadow-dark),
                -12px -12px 20px var(--shadow-light);
}

.neu-raised:active {
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
                inset -4px -4px 8px var(--shadow-light);
}

/* ===== МАГИЯ: свечение по краям и вспышки ===== */
.magic {
    position: relative;
    z-index: 0;
    --delay: 0s;
}

/* Световая линия, пробегающая по верхнему краю */
.magic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 35%;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--glow), transparent);
    filter: blur(1px);
    opacity: 0;
    pointer-events: none;
    animation: edgeRun 9s ease-in-out infinite;
    animation-delay: var(--delay);
}

/* Вспышка-свечение из-за нижнего края плитки */
.magic::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 50%;
    width: 70%;
    height: 26px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(100, 160, 255, 0.55), transparent 70%);
    filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    animation: underGlow 9s ease-in-out infinite;
    animation-delay: calc(var(--delay) + 4.5s);
}

@keyframes edgeRun {
    0% { left: -35%; opacity: 0; }
    8% { opacity: 1; }
    40% { left: 100%; opacity: 1; }
    48% { left: 100%; opacity: 0; }
    100% { left: 100%; opacity: 0; }
}

@keyframes underGlow {
    0%, 78%, 100% { opacity: 0; transform: translateX(-50%) scale(0.85); }
    86% { opacity: 1; transform: translateX(-50%) scale(1.08); }
    94% { opacity: 0; transform: translateX(-50%) scale(0.9); }
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: rgba(224, 229, 236, 0.95);
    backdrop-filter: blur(10px);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hamburger {
    display: none;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: var(--bg);
    box-shadow: 4px 4px 8px var(--shadow-dark),
                -4px -4px 8px var(--shadow-light);
    border-radius: 12px;
    border: none;
    cursor: pointer;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    margin: 0 auto;
    transition: all 0.3s ease;
}

.header-contacts {
    display: flex;
    gap: 20px;
}

.contact-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: var(--text-primary);
}

/* ===== Hero ===== */
.hero {
    min-height: 100vh;
    padding: 120px 0 60px;
    display: flex;
    align-items: center;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
}

.hero-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-title {
    font-size: var(--hero-title-size);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: var(--hero-subtitle-size);
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.hero-features {
    list-style: none;
    font-size: var(--hero-features-size);
    color: var(--text-secondary);
}

.hero-features li {
    margin-bottom: 12px;
}

.hero-right {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.code-stream {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #000;
    opacity: 0.3;
    padding: 120px 60px 60px 60px;
}

.code-stream::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, var(--bg), transparent);
    z-index: 1;
}

.code-stream::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, var(--bg), transparent);
    z-index: 1;
}

.code-content {
    animation: scroll 20s linear infinite;
}

@keyframes scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* ===== Intro (выделенный блок) ===== */
.intro-section {
    padding: 80px 0;
}

.intro-card {
    padding: 70px 60px;
    background: var(--bg);
    box-shadow: 14px 14px 28px var(--shadow-dark),
                -14px -14px 28px var(--shadow-light);
    border-radius: 30px;
    text-align: center;
}

.intro-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--bg);
    text-shadow: 4px 4px 8px var(--shadow-dark),
                 -4px -4px 8px var(--shadow-light);
}

.intro-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ===== Calculator ===== */
.calculator-section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 50px;
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.calculator-options {
    padding: 30px;
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 20px;
}

.calculator-options h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.single-pill-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.single-pill-display {
    flex: 1;
    position: relative;
    height: 60px;
    overflow: hidden;
}

.single-pill-display .pill {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.single-pill-display .pill.active {
    opacity: 1;
    pointer-events: auto;
}

.pill {
    padding: 12px 32px;
    background: var(--bg);
    box-shadow: 4px 4px 8px var(--shadow-dark),
                -4px -4px 8px var(--shadow-light);
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.pill-arrow {
    width: 50px;
    height: 50px;
    min-width: 50px;
    background: var(--bg);
    box-shadow: 4px 4px 8px var(--shadow-dark),
                -4px -4px 8px var(--shadow-light);
    border: none;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pill-arrow:hover {
    box-shadow: 6px 6px 12px var(--shadow-dark),
                -6px -6px 12px var(--shadow-light);
}

.pill-arrow:active {
    box-shadow: inset 2px 2px 4px var(--shadow-dark),
                inset -2px -2px 4px var(--shadow-light);
}

/* Чекбокс скидки */
.discount-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    margin: 10px 0 20px;
    background: var(--bg);
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
                inset -4px -4px 8px var(--shadow-light);
    border-radius: 16px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.discount-toggle:hover {
    box-shadow: inset 5px 5px 10px var(--shadow-dark),
                inset -5px -5px 10px var(--shadow-light);
}

.discount-toggle input {
    display: none;
}

.toggle-track {
    width: 64px;
    height: 34px;
    min-width: 64px;
    border-radius: 20px;
    background: var(--bg);
    box-shadow: inset 3px 3px 6px var(--shadow-dark),
                inset -3px -3px 6px var(--shadow-light);
    position: relative;
    transition: all 0.3s ease;
}

.toggle-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg);
    box-shadow: 3px 3px 6px var(--shadow-dark),
                -3px -3px 6px var(--shadow-light);
    transition: all 0.3s ease;
}

.discount-toggle input:checked + .toggle-track .toggle-thumb {
    left: 34px;
    background: var(--accent);
    box-shadow: 0 0 14px rgba(74, 144, 217, 0.9);
}

.toggle-label {
    font-weight: 600;
    font-size: 1rem;
}

.toggle-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 12px;
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    font-size: 0.85rem;
}

.calculator-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin: 20px 0;
    background: var(--bg);
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
                inset -4px -4px 8px var(--shadow-light);
    border-radius: 16px;
}

.total-label {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.total-wrap {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

.old-price {
    display: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.total-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.calculator-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-messenger {
    padding: 16px;
    background: var(--bg);
    box-shadow: 6px 6px 12px var(--shadow-dark),
                -6px -6px 12px var(--shadow-light);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-messenger:hover {
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
}

.btn-messenger:active {
    box-shadow: inset 3px 3px 6px var(--shadow-dark),
                inset -3px -3px 6px var(--shadow-light);
}

.calculator-preview {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.preview-placeholder {
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.preview-placeholder svg {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.preview-placeholder span {
    font-size: 0.9rem;
}

/* ===== Why ===== */
.why-section {
    padding: 80px 0;
}

.why-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.why-card {
    padding: 40px;
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 20px;
}

.why-card h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.why-list {
    list-style: none;
}

.why-list li {
    padding: 12px 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ===== Portfolio ===== */
.portfolio-section {
    padding: 80px 0;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.portfolio-placeholder {
    height: 300px;
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ===== Apps ===== */
.apps-section {
    padding: 80px 0;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.app-placeholder {
    height: 250px;
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ===== Reviews ===== */
.reviews-section {
    padding: 80px 0;
}

.reviews-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.review-card {
    padding: 30px;
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 20px;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.review-avatar {
    width: 60px;
    height: 60px;
    background: var(--bg);
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
                inset -4px -4px 8px var(--shadow-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.review-info h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.review-company {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.review-text {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.review-rating {
    color: #ffd700;
    font-size: 1.2rem;
}

/* ===== Partners ===== */
.partners-section {
    padding: 80px 0;
}

.partners-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 30px;
}

.partner-logo {
    background: var(--bg);
    box-shadow: 8px 8px 16px var(--shadow-dark),
                -8px -8px 16px var(--shadow-light);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.partner-logo:hover {
    box-shadow: 12px 12px 20px var(--shadow-dark),
                -12px -12px 20px var(--shadow-light);
}

.partner-logo svg {
    width: 100%;
    height: auto;
}

/* ===== Footer ===== */
.footer {
    padding: 40px 0;
    text-align: center;
    color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .hamburger {
        display: flex;
    }

    .header-contacts {
        display: none;
    }

    .hero-content {
        grid-template-columns: 1fr;
    }

    .hero-right {
        height: 400px;
    }

    .hero-title {
        font-size: 3rem;
    }

    .intro-card {
        padding: 40px 24px;
    }

    .intro-title {
        font-size: 2rem;
    }

    .calculator-wrapper,
    .why-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-grid,
    .apps-grid,
    .reviews-grid {
        grid-template-columns: 1fr;
    }

    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .calculator-preview {
        grid-template-columns: 1fr;
    }
}

/* ===== ОБНОВЛЕНИЕ: очень тёмный серо-синий текст ===== */
:root {
    --text-primary: #1c2836;
    --text-secondary: #4d5a6e;
}

/* Возвращаем тёмный цвет заголовку intro, убираем свечение букв */
.intro-title {
    color: var(--text-primary);
    text-shadow: none;
}

/* ===== Бегущая подсветка по контуру панелей ===== */
@property --beam-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.magic::before {
    content: '';
    position: absolute;
    inset: 0;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(from var(--beam-angle),
                transparent 0%,
                transparent 76%,
                var(--glow) 88%,
                transparent 98%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    filter: blur(0.5px) drop-shadow(0 0 6px var(--glow));
    opacity: 0;
    pointer-events: none;
    animation: beam-rotate 9s linear infinite,
               beam-fade 9s ease-in-out infinite;
    animation-delay: var(--delay), var(--delay);
}

@keyframes beam-rotate {
    0%   { --beam-angle: 0deg; }
    50%  { --beam-angle: 360deg; }
    100% { --beam-angle: 360deg; }
}

@keyframes beam-fade {
    0%   { opacity: 0; }
    6%   { opacity: 1; }
    44%  { opacity: 1; }
    52%  { opacity: 0; }
    100% { opacity: 0; }
}

/* ===== Мобильная шапка: контакты вместо гамбургера ===== */
@media (max-width: 768px) {
    .header-phone {
        display: none;
    }

    .header .container {
        justify-content: flex-end;
    }

    .header-contacts {
        display: flex;
        gap: 14px;
    }

    .contact-link {
        font-size: 0.8rem;
    }
}

/* ===== Яркий бегущий луч ===== */
:root {
    --glow: rgba(37, 99, 235, 0.95);
}

.magic::before {
    padding: 3px;
    background: conic-gradient(from var(--beam-angle),
                transparent 0%,
                transparent 68%,
                var(--glow) 86%,
                transparent 99%);
    filter: blur(0.5px) drop-shadow(0 0 10px var(--glow)) drop-shadow(0 0 22px rgba(37, 99, 235, 0.55));
}

/* ===== ПК: телефон справа рядом с остальными контактами ===== */
.header .container {
    justify-content: flex-end;
    gap: 24px;
}

.header-phone {
    order: 1;
}

.header-contacts {
    order: 2;
    gap: 24px;
}

/* ===== Мобильная версия: надёжно фиксируем шапку ===== */
@media (max-width: 768px) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1000;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .header .container {
        justify-content: flex-end;
    }
}

/* ===== Луч по внешнему контуру панелей ===== */
.magic::before {
    inset: -5px;
}

.review-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

/* ===== Исправление CLS в hero ===== */
.hero {
    height: 100vh;
    overflow: hidden;
    contain: layout style;
}

.hero-content {
    contain: layout style;
    height: 100%;
}

.hero-left {
    contain: layout;
}

.hero-title {
    min-height: calc(var(--hero-title-size) * 2);
    contain: layout;
}

.hero-subtitle {
    min-height: calc(var(--hero-subtitle-size) * 1.5);
    contain: layout;
}

.hero-features {
    min-height: calc(var(--hero-features-size) * 1.5 * 4);
    contain: layout;
}

.hero-right {
    contain: layout;
}

/* Предотвращение CLS в других секциях */
.intro-card {
    contain: layout style;
    min-height: 200px;
}

.calculator-options,
.calculator-preview,
.why-card {
    contain: layout style;
}

.portfolio-placeholder,
.app-placeholder {
    contain: layout;
}

.review-card {
    contain: layout style;
    min-height: 200px;
}

.partner-logo {
    contain: layout;
    min-height: 80px;
}

/* Placeholder для пустых элементов до загрузки данных */
#reviewsGrid:empty::before,
#partnersGrid:empty::before,
#siteTypesContainer:empty::before,
#designTypesContainer:empty::before {
    content: '';
    display: block;
    height: 60px;
}
