/* GM_Screen-hub.css
   Hub-page enhancements for GM_Screen.html
   Accessibility: Web Accessibility Cookbook (O'Reilly)
   Security:      Web Application Security 2nd Ed (O'Reilly)  */

/* ---- Intro text ---- */
.hub-intro {
    max-width: 680px;
    margin: -20px auto 44px;
    color: var(--text-subtle);
    font-size: 1rem;
    line-height: 1.65;
    text-align: center;
}

/* ---- Controls bar (search + filters + count) ---- */
.hub-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 0 auto 44px;
    max-width: 900px;
}

/* ---- Search ---- */
/* role="search" landmark — Web Accessibility Cookbook ch. 4 */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.search-wrapper::before {
    content: '⌕';
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--text-subtle);
    pointer-events: none;
    line-height: 1;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 38px;
    border-radius: 8px;
    border: 1.5px solid var(--dark-panel-alt);
    background: var(--dark-panel);
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: 'Roboto', sans-serif;
}

.search-input::placeholder {
    color: var(--text-subtle);
    opacity: 0.75;
}

.search-input:focus-visible {
    outline: 0.25em solid var(--accent-green);
    outline-offset: 0.2em;
    border-color: var(--accent-green);
}

/* ---- Genre filter buttons ---- */
/* role="group" pattern — Web Accessibility Cookbook ch. 4 */
.hub-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.filter-btn {
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--dark-panel-alt);
    background: var(--dark-panel);
    color: var(--text-subtle);
    font-family: 'Roboto', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.filter-btn:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.filter-btn.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-color);
}

.filter-btn:focus-visible {
    outline: 0.25em solid var(--accent-green);
    outline-offset: 0.25em;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.75rem;
    margin-left: 5px;
    font-weight: 700;
}

.filter-btn.active .filter-count {
    background: rgba(0, 0, 0, 0.3);
}

/* ---- Results count ---- */
/* aria-live="polite" — Web Accessibility Cookbook ch. 8 */
.hub-results {
    font-size: 0.85rem;
    color: var(--text-subtle);
    margin: 0;
}

.hub-results strong {
    color: var(--accent-green);
    font-weight: 700;
}

/* ---- Image wrapper ---- */
.card-img-wrap {
    position: relative;
    overflow: hidden;
}

/* Image hover zoom — Web Accessibility Cookbook ch. 10 (reduced-motion guard) */
@media (prefers-reduced-motion: no-preference) {
    .card-img-wrap .preview-image {
        transition: transform 0.45s ease;
    }
    .preview-card:hover .card-img-wrap .preview-image {
        transform: scale(1.06);
    }
}

/* ---- Image gradient overlay (fades image into card background) ---- */
.img-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(to bottom, transparent, var(--dark-panel));
    pointer-events: none;
}

/* ---- Genre badge ---- */
.genre-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.genre-horror      { background: rgba(150, 0,  15, 0.85); }
.genre-fantasy     { background: rgba(18,  95, 18, 0.85); }
.genre-sci-fi      { background: rgba(0,   70, 170, 0.85); }
.genre-supernatural{ background: rgba(85,  0, 135, 0.85); }
.genre-comedy      { background: rgba(148, 108, 0, 0.85); }

/* ---- System tag (small text below h2) ---- */
.system-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-green);
    opacity: 0.65;
    margin: 0 0 6px;
    font-family: 'Roboto', sans-serif;
}

/* ---- Card-as-link pattern ---- */
/* Single focusable element per card — Web Accessibility Cookbook ch. 7
   .preview-link::after is position:absolute relative to .preview-card
   (nearest position:relative ancestor, set in site.css).
   This makes the entire card surface clickable via the one semantic link,
   while the link itself remains the only focusable element. */
.preview-card {
    cursor: default; /* pointer is handled by ::after below */
}

.preview-link::after {
    content: '';
    position: absolute; /* anchors to .preview-card */
    inset: 0;           /* fills the card */
    cursor: pointer;
}

/* ---- Hidden cards (filtered out) ---- */
.preview-card.hidden {
    display: none;
}

/* ---- No-results state ---- */
.no-results {
    display: none;
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-subtle);
    font-size: 1.05rem;
}

.no-results.visible {
    display: block;
}

.no-results-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 12px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hub-intro {
        font-size: 0.9rem;
        margin-bottom: 30px;
    }
    .hub-controls {
        gap: 10px;
        margin-bottom: 30px;
    }
    .filter-btn {
        font-size: 0.78rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .hub-intro {
        font-size: 0.85rem;
    }
    .search-wrapper {
        max-width: 100%;
    }
}

/* ---- Reduced-motion: disable image transition entirely ---- */
@media (prefers-reduced-motion: reduce) {
    .card-img-wrap .preview-image {
        transition: none;
    }
}
