/* ============================================================
   bare-nerve — style.css
   ============================================================ */

/* --- Custom properties ------------------------------------ */

:root {
  --bg:         #f5f0e8;
  --text:       #2a2a2a;
  --text-muted: #8a8578;
  --border:     #d5cfc3;
  --code-bg:    #ece7db;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #1c1b18;
    --text:       #d8d3c8;
    --text-muted: #7a756a;
    --border:     #3a3730;
    --code-bg:    #25241f;
  }
}

/* --- Reset ------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

/* --- Base -------------------------------------------------- */

body {
  font-family: 'Courier New', Courier, monospace;
  font-size: 17px;
  line-height: 1.7;
  background-color: var(--bg);
  color: var(--text);
}

/* --- Layout ----------------------------------------------- */

.site-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 24px 60px;
}

/* --- Links ------------------------------------------------- */

a {
  color: var(--text);
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

/* --- Site header ------------------------------------------ */

.site-header {
  margin-bottom: 48px;
}

.site-title {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin: 0;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

/* Logo variant — no uppercase transform, size constrained */
.site-title-logo a {
  text-transform: none;
  letter-spacing: 0;
}

.site-title-logo img {
  display: block;
  max-height: 40px;
  width: auto;
}

/* --- Publication cover image (index only) ----------------- */

.site-cover {
  margin-bottom: 48px;
}

.site-cover img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Post list (index) ------------------------------------ */

.post-list-item + .post-list-item {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-list-title {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

.post-list-title a {
  color: var(--text);
  text-decoration: none;
}

.post-list-date {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* --- Pagination ------------------------------------------- */

/* Hide when there are no prev/next links — just "Page 1 of 1" */
.pagination:not(:has(a)) {
  display: none;
}

.pagination {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 2rem;
}

.pagination a {
  color: var(--text);
}

.pagination .page-number {
  color: var(--text-muted);
}

/* --- Single post ------------------------------------------ */

.post-header {
  margin-bottom: 36px;
}

.post-title {
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.3;
  margin: 0 0 8px;
}

.post-date {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* Feature image — sits between header and content */
.post-feature-image {
  margin-bottom: 40px;
}

.post-feature-image img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Post content ----------------------------------------- */

.post-content p,
.post-content ul,
.post-content ol,
.post-content dl,
.post-content table,
.post-content pre,
.post-content figure {
  margin-top: 0;
  margin-bottom: 1.4em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  letter-spacing: 0.04em;
  line-height: 1.3;
  margin: 2em 0 0.6em;
}

.post-content h1 { font-size: 1.3em; }
.post-content h2 { font-size: 1.15em; }
.post-content h3 { font-size: 1em; }
.post-content h4,
.post-content h5,
.post-content h6 { font-size: 1em; font-style: italic; }

.post-content ul,
.post-content ol {
  padding-left: 1.5em;
}

.post-content li {
  margin-bottom: 0.4em;
}

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

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

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

/* Inline code */
.post-content code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 0.1em 0.3em;
}

/* Code blocks */
.post-content pre {
  background-color: var(--code-bg);
  padding: 1em 1.2em;
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.5;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.4em 0.7em;
  text-align: left;
}

.post-content th {
  font-weight: bold;
}

/* --- Post reactions (likes / comments) -------------------- */

.post-reactions {
  margin-top: 48px;
}

/* --- Ghost card styles ------------------------------------ */

/* Normal width — stays in column, no special rules needed */
.kg-width-normal {}

/* Images */
.kg-image-card {
  margin: 0 0 1.4em;
}

.kg-image-card img,
.kg-image {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Wide — breaks out to 900px centered */
.kg-width-wide {
  max-width: 900px;
  margin-left:   calc(50% - 450px);
  margin-right:  calc(50% - 450px);
  margin-bottom: 1.4em;
}

.kg-width-wide img {
  display: block;
  width: 100%;
  height: auto;
}

/* Full — true viewport width */
.kg-width-full {
  max-width: 100vw;
  margin-left:   calc(50% - 50vw);
  margin-right:  calc(50% - 50vw);
  margin-bottom: 1.4em;
}

.kg-width-full img {
  display: block;
  width: 100%;
  height: auto;
}

/* Image captions */
.kg-image-card figcaption,
.kg-gallery-card figcaption {
  font-size: 0.8em;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5em;
}

/* Gallery */
.kg-gallery-card {
  margin: 0 0 1.4em;
}

.kg-gallery-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kg-gallery-row {
  display: flex;
  gap: 4px;
  width: 100%;
}

.kg-gallery-image {
  flex: 1;
  min-width: 0;
}

.kg-gallery-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bookmark card — simple bordered box */
.kg-bookmark-card {
  margin: 0 0 1.4em;
}

.kg-bookmark-container {
  display: block;
  border: 1px solid var(--border);
  padding: 0.8em 1em;
  color: var(--text);
  text-decoration: none;
}

.kg-bookmark-container:hover {
  border-color: var(--text-muted);
}

.kg-bookmark-thumbnail,
.kg-bookmark-metadata,
.kg-bookmark-description,
.kg-bookmark-icon,
.kg-bookmark-author {
  display: none;
}

.kg-bookmark-content {
  display: block;
}

.kg-bookmark-title {
  display: block;
  text-decoration: underline;
  font-size: 0.9em;
}

.kg-bookmark-publisher {
  display: block;
  color: var(--text-muted);
  font-size: 0.8em;
  margin-top: 2px;
}

/* Embed / video */
.kg-embed-card {
  margin: 0 0 1.4em;
}

.kg-embed-card iframe,
.kg-embed-card video {
  display: block;
  max-width: 100%;
}

/* Audio */
.kg-audio-card {
  margin: 0 0 1.4em;
}

.kg-audio-card audio {
  width: 100%;
}

/* File card */
.kg-file-card {
  margin: 0 0 1.4em;
  font-size: 0.9em;
}

.kg-file-card a {
  color: var(--text);
}

/* Toggle / accordion */
.kg-toggle-card {
  margin: 0 0 1.4em;
}

.kg-toggle-heading-text {
  font-weight: bold;
}

/* Callout */
.kg-callout-card {
  border-left: 2px solid var(--border);
  padding: 0.8em 1em;
  margin: 0 0 1.4em;
  font-size: 0.95em;
}

.kg-callout-emoji {
  margin-right: 0.4em;
}

/* Header card */
.kg-header-card {
  margin: 0 0 1.4em;
}

/* Button card */
.kg-button-card {
  margin: 0 0 1.4em;
}

.kg-btn {
  display: inline-block;
  color: var(--text);
  text-decoration: underline;
  font-family: 'Courier New', Courier, monospace;
}

.kg-btn:hover {
  text-decoration: none;
}

/* --- Site footer ------------------------------------------ */

.site-footer {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* --- Error page ------------------------------------------- */

.error-page {
  padding-top: 40px;
}

.error-code {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 0.5em;
}

.error-message {
  font-size: 1.3em;
  font-weight: bold;
  margin: 0 0 1em;
  line-height: 1.3;
}

.error-description {
  color: var(--text-muted);
  margin-bottom: 1.6em;
}

.error-home-link {
  font-size: 0.9em;
}
