/* ——— Layout ————————————————————————————————————————————————————————————— */

.cp-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 56px); /* brand header */
}

/* ——— Controls ———————————————————————————————————————————————————————————— */

.cp-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1.5rem, 5vw, 3rem);
    height: 56px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 1.5rem;
}

.cp-controls__left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-width: 0;
}

.cp-controls__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cp-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    color: var(--text);
    flex-shrink: 0;
}

.cp-hint {
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
}

.cp-hint kbd {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: inherit;
    color: var(--text);
}

/* Buttons */

.cp-btn {
    height: 34px;
    padding: 0 1.1rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.cp-btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.cp-btn--primary:hover { background: #2563eb; border-color: #2563eb; }

.cp-btn--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.cp-btn--ghost:hover { border-color: var(--accent); color: var(--accent); }


/* ——— Palette ————————————————————————————————————————————————————————————— */

.cp-palette {
    display: flex;
    flex: 1;
    min-height: 0;
}

.cp-band {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
    transition: flex 0.3s ease;
    overflow: hidden;
}

.cp-band + .cp-band {
    border-left: 1px solid rgba(0, 0, 0, 0.07);
}

.cp-band:hover { flex: 1.2; }

.cp-band__name {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    opacity: 0.82;
    text-align: center;
    padding: 0 0.5rem;
}

.cp-band__hex {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    font-family: 'Inter', monospace;
    transition: opacity 0.15s;
}
.cp-band__hex:hover { opacity: 0.65; }

.cp-band__hsl {
    font-size: 0.64rem;
    opacity: 0.65;
    letter-spacing: 0.02em;
    font-family: 'Inter', monospace;
}

.cp-band__lock {
    position: absolute;
    bottom: 1.2rem;
    width: 24px;
    height: 24px;
    padding: 2px;
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}
.cp-band__lock:hover { opacity: 1 !important; transform: scale(1.18); }
.cp-band__lock svg { width: 100%; height: 100%; display: block; }

/* ——— Rationale ——————————————————————————————————————————————————————————— */

.cp-rationale {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    padding: 0.7rem clamp(1.5rem, 5vw, 3rem);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
}

.cp-rationale__rule {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cp-rationale__desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.cp-rationale__filter-hint {
    flex: 0 0 100%;
    font-size: 0.72rem;
    color: var(--accent);
    font-style: italic;
    margin: 0;
    padding-top: 0.1rem;
    opacity: 0.8;
}

/* ——— Split View Layout ——————————————————————————————————————————————————— */

.cp-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cp-panel-left {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.cp-panel-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ——— Bands in left panel (stacked vertically) ——————————————————————————— */

.cp-panel-left .cp-palette {
    flex-direction: column;
}

.cp-panel-left .cp-band {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.9rem;
    gap: 0.6rem;
    min-height: 0;
}

.cp-panel-left .cp-band + .cp-band {
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.cp-panel-left .cp-band:hover { flex: 1.15; }

.cp-panel-left .cp-band__lock {
    position: static;
    width: 18px;
    height: 18px;
    padding: 0;
    flex-shrink: 0;
}

.cp-panel-left .cp-band__name {
    font-size: 0.64rem;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
}

.cp-panel-left .cp-band__hex {
    font-size: 0.76rem;
    flex-shrink: 0;
}

.cp-panel-left .cp-band__hsl { display: none; }

.cp-panel-left .cp-rationale {
    padding: 0.6rem 0.9rem;
    border-top: 1px solid var(--border);
    border-left: none;
    border-right: none;
}

.cp-panel-left .cp-rationale__desc {
    font-size: 0.72rem;
}

/* ——— Preview Container ——————————————————————————————————————————————————— */

.cp-preview-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cp-preview-inner {
    --pv-bg:        #f8fafc;
    --pv-surface:   #e2e8f0;
    --pv-text:      #0f172a;
    --pv-accent:    #3b82f6;
    --pv-accent2:   #8b5cf6;
    --pv-accent-fg: #ffffff;
    --pv-muted:     rgba(15, 23, 42, 0.45);
    --pv-border:    rgba(15, 23, 42, 0.1);
    --pv-slot-0:    #94a3b8;
    --pv-slot-1:    #64748b;
    --pv-slot-2:    #475569;
    --pv-slot-3:    #334155;
    --pv-slot-4:    #1e293b;

    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    font-size: clamp(12px, 1.2vw, 16px);
}

/* ——— Brand Identity (Website tab) ——————————————————————————————————————— */

.pv-website {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.pv-brand-hero {
    position: relative;
    background: var(--pv-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    overflow: hidden;
}

.pv-brand-pattern {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--pv-bg);
    opacity: 0.12;
    pointer-events: none;
}

.pv-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.5rem, 1.5vh, 1.2rem);
    text-align: center;
    padding: clamp(1.5rem, 4vh, 3rem) 2rem;
}

.pv-brand-icon {
    width: clamp(36px, 5vh, 64px);
    height: clamp(36px, 5vh, 64px);
    flex-shrink: 0;
    color: var(--pv-accent);
}

.pv-brand-name {
    font-size: clamp(1.8rem, 5vw, 4rem);
    font-weight: 800;
    color: var(--pv-accent2);
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1;
}

.pv-brand-sub {
    font-size: clamp(0.55rem, 0.8vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--pv-bg);
    opacity: 0.5;
    margin: 0;
}

.pv-brand-swatches {
    display: flex;
    height: clamp(60px, 12vh, 100px);
    flex-shrink: 0;
}

.pv-swatch {
    flex: 1;
}

/* ——— Responsive ————————————————————————————————————————————————————————— */

@media (max-width: 900px) {
    .cp-main { flex-direction: column; }
    .cp-panel-left {
        width: 100%;
        height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    .cp-panel-left .cp-palette { flex-direction: row; }
    .cp-panel-left .cp-band { flex-direction: column; justify-content: center; padding: 0.5rem; }
    .cp-panel-left .cp-band__name { text-align: center; }
    .cp-panel-left .cp-band__lock { position: absolute; bottom: 0.5rem; }
}

@media (max-width: 640px) {
    .cp-controls__left .cp-hint { display: none; }
    .cp-band__hsl { display: none; }

}
