:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --heading-color: #222222;
  --link-color: #0066cc;
  --link-hover-color: #0052a3;
  --border-color: #cccccc;
  --code-bg: #f5f5f5;
  --code-color: #333333;
  --blockquote-border: #dddddd;
  --blockquote-bg: #f9f9f9;
  --table-border: #dddddd;
  --table-header-bg: #f0f0f0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #212121;
    --text-color: #e0e0e0;
    --heading-color: #f0f0f0;
    --link-color: #5ba3e0;
    --link-hover-color: #7db9ea;
    --border-color: #444444;
    --code-bg: #2a2a2a;
    --code-color: #e0e0e0;
    --blockquote-border: #444444;
    --blockquote-bg: #252525;
    --table-border: #444444;
    --table-header-bg: #2a2a2a;
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
  font-weight: 600;
}

h1 { font-size: 2.2em; }
h2 { font-size: 1.8em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.2em; }
h5 { font-size: 1.1em; }
h6 { font-size: 1em; }

p {
  margin: 1em 0;
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

a:hover {
  color: var(--link-hover-color);
  border-bottom-color: var(--link-hover-color);
}

/* Lists */
ul, ol {
  margin: 1em 0;
  padding-left: 2em;
}

li {
  margin: 0.5em 0;
}

/* Code */
code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre {
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 1em;
  border-radius: 5px;
  overflow-x: auto;
  line-height: 1.4;
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Blockquotes */
blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--blockquote-border);
  background-color: var(--blockquote-bg);
  font-style: italic;
}

blockquote p {
  margin: 0.5em 0;
}

/* Tables */
table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

thead, tbody, tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

th, td {
  padding: 0.75em;
  text-align: left;
  border: 1px solid var(--table-border);
}

th {
  background-color: var(--table-header-bg);
  font-weight: 600;
}

tr:nth-child(even) {
  background-color: var(--blockquote-bg);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto;
}

/* Org-mode specific classes */
.title {
  text-align: center;
  margin-bottom: 0.5em;
}

.subtitle {
  text-align: center;
  font-size: 1.2em;
  color: var(--text-color);
  opacity: 0.8;
  margin-bottom: 2em;
}

.outline-2, .outline-3, .outline-4 {
  margin-top: 2em;
}

#table-of-contents {
  background-color: var(--blockquote-bg);
  padding: 1em;
  border-radius: 5px;
  margin: 2em 0;
}

#table-of-contents h2 {
  margin-top: 0;
}

.timestamp {
  color: var(--text-color);
  opacity: 0.7;
  font-size: 0.9em;
}

.tag {
  background-color: var(--code-bg);
  padding: 0.2em 0.6em;
  border-radius: 3px;
  font-size: 0.85em;
  margin-left: 0.5em;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    padding: 15px;
  }

  h1 { font-size: 1.8em; }
  h2 { font-size: 1.5em; }
  h3 { font-size: 1.3em; }

  pre {
    padding: 0.75em;
    font-size: 0.85em;
  }
}

.post-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
    color: #666;
    border-bottom: 1px solid #cccaca;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-family: monospace;
}

@media (prefers-color-scheme: dark) {
    .post-meta {
        color: #aaa;
        border-bottom-color: #888;
    }
}

footer {
    border-top: 1px solid #cccaca;
}

@media (prefers-color-scheme: dark) {
    footer {
        border-top-color: #888;
    }
}

.index-title-date {
  font-size: 0.8em;
  font-weight: normal;
  font-family: monospace;
}

ul.post-list li::marker {
  content: "– ";
  color: #666;
}

/* Navigation styles */

#preamble > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1em 0;
  margin-bottom: 2em;
  border-bottom: 1px solid var(--border-color);
}

#content > header > h1 {
  margin-bottom: 50px;
}

.main-nav {
  display: flex;
  gap: 2em;
  align-items: center;
}

.main-nav a {
  color: var(--text-color);
  font-weight: 500;
  border-bottom: 3px solid transparent;
  padding-bottom: 0.3em;
  transition: border-bottom-color 0.3s ease;
}

.main-nav a:hover {
  color: var(--heading-color);
  border-bottom-color: var(--link-color);
}

/* Hamburger menu */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  z-index: 1001;
  position: relative;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background-color: var(--text-color);
  transition: all 0.3s ease;
  display: block;
}

.hamburger:hover span {
  background-color: var(--link-color);
}

/* Hamburger active state (X) */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translateY(11px) translateX(3px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-8px);
}

/* Side menu */
.side-menu {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background-color: var(--bg-color);
  border-left: 1px solid var(--border-color);
  padding: 4em 2em 2em;
  transition: right 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.side-menu.active {
  right: 0;
}

.side-menu nav {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
}

.side-menu a {
  color: var(--text-color);
  font-size: 1.1em;
  border-bottom: none;
  padding: 0.5em 0;
  border-left: 3px solid transparent;
  padding-left: 1em;
  transition: all 0.2s ease;
}

.side-menu a:hover {
  color: var(--link-color);
  border-left-color: var(--link-color);
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .main-nav {
    gap: 1em;
  }

  .main-nav a {
    font-size: 0.9em;
  }

  .side-menu {
    width: 250px;
    right: -250px;
  }
}
