/* ============================================================
   Wallpaper Hub — Anime Indo design language
   Glassmorphism · Rounded corners · Gradient accent · Soft shadow
   Smooth motion (transform/opacity only, GPU-friendly)
   ============================================================ */

:root {
    /* Scoped override: wallpaper.css/wallpaper-detail.css are only loaded on
       /wallpaper pages, so this safely makes every existing var(--accent)
       reference in this module resolve to the project's primary red instead
       of the sitewide default (--accent: #ffffff in critical.css). */
    --accent: #ff3e3e;
    --wp-radius: 16px;
    --wp-radius-sm: 10px;
    --wp-radius-pill: 9999px;
    --wp-glass-bg: rgba(255, 255, 255, 0.05);
    --wp-glass-border: rgba(255, 255, 255, 0.09);
    --wp-glass-blur: 14px;
    --wp-accent-grad: linear-gradient(135deg, var(--accent, #ff3e3e) 0%, #e63946 100%);
    --wp-gold-grad: linear-gradient(135deg, #ffe08a, #f5a623);
    --wp-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --wp-t-fast: 180ms;
    --wp-t-base: 260ms;
    --wp-t-slow: 550ms;
}

@media (prefers-reduced-motion: reduce) {
    :root { --wp-t-fast: 0ms; --wp-t-base: 0ms; --wp-t-slow: 0ms; }
}

.wp-hub * { box-sizing: border-box; }

/* ============================================================
   HERO
   ============================================================ */
.wp-hero {
    position: relative;
    border-radius: var(--wp-radius);
    overflow: hidden;
    margin-bottom: 28px;
    padding: 56px 28px 40px;
    background: radial-gradient(circle at 20% 20%, rgba(255, 62, 62, 0.16), transparent 55%),
                radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.14), transparent 50%),
                var(--bg-surface);
    border: 1px solid var(--border-color);
    isolation: isolate;
}
.wp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--wp-hero-bg, none);
    background-size: cover;
    background-position: center;
    opacity: 0.28;
    filter: blur(6px) saturate(1.1);
    transform: scale(1.06);
    z-index: -2;
    animation: wpHeroDrift 24s ease-in-out infinite alternate;
}
.wp-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.35) 0%, var(--bg-primary, #0a0a0a) 96%);
    z-index: -1;
}
@keyframes wpHeroDrift {
    from { transform: scale(1.06) translate3d(0, 0, 0); }
    to   { transform: scale(1.12) translate3d(-1.5%, -1%, 0); }
}
.wp-hero-glow {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: var(--wp-accent-grad);
    opacity: 0.18;
    filter: blur(60px);
    top: -120px;
    right: -80px;
    z-index: -1;
    animation: wpFloat 9s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wpFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(22px); }
}

.wp-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--wp-radius-pill);
    background: var(--wp-glass-bg);
    border: 1px solid var(--wp-glass-border);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    opacity: 0;
    animation: wpFadeUp var(--wp-t-slow) var(--wp-ease) 0ms forwards;
}
.wp-hero h1 {
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 12px;
    max-width: 640px;
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent, #ff3e3e));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    animation: wpFadeUp var(--wp-t-slow) var(--wp-ease) 60ms forwards;
}
.wp-hero-sub {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 560px;
    margin: 0 0 22px;
    opacity: 0;
    animation: wpFadeUp var(--wp-t-slow) var(--wp-ease) 120ms forwards;
}

/* Stats row */
.wp-hero-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    opacity: 0;
    animation: wpFadeUp var(--wp-t-slow) var(--wp-ease) 160ms forwards;
}
.wp-hero-stat { display: flex; flex-direction: column; }
.wp-hero-stat strong { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); }
.wp-hero-stat span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Search box */
.wp-search {
    position: relative;
    max-width: 480px;
    margin-bottom: 18px;
    opacity: 0;
    animation: wpFadeDown var(--wp-t-slow) var(--wp-ease) 200ms forwards;
}
.wp-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--wp-glass-bg);
    backdrop-filter: blur(var(--wp-glass-blur));
    -webkit-backdrop-filter: blur(var(--wp-glass-blur));
    border: 1px solid var(--wp-glass-border);
    border-radius: var(--wp-radius-pill);
    padding: 4px 6px 4px 18px;
    transition: border-color var(--wp-t-base) var(--wp-ease), box-shadow var(--wp-t-base) var(--wp-ease);
}
.wp-search-input-wrap:focus-within {
    border-color: var(--accent, #ff3e3e);
    box-shadow: 0 0 0 3px rgba(255, 62, 62, 0.15);
}
.wp-search-input-wrap svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.wp-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.92rem;
    padding: 10px 10px;
}
.wp-search-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent, #ff3e3e);
    animation: wpSpin 0.7s linear infinite;
    opacity: 0;
    transition: opacity var(--wp-t-fast) ease;
    flex-shrink: 0;
    margin-right: 6px;
}
.wp-search-spinner.active { opacity: 1; }
@keyframes wpSpin { to { transform: rotate(360deg); } }

.wp-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--wp-t-fast) ease, transform var(--wp-t-fast) ease;
}
.wp-search-clear:hover { background: rgba(255, 255, 255, 0.16); transform: scale(1.08); }
.wp-search.has-value .wp-search-clear { display: flex; }

/* Suggestion dropdown */
.wp-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    z-index: 40;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity var(--wp-t-fast) var(--wp-ease), transform var(--wp-t-fast) var(--wp-ease);
}
.wp-suggest.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.wp-suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--wp-t-fast) ease;
}
.wp-suggest-item:hover, .wp-suggest-item.is-active { background: rgba(255, 255, 255, 0.06); }
.wp-suggest-item .wp-suggest-badge {
    font-size: 0.62rem;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    flex-shrink: 0;
}
.wp-suggest-item .wp-suggest-count { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); }

/* Trending tags + resolution chips */
.wp-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    opacity: 0;
    animation: wpFadeUp var(--wp-t-slow) var(--wp-ease) 260ms forwards;
}
.wp-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--wp-radius-pill);
    background: var(--wp-glass-bg);
    border: 1px solid var(--wp-glass-border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--wp-t-fast) var(--wp-ease), background var(--wp-t-fast) ease, color var(--wp-t-fast) ease, border-color var(--wp-t-fast) ease, box-shadow var(--wp-t-fast) ease;
    white-space: nowrap;
}
.wp-chip:hover { transform: translateY(-2px) scale(1.03); background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.wp-chip.is-active { background: var(--wp-accent-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(255, 62, 62, 0.28); }
.wp-chip svg { width: 13px; height: 13px; }

/* Hero CTA */
.wp-hero-cta {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    opacity: 0;
    animation: wpFadeUp var(--wp-t-slow) var(--wp-ease) 320ms forwards;
}
.wp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--wp-radius-pill);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform var(--wp-t-fast) var(--wp-ease), box-shadow var(--wp-t-fast) var(--wp-ease), filter var(--wp-t-fast) ease, opacity var(--wp-t-fast) ease;
    -webkit-tap-highlight-color: transparent;
}
.wp-btn:active { transform: scale(0.96); }
.wp-btn-primary { background: var(--wp-accent-grad); color: #fff; box-shadow: 0 10px 26px rgba(255, 62, 62, 0.25); }
.wp-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(255, 62, 62, 0.36); filter: brightness(1.05); }
.wp-btn-ghost { background: var(--wp-glass-bg); border-color: var(--wp-glass-border); color: var(--text-primary); }
.wp-btn-ghost:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.1); }
.wp-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.wp-btn svg { width: 16px; height: 16px; }

@keyframes wpFadeUp { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }
@keyframes wpFadeDown { from { opacity: 0; transform: translate3d(0, -10px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }

/* ============================================================
   FILTER BAR
   ============================================================ */
.wp-filterbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: var(--wp-radius);
    background: var(--wp-glass-bg);
    border: 1px solid var(--wp-glass-border);
}
.wp-filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wp-filter-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-right: 4px; }
.wp-filter-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: var(--wp-radius-pill);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    transition: color var(--wp-t-fast) ease, background var(--wp-t-fast) ease;
}
.wp-filter-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--wp-accent-grad);
    opacity: 0;
    transform: scale(0.6);
    border-radius: inherit;
    transition: opacity var(--wp-t-base) var(--wp-ease), transform var(--wp-t-base) var(--wp-ease);
    z-index: -1;
}
.wp-filter-chip.is-active { color: #fff; }
.wp-filter-chip.is-active::before { opacity: 1; transform: scale(1); }
.wp-filter-chip:hover:not(.is-active) { background: rgba(255, 255, 255, 0.1); color: #fff; }
.wp-filter-chip .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: wpRipple 500ms ease-out;
    pointer-events: none;
}
@keyframes wpRipple { to { transform: scale(3); opacity: 0; } }

.wp-filter-select {
    appearance: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--wp-glass-border);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 7px 30px 7px 13px;
    border-radius: var(--wp-radius-pill);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    transition: border-color var(--wp-t-fast) ease;
}
.wp-filter-select:hover, .wp-filter-select:focus { border-color: var(--accent, #ff3e3e); outline: none; }

.wp-filter-clear {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color var(--wp-t-fast) ease;
}
.wp-filter-clear:hover { color: var(--accent, #ff3e3e); }

/* ============================================================
   GRID + CARD
   ============================================================ */
.wp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 0 0 8px;
}

/* NOTE: the old "hide broken card" behaviour was removed — the same-origin
   image proxy makes images load reliably, so cards are never hidden. Any
   stale copy of this class (e.g. cached older JS) must NOT hide content: */
.wp-card.wp-card-hidden-broken { opacity: 1 !important; pointer-events: auto !important; display: block !important; }

.wp-card {
    position: relative;
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--wp-radius);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    isolation: isolate;
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.97);
    animation: wpCardIn var(--wp-t-slow) var(--wp-ease) forwards;
    animation-delay: calc(var(--i, 0) * 40ms);
    transition: transform var(--wp-t-base) var(--wp-ease), box-shadow var(--wp-t-base) var(--wp-ease), border-color var(--wp-t-base) ease;
    will-change: transform;
}
@keyframes wpCardIn { to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }

.wp-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid transparent;
    background: linear-gradient(135deg, rgba(255, 62, 62, 0.5), rgba(59, 130, 246, 0.5)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--wp-t-base) ease;
    pointer-events: none;
    z-index: 3;
}
/* :focus-within replaces the old :focus-visible — the card root is an
   <article> now, so it is not itself focusable; the focus lands on the
   stretched link inside it. Keyboard users keep the identical lift/glow. */
.wp-card:hover, .wp-card:focus-within {
    transform: translate3d(0, -5px, 0) scale(1.035);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.4);
    border-color: transparent;
}
.wp-card:hover::after, .wp-card:focus-within::after { opacity: 1; }

/* Hover-revealed affordances must also appear on keyboard focus, otherwise
   the fav button and action row are unreachable without a mouse. */
.wp-card:focus-within .wp-card-glass-overlay,
.wp-card:focus-within .wp-card-fav,
.wp-card:focus-within .wp-card-actions,
.wp-card:focus-within .wp-badge-orientation { opacity: 1; }
.wp-card:focus-within .wp-card-fav,
.wp-card:focus-within .wp-card-actions { transform: translateY(0); }

.wp-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background-color: var(--bg-elevated);
    /* Skeleton shimmer shown behind the fading-in <img> until it loads.
       Painted as the container's own background so it sits below the image
       and the badges without any z-index juggling. Stopped once JS adds
       .wp-thumb-loaded on successful load. */
    background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: wpShimmer 1.4s ease-in-out infinite;
}
.wp-card-thumb.wp-thumb-loaded {
    animation: none;
    background-image: none;
}
.wp-card-thumb img {
    /* In-flow with its own aspect-ratio (NOT position:absolute + height:100%).
       A percentage height on an absolutely-positioned child does not reliably
       resolve against a parent whose height comes from `aspect-ratio` in some
       browser engines — it collapses to height:0, so the image loads but is
       invisible. Sizing the image directly via width:100% + aspect-ratio is
       bulletproof across engines. */
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.08);
    filter: blur(8px);
    transition: opacity 420ms ease, transform var(--wp-t-slow) var(--wp-ease), filter 420ms ease;
}
.wp-card-thumb img.is-loaded { opacity: 1; transform: scale(1); filter: blur(0); }
.wp-card-thumb img.img-error {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}
.wp-card-thumb.wp-thumb-fallback {
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wp-card-thumb.wp-thumb-fallback::after {
    content: '';
    width: 40%;
    height: 40%;
    max-width: 56px;
    max-height: 40px;
    opacity: 0.25;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff3e3e' stroke-width='1.5'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.wp-card-thumb img.wp-img-fallback { opacity: 0.7; transform: none; filter: none; animation: wpFallbackPulse 4s ease-in-out infinite; }
@keyframes wpFallbackPulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 0.55; } }
.wp-card:hover .wp-card-thumb img.is-loaded { transform: scale(1.08); filter: brightness(1.06); }

/* Stretched link — the card's primary click + crawl target.
   The card root is <article>, not <a>, because a card legitimately contains
   other links (Download, #tags) and nesting <a> inside <a> is invalid HTML
   that browsers "fix" by tearing the card into sibling fragments. See
   templates/wallpaper/_card.html for the full story.
   z-index 1 keeps it under the glass overlay (2), fav button (5) and the
   action row (4), so those stay independently clickable on top of it. */
.wp-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.wp-card-glass-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.82) 100%);
    opacity: 0;
    transition: opacity var(--wp-t-base) ease;
    z-index: 2;
    /* Purely decorative. Without this it sits above .wp-card-link and
       swallows every click aimed at the card. */
    pointer-events: none;
}
.wp-card:hover .wp-card-glass-overlay { opacity: 1; }

.wp-badge {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: rgba(10, 10, 10, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.64rem;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.3px;
    z-index: 4;
    transition: transform var(--wp-t-fast) var(--wp-ease);
}
.wp-badge-res { top: 9px; right: 9px; }
.wp-card:hover .wp-badge-res { transform: translateY(-2px); }
.wp-badge-res.tier-4k, .wp-badge-res.tier-8k { background: linear-gradient(135deg, rgba(255, 224, 138, 0.92), rgba(245, 166, 35, 0.92)); color: #241b06; }
.wp-badge-artist { top: 9px; left: 9px; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-badge-adult { top: 9px; left: 9px; background: rgba(239, 68, 68, 0.92); color: #fff; border: 1px solid rgba(255,255,255,0.35); }
.wp-badge-artist:not(:first-child), .wp-badge-adult + .wp-badge-artist { top: 34px; }
.wp-badge-orientation { bottom: 9px; left: 9px; opacity: 0; transition: opacity var(--wp-t-fast) ease; }
.wp-card:hover .wp-badge-orientation { opacity: 1; }

.wp-card-fav {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(6px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--wp-t-fast) ease, transform var(--wp-t-fast) var(--wp-ease), background var(--wp-t-fast) ease;
}
.wp-card:hover .wp-card-fav, .wp-card-fav.is-fav { opacity: 1; transform: translateY(0); }
.wp-card-fav svg { width: 15px; height: 15px; transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.wp-card-fav.is-fav svg { fill: #ff3e3e; stroke: #ff3e3e; }
.wp-card-fav.pop svg { transform: scale(1.4); }
.wp-card-fav:hover { background: rgba(255, 62, 62, 0.85); }

.wp-card-actions {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    z-index: 4;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--wp-t-base) ease, transform var(--wp-t-base) var(--wp-ease);
}
.wp-card:hover .wp-card-actions { opacity: 1; transform: translateY(0); }
.wp-card-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--wp-t-fast) ease, transform var(--wp-t-fast) var(--wp-ease);
}
.wp-card-action-btn:hover { background: var(--wp-accent-grad); transform: translateY(-1px); }
.wp-card-action-btn svg { width: 13px; height: 13px; }

.wp-card-info { padding: 11px 13px 12px; }
.wp-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    /* Now a real <a> (it was a <div> inside a card-wide <a>) so crawlers get
       anchor text for the detail page. These three keep it pixel-identical to
       the old <div>: no underline, block layout so margin applies, and it
       inherits the card's colour rather than the UA link colour. */
    display: block;
    text-decoration: none;
    position: relative;
}
.wp-card-meta { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.wp-card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; max-height: 20px; overflow: hidden; }
.wp-card-tag {
    font-size: 0.62rem;
    padding: 2px 8px;
    border-radius: var(--wp-radius-pill);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: background var(--wp-t-fast) ease, color var(--wp-t-fast) ease, transform var(--wp-t-fast) var(--wp-ease);
}
.wp-card-tag:hover { background: var(--accent, #ff3e3e); color: #fff; transform: translateY(-1px) scale(1.05); border-color: transparent; }

/* Skeleton */
.wp-skeleton { border-radius: var(--wp-radius); background: var(--bg-surface); border: 1px solid var(--border-color); overflow: hidden; }
.wp-skeleton .sk-thumb { width: 100%; aspect-ratio: 3 / 2; }
.wp-skeleton .sk-line { height: 12px; margin: 12px 13px; border-radius: 4px; }
.wp-skeleton .sk-line.short { width: 55%; }
.wp-skeleton .sk-thumb, .wp-skeleton .sk-line {
    background: linear-gradient(100deg, var(--bg-surface) 30%, rgba(255, 255, 255, 0.06) 50%, var(--bg-surface) 70%);
    background-size: 200% 100%;
    animation: wpShimmer 1.5s ease-in-out infinite;
}
@keyframes wpShimmer { 0% { background-position: 150% 0; } 100% { background-position: -50% 0; } }

/* ── Image fallback / placeholder states ────────────────── */
.wp-thumb-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wp-thumb-placeholder svg {
    opacity: 0.3;
}
.wp-thumb-placeholder::after {
    content: '';
    width: 40%;
    height: 40%;
    max-width: 56px;
    max-height: 40px;
    opacity: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff3e3e' stroke-width='1.5'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.wp-img-fallback {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    object-fit: contain !important;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.wp-thumb-fallback {
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
}
.wp-detail-placeholder {
    width: 100%;
    min-height: 360px;
    max-height: 78vh;
    border-radius: 10px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wp-detail-placeholder::after {
    content: 'Image unavailable';
    color: rgba(255, 62, 62, 0.3);
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
}
.wp-home-card.wp-thumb-fallback {
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
}
.wp-home-card.wp-thumb-fallback img { display: none; }

/* Sentinel + loader */
.wp-sentinel { height: 1px; }
.wp-infinite-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.wp-infinite-loader .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: wpDotPulse 1.1s ease-in-out infinite; }
.wp-infinite-loader .dot:nth-child(2) { animation-delay: 0.15s; }
.wp-infinite-loader .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes wpDotPulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1.15); } }

/* Empty / error state */
.wp-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}
.wp-state svg { width: 52px; height: 52px; margin-bottom: 14px; opacity: 0.35; }
.wp-state p { font-size: 0.95rem; margin: 0 0 16px; }

/* Quick preview modal */
.wp-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--wp-t-base) ease;
}
.wp-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.wp-modal {
    position: relative;
    max-width: 900px;
    max-height: 88vh;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--wp-radius);
    overflow: hidden;
    transform: scale(0.94) translateY(10px);
    transition: transform var(--wp-t-base) var(--wp-ease);
    display: flex;
    flex-direction: column;
}
.wp-modal-backdrop.open .wp-modal { transform: scale(1) translateY(0); }
.wp-modal img { width: 100%; max-height: 70vh; object-fit: contain; background: #000; }
.wp-modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; flex-wrap: wrap; }
.wp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--wp-t-fast) ease, transform var(--wp-t-fast) var(--wp-ease);
}
.wp-modal-close:hover { background: rgba(255, 62, 62, 0.85); transform: rotate(90deg); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) { .wp-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
    .wp-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .wp-hero { padding: 40px 20px 30px; }
}
@media (max-width: 560px) {
    .wp-hero h1 { font-size: 1.5rem; }
    .wp-hero-stats { gap: 14px; }
    .wp-filterbar { padding: 10px; gap: 6px; }
    .wp-grid { gap: 8px; }
    .wp-card-info { padding: 8px 10px 10px; }
    .wp-card-title { font-size: 0.75rem; }
    .wp-card-tags, .wp-badge-artist { display: none; }
}

/* ============================================================
   DETAIL PAGE
   ============================================================ */
.wp-detail { max-width: 1180px; margin: 0 auto; padding: 0 var(--space-md, 16px) var(--space-xl, 40px); }

.wp-detail-hero {
    position: relative;
    border-radius: var(--wp-radius);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}
.wp-detail-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(30px) saturate(1.2) brightness(0.55);
    transform: scale(1.1);
    z-index: 0;
}
.wp-detail-frame {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    max-height: 78vh;
    padding: 18px;
}
.wp-detail-frame img {
    max-width: 100%;
    max-height: 74vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 480ms ease, transform 480ms var(--wp-ease);
}
.wp-detail-frame img.is-loaded { opacity: 1; transform: scale(1); }

.wp-download-group { position: relative; z-index: 2; display: flex; gap: 8px; padding: 16px 18px; flex-wrap: wrap; align-items: center; }
.wp-download-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 18px;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    pointer-events: none;
    transition: opacity var(--wp-t-fast) var(--wp-ease), transform var(--wp-t-fast) var(--wp-ease);
    z-index: 10;
}
.wp-download-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.wp-download-menu button, .wp-download-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.84rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--wp-t-fast) ease;
}
.wp-download-menu button:hover, .wp-download-menu a:hover { background: rgba(255, 255, 255, 0.06); }

.wp-info { display: grid; grid-template-columns: 1fr 300px; gap: 24px; margin-bottom: 32px; }
.wp-info-main h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px; }
.wp-info-main p { color: var(--text-muted); line-height: 1.7; font-size: 0.92rem; margin: 0 0 18px; }
.wp-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wp-meta-item {
    background: var(--wp-glass-bg);
    border: 1px solid var(--wp-glass-border);
    border-radius: var(--wp-radius-sm);
    padding: 12px 14px;
    transition: transform var(--wp-t-fast) var(--wp-ease), border-color var(--wp-t-fast) ease;
}
.wp-meta-item:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.2); }
.wp-meta-item-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 4px; }
.wp-meta-item-value { font-size: 0.9rem; font-weight: 700; }

.wp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.wp-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--wp-glass-border);
    padding: 5px 12px;
    border-radius: var(--wp-radius-pill);
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--wp-t-fast) var(--wp-ease);
}
.wp-tag:hover { background: var(--wp-accent-grad); color: #fff; border-color: transparent; transform: translateY(-1px) scale(1.04); }

.wp-sidebar { display: flex; flex-direction: column; gap: 16px; }
.wp-sidebar-box { background: var(--wp-glass-bg); border: 1px solid var(--wp-glass-border); border-radius: var(--wp-radius); padding: 18px; }
.wp-sidebar-box h3 { font-size: 0.8rem; font-weight: 700; margin: 0 0 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.wp-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; }

@media (max-width: 768px) {
    .wp-info { grid-template-columns: 1fr; }
    .wp-meta-grid { grid-template-columns: 1fr 1fr; }
    .wp-detail-frame { min-height: 240px; }
}

/* Toast (share/copy feedback) */
.wp-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 12px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: var(--wp-radius-pill);
    font-size: 0.82rem;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--wp-t-base) var(--wp-ease), transform var(--wp-t-base) var(--wp-ease);
}
.wp-toast.show { opacity: 1; transform: translate(-50%, 0); }
