/* ===========================================================================
   GhostNode by Raven — "Terminal Ghost" theme
   Neon-on-black CRT terminal. Self-contained: no external fonts, no CDN.
   =========================================================================== */

:root {
    --bg:        #050807;
    --bg-soft:   #0a1210;
    --panel:     #0c1613;
    --border:    #123027;
    --fg:        #c9ffe9;
    --fg-dim:    #5f8c7d;
    --green:     #00ff9c;
    --cyan:      #38f0ff;
    --magenta:   #ff5edb;
    --amber:     #ffcf4d;
    --red:       #ff3b5c;
    --glow:      0 0 6px rgba(0, 255, 156, .55);
    --mono: ui-monospace, "SF Mono", "SFMono-Regular", "Cascadia Code",
            "JetBrains Mono", "Fira Code", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 50% -10%, #0c2019 0%, transparent 60%),
        var(--bg);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.65;
    letter-spacing: .2px;
    overflow-x: hidden;
    animation: flicker 6s infinite steps(60);
}

/* Subtle CRT brightness flicker. */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    97%      { opacity: 1; }
    97.5%    { opacity: .82; }
    98%      { opacity: 1; }
    99.2%    { opacity: .9; }
}

/* Scanlines + vignette overlay, above everything, ignores clicks. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 0px,
            rgba(0, 0, 0, 0) 2px,
            rgba(0, 0, 0, .28) 3px,
            rgba(0, 0, 0, 0) 4px
        ),
        radial-gradient(120% 120% at 50% 50%, transparent 62%, rgba(0, 0, 0, .55) 100%);
    mix-blend-mode: multiply;
}

/* Faint moving noise for a "signal" feel. */
body::after {
    content: "";
    position: fixed;
    inset: -50%;
    pointer-events: none;
    z-index: 9998;
    opacity: .035;
    background-image: radial-gradient(rgba(255, 255, 255, .8) 1px, transparent 1px);
    background-size: 3px 3px;
    animation: drift 8s linear infinite;
}
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(-3px, -3px); } }

::selection { background: var(--green); color: #001b12; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--green); text-shadow: var(--glow); }

/* ---- layout --------------------------------------------------------------- */

.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.pad-top { padding-top: 28px; }

/* ---- top bar -------------------------------------------------------------- */

.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(5, 8, 7, .82);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 700; letter-spacing: 1px;
    color: var(--green); text-shadow: var(--glow);
}
.brand-logo {
    width: 26px; height: 26px; border-radius: 7px;
    box-shadow: 0 0 8px rgba(0, 255, 156, .5);
    image-rendering: auto;
}
.brand small { color: var(--fg-dim); font-weight: 400; letter-spacing: .5px; }
.topbar nav { display: flex; gap: 16px; font-size: 13px; }
.topbar nav a { color: var(--fg-dim); }
.topbar nav a:hover { color: var(--green); }

/* ---- terminal window frame ------------------------------------------------ */

.term {
    margin: 22px 0;
    background: linear-gradient(180deg, var(--panel), var(--bg-soft));
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(0, 255, 156, .05), 0 20px 60px rgba(0, 0, 0, .5);
    overflow: hidden;
}
.term-head {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: #0a1512;
    border-bottom: 1px solid var(--border);
    color: var(--fg-dim); font-size: 12px;
}
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.r { background: #ff5f56; } .dot.y { background: #ffbd2e; } .dot.g { background: #27c93f; }
.term-title { margin-left: 8px; }
.term-body { padding: 18px; }

.prompt { color: var(--fg-dim); }
.prompt b { color: var(--green); font-weight: 700; }

/* blinking cursor */
.cursor { display: inline-block; width: 9px; height: 1.05em; vertical-align: text-bottom;
    background: var(--green); box-shadow: var(--glow); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- hero / ghost --------------------------------------------------------- */

.hero { text-align: center; padding: 40px 10px 10px; }
.ghost-ascii {
    color: var(--green); text-shadow: var(--glow);
    /* fsociety art: block (not inline-block) so it stacks above the title instead of
       sitting beside it; text-align centers the short logo/footer lines under the skull */
    font-size: 1.5px; line-height: 1; white-space: pre; display: block;
    text-align: center; max-width: 100%; overflow-x: auto;
    animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.glitch {
    position: relative; display: inline-block;
    font-size: clamp(34px, 7vw, 64px); font-weight: 800; letter-spacing: 3px;
    color: var(--fg); margin: 14px 0 4px;
}
.glitch::before, .glitch::after {
    content: attr(data-text); position: absolute; inset: 0;
    clip-path: inset(0 0 0 0);
}
.glitch::before { left: 2px; text-shadow: -2px 0 var(--magenta); animation: glitch1 2.5s infinite linear alternate-reverse; }
.glitch::after  { left: -2px; text-shadow: -2px 0 var(--cyan);   animation: glitch2 3.1s infinite linear alternate-reverse; }
@keyframes glitch1 {
    0% { clip-path: inset(10% 0 82% 0); } 20% { clip-path: inset(40% 0 40% 0); }
    40% { clip-path: inset(70% 0 12% 0); } 60% { clip-path: inset(20% 0 60% 0); }
    80% { clip-path: inset(88% 0 2% 0); } 100% { clip-path: inset(50% 0 30% 0); }
}
@keyframes glitch2 {
    0% { clip-path: inset(80% 0 5% 0); } 25% { clip-path: inset(15% 0 65% 0); }
    50% { clip-path: inset(55% 0 25% 0); } 75% { clip-path: inset(35% 0 45% 0); }
    100% { clip-path: inset(8% 0 78% 0); }
}
.tagline { color: var(--fg-dim); font-size: 14px; letter-spacing: 1px; }

/* ---- category tabs -------------------------------------------------------- */

.cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 8px; }
.cat {
    cursor: pointer; user-select: none;
    padding: 5px 12px; font-size: 13px;
    color: var(--fg-dim); background: transparent;
    border: 1px solid var(--border); border-radius: 999px;
    transition: all .15s ease;
}
.cat::before { content: "> "; color: var(--fg-dim); }
.cat:hover { color: var(--green); border-color: var(--green); }
.cat.active { color: #04140e; background: var(--green); border-color: var(--green);
    box-shadow: var(--glow); font-weight: 700; }
.cat.active::before { color: #04140e; }

/* ---- post list ------------------------------------------------------------ */

.feed { display: grid; gap: 14px; margin: 18px 0 60px; }
.card {
    display: block;
    border: 1px solid var(--border); border-radius: 8px;
    background: linear-gradient(180deg, var(--panel), var(--bg-soft));
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--green);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 255, 156, .2); }
.card-cover { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block;
    border-bottom: 1px solid var(--border); filter: saturate(1.05) contrast(1.03); }
.card-body { padding: 14px 16px; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 12px; color: var(--fg-dim); margin-bottom: 6px; }
.badge { color: var(--cyan); border: 1px solid var(--border); border-radius: 4px;
    padding: 1px 7px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.badge.draft { color: var(--amber); border-color: var(--amber); }
.card h2 { margin: 4px 0 6px; font-size: 20px; color: var(--fg); letter-spacing: .3px; }
.card:hover h2 { color: var(--green); text-shadow: var(--glow); }
.card p { margin: 0; color: var(--fg-dim); font-size: 14px; }
.tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--fg-dim); }
.tag::before { content: "#"; color: var(--green); }

/* ---- single post ---------------------------------------------------------- */

.article { margin: 26px 0 70px; }
.article .cover { width: 100%; border-radius: 8px; border: 1px solid var(--border);
    margin: 14px 0 22px; display: block; }
.article h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.15; margin: 6px 0 10px;
    color: var(--green); text-shadow: var(--glow); letter-spacing: .5px; }
.article .meta { color: var(--fg-dim); font-size: 13px; margin-bottom: 8px; }

/* rendered markdown */
.md { font-size: 16px; line-height: 1.8; color: var(--fg); }
.md h1, .md h2, .md h3 { color: var(--cyan); margin: 1.6em 0 .5em; line-height: 1.25; }
.md h2 { border-bottom: 1px dashed var(--border); padding-bottom: .25em; }
.md a { border-bottom: 1px dotted currentColor; }
.md p { margin: 0 0 1.1em; }
.md img { max-width: 100%; border-radius: 6px; border: 1px solid var(--border); }
.md blockquote { margin: 1.2em 0; padding: .4em 1em; border-left: 3px solid var(--green);
    background: rgba(0, 255, 156, .05); color: var(--fg-dim); }
.md code { background: #06110d; border: 1px solid var(--border); border-radius: 4px;
    padding: .1em .4em; font-size: .92em; color: var(--amber); }
.md pre { background: #06110d; border: 1px solid var(--border); border-radius: 8px;
    padding: 14px 16px; overflow-x: auto; }
.md pre code { border: 0; padding: 0; background: none; color: var(--fg); }
.md ul, .md ol { padding-left: 1.4em; }
.md hr { border: 0; border-top: 1px dashed var(--border); margin: 2em 0; }
.md table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }

/* ---- forms / buttons ------------------------------------------------------ */

label { display: block; font-size: 12px; color: var(--fg-dim); margin: 14px 0 5px;
    text-transform: uppercase; letter-spacing: 1px; }
label::before { content: "› "; color: var(--green); }

input, textarea, select {
    width: 100%; padding: 10px 12px;
    background: #06110d; color: var(--fg);
    border: 1px solid var(--border); border-radius: 6px;
    font-family: var(--mono); font-size: 14px; outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: var(--glow); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
select { appearance: none; cursor: pointer; }

.btn {
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; font-family: var(--mono); font-size: 14px; font-weight: 700;
    color: #04140e; background: var(--green); border: 1px solid var(--green);
    border-radius: 6px; box-shadow: var(--glow);
    transition: transform .1s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--green); box-shadow: none; }
.btn.ghost:hover { background: rgba(0, 255, 156, .08); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); box-shadow: none; }
.btn.danger:hover { background: rgba(255, 59, 92, .1); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 160px; }
.row.tight > * { flex: 0 0 auto; }

/* checkbox pill */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 13px; color: var(--fg-dim); }
.switch input { width: auto; }

/* ---- toast / status ------------------------------------------------------- */

.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
    background: var(--panel); border: 1px solid var(--green); color: var(--green);
    padding: 10px 18px; border-radius: 6px; box-shadow: var(--glow);
    opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 200; font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red); color: var(--red); box-shadow: 0 0 6px rgba(255,59,92,.5); }

.empty { text-align: center; color: var(--fg-dim); padding: 40px 0; }
.empty .ghost-ascii { font-size: 12px; opacity: .7; animation: none; }

.loading::after { content: "▓▒░"; animation: load 1s steps(3) infinite; color: var(--green); }
@keyframes load { to { content: "░▒▓"; } }

/* ---- admin dashboard ------------------------------------------------------ */

.admin-list { display: grid; gap: 8px; margin: 14px 0; }
.admin-row {
    display: flex; align-items: center; gap: 12px; justify-content: space-between;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-soft);
}
.admin-row .title { color: var(--fg); font-weight: 700; }
.admin-row .sub { color: var(--fg-dim); font-size: 12px; }
.admin-row .actions { display: flex; gap: 8px; }
.admin-row .actions .btn { padding: 5px 10px; font-size: 12px; }

.preview-cover { max-width: 220px; border: 1px solid var(--border); border-radius: 6px;
    margin-top: 8px; display: none; }

.footer { text-align: center; color: var(--fg-dim); font-size: 12px;
    padding: 30px 0 40px; border-top: 1px solid var(--border); margin-top: 40px; }

/* reduce motion for folks who ask for it */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; }
    html { scroll-behavior: auto; }
}

@media (max-width: 560px) {
    body { font-size: 14px; }
    .term-body { padding: 14px; }
    .topbar nav { gap: 10px; }
}
