/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --accent: #4A6CF7;
    --accent-hover: #3756d6;
    --accent-light: #F0F4FF;
    --text: #1a1d23;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f8f9fb;
    --card: #ffffff;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.07);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.10);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ─── Layout ─── */
.page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 56px;
}

/* ─── Header ─── */
.header {
    padding: 40px 0 28px;
    text-align: center;
}
.header__title {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}
.header__sub {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 15px;
}

/* ─── Hero demo (пример до/после) ─── */
.hero-demo {
    margin: 22px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 460px;
}
.hero-demo__card {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.hero-demo__card img {
    display: block;
    width: 100%;
    height: auto;
}
.hero-demo__card--before { opacity: .92; transform: rotate(-1.5deg); }
.hero-demo__card--after  { transform: rotate(1.5deg) scale(1.06); z-index: 2; box-shadow: var(--shadow-md); border-color: var(--accent); }
/* «после»: серый показывается первым, затем проявляется цветной (по кругу) */
.hero-demo__swap { position: relative; display: block; }
.hero-demo__layer { display: block; width: 100%; height: auto; }
.hero-demo__layer--color {
    position: absolute; inset: 0; opacity: 0;
    animation: heroSwap 6s ease-in-out infinite;
}
@keyframes heroSwap {
    0%, 12%   { opacity: 0; }   /* виден серый */
    38%, 62%  { opacity: 1; }   /* виден цветной */
    88%, 100% { opacity: 0; }   /* снова серый */
}
@media (prefers-reduced-motion: reduce) {
    .hero-demo__layer--color { animation: none; opacity: 1; }
}
.hero-demo__cap {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(26,29,35,.72);
    border-radius: 20px;
    letter-spacing: .3px;
}
.hero-demo__cap--after { background: var(--accent); }
.hero-demo__arrow {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--accent);
    z-index: 3;
}
@media (max-width: 420px) {
    .hero-demo { gap: 6px; max-width: 340px; }
    .hero-demo__arrow { width: 26px; }
    .hero-demo__arrow svg { width: 26px; height: 26px; }
}

/* ─── Section ─── */
.section {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.section--action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 24px;
}
.section--palette {
    /* palette section gets subtle accent left border when visible */
    border-left: 3px solid var(--accent);
}

.step-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.step-label__profile {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 14px;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── Upload zone ─── */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: border-color .2s, background .2s;
    overflow: hidden;
    cursor: pointer;
    min-height: 200px;
}
.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}
.upload-zone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}
.upload-zone__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 200px;
    padding: 24px;
    pointer-events: none;
}
.upload-zone__icon { flex-shrink: 0; }
.upload-zone__text {
    font-size: 15px;
    color: var(--text-muted);
    text-align: center;
}
.upload-zone__link {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}
.upload-zone__hint {
    font-size: 12px;
    color: #9ca3af;
}

/* Preview state */
.upload-zone__preview {
    position: relative;
    width: 100%;
}
.upload-zone__preview img {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
}
.upload-zone__remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background .15s;
}
.upload-zone__remove:hover { background: rgba(0,0,0,0.8); }

/* ─── Profile groups ─── */
.profiles {}

.profile-group {
    margin-bottom: 24px;
}
.profile-group:last-child { margin-bottom: 0; }

.profile-group__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.profile-group__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer;
    text-align: left;
    min-width: 130px;
    max-width: 200px;
    flex: 1 1 130px;
    transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
}
.profile-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(74,108,247,.15);
}
.profile-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(74,108,247,.20);
}
/* ─── Profile card preview ─── */
.profile-card__preview {
    display: block;
    width: 100%;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    background: #f1f3f6;
    flex-shrink: 0;
    line-height: 0;
    transition: opacity .15s;
}
.profile-card__preview-svg {
    display: block;
    width: 100%;
    height: 100%;
}
.profile-card:hover .profile-card__preview,
.profile-card.active .profile-card__preview {
    opacity: .85;
    box-shadow: inset 0 0 0 1.5px rgba(74, 108, 247, .35);
}

.profile-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.profile-card__desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ─── Palette ─── */
.palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
}

.swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
    text-align: center;
}
.swatch:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
}
.swatch.active {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(74,108,247,.20);
}
.swatch__color {
    display: block;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    box-shadow: 0 1px 5px rgba(0,0,0,.18);
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.07);
}
.swatch__label {
    font-size: 11px;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.selected-info {
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--accent);
    font-weight: 500;
}

.palette-empty {
    padding: 16px;
    background: #fff8e1;
    border-radius: var(--radius-sm);
    color: #92400e;
    font-size: 14px;
}

/* Palette meta row: counter + hint */
.palette-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.palette-counter {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}
.palette-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Limit message */
.palette-limit-msg {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff8e1;
    border-radius: var(--radius-sm);
    color: #92400e;
    font-size: 13px;
}

/* Checkmark overlay on active swatch */
.swatch__check {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.swatch {
    position: relative;
}
.swatch.active .swatch__check {
    display: block;
}

/* ─── Buttons ─── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 2px 10px rgba(74,108,247,.35);
    min-width: 200px;
    justify-content: center;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 18px rgba(74,108,247,.45);
}
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Spinner inside button */
.btn-primary__spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}

.action-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(74,108,247,.3);
}
.btn-secondary:hover { background: var(--accent-hover); }
.btn-secondary--share {
    background: #0f9d58;
    box-shadow: 0 2px 8px rgba(15,157,88,.3);
}
.btn-secondary--share:hover { background: #0b8048; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 11px 24px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ─── Generating state ─── */
.generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 40px 24px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    text-align: center;
}
.generating__spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--accent-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.generating__text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}
.generating__sub {
    font-size: 13px;
    color: var(--text-muted);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Error ─── */
.error-block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 20px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: var(--radius-sm);
    color: #be123c;
    font-size: 14px;
    margin-bottom: 20px;
}
.error-block__icon { flex-shrink: 0; font-size: 18px; }

/* ─── Result ─── */
.result {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.comparison {
    display: grid;
    grid-template-columns: 1fr 4px 1fr;
    gap: 0;
    align-items: start;
    margin-bottom: 20px;
}
.comparison__side {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.comparison__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 0 6px;
}
.comparison__img {
    width: 100%;
    border-radius: var(--radius-sm);
    display: block;
    object-fit: cover;
    box-shadow: var(--shadow);
}
.comparison__divider {
    background: var(--border);
    align-self: stretch;
    margin: 28px 8px 0;
    border-radius: 2px;
}

.result-meta {
    display: none;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

/* ─── Share link ─── */
.share-link-block {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.share-link-label {
    color: #166534;
    font-weight: 600;
    flex-shrink: 0;
}
.share-link {
    color: var(--accent);
    text-decoration: underline;
    word-break: break-all;
    flex: 1 1 200px;
}
.share-link-copy {
    padding: 4px 12px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}
.share-link-copy:hover { background: var(--accent-hover); }
.share-link-copied {
    font-size: 12px;
    color: #16a34a;
    font-weight: 600;
}

/* ─── Footer ─── */
.footer {
    text-align: center;
    color: #d1d5db;
    font-size: 12px;
    padding: 16px 0;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .section { padding: 18px 14px; }

    .profile-group__row {
        gap: 8px;
    }
    .profile-card {
        min-width: 100px;
        flex: 1 1 100px;
        padding: 10px 12px;
    }

    .palette {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 8px;
    }
    .swatch__color { width: 40px; height: 40px; }

    .comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .comparison__divider { display: none; }

    .btn-primary { width: 100%; }
    .result-actions { flex-direction: column; width: 100%; }
    .btn-secondary, .btn-ghost { width: 100%; justify-content: center; }
    .share-link-block { flex-direction: column; align-items: flex-start; }
    .share-link-copy { align-self: flex-start; }
}

/* ===== Сквозной SEO-футер с перелинковкой посадочных ===== */
.site-footer { max-width: 900px; margin: 40px auto 0; padding: 28px 20px 36px; border-top: 1px solid var(--border); }
/* Инструменты — горизонтальная money-полоса над SEO-колонками */
.site-footer__tools { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.site-footer__tools-links { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 10px; }
.site-footer__tools-links a { color: var(--text-muted); text-decoration: none; font-size: .9rem; line-height: 1.3;
    padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; transition: color .15s, border-color .15s; }
.site-footer__tools-links a:first-child { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.site-footer__tools-links a:hover { color: var(--accent); border-color: var(--accent); }
/* Рамка-заголовок над SEO-колонками: явно говорит, что это визуализатор по категориям, а не статьи */
.site-footer__cats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 6px 0 22px; }
.site-footer__cats .site-footer__h { margin-bottom: 0; }
.site-footer__cats-sub { color: var(--text-muted); font-size: .85rem; }
.site-footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 24px; }
.site-footer__h { font-size: .82rem; font-weight: 700; color: var(--text); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .02em; }
.site-footer__col ul { list-style: none; padding: 0; margin: 0; }
.site-footer__col li { margin: 5px 0; }
.site-footer__col a { color: var(--text-muted); text-decoration: none; font-size: .9rem; line-height: 1.4; }
.site-footer__col a:hover { color: var(--accent); }
.site-footer__bottom { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; color: var(--text-muted); font-size: .85rem; }
.site-footer__bottom a { color: var(--text-muted); text-decoration: none; }
.site-footer__bottom a:hover { color: var(--accent); }
.site-footer__bottom p { margin: 8px 0 0; }

/* ===== Приглушённый сворачиваемый SEO-блок на главной ===== */
.seo-fold { max-width: 760px; margin: 48px auto 0; padding: 0 18px; }
.seo-fold details { border-top: 1px solid var(--border); padding-top: 14px; }
.seo-fold summary { cursor: pointer; color: var(--text-muted); font-size: .9rem; list-style: none; user-select: none; }
.seo-fold summary::-webkit-details-marker { display: none; }
.seo-fold summary::before { content: '+ '; color: var(--text-muted); }
.seo-fold details[open] summary::before { content: '– '; }
.seo-fold__body { margin-top: 10px; }
.seo-fold__body p { color: var(--text-muted); font-size: .9rem; line-height: 1.6; margin: 10px 0; }

/* Больше воздуха от генератора до сквозного футера */
.site-footer { margin-top: 56px; }

/* Приглушённая типографика внутри свёрнутого SEO-блока (главная + лендинги) */
.seo-fold__body h3 { color: var(--text-muted); font-size: .95rem; margin: 14px 0 6px; }
.seo-fold__body ul { padding-left: 20px; margin: 8px 0; }
.seo-fold__body li { color: var(--text-muted); font-size: .9rem; line-height: 1.55; margin: 4px 0; }
.seo-fold--lp { max-width: 760px; }

/* ===== Страница контактов (kontakty.php) + слот реквизитов в футере ===== */
.kontakty { max-width: 560px; margin: 0 auto; padding: 0 18px; }
.cform { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: var(--shadow); }
.cform-inp { display: block; width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 12px 13px;
  font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.cform-inp:focus { outline: none; border-color: var(--accent); }
.cform-ta { min-height: 120px; resize: vertical; line-height: 1.45; font-family: inherit; }
.cform-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.4; }
.cform-consent input { margin-top: 2px; flex: 0 0 auto; }
.cform-consent a { color: var(--accent); }
.cform-btn { display: inline-block; width: 100%; padding: 13px 22px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 16px; border-radius: 10px; }
.cform-btn:hover { background: var(--accent-hover); }
.cform-btn:disabled { opacity: .6; cursor: default; }
.cform-ok { margin: 12px 0 0; font-weight: 600; color: #166534; }
.cform-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.kontakty-alt { text-align: center; margin: 16px 0 0; font-size: 14px; color: var(--text-muted); }
.kontakty-alt a { color: var(--accent); }
/* Реквизиты — только картинкой (не индексируется как текст, не выделяется/копируется) */
.site-footer__req { margin: 12px 0 0; }
.site-footer__req img { max-width: 100%; height: auto; opacity: .85; user-select: none; -webkit-user-select: none; pointer-events: none; }

/* Баннер «второе фото пакета» (переход с результата ?attach=) */
.attach-note {
    background: var(--accent-light);
    border: 1px solid #dbe3ff;
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
}
.attach-note--warn {
    background: #fff8e6;
    border-color: #fde68a;
    color: #92400e;
}
