/* Design tokens.
*
* Every colour in this file used to be a literal, which meant each one needed its
* own `prefers-color-scheme` override; there were about twenty of them. Now the
* dark theme redefines the tokens once, below, and nothing else has to know.
*
* `color-scheme` is what tells the browser to render its own chrome - scrollbars,
* the native video controls, form widgets - to match. Without it those stayed
* light on a black page.
*/
:root {
color-scheme: light dark;
--page-bg: #fff;
--page-fg: #2e2f30;
/* The gutter between grid items. Drawn as an outline, not a gap: outlines take
no space, so the flex-grow row justification below still adds up. */
--gutter-color: #fff;
--control-bg: rgba(200, 200, 200, .25);
--control-bg-hover: rgba(200, 200, 200, .5);
--control-bg-active: rgba(200, 200, 200, .25);
--control-fg: #1a1a1a;
--meta-bg: rgba(200, 200, 200, .5);
--meta-bg-hover: rgba(200, 200, 200, .75);
--meta-bg-active: rgba(200, 200, 200, 1);
--scrim: rgba(0, 0, 0, .25);
--scrim-strong: rgba(0, 0, 0, .5);
/* Height of the browser's native 
<video> control bar. Nothing exposes the real
  figure, so this is the tallest of them (Chrome on Android, Safari on iOS);
  desktop bars are nearer 40px and the extra few pixels do no harm. The grid
  reserves this strip along the bottom of a video tile so the bar stays
  clickable - see .item:has(> video) below. */
  --video-controls: 48px;
  /* Set once here rather than branching on HEADER_ENABLED in four separate rules. */
  --header-height: 0px;
  --links-top: 24px;
  }
  @media (prefers-color-scheme: dark) {
  :root {
  --page-bg: #000;
  --page-fg: #eee;
  --gutter-color: #000;
  /* These four were commented out for years with the note "Disable until Safari
  supports prefers-color-scheme in SVG's". That was never really a colour-scheme
  problem - it was that the icons were SVGs loaded as background images, so CSS
  could not recolour them. They are masks now (see @mixin button), so the icon
  takes its colour from `color` and this works. */
  --control-bg: rgba(0, 0, 0, .35);
  --control-bg-hover: rgba(0, 0, 0, .55);
  --control-bg-active: rgba(0, 0, 0, .75);
  --control-fg: #f0f0f0;
  --meta-bg: rgba(0, 0, 0, .5);
  --meta-bg-hover: rgba(0, 0, 0, .7);
  --meta-bg-active: rgba(0, 0, 0, .9);
  }
  }
  * {
  padding: 0;
  margin: 0;
  font-size: 1em;
  box-sizing: border-box;
  }
  /* Scoped rather than universal: `list-style: none` on every element strips list
  semantics in Safari + VoiceOver, so a gallery stops announcing "list, 40 items". */
  .grid,
  .links,
  .meta {
  list-style: none;
  }
  /* Hides a label from sight while leaving it to assistive technology. Replaces the
  old `text-indent: 150%` trick, which pushed real text sideways out of an
  overflow:hidden box and broke as soon as anything wanted to wrap. */
  .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  }
  /* An icon control. The SVG is a mask, not a background image, so `background-color`
  colours it and it follows the theme; as a background-image it was stuck in whatever
  colours the file shipped with. */
  body,
  html {
  min-height: 100%;
  }
  body {
  font: 16px/24px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  background: var(--page-bg);
  color: var(--page-fg);
  }
  /* HEADER */
  header {
  position: sticky;
  top: 0;
  height: 60px;
  padding: 18px 0 0 24px;
  z-index: 10;
  }
  header span#breadcrumb {
  margin-left: 16px;
  margin-right: 16px;
  }
  /* MAIN */
  main {
  display: flex;
  }
  /* PHOTO GRID */
  .grid {
  display: flex;
  flex-wrap: wrap;
  position: relative;
  align-content: flex-start;
  }
  .grid:after {
  content: "";
  display: block;
  flex-grow: 10;
  outline: 2px solid var(--gutter-color);
  position: relative;
  }
  .grid .photodetail-links {
  display: none;
  }
  .grid .item {
  height: 40vh;
  flex-grow: 1;
  outline: 2px solid var(--gutter-color);
  position: relative;
  background-size: cover;
  /* :focus-within, not :focus - the 
  <li> itself is not focusable, so the old
    :focus never fired; what should reveal the controls is a child of the item
    taking keyboard focus. */
    /* Direct children only: the toolbar carries a second .close, and it must
    keep the pill geometry it inherits from .links rather than being stretched
    across the whole item. */
    /* A video tile carries the browser's own control bar, and the full-bleed
    .open anchor above it would swallow every click aimed at it - which is
    the only way to unmute. So the anchor stops short of the bar: tap the
    picture to open the clip, tap the bar to scrub or turn the sound on.
    The .meta pills sit at bottom: 12px and have to clear it too. */
    /* PHOTO DETAIL */
    }
    .grid .item:focus-within .meta .gridview-button, .grid .item:hover .meta .gridview-button {
    visibility: visible;
    }
    .grid .item > img,
    .grid .item > video {
    max-height: 100%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    object-fit: cover;
    display: block;
    }
    .grid .item > .open,
    .grid .item > .close {
    position: absolute;
    inset: 0;
    }
    .grid .item .open {
    cursor: zoom-in;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.15s ease-out;
    /* No tint on touch at all, and none on hover anywhere: darkening the
    photograph someone is looking at is not a helpful thing to do.
    :active fires under a finger, and closing a photo hands focus back to
    the tile it came from (js/app.js), which a browser may well treat as
    focus-visible - leaving one tile dark on the grid you just returned
    to, which reads as a hover that will not let go.
    Behind a pointer query rather than deleted, because a keyboard user
    needs to see where they are, and a mouse press should acknowledge
    itself. Touch devices keep the browser's own focus ring either way. */
    }
    @media (hover: hover) and (pointer: fine) {
    .grid .item .open:focus-visible {
    background-color: var(--scrim);
    }
    .grid .item .open:active {
    background-color: var(--scrim-strong);
    }
    }
    .grid .item > .close {
    display: none;
    cursor: zoom-out;
    }
    .grid .item:has(> video) > .open {
    bottom: var(--video-controls);
    }
    .grid .item:has(> video) .meta {
    bottom: calc(12px + var(--video-controls));
    }
    .grid .item .full {
    display: none;
    }
    .grid .item .previous,
    .grid .item .next {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: 80px;
    display: none;
    align-items: center;
    justify-content: center;
    }
    .grid .item .previous span,
    .grid .item .next span {
    display: block;
    position: relative;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    white-space: nowrap;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--control-fg);
    background-color: var(--control-bg);
    transition: background-color 0.1s linear;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    cursor: pointer;
    pointer-events: none;
    }
    .grid .item .previous span:hover, .grid .item .previous span:focus-visible,
    .grid .item .next span:hover,
    .grid .item .next span:focus-visible {
    background-color: var(--control-bg-hover);
    }
    .grid .item .previous span:active,
    .grid .item .next span:active {
    background-color: var(--control-bg-active);
    }
    .grid .item .previous span::before,
    .grid .item .next span::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-left.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .grid .item .previous:hover span, .grid .item .previous:focus-visible span,
    .grid .item .next:hover span,
    .grid .item .next:focus-visible span {
    background-color: var(--control-bg-hover);
    }
    .grid .item .previous:active span,
    .grid .item .next:active span {
    background-color: var(--control-bg-active);
    }
    .grid .item .next {
    right: 0;
    left: auto;
    }
    .grid .item .next span::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-right.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .grid .item .meta {
    display: flex;
    position: absolute;
    right: 4px;
    bottom: 12px;
    opacity: 0.5;
    }
    .grid .item .meta li {
    margin-right: 12px;
    }
    .grid .item .meta li .download::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-download.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .grid .item .meta li .share {
    cursor: pointer;
    }
    .grid .item .meta li .share::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-share.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .grid .item .meta li .gridview-button {
    display: block;
    position: relative;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    white-space: nowrap;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--control-fg);
    background-color: var(--control-bg);
    transition: background-color 0.1s linear;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    cursor: pointer;
    background-color: var(--meta-bg);
    }
    .grid .item .meta li .gridview-button:hover, .grid .item .meta li .gridview-button:focus-visible {
    background-color: var(--control-bg-hover);
    }
    .grid .item .meta li .gridview-button:active {
    background-color: var(--control-bg-active);
    }
    @media not all and (hover: none) {
    .grid .item .meta li .gridview-button {
    visibility: hidden;
    }
    }
    .grid .item .meta li .gridview-button:focus-visible, .grid .item .meta li .gridview-button:hover {
    background-color: var(--meta-bg-hover);
    }
    .grid .item .meta li .gridview-button:active {
    background-color: var(--meta-bg-active);
    }
    .grid .item.target {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: 0;
    /* dvh, not vh: the mobile URL bar collapsing used to clip the bottom of
    the fullscreen view. */
    height: calc(100dvh - var(--header-height));
    z-index: 10;
    background: var(--page-bg);
    display: flex;
    align-items: center;
    }
    .grid .item.target .photodetail-links {
    display: flex;
    z-index: 21;
    }
    .grid .item.target .open {
    display: none;
    }
    .grid .item.target > .close {
    display: block;
    }
    .grid .item.target > img {
    object-fit: contain;
    animation: fade-in 0.5s ease-out;
    }
    .grid .item.target video {
    object-fit: contain;
    animation: fade-in 0.5s ease-out;
    /* Sits above the full-bleed .close anchor, which would otherwise
    swallow every click aimed at the native playback controls.
    .previous/.next stay reachable at z-index 20. */
    position: absolute;
    inset: 0;
    z-index: 15;
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: #000;
    }
    .grid .item.target .full {
    display: block;
    position: absolute;
    inset: 0;
    animation: fade-in 0.5s ease-out;
    }
    .grid .item.target .full img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    }
    .grid .item.target .meta {
    display: none !important;
    }
    .grid .item.target .previous,
    .grid .item.target .next,
    .grid .item.target .download {
    display: flex;
    }
    /* SOCIAL LINKS */
    .links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* In flow underneath the grid, not floating over it: a solid pill pinned to
    the corner sat on top of somebody's photograph at every scroll position. */
    }
    .links.bottom {
    justify-content: center;
    padding: 56px 24px 72px;
    }
    .links.top {
    position: fixed;
    /* The insets matter on a notched iPhone in landscape, where the photo runs
    under the sensor housing - viewport-fit=cover is what puts it there. */
    right: calc(24px + env(safe-area-inset-right, 0px));
    top: calc(var(--links-top) + env(safe-area-inset-top, 0px));
    }
    .links li {
    /* The only control left in this row, and the one thing most visitors come
    for, so it opts out of the icon pill: a solid inverted button that says
    what it does and how big the download is. A title attribute would not
    do - tooltips do not exist on a phone, which is where most of these
    visitors are. */
    }
    .links li a,
    .links li button {
    display: block;
    position: relative;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    white-space: nowrap;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--control-fg);
    background-color: var(--control-bg);
    transition: background-color 0.1s linear;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    cursor: pointer;
    }
    .links li a:hover, .links li a:focus-visible,
    .links li button:hover,
    .links li button:focus-visible {
    background-color: var(--control-bg-hover);
    }
    .links li a:active,
    .links li button:active {
    background-color: var(--control-bg-active);
    }
    .links li.github a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-github.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.twitter a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-twitter.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.instagram a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-instagram.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.close-control a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-close.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.rss a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-rss.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.sort a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-sort.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.download a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-download.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.share button {
    cursor: pointer;
    }
    .links li.share button::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url(../img/icon-share.svg);
    mask-repeat: no-repeat;
    mask-position: 8px center;
    mask-size: 16px;
    background-color: var(--control-fg);
    }
    .links li.download-all a {
    width: auto;
    height: 40px;
    border-radius: 20px;
    padding: 0 20px 0 44px;
    font-size: 13px;
    line-height: 40px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-decoration: none;
    /* Inverted rather than tinted: it has to hold its own against
    whatever photo happens to be behind it, in either theme. */
    color: var(--page-bg);
    background-color: var(--page-fg);
    }
    .links li.download-all a::before {
    content: "";
    position: absolute;
    inset: 0;
    mask-image: url("../img/icon-download.svg");
    mask-repeat: no-repeat;
    mask-position: 18px center;
    mask-size: 18px;
    background-color: var(--page-bg);
    }
    .links li.download-all a:hover, .links li.download-all a:focus-visible, .links li.download-all a:active {
    background-color: var(--page-fg);
    opacity: 0.85;
    }
    .links li.download-all .size {
    font-weight: 500;
    opacity: 0.7;
    }
    .links li.link a {
    /* The one link that shows its own text, so it opts out of the
    fixed-size icon pill. */
    width: auto;
    font-size: 13px;
    line-height: 32px;
    text-transform: uppercase;
    padding: 0 12px;
    color: var(--control-fg);
    font-weight: 600;
    text-decoration: none;
    }
    /* 404 */
    .four-oh-four {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 64px;
    align-items: center;
    justify-content: center;
    text-align: center;
    }
    .four-oh-four h1 {
    font-size: 32px;
    line-height: 48px;
    font-weight: 700;
    }
    .four-oh-four p {
    margin-bottom: 32px;
    }
    .four-oh-four a {
    display: block;
    position: relative;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    white-space: nowrap;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--control-fg);
    background-color: var(--control-bg);
    transition: background-color 0.1s linear;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    cursor: pointer;
    width: auto;
    font-size: 13px;
    line-height: 32px;
    text-transform: uppercase;
    padding: 0 12px;
    color: var(--control-fg);
    font-weight: 600;
    text-decoration: none;
    }
    .four-oh-four a:hover, .four-oh-four a:focus-visible {
    background-color: var(--control-bg-hover);
    }
    .four-oh-four a:active {
    background-color: var(--control-bg-active);
    }
    /* RESPONSIVE */
    @media (max-aspect-ratio: 1/1) {
    .grid .item {
    height: 30vh;
    }
    }
    @media (max-height: 480px) {
    .grid .item {
    height: 80vh;
    }
    }
    @media (max-aspect-ratio: 1/1) and (max-width: 480px) {
    .grid {
    flex-direction: row;
    }
    .grid .item {
    height: auto;
    width: 100%;
    }
    .grid .item > img,
    .grid .item > video {
    width: 100%;
    height: auto;
    }
    .grid .item .previous,
    .grid .item .next {
    width: 25vw;
    }
    .grid .item .previous span,
    .grid .item .next span {
    display: none;
    }
    .grid .item .previous {
    cursor: w-resize;
    }
    .grid .item .next {
    cursor: e-resize;
    }
    .grid .item .meta li .gridview-button {
    visibility: visible;
    }
    }
    /* ANIMATIONS */
    @keyframes fade-in {
    0% {
    opacity: 0;
    }
    100% {
    opacity: 1;
    }
    }
    @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    }
    }