/* ============================================================
   GeoHubNG — Insight Gallery (insight.php)
   Loaded only on the Insight Gallery page template.
   Depends on design tokens (--ghng-*) defined in main.css.
   ============================================================ */

/* ---- Hero ---- */
.ghng-page-hero--insight {
    background: linear-gradient(135deg, var(--ghng-deep) 0%, #241708 100%);
}

.ghng-insight-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--ghng-space-2);
    font-family: var(--ghng-font-mono);
    font-size: var(--ghng-text-xs);
    font-weight: var(--ghng-weight-semibold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ghng-gold);
    margin-bottom: var(--ghng-space-4);
}
.ghng-insight-eyebrow::before {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--ghng-gold);
}

.ghng-insight-disclaimer {
    font-family: var(--ghng-font-body);
    font-size: var(--ghng-text-sm);
    font-weight: var(--ghng-weight-bold);
    color: var(--ghng-gold);
    max-width: 600px;
    margin: var(--ghng-space-3) 0 0;
}
.ghng-insight-disclaimer--muted {
    font-weight: var(--ghng-weight-normal);
    font-size: var(--ghng-text-xs);
    color: var(--ghng-muted);
    margin-top: var(--ghng-space-1);
}

/* ---- Page layout ---- */
.ghng-insight-page {
    padding: var(--ghng-space-10) 0 var(--ghng-space-20);
}

/* ---- Filters ---- */
.ghng-insight-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ghng-space-2);
    margin-bottom: var(--ghng-space-8);
    padding-bottom: var(--ghng-space-6);
    border-bottom: 1px solid var(--ghng-border);
}

.ghng-insight-filter {
    display: inline-flex;
    align-items: center;
    gap: var(--ghng-space-2);
    padding: var(--ghng-space-2) var(--ghng-space-4);
    border-radius: var(--ghng-radius-full);
    border: 1px solid var(--ghng-border-mid);
    background: transparent;
    color: var(--ghng-text-mid);
    font-family: var(--ghng-font-body);
    font-size: var(--ghng-text-sm);
    font-weight: var(--ghng-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.ghng-insight-filter:hover {
    border-color: var(--ghng-gold);
    color: var(--ghng-white);
}
.ghng-insight-filter.is-active {
    background: var(--ghng-gold-glow);
    border-color: var(--ghng-gold);
    color: var(--ghng-gold);
}
.ghng-insight-filter__count {
    font-family: var(--ghng-font-mono);
    font-size: var(--ghng-text-xs);
    opacity: 0.7;
}

/* ---- Grid ---- */
.ghng-insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--ghng-space-6);
}

.ghng-insight-card {
    margin: 0;
    position: relative;
    opacity: 0;
    transform: translateY(16px);
    animation: ghng-insight-reveal 0.6s ease forwards;
    animation-delay: var(--ghng-reveal-delay, 0ms);
}

.ghng-insight-card--featured .ghng-insight-card__trigger {
    border-color: var(--ghng-gold);
}

.ghng-insight-card__ribbon {
    position: absolute;
    top: var(--ghng-space-3);
    left: var(--ghng-space-3);
    z-index: 2;
    font-family: var(--ghng-font-mono);
    font-size: 0.6875rem;
    font-weight: var(--ghng-weight-semibold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ghng-deep);
    background: var(--ghng-gold);
    padding: 3px var(--ghng-space-2);
    border-radius: var(--ghng-radius-sm);
    box-shadow: var(--ghng-shadow-md);
    pointer-events: none;
}
@keyframes ghng-insight-reveal {
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .ghng-insight-card { animation: none; opacity: 1; transform: none; }
}

.ghng-insight-card.is-filtered-out { display: none; }

.ghng-insight-card__trigger {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 1px solid var(--ghng-border);
    border-radius: var(--ghng-radius-lg);
    overflow: hidden;
    background: var(--ghng-surface);
    cursor: zoom-in;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.ghng-insight-card__trigger:hover,
.ghng-insight-card__trigger:focus-visible {
    border-color: var(--ghng-gold);
    box-shadow: var(--ghng-shadow-glow-gold), var(--ghng-shadow-lg);
    transform: translateY(-4px);
}

.ghng-insight-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.ghng-insight-card__trigger:hover .ghng-insight-card__img { transform: scale(1.08); }

.ghng-insight-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10,22,40,0.92) 0%, rgba(10,22,40,0.35) 45%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ghng-insight-card__trigger:hover .ghng-insight-card__overlay,
.ghng-insight-card__trigger:focus-visible .ghng-insight-card__overlay { opacity: 1; }

.ghng-insight-card__zoom {
    width: 48px;
    height: 48px;
    border-radius: var(--ghng-radius-full);
    background: rgba(233, 197, 116, 0.15);
    border: 1px solid var(--ghng-gold);
    color: var(--ghng-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.8);
    transition: transform 0.25s ease;
}
.ghng-insight-card__trigger:hover .ghng-insight-card__zoom { transform: scale(1); }

.ghng-insight-card__caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: var(--ghng-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--ghng-space-1);
    text-align: left;
    pointer-events: none;
}
.ghng-insight-card__tag {
    align-self: flex-start;
    font-family: var(--ghng-font-mono);
    font-size: 0.6875rem;
    font-weight: var(--ghng-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ghng-gold);
    background: rgba(10,22,40,0.6);
    padding: 2px var(--ghng-space-2);
    border-radius: var(--ghng-radius-sm);
    margin-bottom: 2px;
}
.ghng-insight-card__title {
    font-family: var(--ghng-font-display);
    font-size: var(--ghng-text-base);
    font-weight: var(--ghng-weight-semibold);
    color: var(--ghng-white);
    line-height: 1.3;
}

.ghng-insight-no-match {
    text-align: center;
    padding: var(--ghng-space-16) 0;
    color: var(--ghng-muted);
}
.ghng-insight-no-match p { margin: 0; font-size: var(--ghng-text-base); }

/* ---- Lightbox ---- */
.ghng-insight-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ghng-insight-lightbox.is-open {
    display: flex;
    flex-direction: column;
    opacity: 1;
}
.ghng-insight-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 18, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ghng-insight-lightbox__close {
    position: absolute;
    top: var(--ghng-space-5);
    right: var(--ghng-space-5);
    z-index: 3;
    width: 40px;
    height: 40px;
    border-radius: var(--ghng-radius-full);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--ghng-border-mid);
    color: var(--ghng-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.ghng-insight-lightbox__close:hover { background: var(--ghng-gold); color: var(--ghng-deep); }

.ghng-insight-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 48px;
    height: 48px;
    border-radius: var(--ghng-radius-full);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--ghng-border-mid);
    color: var(--ghng-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.ghng-insight-lightbox__nav:hover { background: var(--ghng-gold); color: var(--ghng-deep); }
.ghng-insight-lightbox__nav--prev { left: var(--ghng-space-5); }
.ghng-insight-lightbox__nav--next { right: var(--ghng-space-5); }
.ghng-insight-lightbox__nav:disabled { opacity: 0.25; cursor: default; }
.ghng-insight-lightbox__nav:disabled:hover { background: rgba(255,255,255,0.06); color: var(--ghng-text); }

.ghng-insight-lightbox__stage {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: var(--ghng-space-16) var(--ghng-space-20);
    touch-action: none;
    cursor: grab;
}
.ghng-insight-lightbox__stage.is-panning { cursor: grabbing; }

.ghng-insight-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: var(--ghng-shadow-lg);
    border-radius: var(--ghng-radius-sm);
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.15s ease-out;
}
.ghng-insight-lightbox__stage.is-panning .ghng-insight-lightbox__img { transition: none; }

.ghng-insight-lightbox__info {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 var(--ghng-space-6) var(--ghng-space-8);
    max-width: 640px;
    margin: 0 auto;
}
.ghng-insight-lightbox__category {
    display: inline-block;
    font-family: var(--ghng-font-mono);
    font-size: var(--ghng-text-xs);
    font-weight: var(--ghng-weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ghng-gold);
    margin-bottom: var(--ghng-space-2);
}
.ghng-insight-lightbox__title {
    font-family: var(--ghng-font-display);
    font-size: var(--ghng-text-2xl);
    color: var(--ghng-white);
    margin: 0 0 var(--ghng-space-2);
}
.ghng-insight-lightbox__caption {
    font-size: var(--ghng-text-sm);
    color: var(--ghng-text-mid);
    margin: 0 0 var(--ghng-space-2);
}
.ghng-insight-lightbox__credit {
    font-size: var(--ghng-text-xs);
    font-style: italic;
    color: var(--ghng-muted);
    margin: 0 0 var(--ghng-space-4);
}
.ghng-insight-lightbox__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ghng-space-4);
    flex-wrap: wrap;
}
.ghng-insight-lightbox__hint {
    font-size: var(--ghng-text-xs);
    color: var(--ghng-muted);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .ghng-insight-lightbox__stage { padding: var(--ghng-space-8) var(--ghng-space-4); }
    .ghng-insight-lightbox__nav { width: 40px; height: 40px; }
    .ghng-insight-lightbox__nav--prev { left: var(--ghng-space-2); }
    .ghng-insight-lightbox__nav--next { right: var(--ghng-space-2); }
}

@media (max-width: 640px) {
    .ghng-insight-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--ghng-space-3); }
    .ghng-insight-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--ghng-space-4); -webkit-overflow-scrolling: touch; }
    .ghng-insight-filters::-webkit-scrollbar { display: none; }
    .ghng-insight-lightbox__info { padding: 0 var(--ghng-space-4) var(--ghng-space-6); }
    .ghng-insight-lightbox__title { font-size: var(--ghng-text-xl); }
    .ghng-insight-lightbox__actions { flex-direction: column; gap: var(--ghng-space-2); }
}
