/* ============================================
   Strong-Y Blog - Main Stylesheet
   Clean, minimal, agent-friendly design
   ============================================ */

/* CSS Custom Properties for Theming */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --code-bg: #f3f4f6;
  --max-width: 720px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, Inconsolata, "Roboto Mono", Consolas, "Courier New", monospace;
  --line-height: 1.7;
  --radius: 6px;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #e5e5e5;
  --muted: #9ca3af;
  --accent: #60a5fa;
  --border: #27272a;
  --code-bg: #18181b;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: var(--line-height);
  color: var(--fg);
  background-color: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

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

p {
  margin-bottom: 1.25rem;
}

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

a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

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

/* Header */
.site-header {
  padding: 2rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

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

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

.site-title:hover {
  text-decoration: none;
  opacity: 0.8;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

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

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Main Content */
main {
  min-height: calc(100vh - 200px);
  padding-bottom: 4rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

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

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

.post-item-title {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-item-title a {
  color: var(--fg);
  text-decoration: none;
}

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

.post-item-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.post-item-summary {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.post-item-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background-color: var(--code-bg);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.tag:hover {
  background-color: var(--accent);
  color: white;
  text-decoration: none;
}

/* Post Detail */
.post-header {
  margin-bottom: 2.5rem;
}

.post-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.post-meta {
  font-size: 0.9375rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.post-content {
  font-size: 1.0625rem;
  line-height: var(--line-height);
}

.post-content h2 {
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  font-size: 1.625rem;
  font-weight: 700;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.post-content h3 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.375rem;
  font-weight: 600;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: var(--fg);
}

.post-content pre {
  background-color: var(--code-bg);
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Code block language indicator */
.post-content pre[data-language]::before {
  content: attr(data-language);
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

/* Horizontal rules */
.post-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 2.5rem 0;
  position: relative;
}

.post-content hr::after {
  content: '⚡';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  padding: 0 1rem;
  color: var(--accent);
  font-size: 1.2rem;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.post-content thead {
  background-color: var(--accent);
}

.post-content th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: #ffffff;
  border-bottom: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.post-content td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  line-height: 1.7;
  vertical-align: top;
}

.post-content tbody tr:nth-child(even) {
  background-color: var(--code-bg);
}

.post-content tbody tr:last-child td {
  border-bottom: none;
}

.post-content tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.08);
  transition: background-color 0.15s ease;
}

/* First column emphasis for comparison tables */
.post-content td:first-child {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}

/* Table responsive wrapper */
.post-content .table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.post-content .table-wrapper table {
  margin: 0;
  border: none;
}

/* Bold text enhancement */
.post-content strong {
  font-weight: 700;
  color: var(--fg);
}

/* Blockquote enhancement */
.post-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background-color: var(--code-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
}

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

/* List enhancement */
.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.75rem;
}

.post-content li {
  margin-bottom: 0.625rem;
  line-height: 1.7;
}

.post-content li > strong:first-child {
  color: var(--accent);
}

/* Nested lists */
.post-content ul ul,
.post-content ol ol,
.post-content ul ol,
.post-content ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Emphasis */
.post-content em {
  color: var(--muted);
}

/* Italic at end of doc */
.post-content > p:last-child em {
  display: block;
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Post Navigation */
.post-navigation {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.post-navigation a {
  display: block;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s ease;
}

.post-navigation a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.post-navigation-label {
  font-size: 0.8125rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.post-navigation-title {
  font-weight: 600;
  color: var(--fg);
}

/* Related Posts */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* Comments Section */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-posts h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.related-posts-list {
  list-style: none;
}

.related-posts-list li {
  margin-bottom: 0.75rem;
}

.related-posts-list a {
  color: var(--fg);
}

/* Tag Page */
.tag-header {
  margin-bottom: 2rem;
}

.tag-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.tag-header p {
  color: var(--muted);
}

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

/* No JS fallback */
.no-js .post-list::before {
  content: "Please enable JavaScript to view the blog content.";
  display: block;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .site-header .container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 1rem;
  }
}

/* Print styles */
@media print {
  .site-header,
  .site-footer,
  .theme-toggle,
  .post-navigation,
  .related-posts,
  .comments-section {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  .post-content {
    font-size: 12pt;
  }
}
