:root {
  --dark: hsl(0deg, 0%, 8%);
  --light: hsl(0deg, 0%, 90%);
  --grey: hsl(0deg, 0%, 35%);
  --primary: hsl(250deg, 100%, 75%);
  --highlight-selection-background-color: hsl(0deg, 0%, 45%);
  --heading-font: 'Gelasio', serif;
  --body-font: 'Source Sans 3', sans-serif;
  --measure: 70ch;
  --bg-color: hsl(0deg, 0%, 94%);
  --text-color: var(--dark);
  --highlight-bg-color: var(--dark);
  --highlight-text-color: var(--light);
  --copyright-color: var(--grey);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: hsl(0deg, 0%, 8%);
    --text-color: hsl(0deg, 0%, 80%);
    --highlight-bg-color: hsl(0deg, 0%, 85%);
    --highlight-text-color: hsl(0deg, 0%, 0%);
    --copyright-color: hsl(0deg, 0%, 60%);
    --primary: hsl(250deg, 100%, 75%);
  }
}

body {
  font-size: 1.15rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  background-color: var(--bg-color);
  font-family: var(--body-font);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 4rem 2rem 4rem 2rem;
  margin: 0 0 0 10%;
  max-width: var(--measure);
  word-wrap: break-word;
  transition: background-color 0.8s ease, color 0.8s ease;
}

body.dark-theme {
  -webkit-font-smoothing: subpixel-antialiased;
  letter-spacing: 0.01rem;
}

#theme-toggle {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.3s;
  margin-left: 1.5rem;
}

#theme-toggle:hover {
  opacity: 1;
}

@media (max-width: 1200px) {
  body {
    margin-left: 5%;
  }
}

@media (max-width: 800px) {
  body {
    margin-left: 0;
    padding: 2.5rem 1.2rem;
    font-size: 1.1rem;
    line-height: 1.65;
  }
  
  .hero-intro {
    font-size: 1.8rem;
    line-height: 1.3;
  }
}

header h1 {
  font-family: var(--heading-font);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 4rem 0;
  letter-spacing: -0.02em;
}

header h1 a {
  text-decoration: none;
  color: var(--text-color);
  display: flex;
  align-items: baseline;
}

.title-phd {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--grey);
  margin-left: 0.4rem;
  font-family: var(--heading-font);
  text-transform: none;
}

header h1 span.cursor {
  display: inline-block;
  animation: blink 1s step-end infinite;
  margin-left: 0.1rem;
  color: var(--text-color);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-intro {
  font-family: var(--heading-font);
  font-size: 2.5rem;
  line-height: 1.2;
  font-weight: 400;
  margin-bottom: 3rem;
  color: var(--text-color);
  letter-spacing: -0.02em;
}

.hero-intro em {
  font-style: italic;
  font-weight: 700;
}

h2 {
  font-family: var(--heading-font);
  font-size: 2rem;
  font-weight: 700;
  margin-top: 4rem;
  margin-bottom: 1.5rem;
}

p {
  margin-bottom: 1.5rem;
  max-width: 60ch;
}

a {
  color: var(--text-color);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.7;
  color: var(--primary);
}

ul {
  list-style: none;
  padding: 0;
}

li {
  margin-bottom: 1rem;
}

.post-item {
  display: flex;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.post-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  color: var(--grey);
  margin-right: 1.5rem;
  min-width: 100px;
  flex-shrink: 0;
}

.post-item a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.post-item a:hover {
  border-bottom: 1px solid var(--text-color);
}

footer {
  margin-top: 6rem;
  font-size: 0.9rem;
  color: var(--copyright-color);
  padding-top: 2rem;
}

footer nav {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
}

footer nav a {
  text-decoration: none;
  color: var(--copyright-color);
}

@media (max-width: 600px) {
  .hero-intro { font-size: 2.2rem; }
  .post-item { flex-direction: column; margin-bottom: 1.2rem; }
  .post-date { margin-bottom: 0.2rem; }
}
