body {
  background-color: var(--paper);
}

.page-content {
  padding: 3rem 1.5rem 5rem;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
}

a.back {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}

a.back:hover {
  text-decoration: underline;
}

h1 {
  font-size: 2.2rem;
  letter-spacing: -0.02em;
  margin: 1.5rem 0 0.3rem;
}

.post-date {
  color: #777;
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}

.post-body {
  font-size: 1.15rem;
  line-height: 1.7;
  color: #222;
}

.post-body p {
  margin: 0 0 1.25rem;
}

.gallery {
  /* Break out of .wrap's narrow text column so the "table" has room to spread into
     a landscape rectangle instead of being squeezed into a tall, narrow strip. */
  margin: 2.5rem 0;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 1.5rem;
  box-sizing: border-box;
}

.post-photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.75rem;
  margin: 0 auto; /* max-width is set inline by the controller, sized to the photo count */
}

.post-photos figure {
  /* Fixed height, natural width: portrait photos narrow down to match a landscape
     photo's height in the same row, instead of standing taller. */
  margin: 0;
  height: var(--thumb-height, 110px);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  outline: none;
}

.post-photos img {
  width: auto;
  height: 100%;
  display: block;
  border-radius: 4px;
}

.post-photos figcaption {
  display: none;
}

.post-photos figure:hover {
  transform: scale(1.06);
  box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.28);
  z-index: 2;
  position: relative;
}

.post-photos figure.focused {
  box-shadow: 0 0 0 3px var(--accent);
  z-index: 2;
  position: relative;
}

.gallery-lightbox[hidden] {
  display: none;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.gallery-lightbox img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 4px;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
  /* Not zoom-out here — tapping/clicking the photo browses (see the navigate action),
     not closes; zoom-out on the surrounding backdrop still communicates "click to close". */
  cursor: pointer;
}

.gallery-lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.gallery-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gallery-lightbox-play {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.gallery-lightbox-play:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gallery-lightbox-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  z-index: 1;
}

.gallery-lightbox-progress-fill {
  height: 100%;
  width: 0%;
  /* Ocean blue — fits the actual subject matter (fjords, arctic sea, glaciers). Higher
     alpha + a touch more height than the first cut, since that one read as too subtle. */
  background: rgba(56, 189, 248, 0.9);
  transition: width 0.2s ease;
}

.gallery-lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.gallery-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gallery-lightbox-arrow--prev {
  left: 1.25rem;
}

.gallery-lightbox-arrow--next {
  right: 1.25rem;
}

@media (max-width: 468px) {
  /* Tighter edge offset on narrow screens, not a smaller size — 2.75rem (44px) is the
     recommended minimum touch target, and mobile is the primary reason these exist. */
  .gallery-lightbox-arrow--prev {
    left: 0.5rem;
  }

  .gallery-lightbox-arrow--next {
    right: 0.5rem;
  }
}

.gallery-lightbox-caption {
  color: #ccc;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.post-video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 2.5rem 0;
  border-radius: 4px;
  overflow: hidden;
}

.post-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 468px) {
  h1 {
    font-size: 1.8rem;
  }
  .post-body {
    font-size: 1.05rem;
  }
}
