/* ============================================================
   launchpad.css — "Run it" universal AI launcher
   Global component. Loaded on every page after components.css.
   ============================================================ */

/* ── The split Run button ──────────────────────────────────── */

.lp-run {
    display: inline-flex;
    align-items: stretch;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    isolation: isolate;
    background: var(--grad-primary);
    box-shadow: var(--shadow-glow-orange);
    transition: transform var(--transition-fast), box-shadow var(--transition-base);
    max-width: 100%;
}

.lp-run:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(255, 92, 53, 0.45);
}

.lp-run-go,
.lp-run-switch {
    appearance: none;
    border: 0;
    background: transparent;
    color: #0b0710;
    font-family: var(--font-display);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.lp-run-go {
    padding: 11px 18px;
    font-size: var(--text-base);
    letter-spacing: -0.01em;
    flex: 1 1 auto;
    justify-content: center;
}

.lp-run-go:hover { background: rgba(255, 255, 255, 0.14); }
.lp-run-go:active { background: rgba(0, 0, 0, 0.08); }

.lp-run-bolt {
    font-size: 1.05em;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* Once a provider is picked we show its logo instead of the bolt */
.lp-run.has-provider .lp-run-bolt { display: none; }

.lp-run-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #fff;
    padding: 1px;
    flex: 0 0 auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.lp-run-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.lp-run-arrow {
    transition: transform var(--transition-fast);
    flex: 0 0 auto;
}

.lp-run:hover .lp-run-arrow { transform: translateX(3px); }

.lp-run-switch {
    padding: 0 11px;
    font-size: 0.7rem;
    border-left: 1px solid rgba(11, 7, 16, 0.22);
    flex: 0 0 auto;
}

.lp-run-switch:hover { background: rgba(255, 255, 255, 0.18); }

.lp-run-go:focus-visible,
.lp-run-switch:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: -3px;
}

/* Size + tone variants */
.lp-run--sm .lp-run-go { padding: 7px 13px; font-size: var(--text-xs); }
.lp-run--sm .lp-run-switch { padding: 0 8px; }
.lp-run--sm .lp-run-logo { width: 15px; height: 15px; }

.lp-run--lg .lp-run-go { padding: 14px 24px; font-size: var(--text-md); }

.lp-run--block { display: flex; width: 100%; }

/* Quiet variant, for dense surfaces where orange would shout */
.lp-run--quiet {
    background: var(--surface-3);
    box-shadow: none;
    border: 1px solid var(--border-hover);
}
.lp-run--quiet .lp-run-go,
.lp-run--quiet .lp-run-switch { color: var(--text); }
.lp-run--quiet .lp-run-switch { border-left-color: var(--border); }
.lp-run--quiet:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-orange);
}

/* ── Icon-only Run, for card action rows ───────────────────── */

.lp-run-icon {
    appearance: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 92, 53, 0.35);
    background: rgba(255, 92, 53, 0.12);
    color: var(--accent-orange);
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                transform var(--transition-fast);
    flex: 0 0 auto;
}

.lp-run-icon:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: #0b0710;
    transform: translateY(-1px);
}

.lp-run-icon:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* ── Hint line under a Run button ──────────────────────────── */

.lp-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.5;
}

.lp-hint-switch {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--accent-orange);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.lp-hint-switch:hover { color: var(--accent-yellow); }

/* ── Pick-your-AI sheet ────────────────────────────────────── */

html.lp-locked,
html.lp-locked body { overflow: hidden; }

.lp-sheet {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}

.lp-sheet.is-open { display: flex; }

.lp-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 5, 12, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: lpFade 0.2s ease;
}

.lp-sheet-card {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - var(--space-10));
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8) var(--space-6) var(--space-6);
    animation: lpRise 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.lp-sheet-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--grad-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.lp-sheet-x {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lp-sheet-x:hover { color: var(--text); border-color: var(--border-hover); }

.lp-sheet-head { text-align: center; margin-bottom: var(--space-6); }

.lp-sheet-eyebrow {
    display: inline-block;
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-orange);
    background: rgba(255, 92, 53, 0.1);
    border: 1px solid rgba(255, 92, 53, 0.25);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    margin-bottom: var(--space-3);
}

.lp-sheet-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0 0 var(--space-2);
}

.lp-sheet-sub {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 42ch;
    margin: 0 auto;
}

.lp-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
}

.lp-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: var(--space-4) var(--space-2);
    min-width: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast),
                transform var(--transition-fast);
}

.lp-tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--lp-tint, #888) 55%, transparent);
    background: color-mix(in srgb, var(--lp-tint, #888) 10%, var(--surface-2));
}

.lp-tile:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

.lp-tile-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #fff;
    padding: 2px;
    object-fit: contain;
}

.lp-tile-name {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.lp-tile-mode {
    font-size: 0.6rem;
    letter-spacing: 0.02em;
    color: var(--text-faint);
    text-align: center;
    line-height: 1.2;
}

.lp-tile-tick {
    position: absolute;
    top: 5px;
    right: 6px;
    font-size: 0.65rem;
    color: var(--accent-green);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.lp-tile.is-current {
    border-color: var(--accent-green);
    background: rgba(0, 229, 122, 0.07);
}

.lp-tile.is-current .lp-tile-tick { opacity: 1; }

.lp-sheet-foot {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: var(--text-xs);
    color: var(--text-faint);
}

.lp-sheet-foot strong { color: var(--text-muted); }

/* ── Toast ─────────────────────────────────────────────────── */

.lp-toast {
    position: fixed;
    left: 50%;
    bottom: var(--space-6);
    z-index: 9100;
    transform: translate(-50%, calc(100% + var(--space-8)));
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    width: min(520px, calc(100vw - var(--space-8)));
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border-hover);
    border-left: 3px solid var(--accent-orange);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    line-height: 1.55;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.lp-toast.is-up {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.lp-toast--warn { border-left-color: var(--accent-yellow); }

.lp-toast-ic {
    font-size: 1.05rem;
    line-height: 1.4;
    flex: 0 0 auto;
    color: var(--accent-orange);
}

.lp-toast strong { color: var(--text); font-weight: 700; }

.lp-toast a {
    color: var(--accent-orange);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.lp-toast a:hover { color: var(--accent-yellow); }

.lp-toast kbd {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--surface-3);
    border: 1px solid var(--border-hover);
    border-bottom-width: 2px;
    color: var(--text);
}

/* ── Animations ────────────────────────────────────────────── */

@keyframes lpFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes lpRise {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .lp-run,
    .lp-run-arrow,
    .lp-tile,
    .lp-run-icon { transition: none; }
    .lp-run:hover,
    .lp-tile:hover,
    .lp-run-icon:hover { transform: none; }
    .lp-sheet-card,
    .lp-sheet-backdrop { animation: none; }
    .lp-toast { transition: opacity 0.2s ease; }
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 560px) {
    .lp-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lp-sheet-card { padding: var(--space-6) var(--space-4) var(--space-5); }
    .lp-sheet-title { font-size: var(--text-xl); }
    .lp-toast {
        bottom: var(--space-3);
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-xs);
    }
}

@media (max-width: 380px) {
    .lp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
