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

/* Dark mode variables */
:root {
  --bg-color: #fff;
  --text-color: #000;
  --link-color: #0000EE;
  --border-color: #ccc;
  --muted-color: #666;
  --code-bg: #f5f5f5;
  --highlight-bg: #fff3cd;
}

/* Prevent flash by applying dark mode styles to html element during loading */
.dark-mode-loading {
  background-color: #000;
}

body.dark-mode,
.dark-mode-loading body {
  --bg-color: #000;
  --text-color: #ccc;
  --link-color: #809fff;
  --border-color: #333;
  --muted-color: #999;
  --code-bg: #111;
  --highlight-bg: #333300;
}

/* Hide body content until fully loaded to prevent layout shift */
body {
  opacity: 0;
  transition: opacity 0.15s ease-in;
}

body.loaded {
  opacity: 1;
}

/* Base typography */
body {
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--bg-color);
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  transition: background-color 0.3s, color 0.3s;
}

/* Headers */
h1, h2, h3, h4 {
  font-family: Georgia, serif;
  margin: 20px 0 10px;
}

h1 { 
  font-size: 24px; 
  font-weight: normal;
}
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

/* Logo styling */
.logo-icon {
  display: inline-block;
  width: 40px;
  height: 40px;
  margin-right: 0.5em;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Show/hide logos based on theme */
.logo-light {
  display: inline-block;
}

.logo-dark {
  display: none;
}

body.dark-mode .logo-light {
  display: none;
}

body.dark-mode .logo-dark {
  display: inline-block;
}

/* Links */
a { color: var(--link-color); text-decoration: none; }
a:visited { color: var(--link-color); }
a:hover { text-decoration: underline; }

/* Navigation */
nav {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 20px;
  text-align: left;
}

nav a {
  margin: 0 5px;
}

/* Dark mode toggle */
.theme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  background: none;
  color: var(--muted-color);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: Georgia, serif;
  border-radius: 2px;
}

/* Dropdown styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: none;
  border: none;
  color: var(--link-color);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.dropdown-toggle:hover {
  text-decoration: underline;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  min-width: 120px;
  z-index: 1;
  left: 0;
  top: 100%;
  margin-top: 5px;
}

.dropdown.show .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 5px 10px;
  text-decoration: none;
}

.dropdown-content a:hover {
  background: var(--code-bg);
}

/* Lists */
ul, ol {
  margin-left: 30px;
  margin-bottom: 15px;
}

/* Footer */
footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--muted-color);
  text-align: left;
}

/* General alignment */
main {
  text-align: left;
}

p {
  margin: 10px 0;
}

/* Last updated styling */
.last-updated {
  font-style: italic;
  color: var(--muted-color);
  margin-top: 40px;
}

/* Mobile */
@media (max-width: 600px) {
  body { 
    padding: 15px;
    font-size: 14px;
  }
  
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  h4 { font-size: 14px; }
  
  nav {
    text-align: left;
    padding-bottom: 15px;
  }
  
  nav a { 
    display: inline-block; 
    margin: 5px 8px 5px 0;
    font-size: 14px;
  }
  
  ul, ol {
    margin-left: 20px;
  }
  
  .theme-toggle {
    top: 5px;
    right: 5px;
  }
}