/*!
 * overrides.css
 *
 * Loaded AFTER site.css. Supplies the layout that the original template's
 * JavaScript used to apply with inline styles, plus styling for the small
 * vanilla widgets in assets/js/site.js.
 *
 * Nothing here restyles the site for its own sake -- every block replaces
 * something that script used to do at runtime.
 */

/* ==================================================================== *
 * c. Grid galleries
 *
 * site.css lays these out with floats and a zero-height padding box:
 *   .ak-gallery-block-grid .slide { float: left; width: 25% }
 *   .ak-gallery-block-grid .slide .margin-wrapper a.image-slide-anchor {
 *       padding-bottom: 100%; width: 100%; height: 0; display: block }
 *   .ak-gallery-block-grid .slide .margin-wrapper a.image-slide-anchor img {
 *       display: inline-block }
 * The anchor collapses to height:0 and the img was absolutely positioned and
 * sized by script, so with no script the images spill out of their boxes and
 * overlap. The per-row width rules and the gutter rules in each page's inline
 * <style> both target .ak-gallery-design-grid-slide, a class that script
 * added and which is therefore never present -- so there are no gutters
 * either. Replaced wholesale with a CSS grid.
 * ==================================================================== */

.ak-gallery-block-grid .ak-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.ak-gallery-block-grid .slide {
  float: none;
  width: auto;
  min-width: 0;
}

.ak-gallery-block-grid .slide .margin-wrapper {
  position: relative;
  margin: 0;
}

/* Keep the square box site.css asks for, but make it a real containing block. */
.ak-gallery-block-grid .slide .margin-wrapper a.image-slide-anchor {
  position: relative;
  display: block;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  overflow: hidden;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.25);
}

.ak-gallery-block-grid .slide .margin-wrapper a.image-slide-anchor img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  object-position: 50% 50%; /* site.js overrides per data-image-focal-point */
}

.ak-gallery-block-grid .slide .margin-wrapper a.image-slide-anchor:focus-visible {
  outline: 2px solid #f6f6b6;
  outline-offset: 3px;
}

@media only screen and (max-width: 1024px) {
  .ak-gallery-block-grid .ak-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media only screen and (max-width: 640px) {
  .ak-gallery-block-grid .ak-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media only screen and (max-width: 400px) {
  .ak-gallery-block-grid .ak-gallery {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==================================================================== *
 * c. Gallery-collection pages
 *
 * The two gallery collections render .ak-system-gallery, whose slides hold a
 * bare full-resolution img. site.css only styles that structure under
 * .collection-type-gallery:not(.gallery-design-grid), and <body> does carry
 * gallery-design-grid, so none of it applies and the page becomes a stack of
 * multi-thousand-pixel images. Given the body tweak asks for a grid, give it
 * the same grid the block galleries get.
 * ==================================================================== */

.ak-system-gallery .slides {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.ak-system-gallery .slides .slide {
  position: relative;
  min-width: 0;
}

.ak-system-gallery .slides .slide img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 50% 50%;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.25);
}

.ak-system-gallery .slides .slide img:focus-visible {
  outline: 2px solid #f6f6b6;
  outline-offset: 3px;
}

/* No slideshow here any more, so the leftover controls have nothing to do. */
.ak-system-gallery .arrow,
.ak-system-gallery .dots,
.ak-system-gallery .circles,
.ak-system-gallery .numbers,
.ak-system-gallery .simple,
.ak-system-gallery .thumbnail-wrapper {
  display: none !important;
}

@media only screen and (max-width: 640px) {
  .ak-system-gallery .slides {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* ==================================================================== *
 * e. Slideshow galleries
 *
 * site.css absolutely positions the slide contents
 *   .ak-gallery-block-slideshow .slide > a {
 *       position: absolute; top: 0; left: 0; width: 100%; height: 100% }
 * but never gives the container a height -- script measured and set it. Supply
 * an aspect ratio instead, and show only the slide site.js marks active.
 * ==================================================================== */

.ak-gallery-block-slideshow .ak-gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.ak-gallery-block-slideshow .ak-gallery > .slide {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ak-gallery-block-slideshow .ak-gallery > .slide.ak-active-slide {
  display: block;
}

.ak-gallery-block-slideshow .ak-gallery > .slide > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.ak-gallery-block-slideshow .ak-gallery > .slide .ak-video-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.ak-video-wrapper .ak-video-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.ak-video-wrapper .ak-video-icon {
  z-index: 2;
}

/* The prev/next arrows are already fully styled by site.css (absolute, white,
   on a translucent chip, glyphs from the self-hosted icon font). They only need
   a positioned ancestor, which .ak-gallery-block-slideshow already provides --
   so they are deliberately left alone here. */

/* The featured-posts banner stacks its posts and fades all but the first via
   .post:not(:first-of-type){opacity:0}, which leaves every one of them taking
   up 600-700px of height. Overlay them and show one. */
.ak-featured-posts-gallery .gallery-wrapper .posts {
  position: relative;
}

.ak-featured-posts-gallery .gallery-wrapper .posts .post {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.ak-featured-posts-gallery .gallery-wrapper .posts .post.ak-active-slide {
  opacity: 1;
}

.ak-featured-posts-gallery .gallery-wrapper .posts .post > img,
.ak-featured-posts-gallery .gallery-wrapper .posts .post > a > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

/* ==================================================================== *
 * a. Fill-to-container images
 *
 * Two places mark an image as filling its box and relied on script to size
 * it. Their containers are already positioned by site.css --
 *   #thumbnail { position: absolute; top:0; left:0; bottom:0; right:0 }
 *   .ak-audio-playlist.has-album-cover .album-cover {
 *       position: absolute; top:0; right:0; bottom:0; left:0 }
 * -- but the img inside was left at its intrinsic size. Once the lazy loader
 * gives it a src that is up to 2048px wide, it either blows the page out
 * horizontally or shows a raw top-left crop instead of a cover fit.
 * ==================================================================== */

#thumbnail > img,
.album-cover.content-fill > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  object-position: 50% 50%;
}

/* The audio block's transport UI (album play button, per-track progress bars)
   was driven by script we no longer ship. The track titles are ordinary links
   to self-hosted mp3 files and still work, so keep those and drop the chrome
   that would otherwise sit there looking clickable but doing nothing. */
.ak-audio-playlist .album-controls,
.ak-audio-playlist .track-progress-bar {
  display: none;
}

/* ==================================================================== *
 * b. Nav affordances
 * ==================================================================== */

.mobile-nav-toggle,
.folder-toggle {
  cursor: pointer;
}

.mobile-nav-toggle:focus-visible,
.folder-toggle:focus-visible {
  outline: 2px solid #f6f6b6;
  outline-offset: 2px;
}

/* The account markup ships both states -- "Sign In" and "My Account" -- and
   script deleted the one that did not apply. There is no account system on a
   static archive, so neither belongs. */
.user-account-link {
  display: none !important;
}

/* ==================================================================== *
 * d. Lightbox
 *
 * Deliberately namespaced away from the class names site.css already styles,
 * so the light-theme overrides it carries for the old widget cannot reach in.
 * No external assets.
 * ==================================================================== */

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

.site-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0a;
}

.site-lightbox-figure {
  position: relative;
  margin: 0;
  padding: 0;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  opacity: 1 !important;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
}

.site-lightbox-count {
  position: absolute;
  bottom: 14px;
  left: 0;
  width: 100%;
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font: 600 13px/1 "proxima-nova", "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 2px;
  pointer-events: none;
}

.site-lightbox-btn {
  position: absolute;
  margin: 0;
  padding: 0;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 400 34px/1 sans-serif;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.12s ease-in-out;
}

.site-lightbox-btn:hover,
.site-lightbox-btn:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

.site-lightbox-btn:focus-visible {
  outline: 2px solid #f6f6b6;
  outline-offset: 2px;
}

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

.site-lightbox-prev {
  left: 16px;
  top: 50%;
  margin-top: -26px;
}

.site-lightbox-next {
  right: 16px;
  top: 50%;
  margin-top: -26px;
}

.site-lightbox-close {
  top: 16px;
  right: 16px;
  font-size: 28px;
}

/* Stop the page behind the viewer from scrolling. */
.site-lightbox-open,
.site-lightbox-open body {
  overflow: hidden;
}

@media only screen and (max-width: 640px) {
  .site-lightbox-btn {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }

  .site-lightbox-prev {
    left: 6px;
    margin-top: -22px;
  }

  .site-lightbox-next {
    right: 6px;
    margin-top: -22px;
  }
}
