/**
 * buttons.css
 *
 * The single button system used by every page. The canonical TickerChats
 * primary button is the feed page's "New post" CTA in `frontend/components/
 * left_rail/left_rail.css` (`.left-rail__compose-btn`). This shared layer
 * reproduces that visual exactly so /, /login, /legal, ... all match it.
 *
 * Variants:
 *   .btn                    - tertiary (surface + hairline)
 *   .btn.btn--primary       - 3-stop iris->cyan->violet gradient + signature
 *                             drop shadow + inner highlight
 *   .btn.btn--ghost         - transparent + hairline
 *   .btn.btn--large         - 46px tall (matches the feed CTA height)
 *   .btn.btn--icon          - 40x40 square icon button
 *   .btn.btn--block         - width:100% (form submits, narrow cards)
 *
 * Submit pattern: wrap label in `.btn__label` and add `.btn__spinner`. Set
 * `data-busy="true"` on the button to show the spinner and dim the label.
 */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--hairline-2);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-family: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    appearance: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease,
        filter 0.2s ease,
        opacity 0.15s ease;
}
.btn:hover {
    background: var(--surface-2);
    transform: scale(1.04);
}
.btn:active {
    transform: translateY(0);
}
.btn:focus-visible {
    outline: 2px solid var(--iris);
    outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: none;
}

/* ---------- Primary (canonical TickerChats CTA) ----------
   Mirrors the feed-page Compose button in left_rail.css. 3-stop gradient
   at 120deg, iris-glow drop shadow, plus a 1px inset highlight on top.
   Hover lifts 1px, brightens, and intensifies the shadow. */
.btn.btn--primary {
    background: linear-gradient(120deg, #6366f1 0%, #22d3ee 50%, #a855f7 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow:
        0 6px 18px rgba(99, 102, 241, 0.32),
        0 1px 0 rgba(255, 255, 255, 0.15) inset;
}
.btn.btn--primary:hover {
    background: linear-gradient(120deg, #6366f1 0%, #22d3ee 50%, #a855f7 100%);
    transform: translateY(-1px) scale(1.04);
    box-shadow:
        0 12px 32px rgba(99, 102, 241, 0.42),
        0 1px 0 rgba(255, 255, 255, 0.18) inset;
    filter: brightness(1.04);
}
.btn.btn--primary:active {
    transform: translateY(0) scale(1);
    filter: brightness(1);
}
.btn.btn--primary:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* ---------- Ghost ---------- */
.btn.btn--ghost {
    background: transparent;
    border-color: var(--hairline-2);
    color: var(--text);
}
.btn.btn--ghost:hover {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--iris) 30%, var(--hairline-2));
}

/* ---------- Large (matches the feed compose CTA height) ---------- */
.btn.btn--large {
    height: 46px;
    padding: 0 26px;
    font-size: 14px;
}

/* ---------- Icon ---------- */
.btn.btn--icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
}
.btn.btn--icon.btn--large {
    width: 46px;
    height: 46px;
}

/* ---------- Full-width helper ---------- */
.btn.btn--block {
    width: 100%;
}

/* ---------- Busy/loading state ---------- */
.btn__spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffffff;
    animation: btnSpin 0.7s linear infinite;
    display: none;
    flex: 0 0 auto;
}
.btn[data-busy="true"] .btn__spinner {
    display: inline-block;
}
.btn[data-busy="true"] .btn__label {
    opacity: 0.85;
}
.btn[data-busy="true"] {
    cursor: progress;
}

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

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .btn:hover,
    .btn:active { transform: none !important; }
    .btn:hover { filter: none; }
    .btn__spinner { animation: none; }
}
