/* =================================================================
   Noob Incremental Guide - public reader
   The navbar comes from the shared styles.css; this file styles the
   guide landing (topic buttons), the detail view, search and cards.
   ================================================================= */
:root {
    --bg: #050b14;
    --bg-deep: #03070d;
    --bg-raised: #0a1622;
    --blue-lightest: #c9edfb;
    --blue-light: #a8e0f5;
    --blue: #5ec6e3;
    --blue-mid: #2f8fb8;
    --blue-deep: #1b5a7d;
    --gold: #f0c850;
    --line: rgba(94, 198, 227, 0.16);
    --line-strong: rgba(94, 198, 227, 0.32);
    --text: #eaf4fa;
    --text-dim: #9ab8ce;
    --text-faint: #5a7a92;
    --glass-bg: rgba(8, 22, 38, 0.55);
    --glass-bg-2: rgba(13, 35, 56, 0.6);
    --glass-blur: blur(18px);
    --glow-sm: 0 0 24px rgba(94, 198, 227, 0.25);
    --gradient-text: linear-gradient(180deg, var(--blue-lightest) 0%, var(--blue) 45%, var(--blue-deep) 100%);
    --gradient-cta: linear-gradient(135deg, var(--blue-light), var(--blue-mid));
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius: 14px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --container: 1160px;
}

/* Author display rules (grid/flex) below would otherwise override the UA
   [hidden] rule; keep hidden elements hidden regardless. */
[hidden] { display: none !important; }

/* Readable text selection on the dark theme: solid highlight + DARK text.
   -webkit-text-fill-color forces gradient-clipped headings (title/logo) to show
   dark text on selection instead of going transparent. */
::selection { background: #5ec6e3 !important; color: #04121d !important; -webkit-text-fill-color: #04121d !important; }
::-moz-selection { background: #5ec6e3 !important; color: #04121d !important; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 70px; /* clear the fixed navbar from styles.css */
    -webkit-font-smoothing: antialiased;
}

/* Match the main-site navbar exactly: the shared .nav-logo uses var(--font-display),
   which this file overrides to Space Grotesk - pin it back to Orbitron like index.html. */
.nav-logo { font-family: 'Orbitron', sans-serif; }

/* Keep page content above the particle-field background (#particles-js, z-index 0). */
.g-header, .g-main, .g-footer { position: relative; z-index: 1; }

.g-ambient {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(60% 50% at 15% 0%, rgba(94, 198, 227, 0.10), transparent 70%),
        radial-gradient(50% 50% at 100% 10%, rgba(27, 90, 125, 0.18), transparent 70%),
        var(--bg-deep);
}

/* ---------- Header ---------- */
.g-header { max-width: var(--container); margin: 0 auto; padding: 40px 24px 18px; }
.g-header-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.g-eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--blue); font-weight: 600; }
.g-title { font-family: var(--font-display); font-weight: 700; line-height: 1.05; font-size: clamp(2rem, 4.5vw, 3rem); margin-top: 8px; color: var(--text); }
.g-title span { background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.g-subtitle { color: var(--text-dim); margin-top: 10px; max-width: 560px; }

/* Live presence badge */
.g-presence {
    display: inline-flex; align-items: center; gap: 9px;
    background: var(--glass-bg); border: 1px solid var(--line); backdrop-filter: var(--glass-blur);
    padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; color: var(--text-dim); white-space: nowrap;
}
.g-presence-dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); animation: g-pulse 2s infinite; }
@keyframes g-pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); } 70% { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.g-presence-count { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.g-presence-helpers { display: inline-flex; gap: 4px; margin-left: 4px; }
.g-presence-helpers .g-avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.7rem; font-weight: 700; color: #04121d; background: var(--gradient-cta); border: 1.5px solid var(--bg); margin-left: -8px; }

/* Search */
.g-searchbar { max-width: var(--container); margin: 22px auto 0; position: relative; display: flex; align-items: center; }
.g-searchbar i.fa-search { position: absolute; left: 18px; color: var(--text-faint); }
.g-searchbar input {
    width: 100%; background: var(--glass-bg); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 44px; color: var(--text); font-family: var(--font-body); font-size: 1rem; transition: border-color 0.25s var(--ease);
}
.g-searchbar input:focus { outline: none; border-color: var(--line-strong); box-shadow: var(--glow-sm); }
.g-search-clear { position: absolute; right: 14px; background: none; border: 0; color: var(--text-faint); font-size: 1.5rem; cursor: pointer; line-height: 1; }

/* ---------- Main ---------- */
.g-main { max-width: var(--container); margin: 28px auto 0; padding: 0 24px 80px; min-height: 50vh; }
.g-loading, .g-empty { color: var(--text-dim); padding: 60px 20px; text-align: center; }
.g-empty i { font-size: 2rem; color: var(--text-faint); display: block; margin-bottom: 14px; }

/* ---------- Landing: panels of topic buttons ---------- */
.g-landing { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 22px; align-items: start; }
.g-panel {
    background: var(--glass-bg); border: 1px solid var(--line); border-radius: 16px;
    padding: 22px 22px 24px; backdrop-filter: var(--glass-blur);
    position: relative; overflow: hidden;
}
/* subtle accent glow along the top of each panel */
.g-panel::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent, var(--blue)), transparent); opacity: 0.7;
}
.g-panel-head { text-align: center; margin-bottom: 18px; }
.g-panel-title { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; display: inline-flex; align-items: center; gap: 10px; color: var(--accent, var(--blue)); }
.g-panel-icon { display: inline-flex; }
.g-panel-icon .g-svg-icon { width: 24px; height: 24px; }
.g-svg-icon { width: 1em; height: 1em; vertical-align: -0.125em; }
.g-panel-sub { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 7px; }

.g-btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-topic-btn {
    display: block; text-align: center; padding: 12px 10px;
    border: 1px solid color-mix(in srgb, var(--accent, var(--blue)) 55%, transparent);
    border-radius: 9px; background: color-mix(in srgb, var(--accent, var(--blue)) 8%, transparent);
    color: var(--accent, var(--blue-light)); font-family: var(--font-body); font-weight: 600; font-size: 0.92rem;
    cursor: pointer; line-height: 1.3;
    transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.g-topic-btn:hover {
    background: var(--accent, var(--blue)); color: #04121d; border-color: var(--accent, var(--blue));
    box-shadow: 0 0 16px color-mix(in srgb, var(--accent, var(--blue)) 45%, transparent); transform: translateY(-2px);
}
@media (max-width: 460px) { .g-btn-grid { grid-template-columns: 1fr; } }

/* ---------- Detail view ---------- */
.g-back {
    display: inline-flex; align-items: center; gap: 8px; background: var(--glass-bg); border: 1px solid var(--line);
    color: var(--text-dim); padding: 9px 16px; border-radius: 10px; cursor: pointer; font-family: var(--font-body);
    font-size: 0.9rem; margin-bottom: 22px; transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.g-back:hover { color: var(--text); border-color: var(--line-strong); }

.g-section-head { margin-bottom: 20px; }
.g-section-cat { color: var(--blue); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.g-section-title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin-top: 4px; }

/* ---------- Rendered rich page (EditorJS blocks) ---------- */
.g-page {
    background: var(--glass-bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 30px 34px; backdrop-filter: var(--glass-blur); color: var(--text); font-size: 1rem; line-height: 1.7;
}
.g-page > *:first-child { margin-top: 0; }
.g-page > *:last-child { margin-bottom: 0; }
.g-page h1, .g-page h2, .g-page h3, .g-page h4 { font-family: var(--font-display); line-height: 1.25; margin: 26px 0 12px; color: var(--blue-lightest); }
.g-page h1 { font-size: 1.6rem; } .g-page h2 { font-size: 1.32rem; } .g-page h3 { font-size: 1.12rem; } .g-page h4 { font-size: 1rem; }
.g-page p { margin: 0 0 14px; }
.g-page ul, .g-page ol { margin: 0 0 14px; padding-left: 24px; }
.g-page li { margin-bottom: 6px; }
.g-page a { color: var(--blue); text-decoration: underline; }
.g-page mark { background: rgba(240, 200, 80, 0.28); color: #ffe9a8; border-radius: 3px; padding: 0 3px; }
.g-page code { background: rgba(0,0,0,0.35); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: 0.88em; font-family: 'JetBrains Mono', monospace; }
.g-page pre { background: rgba(0,0,0,0.4); border: 1px solid var(--line); padding: 16px 18px; border-radius: 10px; overflow-x: auto; margin: 0 0 16px; }
.g-page pre code { background: none; border: 0; padding: 0; }
.g-page blockquote { border-left: 3px solid var(--blue); margin: 0 0 16px; padding: 6px 0 6px 18px; color: var(--text-dim); font-style: italic; }
.g-page blockquote cite { display: block; margin-top: 6px; font-size: 0.85rem; color: var(--text-faint); font-style: normal; }
.g-page hr.g-delim { border: 0; text-align: center; margin: 26px 0; }
.g-page hr.g-delim::before { content: '* * *'; color: var(--text-faint); letter-spacing: 0.4em; }

/* Tables */
.g-table-wrap { overflow-x: auto; margin: 0 0 16px; border-radius: 10px; border: 1px solid var(--line); }
.g-page table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.g-page th, .g-page td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.g-page th { background: var(--glass-bg-2); color: var(--blue-lightest); font-weight: 600; }
.g-page tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }

/* Inline images placed anywhere in the page */
.g-page figure.g-fig { margin: 0 0 18px; }
.g-page figure.g-fig img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }
.g-page figure.g-fig-wide img { width: 100%; }
/* image tunes from the editor - border hugs the image, background stays on-theme */
.g-page figure.g-fig-border img { border: 2px solid var(--line-strong); }
.g-page figure.g-fig-bg { width: -moz-fit-content; width: fit-content; max-width: 100%; background: rgba(94,198,227,0.10); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 auto 18px; }
.g-page figure.g-fig-bg img { border-radius: 8px; }
.g-page figcaption { margin-top: 8px; font-size: 0.82rem; color: var(--text-faint); text-align: center; }

/* Custom "image + text beside it" block (mirrors the editor's .git-block layout) */
/* FLOAT layout (mirrors css/guide-edit.css): the image floats to its chosen side and
   the text flows right up beside it (wrapping under it when longer). git-side-* = float
   side, git-gap-* = the real gap between image and text, git-align-* = text alignment.
   The block stays FULL WIDTH (do NOT use width:fit-content here - with a floated image
   whose width is capped by a percentage, fit-content resolves the % against the shrunk
   block and collapses the image to a fraction of its size). */
.g-page .git-block { margin: 0 0 18px; }
.g-page .git-block::after { content: ''; display: block; clear: both; }
.g-page .git-block .git-img { float: left; max-width: 45%; margin: 3px 20px 10px 0; }
.g-page .git-block.git-side-right .git-img { float: right; margin-right: 0; margin-left: 20px; }
.g-page .git-size-s .git-img { width: 160px; } .g-page .git-size-m .git-img { width: 250px; } .g-page .git-size-l .git-img { width: 360px; }
.g-page .git-block .git-img img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.g-page .git-block.git-gap-tight .git-img { margin-right: 8px; }
.g-page .git-block.git-gap-loose .git-img { margin-right: 40px; }
.g-page .git-block.git-side-right.git-gap-tight .git-img { margin-right: 0; margin-left: 8px; }
.g-page .git-block.git-side-right.git-gap-loose .git-img { margin-right: 0; margin-left: 40px; }
.g-page .git-block .git-text { min-width: 0; line-height: 1.7; }
.g-page .git-block.git-align-left .git-text { text-align: left; }
.g-page .git-block.git-align-center .git-text { text-align: center; }
.g-page .git-block.git-align-right .git-text { text-align: right; }
.g-page .git-block .git-text > :first-child { margin-top: 0; }
@media (max-width: 640px) { .g-page .git-block .git-img, .g-page .git-block.git-side-right .git-img, .g-page .git-size-s .git-img, .g-page .git-size-m .git-img, .g-page .git-size-l .git-img { float: none; width: 100%; max-width: 100%; margin: 0 0 12px 0; } }

/* Resized standalone image (helper's per-image size tune). Constrain + centre. */
.g-page figure.g-fig.g-img-s img { max-width: 240px; margin: 0 auto; }
.g-page figure.g-fig.g-img-m img { max-width: 440px; margin: 0 auto; }
.g-page figure.g-fig.g-img-l img { max-width: 680px; margin: 0 auto; }

/* Multi-image gallery block (mirrors the editor's .git-gallery grid). */
.g-page .git-gallery { display: grid; gap: 20px; align-items: start; margin: 0 0 18px; }
.g-page .git-gallery.git-cols-2 { grid-template-columns: repeat(2, 1fr); }
.g-page .git-gallery.git-cols-3 { grid-template-columns: repeat(3, 1fr); }
.g-page .git-gallery.git-cols-4 { grid-template-columns: repeat(4, 1fr); }
.g-page .git-gallery.git-gap-tight { gap: 8px; }
.g-page .git-gallery.git-gap-normal { gap: 20px; }
.g-page .git-gallery.git-gap-loose { gap: 44px; }
.g-page .git-gallery .gg-item img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
@media (max-width: 640px) { .g-page .git-gallery.git-cols-3, .g-page .git-gallery.git-cols-4 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Search results ---------- */
.g-result { display: block; background: var(--glass-bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 12px; cursor: pointer; transition: border-color 0.25s var(--ease); }
.g-result:hover { border-color: var(--line-strong); }
.g-result-crumb { font-size: 0.76rem; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; }
.g-result-title { font-family: var(--font-display); font-weight: 600; margin: 3px 0; }
.g-result-snippet { font-size: 0.88rem; color: var(--text-dim); }
.g-result mark { background: rgba(240, 200, 80, 0.25); color: var(--gold); border-radius: 3px; padding: 0 2px; }

/* ---------- Credits (helper team) ---------- */
.g-credits-wrap { margin-top: 50px; padding-top: 38px; border-top: 1px solid var(--line); }
.g-credits-head { text-align: center; margin-bottom: 26px; }
.g-credits-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; }
.g-credits-head p { color: var(--text-dim); font-size: 0.9rem; margin-top: 6px; }
.g-credits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); gap: 14px; }
.g-credit {
    display: flex; align-items: center; gap: 14px; background: var(--glass-bg); border: 1px solid var(--line);
    border-radius: 14px; padding: 14px 16px; backdrop-filter: var(--glass-blur);
    transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.g-credit:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.g-credit-avatar {
    width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: #061018;
    background: linear-gradient(135deg, hsl(var(--h, 200) 75% 64%), hsl(calc(var(--h, 200) + 28) 70% 48%));
    box-shadow: 0 0 16px hsla(var(--h, 200), 70%, 55%, 0.25);
}
.g-credit-info { min-width: 0; }
.g-credit-name { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.g-credit-roles { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.g-role { font-size: 0.68rem; color: var(--text-dim); background: var(--glass-bg-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.g-role.lead { color: var(--blue-lightest); border-color: var(--line-strong); }

/* ---------- Footer ---------- */
.g-footer { border-top: 1px solid var(--line); padding: 30px 24px; text-align: center; color: var(--text-faint); font-size: 0.88rem; }
.g-footer a { color: var(--blue); }
.g-footer-meta { margin-top: 6px; font-size: 0.8rem; }

/* ---------- Lightbox ---------- */
.g-lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(2, 6, 12, 0.92); display: grid; place-items: center; padding: 30px; backdrop-filter: blur(6px); }
.g-lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; border: 1px solid var(--line-strong); }
.g-lightbox-close { position: absolute; top: 20px; right: 28px; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .g-header { padding-top: 28px; }
    .g-header-inner { align-items: flex-start; }
    .g-btn-grid { grid-template-columns: 1fr; }
}
