/* ==========================================================================
   Генератор цветовых комбинаций — /services/colors/
   ========================================================================== */

.color-lab {
    padding-top: 8px;
}

.lab-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}

.lab-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lab-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.segmented {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.segmented-btn {
    min-width: 42px;
    padding: 7px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented-btn:hover {
    color: var(--text);
    background: var(--surface);
}

.segmented-btn.is-active {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.35);
}

.select-control {
    appearance: none;
    -webkit-appearance: none;
    min-width: 190px;
    padding: 9px 36px 9px 12px;
    background-color: var(--bg-soft);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238593a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-control:focus {
    border-color: rgba(91, 140, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.12);
}

.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 10px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #06090f;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-generate:hover {
    background: #7ba3ff;
    transform: translateY(-1px);
}

.btn-generate:active {
    transform: translateY(0);
}

/* ---------- Палитра ---------- */

.palette {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    min-height: 220px;
    padding: 14px;
    background: var(--c);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    color: var(--fg);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.swatch:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -22px rgba(0, 0, 0, 0.95);
}

.swatch.is-locked {
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.82);
}

.swatch-top,
.swatch-bottom {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.swatch-bottom {
    align-items: flex-end;
}

.swatch-values {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.swatch-hex {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--fg);
    font-family: var(--mono);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    cursor: copy;
    text-align: left;
}

.swatch-rgb {
    font-family: var(--mono);
    font-size: 10.5px;
    opacity: 0.7;
}

.swatch-lock,
.swatch-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: var(--fg);
    color: var(--c);
    cursor: pointer;
    opacity: 0.88;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.swatch-lock:hover,
.swatch-copy:hover {
    opacity: 1;
    transform: scale(1.05);
}

.swatch .ico-locked {
    display: none;
}

.swatch.is-locked .ico-locked {
    display: block;
}

.swatch.is-locked .ico-unlocked {
    display: none;
}

.swatch.is-locked .swatch-lock {
    opacity: 1;
}

.swatch-role {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.75;
}

.palette-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dim);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover {
    border-color: rgba(91, 140, 255, 0.45);
    background: var(--surface-2);
    color: var(--text);
}

.palette-hint {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--muted);
}

.palette-noscript {
    margin: 14px 0 0;
    color: var(--danger);
    font-size: 14px;
}

/* ---------- Превью ---------- */

.preview-section {
    padding-top: 34px;
}

.block-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.block-title {
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.02em;
}

.block-sub {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
    max-width: 640px;
}

.browser {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.browser-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.browser-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3a4559;
}

.browser-dot:nth-child(1) {
    background: #ff5f57;
}

.browser-dot:nth-child(2) {
    background: #febc2e;
}

.browser-dot:nth-child(3) {
    background: #28c840;
}

.browser-url {
    margin-left: 10px;
    padding: 2px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11px;
}

.preview-site {
    --pv-bg: #0f172a;
    --pv-surface: #1e293b;
    --pv-text: #f8fafc;
    --pv-muted: #94a3b8;
    --pv-border: #334155;
    --pv-primary: #6366f1;
    --pv-primary-fg: #ffffff;
    --pv-accent: #22d3ee;
    --pv-accent-fg: #0b0e14;
    --pv-accent-2: #f472b6;
    --pv-accent-2-fg: #0b0e14;
    background: var(--pv-bg);
    color: var(--pv-text);
    font-family: var(--font);
    line-height: 1.45;
}

.pv-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--pv-border);
}

.pv-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.pv-logo-mark {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    background: var(--pv-primary);
}

.pv-nav-links {
    display: flex;
    gap: 16px;
    color: var(--pv-muted);
    font-size: 11px;
}

.pv-nav-btn {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--pv-primary);
    color: var(--pv-primary-fg);
    font-size: 11px;
    font-weight: 650;
}

.pv-hero {
    padding: 36px 22px 32px;
    max-width: 560px;
}

.pv-kicker {
    display: block;
    color: var(--pv-accent);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.pv-title {
    display: block;
    margin: 8px 0 10px;
    font-size: clamp(23px, 3.4vw, 32px);
    font-weight: 780;
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.pv-text {
    display: block;
    max-width: 400px;
    color: var(--pv-muted);
    font-size: 12.5px;
    line-height: 1.55;
}

.pv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.pv-btn {
    padding: 8px 15px;
    border-radius: 8px;
    background: var(--pv-primary);
    color: var(--pv-primary-fg);
    font-size: 11.5px;
    font-weight: 650;
}

.pv-btn--ghost {
    background: transparent;
    border: 1px solid var(--pv-border);
    color: var(--pv-text);
}

.pv-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 0 22px 26px;
}

.pv-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px;
    background: var(--pv-surface);
    border: 1px solid var(--pv-border);
    border-radius: 10px;
}

.pv-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--pv-primary);
}

.pv-card:nth-child(2) .pv-icon {
    background: var(--pv-accent);
}

.pv-card:nth-child(3) .pv-icon {
    background: var(--pv-accent-2);
}

.pv-card-title {
    font-size: 12px;
    font-weight: 650;
}

.pv-card-text {
    color: var(--pv-muted);
    font-size: 10.5px;
    line-height: 1.45;
}

.pv-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 22px;
    border-top: 1px solid var(--pv-border);
    color: var(--pv-muted);
    font-size: 10px;
}

.role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.role-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 8px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--text-dim);
}

.role-dot {
    width: 15px;
    height: 15px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.role-name {
    color: var(--muted);
}

.role-item code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
}

/* ---------- Готовые палитры ---------- */

.presets-section {
    padding-top: 38px;
}

.presets-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.preset-tabs {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.preset-tab {
    padding: 7px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.preset-tab:hover {
    color: var(--text);
    background: var(--surface-2);
}

.preset-tab.is-active {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.35);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 12px;
}

.preset-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.preset-card:hover {
    transform: translateY(-2px);
    border-color: rgba(91, 140, 255, 0.45);
    box-shadow: var(--shadow);
}

.preset-stripes {
    display: flex;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-2);
}

.preset-stripes span {
    flex: 1;
}

.preset-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.preset-name {
    font-size: 13.5px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-count {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--muted);
}

/* ---------- Как пользоваться ---------- */

.howto {
    padding-top: 38px;
    padding-bottom: 70px;
}

.howto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 18px 0 34px;
}

.howto-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}

.howto-num {
    display: inline-block;
    margin-bottom: 8px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent-2);
}

.howto-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 650;
}

.howto-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.6;
}

.prose {
    max-width: 800px;
    color: var(--text-dim);
    font-size: 15.5px;
    line-height: 1.7;
}

.prose h2 {
    margin: 28px 0 10px;
    font-size: 21px;
    color: var(--text);
}

.prose p {
    margin: 0 0 12px;
}

/* ---------- Уведомление ---------- */

.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 200;
    padding: 10px 18px;
    background: var(--accent-2);
    border-radius: 999px;
    color: #062018;
    font-size: 13.5px;
    font-weight: 650;
    box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.9);
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Адаптив ---------- */

@media (max-width: 980px) {
    .btn-generate {
        margin-left: 0;
    }

    .palette {
        grid-auto-flow: row;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .swatch {
        min-height: 180px;
    }
}

@media (max-width: 760px) {
    .lab-toolbar {
        align-items: stretch;
    }

    .lab-field {
        flex: 1 1 160px;
    }

    .select-control {
        width: 100%;
        min-width: 0;
    }

    .btn-generate {
        width: 100%;
        justify-content: center;
    }

    .palette {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .swatch {
        min-height: 150px;
        padding: 12px;
        gap: 12px;
    }

    .swatch-hex {
        font-size: 16px;
    }

    .palette-hint {
        flex-basis: 100%;
        margin-left: 0;
    }

    .pv-nav-links {
        display: none;
    }

    .pv-cards {
        grid-template-columns: 1fr;
        padding: 0 18px 22px;
    }

    .pv-hero {
        padding: 28px 18px 24px;
    }

    .pv-nav,
    .pv-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .presets-head {
        align-items: flex-start;
    }

    .preset-tabs {
        width: 100%;
    }

    .preset-tab {
        flex: 1;
    }
}

@media (max-width: 420px) {
    .palette {
        grid-template-columns: 1fr;
    }

    .swatch {
        min-height: 130px;
    }

    .preset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .preset-card {
        padding: 8px;
        gap: 7px;
    }

    .preset-stripes {
        height: 38px;
        border-radius: 7px;
    }

    .preset-name {
        font-size: 12.5px;
    }

    .preset-count {
        font-size: 10px;
    }
}
