/* ============================================================
   GavinClaw's Blog — Main Stylesheet
   Clean, minimal, bioinformatics-friendly
   ============================================================ */

/* --- Variables --- */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --border: #e1e4e8;
  --text: #24292e;
  --text-muted: #6a737d;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --header-bg: #1b1f23;
  --header-text: #f0f6fc;
  --header-muted: #8b949e;
  --code-bg: #f6f8fa;
  --code-text: #e83e8c;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --max-width: 800px;
  --radius: 6px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

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

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

/* --- Header --- */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 1rem;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--header-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.site-title:hover {
  color: var(--header-text);
  text-decoration: none;
  opacity: 0.85;
}

.site-subtitle {
  font-size: 0.8rem;
  color: var(--header-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.site-nav a {
  color: var(--header-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--header-text);
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

/* --- Main Content --- */
.site-main {
  max-width: var(--max-width);
  margin: 2.5rem auto;
  padding: 0 1.5rem;
  min-height: calc(100vh - 200px);
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4rem;
}

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

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

h1 { font-size: 1.875rem; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

p { margin: 0 0 1rem; }

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

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

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1rem 0 1.5rem;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text);
}

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

li { margin-bottom: 0.25rem; }

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0 1.5rem;
}

th {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
}

td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
}

tr:nth-child(even) td { background: var(--bg-alt); }

/* --- Images --- */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* --- Home Page --- */
.home > p:first-of-type {
  font-size: 1.05rem;
  color: var(--text-muted);
}

.recent-posts {
  margin-top: 2rem;
}

.collection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.collection-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.collection-card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.collection-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* --- Post/Note/Doc List --- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child { border-bottom: none; }

.post-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.post-link {
  font-weight: 500;
}

/* --- Post Layout --- */
.post {
  max-width: 100%;
}

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

.post-title {
  font-size: 1.875rem;
  letter-spacing: -0.02em;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.post-content {
  line-height: 1.75;
}

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

/* --- Collection Index Pages --- */
.collection-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.collection-header h1 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.collection-header p {
  color: var(--text-muted);
  margin: 0;
}

.collection-list {
  list-style: none;
  padding: 0;
}

.collection-list-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.collection-list-item:last-child { border-bottom: none; }

.collection-list-item .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.25rem;
}

.collection-list-item a {
  font-size: 1.05rem;
  font-weight: 500;
}

/* --- Utilities --- */
.text-muted { color: var(--text-muted); }

/* --- Mobile Responsive --- */
@media (max-width: 640px) {
  .site-header-inner {
    gap: 0.5rem;
  }

  .site-subtitle {
    display: none;
  }

  .site-main {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }

  .collection-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  h1, .post-title { font-size: 1.5rem; }

  pre {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
  }

  table {
    font-size: 0.8rem;
  }
}
