/* Sophisticated light color scheme */
:root {
  --bg: #fdfcf8; /* softer, more refined cream */
  --fg: #2c2c2c; /* softer black for better readability */
  --accent: #a67c52; /* refined golden brown */
  --link: #8b6914; /* sophisticated golden olive */
  --link-hover: #6b4e0a; /* deeper golden brown */
  
  /* Enhanced interaction colors */
  --selection-bg: rgba(166, 124, 82, 0.15);
  --selection-fg: var(--fg);
  --focus-ring: rgba(139, 105, 20, 0.4);
  --progress-bg: rgba(166, 124, 82, 0.08);
  --progress-fill: var(--accent);
  --subtle-border: rgba(44, 44, 44, 0.08);
  --hover-bg: rgba(166, 124, 82, 0.04);
}

html {
  box-sizing: border-box;
  /* ENHANCEMENT 2: Smooth scroll behavior */
  scroll-behavior: smooth;
}
*, *::before, *::after {
  box-sizing: inherit;
}

/* ENHANCEMENT 2: Better text selection */
::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* ENHANCEMENT 3: Subtle page transition */
  opacity: 0;
  animation: fadeInPage 0.3s ease-out forwards;
}

/* ENHANCEMENT 3: Quick page fade-in */
@keyframes fadeInPage {
  from { opacity: 0; }
  to { opacity: 1; }
}

main {
  max-width: 72ch;
  padding: 8vh 20px;
  margin: 0 auto;
  /* ENHANCEMENT 4: Better responsive typography */
  position: relative;
}

/* ENHANCEMENT 4: Responsive font sizing */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    line-height: 1.6;
  }
  main {
    padding: 6vh 16px;
  }
}

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* Home page title */
main > h1:first-child {
  font-size: 2rem;
}

.site-nav {
  margin-bottom: 1.5rem;
}

.site-nav a {
  color: var(--link);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.1s ease;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--accent);
}

p {
  margin: 0 0 1em;
}

.social-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2em;
  padding-top: 2em;
  border-top: 1px solid var(--subtle-border);
}

.social-links a {
  color: var(--fg);
  text-decoration: none;
  transition: opacity 0.1s ease;
  display: inline-flex;
  align-items: center;
}

.social-links a:hover {
  opacity: 0.7;
  transform: translateY(-1px);
}

.social-links svg {
  width: 24px;
  height: 24px;
}

/* Post styles */
.site-name-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--link);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2.5rem;
  letter-spacing: 0.02em;
  transition: all 0.1s ease;
  padding: 0.5rem 0;
  border-radius: 4px;
  position: relative;
}

.site-name-link::before {
  content: "←";
  font-size: 1.1em;
}

.site-name-link:hover {
  color: var(--link-hover);
}

.post {
  margin-bottom: 4rem;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 0;
  border-bottom: none;
}

.post-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: rgba(44, 44, 44, 0.7);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.post-separator {
  color: rgba(43, 43, 43, 0.4);
}

.post-date {
  font-style: normal;
}

.post-reading-time {
  font-style: normal;
}

.post-content {
  font-size: 1.125rem;
  line-height: 1.85;
  letter-spacing: 0.01em;
}

.post-content a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(139, 115, 85, 0.3);
  transition: all 0.1s ease;
}

.post-content a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--accent);
}

.post-content p {
  margin-bottom: 1.5em;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.5em;
  margin: 1.5em 0;
  font-style: italic;
  color: rgba(44, 44, 44, 0.8);
  background: var(--hover-bg);
  padding: 1em 1.5em;
  border-radius: 0 3px 3px 0;
}

.post-content code {
  background: var(--progress-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
  color: var(--link-hover);
}

.post-content pre {
  background: var(--hover-bg);
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5em 0;
  border-left: 3px solid var(--accent);
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.9em;
}

.post-content h2 {
  font-size: 1.75rem;
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.post-content h3 {
  font-size: 1.5rem;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.post-content ul,
.post-content ol {
  margin: 1.5em 0;
  padding-left: 2em;
}

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

.post-content hr {
  border: none;
  border-top: 1px solid rgba(43, 43, 43, 0.1);
  margin: 2em 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  border-radius: 3px;
}

/* Extended markdown features */
.post-content mark {
  background: rgba(166, 124, 82, 0.2);
  padding: 0.1em 0.2em;
  border-radius: 2px;
}

.post-content del {
  color: rgba(44, 44, 44, 0.6);
  text-decoration: line-through;
}

.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  border: 1px solid var(--subtle-border);
  border-radius: 6px;
  overflow: hidden;
}

.post-content th,
.post-content td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--subtle-border);
}

.post-content th {
  background: var(--hover-bg);
  font-weight: 600;
  color: var(--fg);
}

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

.post-content tr:hover {
  background: rgba(166, 124, 82, 0.02);
}

.post-content .task-list {
  list-style: none;
  padding-left: 0;
}

.post-content .task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

.post-content .task-item input[type="checkbox"] {
  margin: 0.2em 0 0 0;
  flex-shrink: 0;
}

.post-content .youtube-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 1.5em 0;
  border-radius: 3px;
}

.post-content .youtube-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Home page posts list */
.posts-list-home {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--subtle-border);
}

.posts-list-home h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.post-item {
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.post-item:last-child {
  margin-bottom: 0;
}

.post-item h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.post-item h3 a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.1s ease;
  border-bottom: 1px solid transparent;
}

.post-item h3 a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--accent);
}

.post-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: rgba(44, 44, 44, 0.65);
  font-style: italic;
}

.post-item-meta time {
  font-style: normal;
}

/* Archive page styles */
.archive-list {
  margin-top: 3rem;
}

.archive-item {
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.archive-item:last-child {
  margin-bottom: 0;
}

.archive-item h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.archive-item h3 a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.1s ease;
  border-bottom: 1px solid transparent;
}

.archive-item h3 a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--accent);
}

.archive-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: rgba(44, 44, 44, 0.65);
  font-style: italic;
}

.archive-item-meta time {
  font-style: normal;
}

/* ENHANCEMENT 5: Reading progress indicator */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--progress-bg);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reading-progress.visible {
  opacity: 1;
}

.reading-progress-bar {
  height: 100%;
  background: var(--progress-fill);
  width: 0%;
  transition: width 0.1s ease;
}

/* ENHANCEMENT 6: Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

.back-to-top:hover {
  box-shadow: 0 6px 20px rgba(166, 124, 82, 0.4);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ENHANCEMENT 7: Sleek social share buttons */
.social-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(44, 44, 44, 0.5);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.1s ease;
  margin-left: 0.5rem;
  position: relative;
}

.social-share-btn:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.social-share-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.twitter-share-btn:hover {
  color: #1da1f2;
  background: rgba(29, 161, 242, 0.1);
  transform: scale(1.1);
}

.linkedin-share-btn:hover {
  color: #0077b5;
  background: rgba(0, 119, 181, 0.1);
  transform: scale(1.1);
}

.twitter-share-btn:hover::after {
  content: "Share on Twitter";
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
}

.linkedin-share-btn:hover::after {
  content: "Share on LinkedIn";
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
}

/* ENHANCEMENT 8: Enhanced code blocks */
.code-block-wrapper {
  position: relative;
  margin: 1.5em 0;
}

.code-copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(139, 115, 85, 0.1);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  color: var(--link);
  cursor: pointer;
  opacity: 0;
  transition: all 0.1s ease;
  font-family: inherit;
}

.code-block-wrapper:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(139, 115, 85, 0.2);
  border-color: var(--accent);
}

.code-copy-btn.copied {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ENHANCEMENT 9: Better focus states */
a:focus,
button:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ENHANCEMENT 10: Improved mobile touch targets */
@media (max-width: 768px) {
  .social-links a,
  .site-nav a,
  .post-item h3 a,
  .archive-item h3 a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 52px;
    height: 52px;
  }
}

/* ENHANCEMENT 11: Print styles */
@media print {
  .back-to-top,
  .reading-progress,
  .copy-link-btn,
  .code-copy-btn {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.5;
  }
  
  main {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  
  .post-content a {
    color: black !important;
    text-decoration: underline !important;
  }
  
  .post-content a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  p, blockquote {
    page-break-inside: avoid;
  }
  
  pre {
    page-break-inside: avoid;
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
  }
}

/* ENHANCEMENT 12: Snappy hover effects */
.social-links a,
.post-item h3 a,
.archive-item h3 a,
.site-nav a {
  transition: all 0.08s ease;
}



