/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-eureka: #38b2ac;
  --color-primary-bg: rgb(242, 242, 247);
  --color-secondary-bg: rgb(255, 255, 255);
  --color-tertiary-bg: rgb(242, 242, 247);
  --color-primary-text: rgba(0, 0, 0, 0.85);
  --color-secondary-text: rgba(0, 0, 0, 0.7);
  --color-tertiary-text: rgba(0, 0, 0, 0.55);
}

html.dark {
  --color-eureka: #38b2ac;
  --color-primary-bg: rgb(0, 0, 0);
  --color-secondary-bg: rgb(28, 28, 30);
  --color-tertiary-bg: rgb(44, 44, 46);
  --color-primary-text: rgba(255, 255, 255, 0.85);
  --color-secondary-text: rgba(255, 255, 255, 0.7);
  --color-tertiary-text: rgba(255, 255, 255, 0.55);
}

body {
  font-family: "Lora", Georgia, serif;
  background-color: var(--color-primary-bg);
  color: var(--color-secondary-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-primary-text);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}

a {
  color: var(--color-primary-text);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--color-eureka);
}

code {
  direction: ltr;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.9em;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-md {
  max-width: 900px;
}

/* Header */
.header {
  background-color: var(--color-secondary-bg);
  border-bottom: 1px solid var(--color-tertiary-bg);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary-text);
  margin-right: 1.5rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--color-primary-text);
  cursor: pointer;
  padding: 0.5rem;
}

.nav-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--color-primary-text);
  padding: 0.5rem 0;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
}

.nav-actions {
  display: flex;
  gap: 1rem;
}

.theme-toggle-wrapper {
  position: relative;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.theme-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background-color: var(--color-secondary-bg);
  border: 1px solid var(--color-tertiary-bg);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  min-width: 150px;
  z-index: 1000;
}

.theme-menu.active {
  display: block;
}

.theme-option {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--color-secondary-text);
  font-family: inherit;
  transition: color 0.3s ease;
}

.theme-option:hover {
  color: var(--color-eureka);
}

/* Hero */
.hero {
  background-color: var(--color-secondary-bg);
  padding: 6rem 0;
  text-align: center;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

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

/* Sections */
.section {
  padding: 3rem 0;
}

.section-alt {
  background-color: var(--color-secondary-bg);
}

.section-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.section-description {
  color: var(--color-secondary-text);
  margin-bottom: 2rem;
  font-size: 1.125rem;
}

.page-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

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

/* Grids */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* Cards */
.card {
  background-color: var(--color-secondary-bg);
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.card-title a {
  color: var(--color-primary-text);
}

.card-date {
  font-size: 0.875rem;
  color: var(--color-tertiary-text);
  margin-bottom: 0.75rem;
  display: block;
}

.card-description {
  color: var(--color-secondary-text);
  margin-bottom: 1rem;
  flex: 1;
}

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

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--color-tertiary-bg);
  color: var(--color-secondary-text);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Features */
.feature {
  text-align: center;
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.feature-description {
  color: var(--color-secondary-text);
}

/* Post */
.post-header {
  background-color: var(--color-secondary-bg);
  padding: 3rem 0;
  border-bottom: 1px solid var(--color-tertiary-bg);
}

.back-link {
  display: inline-block;
  color: var(--color-eureka);
  margin-bottom: 1rem;
}

.post-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--color-secondary-text);
}

.separator {
  color: var(--color-tertiary-text);
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-content {
  padding: 3rem 0;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-tertiary-bg);
}

/* Prose */
.prose {
  max-width: 100%;
  word-wrap: break-word;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2em;
  margin-bottom: 1em;
}

.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}

.prose p {
  margin-bottom: 1.5em;
}

.prose ul,
.prose ol {
  margin-bottom: 1.5em;
  padding-left: 2em;
}

.prose li {
  margin-bottom: 0.5em;
}

.prose pre {
  background-color: var(--color-tertiary-bg);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5em;
}

.prose code {
  background-color: var(--color-tertiary-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

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

.prose blockquote {
  border-left: 4px solid var(--color-eureka);
  padding-left: 1rem;
  font-style: italic;
  color: var(--color-secondary-text);
  margin: 1.5em 0;
}

.prose a {
  color: var(--color-eureka);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

.prose th,
.prose td {
  border: 1px solid var(--color-tertiary-bg);
  padding: 0.75rem;
  text-align: left;
}

.prose th {
  background-color: var(--color-tertiary-bg);
  font-weight: 600;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* KaTeX */
.katex {
  font-size: 1.1em;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

/* Profile Section */
.profile-section {
  background-color: var(--color-secondary-bg);
  padding: 3rem 0;
  border-bottom: 1px solid var(--color-tertiary-bg);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

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

.profile-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--color-tertiary-bg);
}

.profile-vertical-separator {
  width: 1px;
  height: 120px;
  background-color: var(--color-tertiary-bg);
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary-text);
  margin-bottom: 0.5rem;
  display: inline-block;
  position: relative;
}

.profile-separator {
  width: 100%;
  max-width: 200px;
  height: 1px;
  background-color: var(--color-tertiary-bg);
  margin-top: 0.5rem;
}

.profile-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-primary-text);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.profile-icon {
  color: var(--color-secondary-text);
}

.profile-description {
  color: var(--color-secondary-text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.profile-social {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0;
}

.social-link {
  color: var(--color-primary-text);
  transition: color 0.3s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-link:hover {
  color: var(--color-eureka);
  transform: scale(1.1);
}

/* Footer */
.footer {
  background-color: var(--color-secondary-bg);
  border-top: 1px solid var(--color-tertiary-bg);
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
}

.footer p {
  color: var(--color-tertiary-text);
  font-size: 0.875rem;
}

.footer a {
  color: var(--color-tertiary-text);
}

.footer a:hover {
  color: var(--color-eureka);
}

.profile-name {
  font-size: 1.75rem;
  font-weight: 300;
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 1rem 0;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-tertiary-bg);
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.75rem;
  }
  h3 {
    font-size: 1.5rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-title {
    font-size: 2rem;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .profile-image {
    width: 200px;
    height: 200px;
  }

  .profile-vertical-separator {
    display: none;
  }

  .profile-name {
    font-size: 1.75rem;
    font-weight: 300;
  }

  .profile-title {
    justify-content: center;
    margin-bottom: 1.5rem;
  }

  .profile-social {
    flex-direction: row;
    justify-content: center;
  }
}
