/* 8bit-terminal — dark 8-bit lofi retro, restrained hacker feel.
   Effects (glow, scanlines, stripes) live on the chrome.
   The article body stays clean for long reading. */

/* ---------- Fonts (self-hosted) ---------- */
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/press-start-2p-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-600-italic.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --accent: #5fe3b0;
  --stripe-1: #e0a93b;   /* amber */
  --stripe-2: #3fb8c9;   /* cyan */
  --stripe-3: #5fe3b0;   /* mint */

  --font-display: "Press Start 2P", "JetBrains Mono", monospace;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 14px;
  --wrap: 1120px;
  --wrap-narrow: 720px;
}

html[data-mode="dark"], html:not([data-mode]) {
  --bg: #0f1a18;
  --bg-elev: #15231f;
  --bg-code: #0a1210;
  --border: #25403a;
  --text: #d9e8e2;
  --text-dim: #8fa89f;
  --heading: #f1faf6;
  --link: var(--accent);
  --glow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
  --badge-bg: #f4faf7;
  --badge-fg: #1f6f58;
}
html[data-mode="light"] {
  --bg: #eef4f0;
  --bg-elev: #ffffff;
  --bg-code: #e3ece7;
  --border: #bcd0c7;
  --text: #1d2b27;
  --text-dim: #51675f;
  --heading: #0d1a16;
  --link: #14705a;
  --glow: none;
  --badge-bg: #15231f;
  --badge-fg: #5fe3b0;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--gh-font-body, var(--font-body));
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-shadow: var(--glow); }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #0a1210; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: var(--wrap-narrow); margin: 0 auto; padding: 0 1.25rem; }
.site-main { min-height: 60vh; padding-bottom: 4rem; }

/* ---------- Stripe motif ---------- */
.stripes { display: flex; flex-direction: column; gap: 0; width: 100%; }
.stripes i { display: block; height: 4px; }
.stripes i:nth-child(1) { background: var(--stripe-1); }
.stripes i:nth-child(2) { background: var(--stripe-2); }
.stripes i:nth-child(3) { background: var(--stripe-3); }
.stripes-thin i { height: 2px; }
.no-stripes .stripes { display: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { text-decoration: none; display: inline-flex; align-items: center; }
.brand:hover { text-shadow: none; }
.brand-logo { height: 34px; width: auto; }
.brand-badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-fg);
  border-radius: 10px;
  padding: .55rem .8rem;
  box-shadow: 0 0 0 2px var(--accent), var(--glow);
  position: relative;
}
.brand-badge::before {            /* stacked offset stripes behind the badge */
  content: ""; position: absolute; inset: 4px auto 4px -9px; width: 9px;
  background: linear-gradient(90deg, var(--stripe-1) 0 33%, var(--stripe-2) 33% 66%, var(--stripe-3) 66%);
  border-radius: 3px 0 0 3px;
}
.no-stripes .brand-badge::before { display: none; }
.brand-text { font-family: var(--font-display); font-size: .7rem; letter-spacing: .02em; text-transform: uppercase; }

.nav { flex: 1; }
.nav ul { list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a {
  font-family: var(--font-mono); font-size: .85rem; color: var(--text-dim);
  text-decoration: none; text-transform: lowercase;
}
.nav a::before { content: "/"; color: var(--accent); margin-right: .15rem; }
.nav a:hover, .nav .nav-current a { color: var(--heading); text-shadow: var(--glow); }

.header-actions { display: flex; gap: .5rem; align-items: center; }

/* ---------- Buttons / chips ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono); font-size: .85rem; font-weight: 700;
  color: var(--heading); background: transparent;
  border: 2px solid var(--border); border-radius: 10px;
  padding: .5rem .9rem; text-decoration: none; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); box-shadow: var(--glow); text-shadow: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }
.btn-solid { background: var(--accent); color: #0a1210; border-color: var(--accent); }
.btn-solid:hover { color: #0a1210; }

.mode-toggle {
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 2px solid var(--border); display: grid; place-items: center;
}
.mode-toggle:hover { border-color: var(--accent); box-shadow: var(--glow); }
.mode-icon { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: inset -4px -2px 0 0 var(--bg); }
html[data-mode="light"] .mode-icon { box-shadow: none; }

.chip {
  display: inline-block;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #0a1210; background: var(--accent);
  border-radius: 6px; padding: .15rem .5rem; text-decoration: none;
}
.chip:hover { text-shadow: none; filter: brightness(1.1); }
.chip-hot { background: var(--stripe-1); color: #0a1210; }

/* ---------- Hero (scanlines live here) ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 5rem 0 4rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 65%),
    var(--bg);
}
.hero-small { padding: 3rem 0 2.5rem; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  opacity: .6;
}
html[data-mode="light"] .hero::after { opacity: .12; }
.no-scanlines .hero::after { display: none; }
.hero > .wrap { position: relative; z-index: 1; }
.hero-kicker { font-family: var(--font-mono); color: var(--accent); font-size: .9rem; margin: 0 0 1rem; }
.hero-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.1rem, 3.2vw, 2rem); line-height: 1.6;
  color: var(--heading); margin: 0; max-width: 24ch;
  text-shadow: var(--glow);
}
.hero-sub { color: var(--text-dim); max-width: 60ch; margin: 1.25rem 0 0; font-size: 1.1rem; }

/* ---------- Section label ---------- */
.section-label {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--font-display); font-weight: 400; font-size: .7rem; text-transform: uppercase;
  color: var(--text-dim); margin: 3rem 0 1.5rem;
}
.section-label::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, var(--stripe-1) 0 20%, var(--stripe-2) 20% 40%, var(--stripe-3) 40% 60%, var(--border) 60%); }
.no-stripes .section-label::after { background: var(--border); }
.section-label span::before { content: "> "; color: var(--accent); }

/* ---------- Card grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.card {
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--glow); transform: translateY(-2px); }
.card-image img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 2px solid var(--border); image-rendering: auto; }
.card-body { padding: 1.1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); }
.card-title { font-family: var(--gh-font-heading, var(--font-mono)); font-weight: 700; font-size: 1.15rem; line-height: 1.35; margin: 0; }
.card-title a { color: var(--heading); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 0; color: var(--text-dim); font-size: .95rem; flex: 1; }
.card-more { font-family: var(--font-mono); font-size: .8rem; text-decoration: none; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 3rem; }
.page-num { font-family: var(--font-display); font-size: .6rem; color: var(--text-dim); }

/* ---------- Article (clean: no scanlines, no body glow) ---------- */
.article-header { padding-top: 3.5rem; }
.article-title {
  font-family: var(--gh-font-heading, var(--font-mono)); font-weight: 700;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem); line-height: 1.2;
  color: var(--heading); margin: 1rem 0 0;
}
.article-lede { font-size: 1.25rem; color: var(--text-dim); margin: 1rem 0 0; }
.byline { margin-top: 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.byline-author { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-mono); font-size: .85rem; color: var(--text-dim); text-decoration: none; }
.byline-author img { width: 32px; height: 32px; border-radius: 8px; border: 2px solid var(--accent); }
.article-image { margin: 2rem auto 0; }
.article-image img {
  width: 100%; height: auto; max-height: 300px; object-fit: contain;
  background: var(--bg-elev);
  border-radius: var(--radius); border: 2px solid var(--border);
}
.article-image figcaption { text-align: center; font-size: .85rem; color: var(--text-dim); margin-top: .6rem; }

.gh-content { padding-top: 2.5rem; font-size: 1.1rem; line-height: 1.75; }
.gh-content > * + * { margin-top: 1.4em; }
.gh-content h2, .gh-content h3, .gh-content h4 {
  font-family: var(--gh-font-heading, var(--font-mono)); font-weight: 700; color: var(--heading); line-height: 1.3; margin-top: 2.2em;
}
.gh-content h2 { font-size: 1.6rem; }
.gh-content h2::before { content: "## "; color: var(--accent); }
.gh-content h3 { font-size: 1.25rem; }
.gh-content h3::before { content: "### "; color: var(--accent); }
.gh-content h4 { font-size: 1.05rem; }
.gh-content a { text-decoration: underline; }
.gh-content ul, .gh-content ol { padding-left: 1.5rem; }
.gh-content li + li { margin-top: .4em; }
.gh-content ul li::marker { color: var(--accent); }
.gh-content hr { border: 0; height: 4px; background: linear-gradient(90deg, var(--stripe-1) 0 33%, var(--stripe-2) 33% 66%, var(--stripe-3) 66%); border-radius: 2px; margin: 3rem 0; }
.no-stripes .gh-content hr { background: var(--border); height: 2px; }
.gh-content blockquote {
  margin-left: 0; margin-right: 0; padding: .25rem 0 .25rem 1.25rem;
  border-left: 4px solid var(--accent); color: var(--text-dim); font-style: italic;
}
.gh-content img, .gh-content video { border-radius: 10px; }
.gh-content figure { margin: 2rem 0; }
.gh-content figcaption { text-align: center; font-size: .85rem; color: var(--text-dim); margin-top: .6rem; }

/* inline + block code */
.gh-content code, .gh-content kbd {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 5px; padding: .12em .4em;
}
.gh-content pre {
  position: relative;
  font-family: var(--font-mono); font-size: .88rem; line-height: 1.6;
  background: var(--bg-code); border: 2px solid var(--border); border-radius: 10px;
  padding: 1.1rem 1.25rem; overflow-x: auto;
}
.gh-content pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  font-family: var(--font-mono); font-size: .7rem; color: var(--text-dim);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px;
  padding: .15rem .5rem; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.gh-content pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

.gh-content table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.gh-content th, .gh-content td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.gh-content th { background: var(--bg-elev); font-family: var(--font-mono); color: var(--heading); }

.article-footer { padding-top: 2.5rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.article-comments { padding-top: 3rem; }

/* ---------- Koenig editor cards (required by Ghost) ---------- */
.kg-width-wide { width: min(1000px, 100vw - 2.5rem); margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full img, .kg-width-wide img { width: 100%; }
.kg-image-card img { margin: 0 auto; }
.kg-gallery-container { display: flex; flex-direction: column; gap: .75rem; }
.kg-gallery-row { display: flex; gap: .75rem; }
.kg-gallery-image { flex: 1 1 0; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-bookmark-card { width: 100%; }
.kg-bookmark-container {
  display: flex; text-decoration: none; color: inherit;
  background: var(--bg-elev); border: 2px solid var(--border); border-radius: 12px; overflow: hidden;
}
.kg-bookmark-container:hover { border-color: var(--accent); box-shadow: var(--glow); text-shadow: none; }
.kg-bookmark-content { flex: 1; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.kg-bookmark-title { font-family: var(--font-mono); font-weight: 700; color: var(--heading); }
.kg-bookmark-description { font-size: .9rem; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--text-dim); margin-top: auto; }
.kg-bookmark-icon { width: 18px; height: 18px; border-radius: 3px; display: inline; }
.kg-bookmark-thumbnail { flex: 0 0 28%; position: relative; }
.kg-bookmark-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.kg-callout-card {
  display: flex; gap: .75rem; padding: 1.1rem 1.25rem;
  background: var(--bg-elev); border: 2px solid var(--border); border-left: 6px solid var(--stripe-2); border-radius: 10px;
}
.kg-callout-emoji { font-size: 1.25rem; line-height: 1.5; }
.kg-callout-text { flex: 1; }
.kg-toggle-card { background: var(--bg-elev); border: 2px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem; }
.kg-toggle-heading { display: flex; justify-content: space-between; cursor: pointer; }
.kg-toggle-heading-text { font-family: var(--font-mono); font-weight: 700; margin: 0; }
.kg-toggle-content { display: none; }
.kg-toggle-card[data-kg-toggle-state="open"] .kg-toggle-content { display: block; }
.kg-toggle-card-icon { background: none; border: 0; color: var(--accent); cursor: pointer; }
.kg-button-card { display: flex; justify-content: center; }
.kg-btn { display: inline-block; font-family: var(--font-mono); font-weight: 700; background: var(--accent); color: #0a1210; padding: .6rem 1.1rem; border-radius: 10px; text-decoration: none; }
.kg-btn:hover { text-shadow: none; filter: brightness(1.1); }
.kg-product-card, .kg-audio-card, .kg-file-card, .kg-header-card, .kg-signup-card { background: var(--bg-elev); border: 2px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.kg-video-card video { width: 100%; }

/* ---------- Subscribe block ---------- */
.subscribe {
  margin-top: 4rem; padding-top: 2rem; padding-bottom: 2rem; text-align: center;
  background: var(--bg-elev); border: 2px solid var(--border); border-radius: var(--radius);
  max-width: calc(var(--wrap-narrow) - 2.5rem);
}
.subscribe h2 { font-family: var(--font-display); font-weight: 400; font-size: .9rem; color: var(--heading); margin: 0 0 1rem; text-shadow: var(--glow); }
.subscribe p { color: var(--text-dim); margin: 0 0 1.25rem; }

.related { padding-top: 1rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; }
.footer-inner { padding-top: 2rem; padding-bottom: 2.5rem; display: grid; gap: .75rem; font-family: var(--font-mono); font-size: .85rem; color: var(--text-dim); }
.footer-line { margin: 0; color: var(--text); }
.prompt { color: var(--accent); }
.cursor { display: inline-block; width: .6em; height: 1.05em; background: var(--accent); margin-left: .35rem; vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.footer-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-nav ul { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; }
.footer-nav a { color: var(--text-dim); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }
.footer-copy { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: .75rem; }
  .nav { order: 3; flex-basis: 100%; }
  .grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0 2.5rem; }
  .kg-bookmark-container { flex-direction: column-reverse; }
  .kg-bookmark-thumbnail { flex-basis: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .card, .btn { transition: none; }
}
