/* Modern Blog Stylesheet */

:root {
  --bg-color: #ffffff;
  --text-color: #2c3e50;
  --accent-color: #3498db;
  --secondary-color: #95a5a6;
  --border-color: #ecf0f1;
  --code-bg: #f8f9fa;
  --max-width: 800px;
  --spacing: 2rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #66b3ff;
    --secondary-color: #7f8c8d;
    --border-color: #2c2c2c;
    --code-bg: #2d2d2d;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  font-size: 18px;
}

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

/* Navigation */
.site-nav {
  background-color: var(--bg-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.site-nav .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Site header - title and nav on same line */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
 /* padding-bottom: 1rem; */
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 0;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* Tagline - on its own line below the header */
.site-tagline {
  padding-top: 0.5rem;
  font-style: italic;
  color: var(--secondary-color);
  font-size: 0.9rem;
  text-align: left;
  width: 100%;
}

/* Content */
#content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  color: var(--text-color);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

.title {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.subtitle {
  color: var(--secondary-color);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* Blog post metadata */
.post-meta {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.post-separator {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

/* Lists */
ul, ol {
  margin: 1rem 0 1rem 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Post list (sitemap) */
#content ul {
  list-style: none;
  margin-left: 0;
}

#content ul li {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

#content ul li:last-child {
  border-bottom: none;
}

#content ul li a {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-color);
}

#content ul li a:hover {
  color: var(--accent-color);
}

/* Code blocks */
pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

code {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--secondary-color);
  font-style: italic;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

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

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  background-color: var(--code-bg);
}

/* Newsletter subscribe box */
.subscribe-box {
  background: linear-gradient(135deg, var(--accent-color) 0%, #2980b9 100%);
  color: white;
  padding: 2rem;
  border-radius: 8px;
  margin: 2rem 0;
  text-align: center;
}

.subscribe-box h3 {
  margin-top: 0;
  color: white;
  font-size: 1.5rem;
}

.subscribe-box p {
  margin-bottom: 1.5rem;
  opacity: 0.95;
}

.embeddable-buttondown-form {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.embeddable-buttondown-form input[type="email"] {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
}

.embeddable-buttondown-form input[type="submit"] {
  padding: 0.75rem 2rem;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.embeddable-buttondown-form input[type="submit"]:hover {
  background-color: white;
  color: var(--accent-color);
}

/* Post subscribe box (at bottom of posts) */
.post-subscribe {
  margin: 3rem 0 2rem 0;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.post-subscribe .subscribe-box {
  margin: 0;
}

/* Homepage specific styles */
.home-post {
  margin-bottom: 3rem;
}

.read-more {
  margin-top: 1.5rem;
  font-weight: 600;
}

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

.read-more a:hover {
  text-decoration: underline;
}

.archive-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 3rem 0;
  flex-wrap: wrap;
}

.archive-link-button {
  color: var(--accent-color);
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--accent-color);
  border-radius: 4px;
  display: inline-block;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 1.1rem;
}

.archive-link-button:hover {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

/* Tag styling */
.post-tags {
  margin: 1rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-tag {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--secondary-color);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.post-tag:hover {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 2rem 0;
  padding: 2rem;
  background-color: var(--code-bg);
  border-radius: 8px;
}

.tag-cloud .tag {
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  color: var(--text-color);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tag-cloud .tag:hover {
  border-color: var(--accent-color);
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

.tag-cloud .tag-count {
  background-color: var(--secondary-color);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: bold;
}

.tag-cloud .tag:hover .tag-count {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Tag sizes for cloud */
.tag-cloud .tag-small { font-size: 0.9rem; }
.tag-cloud .tag-medium { font-size: 1rem; }
.tag-cloud .tag-large { font-size: 1.2rem; }
.tag-cloud .tag-x-large { font-size: 1.4rem; }
.tag-cloud .tag-xx-large { font-size: 1.6rem; font-weight: 600; }

/* Series notice styling */
.series-notice {
  background: #e8f4f8;
  border-left: 4px solid #4a90e2;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.series-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.series-notice p {
  margin: 0;
  line-height: 1.6;
}

.series-notice a {
  color: #4a90e2;
  text-decoration: none;
  border-bottom: 1px solid #4a90e2;
}

.series-notice a:hover {
  border-bottom-color: #357abd;
  color: #357abd;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
  padding: 2rem 0;
  text-align: center;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* Responsive design - Mobile optimized */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .title {
    font-size: 2rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  #content {
    padding: 1rem;
  }

  .embeddable-buttondown-form {
    flex-direction: column;
  }

  .embeddable-buttondown-form input[type="email"],
  .embeddable-buttondown-form input[type="submit"] {
    width: 100%;
  }

  .subscribe-box {
    padding: 1.5rem;
  }

  .home-post {
    margin-bottom: 2rem;
  }

  .post-separator {
    margin: 2rem 0;
  }
}

/* Print styles */
@media print {
  .site-nav,
  .site-footer {
    display: none;
  }

  body {
    font-size: 12pt;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}

/* Image utilities */
.img-right {
  float: right;
  margin: 0 0 1rem 1rem;
  max-width: 350px;
  border-radius: 8px;
}

.img-left {
  float: left;
  margin: 0 1rem 1rem 0;
  max-width: 350px;
  border-radius: 8px;
}

.img-center {
  display: block;
  margin: 2rem auto;
  max-width: 600px;
  border-radius: 8px;
}

/* Clear floats after images */
.clear {
  clear: both;
}

/* Responsive images */
article img {
  max-width: 100%;
  height: auto;
}

.footer-nav {
  text-align: center;
  padding: 2rem 0 1rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

.footer-nav a {
  color: var(--text-color);
  text-decoration: none;
  margin: 0 1rem;
  transition: color 0.2s;
}

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

/* Search page styles */
#search-container {
  max-width: 600px;
  margin: 2rem auto;
}

#search-input {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 2rem;
}

#search-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.search-result {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.search-result h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.search-result p {
  color: var(--secondary-color);
  margin: 0;
}
