a {
    transition: color 180ms ease, text-shadow 180ms ease;
}

a:hover {
    color: #f0d78f;
    text-shadow: 0 0 9px rgba(228, 196, 107, 0.7);
}

.gallery-skip {
    position: absolute;
    left: 12px;
    top: -80px;
    padding: 14px;
    background: var(--bg);
    z-index: 10;
}
.gallery-skip:focus {
    top: 12px;
}
nav [aria-current] {
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
}
.gallery-main {
    padding: 30px 6% 80px;
    min-height: 70vh;
}
.gallery-intro {
    margin: 20px 0 40px;
}
.gallery-intro h1 {
    margin: 14px 0;
    font-size: clamp(44px, 6vw, 74px);
}
.gallery-intro > p:last-child {
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}
.gallery-filters {
    display: flex;
    align-items: end;
    gap: 18px;
    border-block: 1px solid var(--line);
    padding: 24px 0;
    flex-wrap: wrap;
}
.gallery-filters label {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 11px;
    letter-spacing: 0.5px;
    flex: 1;
    min-width: 160px;
}
.gallery-filters label:first-child {
    flex: 2;
}
.gallery-filters input,
.gallery-filters select {
    width: 100%;
    min-height: 46px;
    background: #1b231e;
    border: 1px solid #ffffff30;
    border-radius: 3px;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    padding: 12px;
}
.gallery-filters button,
#more,
#retry {
    min-height: 46px;
    padding: 12px 20px;
    border: 1px solid var(--line);
    background: none;
    border-radius: 3px;
}
.gallery-status {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    color: var(--muted);
    font-size: 13px;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 22px;
}
.gallery-card {
    display: block;
    width: 100%;
    border: 0;
    background: none;
    text-align: left;
    padding: 0;
}
.gallery-card .frame {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3/2;
    background: #090e0b;
    overflow: hidden;
}
.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s;
}
.gallery-card:hover img {
    opacity: 0.85;
}
.gallery-card .label {
    display: block;
    font-family: Georgia, serif;
    font-size: calc(15px + 2pt);
    line-height: 1.4;
    margin-top: 14px;
    text-align: center;
}
.gallery-card .meta {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
    margin-top: 7px;
    text-align: center;
}
#more {
    display: block;
    margin: 38px auto 0;
}
#empty {
    color: var(--muted);
    padding: 30px 0;
    line-height: 1.8;
}
[hidden],
#more[hidden] {
    display: none !important;
}
body.viewer-open {
    overflow: hidden;
}
#photo-viewer {
    width: 96vw;
    max-width: 1600px;
    height: 94dvh;
    max-height: 94dvh;
    padding: 0;
    border: 1px solid transparent;
    background: #0b100d;
    overflow: auto;
}
#photo-viewer:focus {
    outline: none;
}
#photo-viewer::backdrop {
    background: #000e;
}
.viewer-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0b100df5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    font-size: 12px;
}
.viewer-toolbar > div {
    display: flex;
    gap: 12px;
}
.viewer-toolbar button {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: none;
}
.viewer-stage {
    position: relative;
    height: calc(94dvh - 240px);
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 56px;
    touch-action: pan-y pinch-zoom;
}
#full-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#previous,
#next {
    position: absolute;
    top: calc(50% - 25px);
    width: 44px;
    height: 50px;
    z-index: 1;
    border: 1px solid #ffffff18;
    border-radius: 4px;
    background: #080d0bb0;
    color: #fff9;
    opacity: 0.62;
    transition: opacity 180ms ease, background-color 180ms ease, border-color 180ms ease;
    font-size: 34px;
    line-height: 1;
}
#previous:focus-visible,
#next:focus-visible {
    opacity: 0.92;
    background: #080d0be8;
    border-color: #ffffff45;
}
@media (hover: hover) {
    #previous:hover,
    #next:hover {
        opacity: 0.92;
        background: #080d0be8;
        border-color: #ffffff45;
    }
}
#previous {
    left: 6px;
}
#next {
    right: 6px;
}
button:disabled {
    opacity: 0.3;
    cursor: default;
}
#image-error {
    position: absolute;
    background: #101812;
    padding: 20px;
    max-width: 75%;
    text-align: center;
}
#photo-details {
    padding: 20px 60px 28px;
}
#photo-title {
    font-size: 26px;
    margin: 0;
}
#photo-details p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    margin: 8px 0;
}
#photo-tags {
    color: var(--accent) !important;
}
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 540px) {
    .gallery-main {
        padding: 15px 5% 55px;
    }
    .gallery-intro {
        margin: 15px 0 28px;
    }
    .gallery-filters {
        gap: 14px;
    }
    .gallery-filters label {
        min-width: 0;
        flex-basis: 40%;
    }
    .gallery-filters label:first-child {
        flex-basis: 100%;
    }
    .gallery-filters button {
        font-size: 12px;
    }
    .gallery-grid {
        gap: 26px 13px;
    }
    .gallery-card .label {
        font-size: calc(15px + 2pt);
    }
    .gallery-card .meta {
        font-size: 10px;
    }
    #photo-viewer {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
    }
    .viewer-toolbar {
        padding: 8px 10px;
    }
    .viewer-toolbar > div {
        gap: 7px;
    }
    .viewer-toolbar button {
        font-size: 11px;
        padding: 10px;
    }
    .viewer-stage {
        height: calc(100dvh - 260px);
        padding: 0 8px;
    }
    #previous,
    #next {
        top: calc(50% - 25px);
        bottom: auto;
        width: 44px;
        height: 50px;
        background: #080d0b88;
        opacity: 0.48;
    }
    #previous:focus-visible,
    #next:focus-visible {
        opacity: 0.86;
    }
    #photo-details {
        padding: 20px;
    }
    #photo-title {
        font-size: 23px;
    }
}

.gallery-card:hover img {
    opacity: 1;
}
.gallery-card img {
    transition: transform 1.2s ease;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .gallery-card:hover img {
        transform: scale(1.045);
    }
}
#photo-viewer[open] {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.viewer-toolbar {
    flex: none;
    position: relative;
}
.viewer-stage {
    height: auto;
    min-height: 100px;
    flex: 1;
    padding: 0;
    overflow: hidden;
}
#image-viewport {
    position: absolute;
    inset: 0 56px;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
}
#image-viewport.can-pan {
    cursor: grab;
}
#image-viewport.dragging {
    cursor: grabbing;
}
#image-viewport #full-photo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: fill;
    user-select: none;
}
.image-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-block: 1px solid var(--line);
    flex: none;
}
.image-controls button {
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: 1px solid var(--line);
    padding: 8px 12px;
    font-size: 12px;
}
.image-controls button[aria-pressed='true'] {
    border-color: var(--accent);
    color: var(--accent);
}
#zoom-level {
    min-width: 48px;
    text-align: center;
    font-size: 12px;
}
.image-hint {
    font-size: 11px;
    color: var(--muted);
    margin-left: 12px;
}
#photo-details {
    flex: none;
    max-height: 26vh;
    overflow: auto;
}
.viewer-expanded#photo-viewer {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
}
@media (max-width: 540px) {
    #image-viewport {
        inset: 0 8px;
    }
    .image-controls {
        gap: 5px;
        padding: 8px;
    }
    .image-controls button {
        padding: 8px;
        font-size: 11px;
    }
    .image-hint {
        display: none;
    }
    #photo-details {
        padding: 14px 20px;
        max-height: 24dvh;
    }
    .viewer-stage {
        min-height: 100px;
    }
    .image-controls #image-expand {
        display: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .gallery-card img {
        transition: none;
    }
    .gallery-card:hover img {
        transform: none;
    }
}
.image-loading {
    position: absolute;
    inset: 45% 0 auto;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* Gallery: compact introduction, persistent search, generous image viewport. */
body.gallery-page > header {
    padding: 6px 5%;
    gap: 12px;
}
body.gallery-page > header .brand-logo {
    width: 180px;
    max-height: 61px;
}
.gallery-main {
    padding-top: 8px;
}
.gallery-intro {
    margin: 0 0 14px;
}
.gallery-intro .eyebrow {
    font-size: 9px;
    margin: 3px 0;
}
.gallery-intro h1 {
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin: 5px 0;
}
.gallery-intro > p:last-child {
    font-size: 13px;
    line-height: 1.4;
    margin: 5px 0;
}
.gallery-filters {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    padding: 10px 0;
    gap: 12px;
}
.gallery-filters label {
    gap: 4px;
    min-width: 120px;
}
.gallery-filters label:first-child {
    flex: 3;
}
.gallery-filters input,
.gallery-filters select {
    min-height: 40px;
    padding: 8px 10px;
}
.gallery-filters button {
    min-height: 40px;
    padding: 8px 14px;
}
.gallery-status {
    margin: 8px 0;
}
.gallery-status p {
    margin: 5px 0;
}
.gallery-card .label {
    margin-top: 4px;
    font-size: calc(15px + 2pt);
    line-height: 1.3;
}
.gallery-card .meta {
    margin-top: 1px;
}
.viewer-toolbar {
    padding: 4px 12px;
}
.viewer-toolbar button {
    min-height: 36px;
    padding: 6px 10px;
}
.image-controls {
    padding: 5px 12px;
    gap: 6px;
}
.image-controls button {
    min-height: 34px;
    min-width: 36px;
    padding: 5px 9px;
}
.image-hint {
    margin-left: 6px;
}
#photo-details {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 14px;
    padding: 8px 18px;
    max-height: 88px;
}
#photo-title {
    font-size: 17px;
    line-height: 1.3;
    margin: 0;
}
#photo-details p {
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    text-align: left;
}
#photo-details p:empty {
    display: none;
}
#photo-description {
    order: 2;
    flex-basis: 100%;
}
#photo-tags {
    order: 3;
}
#image-viewport {
    inset: 0 48px;
}
@media (max-width: 700px) {
    body.gallery-page > header {
        gap: 2px;
        padding: 5px 5%;
    }
    body.gallery-page > header .brand-logo {
        width: 160px;
        max-height: 54px;
    }
    body.gallery-page > header nav {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        gap: clamp(7px, 2.2vw, 12px);
        white-space: nowrap;
    }
    body.gallery-page > header nav a {
        padding: 6px 0;
        font-size: 10px;
        letter-spacing: 0;
    }
}
@media (max-width: 540px) {
    .gallery-intro {
        margin: 0 0 10px;
    }
    .gallery-intro h1 {
        font-size: 27px;
    }
    .gallery-intro > p:last-child {
        font-size: 12px;
    }
    .gallery-filters {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 100px 44px;
        gap: 6px;
        padding: 8px 0;
    }
    .gallery-filters label {
        min-width: 0;
        font-size: 10px;
        letter-spacing: 0;
    }
    .gallery-filters input,
    .gallery-filters select {
        font-size: 12px;
        padding: 8px 6px;
    }
    .gallery-filters button {
        padding: 8px 3px;
        font-size: 11px;
    }
    #image-viewport {
        inset: 0 8px;
    }
    .image-controls {
        padding: 5px;
        gap: 4px;
    }
    .image-controls button {
        min-height: 38px;
        padding: 5px 7px;
    }
    #photo-details {
        padding: 7px 12px;
        gap: 3px 10px;
        max-height: 84px;
    }
    #photo-title {
        font-size: 16px;
    }
    #photo-details p {
        font-size: 11px;
    }
}

/* Caption and optional information panel leave the photograph centre stage. */
#photo-details {
    order: 2;
    justify-content: center;
    align-items: center;
    overflow: visible;
    max-height: none;
    padding: 6px 12px;
}
.image-controls {
    order: 3;
}
#photo-scientific {
    color: #999f9a;
    font-weight: 400;
    font-style: italic;
}
#photo-info-toggle {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #8c978e;
    border-radius: 50%;
    background: #18221b;
    color: #d5ddd6;
    font:
        12px/1 Georgia,
        serif;
    flex: none;
}
#photo-info {
    position: absolute;
    right: 16px;
    bottom: 110px;
    z-index: 4;
    width: min(310px, calc(100% - 32px));
    max-height: 60%;
    overflow: auto;
    padding: 16px;
    background: #111a14f5;
    border: 1px solid #65745a;
    border-radius: 4px;
    box-shadow: 0 8px 24px #0008;
    font-size: 12px;
}
#photo-info h3 {
    font-size: 14px;
    margin: 0 0 14px;
}
#photo-info p {
    color: var(--muted);
    line-height: 1.5;
}
#photo-metadata {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
}
#photo-metadata dt {
    color: var(--muted);
}
#photo-metadata dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.location-unsaved-marker {
    margin-left: 2px;
    color: #e36e67;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
#photo-viewer.image-fullscreen,
#photo-viewer:fullscreen {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    background: #000;
}
.image-fullscreen .viewer-toolbar,
.image-fullscreen #photo-details,
.image-fullscreen #photo-info {
    display: none;
}
.image-fullscreen #image-viewport {
    inset: 0;
}
.image-fullscreen #image-viewport:focus,
#photo-viewer:fullscreen #image-viewport:focus {
    outline: none;
}

#photo-info-toggle {
    position: absolute;
    z-index: 7;
    background: #18221be8;
    box-shadow: 0 1px 5px #0009;
}
#photo-info-actions {
    display: none;
}
.image-fullscreen #photo-info-toggle {
    display: none;
}
.image-fullscreen #photo-info-actions,
#photo-viewer:fullscreen #photo-info-actions {
    display: none;
}
#photo-scientific:empty {
    display: none;
}

#photo-details {
    justify-content: flex-start;
    text-align: left;
}
#photo-info {
    text-align: left;
}
#photo-metadata a {
    color: var(--accent);
    text-decoration: underline;
}
#image-viewport {
    right: 40px;
}
.image-fullscreen #image-viewport {
    right: 0;
}

#photo-info p,
#photo-info h3,
#photo-description,
#photo-taxonomy {
    text-align: left;
}
#photo-title {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    text-align: center;
}
#photo-title-name {
    grid-column: 2;
    min-width: 0;
    overflow-wrap: anywhere;
}
#photo-info section {
    padding: 0;
}
#photo-info hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 16px 0;
}
#species-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
#species-links a {
    color: var(--accent);
    text-decoration: underline;
}
#species-links small {
    flex-basis: 100%;
    font-size: 10px;
}
#species-summary {
    max-height: 180px;
    overflow: auto;
}

/* One shared toolbar: hover near the image bottom, focus by keyboard, or tap to reveal. */
#photo-viewer .image-controls {
    display: flex;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 8px;
    width: max-content;
    max-width: calc(100% - 16px);
    z-index: 5;
    background: #142018b8;
    backdrop-filter: blur(6px);
    border: 1px solid #ffffff38;
    border-radius: 7px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
    gap: 5px;
    padding: 6px;
}
#photo-viewer.controls-visible .image-controls,
#photo-viewer .image-controls:hover,
#photo-viewer .image-controls:focus-within {
    opacity: 1;
    pointer-events: auto;
}
.image-controls .image-hint {
    display: none;
}
/* Touch browsers can retain hover/focus after a tap; the timer still controls visibility. */
#photo-viewer.touch-controls:not(.controls-visible) .image-controls {
    opacity: 0;
    pointer-events: none;
}
@media (max-width: 540px) {
    #photo-viewer .image-controls {
        gap: 4px;
        padding: 5px;
    }
    .image-controls button {
        min-height: 38px;
    }
    .image-controls #image-fullscreen {
        font-size: 11px;
    }
}
@media (prefers-reduced-motion: reduce) {
    #photo-viewer .image-controls {
        transition: none;
    }
}

#info-scientific-name {
    font-style: italic;
    color: var(--muted);
}
#info-species-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 5px;
    margin: 0 0 7px;
}
#photo-taxonomy {
    margin: 0 0 12px;
}
#info-scientific-name:empty {
    display: none;
}
/* Details use empty space beside the photo, or scroll below it without resizing it. */
#photo-info {
    max-height: none;
    min-height: 0;
    overflow: auto;
}
#photo-viewer.info-open > .viewer-toolbar,
#photo-viewer.info-open > .viewer-stage,
#photo-viewer.info-open > #photo-details {
    width: var(--viewer-content-width);
    max-width: none;
}
#photo-viewer.info-below {
    overflow-y: auto;
    overflow-x: hidden;
}
#photo-viewer.info-overlay #photo-info {
    margin-block: auto;
    background: rgba(17, 26, 20, 0.78);
    z-index: 8;
    overscroll-behavior: contain;
}
#photo-info-close {
    display: none;
}
#photo-viewer.info-overlay #photo-info-close {
    display: block;
    position: sticky;
    top: 0;
    margin-left: auto;
    min-height: 44px;
    padding: 6px 12px;
    background: #18221b;
    color: var(--accent);
    border: 1px solid #65745a;
    border-radius: 4px;
}
#photo-viewer.info-below > .viewer-toolbar {
    position: sticky;
    top: 0;
    z-index: 6;
}
#photo-title {
    font-size: 18.3333px;
    text-align: center;
}
@media (max-width: 1000px) {
    #photo-viewer[open] {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    #image-viewport {
        left: 48px;
        right: 48px;
    }
    #photo-info-actions {
        display: block;
        position: absolute;
        width: 30px;
        height: 30px;
        z-index: 7;
        pointer-events: none;
    }
    #photo-info-toggle {
        width: 30px;
        height: 30px;
        position: static;
        flex: none;
        margin: 0;
        pointer-events: auto;
        border: 0;
        border-radius: 50%;
        background: radial-gradient(circle, #43513dcf 8px, #26352788 8.5px, transparent 10px);
        box-shadow: none;
        outline: none;
        color: #e8eadf;
        font-size: 13px;
        opacity: 0.8;
        touch-action: manipulation;
    }
    #photo-info-toggle:focus-visible {
        outline: 1px solid #a6ad96;
        outline-offset: 1px;
    }
    #photo-info-toggle:hover,
    #photo-info-toggle:focus-visible {
        opacity: 1;
    }
    #previous,
    #next {
        width: 38px;
        height: 44px;
        border: 1px solid #ffffff18;
        border-radius: 3px;
        background: #080d0b48;
        color: #f0f1e9b8;
        font-size: 25px;
        opacity: 0.38;
    }
}

@media (hover: hover) and (max-width: 900px) {
    #previous:hover,
    #next:hover {
        opacity: 0.86;
    }
}
@media (hover: none) and (max-width: 1000px) {
    #previous:hover,
    #next:hover,
    #previous:active,
    #next:active,
    #previous:focus-visible,
    #next:focus-visible {
        opacity: 0.38;
        background: #080d0b48;
        border-color: #ffffff18;
    }
}

/* Directional transitions only run after the newly selected image is ready. */
@keyframes gallery-slide-in-next {
    from {
        opacity: 0.45;
        transform: translateX(5vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes gallery-slide-in-previous {
    from {
        opacity: 0.45;
        transform: translateX(-5vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.viewer-stage.slide-next #image-viewport {
    animation: gallery-slide-in-next 380ms ease-out both;
}

.viewer-stage.slide-previous #image-viewport {
    animation: gallery-slide-in-previous 380ms ease-out both;
}

@keyframes gallery-slideshow-fade {
    from { opacity: 0.12; }
    to { opacity: 1; }
}

@keyframes gallery-slideshow-zoom {
    from { opacity: 0.35; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes gallery-slideshow-rise {
    from { opacity: 0.35; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gallery-slideshow-blur {
    from { opacity: 0.45; filter: blur(7px); }
    to { opacity: 1; filter: blur(0); }
}

.viewer-stage.effect-fade #image-viewport {
    animation: gallery-slideshow-fade 560ms ease-out both;
}

.viewer-stage.effect-zoom #image-viewport {
    animation: gallery-slideshow-zoom 560ms ease-out both;
}

.viewer-stage.effect-rise #image-viewport {
    animation: gallery-slideshow-rise 560ms ease-out both;
}

.viewer-stage.effect-blur #image-viewport {
    animation: gallery-slideshow-blur 560ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    .viewer-stage.slide-next #image-viewport,
    .viewer-stage.slide-previous #image-viewport,
    .viewer-stage.effect-fade #image-viewport,
    .viewer-stage.effect-zoom #image-viewport,
    .viewer-stage.effect-rise #image-viewport,
    .viewer-stage.effect-blur #image-viewport {
        animation: none;
    }
}

/* In full screen, keep a compact centered species caption under the image. */
.image-fullscreen #image-viewport {
    inset: 0 0 62px;
}

.image-fullscreen #photo-details {
    display: flex;
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: 0;
    left: 0;
    height: 62px;
    justify-content: center;
    align-items: center;
    padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, #000b 36%, #000e);
    pointer-events: none;
}

.image-fullscreen #photo-title {
    margin: 0;
    color: #f1f0e8;
    text-align: center;
}

.image-fullscreen #photo-status,
.image-fullscreen #photo-edit-link {
    display: none !important;
}

@media (max-width: 540px) {
    #photo-title {
        font-size: 17.3333px;
        display: flex;
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    #photo-title-name {
        grid-column: auto;
        width: 100%;
    }
    #photo-edit-link {
        grid-column: auto;
        align-self: center;
        max-width: 100%;
        font-size: 12px;
        line-height: 1.3;
        text-align: center;
        white-space: nowrap;
    }
    #image-viewport {
        left: 8px;
        right: 8px;
    }
}

.fullscreen-status {
    position: absolute;
    top: 8px;
    left: 10%;
    width: 80%;
    z-index: 6;
    background: #172119dd;
    padding: 8px;
    font-size: 12px;
}

/* Preview five photographs per wide desktop row; keep tablet and mobile layouts unchanged. */
@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 44px 16px;
    }
}

.gallery-item {
    min-width: 0;
}
.gallery-card .frame {
    position: relative;
}
.draft-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    padding: 5px 8px;
    border-radius: 3px;
    background: #e4c46b;
    color: #211c0e;
    font:
        700 10px/1.2 system-ui,
        sans-serif;
    letter-spacing: 0.5px;
}
.gallery-edit-link {
    display: block;
    margin-top: 0;
    color: var(--muted);
    font-size: 11px;
    opacity: 0.8;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-align: right;
}
#photo-status {
    margin: 9px 0 0;
    color: #e4c46b;
    font-size: 13px;
}
#photo-edit-link {
    grid-column: 3;
    justify-self: end;
    max-width: 100%;
    margin: 0;
    color: var(--accent);
    font-size: calc(50% + 1pt);
    line-height: 1.2;
    text-align: right;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

#photo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#photo-tags a {
    color: var(--accent);
    text-decoration: underline;
    padding: 5px 2px;
}
#high-resolution-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 5px;
}
@media (max-width: 1000px) {
    #photo-details,
    #photo-title,
    #photo-status {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }
    #photo-status {
        white-space: normal;
    }
    #photo-details {
        max-height: none;
        padding-top: 2px;
    }
}

@media (max-width: 540px) {
    .gallery-edit-link {
        font-size: 10px;
    }
}

/* Keep boundary arrows visibly inactive even when hover/focus styles apply. */
#previous:disabled,
#next:disabled {
    opacity: 0.16;
    background-color: #080d0b30;
    border-color: transparent;
    color: #ffffff70;
    cursor: default;
    pointer-events: none;
}
