:root {
  --nav-background: hsl(230,40%,90%); /* hue, saturation, brightness */
  --nav-hover: hsl(230,40%,80%);
  --nav-weight: 200px; /* width of sidebar */
  --nav-height: 40px; /* height of top bar */
  --gap: 10px; /* gap between photos */
  --thumb-size: 180px; /* size of thumbnails */
}

/* Overwriting the default from user agent stylesheet */
body {
  margin: 0;
  font-family: "DejaVu Sans", "Noto Sans", sans-serif;
}

p {
  line-height: 150%;
}

h1 {
  text-align: center;
}

.startPage {
  display: flex; 
  align-items: flex-start; 
  justify-content: space-around;
}

/* Sidebar navigation */
.sidenav {
  height: 100%;
  width: var(--nav-weight);
  position: fixed;
  /* z-index: 1; */
  top: 0;
  left: 0;
  background-color: var(--nav-background);
  overflow-x: hidden;
  padding-top: 8px;
}

.sidenav a {
  padding: 4px 8px 4px 16px; /* top-right-bottom-left*/
  text-decoration: none;
  font-size: 20px;
  color: black;
  display: block;
}

.sidenav a:hover {
  background-color: var(--nav-hover);
}

.sidenav a.active {
  background-color: var(--nav-hover);
}

iframe {
  width: calc(100% - var(--nav-weight));
  margin-left: var(--nav-weight);
  height: calc(100dvh - 5px); /* prevents duplicated scrollbar */
  border: none;
}

.subpage {
  margin: 0;
  padding: 0 16px 8px;
}

/* Topbar navigation on creative writings */
.topnav {
  display: flex;
  justify-content: start;
  align-items: center; 
  width: 100%;
  height: var(--nav-height);
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--nav-background);
}

.topnav a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0px 24px;
  text-decoration: none;
  font-size: 20px;
  color: black;
}

.topnav a:hover {
  background-color: var(--nav-hover);
}

.topnav a.active {
  background-color: var(--nav-hover);
}

/* Creative writings */
article {
  margin-top: var(--nav-height);
  display: none;
  overflow: auto; /* prevent margin collapsing */
  padding: 0 32px 24px;
}

article h1 {
  font-weight: normal;
}

article p {
  text-align: justify;
  font-size: 1.1em;
}

.math {
  font-size: 1.5em;
  color: black;
}

li {
  padding-top: 4px;
  padding-bottom: 4px;
  line-height: 150%;
}

td {
  padding-top: 4px;
  padding-bottom: 4px;
}

td img {
  height: 150px;
}

.vita-tab {
  padding-right: 24px;
}

.books-tab {
  padding: 8px 32px;
}

/* photo gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), 1fr));
  gap: var(--gap);
  align-items: stretch;
}

.gallery button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.gallery button:hover img {
  transform: scale(1.1);
}

/* lightbox modal */
.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.75);
  visibility: hidden;
}

.lightbox.open {
  visibility: visible;
}

.lightbox img {
  max-width: calc(100vw - 96px);
  max-height: calc(100vh - 24px);
}

.nav-btn {
  background: var(--nav-background);
  color: black;
  border: 0;
  font-size: 1.8em;
  height: 32px;
  width: 32px;
  margin: 0 8px;
  border-radius: 50%;
  display: flex; 
  align-items: end; /* hack, because ‹, › are not vertically centered */
  justify-content: center;
  cursor: pointer;
}

.nav-btn:hover {
  background: var(--nav-hover);
}
