:root {
  --primary-color: #2c3e50;
  --secondary-color: #2980b9;
  --background-light: #f5f6f5;
  --spacing-unit: 1.25em;
}

* {
  box-sizing: border-box; /* Prevent padding/margin issues */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Arial', 'Helvetica', sans-serif;
  line-height: 1.8;
  margin: 0 auto;
  max-width: 900px;
  padding: 25px;
  background-color: #fdfdfd;
  color: #222;
  display: flex;
  flex-direction: column;
  align-items: center; /* Center all body content */
}

h1 {
  color: var(--primary-color);
  font-size: 2.2em;
  text-align: center; /* Centered heading */
  margin-bottom: 0.5em;
  font-weight: 700;
}

h2 {
  color: var(--primary-color);
  font-size: 1.6em;
  text-align: center; /* Centered heading */
  margin-top: 2em;
  margin-bottom: 0.75em;
  font-weight: 600;
}

h3 {
  color: var(--primary-color);
  font-size: 1.4em;
  text-align: center; /* Centered heading */
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

p {
  margin-bottom: var(--spacing-unit);
  font-size: 1.1em;
}

li {
  margin-bottom: 0.5em;
  font-size: 1.1em;
}

.highlight {
  background-color: var(--background-light);
  padding: 15px;
  border-left: 5px solid var(--primary-color);
  border-radius: 4px;
  transition: border-color 0.3s ease;
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

a:hover {
  color: #1a5276;
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em auto; /* Center images */
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Lighter shadow for performance */
}

.center {
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 1em;
  display: block;
  overflow-x: auto; /* Responsive tables on mobile */
}

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

th {
  background-color: #e5e7eb;
  font-weight: 600;
  color: #374151;
}

th[scope="col"] {
  background-color: var(--primary-color);
  color: #fff;
}

blockquote {
  margin: 1.5em 1em;
  padding: 15px 20px;
  background-color: #f9fafb;
  border-left: 5px solid #7f8c8d;
  font-style: italic;
  color: #4b5e6d;
}

nav ul {
  list-style: none;
  padding: 0;
  text-align: center; /* Center navigation */
}

nav li {
  display: inline-block; /* Compact, centered nav */
  margin: 0.5em 1em;
}

nav a[aria-current="page"] {
  color: var(--primary-color);
  font-weight: 700;
}

pre, code {
  background-color: var(--background-light);
  padding: 10px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
}

/* New .video class for responsive video embeds */
.video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 1.5em auto;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

/* Optional Dark Mode (uncomment to enable) */
/*
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #e0e0e0;
  }
  h1, h2, h3 {
    color: #ffffff;
  }
  .highlight {
    background-color: #2a2a2a;
    border-left-color: var(--secondary-color);
  }
  th {
    background-color: #333;
    color: #fff;
  }
  th[scope="col"] {
    background-color: var(--secondary-color);
  }
  .video {
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
  }
}
*/

@media (max-width: 600px) {
  body {
    max-width: 100%;
    padding: 15px;
  }

  h1 {
    font-size: 1.8em;
  }

  h2 {
    font-size: 1.4em;
  }

  h3 {
    font-size: 1.2em;
  }

  p, blockquote, li {
    font-size: 1em;
  }

  nav li {
    display: block; /* Stack nav on mobile */
    margin: 0.75em 0; /* Slightly more spacing */
  }
}