/*
Responsive Webcomic Layout Template v1.0
by Scott Andrew LePera 
https://scottandrew.com

On BlueSky:
https://bsky.app/profile/neathobby.com
*/

/* (PART A) GALLERY CONTAINER */
.gallery {
  /* (A1) GRID LAYOUT - 3 PER ROW */
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));

  /* (A2) OPTIONAL */
  grid-gap: 10px;
  max-width: 800px;
  padding: 10px; margin: 0 auto;
  overflow: hidden;
}

/* (PART B) IMAGES */
.gallery > img {
  width: 100%; object-fit: cover;
  aspect-ratio: 1/1;
  transition: all 0.3s;
}

/* (PART C) SMALL SCREENS - 2 PER ROW */
@media screen and (max-width:640px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* (PART D) ENLARGE ON MOUSE HOVER */
.gallery > img:hover:not(.full) {
  transform: scale(1.1);
}
/* (PART E) SHOW SELECTED IMAGE IN FULLSCREEN */
.gallery > img.full {
  position: fixed; top: 0; left: 0; z-index: 999;
  width: 100vw; height: 100vh;
  object-fit: scale-down;
  background: rgba(0, 0, 0, 0.5);
}
 /* unvisited link */
a:link {
  color: #3FA8DF;
}


/* visited link */
a:visited {
  color: #FBD62B;
}

/* mouse over link */
a:hover {
  color: #EE4197;
}

/* selected link */
a:active {
  color: #DB504A;
} 

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

:root {
  --nav-font: "Lilita One", serif;
}

html {
  font-size: 26px;
  font-family: var(--nav-font);
}

body {
  background-color: #fff;
  color: #000;
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

header img:first-child {
  max-inline-size: 100%
}

main {
  min-inline-size: min-content;
}

.comic-page {
  container-type: inline-size;
}

.comic-page:not(:last-child) {
  margin-bottom: 1em;
}

.comic-page > img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.comic-page > h2 {
  text-align: center;
  font-family: var(--nav-font);
  font-size: 6cqi;
}

nav {
  position: sticky;
  top: 0;
  padding: 0.5em 0;
  
  background-color: #fff;

  & a {
    text-decoration: none;
  }
}

#nav-sections {
  display: none;
  & a {
    font-size: 2rem;
    font-family: var(--nav-font);
  }
}

.menu {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-evenly;
}

.menu:has(input:checked) ~ #nav-sections {
  display: flex;
}
.menu:has(input:checked) {
  & label::before {
    content: "Close ";
  }
}

nav:has(input:checked) {
  width: 100%;
}

#nav-toggle {
  appearance: none;
  width: 0px;
  height: 0px;
  display: none;
}

label[for="nav-toggle"] {
  cursor: pointer;
  font-family: var(--nav-font);
  &::before {
    content: "Open ";
  }
}

#comic-nav {
  display: flex;
  justify-content: space-around;
  font-family: var(--nav-font);
  container-type: inline-size;
  & a {
    font-size: 6cqi;
  }
  
}

article {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  & p {
    margin-inline: 0.5rem;
    margin-block: 0.5rem;
    line-height: 1.2rem;
  }
}

article:empty {
  display: none;
}

footer {
  margin-block-start: 2rem;
  text-align: center;
}

/* widescreen overrides ------------------------------------*/

@media (width > 45em) {

  body {
    margin: 1em;
  }

  .outer {
    display: grid;
    grid-template-columns: 0.3fr 1fr;
    grid-template-rows: auto;
    margin-inline: auto;
    max-inline-size: 60ch;
  }

  header {
    grid-column-end: span 2;
  }


  nav {
    margin-top: 1em;
    grid-row-start: 2;
    grid-row-end: span 3;
    position: relative;
  }

  #nav-sections {
    display: flex;
    align-items: flex-start;
  }

  .menu {
    display: none;
  }
  
  main {
    grid-row-end: span 2;
  }

  #notes {
    grid-column-start: 2;
  }

  footer {
    grid-column-end: span 2
  }
}
