/* ============================================================
   k8.AI Ghost Theme — screen.css
   Design system: brand/DESIGN_SYSTEM.md
   Philosophy: Calm cyberpunk. Motoko lineage. Citizen Sleeper grammar.
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --bg-root:     #08080f;
  --bg-panel:    #0e0e18;
  --bg-input:    #16161f;
  --border:      #252535;

  --text-muted:  #666680;
  --text-main:   #d8d8e8;
  --text-bright: #f0f0ff;

  --accent:      #f0a500;
  --accent-dim:  rgba(240,165,0,.10);
  --accent2:     #6e4eff;
  --glow:        0 0 12px rgba(240,165,0,.28);
  --glow-strong: 0 0 22px rgba(240,165,0,.45);

  --ok:          #00dc70;
  --warn:        #ffb800;
  --err:         #ff4d4d;

  --font-body:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --measure:     70ch;
  --radius:      3px;
  --transition:  all .15s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  background: var(--bg-root);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--text-bright); }

/* ── Layout ───────────────────────────────────────────────── */
.gh-viewport { display: flex; flex-direction: column; min-height: 100vh; }
.gh-main     { flex: 1; }
.container   { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ── Header — copied verbatim from k8review template ─────── */
/* Source: content/review-ui/index.html <style> block        */

/* k8review CSS variables (mapped to gh- namespace) */
.gh-head {
  --bg:#0d0d0d; --s:#141414; --b:#222; --t:#e0e0e0; --m:#555;
  --a:#f0a500; --ok:#2ecc71; --warn:#f0a500; --err:#e05c2a; --info:#3498db;
  /* k8review header rule (verbatim): */
  border-bottom:1px solid var(--b);
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
}
.gh-head-inner {
  /* k8review header{} rule (verbatim): */
  padding:10px 20px; display:flex; align-items:center; gap:12px;
  /* constrain to content width */
  max-width: 760px; margin: 0 auto; width: 100%;
}

/* Logo — k8review header h1{} (verbatim) */
.gh-head-logo {
  font-size:14px; color:var(--a); letter-spacing:.1em;
  font-family:'JetBrains Mono','Fira Mono',monospace;
  white-space: nowrap; text-decoration: none;
}
.gh-head-logo:hover { color: var(--t); }

/* Nav pills — bigger, clearly visible */
.gh-head-nav { display:flex; align-items:center; gap:6px; margin-left:16px; }
.gh-head-nav a {
  background:#1a1a1a; border:1px solid var(--b); color:var(--t);
  padding:6px 16px; border-radius:2px;
  font-family:'JetBrains Mono','Fira Mono',monospace;
  font-size:11px; font-weight:700; letter-spacing:.08em;
  text-transform:uppercase; transition:all .15s;
  text-decoration: none;
}
.gh-head-nav a:hover { border-color:var(--a); color:var(--a); }
.gh-head-nav a.active { background:var(--a); border-color:var(--a); color:#000; }

/* Subscribe button — filled amber, stands out */
.gh-head-actions { display:flex; align-items:center; gap:10px; margin-left:auto; }
.gh-head-btn {
  display:inline-flex; align-items:center;
  background:var(--a); border:1px solid var(--a); color:#000;
  padding:6px 18px; border-radius:2px;
  font-family:'JetBrains Mono','Fira Mono',monospace;
  font-size:11px; font-weight:700; letter-spacing:.08em;
  text-transform:uppercase; transition:all .15s; text-decoration:none;
}
.gh-head-btn:hover { background:transparent; color:var(--a); border-color:var(--a); }

/* ── Hero (home) ──────────────────────────────────────────── */
.gh-hero {
  padding: 80px 0 64px;
  border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.gh-hero::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 600px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .4;
}
.gh-hero-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 16px;
}
.gh-hero-title {
  font-size: clamp(28px, 4vw, 42px); font-weight: 600; line-height: 1.2;
  color: var(--text-bright); letter-spacing: -.02em; margin-bottom: 16px;
  max-width: 640px;
}
.gh-hero-desc {
  font-size: 16px; color: var(--text-muted); line-height: 1.65;
  max-width: 560px; margin-bottom: 32px;
}
.gh-hero-stats {
  display: flex; gap: 32px; flex-wrap: wrap;
}
.gh-hero-stat { display: flex; flex-direction: column; gap: 4px; }
.gh-hero-stat-val {
  font-family: var(--font-mono); font-size: 20px; font-weight: 500;
  color: var(--text-bright);
}
.gh-hero-stat-key {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  color: var(--text-muted); text-transform: uppercase;
}

/* ── Post Grid ────────────────────────────────────────────── */
.gh-feed { padding: 48px 0 80px; }
.gh-feed-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.gh-feed-header h2 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  color: var(--text-muted); text-transform: uppercase;
}

.gh-postfeed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Featured post — full width first card */
.gh-postfeed .gh-card:first-child {
  grid-column: 1 / -1;
}

/* ── Post Card ────────────────────────────────────────────── */
.gh-card {
  background: var(--bg-panel);
  display: flex; flex-direction: column;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.gh-card:hover { background: var(--bg-input); }
.gh-card:hover .gh-card-title { color: var(--accent); }

.gh-card-link {
  display: flex; flex-direction: column; height: 100%;
  color: inherit; padding: 24px;
}
.gh-card-link:hover { color: inherit; }

/* Featured card has horizontal layout */
.gh-card:first-child .gh-card-link {
  flex-direction: row; gap: 32px; align-items: flex-start;
  padding: 32px;
}

.gh-card-image {
  flex-shrink: 0; overflow: hidden;
  border-radius: 2px; background: var(--bg-input);
}
.gh-card:first-child .gh-card-image {
  width: 320px; height: 220px;
}
.gh-card:not(:first-child) .gh-card-image {
  width: 100%; height: 180px;
  margin-bottom: 20px;
}
.gh-card-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
  filter: saturate(.9) brightness(.92);
}
.gh-card:hover .gh-card-image img {
  transform: scale(1.03);
  filter: saturate(1) brightness(1);
}

.gh-card-meta {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.gh-card-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
}
.gh-card-date {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em;
  color: var(--text-muted);
}
.gh-card-readtime {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-muted);
}
.gh-card-meta-sep { color: var(--border); font-size: 10px; }

.gh-card-body { flex: 1; display: flex; flex-direction: column; }
.gh-card-title {
  font-size: 18px; font-weight: 600; line-height: 1.3;
  color: var(--text-bright); letter-spacing: -.01em;
  margin-bottom: 10px; transition: var(--transition);
}
.gh-card:first-child .gh-card-title { font-size: 24px; }

.gh-card-excerpt {
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
  flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.gh-card:first-child .gh-card-excerpt { -webkit-line-clamp: 4; }

.gh-card-footer {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.gh-card-author {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.gh-card-author-img {
  width: 24px; height: 24px; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--border);
}
.gh-card-read-more {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.gh-card:hover .gh-card-read-more { color: var(--accent); }

/* ── Pagination ───────────────────────────────────────────── */
.gh-pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 32px 0;
}
.gh-pagination a, .gh-pagination span {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-muted); transition: var(--transition);
}
.gh-pagination a:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow); }

/* ── Post Article ─────────────────────────────────────────── */
.gh-article { padding: 0 0 80px; }

.gh-article-header { padding: 56px 0 0; margin-bottom: 48px; }

/* Hero image — centered, content width, full natural height */
.gh-article-image {
  max-width: 760px;
  width: 100%;
  margin: 0 auto 48px;
  display: block;
  padding: 0 24px;
  box-sizing: border-box;
}

.gh-article-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.gh-article-tag {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
  padding: 3px 8px; border: 1px solid rgba(240,165,0,.3); border-radius: 2px;
}
.gh-article-date, .gh-article-readtime {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--text-muted);
}

.gh-article-title {
  font-size: clamp(26px, 4vw, 40px); font-weight: 700; line-height: 1.2;
  letter-spacing: -.025em; color: var(--text-bright); margin-bottom: 20px;
}

.gh-article-excerpt {
  font-size: 18px; color: var(--text-muted); line-height: 1.65;
  max-width: 640px; margin-bottom: 32px;
  border-left: 2px solid var(--accent); padding-left: 16px;
}

.gh-article-byline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.gh-article-author-img {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); overflow: hidden;
}
.gh-article-author-img img { width: 100%; height: 100%; object-fit: cover; }
.gh-article-author-name { font-size: 13px; font-weight: 600; color: var(--text-bright); }
.gh-article-author-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
}

.gh-article-image {
  overflow: hidden;
}
.gh-article-image img {
  width: 100%; height: auto; display: block;
  filter: saturate(.85) brightness(.9);
}

/* ── Post Content ─────────────────────────────────────────── */
.gh-content {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text-main);
}

.gh-content h2 {
  font-size: 22px; font-weight: 600; line-height: 1.3;
  color: var(--text-bright); letter-spacing: -.015em;
  margin: 48px 0 16px; padding-top: 32px;
  border-top: 1px solid var(--border);
}
.gh-content h3 {
  font-size: 18px; font-weight: 600; line-height: 1.35;
  color: var(--text-bright); margin: 32px 0 12px;
}
.gh-content h4 {
  font-size: 15px; font-weight: 600;
  color: var(--text-muted); letter-spacing: .06em;
  text-transform: uppercase; font-family: var(--font-mono);
  margin: 28px 0 10px;
}

.gh-content p { margin-bottom: 24px; }
.gh-content p:last-child { margin-bottom: 0; }

.gh-content strong { color: var(--text-bright); font-weight: 600; }
.gh-content em { color: var(--text-muted); font-style: italic; }

.gh-content a {
  color: var(--accent);
  border-bottom: 1px solid rgba(240,165,0,.25);
  padding-bottom: 1px;
}
.gh-content a:hover { border-bottom-color: var(--accent); color: var(--text-bright); }

.gh-content ul, .gh-content ol {
  margin: 0 0 24px; padding-left: 24px;
}
.gh-content li { margin-bottom: 8px; }
.gh-content ul li::marker { color: var(--accent); }

.gh-content blockquote {
  margin: 32px 0; padding: 20px 24px;
  border-left: 3px solid var(--accent);
  background: var(--bg-panel); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 17px; font-style: italic; color: var(--text-bright);
}
.gh-content blockquote p { margin: 0; }

.gh-content code {
  font-family: var(--font-mono); font-size: 13.5px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 2px; padding: 2px 6px; color: var(--accent);
}
.gh-content pre {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  overflow-x: auto; margin: 0 0 28px;
  position: relative;
}
.gh-content pre::before {
  content: '> ';
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); position: absolute; top: 8px; left: 12px;
  letter-spacing: .06em; text-transform: uppercase;
}
.gh-content pre code {
  background: none; border: none; padding: 0;
  font-size: 13px; color: var(--text-main);
}

.gh-content hr {
  border: none; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 40px 0;
}

.gh-content img {
  border-radius: var(--radius); border: 1px solid var(--border);
  margin: 8px 0 24px;
}

/* Callout / kg-card */
.kg-callout-card {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 0 0 28px;
}
.kg-callout-emoji { font-size: 20px; line-height: 1; }
.kg-callout-text { font-size: 15px; color: var(--text-main); }

/* ── Tags Bar (post) ──────────────────────────────────────── */
.gh-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 40px 0 0; }
.gh-tag {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--transition);
}
.gh-tag:hover { color: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }

/* ── Author Card ──────────────────────────────────────────── */
.gh-author-card {
  margin-top: 56px; padding: 32px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-panel);
  display: flex; gap: 24px; align-items: flex-start;
}
.gh-author-card-image {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--border); overflow: hidden;
}
.gh-author-card-image img { width: 100%; height: 100%; object-fit: cover; }
.gh-author-card-title {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.gh-author-card-name {
  font-size: 18px; font-weight: 600; color: var(--text-bright); margin-bottom: 8px;
}
.gh-author-card-bio { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ── Related Posts ────────────────────────────────────────── */
.gh-related { padding: 56px 0; border-top: 1px solid var(--border); }
.gh-related-title {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 24px;
}
.gh-related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}

/* ── Tag / Author Archive ─────────────────────────────────── */
.gh-archive-header {
  padding: 56px 0 40px; border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.gh-archive-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.gh-archive-title {
  font-size: clamp(24px, 3vw, 36px); font-weight: 700;
  color: var(--text-bright); letter-spacing: -.02em; margin-bottom: 12px;
}
.gh-archive-desc { font-size: 15px; color: var(--text-muted); max-width: 520px; }

/* ── 404 ──────────────────────────────────────────────────── */
.gh-404 {
  padding: 120px 0; text-align: center;
}
.gh-404-code {
  font-family: var(--font-mono); font-size: 80px; font-weight: 700;
  color: var(--border); letter-spacing: -.04em; margin-bottom: 16px;
  line-height: 1;
}
.gh-404-title { font-size: 22px; color: var(--text-bright); margin-bottom: 16px; }
.gh-404-desc  { font-size: 15px; color: var(--text-muted); margin-bottom: 32px; }

/* ── Footer ───────────────────────────────────────────────── */
.gh-foot {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  background: var(--bg-panel);
}
.gh-foot-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.gh-foot-brand {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: var(--text-muted);
}
.gh-foot-brand span { color: var(--accent); }
.gh-foot-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.gh-foot-nav a {
  font-size: 12px; color: var(--text-muted); padding: 4px 10px;
  border-radius: var(--radius); transition: var(--transition);
}
.gh-foot-nav a:hover { color: var(--text-main); }
.gh-foot-copy {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  color: var(--text-muted); white-space: nowrap;
}

/* Scanline overlay — subtle grain texture */
.gh-viewport::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.03) 2px,
    rgba(0,0,0,.03) 4px
  );
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .gh-head-nav { display: none; }
  .gh-postfeed { grid-template-columns: 1fr; }
  .gh-card:first-child .gh-card-link { flex-direction: column; }
  .gh-card:first-child .gh-card-image { width: 100%; }
  .gh-author-card { flex-direction: column; }
  .gh-foot-inner { flex-direction: column; align-items: flex-start; }
  .gh-hero { padding: 48px 0 40px; }
  .gh-content { font-size: 16px; }
}

@media (max-width: 480px) {
  .container, .container--narrow { padding: 0 16px; }
  .gh-article-title { font-size: 24px; }
  .gh-content pre { padding: 16px; }
}

/* ── Koenig Editor — Required classes ────────────────────── */
.kg-width-wide {
  margin-left: calc(50% - 50vw + 24px);
  margin-right: calc(50% - 50vw + 24px);
  max-width: 1100px;
}
.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
}
.kg-image-card img { width: 100%; border-radius: var(--radius); }
.kg-gallery-container { display: flex; flex-direction: column; gap: 8px; margin: 0 0 28px; }
.kg-gallery-row { display: flex; gap: 8px; }
.kg-gallery-image { flex: 1; overflow: hidden; border-radius: var(--radius); }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kg-bookmark-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 0 0 28px; }
.kg-bookmark-container { display: flex; }
.kg-bookmark-content { padding: 16px; flex: 1; }
.kg-bookmark-title { font-size: 14px; font-weight: 600; color: var(--text-bright); margin-bottom: 6px; }
.kg-bookmark-description { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.kg-bookmark-thumbnail { width: 160px; flex-shrink: 0; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.kg-video-card video { width: 100%; border-radius: var(--radius); }
.kg-toggle-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 0 28px; }
.kg-toggle-heading-text { font-weight: 600; color: var(--text-bright); cursor: pointer; }
.kg-toggle-content { margin-top: 12px; }
.kg-button-card { text-align: center; margin: 0 0 28px; }
.kg-button-card a {
  display: inline-flex; align-items: center;
  padding: 10px 24px; border: 1px solid var(--accent); border-radius: var(--radius);
  color: var(--accent); font-weight: 500; font-size: 14px; letter-spacing: .04em;
  transition: var(--transition);
}
.kg-button-card a:hover { background: var(--accent-dim); box-shadow: var(--glow); }
