/* Photo albums: the list of a user's albums and one album (all_albums.html, album_detail.html). */

.albums-page {
    width: min(100% - 32px, 1240px);
    margin: 28px auto 0;
    padding-bottom: 80px;
    color: #0f172a;
}

.albums-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin-bottom: 14px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.albums-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.albums-back svg { width: 16px; height: 16px; flex: none; }
.albums-back:hover { color: #c2410c; }

.albums-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 24px;
    margin-bottom: 22px;
}

.albums-head__titles { min-width: 0; }

.albums-head__titles h1 {
    margin: 0;
    font-size: clamp(26px, 3.4vw, 38px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.albums-head__titles p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.albums-map-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #c2410c;
    font-weight: 650;
    text-decoration: none;
}

.albums-map-link svg { width: 15px; height: 15px; }
.albums-map-link:hover { text-decoration: underline; }

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

.albums-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #ffffff;
    color: #334155;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 140ms, color 140ms, background 140ms;
}

.albums-button svg { width: 17px; height: 17px; flex: none; }
.albums-button:hover { border-color: #fdba74; color: #c2410c; }
.albums-button:disabled { opacity: 0.6; cursor: progress; }

.albums-button.is-primary { border-color: #f97316; background: #f97316; color: #ffffff; }
.albums-button.is-primary:hover { border-color: #ea580c; background: #ea580c; color: #ffffff; }

/* ------------------------------------------------------------------ */
/* Albums list.                                                        */
/* ------------------------------------------------------------------ */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 22px 18px;
}

.album-card {
    display: grid;
    gap: 9px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.album-card__cover {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 20px;
    background: #f1f5f9;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.album-card__cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.album-card:hover .album-card__cover img { transform: scale(1.05); }

.album-card__empty { display: grid; width: 100%; height: 100%; place-items: center; color: #cbd5e1; }
.album-card__empty svg { width: 40px; height: 40px; }

.album-card__count {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 12px;
    font-weight: 650;
}

.album-card__title {
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-card:hover .album-card__title { color: #c2410c; }

.album-card .drag-handle,
.photo-grid-item .drag-handle {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.38);
    color: #ffffff;
    cursor: grab;
}

.album-card .drag-handle.hidden,
.photo-grid-item .drag-handle.hidden { display: none; }
.album-card .drag-handle svg,
.photo-grid-item .drag-handle svg { width: 30px; height: 30px; }
.albums-grid.is-reordering .album-card { cursor: grab; }
.is-ghost { opacity: 0.4; }

.albums-empty {
    grid-column: 1 / -1;
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 56px 20px;
    border: 1px dashed #e2e8f0;
    border-radius: 24px;
    background: #f8fafc;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.albums-empty p { margin: 0; }

.albums-empty__icon {
    display: grid;
    width: 60px;
    height: 60px;
    place-items: center;
    border-radius: 18px;
    background: #ffffff;
    color: #94a3b8;
}

.albums-empty__icon svg { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ */
/* One album: a dense grid of square photos.                           */
/* ------------------------------------------------------------------ */
.album-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}

.photo-grid-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 14px;
    background: #f1f5f9;
}

.photo-grid-item .photo-link { display: block; width: 100%; height: 100%; }

.photo-grid-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 350ms ease, filter 200ms;
}

.photo-grid-item:hover img { transform: scale(1.04); }

/* The owner deletes the open photo from the viewer's toolbar. */
.fancybox__toolbar .album-viewer-delete:hover { color: #f87171; }

/* Upload window. */
.albums-upload-note {
    margin: 0 0 14px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

#dropzone.is-dragging { border-color: #f97316; background: #fff7ed; }

.albums-upload-preview {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 10px;
    background: #f1f5f9;
}

.albums-upload-preview img { width: 100%; height: 100%; object-fit: cover; }

/* The album windows read like the rest of the site: words, not tracked capitals. */
#edit-album-modal h3,
#delete-album-modal h3,
#upload-manager-modal h3,
#delete-photo-modal h3,
#create-album-modal h3 {
    font-size: 20px !important;
    letter-spacing: -0.01em !important;
    text-transform: none !important;
}

#edit-album-modal label,
#edit-album-modal button,
#delete-album-modal p,
#delete-album-modal button,
#upload-manager-modal p,
#upload-manager-modal span,
#upload-manager-modal button,
#delete-photo-modal p,
#delete-photo-modal button {
    letter-spacing: 0 !important;
    text-transform: none !important;
}

#edit-album-modal button,
#delete-album-modal button,
#upload-manager-modal button,
#delete-photo-modal button { font-size: 14px !important; font-weight: 650 !important; }

#edit-album-modal label,
#delete-album-modal p,
#delete-photo-modal p { font-size: 13px !important; font-weight: 500 !important; }

html[data-theme="dark"] .albums-page { color: #f2f2ef; }
html[data-theme="dark"] .albums-button { border-color: #454545; background: #292929; color: #e4e4e0; }
html[data-theme="dark"] .albums-button.is-primary { border-color: #f97316; background: #f97316; color: #ffffff; }
html[data-theme="dark"] .albums-empty { border-color: #454545; background: #1b1b1b; }

@media (max-width: 767px) {
    /* The site shell leaves 6px at each side on phones; the page adds 10px so text sits 16px in. */
    .albums-page,
    body.page-site-redesign:not(.page-home-redesign) .albums-page.albums-page {
        margin-top: 8px !important;
        padding-right: 10px !important;
        padding-left: 10px !important;
        overflow-x: visible !important;
    }
    .albums-head { margin-bottom: 16px; }
    .albums-head__titles h1 { font-size: 26px; }
    .albums-head__titles p { font-size: 13px; }
    /* One row: settings and edit as icons, upload with its word. */
    .albums-head__actions { width: 100%; flex-wrap: nowrap; }
    .albums-head__actions .albums-button { min-height: 44px; }
    .albums-head__actions .albums-button.is-primary { flex: 1 1 auto; }
    .albums-head__actions .albums-button.is-compact { width: 44px; padding: 0; flex: none; }
    .albums-head__actions .albums-button.is-compact.is-primary { width: auto; padding: 0 14px; }
    .albums-button.is-compact .albums-button__label { display: none; }
    .albums-head__actions:not(.album-detail-actions) .albums-button { flex: 1 1 0; }
    .albums-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
    .album-card__cover { border-radius: 16px; }
    .album-card__title { font-size: 14px; }
    /* Three photos across, close together. */
    .album-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; max-width: none; margin: 0 -16px; }
    .photo-grid-item { border-radius: 0; }
    .photo-grid-item:hover img { transform: none; }
}
