/* -----------------------------------------------------------------------------
   Site-specific additions on top of the Minimal Light theme files
   (style.scss and publications.css). Tweaks live here so the theme files
   stay easy to compare with upstream.
   ----------------------------------------------------------------------------- */

:root {
  --section-rule: #e5e5e5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --section-rule: #3a3c4a;
  }
}

/* Sidebar: a little space between roles */
header .role + .role {
  margin-top: 0.5em;
}

/* Heading spacing on pages without collapsible sections (e.g. the 404 page) */
section > h2 {
  margin-top: 28px;
}
section > h2:first-child {
  margin-top: 2px;
}

/* Publications: citations from _data/publications.yml, with link buttons below */
.pub-list > li {
  margin-bottom: 14px;
}
.pub-list > li:last-child {
  margin-bottom: 0;
}
.pub-list .pub-links {
  margin-top: 4px;
}
.pub-list .pub-links a {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 0 0.45rem;
  border: 1px solid #000;
  color: #000;
  font-size: 12px;
  line-height: 1.6;
}
.pub-list .pub-links a:hover {
  color: var(--global-theme-color);
  border-color: var(--global-theme-color);
}
@media (prefers-color-scheme: dark) {
  .pub-list .pub-links a {
    color: #fff;
    border-color: #fff;
  }
}

/* Teaching: indent the role headings (Instructor of Record, Teaching Assistant) */
section h3 {
  padding-left: 18px;
}

/* -----------------------------------------------------------------------------
   Collapsible sections (homepage)
   Markup: _layouts/homepage.html. Behavior: _includes/sections.js.
   Without JavaScript every section is shown and nothing collapses.
   ----------------------------------------------------------------------------- */

.section > h2 {
  margin: 0;
}

/* Sections listed under fixed_sections in index.md are always shown. Their
   plain headings get the same spacing as the toggle buttons below. */
.section-fixed > h2 {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 8px 0 15px;
}
.section-content {
  display: flow-root;
}

/* The heading is a full-width button that looks like the original heading */
.section-toggle {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  width: 100%;
  margin: 0;
  padding: 8px 0 15px;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  cursor: text;
  -webkit-tap-highlight-color: transparent;
}
.js .section-toggle {
  cursor: pointer;
}
.section-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Chevron: points down when open, right when closed */
.js .section-toggle::after {
  content: "";
  flex: none;
  width: 0.36em;
  height: 0.36em;
  margin-right: 0.35em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.55;
  transform: translateY(-25%) rotate(45deg);
  transition: transform 0.25s ease, opacity 0.15s ease;
}
.js .section-toggle:hover::after {
  opacity: 1;
}

/* Body: a one-row grid whose row shrinks to zero when collapsed, which
   gives a smooth vertical slide without measuring heights in JavaScript. */
.section-body {
  display: grid;
  grid-template-rows: 1fr;
}
.section-inner {
  min-height: 0;
}

.js .section-body {
  transition: grid-template-rows 0.3s ease, visibility 0s linear 0s;
}
.js .section.is-collapsed .section-body,
.js:not(.sections-ready) .section:not(.starts-open) .section-body {
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.3s ease, visibility 0s linear 0.3s;
}
.js .section.is-collapsed .section-inner,
.js .section.is-animating .section-inner,
.js:not(.sections-ready) .section:not(.starts-open) .section-inner {
  overflow: hidden;
}
.js .section.is-collapsed .section-toggle::after,
.js:not(.sections-ready) .section:not(.starts-open) .section-toggle::after {
  transform: rotate(-45deg);
}

/* Narrow screens: the section headings read as a tappable menu */
@media (max-width: 960px) {
  .section {
    border-top: 1px solid var(--section-rule);
  }
  .section:first-of-type {
    border-top: 0;
  }
  .section:last-of-type {
    border-bottom: 1px solid var(--section-rule);
  }
  .section-toggle,
  .section-fixed > h2 {
    min-height: 48px;
    padding: 12px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .section-body,
  .js .section-toggle::after {
    transition: none !important;
  }
}

/* Printing always shows everything */
@media print {
  .js .section .section-body {
    grid-template-rows: 1fr !important;
    visibility: visible !important;
  }
  .js .section .section-inner {
    overflow: visible !important;
  }
  .js .section-toggle::after {
    display: none;
  }
}
