: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", "Segoe UI", sans-serif;
}

p {
  line-height: 150%;
}

h1 {
  text-align: center;
}

.annoying {
  color: red;
}

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

/* Hamburger button (hidden on desktop) */
.hamburger {
  display: none;
  position: fixed;
  top: 6px;
  left: 6px;
  z-index: 300;
  background: var(--nav-background);
  border: none;
  font-size: 22px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
}

.nav-overlay.open {
  display: block;
}

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

.sidenav a {
  padding: 0px 8px 0px 16px; /* top-right-bottom-left*/
  display: flex;
  align-items: center; 
  text-decoration: none;
  height: 40px;
  font-size: 20px;
  color: black;
}

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

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

.subpage {
  margin: 0 0 0 var(--nav-weight); /* space for sidebar */
  padding: 0 16px 8px;
}

/* Topbar navigation on creative writings */
.topnav {
  display: flex;
  justify-content: start;
  align-items: center;
  width: calc(100% - var(--nav-weight));
  height: var(--nav-height);
  position: fixed;
  top: 0;
  left: var(--nav-weight);
  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 */
@font-face {
  font-family: 'Domine';
  src: url('../fonts/Domine-Regular.woff2') format('woff2');
  font-display: swap;
}

article {
  font-family: Domine;
  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.2em; 
}

.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 td:first-child {
  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;
  left: var(--nav-weight); /* keep sidebar visible */
  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 - var(--nav-weight) - 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);
}

/* Mobile layout */
@media (max-width: 640px) {
  .hamburger {
    display: flex;
  }

  .sidenav {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding-top: 50px;
  }

  .sidenav.open {
    transform: translateX(0);
  }

  .subpage {
    margin-left: 0;
  }

  .topnav {
    overflow-x: auto;
    width: 100%;
    left: 0;
  }

  .lightbox {
    left: 0;
  }

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

  .topnav a {
    white-space: nowrap;
    font-size: 16px;
    padding: 0 14px;
  }
}
