/* Photo-first, minimal. Dark by default; [data-theme="light"] via the toggle. */

:root,
[data-theme="dark"] {
    --bg: #0f0f10;
    --surface: #18181b;
    --surface-2: #222226;
    --border: #2a2a2e;
    --text: #e8e8ea;
    --muted: #9a9aa2;
    --accent: #d9b36c;
    --ok: #5fb87a;
    --info: #7a9fd1;
    --warn: #e0a84a;
    --fail: #e0625c;
    --overlay: rgba(0, 0, 0, 0.55);
    --radius: 6px;
    --gutter: 16px;
    --gap: 6px;
    --row-height: 170px;
    --max-width: 1600px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f0f0f2;
    --border: #e2e2e6;
    --text: #1b1b1f;
    --muted: #63636b;
    --accent: #87601a; /* ≥ 4.5:1 on --bg and --surface-2 (WCAG AA) */
    --ok: #2e7d4a;
    --info: #3b64a0;
    --warn: #9a6a12;
    --fail: #b3322c;
    --overlay: rgba(0, 0, 0, 0.45);
    color-scheme: light;
}

@media (min-width: 700px) {
    :root { --gutter: 24px; --row-height: 230px; --gap: 8px; }
}

@media (min-width: 1400px) {
    :root { --row-height: 280px; }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
}

a {
    color: var(--accent);
}

img,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
}

/* The hidden attribute always wins over component display rules. */
[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -100px;
    padding: 8px 12px;
    background: var(--accent);
    color: var(--bg);
    z-index: 10;
}

.skip-link:focus {
    top: 8px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Header */

.site-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px var(--gutter);
    border-bottom: 1px solid var(--border);
}

.site-title {
    flex: none;
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.site-nav {
    flex: 1;
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
    mask-image: linear-gradient(90deg, #000 90%, transparent);
}

.site-nav::-webkit-scrollbar {
    display: none;
}

.site-nav a {
    padding: 6px 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text);
}

.site-nav a[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--accent);
}

/* Between the collections and the other ways to browse (Map, Keywords) */
.site-nav__divider {
    flex: none;
    align-self: center;
    width: 1px;
    height: 1.1em;
    margin: 0 -6px;           /* sits evenly between the links despite the nav's gap */
    background: var(--border);
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px var(--gutter) 48px;
}

/* Theme toggle: a half-filled circle */

.theme-toggle {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.theme-toggle__icon {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text);
    border-radius: 50%;
    background: linear-gradient(90deg, var(--text) 50%, transparent 50%);
}

/* Generic content */

.hero {
    max-width: 640px;
    margin: 8vh auto;
    text-align: center;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 300;
}

.lead {
    font-size: 1.15rem;
}

.muted {
    color: var(--muted);
}

.notice {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--warn);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
}

.button {
    display: inline-block;
    background: transparent;
    padding: 10px 18px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    text-decoration: none;
}

.button:hover {
    background: var(--accent);
    color: var(--bg);
}

.prose {
    max-width: 70ch;
    color: var(--text);
}

.prose p {
    margin: 0 0 0.8em;
}

.section {
    margin-top: 28px;
}

.section__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section__title {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.section__bar .section__title {
    margin: 0;
}

/* Breadcrumbs and page header */

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--muted);
}

.breadcrumbs li + li::before {
    content: "/";
    margin-right: 4px;
    opacity: 0.5;
}

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--text);
}

.page-header {
    margin-bottom: 8px;
}

.page-title {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 300;
    line-height: 1.2;
}

.page-subtitle {
    margin: 4px 0 0;
    font-size: 1.1rem;
    color: var(--muted);
}

.page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 8px 0 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Album cards */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Smaller cards (the home page's recent albums): about 2/3 the width, two across on phones */
.cards--small {
    grid-template-columns: repeat(auto-fill, minmax(min(40%, 175px), 1fr));
    gap: 14px;
}

.cards--small .card__title {
    font-size: 0.95rem;
}

.cards--small .card__meta {
    font-size: 0.8rem;
}

.card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card__image {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface-2);
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card__link:hover .card__image img {
    transform: scale(1.03);
}

.card__body {
    padding: 8px 2px 0;
}

.card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
}

.card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Layout switcher */

.view-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-switch__option {
    display: grid;
    place-items: center;
    width: 38px;
    height: 32px;
    color: var(--muted);
}

.view-switch__option + .view-switch__option {
    border-left: 1px solid var(--border);
}

.view-switch__option[aria-current="true"] {
    background: var(--surface-2);
    color: var(--text);
}

/* Tiny CSS icons for the three layouts */
.icon {
    display: block;
    width: 16px;
    height: 12px;
}

.icon--grid {
    background:
        linear-gradient(currentColor 0 0) 0 0 / 7px 5px no-repeat,
        linear-gradient(currentColor 0 0) 100% 0 / 7px 5px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 7px 5px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 7px 5px no-repeat;
}

.icon--justified {
    background:
        linear-gradient(currentColor 0 0) 0 0 / 10px 5px no-repeat,
        linear-gradient(currentColor 0 0) 100% 0 / 4px 5px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 9px 5px no-repeat;
}

.icon--masonry {
    background:
        linear-gradient(currentColor 0 0) 0 0 / 7px 7px no-repeat,
        linear-gradient(currentColor 0 0) 100% 0 / 7px 3px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 7px 3px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 7px 7px no-repeat;
}

/* Gallery tiles (shared) */

.gallery {
    margin: 0;
}

.tile {
    position: relative;
    min-width: 0; /* let wide panoramas shrink instead of overflowing */
    margin: 0;
    overflow: hidden;
    border-radius: 3px;
    background: var(--surface-2);
}

.tile__link {
    display: block;
    height: 100%;
    color: inherit;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*
 * Images and videos the visitor may not download ([data-protect], set by picture.html.twig and the
 * viewing modules; the lightbox marks itself): no long-press "Save to Photos" menu on iOS and no
 * dragging out in WebKit. gallery.js blocks the right-click menu and dragging elsewhere.
 */
img[data-protect],
video[data-protect],
[data-protect] img {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
}

.tile__caption {
    position: absolute;
    inset: auto 0 0;
    padding: 20px 10px 8px;
    background: linear-gradient(transparent, var(--overlay));
    color: #fff;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.tile__link:hover .tile__caption,
.tile__link:focus-visible .tile__caption {
    opacity: 1;
}

@media (hover: none) {
    .tile__caption { display: none; }
}

.tile__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--overlay);
    color: #fff;
    font-size: 0.75rem;
}

/* Justified rows: each tile grows in proportion to its aspect ratio (--r). */

.gallery--justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
}

.gallery--justified .tile {
    flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row-height));
    aspect-ratio: var(--r);
    max-height: calc(var(--row-height) * 1.8);
}

/* With JS, rows are fitted exactly (gallery.js sets each tile's size). */
.gallery--justified.is-fitted .tile {
    flex: none;
    aspect-ratio: auto;
    max-height: none;
}

.gallery--justified.is-fitted::after {
    display: none;
}

/* Without JS: a spacer that stops the last row from stretching. */
.gallery--justified::after {
    content: "";
    flex: 10000 1 0;
}

/* Uniform square grid */

.gallery--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(45%, 170px), 1fr));
    gap: var(--gap);
}

.gallery--grid .tile {
    aspect-ratio: 1;
}

/* Masonry columns */

.gallery--masonry {
    columns: 2 150px;
    column-gap: var(--gap);
}

@media (min-width: 700px) {
    .gallery--masonry { columns: 240px; } /* as many ~240px columns as fit */
}

.gallery--masonry .tile {
    break-inside: avoid;
    margin-bottom: var(--gap);
    aspect-ratio: var(--r);
}

.load-more {
    display: block;
    flex: 1 0 100%;
    column-span: all;
    grid-column: 1 / -1;
    margin: 20px auto 0;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-align: center;
    text-decoration: none;
    max-width: 220px;
}

.load-more:hover {
    border-color: var(--accent);
}

.load-more[aria-busy="true"] {
    opacity: 0.6;
    pointer-events: none;
}

/* Photo page */

.photo {
    display: grid;
    gap: 16px;
}

.photo__stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 40vh;
    margin: 0 calc(var(--gutter) * -1);
    background: #000;
    touch-action: pan-y pinch-zoom;
}

.photo__stage picture {
    display: contents;
}

.photo__media {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 140px);
    max-height: calc(100svh - 140px);
    object-fit: contain;
}

video.photo__media {
    width: 100%;
    background: #000;
}

.photo__nav {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    width: 22%;
    padding: 0 12px;
    color: #fff;
    font-size: 2.6rem;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo__nav--prev { left: 0; justify-content: flex-start; }
.photo__nav--next { right: 0; justify-content: flex-end; }

.photo__nav span[aria-hidden] {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--overlay);
    line-height: 1;
}

.photo__stage:hover .photo__nav,
.photo__nav:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .photo__nav { opacity: 0.8; width: 56px; }
}

/* Videos have their own controls; keep nav arrows off the control bar. */
.photo__stage:has(video) .photo__nav {
    bottom: 64px;
}

.photo__info {
    min-width: 0;
}

.photo__position {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.photo__position a {
    color: var(--muted);
    text-decoration: none;
}

.photo__position a:hover {
    color: var(--text);
}

.photo__title {
    margin: 0 0 6px;
    font-size: 1.4rem;
    font-weight: 400;
    line-height: 1.3;
}

.photo__caption {
    margin: 0 0 12px;
}

.photo__summary {
    margin: 12px 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.85rem;
}

.details {
    display: grid;
    margin: 12px 0;
    border-top: 1px solid var(--border);
}

.details__row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.details dt {
    color: var(--muted);
}

.details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.photo__map {
    font-size: 0.9rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.tag {
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (min-width: 1100px) {
    .page-photo .site-main {
        max-width: none;
    }

    .photo {
        grid-template-columns: minmax(0, 1fr) 360px;
        align-items: start;
        gap: 28px;
    }

    .photo__stage {
        margin: 0;
        min-height: calc(100vh - 140px);
        border-radius: var(--radius);
    }

    .photo__info {
        position: sticky;
        top: 20px;
    }
}

/* Album header actions */

.page-header__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.button--play {
    padding: 8px 16px;
    background: var(--accent);
    color: var(--bg);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.button--play:hover {
    filter: brightness(1.1);
}

.button--small {
    padding: 6px 12px;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.photo__actions {
    margin: 0 0 12px;
}

.icon--slider {
    background:
        linear-gradient(currentColor 0 0) 50% 0 / 10px 8px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 4px 2px no-repeat,
        linear-gradient(currentColor 0 0) 50% 100% / 4px 2px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 4px 2px no-repeat;
}

/* Slider layout: without JS it falls back to CSS rows; with JS the carousel
   replaces the tiles. */

.gallery--slider {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
}

.gallery--slider .tile {
    flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row-height));
    aspect-ratio: var(--r);
}

.gallery.has-slider {
    display: none;
}

.slider {
    margin-bottom: 16px;
}

.slider__main {
    position: relative;
    height: min(72vh, 900px);
    height: min(72svh, 900px);
    border-radius: var(--radius);
    background: #000;
}

/* Fill the slide and let object-fit letterbox: percentage heights don't
   resolve for grid-centred images, which then overflow. */
.slider__main .swiper-slide {
    display: block;
}

.slider__media {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

video.slider__media {
    cursor: auto;
}

.slider__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    border: 0;
    border-radius: 50%;
    background: var(--overlay);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.slider__nav--prev { left: 10px; }
.slider__nav--next { right: 10px; }

.slider__nav.swiper-button-disabled {
    opacity: 0.25;
    cursor: default;
}

.slider__counter {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--overlay);
    color: #fff;
    font-size: 0.8rem;
}

.slider__caption {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    min-height: 2.8em;
    padding: 10px 2px;
}

.slider__thumbs {
    height: 72px;
}

.slider__thumb {
    width: auto;
    height: 100%;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s;
}

.slider__thumb img {
    width: auto;
    height: 100%;
    border-radius: 3px;
}

.slider__thumb.swiper-slide-thumb-active,
.slider__thumb:hover {
    opacity: 1;
}

/* Captions shared by the lightbox, slider and slideshow */

.cap__title {
    font-weight: 600;
}

.cap__meta {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Lightbox (PhotoSwipe) additions */

.pswp {
    --pswp-bg: #000;
}

.pswp__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 12px;
    padding: 14px 16px 18px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s;
}

.pswp__caption .cap__meta {
    flex-basis: 100%;
    color: rgba(255, 255, 255, 0.7);
}

.pswp--ui-visible .pswp__caption:empty,
.pswp:not(.pswp--ui-visible) .pswp__caption {
    opacity: 0;
}

.pswp__button--slideshow,
.pswp__button--link,
.pswp__button--details {
    display: grid;
    place-items: center;
    width: 50px;
    height: 60px;
    color: #fff;
    text-decoration: none;
}

.pswp-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font: 600 12px/1 var(--font);
}

.pswp--info-open .pswp__button--details {
    color: var(--accent);
}

/* Lightbox info panel (i): beside the photo on wide screens, a sheet below it on phones.
   Always dark, like the lightbox. Width is kept in step with INFO_WIDTH in lightbox.js. */
.pswp__info {
    --text: #e8e8ea;
    --muted: #a3a3ab;
    --border: #34343a;
    --surface-2: #26262b;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    max-height: 50%;
    border-top: 1px solid var(--border);
    background: rgba(20, 20, 23, 0.97);
    color: var(--text);
    font-size: 0.95rem;
}

.pswp__info[hidden] {
    display: none;
}

@media (max-width: 899px) {
    .pswp--info-open .pswp__button--arrow {
        display: none; /* they'd sit on the panel's edge; swipe instead */
    }
}

@media (min-width: 900px) {
    .pswp__info {
        top: 60px;
        left: auto;
        width: 360px;
        max-height: none;
        border-top: 0;
        border-left: 1px solid var(--border);
    }

    .pswp--info-open .pswp__button--arrow--next {
        right: 360px;
    }
}

.pswp--info-open .pswp__caption {
    display: none; /* the panel says it all */
}

.pswp-info__head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 8px 4px 18px;
}

.pswp-info__title {
    flex: 1;
    min-width: 0;
    margin: 6px 0 0;
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.pswp-info__close {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
}

.pswp-info__close:hover,
.pswp-info__close:focus-visible {
    background: var(--surface-2);
    color: var(--text);
}

.pswp-info__body {
    flex: 1;
    min-height: 0;
    padding: 4px 18px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pswp-info__body[aria-busy="true"] {
    opacity: 0.8;
}

.pswp-info__body a {
    color: var(--text);
}

.pswp-info__body .tag {
    color: var(--muted);
    text-decoration: none;
}

/* The panel footer: "Copy link to this photo" (a button styled as a quiet link) */
.pswp-info__more {
    padding: 10px 18px 14px;
    border: 0;
    border-top: 1px solid var(--border);
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.pswp-info__more:hover,
.pswp-info__more:focus-visible {
    color: var(--text);
    text-decoration: underline;
}

/* The link button's chain icon sits in the same circle as the other top-bar icons. */
.pswp-icon--svg svg {
    display: block;
}

/* "Link to this photo copied": a short message at the top of the lightbox (lightbox.js say()). */
.pswp__toast {
    position: absolute;
    top: 64px;
    left: 50%;
    z-index: 3;
    max-width: calc(100% - 32px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(30, 30, 34, 0.95);
    color: #fff;
    font-size: 0.9rem;
    transform: translateX(-50%);
    pointer-events: none;
}

.pswp__toast[hidden] {
    display: none;
}

/* The temporary input the copy fallback selects (lightbox.js shareLink()); never seen. */
.pswp-copy-input {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pswp-video {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
}

.pswp-video__media {
    max-width: 100%;
    max-height: calc(100% - 120px);
}

/* Slideshow */

.ss-open {
    overflow: hidden;
}

.ss {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #000;
    color: #fff;
    cursor: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    outline: none;
}

.ss.ss--ui {
    cursor: default;
}

.ss__layer {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.ss[data-transition="none"] .ss__layer {
    transition: none;
}

.ss__layer.is-active {
    opacity: 1;
}

.ss__media {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Ken Burns: slow zoom and drift, four variations. */
.ss__media--kb {
    /* Runs slightly longer than the photo is shown, so it never stops moving. */
    animation-duration: calc(var(--ss-interval, 6s) + 1.5s);
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

.ss__media--kb0 { animation-name: ss-kb0; }
.ss__media--kb1 { animation-name: ss-kb1; }
.ss__media--kb2 { animation-name: ss-kb2; }
.ss__media--kb3 { animation-name: ss-kb3; }

@keyframes ss-kb0 { from { transform: scale(1); } to { transform: scale(1.12) translate(-2%, -1%); } }
@keyframes ss-kb1 { from { transform: scale(1.12) translate(2%, 1%); } to { transform: scale(1); } }
@keyframes ss-kb2 { from { transform: scale(1.02) translate(-1.5%, 1%); } to { transform: scale(1.14) translate(1.5%, -1%); } }
@keyframes ss-kb3 { from { transform: scale(1.14) translate(-1%, -1.5%); } to { transform: scale(1.02) translate(1%, 1%); } }

.ss__progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ss__bar {
    width: 100%;
    height: 100%;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0);
}

.ss__bar.is-running {
    animation: ss-progress var(--ss-interval, 6s) linear forwards;
}

@keyframes ss-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.ss__top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
}

.ss__counter {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.ss__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-wrap: wrap;
    gap: 2px 14px;
    padding: 40px 24px 22px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    font-size: clamp(0.95rem, 1.6vw, 1.3rem);
    transition: transform 0.3s;
}

.ss__caption .cap__meta {
    flex-basis: 100%;
    color: rgba(255, 255, 255, 0.7);
}

.ss--captions .ss__caption:not(:empty) {
    display: flex;
}

.ss__controls {
    position: absolute;
    left: 50%;
    bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    max-width: calc(100% - 24px);
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(20, 20, 22, 0.85);
    transform: translateX(-50%);
}

.ss__group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ss__btn {
    display: grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font: 600 1.05rem/1 var(--font);
    cursor: pointer;
}

.ss__btn:hover,
.ss__btn[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.14);
}

.ss__select {
    height: 36px;
    padding: 0 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: #1d1d20;
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
}

/* Controls fade out after a few seconds of inactivity. */
.ss__top,
.ss__controls {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.ss--ui .ss__top,
.ss--ui .ss__controls,
.ss--ui .ss__progress {
    opacity: 1;
    pointer-events: auto;
}

/* Lift the caption above the controls while they're showing. */
.ss--ui .ss__caption {
    transform: translateY(-80px);
}

@media (max-width: 600px) {
    .ss--ui .ss__caption { transform: translateY(-120px); }
}

/* Account links in the header */

.site-account {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
}

.site-account a {
    color: var(--muted);
    text-decoration: none;
}

.site-account a:hover {
    color: var(--text);
}

.site-account form {
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    text-decoration: none; /* an <a class="link-button"> looks like the buttons until hovered */
    cursor: pointer;
}

.link-button:hover {
    color: var(--text);
    text-decoration: underline;
}

/* Forms and alerts (sign-in, setup, admin) */

.auth {
    max-width: 420px;
    margin: 6vh auto;
}

.auth h1 {
    font-weight: 300;
}

.form {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    align-content: start; /* don't stretch inputs to the row height */
    gap: 4px;
    min-width: 0;
}

.field label {
    font-size: 0.9rem;
    font-weight: 500;
}

.field input:not([type="checkbox"]),
.field textarea,
.field select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.field textarea {
    resize: vertical;
    line-height: 1.45;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 0;
    border-color: transparent;
}

.field--check {
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 8px;
}

.field--check .field__help {
    grid-column: 2;
}

.field__help {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.field__error {
    margin: 0;
    color: var(--fail);
    font-size: 0.85rem;
}

.field--error input,
.field--error textarea {
    border-color: var(--fail);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 14px;
}

.button--primary {
    background: var(--accent);
    color: var(--bg);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    justify-self: start;
}

.button--primary:hover {
    filter: brightness(1.1);
    background: var(--accent);
}

button.button {
    font: inherit;
    cursor: pointer;
}

.alert {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-left: 3px solid var(--info);
    border-radius: var(--radius);
    background: var(--surface);
}

.alert--success { border-left-color: var(--ok); }
.alert--warning { border-left-color: var(--warn); }
.alert--error { border-left-color: var(--fail); }

.code {
    overflow-x: auto;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--mono);
    font-size: 0.85rem;
}

/* Environment check */

.check {
    max-width: 900px;
    margin: 0 auto;
}

.check h1 {
    font-weight: 300;
}

.check h2 {
    margin: 32px 0 8px;
    font-size: 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.summary {
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border-left: 3px solid var(--ok);
}

.summary--warn { border-left-color: var(--warn); }
.summary--fail { border-left-color: var(--fail); }

.table-wrap {
    overflow-x: auto;
}

.check-table {
    width: 100%;
    border-collapse: collapse;
}

.check-table th,
.check-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.check-table th {
    width: 32%;
    font-weight: 500;
}

.check-table .detail {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.badge {
    display: inline-block;
    min-width: 64px;
    padding: 2px 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.8rem;
    text-align: center;
}

.badge--ok { color: var(--ok); }
.badge--info { color: var(--info); }
.badge--warn { color: var(--warn); }
.badge--fail { color: var(--fail); }

@media (max-width: 600px) {
    /* Stack each row: name + badge on one line, detail underneath. */
    .check-table tr { display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid var(--border); }
    .check-table th,
    .check-table td { border-bottom: 0; }
    .check-table th { width: auto; }
    .check-table .detail { grid-column: 1 / -1; padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Access pages and account forms */

.lock-icon {
    margin: 0;
    font-size: 2rem;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.fieldset {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.fieldset legend {
    padding: 0 6px;
    font-weight: 500;
}

/* Locked (password) album cards */

.card__image--locked {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 2.2rem;
}

.card__lock {
    margin-right: 4px;
}

/* Buttons in forms size to their label rather than the grid column. */
.form > .button,
.form > button {
    justify-self: start;
}

/* Header search and map link */

.site-tools {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-search input {
    width: 150px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    transition: width 0.2s;
}

.site-search input:focus {
    width: 220px;
    outline: 2px solid var(--accent);
    border-color: transparent;
}

@media (max-width: 700px) {
    /* Phones: three rows rather than links hidden off the edge. Row 1: the title, then the account
       links and theme button pushed right. Row 2: search, full width. Row 3: the nav, wrapping. */
    .site-header { flex-wrap: wrap; gap: 8px 14px; }
    .site-account { margin-left: auto; }
    .site-tools { order: 9; flex-basis: 100%; }
    .site-search { flex: 1; }
    .site-nav { order: 10; flex-basis: 100%; flex-wrap: wrap; row-gap: 2px; overflow: visible; mask-image: none; }
    .site-search input,
    .site-search input:focus { width: 100%; }
}

/* Search page */

.search-form {
    display: grid;
    gap: 10px;
    margin: 0 0 20px;
}

.search-form__main {
    display: flex;
    gap: 8px;
}

.search-form__main input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.search-form__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    color: var(--muted);
    font-size: 0.9rem;
}

.search-form__filters select {
    margin-left: 4px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

/* Tag cloud and tag links */

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tag-cloud__tag {
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
}

.tag-cloud__tag:hover { color: var(--accent); }
.tag-cloud__tag .muted { font-size: 0.75em; }
.tag-cloud__tag--1 { font-size: 0.9rem; opacity: 0.8; }
.tag-cloud__tag--2 { font-size: 1rem; }
.tag-cloud__tag--3 { font-size: 1.2rem; }
.tag-cloud__tag--4 { font-size: 1.45rem; }
.tag-cloud__tag--5 { font-size: 1.75rem; }

a.tag {
    display: inline-block;
    text-decoration: none;
}

a.tag:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* Maps */

.icon--map {
    background:
        radial-gradient(circle at 50% 38%, transparent 2px, currentColor 2.5px, currentColor 4.5px, transparent 5px),
        linear-gradient(currentColor 0 0) 50% 100% / 2px 5px no-repeat;
}

.gallery.has-map {
    display: none;
}

.album-map {
    height: min(70vh, 720px);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.album-map__note {
    margin: 8px 0 0;
    font-size: 0.85rem;
}

.mini-map {
    height: 200px;
    margin: 12px 0 4px;
    border-radius: var(--radius);
    background: var(--surface-2);
}

.page-map .site-main {
    max-width: none;
    padding: 0;
}

.world-map {
    position: relative;
    height: calc(100vh - 110px);
    height: calc(100svh - 110px);
    min-height: 360px;
    background: var(--surface-2);
}

.world-map__status {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 500;
    margin: 0;
    transform: translate(-50%, -50%);
    color: var(--muted);
}

.map-popup {
    display: grid;
    gap: 4px;
    min-width: 160px;
    font: 13px/1.4 var(--font);
}

.map-popup__link {
    display: grid;
    gap: 6px;
    color: #1b1b1f;
    text-decoration: none;
}

.map-popup__link img {
    width: 160px;
    height: auto;
    border-radius: 4px;
}

.map-popup__meta {
    color: #63636b;
}

/* Leaflet controls follow the theme a little in dark mode. */
[data-theme="dark"] .leaflet-container {
    background: #1d1d20;
}

.pswp__button--download {
    display: grid;
    place-items: center;
    width: 50px;
    height: 60px;
    color: #fff;
}

.page-header__top .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/*
 * Modal cards (<dialog class="dialog">): the admin pages' (admin.js initDialogs, e.g. Groups →
 * Create group) and the public pages' (modules/save.js "Photo ready"), with a row of buttons in
 * .actions. Here rather than in admin.css because both use them.
 */
.dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.dialog h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 600;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* A Download button while the photo is being fetched for the share sheet (modules/save.js). */
a[data-save][aria-busy="true"],
.pswp__button--download[aria-busy="true"] {
    cursor: progress;
    opacity: 0.6;
}
