/* Belshaw Brain Archive — Nord Theme */

:root {
  /* Nord Light (default) */
  --bg: #eceff4;      /* nord6 */
  --fg: #2e3440;      /* nord0 */
  --muted: #4c566a;   /* nord3 */
  --accent: #5e81ac;  /* nord10 */
  --rule: #d8dee9;    /* nord4 */
  --code-bg: #e5e9f0; /* nord5 */
  --badge-bg: #d8dee9;/* nord4 */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  /* Nord Dark */
  --bg: #2e3440;      /* nord0 */
  --fg: #eceff4;      /* nord6 */
  --muted: #d8dee9;   /* nord4 */
  --accent: #88c0d0;  /* nord8 */
  --rule: #3b4252;    /* nord1 */
  --code-bg: #3b4252; /* nord1 */
  --badge-bg: #434c5e;/* nord2 */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2e3440;
    --fg: #eceff4;
    --muted: #d8dee9;
    --accent: #88c0d0;
    --rule: #3b4252;
    --code-bg: #3b4252;
    --badge-bg: #434c5e;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
}

body {
  font-family: var(--serif);
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Header */
.archive-header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
  margin-bottom: 2.5rem;
}

.archive-header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.archive-wordmark {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.archive-wordmark:hover {
  text-decoration: underline;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.theme-toggle:hover {
  color: var(--fg);
  background: var(--code-bg);
}

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }

[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* Footer */
.archive-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
}

.archive-footer a {
  color: var(--muted);
}

/* Hero / homepage */
.archive-hero {
  margin-bottom: 2.5rem;
}

.archive-hero h1 {
  font-family: var(--sans);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.lede {
  font-size: 1.05rem;
  color: var(--muted);
}

/* Headings */
h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; color: var(--accent); }
h3 { font-size: 1.1rem; }

/* Lists */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li { margin-bottom: 0.35rem; }

/* Paragraphs */
p { margin-bottom: 1rem; }

/* Links */
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--fg);
}

/* Post styles */
.post-header {
  margin-bottom: 2rem;
}

.post-title {
  font-size: 1.7rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
}

.post-meta time {
  margin-right: 0.75rem;
}

.source-badge {
  background: var(--badge-bg);
  color: var(--muted);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.75rem;
}

.post-tags a {
  color: var(--muted);
  text-decoration: none;
}

.post-tags a:hover {
  text-decoration: underline;
}

.post-body {
  font-size: 1rem;
  line-height: 1.7;
}

.post-body h2 {
  margin-top: 2.5rem;
}

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.post-body blockquote {
  border-left: 3px solid var(--rule);
  padding-left: 1rem;
  margin-left: 0;
  color: var(--muted);
  font-style: italic;
}

.post-body pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.4;
  border-radius: 4px;
}

.post-body code {
  font-family: "SF Mono", Monaco, Inconsolata, "Fira Code", monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
}

.post-body pre code {
  background: none;
  padding: 0;
}

/* Archive / list styles */
.archive-list {
  list-style: none;
  margin-left: 0;
}

.archive-list li {
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.archive-list a {
  text-decoration: none;
  font-weight: 500;
}

.archive-list .meta {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* Tag cloud */
.tag-cloud {
  list-style: none;
  margin-left: 0;
  column-count: 2;
  column-gap: 2rem;
}

.tag-cloud li {
  break-inside: avoid;
  margin-bottom: 0.4rem;
}

.tag-cloud .count {
  color: var(--muted);
  font-size: 0.85em;
}

/* Home columns */
.home-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
}

@media (max-width: 600px) {
  .home-columns {
    grid-template-columns: 1fr;
  }
  .tag-cloud {
    column-count: 1;
  }
}

.home-nav ul {
  list-style: none;
  margin-left: 0;
}

.home-nav li {
  margin-bottom: 0.5rem;
}

/* Source list */
.source-list {
  list-style: none;
  margin-left: 0;
  font-size: 1.1rem;
}

.source-list li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

/* Footer License */
.license {
  margin-top: 0.5rem;
  opacity: 0.8;
}

/* Ghost Bookmark Cards & Big Links */
.kg-bookmark-card, 
.post-body a[href*="blog.dougbelshaw.com"], 
.post-body a[href*="thoughtshrapnel.com"] {
  display: block;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  padding: 1.2rem;
  border-radius: 6px;
  text-decoration: none !important;
  margin: 1.5rem 0;
  transition: border-color 0.2s, transform 0.1s;
  color: var(--fg) !important;
}

.post-body a[href*="blog.dougbelshaw.com"]:hover,
.post-body a[href*="thoughtshrapnel.com"]:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Post body links should not be blocks unless they are internal bookmarks */
.post-body p a {
  display: inline;
  background: none;
  border: none;
  padding: 0;
}

/* Re-styled Ghost specific classes if they survive conversion */
.kg-bookmark-container {
  display: flex;
  color: inherit;
  text-decoration: none;
}

.kg-bookmark-content {
  flex-grow: 1;
}

.kg-bookmark-title { font-weight: 600; margin-bottom: 0.3rem; }
.kg-bookmark-description { font-size: 0.85rem; color: var(--muted); }
.kg-bookmark-metadata { display: flex; align-items: center; margin-top: 0.5rem; font-size: 0.75rem; }
.kg-bookmark-icon { width: 16px; height: 16px; margin-right: 8px; }
