/* ==========================================================================
   Night mode for academicpages / Minimal Mistakes
   Activated by html[data-theme="dark"] (set by script in _includes/head.html)
   ========================================================================== */

/* ---- Theme toggle (menu item, sits after the last nav link) ---- */
/* Rendered as an <a> so the greedy-nav script's `#site-nav button`
   selector ignores it and the mobile menu keeps working. */
.greedy-nav a.theme-toggle {
  cursor: pointer;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }

html[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Global ---- */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #16181a;
  color: #c9cdd1;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
  color: #e4e7ea;
}

html[data-theme="dark"] a { color: #6fc0dc; }
html[data-theme="dark"] a:hover { color: #9ad4e8; }
html[data-theme="dark"] a:visited { color: #5aa3bd; }

html[data-theme="dark"] blockquote {
  color: #a5abb0;
  border-left-color: #3a3f43;
}

html[data-theme="dark"] hr { border-color: #33383c; }

html[data-theme="dark"] ::selection {
  background: #3a5f70;
  color: #fff;
}

/* ---- Masthead & navigation ---- */
html[data-theme="dark"] .masthead {
  background-color: #16181a;
  border-bottom-color: #33383c;
}

html[data-theme="dark"] .greedy-nav {
  background: #16181a;
}

html[data-theme="dark"] .greedy-nav a {
  color: #c9cdd1;
}

html[data-theme="dark"] .greedy-nav a:hover {
  color: #ffffff;
}

html[data-theme="dark"] .greedy-nav .visible-links a:before {
  background: #6fc0dc;
}

html[data-theme="dark"] .greedy-nav .hidden-links {
  background: #222629;
  border-color: #3a3f43;
}

html[data-theme="dark"] .greedy-nav .hidden-links::before {
  border-color: transparent transparent #222629 transparent;
}

html[data-theme="dark"] .greedy-nav .hidden-links a:hover {
  background: #2d3235;
}

/* ---- Sidebar / author profile ---- */
html[data-theme="dark"] .author__name { color: #e4e7ea; }
html[data-theme="dark"] .author__bio,
html[data-theme="dark"] .author__content { color: #c9cdd1; }

/* Below 1200px the urls list is styled as a card; match the page
   background so it blends, exactly like white-on-white in light mode */
html[data-theme="dark"] .author__urls {
  background: #16181a;
  border-color: #33383c;
  color: #c9cdd1;
}

html[data-theme="dark"] .author__urls::before {
  border-color: transparent transparent #3a3f43 transparent;
}

html[data-theme="dark"] .author__urls::after {
  border-color: transparent transparent #16181a transparent;
}

/* On large screens it's a plain list in the sidebar - no card background */
@media (min-width: 1200px) {
  html[data-theme="dark"] .author__urls {
    background: transparent;
    border: 0;
    box-shadow: none;
  }
}

html[data-theme="dark"] .author__urls a { color: #c9cdd1; }

/* Icons that are black/near-black in the light theme (university, GitHub)
   - lighten to match the inherited icon color (e.g. email) */
html[data-theme="dark"] .social-icons .fa,
html[data-theme="dark"] .social-icons .fa-github,
html[data-theme="dark"] .social-icons .fa-github-alt,
html[data-theme="dark"] .social-icons .fa-github-square {
  color: #c9cdd1;
}

/* ---- Page content ---- */
html[data-theme="dark"] .page__title,
html[data-theme="dark"] .page__content,
html[data-theme="dark"] .page__meta,
html[data-theme="dark"] .page__date,
html[data-theme="dark"] .archive__item-excerpt {
  color: #c9cdd1;
}

html[data-theme="dark"] .page__content h1,
html[data-theme="dark"] .page__content h2,
html[data-theme="dark"] .page__content h3,
html[data-theme="dark"] .page__content h4,
html[data-theme="dark"] .archive__item-title,
html[data-theme="dark"] .archive__subtitle {
  color: #e4e7ea;
}

html[data-theme="dark"] .page__content h2,
html[data-theme="dark"] .archive__subtitle {
  border-bottom-color: #33383c;
}

html[data-theme="dark"] .archive__item-title a { color: #e4e7ea; }
html[data-theme="dark"] .archive__item-title a:hover { color: #9ad4e8; }

html[data-theme="dark"] .pagination--pager {
  color: #c9cdd1;
  border-color: #3a3f43;
}

html[data-theme="dark"] .pagination--pager:hover {
  background-color: #2d3235;
  color: #fff;
}

/* ---- Footer ---- */
html[data-theme="dark"] .page__footer {
  background-color: #1d2023;
  color: #a5abb0;
}

html[data-theme="dark"] .page__footer footer { color: #a5abb0; }
html[data-theme="dark"] .page__footer a { color: #c9cdd1; }
html[data-theme="dark"] .page__footer-copyright { color: #82888d; }

/* ---- Code ---- */
html[data-theme="dark"] code,
html[data-theme="dark"] pre,
html[data-theme="dark"] .highlight {
  background-color: #222629;
  color: #d7dbdf;
}

html[data-theme="dark"] div.highlighter-rouge,
html[data-theme="dark"] figure.highlight {
  background-color: #222629;
}

/* ---- Tables ---- */
html[data-theme="dark"] table {
  background-color: #1d2023;
  color: #c9cdd1;
  border-color: #33383c;
}

html[data-theme="dark"] th,
html[data-theme="dark"] td {
  border-color: #33383c;
}

html[data-theme="dark"] th {
  background-color: #26292c;
}

html[data-theme="dark"] tr:nth-child(even) {
  background-color: #202427;
}

/* ---- Forms, buttons, misc ---- */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background-color: #222629;
  color: #c9cdd1;
  border-color: #3a3f43;
}

html[data-theme="dark"] .notice,
html[data-theme="dark"] .notice--primary,
html[data-theme="dark"] .notice--info,
html[data-theme="dark"] .notice--warning,
html[data-theme="dark"] .notice--success,
html[data-theme="dark"] .notice--danger {
  background-color: #222629 !important;
  color: #c9cdd1 !important;
}

html[data-theme="dark"] .well {
  background-color: #222629;
  border-color: #3a3f43;
}

html[data-theme="dark"] img {
  opacity: 0.9;
}

/* ---- Layout tweak (both modes): more breathing room between the fixed
   sidebar and the main text on mid-size windows ---- */
@media (min-width: 1024px) and (max-width: 1199px) {
  .page,
  .archive {
    padding-left: 2.5em;
  }
}

/* Smooth transition when toggling */
body,
.masthead,
.greedy-nav,
.page__footer,
.author__urls {
  transition: background-color 0.25s ease, color 0.25s ease;
}
