/* Shared keyboard, touch-target and action-feedback improvements. */

.skip-link {
    background: var(--surface, #1f1a1a);
    border: 2px solid var(--gold-strong, #d4af37);
    border-radius: 0 0 0.5rem 0.5rem;
    color: var(--text, #fff) !important;
    font-weight: 700;
    left: 1rem;
    padding: 0.7rem 1rem;
    position: fixed;
    top: 0;
    transform: translateY(-130%);
    transition: transform 0.15s ease;
    z-index: 10000;
}

.skip-link:focus {
    transform: translateY(0);
}

:where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    box-shadow: 0 0 0 0.22rem rgba(212, 175, 55, 0.38) !important;
    outline: 2px solid var(--gold-strong, #d4af37) !important;
    outline-offset: 2px !important;
}

#main-content:focus {
    outline: 0;
}

.action-feedback-region {
    display: grid;
    gap: 0.65rem;
    max-width: min(92vw, 520px);
    position: fixed;
    right: clamp(0.75rem, 3vw, 2rem);
    top: max(0.75rem, env(safe-area-inset-top));
    width: max-content;
    z-index: 1090;
}

.action-feedback {
    align-items: center;
    animation: feedback-enter 0.18s ease-out;
    background: var(--surface, #2c2424);
    border: 1px solid var(--gold, #b99a68);
    border-left-width: 5px;
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.45));
    color: var(--text, #f5e9dc);
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 64px;
    overflow: hidden;
    padding: 0.8rem 0.9rem;
    position: relative;
    width: min(92vw, 520px);
}

.action-feedback.is-leaving {
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.action-feedback--success { border-left-color: #2f9e55; }
.action-feedback--danger { border-left-color: #e55353; }
.action-feedback--warning { border-left-color: #f0ad24; }

.action-feedback__message {
    color: inherit;
    line-height: 1.4;
    margin: 0;
}

.action-feedback__actions {
    align-items: center;
    display: flex;
    gap: 0.35rem;
}

.action-feedback__undo,
.action-feedback__close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0.35rem;
    color: var(--text, #f5e9dc);
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 44px;
}

.action-feedback__undo {
    color: var(--gold-strong, #d4af37);
    padding-inline: 0.65rem;
}

.action-feedback__undo:disabled {
    cursor: wait;
    opacity: 0.72;
}

.action-feedback__close {
    font-size: 1.5rem;
    line-height: 1;
    min-width: 44px;
    padding: 0;
}

.action-feedback__progress {
    animation: feedback-progress var(--feedback-duration, 9000ms) linear forwards;
    background: var(--gold-strong, #d4af37);
    bottom: 0;
    height: 3px;
    left: 0;
    opacity: 0.65;
    position: absolute;
    transform-origin: left;
    width: 100%;
}

@keyframes feedback-enter {
    from { opacity: 0; transform: translateY(-0.75rem); }
}

@keyframes feedback-progress {
    to { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
    .action-feedback-region {
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        left: 0.75rem;
        max-width: none;
        right: 0.75rem;
        top: auto;
        width: auto;
    }

    .action-feedback {
        align-items: stretch;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .action-feedback__actions {
        justify-content: flex-end;
    }
}

@media (pointer: coarse) {
    .navbar .nav-link,
    .navbar .dropdown-item,
    .navbar .navbar-toggler,
    .global-search-modal .btn-close,
    .home-search-suggestions a,
    .btn-sm {
        align-items: center;
        display: inline-flex;
        min-height: 44px;
    }

    .navbar .navbar-toggler {
        justify-content: center;
        min-width: 56px;
    }

    .global-search-modal .btn-close {
        justify-content: center;
        width: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .action-feedback__progress {
        display: none;
    }
}
