/* ── Override LaTeX.css body width ── */
body {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

/* ── Dot canvas ── */
#dot-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Everything else above canvas */
nav, main, footer {
  position: relative;
  z-index: 1;
}

/* ── Dark theme overrides ── */
body.latex-dark {
  --body-color: hsl(0, 0%, 90%);
  --body-bg-color: #000;
  --link-visited: hsl(196, 80%, 77%);
  --link: hsl(196, 80%, 77%);
  --code-bg-color: hsl(0, 0%, 12%);
  --kbd-bg-color: hsl(0, 0%, 12%);

  background-color: #000;
  color: hsl(0, 0%, 90%);
}

/* ── Light mode ── */
body:not(.latex-dark) {
  --body-color: hsl(0, 5%, 10%);
  --body-bg-color: hsl(210, 20%, 98%);
  --link: hsl(0, 100%, 33%);
  --link-visited: hsl(0, 100%, 33%);

  background-color: hsl(210, 20%, 98%);
  color: hsl(0, 5%, 10%);
}

body:not(.latex-dark) nav {
  border-bottom-color: hsl(0, 0%, 80%);
}

body:not(.latex-dark) .nav-name {
  color: hsl(0, 5%, 10%);
}

body:not(.latex-dark) nav .nav-link {
  color: hsl(0, 0%, 40%);
}

body:not(.latex-dark) nav .nav-link.active,
body:not(.latex-dark) nav .nav-link:hover {
  color: hsl(0, 5%, 10%);
  border-bottom-color: hsl(0, 5%, 10%);
}

body:not(.latex-dark) #theme-toggle {
  color: hsl(0, 5%, 10%);
  border-color: hsl(0, 0%, 70%);
}

body:not(.latex-dark) #theme-toggle:hover {
  background: hsl(0, 0%, 90%);
}

body:not(.latex-dark) .section-nav {
  border-bottom-color: hsl(0, 0%, 80%);
}

body:not(.latex-dark) .section-nav a {
  color: hsl(0, 0%, 40%);
}

body:not(.latex-dark) .section-nav a:hover {
  color: hsl(0, 5%, 10%);
}

body:not(.latex-dark) section h2 {
  border-bottom-color: hsl(0, 0%, 80%);
}

body:not(.latex-dark) .entry-date {
  color: hsl(0, 0%, 45%);
}

body:not(.latex-dark) .entry-subtitle {
  color: hsl(0, 0%, 40%);
}

body:not(.latex-dark) .entry-detail {
  color: hsl(0, 0%, 42%);
}

body:not(.latex-dark) .entry-detail strong {
  color: hsl(0, 0%, 20%);
}

body:not(.latex-dark) .interest-list li {
  border-color: hsl(0, 0%, 75%);
}

body:not(.latex-dark) .contact-list li::before {
  color: hsl(0, 0%, 55%);
}

body:not(.latex-dark) .post-list .post-date,
body:not(.latex-dark) .post-meta {
  color: hsl(0, 0%, 45%);
}

body:not(.latex-dark) footer {
  color: hsl(0, 0%, 55%);
}

body:not(.latex-dark) footer hr {
  border-color: hsl(0, 0%, 80%);
}

body:not(.latex-dark) .course-toc-col a,
body:not(.latex-dark) .course-toc-col .semester-label,
body:not(.latex-dark) .toc-nav-btn {
  color: hsl(0, 100%, 33%);
}

body:not(.latex-dark) .nav-avatar {
  border-color: hsl(0, 0%, 75%);
}

body:not(.latex-dark) .course-card-img {
  background: hsl(0, 0%, 88%);
}

body:not(.latex-dark) .img-placeholder {
  color: hsl(0, 0%, 55%);
}

/* ── Navigation ── */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 2.5rem;
  border-bottom: 1px solid hsl(0, 0%, 25%);
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-name {
  font-weight: bold;
  font-size: 1.1rem;
  text-decoration: none;
  color: hsl(0, 0%, 95%);
  white-space: nowrap;
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid hsl(0, 0%, 35%);
  overflow: hidden;
  flex-shrink: 0;
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

nav .nav-link {
  text-decoration: none;
  color: hsl(0, 0%, 65%);
  font-variant: small-caps;
  letter-spacing: 0.05em;
  font-size: 0.95rem;
}

nav .nav-link.active,
nav .nav-link:hover {
  color: hsl(0, 0%, 95%);
  border-bottom: 2px solid hsl(0, 0%, 95%);
}

/* ── Theme toggle ── */
#theme-toggle {
  background: none;
  border: 1px solid hsl(0, 0%, 40%);
  color: hsl(0, 0%, 85%);
  padding: 0.25rem 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 3px;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

#theme-toggle:hover {
  background: hsl(0, 0%, 15%);
}

/* ── Main content ── */
main {
  padding: 0 2.5rem 2rem;
}

/* ── Hero / intro header ── */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.hero-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid hsl(0, 0%, 30%);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-text h1 {
  margin: 0 0 0.2rem;
}

.hero-text .author {
  margin: 0 0 0.75rem;
  color: hsl(0, 0%, 60%);
}

.hero-quote {
  margin: 0;
  font-style: italic;
  color: hsl(0, 0%, 55%);
}

.hero-quote p {
  margin: 0;
}

body:not(.latex-dark) .hero-photo {
  border-color: hsl(0, 0%, 75%);
}

body:not(.latex-dark) .hero-text .author {
  color: hsl(0, 0%, 45%);
}

body:not(.latex-dark) .hero-quote {
  color: hsl(0, 0%, 45%);
}

/* ── Section anchors in the top bar ── */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid hsl(0, 0%, 25%);
}

.section-nav a {
  color: hsl(0, 0%, 70%);
  text-decoration: none;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
}

.section-nav a:hover {
  color: hsl(0, 0%, 95%);
}

/* ── Section styling ── */
section {
  margin-bottom: 3rem;
}

section h2 {
  border-bottom: 1px solid hsl(0, 0%, 25%);
  padding-bottom: 0.4rem;
}

/* ── Entry blocks (education, experience) ── */
.entry {
  margin-bottom: 1.5rem;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entry-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.entry-date {
  font-style: italic;
  color: hsl(0, 0%, 55%);
  white-space: nowrap;
}

.entry-subtitle {
  color: hsl(0, 0%, 65%);
  margin: 0.15rem 0 0.4rem;
}

.entry-detail {
  font-size: 0.9rem;
  color: hsl(0, 0%, 60%);
  margin: 0.3rem 0 0;
}

.entry-detail strong {
  color: hsl(0, 0%, 82%);
  font-weight: 600;
}

/* ── Interest tags ── */
.interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
}

.interest-list li {
  border: 1px solid hsl(0, 0%, 30%);
  padding: 0.3rem 0.75rem;
  border-radius: 3px;
  font-size: 0.9rem;
}

/* ── Contact list ── */
.contact-list {
  list-style: none;
  padding: 0;
}

.contact-list li {
  margin-bottom: 0.5rem;
}

.contact-list li::before {
  content: "·";
  margin-right: 0.5rem;
  color: hsl(0, 0%, 50%);
}

/* ── Blog heading ── */
.blog-heading {
  border-bottom: 1px solid hsl(0, 0%, 25%);
  padding-bottom: 0.4rem;
  text-align: left;
  margin-top: 0;
}

body:not(.latex-dark) .blog-heading {
  border-bottom-color: hsl(0, 0%, 80%);
}

/* ── Blog list ── */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.post-list .post-date {
  color: hsl(0, 0%, 50%);
  font-size: 0.9rem;
  margin-right: 0.75rem;
}

.post-meta {
  color: hsl(0, 0%, 50%);
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Footer ── */
footer {
  margin: auto 0 0;
  padding: 1rem 2.5rem;
  color: hsl(0, 0%, 45%);
  font-size: 0.85rem;
}

footer hr {
  border-color: hsl(0, 0%, 20%);
}

/* ── Course TOC ── */
.course-toc-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding: 1rem 0.75rem;
  border: 1px solid hsl(0, 0%, 25%);
  border-radius: 3px;
}

.course-toc-track {
  flex: 1;
  overflow: hidden;
}

.course-toc-inner {
  display: flex;
  gap: 1.5rem;
  transition: transform 0.25s ease;
}

.course-toc-col {
  flex: 0 0 auto;
  min-width: 190px;
}

.course-toc-col .semester-label {
  display: block;
  font-weight: bold;
  font-size: 1rem;
  color: hsl(196, 80%, 77%);
  text-decoration: none;
  margin-bottom: 0.4rem;
}

.course-toc-col .semester-label:hover {
  text-decoration: underline;
}

.course-toc-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  padding-left: 0.85rem;
  border-left: 2px solid hsl(0, 0%, 30%);
}

.course-toc-col li {
  margin-bottom: 0.3rem;
}

.course-toc-col a {
  color: hsl(196, 80%, 77%);
  text-decoration: none;
  font-size: 0.88rem;
}

.course-toc-col a:hover {
  text-decoration: underline;
}

.toc-nav-btn {
  background: none;
  border: none;
  color: hsl(196, 80%, 77%);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.2rem 0.1rem;
  white-space: nowrap;
  visibility: hidden;
}

.toc-nav-btn:hover {
  text-decoration: underline;
}

.semester-heading {
  margin-top: 2rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid hsl(0, 0%, 25%);
}

/* ── Course card ── */
.course-card {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem 0;
  align-items: flex-start;
}

.course-card-img {
  flex: 0 0 42%;
  border-radius: 4px;
  overflow: hidden;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(0, 0%, 12%);
}

.course-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.course-card-body {
  flex: 1;
}

.course-card-body h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.img-placeholder {
  color: hsl(0, 0%, 45%);
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  nav {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .nav-left {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links {
    gap: 0.75rem;
    width: 100%;
  }

  main,
  footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .entry-header {
    flex-direction: column;
  }

  .entry-date {
    font-size: 0.9rem;
  }

  .hero {
    flex-direction: column;
    text-align: center;
  }

  .hero-photo {
    width: 110px;
    height: 110px;
  }

  .course-card {
    flex-direction: column;
  }

  .course-card-img {
    flex: none;
    width: 100%;
    min-height: 140px;
  }
}
