/* CSS Variables */
:root {
  --fg: #111;
  --bg: #fff;
  --muted: #666;
  --link: #0b79d0;
  --border: #e5e5e5;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}

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

a:hover {
  text-decoration: underline;
}

/* Layout */
.container {
  width: 100%;
  max-width: 740px;
  margin: 0;
  padding: 0 16px;
}

/* Header */
.site-header {
  background: #ADD8E6;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  margin: 16px;
}

.site-title {
  margin: 0;
  padding: 12px 0;
}

.site-title a {
  color: #2c5582;
  text-decoration: none;
}

/* Post List */
.post-list {
  list-style: none;
  padding: 0;
}

.post-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

/* Ensure consistent spacing after posts, regardless of last element type (text, image, etc.) */
.post-item .content > *:last-child {
  margin-bottom: 2.5rem;
}

.meta {
  color: var(--muted);
  font-size: 0.9em;
}

/* Code Blocks */
pre {
  background: #f8f9fa;
  color: #000;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  overflow: auto;
}

code {
  background: #f5f5f5;
  color: #E21144;
  padding: 2px 4px;
  border: 1px solid #e1e1e8;
  border-radius: 3px;
}

/* Code inside pre blocks should be black */
pre code {
  background: transparent;
  color: #000;
  padding: 0;
  border: none;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
}

img.blog {
  border: 1vw solid white;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.3);
}

/* Pagination */
.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: 32px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.pagination-link {
  background: var(--link);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.pagination-link:first-child {
  justify-self: start;
}

.pagination-link:last-child {
  justify-self: end;
}

.pagination-link:hover {
  background: #0056b3;
  text-decoration: none;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.9em;
  text-align: center;
  grid-column: 2;
}

/* Title Styling */
.post-item h3,
.post h3 {
  font-size: 2em;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.post-item h3 a,
.post h3 {
  color: #0088cc;
  text-decoration: none;
}

.post-item h3 a:hover {
  text-decoration: underline;
  color: #2c5582;
}

/* Meta line with share button */
.meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Share Button */
.share-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  line-height: 1;
  margin-left: auto;
}

.share-button:hover {
  opacity: 1;
  transform: scale(1.15);
}

.share-button:active {
  transform: scale(0.95);
}


/* Heading Sizes */
h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

/* All headings styling */
h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 0.5rem 0;
  line-height: 1.3;
  font-weight: 600;
}

/* Footer Styling - Typewriter Style */
.site-footer {
  margin-top: 1rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: #f8f9fa;
}

.site-footer .container {
  font-family: monospace;
  font-size: 0.8em;
  color: #555;
  line-height: 1.5;
}

.site-footer .container p {
  margin: 0;
}

/* Footer categories styling */
.site-footer .categories {
  margin: 0.5rem 0;
  line-height: 1.4;
}

.site-footer .categories a {
  white-space: nowrap;
}

/* Responsive: Stack categories on very small screens */
@media (max-width: 480px) {
  .site-footer .categories {
    word-break: break-all;
  }
}

/* Search Component Styles */
.search-container { 
  position: relative; 
  margin: 1rem 0; 
  max-width: 400px; 
}

.search-toggle { 
  cursor: pointer; 
  color: #4a90e2; 
  font-size: 1rem; 
  display: flex; 
  align-items: center; 
  gap: 0.5rem; 
  user-select: none; 
}

.search-toggle:hover { 
  color: #357abd; 
}

.search-input-wrapper { 
  max-height: 0; 
  overflow: hidden; 
  transition: max-height 0.3s ease; 
}

.search-input-wrapper.expanded { 
  max-height: 500px; 
}

.search-input { 
  width: 100%; 
  padding: 0.5rem 2.5rem 0.5rem 0.75rem; 
  border: 1px solid #ddd; 
  border-radius: 4px; 
  font-size: 1rem; 
  margin-top: 0.5rem; 
  box-sizing: border-box; 
}

.search-input:focus { 
  outline: none; 
  border-color: #4a90e2; 
}

.search-icon { 
  position: absolute; 
  right: 0.75rem; 
  top: calc(0.5rem + 0.5rem + 50%); 
  transform: translateY(-50%); 
  pointer-events: none; 
  opacity: 0; 
  transition: opacity 0.3s; 
}

.search-input-wrapper.expanded .search-icon { 
  opacity: 0.5; 
}

.search-help {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #e9ecef;
  border: 1px solid #ddd;
  border-top: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #666;
  display: none;
  z-index: 999;
  line-height: 1.4;
}

.search-help.active {
  display: block;
}

.search-help code {
  background: #e9ecef;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
}

.search-results { 
  position: absolute; 
  top: calc(100% + 2.5rem);
  left: 0; 
  right: 0; 
  background: white; 
  border: 1px solid #ddd; 
  border-top: none; 
  border-radius: 0 0 4px 4px; 
  max-height: 400px; 
  overflow-y: auto; 
  display: none; 
  z-index: 1000; 
  box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
}

.search-results.active { 
  display: block; 
}

.search-result-item { 
  display: block; 
  padding: 0.75rem; 
  border-bottom: 1px solid #eee; 
  cursor: pointer; 
  text-decoration: none; 
  color: inherit; 
}

.search-result-item:hover { 
  background: #f5f5f5; 
  text-decoration: none; 
}

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

.search-result-title { 
  font-weight: bold; 
  margin-bottom: 0.25rem; 
  color: #0066cc; 
}

.search-result-item:hover .search-result-title { 
  text-decoration: underline; 
}

.search-result-excerpt { 
  font-size: 0.875rem; 
  color: #666; 
  overflow: hidden; 
  display: -webkit-box; 
  -webkit-line-clamp: 3; 
  -webkit-box-orient: vertical; 
}

.search-no-results { 
  padding: 1rem; 
  text-align: center; 
  color: #666; 
}

/*
.footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9em;
}

.footnotes ol {
  padding-left: 1.5rem;
}

.footnotes li {
  margin-bottom: 0.5rem;
}

.footnote-ref {
  font-size: 0.8em;
  text-decoration: none;
  padding: 1px 4px;
  border-radius: 2px;
  background-color: var(--link);
  color: white;
}

.footnote-ref:hover {
  background-color: #0056b3;
  text-decoration: none;
}

.footnote-backref {
  margin-left: 0.5rem;
  text-decoration: none;
  font-size: 0.9em;
}
*/