/* ============================================================
   GeoHubNG — Knowledge / GeoMysteryNG (knowledge.php)
   Loaded only on the Knowledge page template.
   Depends on design tokens (--ghng-*) defined in main.css, and reuses
   .ghng-insight-eyebrow / .ghng-empty-state from insight.css's sibling
   patterns (defined once in main.css/insight.css, safe to reference here
   since both stylesheets load together only if both pages exist — this
   file does not redeclare them).
   ============================================================ */

.ghng-page-hero--knowledge {
    background: linear-gradient(135deg, var(--ghng-deep) 0%, #1a1420 100%);
}

.ghng-knowledge-page {
    padding: var(--ghng-space-10) 0 var(--ghng-space-20);
}

/* ---- Layout: current mystery + stack side by side, stacked on mobile ---- */
.ghng-gm-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--ghng-space-8);
    align-items: start;
}

/* ---- Current mystery card ---- */
.ghng-gm-card {
    background: var(--ghng-surface);
    border: 1px solid var(--ghng-border);
    border-radius: var(--ghng-radius-lg);
    padding: var(--ghng-space-6);
    position: relative;
}

.ghng-gm-badge {
    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);
    background: rgba(201, 150, 58, 0.1);
    border: 1px solid var(--ghng-gold);
    padding: var(--ghng-space-1) var(--ghng-space-3);
    border-radius: var(--ghng-radius-full);
    margin-bottom: var(--ghng-space-4);
}

.ghng-gm-image-wrap {
    width: 100%;
    border-radius: var(--ghng-radius);
    overflow: hidden;
    margin-bottom: var(--ghng-space-5);
    border: 1px solid var(--ghng-border);
}
.ghng-gm-image { width: 100%; height: auto; display: block; max-height: 520px; object-fit: cover; }

.ghng-gm-question {
    font-family: var(--ghng-font-display);
    font-size: var(--ghng-text-xl);
    color: var(--ghng-white);
    margin: 0 0 var(--ghng-space-1);
}
.ghng-gm-subtext { color: var(--ghng-muted); font-size: var(--ghng-text-sm); margin: 0 0 var(--ghng-space-4); }

.ghng-gm-clues {
    list-style: none;
    margin: 0 0 var(--ghng-space-6);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--ghng-space-3);
}
.ghng-gm-clues li {
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--ghng-gold);
    padding: var(--ghng-space-3) var(--ghng-space-4);
    border-radius: 0 var(--ghng-radius-sm) var(--ghng-radius-sm) 0;
    color: var(--ghng-text-mid);
    font-size: var(--ghng-text-sm);
    line-height: 1.6;
}
.ghng-gm-clues strong { color: var(--ghng-gold); }

/* ---- Guess form ---- */
.ghng-gm-guess {
    border-top: 1px solid var(--ghng-border);
    padding-top: var(--ghng-space-5);
}
.ghng-gm-guess__label {
    display: block;
    font-size: var(--ghng-text-sm);
    font-weight: var(--ghng-weight-semibold);
    color: var(--ghng-text);
    margin-bottom: var(--ghng-space-2);
}
.ghng-gm-guess__row {
    display: flex;
    gap: var(--ghng-space-3);
    flex-wrap: wrap;
}
.ghng-gm-guess__input {
    flex: 1;
    min-width: 200px;
    padding: var(--ghng-space-3) var(--ghng-space-4);
    background: var(--ghng-deep);
    border: 1px solid var(--ghng-border-mid);
    border-radius: var(--ghng-radius);
    color: var(--ghng-white);
    font-family: var(--ghng-font-body);
    font-size: var(--ghng-text-sm);
}
.ghng-gm-guess__input:focus { outline: none; border-color: var(--ghng-gold); }

.ghng-gm-guess__saved p { margin: 0 0 var(--ghng-space-2); color: var(--ghng-text-mid); font-size: var(--ghng-text-sm); }
.ghng-gm-guess__saved strong { color: var(--ghng-gold); }
.ghng-gm-guess__change {
    background: none;
    border: none;
    color: var(--ghng-teal);
    font-size: var(--ghng-text-xs);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-bottom: var(--ghng-space-3);
}
.ghng-gm-guess__hint { font-size: var(--ghng-text-xs); color: var(--ghng-muted); }

/* ---- Stack of solved mysteries ---- */
.ghng-gm-stack__heading {
    font-family: var(--ghng-font-display);
    font-size: var(--ghng-text-base);
    color: var(--ghng-white);
    margin: 0 0 var(--ghng-space-5);
}
.ghng-gm-stack__empty { color: var(--ghng-muted); font-size: var(--ghng-text-sm); }

.ghng-gm-stack__pile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: var(--ghng-space-8);
}
.ghng-gm-thumb {
    position: relative;
    width: 160px;
    height: 120px;
    padding: 0;
    border: none;
    border-radius: var(--ghng-radius-sm);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--ghng-shadow-md);
    margin-top: -78px;
    opacity: 0;
    transform: translateY(16px) rotate(0);
    animation: ghng-gm-thumb-in 0.5s ease forwards;
    animation-delay: calc(var(--stack-index, 0) * 60ms);
    transition: transform 0.25s ease, z-index 0s;
}
.ghng-gm-stack__pile > .ghng-gm-thumb:first-child { margin-top: 0; }
.ghng-gm-thumb:nth-child(odd)  { --tilt: -5deg; }
.ghng-gm-thumb:nth-child(even) { --tilt: 4deg; }
@keyframes ghng-gm-thumb-in {
    to { opacity: 1; transform: translateY(0) rotate(var(--tilt)); }
}
.ghng-gm-thumb { z-index: calc(20 - var(--stack-index, 0)); }
.ghng-gm-thumb:hover, .ghng-gm-thumb:focus-visible {
    transform: translateY(-10px) rotate(0deg) scale(1.06);
    z-index: 30;
    box-shadow: var(--ghng-shadow-glow-gold), var(--ghng-shadow-lg);
}
.ghng-gm-thumb__img { width: 100%; height: 100%; object-fit: cover; display: block; border: 2px solid var(--ghng-border-mid); border-radius: var(--ghng-radius-sm); }
.ghng-gm-thumb__number {
    position: absolute;
    bottom: 4px; left: 4px;
    font-family: var(--ghng-font-mono);
    font-size: 0.625rem;
    font-weight: var(--ghng-weight-semibold);
    color: var(--ghng-white);
    background: rgba(10,22,40,0.75);
    padding: 1px var(--ghng-space-1);
    border-radius: var(--ghng-radius-sm);
}
.ghng-gm-thumb--overflow { display: none; }

/* Expanded view: drop the stack illusion, become a plain readable wrap */
.ghng-gm-stack__pile.is-expanded {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ghng-space-3);
    padding-top: 0;
}
.ghng-gm-stack__pile.is-expanded .ghng-gm-thumb {
    margin-top: 0;
    transform: none !important;
    animation: none;
    opacity: 1;
}
.ghng-gm-stack__pile.is-expanded .ghng-gm-thumb--overflow { display: block; }

.ghng-gm-view-all {
    display: block;
    width: 100%;
    margin-top: var(--ghng-space-5);
    padding: var(--ghng-space-2) var(--ghng-space-4);
    background: transparent;
    border: 1px solid var(--ghng-border-mid);
    border-radius: var(--ghng-radius);
    color: var(--ghng-text-mid);
    font-size: var(--ghng-text-xs);
    cursor: pointer;
    transition: all 0.2s ease;
}
.ghng-gm-view-all:hover { border-color: var(--ghng-gold); color: var(--ghng-gold); }

/* ---- Lightbox (revealed mysteries — full detail) ---- */
.ghng-gm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ghng-gm-lightbox.is-open { display: block; opacity: 1; }
.ghng-gm-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 18, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.ghng-gm-lightbox__close {
    position: fixed;
    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;
}
.ghng-gm-lightbox__close:hover { background: var(--ghng-gold); color: var(--ghng-deep); }

.ghng-gm-lightbox__scroll {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow-y: auto;
    padding: var(--ghng-space-16) var(--ghng-space-4) var(--ghng-space-10);
}
.ghng-gm-lightbox__inner {
    max-width: 720px;
    margin: 0 auto;
    background: var(--ghng-surface);
    border: 1px solid var(--ghng-border);
    border-radius: var(--ghng-radius-lg);
    padding: var(--ghng-space-8);
}
.ghng-gm-lightbox__badge {
    display: inline-block;
    font-family: var(--ghng-font-mono);
    font-size: var(--ghng-text-xs);
    color: var(--ghng-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--ghng-space-4);
}
.ghng-gm-lightbox__image {
    width: 100%;
    border-radius: var(--ghng-radius);
    margin-bottom: var(--ghng-space-5);
    border: 1px solid var(--ghng-border);
}
.ghng-gm-lightbox__guess-result {
    padding: var(--ghng-space-3) var(--ghng-space-4);
    border-radius: var(--ghng-radius);
    margin-bottom: var(--ghng-space-5);
    font-size: var(--ghng-text-sm);
}
.ghng-gm-lightbox__guess-result.is-correct { background: rgba(0,194,168,0.1); border: 1px solid var(--ghng-teal); color: var(--ghng-teal); }
.ghng-gm-lightbox__guess-result.is-incorrect { background: rgba(255,255,255,0.04); border: 1px solid var(--ghng-border-mid); color: var(--ghng-text-mid); }

.ghng-gm-lightbox__answer {
    font-family: var(--ghng-font-display);
    font-size: var(--ghng-text-xl);
    color: var(--ghng-white);
    margin: 0 0 var(--ghng-space-3);
}
.ghng-gm-lightbox__looking-at { color: var(--ghng-text-mid); font-size: var(--ghng-text-sm); line-height: 1.7; margin: 0 0 var(--ghng-space-5); }

.ghng-gm-lightbox__meta {
    display: flex;
    gap: var(--ghng-space-6);
    flex-wrap: wrap;
    padding: var(--ghng-space-3) 0;
    border-top: 1px solid var(--ghng-border);
    border-bottom: 1px solid var(--ghng-border);
    margin-bottom: var(--ghng-space-5);
    font-size: var(--ghng-text-sm);
    color: var(--ghng-muted);
}
.ghng-gm-lightbox__meta strong { color: var(--ghng-text); }

.ghng-gm-lightbox__section { margin-bottom: var(--ghng-space-6); }
.ghng-gm-lightbox__section h4 {
    font-family: var(--ghng-font-mono);
    font-size: var(--ghng-text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ghng-gold);
    margin: 0 0 var(--ghng-space-2);
}
.ghng-gm-lightbox__section p { color: var(--ghng-text-mid); font-size: var(--ghng-text-sm); line-height: 1.7; margin: 0; }

.ghng-gm-lightbox__takeaways {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--ghng-space-4);
}
.ghng-gm-takeaway {
    background: rgba(255,255,255,0.03);
    border-radius: var(--ghng-radius);
    padding: var(--ghng-space-4);
}
.ghng-gm-takeaway__label {
    display: block;
    font-family: var(--ghng-font-mono);
    font-size: 0.6875rem;
    font-weight: var(--ghng-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--ghng-space-2);
}
.ghng-gm-takeaway--beginner .ghng-gm-takeaway__label { color: var(--ghng-teal); }
.ghng-gm-takeaway--practitioner .ghng-gm-takeaway__label { color: var(--ghng-gold); }
.ghng-gm-takeaway--senior .ghng-gm-takeaway__label { color: #C9736A; }
.ghng-gm-takeaway p { margin: 0; font-size: var(--ghng-text-sm); color: var(--ghng-text-mid); line-height: 1.6; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .ghng-gm-layout { grid-template-columns: 1fr; }
    .ghng-gm-stack__pile { flex-direction: row; flex-wrap: wrap; justify-content: center; padding-top: 0; }
    .ghng-gm-stack__pile .ghng-gm-thumb { margin-top: 0; transform: none !important; animation: none; opacity: 1; }
    .ghng-gm-stack__pile .ghng-gm-thumb--overflow { display: none; }
    .ghng-gm-stack__pile.is-expanded .ghng-gm-thumb--overflow { display: block; }
}

@media (max-width: 640px) {
    .ghng-gm-card { padding: var(--ghng-space-4); }
    .ghng-gm-guess__row { flex-direction: column; }
    .ghng-gm-guess__row .ghng-btn { width: 100%; }
    .ghng-gm-lightbox__inner { padding: var(--ghng-space-5); }
    .ghng-gm-lightbox__answer { font-size: var(--ghng-text-lg); }
}
