/* Custom styles for 罗一阳's Insights */

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

/* Remove default margins that cause gaps */
.home main,
.home .post-content,
.home .entry-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Homepage styling */
.home-intro {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}

.home-intro h1 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.home-intro .subtitle {
  font-size: 1.05rem;
  margin: 0.75rem 0 1.25rem;
  opacity: 0.85;
  line-height: 1.6;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.home-intro .description {
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.75;
  font-size: 1rem;
  color: var(--content);
}

.home-intro .description p {
  margin: 0 0 1rem;
}

.home-intro .description p:last-child {
  margin-bottom: 0;
}

/* Recent articles section */
.recent-articles-section {
  padding: 2rem;
  border-radius: 15px;
  margin: 2rem 0;
  text-align: center;
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.recent-articles-section h2 {
  margin-bottom: 1rem;
  color: var(--primary);
}

.recent-articles-section .description {
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

/* Button styling */
.home-button {
  display: inline-block;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.75rem 2rem;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.home-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

/* Post list styling */
.post-list {
  margin-top: 2rem;
}

/* Homepage hero + posts layout */
.hero-section {
  padding: 4rem 0 3rem;
  background: linear-gradient(135deg, var(--theme) 0%, var(--code-bg) 100%);
  margin-bottom: 3rem;
  border-radius: 0 0 20px 20px;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.profile-image {
  flex-shrink: 0;
}

.profile-img {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: clamp(2.25rem, 4vw, 3.2rem);
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.hero-subtitle a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.hero-description {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 620px;
  color: var(--content);
}

.hero-tags {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tag {
  background: rgba(0, 0, 0, 0.08);
  color: var(--content);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.all-posts-section {
  padding: 1rem 0 2rem;
}

.section-title {
  text-align: center;
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  margin-bottom: 2rem;
  color: var(--primary);
}

.posts-list {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  gap: 1.5rem;
}

.post-item {
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

.post-title {
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
  color: var(--primary);
}

.post-excerpt {
  margin-bottom: 1rem;
  line-height: 1.65;
  color: var(--content);
  opacity: 0.85;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.post-category {
  background: var(--code-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
}

.about-section {
  padding: 3rem 0;
  background: var(--code-bg);
  border-radius: 24px;
  margin: 2.5rem auto 3rem;
  max-width: 960px;
}

.about-section .section-title {
  margin-bottom: 1.5rem;
}

.about-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.about-content p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.about-content .about-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

.about-content .about-hero-media {
  flex-shrink: 0;
}

.about-content .about-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.about-content .about-hero-text {
  flex: 1;
  padding-top: 0.25rem;
}

@media (max-width: 768px) {
  .about-content .about-hero {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: left;
  }

  .about-content .about-photo {
    width: 72px;
    height: 72px;
  }
}

.fade-in {
  animation: fadeIn 0.8s ease-out both;
}

.fade-in:nth-of-type(2) {
  animation-delay: 0.1s;
}

.fade-in:nth-of-type(3) {
  animation-delay: 0.2s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ensure post entries are consistent */
.post-entry {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  background: var(--entry);
  border: 1px solid var(--border);
}

.post-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.post-entry-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.post-entry-content {
  opacity: 0.8;
  margin-bottom: 0;
  line-height: 1.6;
}

/* Fix spacing issues */
.home main,
.home .post-content,
.home .entry-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.home .post-list {
  margin-top: 1rem;
}

.home .post-list .post-entry {
  margin-bottom: 1rem;
}

.home .post-list .post-entry:last-child {
  margin-bottom: 0;
}

/* Remove extra spacing */
.home .post-content {
  padding-top: 0;
  margin-top: 0;
}

.home main {
  padding-top: 0;
}

/* Ensure consistent line heights */
.entry-content p,
.post-entry-content p {
  line-height: 1.6;
  margin: 0 0 0.5rem;
}

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

/* Fix meta information spacing */
.post-meta {
  margin-top: 0.5rem;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* Ensure text doesn't overflow */
.entry-content,
.post-entry-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .recent-articles-section {
    background: var(--border);
  }

  .post-entry {
    background: var(--entry);
    border-color: var(--border);
  }

  .hero-section {
    background: linear-gradient(135deg, var(--theme) 0%, var(--border) 100%);
  }

  .about-section {
    background: var(--border);
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .home-intro h1 {
    font-size: 2rem;
  }

  .recent-articles-section {
    padding: 1.5rem;
  }

  .post-entry {
    padding: 1rem;
  }

  .hero-content {
    flex-direction: column;
    text-align: center;
    padding: 0 1.5rem;
  }

  .profile-img {
    width: 150px;
    height: 150px;
  }

  .posts-list {
    padding: 0 1.5rem;
  }

  .post-meta {
    justify-content: center;
  }

  .about-section {
    margin: 2rem 1rem;
  }
}

/* Modern homepage design */

/* Homepage specific styles */
.homepage-content {
  padding-top: 0;
  margin-top: 0;
}

.home .main-content {
  padding-top: 0;
}

/* Remove breadcrumbs on homepage */
.home .breadcrumbs {
  display: none;
}

.home .post-header {
  display: none;
}

/* Ensure consistent header styling */
.main-header {
  background: var(--theme);
  color: var(--on-theme);
}

/* Fix for theme switching */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hide theme toggle if causing issues */
#theme-toggle {
  display: none;
}

/* Make sure all text is readable */
.entry-content p,
.entry-content li {
  line-height: 1.7;
}

/* Fix any remaining color issues */
.entry-content {
  color: var(--content);
}

.entry-header {
  color: var(--content);
}

/* Ensure links are visible */
.entry-content a {
  color: var(--primary);
}

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