/*******************************************************************************
 * Theme styles, following the look and feel of al-folio
 * (https://github.com/alshedivat/al-folio), reimplemented as plain CSS so the
 * site keeps building on GitHub Pages with no plugins or Bootstrap.
 *
 * The one deliberate departure from al-folio: the palette is built around the
 * site's existing background colour (#935d8c) rather than al-folio's white.
 ******************************************************************************/

/* ---------------------------------------------------------------------------
 * Variables
 * ------------------------------------------------------------------------ */

:root {
  --global-bg-color: #935d8c;
  /* Stellar's diagonal gradient overlay, carried over from the previous design.
     Fixed attachment keeps it viewport-sized, so the sticky navbar can paint the
     same background and blend seamlessly into the page behind it. */
  --global-bg-image: url("images/overlay.png"),
    linear-gradient(45deg, #e37682 15%, #5f4d93 85%);
  --global-text-color: #ffffff;
  --global-text-color-light: rgba(255, 255, 255, 0.6);
  --global-theme-color: #8cc9f0;
  --global-hover-color: #b6ddf6;
  --global-hover-text-color: #4b2e47;
  --global-divider-color: rgba(255, 255, 255, 0.2);
  --global-card-bg-color: rgba(255, 255, 255, 0.08);
  --global-code-bg-color: rgba(0, 0, 0, 0.18);
  --global-back-to-top-bg-color: rgba(0, 0, 0, 0.35);
  --global-back-to-top-text-color: #ffffff;

  --global-max-width: 930px;
  --global-navbar-height: 56px;

  --z-depth-1: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  --z-depth-2: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

/* ---------------------------------------------------------------------------
 * Base
 * ------------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  color: var(--global-text-color);
  background-color: var(--global-bg-color);
  background-image: var(--global-bg-image);
  background-attachment: fixed, fixed;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--global-text-color);
  scroll-margin-top: 66px;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}
h5 {
  font-size: 1.25rem;
}
h6 {
  font-size: 1rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

em,
div,
li,
span,
strong {
  color: var(--global-text-color);
}

strong {
  font-weight: 700;
}

hr {
  box-sizing: content-box;
  height: 0;
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid var(--global-divider-color);
}

img {
  max-width: 100%;
  height: auto;
  border-style: none;
  vertical-align: middle;
}

a {
  color: var(--global-theme-color);
  text-decoration: none;
  background-color: transparent;
}

a:hover {
  color: var(--global-hover-color);
  text-decoration: underline;
}

blockquote {
  margin: 1.5em 0;
  padding: 1em;
  border-left: 5px solid var(--global-theme-color);
  font-size: 1.2rem;
}

blockquote p {
  margin-bottom: 0;
}

code {
  padding: 3px;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
  color: var(--global-theme-color);
  background-color: var(--global-code-bg-color);
}

pre {
  margin: 0 0 1rem;
  padding: 6px 12px;
  overflow: auto;
  border-radius: 6px;
  color: var(--global-theme-color);
  background-color: var(--global-code-bg-color);
}

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

table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
}

table td,
table th {
  padding: 1px 1rem 1px 0;
  font-size: 1rem;
  text-align: left;
}

table th {
  font-weight: 700;
}

/* ---------------------------------------------------------------------------
 * Layout
 * ------------------------------------------------------------------------ */

.container {
  width: 100%;
  max-width: var(--global-max-width);
  margin-right: auto;
  margin-left: auto;
  padding-right: 15px;
  padding-left: 15px;
}

main.container {
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.clearfix::after {
  display: block;
  clear: both;
  content: "";
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------------
 * Navbar
 * ------------------------------------------------------------------------ */

/* The stickiness lives on the wrapping <header>: a sticky .navbar would be
   confined to that parent's box, which is only as tall as the bar itself. */
body > header {
  position: sticky;
  top: 0;
  z-index: 1030;
}

.navbar {
  display: flex;
  align-items: center;
  min-height: var(--global-navbar-height);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--global-divider-color);
  /* Frosted rather than a copy of the page gradient: iOS Safari ignores
     background-attachment: fixed, so a duplicated gradient would drift out of
     alignment with the page behind it. */
  background-color: rgba(147, 93, 140, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: none;
}

/* Slightly wider than the article column so all seven links stay on one row. */
.navbar > .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  max-width: 1060px;
}

.navbar-brand {
  display: inline-block;
  padding: 0.3125rem 0;
  margin-right: 1rem;
  font-size: 1.25rem;
  font-weight: 300;
  line-height: inherit;
  white-space: nowrap;
  color: var(--global-text-color);
}

.navbar-brand:hover {
  color: var(--global-text-color);
  text-decoration: none;
}

.navbar-brand .font-weight-bold {
  font-weight: 700;
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar-nav .nav-link {
  display: block;
  padding: 0.5rem 0.45rem;
  font-size: 0.95rem;
  color: var(--global-text-color);
  white-space: nowrap;
}

.navbar-nav .nav-link:hover {
  color: var(--global-hover-color);
  text-decoration: none;
}

.navbar-nav .nav-item.active > .nav-link {
  font-weight: bolder;
  color: var(--global-theme-color);
  background-color: inherit;
}

.navbar-nav .nav-item.active > .nav-link:hover {
  color: var(--global-hover-color);
}

/* Social icons shown in place of the brand on the about page */
.navbar-brand.social {
  padding-top: 0;
  padding-bottom: 0;
  margin-right: 0.5rem;
  font-size: 1.4rem;
}

.navbar-brand.social a {
  margin-right: 0.4rem;
}

/* Hamburger toggle (small screens only) */
.navbar-toggler {
  display: none;
  padding: 0.25rem 0.5rem;
  border: 0;
  background-color: transparent;
  cursor: pointer;
}

.navbar-toggler .icon-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin-bottom: 4px;
  border-radius: 1px;
  background-color: var(--global-text-color);
  transition: all 0.2s;
}

.navbar-toggler .top-bar {
  transform: rotate(45deg);
  transform-origin: 10% 10%;
}

.navbar-toggler .middle-bar {
  opacity: 0;
}

.navbar-toggler .bottom-bar {
  transform: rotate(-45deg);
  transform-origin: 10% 90%;
}

.navbar-toggler.collapsed .top-bar,
.navbar-toggler.collapsed .bottom-bar {
  transform: rotate(0);
}

.navbar-toggler.collapsed .middle-bar {
  opacity: 1;
}

@media (max-width: 575.98px) {
  .navbar-toggler {
    display: block;
  }

  .navbar-collapse {
    flex-basis: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .navbar-collapse.show {
    max-height: 100vh;
  }

  .navbar-nav {
    flex-direction: column;
    align-items: flex-end;
    padding-bottom: 0.5rem;
  }
}

/* ---------------------------------------------------------------------------
 * Post / page scaffolding
 * ------------------------------------------------------------------------ */

.post-header {
  margin-bottom: 1rem;
}

.post-title {
  margin-bottom: 0.5rem;
  font-weight: 300;
}

.post-title .font-weight-bold {
  font-weight: 700;
}

.post-description,
.post-header .desc {
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--global-text-color-light);
}

.post-description a,
.post-header .desc a {
  color: inherit;
}

.post-description a:hover,
.post-header .desc a:hover {
  color: var(--global-theme-color);
  text-decoration: none;
}

.post article > h2,
.post article > h3 {
  margin-top: 2rem;
}

/* Profile picture on the about page */
.profile {
  width: 100%;
  margin-bottom: 1rem;
}

.profile img {
  width: 100%;
  border-radius: 4px;
  box-shadow: var(--z-depth-1);
}

.profile img.rounded-circle {
  border-radius: 50%;
}

.profile .more-info {
  margin-top: 5px;
  margin-bottom: 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  color: var(--global-text-color-light);
}

.profile .more-info p {
  margin: 0;
}

.profile.float-right {
  float: none;
}

@media (min-width: 576px) {
  .profile {
    width: 30%;
  }

  .profile.float-right {
    float: right;
    margin-left: 1rem;
  }

  .profile.float-left {
    float: left;
    margin-right: 1rem;
  }
}

/* Section heading rules, as used on al-folio's projects/publications pages */
h2.category,
h2.bibliography {
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
  font-size: 2rem;
  text-align: right;
  /* al-folio uses the divider colour here; nudged up so it stays legible on purple. */
  color: rgba(255, 255, 255, 0.35);
  border-top: 1px solid var(--global-divider-color);
}

/* ---------------------------------------------------------------------------
 * Cards / grids
 * ------------------------------------------------------------------------ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--global-divider-color);
  border-radius: 4px;
  background-color: var(--global-card-bg-color);
  box-shadow: var(--z-depth-1);
  overflow: hidden;
  transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
  box-shadow: var(--z-depth-2);
}

.card .card-img {
  display: block;
  width: 100%;
  height: 140px;
  padding: 1.25rem 1.25rem 0;
  object-fit: contain;
}

.card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1.25rem;
}

.card .card-title {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  color: var(--global-text-color);
}

.card .card-text {
  font-size: 0.9rem;
}

.card .card-text:last-of-type {
  margin-bottom: 1rem;
}

.card .badges {
  margin-bottom: 0.75rem;
}

.card .badges img {
  height: 20px;
  margin-right: 4px;
}

.card .links {
  margin-top: auto;
}

.projects a {
  text-decoration: none;
}

.projects a:hover .card-title,
.projects .card-title a:hover {
  color: var(--global-theme-color);
}

.projects .card-title a {
  color: var(--global-text-color);
}

/* ---------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------ */

.btn {
  display: inline-block;
  margin: 0 0.5rem 0.5rem 0;
  padding: 0.25rem 1rem;
  border: 1px solid var(--global-text-color);
  border-radius: 3px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--global-text-color);
  background-color: transparent;
  cursor: pointer;
  transition: color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.btn:hover {
  color: var(--global-theme-color);
  border-color: var(--global-theme-color);
  text-decoration: none;
}

.btn-primary {
  color: var(--global-hover-text-color);
  border-color: var(--global-theme-color);
  background-color: var(--global-theme-color);
}

.btn-primary:hover {
  color: var(--global-hover-text-color);
  border-color: var(--global-hover-color);
  background-color: var(--global-hover-color);
}

/* ---------------------------------------------------------------------------
 * Publications
 * ------------------------------------------------------------------------ */

.publications {
  margin-top: 2rem;
}

.publications h2.bibliography {
  margin-bottom: 1rem;
}

.publications ol.bibliography {
  margin-top: 0;
  padding: 0;
  list-style: none;
}

.publications ol.bibliography li {
  margin-bottom: 1.5rem;
}

.publications ol.bibliography .abbr {
  margin-bottom: 0.5rem;
}

.publications ol.bibliography abbr {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--global-hover-text-color);
  background-color: var(--global-theme-color);
}

.publications ol.bibliography .title {
  font-weight: bolder;
}

.publications ol.bibliography .author,
.publications ol.bibliography .periodical {
  font-size: 0.95rem;
}

.publications ol.bibliography .author > em {
  border-bottom: 1px solid;
  font-style: normal;
}

.publications ol.bibliography .periodical {
  font-style: italic;
}

.publications ol.bibliography .links {
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------------------
 * Lists used for CV-style entries (education, experience, talks)
 * ------------------------------------------------------------------------ */

ul.entry-list {
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

ul.entry-list > li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--global-divider-color);
}

ul.entry-list > li:first-child {
  padding-top: 0.5rem;
}

ul.entry-list .entry-title {
  font-weight: 700;
}

ul.entry-list .entry-meta {
  font-size: 0.875rem;
  color: var(--global-text-color-light);
}

/* ---------------------------------------------------------------------------
 * Social icons (bottom of the about page)
 * ------------------------------------------------------------------------ */

article .social {
  margin-top: 3rem;
  text-align: center;
}

/* Shared by the navbar and the about-page icon row */
.social a i::before,
.social a .social-svg {
  color: var(--global-text-color);
  transition: all 0.2s ease-in-out;
}

.social a:hover i::before,
.social a:hover .social-svg {
  color: var(--global-theme-color);
}

.social-svg {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

.social .contact-icons {
  font-size: 4rem;
}

.social .contact-icons a {
  margin: 0 0.4rem;
}

.social .contact-note {
  font-size: 0.8rem;
  color: var(--global-text-color-light);
}

/* ---------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------ */

footer.sticky-bottom {
  padding-top: 40px;
  padding-bottom: 40px;
  border-top: 1px solid var(--global-divider-color);
  font-size: 0.9rem;
}

footer.sticky-bottom .container {
  text-align: center;
  color: var(--global-text-color-light);
}

footer.sticky-bottom a {
  color: var(--global-text-color);
}

footer.sticky-bottom a:hover {
  color: var(--global-theme-color);
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Back to top
 * ------------------------------------------------------------------------ */

#back-to-top {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 10;
  display: inline-block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 50%;
  color: var(--global-back-to-top-text-color);
  background: var(--global-back-to-top-bg-color);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  text-decoration: none;
}
