:root {
  --max-width: 860px;
  --border-color: #e0e0e0;
  --text-color: #222;
  --muted-color: #666;
  --accent-color: #3b5bdb;
  --bg-color: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text-color);
  background: var(--bg-color);
  line-height: 1.6;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ---- Header / nav ---- */

.site-header {
  border-bottom: 1px solid var(--border-color);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-color);
}

.site-title:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.site-nav-link {
  color: var(--muted-color);
}

.site-nav-link:hover,
.site-nav-link.active {
  color: var(--accent-color);
  text-decoration: none;
}

/* ---- Main / footer ---- */

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.site-footer {
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--muted-color);
  font-size: 0.85rem;
  padding: 1.5rem 1.25rem;
}

/* ---- Collection list pages (Projects / Software / Blog) ---- */

.box-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.box-link {
  display: block;
  color: inherit;
}

.box-link:hover {
  text-decoration: none;
}

.box {
  display: flex;
  gap: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.box-link:hover .box {
  border-color: var(--accent-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.box-image {
  flex: 0 0 180px;
  max-width: 180px;
  background: #f2f2f2;
}

.box-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.box-image-placeholder {
  width: 100%;
  height: 100%;
  min-height: 120px;
  background: #f2f2f2;
}

.box-body {
  flex: 1 1 auto;
  padding: 1rem 1rem 1rem 0;
  min-width: 0;
}

.box-title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.box-date {
  margin: 0 0 0.5rem;
  color: var(--muted-color);
  font-size: 0.85rem;
}

.box-excerpt {
  margin: 0;
  color: var(--text-color);
}

@media (max-width: 480px) {
  .box {
    flex-direction: column;
  }

  .box-image {
    flex: none;
    max-width: 100%;
    height: 140px;
  }

  .box-body {
    padding: 1rem;
  }
}

/* ---- Detail pages (project_like, blog_post) ---- */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.project-detail-image,
.blog-post-image {
  width: 100%;
  border-radius: 8px;
  margin: 1rem 0;
}

/* ---- Callout box: wrap a section of Markdown in a bordered card ---- */
/* Usage: <div class="callout" markdown="1"> ...markdown... </div> */

.callout {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  background: #e3e7f6;
  border-color: #4a4f5f;
  margin: 1rem 0;
}

.callout-example{
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  background: #eadcf1;
  border-color: #3e363e;
  margin: 1rem 0;
}



.callout > *:first-child {
  margin-top: 0;
}

.callout > *:last-child {
  margin-bottom: 0;
}

/* ---- Coursework dropdown: collapsible <details> list (e.g. index.md) ---- */

.coursework-list details {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  margin: 0.5rem 0;
}

.coursework-list summary {
  cursor: pointer;
  font-weight: 600;
}

.coursework-list details[open] summary {
  margin-bottom: 0.5rem;
}

/* ---- Placement helpers for inline content images (e.g. index.md) ---- */

.avatar-left {
  float: left;
  width: 200px;
  border-radius: 8px;
  margin: 0 1.5rem 1rem 0;
}

.avatar-right {
  float: right;
  width: 200px;
  border-radius: 8px;
  margin: 0 0 1rem 1.5rem;
}

.avatar-center {
  display: block;
  width: 200px;
  border-radius: 8px;
  margin: 0 auto 1rem;
}

/* image center*/
.image-center {
  display: block;
  width: 600px;
  border-radius: 1px;
  margin: 0 auto 1rem;
}

@media (max-width: 480px) {
  .avatar-left,
  .avatar-right {
    float: none;
    margin: 0 auto 1rem;
  }
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.gallery img {
  flex: 1 1 200px;
  width: auto;
  max-width: 370px;
  height: 400px;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
}

/* CSS-only lightbox: click a gallery image to open, click overlay to close */
.lightbox-target {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(211, 179, 209, 0.85);
}

.lightbox-target:target {
  display: flex;
}

.lightbox-target img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}

/* ---- Pseudocode / algorithm block ---- */
/* Usage: <div class="pseudocode"><div class="pseudocode-title">...</div><ol>...</ol></div> */

.pseudocode {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  background: #f6f8fa;
  margin: 1.5rem 0;
}

.pseudocode-title {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.pseudocode ol {
  margin: 0;
  padding-left: 1.5rem;
}

.pseudocode li {
  margin: 0.6rem 0;
}

.pseudocode-note {
  color: var(--muted-color);
  font-size: 0.85rem;
}

.project-detail-date,
.post-meta {
  color: var(--muted-color);
  font-size: 0.9rem;
}

.project-detail-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0.5rem 0;
}

.project-detail-tags li {
  background: #f0f2ff;
  color: var(--accent-color);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
}

.project-detail-links {
  padding: 0;
  margin: 0.75rem 0 1.5rem;
  list-style: none;
  display: flex;
  gap: 1rem;
}

/* ---- Blog content: media, code, math, footnotes ---- */

.media-video,
.media-figure {
  margin: 1.5rem 0;
}

.media-video video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}

.media-caption,
.media-figure figcaption {
  color: var(--muted-color);
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.post-content pre {
  padding: 1rem;
  overflow-x: auto;
  border-radius: 6px;
  background: #f6f8fa;
}

.post-content code {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.9em;
}

/* ---- Collapsible code block ---- */
/* Usage: <details class="code-dropdown" markdown="1"><summary>label</summary>
   ```julia ... ``` </details> */
.post-content details.code-dropdown {
  margin: 1rem 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.post-content details.code-dropdown summary {
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  user-select: none;
}

.post-content details.code-dropdown[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.post-content details.code-dropdown pre {
  margin: 0;
  border-radius: 0 0 6px 6px;
}

/*proof dropdown*/
.post-content details.proof-dropdown {
  margin: 1rem 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.post-content details.proof-dropdown summary {
  cursor: pointer;
  padding: 1rem 1rem;
  font-size: 0.9rem;
  user-select: none;
}

.post-content details.proof-dropdown[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.post-content details.proof-dropdown[open] summary ~ * {
  margin-left: 1rem;
  margin-right: 1rem;
}

.post-content details.proof-dropdown[open] summary ~ *:last-child {
  margin-bottom: 1rem;
}

.footnotes {
  border-top: 1px solid var(--border-color);
  margin-top: 2.5rem;
  padding-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted-color);
}

.post-references {
  border-top: 1px solid var(--border-color);
  margin-top: 2.5rem;
  padding-top: 1rem;
  font-size: 0.9rem;
}

/* ---- Table of contents (_includes/toc.html) ---- */
/* Fixed in the right margin beside the 860px column; hidden when the
   viewport is too narrow to fit it. */

.toc {
  position: fixed;
  top: 6rem;
  left: calc(50% + var(--max-width) / 2 + 1.5rem);
  width: 220px;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  font-size: 0.85rem;
  border-left: 1px solid var(--border-color);
  padding-left: 0.75rem;
}

.toc-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

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

.toc li {
  margin: 0.3rem 0;
}

.toc li.toc-h3 {
  padding-left: 0.9rem;
}

.toc a {
  color: var(--muted-color);
}

.toc a.active {
  color: var(--accent-color);
  font-weight: 600;
}

.post-content h2, .post-content h3,
.project-detail-body h2, .project-detail-body h3 {
  scroll-margin-top: 1.5rem;
}

@media (max-width: 1400px) {
  .toc { display: none; }
}

/* Boxes from _plugins/theorem_env.rb: keep linked boxes clear of the top edge. */
.callout[id], .callout-example[id] {
  scroll-margin-top: 1.5rem;
}
