/* Portfolio Blog Theme - Clean implementation of portfolio design */

/* CSS Variables for softer theming */
:root {
  --background: #fdfcfa;
  --foreground: #3a2518;
  --card-bg: #fdfcfa;
  --border-color: rgba(45, 24, 16, 0.3);
  --link-color: #c2670a;
  --text-secondary: #8b6b4f;
  --widget-bg: #f8f6f2;
  --tag-bg: #f4e6d7;
  --tag-color: #3a2518;
  --border-radius: 0;
}

.dark {
  --background: #1c1916;
  --foreground: #f2ede4;
  --card-bg: #1c1916;
  --border-color: rgba(242, 237, 228, 0.25);
  --link-color: #e6a85c;
  --text-secondary: #b8a08a;
  --widget-bg: #252118;
  --tag-bg: #8b4a1a;
  --tag-color: #f2ede4;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Georgia, "Times New Roman", "Book Antiqua", serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--foreground);
  background: var(--background);
  background-image: radial-gradient(circle at 1px 1px, rgba(139, 107, 79, 0.08) 1px, transparent 0);
  background-size: 24px 24px;
  letter-spacing: 0.005em;
  transition: all 0.3s ease;
}

.dark body {
  background-image: radial-gradient(circle at 1px 1px, rgba(184, 160, 138, 0.04) 1px, transparent 0);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: "Book Antiqua", Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--foreground);
  margin: 1.2em 0 0.8em 0;
}

h1 { font-size: 2.5em; }
h2 { font-size: 2em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.3em; }
h5 { font-size: 1.1em; }
h6 { font-size: 1em; }

p {
  margin: 1em 0;
  line-height: 1.7;
}

a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}

a:hover {
  text-decoration: underline;
}

/* Dark mode toggle - softer approach */
.dark-mode-toggle {
  position: fixed;
  top: 25px;
  right: 25px;
  z-index: 1000;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  border-radius: 2px;
  opacity: 0.8;
}

.dark-mode-toggle:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(45, 24, 16, 0.1);
}

.dark .dark-mode-toggle:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode-toggle::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border: 1px solid var(--border-color);
  z-index: -1;
  background: var(--background);
  border-radius: 2px;
  opacity: 0.5;
}

/* Container and layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  position: relative;
}

/* Page wrapper with subtle border */
.page-wrapper {
  border: 1px solid var(--border-color);
  position: relative;
  background: var(--background);
  min-height: 100vh;
  opacity: 0.98;
}

.page-wrapper::before {
  content: "";
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border: 1px solid var(--border-color);
  z-index: -1;
  background: var(--background);
  opacity: 0.4;
}

.page-wrapper::after {
  content: "";
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border: 1px solid var(--border-color);
  z-index: -2;
  background: var(--background);
  opacity: 0.2;
}

/* Header */
.header {
  padding: 80px 40px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background: var(--background);
  margin-bottom: 20px;
}

.site-title {
  font-size: 2.5em;
  margin-bottom: 0.2em;
  color: var(--foreground);
  text-decoration: none;
}

.site-subtitle {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin-bottom: 2em;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 2em;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--link-color);
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 1;
}

/* Content area */
.content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  padding: 40px;
}

@media (max-width: 968px) {
  .content {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 20px;
  }
}

/* Articles with subtle nested borders */
.article-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  position: relative;
  margin-bottom: 40px;
  transition: all 0.3s ease;
  opacity: 0.95;
}

.article-card:hover {
  transform: translateY(-2px);
  opacity: 1;
  box-shadow: 0 8px 25px rgba(45, 24, 16, 0.08);
}

.dark .article-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.article-card::before {
  content: "";
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border: 1px solid var(--border-color);
  z-index: -1;
  background: var(--background);
  opacity: 0.6;
}

.article-card::after {
  content: "";
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border: 1px solid var(--border-color);
  z-index: -2;
  background: var(--background);
  opacity: 0.3;
}

/* Simplified nested borders for mobile */
@media (max-width: 768px) {
  .article-card::before {
    top: -2px; left: -2px; right: -2px; bottom: -2px;
  }
  
  .article-card::after {
    top: -4px; left: -4px; right: -4px; bottom: -4px;
  }
}

.article-header {
  padding: 40px 35px 25px 35px;
  border-bottom: 1px solid var(--border-color);
}

.article-meta {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.article-title {
  font-size: 1.8em;
  margin: 0 0 15px 0;
  color: var(--foreground);
}

.article-content {
  padding: 35px;
  line-height: 1.75;
}

.article-excerpt {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.read-more {
  display: inline-block;
  padding: 8px 16px;
  background: var(--tag-bg);
  color: var(--tag-color);
  border: 1px solid var(--border-color);
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s ease;
}

.read-more:hover {
  background: var(--link-color);
  color: var(--background);
  text-decoration: none;
}

/* Tags */
.article-tags {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  font-size: 0.8em;
  font-weight: 500;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tag:hover {
  background: var(--link-color);
  color: var(--background);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.widget {
  background: var(--widget-bg);
  border: 1px solid var(--border-color);
  position: relative;
  padding: 25px;
  border-radius: 2px;
  transition: all 0.3s ease;
  opacity: 0.95;
}

.widget:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(45, 24, 16, 0.06);
}

.dark .widget:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.widget::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border: 1px solid var(--border-color);
  z-index: -1;
  background: var(--background);
  border-radius: 2px;
  opacity: 0.4;
}

.widget-title {
  font-size: 1.2em;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--foreground);
}

.widget ul {
  list-style: none;
}

.widget li {
  margin-bottom: 8px;
}

.widget a {
  color: var(--link-color);
  font-size: 0.9em;
}

/* Footer */
.footer {
  padding: 40px;
  border-top: 2px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Post content styling with subtle animations */
.post-content img {
  max-width: 100%;
  height: auto;
  margin: 2em 0;
  border: 1px solid var(--border-color);
  transition: all 0.4s ease;
  opacity: 0.95;
}

.post-content img:hover {
  opacity: 1;
  transform: scale(1.02);
  box-shadow: 0 8px 30px rgba(45, 24, 16, 0.06);
}

.dark .post-content img:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.post-content blockquote {
  border-left: 4px solid var(--link-color);
  padding-left: 20px;
  margin: 2em 0;
  font-style: italic;
  color: var(--text-secondary);
  position: relative;
  transition: all 0.3s ease;
  opacity: 0.9;
}

.post-content blockquote:hover {
  opacity: 1;
  transform: translateX(5px);
  border-left-width: 6px;
}

/* Custom styled divs and blockquotes - override inline styles for dark mode */
.post-content div[style*="background-color"] {
  background-color: var(--widget-bg) !important;
  color: var(--foreground) !important;
}

.post-content div[style*="border-left"] {
  border-left-color: var(--link-color) !important;
}

/* Ensure all text in styled containers is visible */
.post-content div[style] * {
  color: var(--foreground) !important;
}

.post-content code {
  background: var(--widget-bg);
  padding: 2px 6px;
  border: 1px solid var(--border-color);
  font-family: "SF Mono", Monaco, "Inconsolata", "Roboto Mono", "Courier New", monospace;
  font-size: 0.9em;
}

.post-content pre {
  background: var(--widget-bg);
  padding: 20px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  margin: 2em 0;
  line-height: 1.5;
}

.post-content pre code {
  background: none;
  padding: 0;
  border: none;
}

/* Archive page */
.archive-list {
  list-style: none;
}

.archive-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.archive-date {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin-bottom: 5px;
}

.archive-title {
  font-size: 1.1em;
  color: var(--foreground);
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 20px 15px;
  }
  
  .header {
    padding: 40px 20px;
  }
  
  .site-title {
    font-size: 2em;
  }
  
  .nav {
    gap: 1.5em;
  }
  
  .article-header,
  .article-content {
    padding: 20px;
  }
  
  .widget {
    padding: 20px;
  }
}

/* Pagination */
.pagination {
  text-align: center;
  margin: 40px 0;
}

.pagination a, .pagination span {
  display: inline-block;
  padding: 8px 16px;
  margin: 0 4px;
  background: var(--widget-bg);
  color: var(--foreground);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.pagination a:hover {
  background: var(--link-color);
  color: var(--background);
}

.pagination .current {
  background: var(--link-color);
  color: var(--background);
}

.pagination .space {
  background: none;
  border: none;
  color: var(--text-secondary);
}

/* Category links */
.category-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9em;
}

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

/* Utilities */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.text-center {
  text-align: center;
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--link-color), var(--text-secondary));
  z-index: 999;
  transition: width 0.1s ease;
  opacity: 0;
}

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

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Subtle fade-in animation for content */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-card {
  animation: fadeInUp 0.6s ease forwards;
}

.article-card:nth-child(2) { animation-delay: 0.1s; }
.article-card:nth-child(3) { animation-delay: 0.2s; }
.article-card:nth-child(4) { animation-delay: 0.3s; }
.article-card:nth-child(5) { animation-delay: 0.4s; }

.widget {
  animation: fadeInUp 0.6s ease forwards;
}

.widget:nth-child(2) { animation-delay: 0.15s; }
.widget:nth-child(3) { animation-delay: 0.3s; }
.widget:nth-child(4) { animation-delay: 0.45s; }

/* Enhanced link hover with subtle underline animation */
.post-content a {
  position: relative;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.post-content a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -1px;
  left: 0;
  background-color: var(--link-color);
  transition: width 0.3s ease;
}

.post-content a:hover::after {
  width: 100%;
}

/* Subtle glow effect for focused elements */
*:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--link-color), 0 0 12px rgba(194, 103, 10, 0.2);
  transition: box-shadow 0.2s ease;
}

.dark *:focus {
  box-shadow: 0 0 0 2px var(--link-color), 0 0 12px rgba(230, 168, 92, 0.2);
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--widget-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 998;
  box-shadow: 0 4px 15px rgba(45, 24, 16, 0.05);
}

.dark .back-to-top {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

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

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 24, 16, 0.1);
}

.dark .back-to-top:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.back-to-top::before {
  content: '↑';
  font-size: 18px;
  color: var(--foreground);
  font-weight: bold;
}

/* Utilities */
.mt-2 { margin-top: 2em; }
.mb-2 { margin-bottom: 2em; }
.p-0 { padding: 0; }
