/* ============================================================
   rgn.ltd — Ghost Theme
   Scheme C: Slate
   Fragment Mono + Libre Baskerville + Barlow Condensed
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fragment+Mono&family=Libre+Baskerville:wght@400;700&family=Barlow+Condensed:wght@400;600;700&display=swap');

/* ── VARIABLES ── */
:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --border:    #1e2632;
  --border2:   #2c3a4e;
  --amber:     #d4891a;
  --amber-hi:  #f0a830;
  --amber-lo:  #6a4410;
  --text:      #eef2f8;
  --text-mid:  #c8d0dc;
  --text-dim:  #5a6878;
  --badge-bg:  #1a2235;
  --badge-fg:  #98b4d4;
  --badge-bdr: #2c3a4e;
  --mono:      'Fragment Mono', monospace;
  --serif:     'Libre Baskerville', Georgia, serif;
  --cond:      'Barlow Condensed', sans-serif;
  --max-width: 700px;
  --pad:       32px;
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── LAYOUT ── */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ── HEADER ── */
.site-header {
  padding: 44px 0 28px;
  border-bottom: 1px solid var(--border2);
  position: relative;
  /* scanlines */
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--amber) 0%, var(--amber-lo) 35%, transparent 70%);
}

.site-header-inner {
  position: relative;
  z-index: 1;
}

.site-title-wrap {
  display: flex;
  align-items: center;
}
.site-title-prompt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber-lo);
  margin-right: 7px;
  user-select: none;
}
.site-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--amber-hi);
  letter-spacing: 0.02em;
}
.site-title a { color: var(--amber-hi); }
.site-title a:hover { color: var(--amber-hi); }

.site-title-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--amber-hi);
  margin-left: 4px;
  vertical-align: baseline;
  position: relative;
  bottom: -1px;
  animation: blink 1s step-end infinite;
}
.site-title-cursor.stopped {
  animation: none;
  opacity: 0;
}

@keyframes blink { 50% { opacity: 0; } }

.site-tagline {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 0.03em;
}

.site-nav {
  display: flex;
  gap: 4px;
  list-style: none;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.site-nav li { margin-right: 2px; }
.site-nav a {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.site-nav a::before { content: '['; color: var(--border2); }
.site-nav a::after  { content: ']'; color: var(--border2); }
.site-nav a:hover { color: var(--amber); }

/* ── SECTION DIVIDERS ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 0;
}
.section-divider span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── POST LIST (index) ── */
.post-feed {
  padding-bottom: 64px;
}

/* ── ESSAY / ORIGINAL POST ── */
.post-card-essay {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.post-card-flag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--badge-fg);
  background: var(--badge-bg);
  border: 1px solid var(--badge-bdr);
  padding: 2px 8px;
  display: inline-block;
  margin-bottom: 13px;
}

.post-card-title {
  font-family: var(--cond);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  font-style: normal;
  color: var(--text);
  margin-bottom: 12px;
}
.post-card-title a {
  color: var(--text);
  transition: color 0.15s;
}
.post-card-title a:hover { color: var(--amber-hi); }

.post-card-excerpt {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-mid);
}
.post-card-excerpt strong { color: var(--text); font-weight: 700; }

.post-card-meta {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  color: var(--border2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.post-card-meta::before {
  content: '';
  display: inline-block;
  width: 18px; height: 1px;
  background: var(--border2);
}

/* ── LINK POST ── */
.post-card-link {
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}

.post-card-source {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--amber);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.post-card-source::before { content: '//'; color: var(--border2); }

.post-card-link .post-card-title {
  font-size: 20px;
}
.post-card-link .post-card-title .ext-arrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber-lo);
  margin-left: 5px;
  transition: color 0.15s;
}
.post-card-link .post-card-title a:hover .ext-arrow { color: var(--amber-hi); }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
}
.pagination a,
.pagination span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.pagination a:hover { color: var(--amber); }
.pagination .page-number { color: var(--border2); }

/* ── SINGLE POST ── */
.post-header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--border);
}
.post-header .post-card-flag { margin-bottom: 16px; }

.post-full-title {
  font-family: var(--cond);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  font-style: normal;
  color: var(--text);
  margin-bottom: 16px;
}

.post-full-meta {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 12px;
}
.post-full-meta::before {
  content: '';
  display: inline-block;
  width: 18px; height: 1px;
  background: var(--border2);
}

/* ── POST CONTENT ── */
.post-content {
  padding: 36px 0 64px;
  font-size: 15.5px;
  line-height: 1.82;
  color: var(--text-mid);
}

.post-content p { margin-bottom: 1.4em; }
.post-content p:last-child { margin-bottom: 0; }

.post-content strong { color: var(--text); font-weight: 700; }
.post-content em { font-style: italic; }

.post-content h2 {
  font-family: var(--cond);
  font-size: 22px;
  font-weight: 700;
  font-style: normal;
  color: var(--text);
  margin: 2em 0 0.6em;
  letter-spacing: 0.01em;
}
.post-content h3 {
  font-family: var(--cond);
  font-size: 17px;
  font-weight: 600;
  font-style: normal;
  color: var(--text);
  margin: 1.8em 0 0.5em;
  letter-spacing: 0.02em;
}

.post-content a {
  color: var(--amber-hi);
  text-decoration: underline;
  text-decoration-color: var(--amber-lo);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.post-content a:hover {
  color: var(--amber-hi);
  text-decoration-color: var(--amber-hi);
}

.post-content blockquote {
  border-left: 2px solid var(--amber-lo);
  margin: 1.6em 0;
  padding: 0 0 0 20px;
  color: var(--text-dim);
  font-style: italic;
}

.post-content code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--amber-hi);
}

.post-content pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 20px;
  overflow-x: auto;
  margin: 1.6em 0;
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

.post-content ul,
.post-content ol {
  margin: 1em 0 1.4em 1.4em;
}
.post-content li { margin-bottom: 0.4em; }

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

/* link post external URL on single page */
.post-external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--amber);
  border: 1px solid var(--amber-lo);
  padding: 4px 12px;
  margin-bottom: 28px;
  transition: all 0.15s;
}
.post-external-link:hover {
  color: var(--amber-hi);
  border-color: var(--amber);
}

/* ── POST NAV (prev/next) ── */
.post-nav {
  display: flex;
  justify-content: space-between;
  padding: 28px 0 48px;
  border-top: 1px solid var(--border);
  gap: 20px;
}
.post-nav-item {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  max-width: 48%;
}
.post-nav-item a { color: var(--text-dim); transition: color 0.15s; }
.post-nav-item a:hover { color: var(--amber); }
.post-nav-label {
  display: block;
  color: var(--border2);
  margin-bottom: 4px;
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.post-nav-title {
  font-family: var(--cond);
  font-size: 14px;
  font-weight: 600;
  font-style: normal;
  color: var(--text-dim);
  line-height: 1.3;
}

/* ── TAG / AUTHOR PAGES ── */
.taxonomy-header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--border2);
}
.taxonomy-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.taxonomy-title {
  font-family: var(--cond);
  font-size: 28px;
  font-weight: 700;
  font-style: normal;
  color: var(--text);
}

/* ── 404 ── */
.error-page {
  padding: 80px 0;
  text-align: center;
}
.error-code {
  font-family: var(--mono);
  font-size: 64px;
  color: var(--border2);
  display: block;
  margin-bottom: 16px;
}
.error-message {
  font-family: var(--cond);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.error-link {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--amber);
}
.error-link:hover { color: var(--amber-hi); }

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 48px;
}
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer-copy {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--border2);
  letter-spacing: 0.06em;
}
.site-footer-links {
  display: flex;
  gap: 16px;
  list-style: none;
}
.site-footer-links a {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--border2);
  letter-spacing: 0.06em;
  transition: color 0.15s;
}
.site-footer-links a:hover { color: var(--amber); }

/* ── KOENIG CARD WIDTHS (required by Ghost validator) ── */
.kg-width-wide {
  position: relative;
  width: 85vw;
  min-width: 100%;
  margin: 1.6em auto;
}
.kg-width-full {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

/* Koenig image cards */
.kg-image-card { margin: 1.6em 0; }
.kg-image-card img { width: 100%; height: auto; }
.kg-image-card figcaption {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.04em;
}

/* Koenig gallery */
.kg-gallery-container { margin: 1.6em 0; }
.kg-gallery-row { display: flex; gap: 8px; margin-bottom: 8px; }
.kg-gallery-image { flex: 1; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }

/* Koenig embed / bookmark */
.kg-bookmark-card {
  border: 1px solid var(--border2);
  margin: 1.6em 0;
}
.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: var(--text);
  padding: 16px;
  gap: 16px;
}
.kg-bookmark-content { flex: 1; min-width: 0; }
.kg-bookmark-title {
  font-family: var(--cond);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.kg-bookmark-description {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kg-bookmark-metadata {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-thumbnail { width: 120px; flex-shrink: 0; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* Koenig callout */
.kg-callout-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-left: 2px solid var(--amber-lo);
  background: var(--bg2);
  margin: 1.6em 0;
}
.kg-callout-emoji { font-size: 18px; flex-shrink: 0; }
.kg-callout-text { font-size: 14.5px; line-height: 1.7; color: var(--text-mid); }

/* Koenig toggle */
.kg-toggle-card {
  border: 1px solid var(--border2);
  margin: 1.6em 0;
}
.kg-toggle-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
}
.kg-toggle-heading-text {
  font-family: var(--cond);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.kg-toggle-content {
  padding: 0 16px 14px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-mid);
}

/* Koenig divider */
.kg-divider { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  :root { --pad: 20px; }
  .post-full-title { font-size: 24px; }
  .post-card-title { font-size: 19px; }
  .post-content { font-size: 15px; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; }
}
