/*
 * The look of every page (PageController and the photo page, PhotoDetailController), mobile first:
 * one column on phones, the photo grid fills the width, larger screens get more columns, never a fixed width.
 * Dark, so the photos stand out. Administration adds gallery-admin.css.
 */

:root {
    color-scheme: dark;
    --bg: #0b141d;
    --bg-2: #111f2b;
    --bg-3: #192c3c;
    --line: #233a4d;
    --text: #c5d5e2;
    --muted: #7c95a9;
    --strong: #fff;
    --link: #a7d2f1;
    --accent: #ff9a3c;
    --warn: #ffb59c;
    --radius: 10px;
    --gap: 12px;
    --max: 1240px;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --serif: Georgia, Cambria, "Times New Roman", serif;
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--sans);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--strong);
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4 {
    color: var(--strong);
    font-family: var(--serif);
    font-weight: normal;
    line-height: 1.2;
}

h3 {
    font-size: 1.5rem;
    margin: 0.5em 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 0;
}

.hr {
    margin: 16px 0;
}

.cl {
    clear: both;
    height: 0;
    font-size: 0;
}

.alternate, .alternative, .grayed, .little {
    color: var(--muted);
}

.little {
    font-size: 0.85em;
}

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

p.warn {
    padding: 10px 14px;
    border-radius: var(--radius);
    background: rgba(255, 120, 80, 0.1);
}

p.notice {
    padding: 10px 14px;
    border-radius: var(--radius);
    background: rgba(167, 210, 241, 0.1);
}

.skip {
    position: absolute;
    left: -9999px;
}

.skip:focus {
    left: 8px;
    top: 8px;
    z-index: 100;
    padding: 6px 12px;
    background: var(--strong);
    color: var(--bg);
}

/* form controls (templates/forms.html.twig) */
input.txt, textarea.txt, select.txt, input[type="search"] {
    max-width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg-2);
    color: var(--strong);
    font: inherit;
}

/* iOS zooms into smaller text fields */
@media (max-width: 759px) {
    input.txt, textarea.txt, select.txt, input[type="search"] {
        font-size: 16px;
    }
}

input.txt:focus, textarea.txt:focus, select.txt:focus, input[type="search"]:focus {
    outline: 2px solid var(--link);
    outline-offset: -1px;
}

input.btn, button {
    padding: 6px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--link);
    color: var(--bg);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

input.btn:hover, button:hover {
    background: var(--strong);
}

/* page frame (templates/page.html.twig) */
.site-header {
    background: linear-gradient(180deg, #15293b 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--line);
}

.site-header-in, .albums, .site-main, .site-footer-in {
    max-width: var(--max);
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}

.site-header-in {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    padding-top: 16px;
    padding-bottom: 12px;
}

.site-brand {
    flex: 1 1 auto;
    min-width: 0;
}

.site-title {
    margin: 0;
    font-size: 1.9rem;
}

.site-title a {
    color: var(--strong);
}

.site-description {
    margin: 2px 0 0;
    color: var(--muted);
}

.site-admin {
    margin: 4px 0 0;
    font-size: 0.9em;
}

.site-search {
    display: flex;
    flex: 1 1 260px;
    gap: 6px;
    max-width: 420px;
}

.site-search input[type="search"] {
    flex: 1;
    min-width: 0;
}

/* album menu: one row of chips per level, scrolled sideways on phones */
.albums {
    padding-bottom: 12px;
}

.albums-row {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 3px 0;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
}

.albums-row::-webkit-scrollbar {
    display: none;
}

.albums-row a, .albums-row span.albums-label {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--bg-3);
    color: var(--text);
    white-space: nowrap;
}

.albums-row a:hover {
    background: var(--line);
    color: var(--strong);
}

.albums-row a.sel {
    background: var(--link);
    color: var(--bg);
}

.albums-row a.sel .alternate {
    color: inherit;
    opacity: 0.7;
}

.albums-row a.grayed {
    background: transparent;
    color: var(--muted);
}

.albums-sub a {
    padding: 3px 10px;
    font-size: 0.9em;
}

@media (min-width: 760px) {
    .albums-row {
        flex-wrap: wrap;
        overflow: visible;
    }
}

.site-main {
    padding-top: 16px;
    padding-bottom: 24px;
}

.site-footer {
    margin-top: 24px;
    border-top: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--muted);
    font-size: 0.85em;
}

.site-footer-in {
    padding-top: 16px;
    padding-bottom: 24px;
}

.site-footer p {
    margin: 4px 0;
}

.site-footer strong {
    color: var(--text);
    font-weight: normal;
}

/* gallery grid (templates/gallery/photo-block.html.twig), the next pages are appended by photobit.js */
#photos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--gap);
}

#photos-list > p {
    grid-column: 1 / -1;
}

@media (min-width: 760px) {
    #photos-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
}

.pb {
    position: relative;
    border-radius: var(--radius);
    background: var(--bg-2);
    overflow: hidden;
}

.pb .photo {
    display: block;
    color: var(--text);
}

.pb .photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--bg-3);
    transition: transform 0.3s, opacity 0.3s;
}

.pb .photo:hover img {
    opacity: 0.9;
}

.pb-name {
    display: block;
    padding: 8px 10px 0;
    overflow: hidden;
    color: var(--strong);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pb-in > div {
    padding: 0 10px;
    font-size: 0.85em;
}

.pb-in > div:last-child {
    padding-bottom: 8px;
}

.pb .rp {
    padding: 4px 10px 0;
}

/* admin options over the photo, toggled by "Zobrazit možnosti" */
.pb .photoOptions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0;
    font-size: 0.85em;
}

.pb .photoOptions a.editPhoto {
    display: block;
    padding: 4px 8px 4px 30px;
    background: rgba(0, 0, 0, 0.6) url("../images/PhotoBlock-editPhoto.png") no-repeat 8px 50%;
    color: var(--strong);
}

/* paging and ordering (templates/gallery/navigation.html.twig) */
.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.mb-def, .mb-dis {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

a.mb-def:hover {
    background: var(--bg-3);
}

.mb-dis {
    color: var(--muted);
    opacity: 0.6;
}

/* infinite scroll (photobit.js): the paging below the photos is not needed */
.photos-infinite .photos-nav-bottom {
    display: none;
}

.photos-more {
    margin: 24px 0;
    text-align: center;
}

.photos-more-loading a {
    display: none;
}

.photos-more-loading::after {
    content: "Načítám…";
    color: var(--muted);
}

/* chosen photos on the main page (templates/gallery/list.html.twig), cross-faded by photobit.js */
#slideshow {
    display: none;
    margin-bottom: 8px;
}

#slideshow.slideshow-ready {
    display: grid;
}

#slideshow > div {
    display: flex;
    grid-area: 1 / 1;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg-2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s, visibility 0.6s;
}

#slideshow > div.active {
    opacity: 1;
    visibility: visible;
}

.slideshow-l {
    flex: 0 0 auto;
    width: 40%;
    max-width: 200px;
}

.slideshow-l img {
    display: block;
    border-radius: 6px;
}

.slideshow-r {
    flex: 1;
    min-width: 0;
}

.slideshow-r h3 {
    margin: 0 0 0.3em;
    font-size: 1.3rem;
}

.slideshow-r p {
    margin: 0 0 0.3em;
}

@media (min-width: 760px) {
    .slideshow-r h3 {
        font-size: 1.8rem;
    }
}

/* rating stars (templates/photo/rating.html.twig), li.cr is the bar of the current rating */
.rs, .rs-v, .rs li, .rs-v li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rs, .rs-v {
    position: relative;
    width: 112px;
    height: 16px;
    overflow: hidden;
    background: url("../images/stars.gif") 0 0 repeat-x;
}

.rs li, .rs-v li {
    float: left;
    text-indent: -9000px;
}

.rs li a, .rs-v li div {
    position: absolute;
    display: block;
    width: 16px;
    height: 16px;
    overflow: hidden;
    z-index: 20;
    text-indent: -900px;
    cursor: pointer;
}

.rs li a:hover {
    left: 0;
    z-index: 2;
    background: url("../images/stars.gif") 0 32px;
}

.rs li.cr, .rs-v li.cr {
    position: absolute;
    display: block;
    height: 16px;
    overflow: hidden;
    z-index: 1;
    background: url("../images/stars.gif") 0 16px;
}

.rs-v li.cr {
    background-position: 0 32px;
}

.r1 { left: 0; }
.r2 { left: 16px; }
.r3 { left: 32px; }
.r4 { left: 48px; }
.r5 { left: 64px; }
.r6 { left: 80px; }
.r7 { left: 96px; }
.rs .r1:hover { width: 16px; }
.rs .r2:hover { width: 32px; }
.rs .r3:hover { width: 48px; }
.rs .r4:hover { width: 64px; }
.rs .r5:hover { width: 80px; }
.rs .r6:hover { width: 96px; }
.rs .r7:hover { width: 112px; }

/* labels (templates/photo/label.html.twig) */
.PhotoBitPhotoLabel {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-3);
    color: var(--strong);
    font-size: 0.9em;
}

.PhotoBitPhotoLabel a.delete {
    margin-left: 4px;
    color: var(--warn);
}

#labelAdd {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.editForm #labelList {
    height: 200px;
    overflow: auto;
}

.editForm #labelList .PhotoBitPhotoLabel {
    display: block;
}

/* photo page (templates/photo.html.twig, photo/detail.html.twig): the photo fills the window */
.photo-page .panel {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 20, 29, 0.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.panel-info {
    padding: 8px 16px;
    font-size: 0.9em;
}

.panel-info strong {
    color: var(--strong);
    font-weight: 600;
}

.panel-in > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px 8px;
    font-size: 0.9em;
}

.panel-l, .panel-r {
    flex: 1;
    min-width: 0;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-r {
    text-align: right;
}

.panel-l .navigationLink::before {
    content: "‹ ";
}

.panel-r .navigationLink::after {
    content: " ›";
}

.panel .cl {
    display: none;
}

.photo-page #main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 12px 16px 24px;
}

#pic-a {
    display: block;
    text-align: center;
}

#pic {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 110px);
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 4px;
    background: var(--bg-2);
}

.photo-page h1 {
    margin: 16px 0 8px;
    font-size: 1.8rem;
}

.photo-page p {
    margin: 8px 0;
}

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

.info strong {
    color: var(--text);
    font-weight: normal;
}

#rating {
    margin-bottom: 4px;
}

/* author and help pages */
.authors {
    columns: 14em;
    padding-left: 1.2em;
}

#keys {
    display: grid;
    grid-template-columns: 3em 1fr;
    gap: 8px 12px;
}

#keys dt {
    font-size: 1.6rem;
    text-align: center;
}

#keys dd {
    margin: 0;
    align-self: center;
}

/* forms of the administration */
fieldset {
    margin: 12px 0;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

fieldset legend {
    padding: 0 8px;
    color: var(--strong);
    font-weight: 600;
}

form dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px 12px;
    max-width: 640px;
}

form dl dt {
    padding-top: 6px;
}

form dl dd {
    position: relative;
    margin: 0 0 6px;
}

@media (min-width: 760px) {
    form dl {
        grid-template-columns: 130px 1fr;
    }

    form dl dt {
        text-align: right;
    }

    form dl dd {
        margin: 0;
    }
}

form .cleaner {
    clear: both;
}

.checkbox .chck {
    display: inline-block;
    width: 11px;
    height: 13px;
    margin-right: 4px;
    vertical-align: middle;
    background: none no-repeat 0 1px;
    cursor: pointer;
}

.checkbox .chck-0 {
    background-image: url("../images/forms.checkbox-0.png");
}

.checkbox .chck-1 {
    background-image: url("../images/forms.checkbox-1.png");
}

.checkbox span.label {
    cursor: pointer;
}

.hint {
    display: none;
    position: absolute;
    left: 0;
    z-index: 10;
    width: 260px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fff8d6;
    color: #222;
}

.hint a {
    color: #a00;
}

/* fullscreen photo viewer (assets/js/viewer.js) */
.viewer-open {
    overflow: hidden;
}

.viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    color: var(--strong);
}

/* the backdrop, fading while the photo is pulled down to close */
.viewer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #04080c;
    opacity: var(--viewer-fade, 1);
}

.viewer[hidden] {
    display: none;
}

.viewer-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

.viewer-zoomed .viewer-stage {
    touch-action: auto;
}

.viewer-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease-out, filter 0.25s;
}

.viewer-img.viewer-loading {
    filter: blur(6px);
}

.viewer-dragging .viewer-img {
    transition: none;
}

.viewer-top, .viewer-caption, .viewer-prev, .viewer-next {
    transition: opacity 0.2s;
}

.viewer-ui-hidden .viewer-top, .viewer-ui-hidden .viewer-caption,
.viewer-ui-hidden .viewer-prev, .viewer-ui-hidden .viewer-next {
    opacity: 0;
    pointer-events: none;
}

.viewer-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
    background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
    font-size: 0.9em;
}

.viewer button {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: var(--strong);
    font-size: 28px;
    font-weight: normal;
    line-height: 1;
}

.viewer button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.viewer button:disabled {
    visibility: hidden;
}

.viewer-prev, .viewer-next {
    position: absolute;
    top: 50%;
    margin-top: -22px;
}

.viewer-prev {
    left: 8px;
}

.viewer-next {
    right: 8px;
}

/* touch screens swipe */
@media (hover: none) {
    .viewer-prev, .viewer-next {
        display: none;
    }
}

.viewer-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 32px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

.viewer-title {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: normal;
}

.viewer-date {
    color: var(--muted);
    margin-right: 8px;
}

.viewer-detail {
    white-space: nowrap;
}
