/* ============================
   CSS CUSTOM PROPERTIES
   ============================ */
:root {
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --spacing-xs: 0.125rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;

  /* Light theme colors */
  --primary-color: #333;
  --secondary-color: #666;
  --accent-color: #333;
  --background-color: #fafafa;
  --border-color: #bebebe;
  --shadow-medium: rgba(75, 85, 99, 0.2);
  --code-bg: #f8f8f8;
  --inline-code-bg: #f0f0f0;
  --conversation-bg: rgba(0, 0, 0, 0.02);
  --conversation-border: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"],
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark theme colors */
    --primary-color: #e0e0e0;
    --secondary-color: #a0a0a0;
    --accent-color: #e0e0e0;
    --background-color: #1a1a1a;
    --border-color: #404040;
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --code-bg: #2d2d2d;
    --inline-code-bg: #333333;
    --conversation-bg: rgba(255, 255, 255, 0.05);
    --conversation-border: rgba(255, 255, 255, 0.1);
  }
}

[data-theme="dark"] {
  /* Dark theme colors */
  --primary-color: #e0e0e0;
  --secondary-color: #a0a0a0;
  --accent-color: #e0e0e0;
  --background-color: #1a1a1a;
  --border-color: #404040;
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --code-bg: #2d2d2d;
  --inline-code-bg: #333333;
  --conversation-bg: rgba(255, 255, 255, 0.05);
  --conversation-border: rgba(255, 255, 255, 0.1);
}

/* ============================
   VIEW TRANSITIONS
   ============================ */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: fade 0.3s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================
   BASE STYLES
   ============================ */
body {
  background-color: var(--background-color);
  color: var(--primary-color);
  font-family: var(--font-family);
  font-size: 18px;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 700px;
  padding: var(--spacing-xxl);
}

header {
  margin-bottom: var(--spacing-md);
  position: relative;
}

main {
  margin-bottom: var(--spacing-lg);
}

footer {
  text-align: center;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* ============================
   SITE HEADER
   ============================ */
.header-content {
  align-items: flex-start;
  display: flex;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  margin-top: var(--spacing-sm);
}

.site-avatar {
  border-radius: 50%;
  border: 3px solid var(--primary-color);
  box-shadow: 0 2px 8px var(--shadow-medium);
  flex-shrink: 0;
  height: 70px;
  object-fit: cover;
  transition: transform 0.2s ease;
  width: 70px;
}

.site-avatar:hover {
  transform: scale(1.05);
}

.header-text {
  flex: 1;
}

.site-title {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-title a {
  text-decoration: none;
  color: var(--primary-color);
  transition: color 0.2s ease;
}

.site-description {
  color: var(--secondary-color);
  font-size: 1.25rem;
  line-height: 1.4;
  margin: 0;
  padding-top: var(--spacing-sm);
}

/* ============================
   THEME TOGGLE
   ============================ */
.theme-toggle {
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  margin-top: 2px;
}

.theme-switch {
  display: none;
}

.theme-label {
  width: 50px;
  height: 24px;
  background: var(--border-color);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
  display: block;
}

.theme-slider {
  width: 20px;
  height: 20px;
  background: var(--background-color);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-switch:checked + .theme-label {
  background: var(--primary-color);
}

.theme-switch:checked + .theme-label .theme-slider {
  transform: translateX(26px);
}

.theme-icon {
  width: 12px;
  height: 12px;
  color: var(--primary-color);
  transition: opacity 0.3s ease;
  position: absolute;
}

.sun-icon {
  opacity: 1;
}

.moon-icon {
  opacity: 0;
}

.theme-switch:checked + .theme-label .sun-icon {
  opacity: 0;
}

.theme-switch:checked + .theme-label .moon-icon {
  opacity: 1;
}

/* ============================
   NAVIGATION
   ============================ */
nav {
  font-size: 1.2rem;
  margin-top: 0;
  margin-bottom: var(--spacing-xl);
}

nav ul {
  display: flex;
  min-height: 20px;
  gap: 1rem;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
}

nav ul li {
  margin: 0;
}

.nav-link {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: bold;
  padding: 0.5rem 0;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* ============================
   POSTS & ARTICLES
   ============================ */
.post {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
}

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

.post-header {
  border: none;
  padding: 0;
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.post-date {
  color: var(--secondary-color);
  font-size: 0.9rem;
  font-weight: bold;
  position: relative;
  display: inline-block;
  padding-bottom: var(--spacing-xxs);
  margin-bottom: var(--spacing-xxs);
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: color 0.3s ease;
}

.post-date::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

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

.post h1,
.post h2 {
  margin: 0;
  margin-bottom: var(--spacing-sm);
  font-size: 1.3rem;
}

.post h1 {
  font-size: 1.6rem;
}

.post h2 {
  text-decoration: none;
  color: var(--accent-color);
  font-weight: bold;
  position: relative;
  display: inline-block;
  padding-bottom: var(--spacing-xxs);
  margin-bottom: var(--spacing-xxs);
  letter-spacing: 0.5px;
  text-decoration: none;
}

.post h2 a {
  text-decoration: none;
  color: var(--accent-color);
  font-weight: bold;
  position: relative;
  display: inline-block;
  padding-bottom: var(--spacing-xxs);
  margin-bottom: var(--spacing-xxs);
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: color 0.3s ease;
}

.post h2 a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

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

.post-meta {
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.post-meta-left {
  flex: 1;
}

.post-meta-right {
  flex-shrink: 0;
}

/* ============================
   CONTENT STYLES
   ============================ */
.content {
  margin-bottom: var(--spacing-lg);
}

.content > *:first-child {
  margin-top: 0;
}

.content > *:last-child {
  margin-bottom: 0;
}

.content p {
  margin-bottom: var(--spacing-sm);
}

.content ul,
.content ol {
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-lg);
}

.content li {
  margin-bottom: var(--spacing-xs);
}

blockquote {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  padding-left: var(--spacing-lg);
  border-left: 4px solid var(--secondary-color);
  background: transparent;
  font-style: italic;
  color: var(--primary-color);
  font-size: 1.05em;
}

/* ============================
   IMAGES & MEDIA
   ============================ */
.content img:not(.microblog_avatar),
.post img:not(.microblog_avatar) {
  width: 100%;
  height: auto;
  margin: var(--spacing-sm) 0;
  border-radius: 2px;
  border: var(--secondary-color) solid 2px;
}

.photos-grid-item img {
  border: none;
}

.microblog_collection {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(200px, 1fr)
  ) !important; /* Adjust 200px as needed */
  gap: 16px !important; /* Space between images */
  width: 100% !important; /* Full width */
}

.microblog_collection img {
  border: none;
  width: 100% !important;
  height: 200px !important; /* Fixed height */
  object-fit: cover; /* Ensures the image fills its area without distortion */
  display: block;
}

/* ============================
   CODE BLOCKS
   ============================ */
pre {
  background: var(--code-bg);
  padding: var(--spacing-sm);
  border-radius: 4px;
  overflow-x: auto;
  margin: var(--spacing-sm) 0;
}

code {
  background: var(--inline-code-bg);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 2px;
  font-size: 0.9rem;
}

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

/* ============================
   CATEGORIES & METADATA
   ============================ */
.categories {
  margin: 0;
  text-transform: uppercase;
}

.categories a {
  color: var(--secondary-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.categories a:hover {
  color: var(--primary-color-color);
}

/* ============================
   SPECIAL LINKS
   ============================ */
.external-link,
.reply-context {
  margin-top: var(--spacing-sm);
}

.external-link a,
.reply-context a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.external-link a:hover,
.reply-context a:hover {
  color: var(--primary-color);
}

.post a {
  color: var(--secondary-color);
  text-decoration: underline;
  text-decoration-color: var(--secondary-color);
  transition: all 0.2s ease;
}

.post a:hover {
  color: var(--primary-color);
  text-decoration-color: var(--primary-color);
}

.read-more {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.read-more:hover {
  color: var(--primary-hover);
}

/* ============================
   MICRO.BLOG CONVERSATION
   ============================ */
.microblog_conversation {
  border-top: 1px solid var(--border-color);
  margin: var(--spacing-lg) 0 !important;
  padding-top: var(--spacing-lg);
}

.microblog_post {
  margin-bottom: var(--spacing-md) !important;
  padding: var(--spacing-md) !important;
  background: var(--conversation-bg);
  border-radius: 4px;
  border: 1px solid var(--conversation-border);
}

.microblog_post:last-child {
  margin-bottom: 0;
}

.microblog_user {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
}

.microblog_avatar {
  max-width: 30px !important;
  border-radius: 50% !important;
  border: 3px solid var(--primary-color) !important;
  box-shadow: 0 2px 8px var(--shadow-medium) !important;
  flex-shrink: 0 !important;
  object-fit: cover !important;
}

.microblog_fullname {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.95rem;
}

.microblog_text {
  margin-bottom: var(--spacing-xs);
  line-height: 1.5;
  text-align: left;
}

.microblog_text p {
  margin: 0;
  color: var(--primary-color);
}

.microblog_text a {
  color: var(--secondary-color);
  text-decoration: underline;
  text-decoration-color: var(--secondary-color);
  transition: all 0.2s ease;
}

.microblog_text a:hover {
  color: var(--primary-color);
  text-decoration-color: var(--primary-color);
}

.microblog_time {
  font-size: 0.85rem;
  color: var(--secondary-color);
  text-align: left;
  margin-top: var(--spacing-md);
}

.microblog_time a {
  color: var(--secondary-color);
  text-decoration: none;
  text-align: left;
  transition: color 0.2s ease;
}

.microblog_time a:hover {
  color: var(--primary-color);
}

/* ============================
   RESPONSIVE STYLES
   ============================ */
@media (max-width: 768px) {
  body {
    font-size: 20px;
    padding: var(--spacing-md);
  }

  .header-content {
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
  }

  .post {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
    padding: var(--spacing-md);
  }

  .header-content {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: var(--spacing-sm) !important;
  }

  .theme-toggle {
    margin-left: 0 !important;
    justify-content: center;
  }

  .site-title {
    font-size: 1.8rem !important;
  }

  .site-description {
    font-size: 1rem !important;
  }

  nav ul {
    font-size: 1rem;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: var(--spacing-sm) var(--spacing-md) !important;
    row-gap: var(--spacing-sm) !important;
  }
}
