/* Root variables for easy customization */
:root {
  --primary-color: #2c3e50; /* Dark Blue */
  --accent-color: #3498db;  /* Light Blue */
  --bg-color: #f9f9f9;      /* Light Gray Background */
  --text-color: #333;       /* Dark Text */
  --card-bg: #fff;          /* White Card Background */
  --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Header & Navigation */
header {
  background-color: var(--primary-color);
  color: #fff;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-links {
  list-style: none;
  display: flex;
  padding: 0;
  margin: 0;
}

.nav-links li {
  margin-left: 20px;
}

.nav-links a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--accent-color);
}

/* Sections */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 20px;
}

section {
  padding: 3rem 0;
  border-bottom: 1px solid #ddd;
}

section h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--primary-color);
  font-size: 2rem;
}

/* About Section */
.about-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
}

.about-text {
  flex: 1;
  min-width: 300px;
}

.about-image {
  flex: 1;
  text-align: center;
  min-width: 300px;
}

.profile-pic {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent-color);
}

/* About Read More */
#about-container.collapsed {
  max-height: 280px; /* Adjust height as needed */
  overflow: hidden;
  position: relative;
}

#about-container.collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg-color));
  pointer-events: none;
}

.read-more-btn {
  background-color: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 10px;
  transition: all 0.3s ease;
}

.read-more-btn:hover {
  background-color: var(--accent-color);
  color: white;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
}

.project-card h3 {
  margin-top: 0;
  color: var(--primary-color);
}

/* GitHub Preview Image */
.project-thumb {
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 1rem;
  border: 1px solid #eee;
}

.project-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: bold;
}

/* Blog & Books (General Card Style) */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.list-item {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: bold;
}

/* Modal specific styles */
.modal {
  display: none; 
  position: fixed; 
  z-index: 2000; 
  padding-top: 100px; 
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgb(0,0,0); 
  background-color: rgba(0,0,0,0.4); 
}

.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 800px;
  border-radius: 8px;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

.close-modal {
  color: #aaaaaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

/* Markdown Content Styling within Modal */
.markdown-body {
  font-family: var(--font-main);
  line-height: 1.6;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: var(--primary-color);
  margin-top: 1.5em;
}
.markdown-body code {
  background-color: #f0f0f0;
  padding: 2px 4px;
  border-radius: 4px;
}
.markdown-body pre {
  background-color: #f0f0f0;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
}
.markdown-body img {
  max-width: 100%;
  height: auto;
}

/* Project Preview in Card */
.project-readme-preview {
  margin-top: 10px;
  /* Removed gray background/border for cleaner text look */
  /* background-color: #f4f4f4; */
  /* border: 1px solid #ddd; */
  font-size: 0.95rem; /* Slightly larger for readability */
  color: var(--text-color);
  
  /* Restrict height to show only the "first part" */
  max-height: 250px; /* Increased slightly */
  overflow: hidden;
  position: relative;
}

.project-readme-preview::after {
  /* Fade out effect at the bottom */
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px; /* Longer fade for smoother transition */
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
}

.project-readme-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.project-readme-preview h1 { font-size: 1.4rem; margin-top: 0; }
.project-readme-preview h2 { font-size: 1.2rem; margin-top: 10px; }
.project-readme-preview h3 { font-size: 1.1rem; }


/* Book Content Truncation */
.book-content.collapsed {
  max-height: 220px;
  overflow: hidden;
  position: relative;
  margin-bottom: 15px;
}

.book-content.collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--card-bg));
  pointer-events: none;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  background-color: var(--primary-color);
  color: #fff;
  margin-top: 3rem;
}

.footer-icon {
  text-decoration: none !important;
  display: inline-block;
}

.footer-icon i {
  display: block; /* Helps remove line-height issues */
}

.footer-icon:hover {
  color: var(--accent-color) !important;
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
  nav {
    flex-direction: column;
  }
  
  .nav-links {
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .nav-links li {
    margin: 0 10px;
  }
  
  .about-content {
    flex-direction: column-reverse;
    text-align: center;
  }
}
