/* ═══════════════════════════════════════════════════════════
   PAGE-GALLERY.CSS
   Page-specific additions for works.php / certificates.php.
   Only NEW classes live here — .filter-bar, .filter-btn,
   .work-group-header, .work-grid, .work-card, .scroll-group and
   the .cat-* colour classes stay in components.css and are reused
   as-is. Nothing in this file redefines them.
   ═══════════════════════════════════════════════════════════ */

/* ── Empty-category placeholder ──────────────────────────────
   Rendered instead of .work-grid for a category that exists in
   the `categories` table but has no rows in `works` yet. */
.work-empty {
    border: 1px dashed var(--color-gray-200);
    border-radius: 0.75rem;
    background: var(--color-gray-50, #fafafa);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Never let long item strings push the page sideways at 360px */
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (min-width: 768px) {
    .work-empty { padding: 1.25rem 1.5rem; }
}

.work-empty-lead {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--color-gray-700);
    margin: 0;
    line-height: 1.5;
}

.work-empty-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.work-empty-item {
    position: relative;
    padding-left: 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--color-gray-500);
}

.work-empty-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background: currentColor;
    opacity: 0.5;
}

/* The [TODO: …] reminder is intentionally visible for the site owner. */
.work-empty-todo {
    align-self: flex-start;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--color-amber-txt, #b45309);
    background: var(--color-amber-bg, #fffbeb);
    border: 1px solid var(--color-amber-bdr, #fde68a);
    border-radius: 9999px;
    padding: 0.25rem 0.625rem;
    margin: 0;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* ── Filter bar safety at very narrow widths ─────────────────
   .filter-bar already wraps; these are scoped guards so 11 tabs
   can never cause a horizontal scrollbar on a 360px screen. */
#filter-bar { padding-left: 0.25rem; padding-right: 0.25rem; }
#filter-bar > .filter-btn { max-width: 100%; white-space: nowrap; }

@media (max-width: 400px) {
    #filter-bar > .filter-btn {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ══════════════ CERTIFICATES — image previews ══════════════
   Each card shows an upright render of the certificate (page 1),
   contained (never cropped or tilted) on a soft paper backdrop. */
.cert-grid:has(.cert-card--img) { gap: 1rem; }
@media (min-width: 1024px) { .cert-grid:has(.cert-card--img) { grid-template-columns: repeat(4, 1fr); } }
.cert-card--img { padding: 0 0 0.9rem; justify-content: flex-start; }
.cert-thumb {
    position: relative; display: block; width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(180deg, #f4f2ee, #ebe8e2);
    border-bottom: 1px solid var(--color-gray-100);
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.cert-thumb img {
    position: absolute; inset: 0.65rem; width: calc(100% - 1.3rem); height: calc(100% - 1.3rem);
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.14));
    transition: transform 0.5s cubic-bezier(0.22,1,0.36,1);
}
.cert-card--img:hover .cert-thumb img { transform: scale(1.04); }
.cert-thumb-zoom {
    position: absolute; right: 0.5rem; bottom: 0.5rem;
    width: 2rem; height: 2rem; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(17,24,39,0.78); color: #fff;
    opacity: 0; transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.cert-card--img:hover .cert-thumb-zoom { opacity: 1; transform: none; }
@media (hover: none) { .cert-thumb-zoom { opacity: 1; transform: none; } }
.cert-card--img .cert-card-title,
.cert-card--img .cert-card-issuer,
.cert-card--img .cert-card-date { padding-inline: 0.75rem; }
.cert-card--img .cert-card-title { font-size: 0.8rem; }
.cert-card--img .cert-external-icon { display: none; }

/* Full-size upright view inside the existing overlay */
.pdf-overlay { z-index: 1000; padding: 4.25rem 1rem 1.5rem; }
.cert-view { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; max-width: 94vw; }
.cert-view[hidden] { display: none; }
.cert-view img {
    max-width: min(94vw, 1100px); max-height: calc(100vh - 8.5rem); width: auto; height: auto;
    object-fit: contain; border-radius: 0.5rem; background: #fff;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.cert-view figcaption { color: rgba(255,255,255,0.85); font-size: 0.85rem; font-weight: 600; text-align: center; padding: 0 1rem; }
