/* Base styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #ffffff;
  color: #333333;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

img {
  max-width: 100%;
  height: auto;
}

header, footer {
  background-color: #f5f5f5;
  padding: 15px 20px;
}

/* Header link styling */
header h1 a {
  color: #765FFF;
  text-decoration: none;
}

header h1 a:hover {
  text-decoration: underline;
}

/* Base link colors */
a {
  color: #0066cc;
}

/* Article body links should be underlined for clarity */
article a {
  text-decoration: underline;
}

/* Link underline handling - no underlines in tag cloud and article lists */
#tagcloud a,
.taglist a,
main ul li a {
  text-decoration: none;
}

#tagcloud a:hover,
.taglist a:hover,
main ul li a:hover {
  text-decoration: underline;
}

/* Override: Ensure links INSIDE article content are underlined even in lists */
article ul li a,
article ol li a {
  text-decoration: underline;
}

/* Table styling */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  font-size: 0.95rem;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid #e0e0e0;
}

th {
  background-color: #f8f8f8;
  font-weight: 600;
  border-bottom: 2px solid #ccc;
}

tr:nth-child(even) {
  background-color: #fafafa;
}

tr:hover {
  background-color: #f0f0f0;
}

td code {
  background-color: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Dark Mode - Automatic via system preference */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #e0e0e0;
  }

  header, footer {
    background-color: #1e1e1e;
  }

  /* Link colors for dark mode - lighter for contrast */
  a {
    color: #66b3ff;
  }

  /* Table styling in dark mode */
  th, td {
    border-color: #444;
  }

  th {
    background-color: #2a2a2a;
    border-bottom-color: #555;
  }

  tr:nth-child(even) {
    background-color: #1a1a1a;
  }

  tr:hover {
    background-color: #252525;
  }

  td code {
    background-color: #2a2a2a;
  }
}

/* Responsive */
@media (max-width: 768px) {
  main {
    padding: 15px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  th, td {
    padding: 8px 10px;
  }
}
