/**
 * polish.css — production polish layer
 * Loads after design.css / theme.css / theme-light.css.
 *
 * IMPORTANT: This file MUST NOT modify the locked home hero showcase.
 * See .cursor/rules/hero-showcase-locked.mdc — selectors starting with
 *   .hero__stage, .hero__col, .hero__card, .hero__card-shine, .hero__stage-glow
 * and keyframes hero-marquee / hero-shimmer / hero-glow-shift are off-limits.
 */

/* ============================================================
   1. Selection, scrollbar, motion preferences
   ============================================================ */

::selection {
    background: rgba(124, 106, 255, 0.32);
    color: var(--text-primary);
}
html[data-theme="light"] ::selection {
    background: rgba(106, 88, 232, 0.22);
    color: #0f0f18;
}

/* Subtle, themed scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 106, 255, 0.28) transparent;
}
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background-color: rgba(124, 106, 255, 0.22);
    background-clip: content-box;
    border: 2px solid transparent;
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
    background-color: rgba(124, 106, 255, 0.45);
    background-clip: content-box;
}
html[data-theme="light"] *::-webkit-scrollbar-thumb {
    background-color: rgba(106, 88, 232, 0.28);
}

/* Respect reduced motion globally (the locked hero already opts in) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.08s !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   2. Accessibility — focus rings, skip link
   ============================================================ */

:focus-visible {
    outline: 2px solid var(--accent, #8b7cff);
    outline-offset: 3px;
    border-radius: inherit;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.nav-account:focus-visible,
.nav-toggle:focus-visible,
.theme-toggle:focus-visible,
.tab:focus-visible,
.page-btn:focus-visible,
.see-all:focus-visible {
    outline: 2px solid var(--accent, #8b7cff);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(124, 106, 255, 0.22);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 9999;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--accent, #8b7cff), var(--accent-dim, #5c4fd4));
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(124, 106, 255, 0.4);
    transition: top 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.skip-link:focus {
    top: 12px;
    color: var(--accent-text);
}

/* ============================================================
   3. Page transition (subtle fade-in)
   ============================================================ */

.site-main {
    animation: page-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes page-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   4. Refined buttons (consistent active/disabled states)
   ============================================================ */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid transparent;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.22s;
}
.btn:active:not(:disabled):not([aria-disabled="true"]) {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.08s;
}
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    pointer-events: none;
}
.btn-sm {
    padding: 8px 14px;
    font-size: 0.82rem;
    min-height: 36px;
}
.btn-lg {
    padding: 14px 26px;
    font-size: 1rem;
    min-height: 48px;
}
.btn:not(.btn-sm):not(.btn-lg) {
    min-height: 42px;
    padding: 10px 18px;
    font-size: 0.9rem;
}

/* ============================================================
   5. Refined form controls (consistent across the site)
   ============================================================ */

.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-group select,
.form-group textarea,
.search-input,
.select-sm {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    background: var(--bg-input, rgba(8, 8, 12, 0.6));
    border: 1px solid var(--border-default, rgba(255, 255, 255, 0.1));
    color: var(--text-primary);
    border-radius: var(--radius-sm, 10px);
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-group textarea {
    min-height: 96px;
    line-height: 1.55;
    resize: vertical;
}
.form-group input:hover:not(:focus):not(:disabled),
.form-group select:hover:not(:focus):not(:disabled),
.form-group textarea:hover:not(:focus):not(:disabled),
.search-input:hover:not(:focus),
.select-sm:hover:not(:focus) {
    border-color: rgba(124, 106, 255, 0.42);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-input:focus,
.select-sm:focus {
    outline: none;
    border-color: var(--accent, #8b7cff);
    background: var(--bg-input, rgba(8, 8, 12, 0.6));
    box-shadow: 0 0 0 3px rgba(124, 106, 255, 0.2);
}
.form-group input::placeholder,
.form-group textarea::placeholder,
.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Checkbox / radio polish */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent, #8b7cff);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* File input look */
input[type="file"] {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    background: rgba(124, 106, 255, 0.15);
    color: #fff;
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
input[type="file"]::file-selector-button:hover {
    background: rgba(124, 106, 255, 0.25);
    border-color: var(--accent);
}

/* ============================================================
   6. Refined empty state pattern
   ============================================================ */

.empty-state {
    text-align: center;
    padding: clamp(48px, 8vw, 72px) 24px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-xl, 24px);
    max-width: 520px;
    margin: 24px auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.empty-state__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(124, 106, 255, 0.14);
    border: 1px solid var(--border-accent, rgba(124, 106, 255, 0.3));
    color: #fff;
    font-size: 1.5rem;
}
.empty-state h2,
.empty-state__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}
.empty-state p {
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1.6;
    margin: 0 auto 18px;
    max-width: 380px;
}
.empty-state .btn,
.empty-state a:not(.btn) {
    margin: 4px 4px 0;
}

/* ============================================================
   7. Improved 404 / error page
   ============================================================ */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 220px);
    padding: 48px 24px;
    text-align: center;
    position: relative;
}
.error-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 50% 40% at 50% 30%, rgba(124, 106, 255, 0.18), transparent 65%);
    filter: blur(40px);
    pointer-events: none;
    z-index: -1;
}
.error-page__code {
    font-size: clamp(6rem, 18vw, 10rem);
    font-weight: 900;
    letter-spacing: -0.06em;
    line-height: 0.95;
    background: linear-gradient(135deg, var(--accent-bright, #a594ff) 0%, var(--accent, #8b7cff) 45%, var(--accent-dim, #5c4fd4) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
    filter: drop-shadow(0 12px 30px rgba(124, 106, 255, 0.32));
}
.error-page__title {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 16px 0 12px;
}
.error-page__desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.65;
    max-width: 480px;
    margin: 0 0 28px;
}
.error-page__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ============================================================
   8. Footer polish
   ============================================================ */

.footer h4 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.footer__col a {
    display: block;
    padding: 5px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s, transform 0.2s;
}
.footer__col a:hover {
    color: var(--accent-text);
    transform: translateX(3px);
}
.footer__bottom {
    padding-top: 20px;
    margin-top: 8px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

/* ============================================================
   9. Misc polish
   ============================================================ */

@media (max-width: 600px) {
    .nav-link:not(.nav-link--icon),
    .btn,
    .page-btn,
    .tab {
        min-height: 44px;
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.card-placeholder,
.card-placeholder-lg,
.set-placeholder {
    color: var(--text-muted);
    background: var(--card-img-bg, linear-gradient(165deg, rgba(28, 28, 40, 0.9) 0%, rgba(12, 12, 18, 0.95) 100%));
    opacity: 0.7;
}
.card-placeholder { opacity: 0.55; }

.flash {
    animation: flash-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes flash-in {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-price,
.big-price,
.stat-num,
.stat-val,
.market-ref,
.price-col,
.card-listing-row__price {
    font-variant-numeric: tabular-nums;
}

img[loading="lazy"] {
    transition: opacity 0.25s;
}

.fa-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-bar .search-submit {
    min-height: 44px;
}

.form-card hr,
.card-page__actions-panel hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 24px 0;
}

button,
.btn,
a.btn,
.nav-link,
.page-btn,
.tab {
    touch-action: manipulation;
}

/* ============================================================
   Section headers — tighter, more elegant
   ============================================================ */
.section-title {
    font-size: 1.45rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    gap: 0;
}
.see-all {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--accent-text);
    opacity: 0.8;
    margin-left: 14px;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.see-all:hover { opacity: 1; }

/* Results row — give the count slightly more presence */
.results-row {
    margin-bottom: 20px;
}
.results-count {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ============================================================
   Set cards — light mode backgrounds & card polish
   ============================================================ */
html[data-theme="light"] .set-card img,
html[data-theme="light"] .set-placeholder {
    background: linear-gradient(160deg, #f0f0f8 0%, #e8e8f4 100%);
}
html[data-theme="light"] .set-card {
    background: #ffffff;
    border-color: var(--border-default);
    box-shadow: 0 1px 6px rgba(15, 15, 28, 0.06);
}
html[data-theme="light"] .set-card:hover {
    box-shadow: 0 6px 20px rgba(106, 88, 232, 0.12), 0 2px 8px rgba(15, 15, 28, 0.07);
}
html[data-theme="light"] .set-name { color: #0f0f18; }
html[data-theme="light"] .set-meta,
html[data-theme="light"] .set-date { color: #6a6a80; }

/* ============================================================
   Card-foot light mode
   ============================================================ */
html[data-theme="light"] .card-foot {
    border-top-color: #e8e8f2;
}
html[data-theme="light"] .card-foot .card-cond {
    color: var(--accent-text);
}
html[data-theme="light"] .card-foot .card-seller {
    color: #8a8aaa;
}

/* ============================================================
   Game cards — slightly more depth
   ============================================================ */
.game-card {
    position: relative;
    overflow: hidden;
}
.game-card__cta {
    display: inline-block;
    margin-top: 16px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-text);
    letter-spacing: 0.01em;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.2s;
}
.game-card:hover .game-card__cta {
    opacity: 1;
    transform: translateX(3px);
}

/* ============================================================
   7. Advanced cards browse — count bar, load-more, busy state
   ============================================================ */
.browse-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin: 4px 2px 18px;
}
.card-grid[aria-busy="true"] {
    opacity: 0.55;
    transition: opacity 0.15s var(--ease-out, ease);
    pointer-events: none;
}
.load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 32px 0 8px;
}
.load-more-wrap #loadMore {
    min-width: 220px;
}

/* —— Explore-by-game cards: match site style (home only) ——
   Restrained to the site's language: single violet accent, glass surfaces,
   brand color only as the subtle hover glow already on .game-card__accent.
   No solid color bars, no filled buttons. */
.home-games .game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* Per-game tint mirrors the original .game-icon tiles (kept subtle) */
.home-games .game-card.op   { --game-tint: rgba(255, 107, 53, 0.10); }
.home-games .game-card.poke { --game-tint: rgba(255, 215, 0, 0.10); }
/* Logo seated on a faint tinted tile at a uniform height so the three
   different-shaped wordmarks share one baseline */
.home-games .game-logo {
    height: 96px;
    width: 100%;
    padding: 0 24px;
    margin: 4px 0 18px;
    border-radius: var(--radius-md);
    background:
        radial-gradient(ellipse 120% 100% at 50% 0%, rgba(255,255,255,0.06), transparent 70%),
        var(--game-tint, rgba(124, 106, 255, 0.08));
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.home-games .game-logo img {
    max-height: 64px;
    max-width: 88%;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}
.home-games .game-card:hover .game-logo img { transform: scale(1.05); }

/* CTA keeps the site's text-link-with-arrow style (base .game-card__cta);
   just pin it to the bottom so all three cards' CTAs align */
.home-games .game-card__cta { margin-top: auto; }
