/* --- BILDER PAGE --- */
.bilder-main {
    padding-bottom: 30px;
}

.bilder-intro {
    text-align: center;
    margin-bottom: 40px;
}

.bilder-intro h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 36px;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin: 0 0 8px 0;
}

.bilder-intro p {
    font-size: 16px;
    color: var(--ink-soft);
    margin: 0;
}

/* --- UPLOAD CARD --- */
.upload-card {
    text-align: center;
    background: #FFFDF9;
    border: 1px dashed var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 36px 24px;
    max-width: 480px;
    margin: 0 auto;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-card.dragover {
    border-color: var(--blue);
    background: var(--wash);
}

.upload-flower {
    width: 40px;
    height: auto;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 15px;
    color: var(--ink-soft);
    margin: 0 0 20px 0;
}

.upload-name-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--blue-deep);
    margin-bottom: 20px;
}

.upload-name-label span {
    text-transform: none;
    letter-spacing: 0.04em;
    font-weight: 400;
    color: var(--ink-soft);
}

.upload-name-label input {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 8px auto 0 auto;
    padding: 10px 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-sizing: border-box;
    text-align: center;
}

.upload-name-label input:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.upload-button {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #FFFDF9;
    background: var(--blue-deep);
    border: none;
    border-radius: 999px;
    padding: 14px 34px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.upload-button.secondary {
    color: var(--blue-deep);
    background: transparent;
    border: 1px solid var(--blue-deep);
}

.upload-button.secondary:hover:not(:disabled) {
    background: var(--wash);
}

.upload-button:hover:not(:disabled) {
    background: var(--blue);
}

.upload-button:active:not(:disabled) {
    transform: scale(0.98);
}

.upload-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.upload-button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

.upload-status {
    font-size: 14px;
    color: var(--blue-deep);
    min-height: 1.5em;
    margin: 16px 0 0 0;
}

.upload-status.error {
    color: #A05252;
}

/* --- PER-FILE UPLOAD PROGRESS --- */
.upload-list {
    list-style: none;
    margin: 18px 0 0 0;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* An author `display` beats the UA [hidden] rule, so restore it explicitly —
   otherwise the hidden attribute in the markup does nothing. */
.upload-list[hidden] {
    display: none;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-thumb {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--wash);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.upload-thumb::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--line);
}

.upload-item.is-done .upload-thumb::after,
.upload-item.is-error .upload-thumb::after {
    display: none;
}

.upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.upload-item-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.upload-item-name {
    font-size: 13px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-status {
    font-size: 12px;
    color: var(--ink-soft);
    overflow-wrap: anywhere;
}

.upload-item.is-uploading .upload-item-status,
.upload-item.is-done .upload-item-status {
    color: var(--blue-deep);
}

.upload-item.is-error .upload-item-status {
    color: #A05252;
}

/* --- GALLERY --- */
.gallery-heading {
    font-family: 'Cormorant Garamond', serif;
    font-size: 30px;
    font-weight: 500;
    text-align: center;
    margin: 0 0 24px 0;
}

.gallery-empty {
    text-align: center;
    font-size: 15px;
    color: var(--ink-soft);
}

.gallery-hint {
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
    margin: -12px 0 20px 0;
}

.gallery-hint[hidden] {
    display: none;
}

.gallery-grid {
    columns: 2;
    column-gap: 12px;
}

.gallery-item {
    position: relative;
    margin-bottom: 12px;
    break-inside: avoid;
}

.gallery-link {
    display: block;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.gallery-link:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.gallery-grid img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.25s ease;
}

.gallery-link:hover img {
    transform: scale(1.03);
}

/* --- SELECTING PHOTOS TO SAVE --- */
.gallery-select {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1.5px solid rgba(255, 253, 249, 0.9);
    border-radius: 50%;
    background: rgba(55, 50, 46, 0.35);
    cursor: pointer;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* The checkmark, hidden until selected. */
.gallery-select::after {
    content: "";
    position: absolute;
    top: 8px;
    left: 9px;
    width: 10px;
    height: 5px;
    border-left: 2px solid #FFFDF9;
    border-bottom: 2px solid #FFFDF9;
    transform: rotate(-45deg);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gallery-select[aria-pressed="true"] {
    background: var(--blue-deep);
    border-color: var(--blue-deep);
}

.gallery-select[aria-pressed="true"]::after {
    opacity: 1;
}

.gallery-select:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.gallery-item.is-selected .gallery-link {
    outline: 3px solid var(--blue-deep);
    outline-offset: -3px;
    border-radius: 10px;
}

/* Sticky action bar, only present while something is selected. */
.select-bar {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 20;
    width: calc(100% - 32px);
    max-width: 420px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    background: #FFFDF9;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(55, 50, 46, 0.18);
}

.select-bar[hidden] {
    display: none;
}

.select-count {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.select-bar-actions {
    display: flex;
    gap: 8px;
}

.select-bar .upload-button {
    padding: 10px 18px;
    font-size: 11px;
    letter-spacing: 0.12em;
}

.select-status {
    flex-basis: 100%;
    margin: 0;
    font-size: 12px;
    color: var(--ink-soft);
    text-align: center;
}

.select-status:empty {
    display: none;
}

/* Keep the last row of photos clear of the floating bar. */
body.has-selection .bilder-main {
    padding-bottom: 130px;
}

.gallery-byline {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    background: #FFFDF9;
    padding: 6px 10px;
}

@media (min-width: 600px) {
    .gallery-grid {
        columns: 3;
    }
}

/* --- LIGHTBOX --- */
.lightbox {
    border: none;
    border-radius: 12px;
    padding: 0;
    background: transparent;
    max-width: min(92vw, 1000px);
    max-height: 90vh;
}

.lightbox::backdrop {
    background: rgba(55, 50, 46, 0.85);
}

.lightbox img {
    display: block;
    max-width: min(92vw, 1000px);
    max-height: 85vh;
    width: auto;
    height: auto;
    border-radius: 12px;
}

.lightbox-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    font-size: 22px;
    line-height: 1;
    color: var(--ink);
    background: rgba(250, 247, 242, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.lightbox-close:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.lightbox-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}

.lightbox-status {
    font-size: 12px;
    color: #FFFDF9;
    text-shadow: 0 1px 2px rgba(55, 50, 46, 0.6);
    min-height: 1em;
}
