/* web_style.css - one stylesheet for the gallery and the login/account pages. */

:root {
  --bg: #14171c;
  --panel: #1b1f27;
  --tile: #262b35;
  --text: #e6e9ef;
  --muted: #8a93a3;
  --accent: #6aa9ff;
  --danger: #ff6b6b;
  --ok: #5fd08a;
  --gap: 4px;
  --tile-size: 150px; /* thumbnail size in the grid; changed by the Size slider in web_app.js */
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.noscroll { overflow: hidden; }
.spacer { flex: 1; }
.muted { color: var(--muted); }

/* ---------------------------------- Top bar ---------------------------------- */

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding: 10px 14px; background: var(--panel); border-bottom: 1px solid #000;
}
.bar form { margin: 0; }
.size { display: flex; align-items: center; gap: 8px; color: var(--muted); }
/* List view: the slider stays in place but cannot be used (rows have a fixed picture size). */
.size.disabled { opacity: .45; }
.size input[type=range] { width: 110px; padding: 0; border: 0; outline: none; background: none; accent-color: var(--accent); }
.size input[type=range]:disabled { cursor: default; }
.brand { font-weight: 700; color: var(--text); }
/* A little more air around the navigation: Gallery | Timeline Folders | Tiles List */
.bar nav { display: flex; gap: 12px; margin-left: 10px; }
.bar nav a.active { color: var(--text); border-bottom: 2px solid var(--accent); }
/* Tiles / List switch, shown in both views. Its height is one line of text, so the top bar is exactly
   as tall with the switch as without it (no jump when changing view). */
.viewmode {
  display: inline-flex; align-items: stretch; height: 21px;
  border: 1px solid #2b3342; border-radius: 6px; overflow: hidden;
}
.viewmode[hidden] { display: none; }
.viewmode button {
  display: flex; align-items: center; padding: 0 7px;
  background: none; border: 0; color: var(--muted); font: inherit; line-height: 1; cursor: pointer;
}
.viewmode svg { display: block; width: 13px; height: 13px; fill: currentColor; }
.viewmode button[aria-pressed="true"] { background: var(--tile); color: var(--text); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

main { padding: var(--gap); }

/* ----------------------------- Breadcrumbs and folders ----------------------------- */

.crumbs { padding: 8px 6px; color: var(--muted); }
.crumbs a { color: var(--accent); }
.crumbs .sep { margin: 0 6px; }

.folders {
  display: grid; gap: 8px; padding: 0 2px 10px;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr));
}
.folders:empty { display: none; }
.fcard { display: block; background: var(--panel); border-radius: 8px; overflow: hidden; color: var(--text); }
.fcard:hover { text-decoration: none; outline: 2px solid var(--accent); }
.fcard img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--tile); }
.fcard .meta { padding: 6px 10px 8px; }
.fcard .name {
  font-weight: 600; line-height: 1.3; min-height: 2.6em;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere;
}
.fcard .count { color: var(--muted); font-size: 13px; }

/* ------------------------------------ Thumbnails ------------------------------------ */

.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, var(--tile-size));
}
.month { grid-column: 1 / -1; margin: 18px 4px 4px; font-size: 18px; font-weight: 600; }
.tile { position: relative; display: block; aspect-ratio: 1; background: var(--tile); overflow: hidden; }
/* The picture and its marks, so the list view can give them a fixed size of their own. */
.tile .thumb { position: relative; display: block; width: 100%; height: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-name { display: none; }
/* The folders in the path look like folder names elsewhere in the gallery: white and bold (.fcard .name).
   The file name after them stays normal weight, as it was. */
.tile-dir { font-weight: 600; color: var(--text); }
.tile:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.badge {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 7px; border-radius: 10px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px;
}
/* "Slow to open" mark, on the other side so it never hides the video triangle. */
.badge-slow { left: 6px; right: auto; }
.status { padding: 24px; text-align: center; color: var(--muted); }
#sentinel { height: 1px; }

/* ------------------------------------ List view ------------------------------------ */

/*
 * The "List" choice, on both pages: one column, a fixed 56 px picture on the left and the full name
 * beside it. Folder cards and photo tiles keep their existing markup; only the arrangement changes,
 * so opening a folder or a picture, lazy loading and the size remembered per view behave as before.
 */
body.view-list .folders { display: block; }
body.view-list .fcard {
  display: flex; align-items: center; gap: 12px;
  padding: 6px; margin-bottom: 6px;
}
body.view-list .fcard img {
  width: 56px; height: 56px; aspect-ratio: auto; flex: 0 0 auto; border-radius: 6px;
}
body.view-list .fcard .meta { padding: 0; min-width: 0; }
body.view-list .fcard .name {
  display: block; min-height: 0; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible;
}
body.view-list .fcard .count { display: block; }

body.view-list .grid { display: block; }
body.view-list .tile {
  display: flex; align-items: center; gap: 12px;
  aspect-ratio: auto; padding: 6px; margin-bottom: 6px;
  background: var(--panel); border-radius: 8px;
}
body.view-list .tile .thumb {
  width: 56px; height: 56px; flex: 0 0 auto; border-radius: 6px; overflow: hidden;
}
body.view-list .tile-name { display: block; min-width: 0; overflow-wrap: anywhere; }
/* The marks stay on the small picture and shrink so both fit. */
body.view-list .badge { font-size: 9px; padding: 0 4px; right: 3px; bottom: 3px; }
body.view-list .badge-slow { left: 3px; right: auto; top: 3px; bottom: auto; }

/* -------------------------------------- Viewer -------------------------------------- */

.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: rgba(0, 0, 0, .94); }
.viewer[hidden] { display: none; }
.v-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 10px 14px; color: #ddd; }
.v-top button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
.v-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 56px 14px; }
.v-stage img, .v-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-stage .msg { color: #ddd; text-align: center; max-width: 480px; }
.v-nav {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 48px; height: 96px; border: 0; background: none; color: #fff; font-size: 44px; cursor: pointer; opacity: .75;
}
.v-nav:hover { opacity: 1; }
.v-prev { left: 0; }
.v-next { right: 0; }
/* Delete is an administrator-only link and only exists when the Account page switch is on. */
.v-delete { color: var(--danger); font-weight: 600; }
.v-delete[hidden] { display: none; }
/* Confirmation panel: deliberately covers the whole viewer, so no other control can be hit. */
.v-confirm {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(0, 0, 0, .8);
}
.v-confirm[hidden] { display: none; }
.v-confirm-box {
  width: min(520px, 100%); max-height: 100%; overflow: auto; padding: 22px;
  background: var(--panel); color: var(--text); border: 2px solid var(--danger); border-radius: 12px;
}
.v-confirm-box h2 { margin: 0 0 12px; color: var(--danger); font-size: 22px; }
.v-confirm-name { margin: 0 0 12px; font-weight: 600; overflow-wrap: anywhere; }
.v-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ------------------------------ Login / account pages ------------------------------ */

body.plain { display: flex; justify-content: center; padding: 40px 16px; }
.card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 12px; padding: 24px; }
.card.wide { max-width: 720px; }
.card h1 { margin: 0 0 16px; font-size: 22px; }
.card h2 { margin: 28px 0 10px; font-size: 17px; }
.card h3 { margin: 22px 0 8px; font-size: 15px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
input:not([type=checkbox]) {
  padding: 9px 10px; border: 1px solid #333a47; border-radius: 6px; background: var(--bg); color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  padding: 9px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #07111f; font: inherit; font-weight: 600; cursor: pointer;
}
button.danger { background: var(--danger); }
.notice { padding: 8px 10px; border-radius: 6px; margin: 0 0 14px; }
.notice.error { background: rgba(255, 107, 107, .15); color: var(--danger); }
.notice.ok { background: rgba(95, 208, 138, .15); color: var(--ok); }
.tag { margin-left: 6px; padding: 1px 6px; border-radius: 8px; background: var(--tile); color: var(--muted); font-size: 12px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
td { padding: 8px 6px; border-bottom: 1px solid #262b35; vertical-align: middle; }
form.inline { display: flex; gap: 6px; margin: 0; }
form.inline input { width: 150px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ----------------------------------- Small screens ----------------------------------- */

@media (max-width: 520px) {
  .v-stage { padding: 0 0 14px; }
  .v-nav { width: 40px; }
}