/* Site-specific styles layered on top of the hello-friend-ng theme.
   The theme switches appearance via prefers-color-scheme and an optional
   [data-theme] attribute set by the theme toggle, so every themed rule
   below is declared for both mechanisms. */

/* ---------------------------------------------------------------------
   Home page hero + featured/recent post sections
   --------------------------------------------------------------------- */
.home-hero {
  text-align: center;
  margin: 30px 0 50px;
}

.home-hero h1 {
  font-size: 2.6rem;
  margin-bottom: 0;
}

.home-section {
  margin-bottom: 2.5em;
}

.home-section__title {
  font-size: 1.3rem;
  margin-bottom: 0.4em;
}

.home-section__more {
  margin-top: 0.8em;
  text-align: right;
}

.home-section__more a {
  text-decoration: none;
  opacity: 0.7;
}

.home-section__more a:hover {
  opacity: 1;
}

/* ---------------------------------------------------------------------
   Series badge on blog list items ("Series name · Part X")
   --------------------------------------------------------------------- */
.series-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
  background-color: #eaeaea;
  color: #555;
}

@media (prefers-color-scheme: dark) {
  .series-badge {
    background-color: #3b3d42;
    color: #b3b3bd;
  }
}

[data-theme="light"] .series-badge {
  background-color: #eaeaea;
  color: #555;
}

[data-theme="dark"] .series-badge {
  background-color: #3b3d42;
  color: #b3b3bd;
}

/* ---------------------------------------------------------------------
   Series box on articles that are part of a series
   --------------------------------------------------------------------- */
.series-box {
  margin: 25px 0;
  padding: 15px 20px;
  border-radius: 8px;
  border: 1px solid #dcdcdc;
  background-color: #fafafa;
}

@media (prefers-color-scheme: dark) {
  .series-box {
    border-color: #4e4e57;
    background-color: #1b1c1d;
  }
}

[data-theme="light"] .series-box {
  border-color: #dcdcdc;
  background-color: #fafafa;
}

[data-theme="dark"] .series-box {
  border-color: #4e4e57;
  background-color: #1b1c1d;
}

.series-box__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-weight: 700;
}

.series-box__count {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.7;
}

.series-box__parts {
  margin: 10px 0 0 25px;
  padding: 0;
}

.series-box__part {
  margin: 4px 0;
}

.series-box__this {
  font-size: 0.85em;
  opacity: 0.7;
}

.series-box__part--current {
  font-weight: 700;
}

.series-parts__title {
  margin-top: 0;
}

.series-part__date {
  font-size: 0.85em;
  opacity: 0.7;
  margin-left: 0.5rem;
}

/* ---------------------------------------------------------------------
   Table of contents on blog posts

   On narrow viewports it renders in-flow at the top of the post. When
   there is room next to the 800px-wide centered .post column, it moves
   into the right margin and sticks while scrolling.
   --------------------------------------------------------------------- */
#toc {
  font-size: 0.9em;
}

@media (min-width: 1300px) {
  .post article {
    position: relative;
  }

  .toc-container {
    position: absolute;
    top: 0;
    left: 100%;
    height: 100%;
    width: 220px;
    margin-left: 30px;
  }

  .toc-container hr {
    display: none;
  }

  #toc {
    position: sticky;
    top: 30px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    font-size: 0.85em;
    opacity: 0.85;
  }
}

#toc .toc-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

#toc ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

/* Indent nested levels, but not empty wrapper levels that Hugo emits
   when a post skips a heading level (e.g. h1 straight to h3). */
#toc li:has(> a) > ul {
  padding-left: 1.25rem;
}

#toc li {
  margin: 4px 0;
}

#toc a {
  text-decoration: none;
}

#toc a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------
   Blog post metadata
   --------------------------------------------------------------------- */
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
}

.post-meta__details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  width: 100%;
  margin: 0.8em 0;
}

.post-meta__item {
  display: inline-flex;
  align-items: center;
}

/* ---------------------------------------------------------------------
   Photo albums (gallery section)
   Adapted from duncanmackenzie.net's albums, which in turn build on
   "Adaptive Photo Layout with Flexbox" (css-tricks.com) and PhotoSwipe.
   --------------------------------------------------------------------- */
main.album {
  width: 100%;
  padding: 0 20px;
  margin: auto;
  text-align: center;
}

main.album h1 {
  margin-bottom: 0;
}

main.album .albumDescription {
  max-width: 90ch;
  margin: 0 auto;
  padding-bottom: 25px;
}

main.album .albumContent {
  text-align: left;
  max-width: 800px;
  margin: auto;
}

main.album > section {
  margin: 2rem auto 1rem;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
}

main.album .post-info {
  text-align: left;
}

/* Adaptive flexbox photo layout: each slide's inline aspect-ratio plus a
   fixed row height lets flex-grow fill each row edge to edge. */
.photo-list {
  display: flex;
  flex-wrap: wrap;
  margin: auto;
  width: auto;
}

@media (min-width: 700px) {
  .photo-list {
    width: 80%;
  }
}

.gallery-slide {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: 40vh;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 10px;
  overflow: hidden;
}

/* Keeps the last row from stretching a lone photo across the full width */
.photo-list div.spacer {
  flex-grow: 10;
  padding: 0;
  height: 0;
}

@media (max-width: 700px) {
  .photo-list div.spacer {
    display: none;
  }
}

.gallery-slide .gallery-item {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: block;
  width: 100%;
  position: relative;
  cursor: zoom-in;
  box-sizing: border-box;
  overflow: hidden;
}

.gallery-slide .gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: bottom;
  border-radius: 4px;
}

/* Caption markup is only shown inside the PhotoSwipe lightbox */
.gallery-slide .pswp-caption-content {
  display: none;
}

.pswp__dynamic-caption .title {
  font-weight: 700;
  margin: 0;
}

.pswp__dynamic-caption .description {
  margin: 0.25em 0 0;
}

/* Album cards on the gallery list page */
section.featured {
  max-width: 600px;
}

section.galleries {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 2rem 1.5rem;
  max-width: 1280px;
}

@media (min-width: 640px) {
  section.galleries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 3rem;
  }
}

@media (min-width: 1024px) {
  section.galleries {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  position: relative;
  text-decoration: none;
  text-align: left;
}

.card > img {
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  aspect-ratio: 3 / 2;
  width: 100%;
  overflow: hidden;
  object-fit: cover;
}

.card > img:hover {
  transform: scale(1.01);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.card > div {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.card > div > h2 {
  display: block;
  font-weight: 600;
  font-size: 1.125rem;
  margin: 0.5rem 0 0.3rem 0;
}

/* Photo count pill overlaid on the card image */
.card > div > span {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 0.5rem;
  color: #fff;
  font-size: 0.875rem;
}

.card > div > p {
  opacity: 0.8;
  font-size: 0.8rem;
  line-height: 1.25;
  margin: 0;
}

section.featured .card > div > h2 {
  font-weight: 600;
  font-size: 2rem;
  line-height: 2.25rem;
  margin: 0.5rem 0 0.3rem 0;
}

section.featured .card > div > span > .featuredIndicator {
  font-weight: 700;
}

@media (max-width: 639px) {
  section.featured .card > div > h2 {
    font-size: 1.125rem;
  }

  section.featured .featuredIndicator {
    display: none;
  }
}

/* ---------------------------------------------------------------------
   Bookmarks
   --------------------------------------------------------------------- */
.bookmark-desc {
  opacity: 0.7;
}
