@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=JetBrains+Mono:wght@400;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: black;
  background-color: white;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Sidebar ── */

.sidebar {
  flex: 0 0 25%;
  width: 25%;
  min-width: 0;
  padding: 2rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.site-title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.site-title a {
  color: black;
  text-decoration: none;
}

.site-title a:visited {
  color: black;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav a {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  color: #444;
  text-decoration: none;
  padding: 0.2rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.sidebar-nav a:visited {
  color: #444;
}

.sidebar-nav a:hover {
  color: black;
  border-left-color: #ccc;
}

.sidebar-nav a.active {
  color: black;
  font-weight: 700;
  border-left-color: black;
}

/* ── Main content ── */

.main-content {
  flex: 0 0 50%;
  padding: 2rem 2.5rem;
  min-width: 0;
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
}

/* Home page */
.home-header {
  margin-bottom: 1.5rem;
}

.home-header h1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.8rem;
  margin: 0 0 0.25rem;
}

.home-header .email-link {
  font-size: 0.95rem;
}

/* Blog index */
.blog-intro {
  margin-bottom: 1.5rem;
  color: #333;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list .post-meta {
  font-size: 0.85rem;
  color: #888;
  margin-right: 0.75rem;
  font-family: 'Inter', sans-serif;
}

/* Post layout */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 0.4rem;
}

.post-date {
  font-size: 0.85rem;
  color: #888;
  font-family: 'Inter', sans-serif;
  margin: 0;
}

.post-content {
  text-align: justify;
}

/* Page headings */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Links */
a:link,
a:visited {
  color: #0049DB;
}

/* Code */
pre {
  font-size: 13px;
  background-color: #f4f4f4;
  padding: 0.75em 1em;
  overflow-x: auto;
  border-radius: 4px;
  max-width: 100%;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  line-height: 1.4;
  text-align: left;
  margin: 1em 0;
}

code {
  background-color: #f4f4f4;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Figures */
figure {
  margin: 1.8em 0;
}

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

figcaption {
  font-size: 0.85em;
  color: #777;
  margin-top: 0.4em;
  line-height: 1.4;
}

/* Footnotes (Kramdown generates .footnotes with its own <hr> inside) */
.footnotes > hr {
  display: none;
}

.footnotes {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: black;
  padding-top: 0.5rem;
}

.footnotes ol {
  padding-left: 1.25rem;
  margin: 0;
}

.footnotes li {
  margin: 0.2rem 0;
}

/* Footnote back-references */
sup a,
a.footnote,
a.reversefootnote {
  color: black;
  text-decoration: none;
  font-size: 0.8em;
}

hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 1.5rem 0;
}

/* ── Search ── */

.search-form {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.5rem;
  border-top: 1px solid #f0f0f0;
  position: sticky;
  bottom: 0;
  background: white;
}

.search-input {
  width: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  color: black;
  background: white;
}

.search-input:focus {
  border-color: #aaa;
}

.search-input::placeholder {
  color: #bbb;
}

/* ── Sidebar TOC (left sidebar, post pages only) ── */

.sidebar-toc-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.sidebar-toc-section:not(:empty) {
  border-top: 1px solid #f0f0f0;
}

.toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
  padding-left: 0.5rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li a {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  color: #666;
  text-decoration: none;
  display: block;
  padding: 0.15rem 0 0.15rem 0.5rem;
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.toc-list li a:visited {
  color: #666;
}

.toc-list li a:hover {
  color: black;
  border-left-color: #ccc;
}

.toc-list li a.active {
  color: black;
  border-left-color: black;
  font-weight: 600;
}

.toc-list li.toc-h3 a {
  padding-left: 1.25rem;
  font-size: 0.82rem;
}

/* ── Sidebar artwork ── */

.sidebar-artwork {
  margin-top: 1.5rem;
}

.sidebar-artwork img {
  width: 100%;
  display: block;
}

/* ── Site footer ── */

.site-footer {
  flex-basis: 100%;
  border-top: 1px solid #e0e0e0;
  padding: 0.75rem 1.5rem;
  font-size: 0.78rem;
  color: #aaa;
  text-align: center;
}

/* ── Responsive: collapse sidebar to top bar below 700px ── */

@media (max-width: 700px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    flex: none;
    width: 100%;
    min-width: 0;
    height: auto;
    position: static;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }

  .site-title {
    margin-bottom: 0;
    white-space: nowrap;
  }

  .sidebar-artwork {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .sidebar-nav a {
    border-left: none;
    padding-left: 0;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.1rem;
  }

  .sidebar-nav a:hover {
    border-left-color: transparent;
    border-bottom-color: #ccc;
  }

  .sidebar-nav a.active {
    border-left-color: transparent;
    border-bottom-color: black;
  }

  .main-content {
    padding: 1.5rem 1.25rem;
    border-left: none;
    border-right: none;
  }

  .search-form {
    display: none;
  }
}
