:root {
  --bg-color: #e5e7eb;
  /* Light gray background for "desk" feel */
  --paper-bg: #ffffff;
  --text-color: #000000;
  --text-secondary: #333333;
  --accent-color: #000000;
  /* Minimalist black/standard link blue */
  --accent-hover: #333333;
  --card-bg: #ffffff;
  --card-border: #cccccc;
  --header-bg: #ffffff;
  --tag-bg: #f3f4f6;
  --tag-text: #374151;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --paper-bg: #2d2d2d;
  --text-color: #f0f0f0;
  --text-secondary: #cccccc;
  --accent-color: #60a5fa;
  --card-border: #404040;
  --header-bg: #1a1a1a;
  /* Match body bg or slightly lighter */
  --card-bg: #2d2d2d;
  --tag-bg: #404040;
  --tag-text: #e5e5e5;
}

body {
  font-family: 'Times New Roman', 'Georgia', serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

header {
  background-color: var(--header-bg);
  padding: 4rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
}

.profile-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid var(--bg-color);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 1rem 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.social-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 1rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

.container {
  max-width: 1024px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

section {
  margin-bottom: 5rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 2.5rem;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--text-color);
  display: block;
}

.about-text {
  font-size: 1.2rem;
  /* Enlarge text slightly */
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

/* Featured Project Card */
.featured-project {
  grid-column: 1 / -1;
  border: 2px solid var(--accent-color);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.card h3 {
  margin: 0;
  font-size: 1.5rem;
}

.card h3 a {
  color: var(--text-color);
  text-decoration: none;
}

.card h3 a:hover {
  color: var(--accent-color);
}

.badge-featured {
  background: var(--accent-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.card p {
  color: var(--text-secondary);
  flex-grow: 1;
}

.tags {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Toggle Switch */
.theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.5rem;
}

footer {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--card-border);
  margin-top: 4rem;
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .container {
    padding: 0 0.5rem;
    /* Restore small padding for main page content */
  }

  header {
    padding: 3rem 1rem;
  }

  .about-text {
    padding: 0 0.5rem;
    /* Add extra breathing room for about text on mobile */
  }
}

/* Code Block Styles */
pre {
  background: var(--tag-bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--card-border);
  margin: 1.5rem 0;
}

code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

pre code {
  color: var(--text-color);
  background: none;
  padding: 0;
}

/* Post Content Images */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  /* Remove rounded corners for formal look */
  display: block;
  margin: 2rem auto;
  border: 1px solid var(--card-border);
  padding: 5px;
  background: var(--card-bg);
}

/* IEEE Specific Layout Items */
.post-container {
  max-width: 850px;
  margin: 3rem auto;
  padding: 4rem;
  background: var(--paper-bg);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}

.post-header {
  margin-bottom: 3rem;
  border-bottom: 2px solid var(--text-color);
  padding-bottom: 1rem;
}

.post-meta {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 1rem;
}

.post-meta .author {
  font-weight: bold;
  font-style: normal;
  font-size: 1.1em;
}

.post-meta .divider {
  margin: 0 10px;
}

.post-content {
  text-align: justify;
  font-size: 1.15rem;
  line-height: 1.8;
}

.post-content p {
  margin-bottom: 1.5rem;
  text-indent: 2rem;
  /* Classic paragraph indent */
}

.post-content h3 {
  font-style: italic;
  font-weight: bold;
  margin-top: 2rem;
}

.tags {
  justify-content: center;
  margin-top: 1rem;
}

.tag {
  background: none;
  border: 1px solid var(--text-secondary);
  border-radius: 0;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 2px 8px;
}

@media (max-width: 768px) {
  .post-container {
    padding: 1.5rem 1.5rem;
    margin: 0.5rem 0;
    /* Top/Bottom margin only. Side is handled by container padding */
    width: auto;
    /* Fill available space minus margin */
    border: 1px solid var(--card-border);
    /* Restore border */
    border-radius: 0;
    /* Keep it sharp */
    box-shadow: none;
  }

  h1 {
    font-size: 1.8rem;
    /* Smaller title for mobile */
    line-height: 1.3;
  }

  .abstract {
    margin: 1.5rem 0.5rem;
    /* Much smaller margins for mobile */
  }

  .post-content h1,
  .post-content h2,
  .post-content h3,
  .post-content h4,
  .post-content h5,
  .post-content h6 {
    text-align: left;
    /* Prevent weird spacing from justification on mobile */
    text-align-last: left;
  }
}

.abstract {
  margin: 2rem 4rem;
  /* Desktop margins */
  text-align: justify;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
}

.abstract-label {
  font-weight: bold;
  font-style: normal;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.keywords {
  margin: 1rem 4rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: justify;
}

.keywords-label {
  font-weight: bold;
  font-style: normal;
}

@media (max-width: 768px) {
  .keywords {
    margin: 1rem 0.5rem;
  }
}

.card .keywords {
  margin: 1rem 0 0 0;
  text-align: left;
  font-size: 0.85rem;
}
/* Card Action Buttons */
.card-actions {
  margin-top: 1.5rem;
}

.btn-card {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--text-color);
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  transition: all 0.2s ease;
  background: transparent;
}

.btn-card:hover {
  background: var(--text-color);
  color: var(--card-bg);
  text-decoration: none;
}
