/* =========================================================
   FONT PAIRING BUILDER
   assets/css/pages/font-pairing-builder/font-pairing-builder.css
   =========================================================
   Controls rail (#fp-sidebar) for the Font Pairing Builder, plus
   workspace-level preview reflow. Reuses the website design system
   tokens (variables.css) — no new theme. Mirrors the visual language
   of shadow-builder.css / radius-builder.css for consistency.

   The preview surface styles itself inline (font-pairing-preview.js),
   so this file owns the controls + the mobile reflow only.
   ========================================================= */


/* =========================================================
   CONTROLS PANEL — shell
   ========================================================= */

.fp-controls-panel {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Panel header — unified in components/tool-shell.css (icon + heading). */


/* =========================================================
   SEGMENTED PILLS — presets (5, wraps) + category filter (3)
   ========================================================= */

.fp-seg {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.25rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.65rem;
    padding: 0.15rem;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.fp-seg-btn {
    flex: 1 1 auto;
    min-width: 62px;
    padding: 0.4rem 0.45rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 0.5rem;
    font-family: var(--font-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.fp-seg-btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.fp-seg-btn--active,
.fp-seg-btn--active:hover {
    background: var(--surface-primary);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: var(--font-semi-bold);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-primary-soft);
}


/* =========================================================
   FONT SLOTS — native <select> + Suggest
   ========================================================= */

.fp-slot-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.fp-select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 2rem 0.5rem 0.7rem;
    border: 1px solid var(--border-primary);
    border-radius: 0.55rem;
    background-color: var(--surface-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.fp-select:hover { border-color: var(--color-primary); }

.fp-select:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.fp-suggest-btn {
    flex: 0 0 auto;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 0.55rem;
    background: var(--surface-primary);
    font-family: var(--font-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-semi-bold);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.fp-suggest-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-soft);
}


/* =========================================================
   SUGGEST — ranked partner chips
   =========================================================
   The list is toggled via inline display by JS (none ↔ ""); this
   flex layout applies when shown.
   ========================================================= */

.fp-suggest-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: var(--space-3);
}

.fp-suggest-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-primary);
    border-radius: 9999px;
    background: var(--surface-primary);
    font-family: var(--font-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.fp-suggest-chip:hover {
    border-color: var(--color-primary);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.fp-suggest-chip-name {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.fp-suggest-chip-verdict {
    font-size: 0.6rem;
    font-weight: var(--font-semi-bold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Verdict colour-coding (rejected pairs are never suggested). */
.fp-suggest-chip--excellent .fp-suggest-chip-verdict { color: #16a34a; }
.fp-suggest-chip--good .fp-suggest-chip-verdict      { color: var(--color-primary); }
.fp-suggest-chip--weak .fp-suggest-chip-verdict      { color: #d97706; }


/* =========================================================
   RESET
   ========================================================= */

/* Reset footer — unified in components/tool-shell.css (.tool-reset-row/-btn). */


/* =========================================================
   PREVIEW — mobile device reflow
   =========================================================
   The device toggle flips .fp-preview-area--mobile; the active
   surface narrows to a phone-ish column so the composition reflows.
   ========================================================= */

.fp-preview-area--mobile .tool-preview-panel--active {
    max-width: 420px;
    margin: 0 auto;
}


/* =========================================================
   MOBILE — controls drawer scroll fix
   =========================================================
   Same flexbox min-height:0 clipping issue as the other tools:
   .fp-controls-panel has overflow:hidden for its rounded corners,
   so inside the flex-column drawer it would shrink and clip.
   flex-shrink:0 keeps it at full content height so the drawer scrolls.
   ========================================================= */

@media (max-width: 768px) {
    .fp-controls-panel {
        flex-shrink: 0;
    }

    #fp-sidebar {
        padding-bottom: var(--space-6);
    }
}
