/* ============================================================
   CraigFreeman — Public Site Styles
   Palette: white base, slate text, indigo accent (#6366f1)
   ============================================================ */

:root {
  --bg:           #ffffff;
  --bg-subtle:    #f8fafc;
  --border:       #e8ecf0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --accent:       #6366f1;
  --accent-dark:  #4f46e5;
  --accent-bg:    #f0f0ff;
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --radius:       6px;
  --radius-lg:    10px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 8px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --max-width:    1080px;
  --max-narrow:   680px;
  --nav-h:        64px;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow { max-width: var(--max-narrow); }

.section { padding: 4rem 0; }

/* ── Navigation ─────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: 2rem;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.nav-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  padding: 0.35rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--bg-subtle); }
.nav-link.active { color: var(--accent); background: var(--accent-bg); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Hero ───────────────────────────────────────────────── */

.hero {
  padding: 6rem 0 5rem;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  font-family: inherit;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-subtle); border-color: #c7cbd4; }

.btn--full { width: 100%; justify-content: center; }

/* ── Section header ──────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.link-subtle {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.link-subtle:hover { color: var(--accent); }

/* ── Page header ─────────────────────────────────────────── */

.page-header {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-subtitle { color: var(--text-muted); font-size: 1.05rem; }

/* ── Post grid (homepage) ────────────────────────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ── Post card ───────────────────────────────────────────── */

.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d0d4db;
  transform: translateY(-2px);
}

.post-card--list {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  background: transparent;
}

.post-card--list:hover { transform: none; box-shadow: none; }
.post-list .post-card--list:first-child { border-top: 1px solid var(--border); }

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-card-title a { color: inherit; text-decoration: none; }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
  flex: 1;
}

.post-card-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.post-card-link:hover { color: var(--accent-dark); }

/* ── Tags ────────────────────────────────────────────────── */

.tag-list { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.tag {
  display: inline-block;
  background: var(--accent-bg);
  color: var(--accent-dark);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.tag:hover { background: #e0e0fa; }

.tag-filter-notice {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Blog post detail ────────────────────────────────────── */

.post-detail { padding: 3rem 0 5rem; }

.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}

.post-excerpt {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 0.75rem;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* ── Prose (rendered Markdown) ───────────────────────────── */

.prose {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.prose h1 { font-size: 1.8rem; }
.prose h2 { font-size: 1.4rem; }
.prose h3 { font-size: 1.15rem; }
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }

.prose p { margin-bottom: 1.25em; }

.prose a { color: var(--accent); font-weight: 500; }
.prose a:hover { color: var(--accent-dark); }

.prose blockquote {
  margin: 1.5em 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

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

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #5b21b6;
}

.prose pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.875rem;
  line-height: 1.7;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.25em; }
.prose li { margin-bottom: 0.4em; }

.prose img { max-width: 100%; border-radius: var(--radius-lg); margin: 1.5em 0; }

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

.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.9rem; }
.prose th { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--border); font-weight: 600; }
.prose td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }

/* ── Pagination ──────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.pagination a { color: var(--accent); text-decoration: none; font-weight: 500; }
.pagination-info { color: var(--text-muted); }

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: 4rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-text { font-size: 0.85rem; color: var(--text-muted); }

.footer-social { display: flex; gap: 1.25rem; }

.footer-social a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-social a:hover { color: var(--accent); }

/* ── Empty state ─────────────────────────────────────────── */

.empty-state { color: var(--text-muted); padding: 3rem 0; text-align: center; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open { display: flex; }

  .hero { padding: 3.5rem 0 3rem; }
  .post-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .section { padding: 2.5rem 0; }
  .section-header { flex-direction: column; gap: 0.5rem; }
}
