/**
 * docs/design/06_Buttons.md
 */

/* Modern SaaS button system — 16px radius, 48–52px heights, 200ms eased
   transitions, gentle hover lift. Every variant declares its own :hover
   color so the global `a:hover` link color can never bleed blue text onto
   a dark button (specificity: .btn--x:hover beats a:hover). */
.btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-weight: var(--weight-semibold);
    font-size: 1.0625rem;
    letter-spacing: 0.01em;
    border-radius: var(--radius-xl);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background-color 200ms var(--ease-out),
                color 200ms var(--ease-out),
                border-color 200ms var(--ease-out),
                transform 200ms var(--ease-out),
                box-shadow 200ms var(--ease-out);
    min-width: 120px;
    white-space: nowrap;
    text-decoration: none !important;
}

/* Click ripple — spawned by initButtonRipple() in main.js, skipped under
   prefers-reduced-motion (the JS never creates the element in that case). */
.btn__ripple {
    position: absolute;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: var(--radius-full);
    background: currentColor;
    opacity: 0.35;
    pointer-events: none;
    animation: btn-ripple 550ms var(--ease-out) forwards;
}

@keyframes btn-ripple {
    to { width: 260px; height: 260px; margin: -130px 0 0 -130px; opacity: 0; }
}

.btn--large { height: 52px; padding: 0 var(--space-8); font-size: 1.125rem; }
.btn--default { height: 48px; padding: 0 var(--space-6); }
.btn--small { height: 38px; padding: 0 var(--space-4); font-size: var(--text-body-sm); min-width: 0; border-radius: var(--radius-lg); }
.btn--full { width: 100%; }

.btn--primary {
    background: var(--color-primary-600);
    color: var(--color-white);
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
    /* Slightly LIGHTER on hover (never darker), text stays white. */
    background: color-mix(in srgb, var(--color-primary-600) 82%, white);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.btn--primary:active { background: var(--color-primary-700); color: var(--color-white); transform: translateY(0); }

.btn--secondary {
    background: var(--color-white);
    color: var(--color-primary-600);
    border-color: var(--color-primary-600);
}
.btn--secondary:hover {
    background: var(--color-primary-50);
    color: var(--color-primary-700);
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary-600) 12%, transparent);
}

.btn--tertiary {
    background: transparent;
    color: var(--color-primary-600);
    min-width: 0;
    padding-inline: 0;
    height: auto;
}
.btn--tertiary:hover { text-decoration: underline; color: var(--color-primary-700); }

.btn--accent {
    background: var(--color-accent-600);
    color: var(--color-neutral-900);
    box-shadow: var(--shadow-sm);
}
.btn--accent:hover {
    /* Brighten slightly; keep the dark text that passes contrast on gold. */
    background: color-mix(in srgb, var(--color-accent-600) 88%, white);
    color: var(--color-neutral-900);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn--danger {
    background: var(--color-danger-600);
    color: var(--color-white);
}

/* On the dark gradient heroes, a navy primary button blends into the
   background — invert it to a white-filled button so the primary CTA reads
   as the strongest element, with the outline secondary beside it. */
.hero .btn--primary,
.page-hero .btn--primary {
    background: var(--color-white);
    color: var(--color-primary-700);
    border-color: var(--color-white);
}
.hero .btn--primary:hover,
.page-hero .btn--primary:hover {
    background: var(--color-neutral-100);
    color: var(--color-primary-900);
}
.hero .btn--secondary,
.page-hero .btn--secondary {
    background: transparent;
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.5);
}
.hero .btn--secondary:hover,
.page-hero .btn--secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--color-white);
    color: var(--color-white);
}

/* CTA band sits on the same dark gradient — its accent (gold) button is the
   primary; any secondary beside it uses the white-outline treatment. */
.cta-band .btn--secondary {
    background: transparent;
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.5);
}
.cta-band .btn--secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--color-white);
    color: var(--color-white);
}

.btn:disabled {
    background: var(--color-neutral-300);
    color: var(--color-neutral-500);
    cursor: not-allowed;
    transform: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary-600);
    outline-offset: 2px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-neutral-900);
    transition: background-color var(--duration-fast) var(--ease-out);
}

.icon-button:hover {
    background: var(--color-neutral-100);
}

.btn__icon svg { width: var(--icon-size-button); height: var(--icon-size-button); transition: transform var(--duration-fast) var(--ease-out); }

@media (hover: hover) {
    .btn:hover .btn__icon svg { transform: translateX(3px); }
}

@media (max-width: 639px) {
    .hero__actions .btn,
    .page-hero__actions .btn,
    .cta-band__actions .btn,
    .intent-router .btn {
        width: 100%;
    }
    /* Let the action rows stack their full-width buttons cleanly. */
    .hero__actions,
    .page-hero__actions,
    .cta-band__actions { width: 100%; flex-direction: column; align-items: stretch; }
}
