:root {
  --bg: #f7f6f3; --panel: #fff; --ink: #1f2328; --muted: #6b6f76; --line: #e3e1dc;
  --accent: #2f5d8a; --accent-ink: #fff; --ok: #2e7d4f; --ok-bg: #e7f4ec;
  --warn: #9a5b00; --warn-bg: #fdf1dc; --sugg: #5b4a9e; --sugg-bg: #efebfa;
  --none-bg: #eeeeec; --undated-bg: #f6e7e7; --undated: #8a3434;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c; --panel: #202327; --ink: #e8e6e3; --muted: #9aa0a6; --line: #33373c;
    --accent: #7fb0e0; --accent-ink: #10202f; --ok: #7fd1a1; --ok-bg: #1d3327;
    --warn: #f0b660; --warn-bg: #3a2c14; --sugg: #b9a8f0; --sugg-bg: #2b2540;
    --none-bg: #2a2d31; --undated-bg: #3a2222; --undated: #f0a0a0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; padding: .7rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .lib { font-weight: 650; }
.topbar .spacer { flex: 1; }
.topbar form { margin: 0; }
main { max-width: 78rem; margin: 0 auto; padding: 1.25rem; }
h1 { font-size: 1.45rem; margin: .2rem 0 .3rem; }
.lede { color: var(--muted); margin: 0 0 1rem; max-width: 52rem; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: .3rem .7rem; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
input[type=text] { font: inherit; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); width: 11rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.chip { padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip .n { color: var(--muted); margin-left: .3rem; font-variant-numeric: tabular-nums; }
.chip.on .n { color: inherit; opacity: .7; }
.bulkbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .6rem .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: .75rem; position: sticky; top: 3.1rem; z-index: 4; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.frow { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .8rem; display: grid; grid-template-columns: minmax(16rem, 1.2fr) minmax(12rem, 1fr); gap: .5rem 1rem; align-items: start; }
.tree .frow { margin-left: calc(var(--depth) * 1.1rem); }
.fhead { display: flex; gap: .6rem; align-items: flex-start; min-width: 0; }
.fhead input[type=checkbox] { margin-top: .35rem; }
.fname { min-width: 0; }
.fname a.name { font-weight: 600; word-break: break-word; }
.fparent { font-size: .82rem; color: var(--muted); word-break: break-word; }
.counts { display: block; font-size: .85rem; color: var(--muted); }
.warn { color: var(--warn); }
.fdate { display: flex; flex-direction: column; gap: .15rem; }
.fdate .date { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.fdate .inh { color: var(--muted); font-size: .9rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .02em; padding: .05rem .5rem; border-radius: 999px; width: fit-content; }
.b-suggested { background: var(--sugg-bg); color: var(--sugg); }
.b-confirmed { background: var(--ok-bg); color: var(--ok); }
.b-undated { background: var(--undated-bg); color: var(--undated); }
.b-none { background: var(--none-bg); color: var(--muted); }
.thumbs { grid-column: 1 / -1; display: flex; gap: .35rem; overflow: hidden; }
.thumbs img { height: 64px; width: auto; max-width: 96px; object-fit: cover; border-radius: 4px; background: var(--none-bg); }
.factions { grid-column: 1 / -1; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.factions form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.preview { font-size: .85rem; color: var(--muted); }
.preview .bad { color: var(--undated); }
.preview .good { color: var(--ok); }
.msg { grid-column: 1 / -1; font-size: .88rem; color: var(--ok); }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: .55rem 1rem; border-radius: 8px; max-width: min(36rem, calc(100vw - 2rem)); z-index: 10; }
.toast:empty { display: none; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .3rem; word-break: break-word; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .8rem; margin-bottom: 1rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; }
.tile.conflict { border-color: var(--warn); }
.tile label { display: block; cursor: pointer; }
.tile input[type=checkbox] { position: absolute; top: .4rem; left: .4rem; width: 1.1rem; height: 1.1rem; }
.tile img, .tile .noimg { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--none-bg); }
.tile .noimg { display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.tile .meta { padding: .35rem .45rem; font-size: .8rem; }
.tile .meta .d { font-weight: 600; font-size: .88rem; font-variant-numeric: tabular-nums; }
.tile .meta .src { color: var(--muted); }
.tile .note { color: var(--warn); font-size: .75rem; margin-top: .2rem; }
.tile .fname-small { color: var(--muted); font-size: .72rem; word-break: break-all; }
.empty { color: var(--muted); padding: 2rem; text-align: center; }
@media (max-width: 640px) {
  .frow { grid-template-columns: 1fr; }
  .tree .frow { margin-left: calc(var(--depth) * .5rem); }
  input[type=text] { width: 9rem; }
}

.searchbar { display: flex; gap: .5rem; margin: .5rem 0 1rem; }
.searchbar input[type=search] { flex: 1; font: inherit; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.person { text-align: center; }
.person img, .person .noface { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: var(--none-bg); display: block; }
.person .noface { display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.person .pname { display: block; margin-top: .35rem; font-weight: 600; font-size: .9rem; word-break: break-word; }
.person .pcount { color: var(--muted); font-size: .8rem; }
.person input[type=text] { width: 100%; margin-top: .35rem; font-size: .85rem; }
.hero { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.hero img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }

/* --- Browsing: timeline, viewer, albums, sharing --- */
:root { --danger: #a33a3a; }
@media (prefers-color-scheme: dark) { :root { --danger: #f09090; } }
.muted { color: var(--muted); }
.flash { padding: .4rem .7rem; background: var(--ok-bg); border-radius: 6px; width: fit-content; }
button.danger, .danger { color: var(--danger); }
input[type=email], input[type=password], input[type=number], select { font: inherit; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
input.num { width: 5.5rem; }
input.wide { width: min(40rem, 100%); }
.narrow { max-width: 28rem; margin: 3rem auto; }

.tl { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1.25rem; }
.years { position: sticky; top: 3.6rem; align-self: start; max-height: calc(100vh - 4.5rem); overflow-y: auto; display: flex; flex-direction: column; font-size: .85rem; font-variant-numeric: tabular-nums; }
.years .decade { color: var(--muted); font-weight: 650; margin-top: .5rem; }
.years a { padding: .05rem 0 .05rem .5rem; }
.years .undated-link { margin-top: .6rem; color: var(--undated); }
.tl-body { min-width: 0; }
.yh { font-size: 1.35rem; margin: 1.6rem 0 .2rem; position: sticky; top: 3.1rem; background: var(--bg); padding: .25rem 0; z-index: 3; }
/* Jumps (#y2017, #f<folder>) land below the sticky top bar, and folders below the sticky
   year heading too, so the heading of what was jumped to is in view. */
.year { scroll-margin-top: 3.1rem; }
.fh { scroll-margin-top: 6rem; }
.mh { font-size: .95rem; font-weight: 600; margin: 1rem 0 .4rem; }
.yh .n, .mh .n { color: var(--muted); font-weight: 400; font-size: .8em; margin-left: .3rem; }
.grid.lazy:empty { min-height: calc(var(--n) / 6 * 158px); background: repeating-linear-gradient(90deg, var(--none-bg) 0 150px, transparent 150px 160px); border-radius: 8px; opacity: .5; }
.grid .more { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; }
.tile > input.sel { position: absolute; top: .4rem; left: .4rem; width: 1.15rem; height: 1.15rem; z-index: 1; opacity: 0; transition: opacity .1s; }
.tile:hover > input.sel, .tile > input.sel:checked, body.selecting .tile > input.sel { opacity: 1; }
.tile:has(> input.sel:checked) { outline: 3px solid var(--accent); outline-offset: -3px; }
.selectbar { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem; box-shadow: 0 6px 24px rgb(0 0 0 / .18); z-index: 8; max-width: calc(100vw - 2rem); }
.selectbar[hidden] { display: none; }
.selectbar .or { color: var(--muted); }
.selectbar .sep { align-self: stretch; width: 1px; background: var(--line); }
.selectbar [name="date"] { width: 11rem; }
.selectbar .date-preview { font-size: .85rem; color: var(--muted); }
.selectbar .date-preview .bad { color: var(--undated); }
.selectbar .date-preview .good { color: var(--ok); }

.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; }
.stage { position: sticky; top: 3.6rem; display: flex; align-items: center; justify-content: center; background: #111; border-radius: 10px; min-height: 60vh; }
.frame { position: relative; margin: 0; line-height: 0; }
.frame img, .frame video { max-width: 100%; max-height: calc(100vh - 9rem); display: block; }
.frame:has(video) { width: 100%; }
.frame video { width: 100%; aspect-ratio: 4 / 3; background: #000; }
.vidnote { position: absolute; left: 0; right: 0; bottom: 0; padding: .5rem .8rem; background: rgb(0 0 0 / .65); color: #fff; font-size: .85rem; line-height: 1.4; }
.stage .nav { position: absolute; top: 0; bottom: 0; width: 3.5rem; display: grid; place-items: center; font-size: 2.6rem; color: #fff; opacity: .55; z-index: 2; text-decoration: none; }
.stage .nav:hover { opacity: 1; background: rgb(255 255 255 / .06); }
.stage .prev { left: 0; } .stage .next { right: 0; }
.noimg.big { color: #bbb; padding: 4rem 2rem; line-height: 1.4; max-width: 30rem; }
.boxes .box { position: absolute; border: 2px solid rgb(255 255 255 / .85); border-radius: 4px; box-shadow: 0 0 0 1px rgb(0 0 0 / .4); }
.boxes .box span { position: absolute; top: 100%; left: -2px; margin-top: 2px; background: rgb(0 0 0 / .7); color: #fff; font-size: .75rem; line-height: 1.3; padding: .05rem .35rem; border-radius: 3px; white-space: nowrap; }
.info section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .8rem; margin-bottom: .75rem; }
.info h2 { margin: 0 0 .5rem; font-size: .95rem; display: flex; justify-content: space-between; align-items: baseline; }
.info .date { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.info .src { color: var(--muted); font-size: .9rem; }
.info .note { color: var(--warn); font-size: .85rem; margin-top: .25rem; }
.info .dateform { margin: .6rem 0 0; }
.info .dateform input[type=text] { width: 100%; }
.info .addto { margin: .5rem 0 0; }
.faces { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr)); gap: .5rem; }
.faces li { text-align: center; font-size: .78rem; word-break: break-word; }
.faces a { color: inherit; }
.faces img, .faces .noface { width: 3.6rem; height: 3.6rem; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto .2rem; background: var(--none-bg); }
.faces .noface { display: grid; place-items: center; color: var(--muted); }
.faces .fix { font-size: .75rem; }
.face-editor { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.face-editor p { margin: 0 0 .4rem; font-size: .85rem; display: flex; gap: .6rem; align-items: center; }
.face-editor p img { width: 3rem; height: 3rem; border-radius: 50%; object-fit: cover; flex: none; }
.face-editor input[type=text] { width: 100%; }
.face-editor .toolbar { margin: .4rem 0 0; }
.boxes .box.on { border: 3px solid #ffd400; box-shadow: 0 0 0 2px rgb(0 0 0 / .5); }
.facts { display: grid; grid-template-columns: 6rem 1fr; gap: .3rem .6rem; margin: 0; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.chip { display: inline-block; margin: 0 .2rem .25rem 0; font-size: .8rem; }

.albums { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.albums a { display: block; color: inherit; }
.albums img, .albums .noimg { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--none-bg); }
.albums .noimg { display: grid; place-items: center; color: var(--muted); }
.albums .t { display: block; font-weight: 600; margin-top: .4rem; }
.albums .n { color: var(--muted); font-size: .85rem; }
.titleform { display: flex; gap: .5rem; align-items: baseline; margin: .2rem 0 .3rem; }
.titleform .h1input { font-size: 1.45rem; font-weight: 650; border-color: transparent; background: transparent; width: min(34rem, 100%); padding: .1rem .3rem; margin-left: -.3rem; }
.titleform .h1input:hover, .titleform .h1input:focus { border-color: var(--line); background: var(--panel); }
.shares summary { cursor: pointer; }
.newshare { background: var(--ok-bg); border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; }
.newshare p { margin: 0 0 .4rem; }
.sharelist { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .6rem 0; }
.sharelist th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: .3rem .4rem; }
.sharelist td { border-bottom: 1px solid var(--line); padding: .35rem .4rem; vertical-align: top; }
.sharelist tr.inactive td { color: var(--muted); }
.sharelist .acts { display: flex; gap: .6rem; }
.sharelist .acts form { margin: 0; }
.sharelist .ua { font-size: .75rem; }
.shareform fieldset { border: 0; padding: 0; margin: .8rem 0 .5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.shareform legend { font-weight: 600; margin-bottom: .3rem; }
.shareform [hidden] { display: none; }

.lightbox { padding: 0; border: 0; background: #000; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: #000; }
.lightbox img, .lightbox video { width: 100%; height: 100%; object-fit: contain; }
.lightbox button { position: absolute; background: rgb(0 0 0 / .4); color: #fff; border: 0; font-size: 2.2rem; padding: .2rem .9rem; }
.lightbox .lb-prev { left: .5rem; top: 50%; } .lightbox .lb-next { right: .5rem; top: 50%; }
.lightbox .lb-close { right: .5rem; top: .5rem; }

@media (max-width: 860px) {
  .viewer { grid-template-columns: 1fr; }
  .stage { position: relative; top: auto; }
  .tl { grid-template-columns: 1fr; }
  .years { position: static; flex-direction: row; flex-wrap: wrap; gap: .1rem .5rem; max-height: none; }
  .years .decade { margin-top: 0; width: 100%; }
}

.tile > a { position: relative; display: block; }
.tile .dur { position: absolute; right: .3rem; bottom: .3rem; background: rgb(0 0 0 / .65); color: #fff; font-size: .72rem; line-height: 1; padding: .2rem .35rem; border-radius: 3px; font-variant-numeric: tabular-nums; pointer-events: none; }

/* Map. isolation keeps Leaflet's high z-indexes below the sticky top bar. */
main:has(.mapwrap) { max-width: none; }
.maphead { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.25rem; }
.maphead .lede { margin: 0; }
.yearfilter { display: flex; gap: .8rem; align-items: center; color: var(--muted); }
.yearfilter[hidden] { display: none; }
.yearfilter select { font: inherit; }
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1rem; height: calc(100vh - 9.5rem); min-height: 26rem; margin-top: .75rem; }
.map, .minimap { isolation: isolate; border-radius: 10px; border: 1px solid var(--line); background: var(--none-bg); }
.mapside { overflow-y: auto; }
.mapside .count { color: var(--muted); margin: 0 0 .6rem; }
.mapside .grid { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
.pin { background: none; border: 0; }
.pin img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 1px 5px rgb(0 0 0 / .45); background: #ccc; display: block; }
.pin span { position: absolute; top: -8px; right: -10px; min-width: 1.5rem; padding: .05rem .35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 650; text-align: center; box-shadow: 0 1px 3px rgb(0 0 0 / .4); }
.minimap { height: 11rem; margin-top: .75rem; }
@media (max-width: 860px) {
  .mapwrap { grid-template-columns: 1fr; height: auto; }
  .map { height: 65vh; }
  .mapside { overflow: visible; }
}

/* Upload */
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 2rem 1rem; text-align: center; background: var(--panel); }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.dropzone p { margin: .4rem 0; }
.dropzone .btn { display: inline-block; margin: 0 .25rem; }
.dropzone .hint { color: var(--muted); font-size: .85rem; }
.upload-plan, .upload-run { margin-top: 1.25rem; }
.upload-options { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.upload-options [hidden] { display: none; }
.upload-run progress { width: 100%; height: .8rem; }
.upload-now { list-style: none; padding: 0; margin: .3rem 0; color: var(--muted); font-size: .85rem; }
.upload-now li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-problems { font-size: .85rem; }
.upload-problems .why { color: var(--undated); }
.sh { font-size: 1.2rem; margin: 1.4rem 0 .2rem; }
.sh .n { color: var(--muted); font-weight: 400; font-size: .8em; margin-left: .3rem; }

/* Photos by folder, and the folder page */
.fh a { color: inherit; }
.fh a:hover { color: var(--accent, inherit); text-decoration: underline; }
.lede .path { font-size: .85rem; word-break: break-word; }
.folderlist { list-style: none; padding: 0; margin: .5rem 0 0; columns: 18rem; column-gap: 1.5rem; }
.folderlist li { padding: .15rem 0; break-inside: avoid; }
.folderlist .n, .fh .n { color: var(--muted); font-weight: 400; font-size: .85rem; }
.leftout { margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.leftout summary { cursor: pointer; }
.leftout .faces { margin-top: .5rem; opacity: .75; }
.addperson { margin-top: .8rem; margin-bottom: 0; }
.addperson input { flex: 1; min-width: 8rem; }

/* Search filters */
.filters summary { cursor: pointer; }
.filters fieldset { border: 0; padding: 0; margin: .8rem 0 0; min-width: 0; }
.filters legend { font-weight: 600; padding: 0; margin-bottom: .35rem; }
.filters legend .muted { font-weight: 400; }
.filters label { margin-right: .9rem; white-space: nowrap; }
.filters input[type=text] { font: inherit; padding: .25rem .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.filter-row { display: flex; flex-wrap: wrap; gap: .5rem 2rem; }
.filters .toolbar { margin: 1rem 0 0; }
.people-filter { width: 100%; max-width: 22rem; font: inherit; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); margin-bottom: .6rem; }
.pick { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: .6rem; max-height: 19rem; overflow-y: auto; }
.pick li[hidden] { display: none; }
.pick label { display: block; text-align: center; font-size: .78rem; white-space: normal; margin: 0; cursor: pointer; word-break: break-word; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick img, .pick .noface { width: 4rem; height: 4rem; border-radius: 50%; object-fit: cover; display: grid; place-items: center; margin: 0 auto .25rem; background: var(--none-bg); color: var(--muted); border: 3px solid transparent; }
.pick input:checked ~ img, .pick input:checked ~ .noface { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pick input:checked ~ span { font-weight: 650; color: var(--accent); }
.pick input:focus-visible ~ img, .pick input:focus-visible ~ .noface { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: .2rem .4rem .2rem .25rem; font-size: .9rem; }
.chips .k { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: .1rem .55rem; margin-right: .25rem; font-size: .8rem; }
.chips a { margin-left: .3rem; text-decoration: none; color: var(--muted); }

/* Person page tools and their dialogs */
.person-tools .spacer { flex: 1; }
.dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 1.2rem 1.4rem; width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); }
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog h2 { margin-top: 0; }
.dialog p { max-width: 36rem; }
.dialog .pick { max-height: 16rem; margin-bottom: .8rem; }
.dialog-actions { justify-content: flex-end; margin: .5rem 0 0; }
.tile .tile-folder { display: block; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .fname-small.short { word-break: normal; overflow-wrap: anywhere; }

/* Album covers */
.album-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: .5rem; }
.album-cover { width: 9rem; height: 9rem; object-fit: cover; border-radius: 10px; flex: none; }
@media (max-width: 40rem) { .album-cover { width: 5.5rem; height: 5.5rem; } }
.inalbums { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.inalbums li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inalbums form { display: inline; margin: 0; }
.inalbums .muted { font-size: .85rem; }

/* Shared album: a gallery, introduced by its cover photo (SmugMug-like). Always dark, so
   the photos carry the colour. */
body:has(.gallery) { background: #111; color: #eee; }
body:has(.gallery) main { max-width: none; padding: 0; }
.gallery { padding: 0 0 2rem; }
.g-hero { position: relative; height: min(62vh, 40rem); overflow: hidden; background: #222; }
.g-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-hero-plain { height: auto; padding: 4rem 1.5rem 1rem; }
.g-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 4rem 2rem 1.6rem; background: linear-gradient(transparent, rgb(0 0 0 / .65)); color: #fff; }
.g-hero-plain .g-title { position: static; padding: 0; background: none; }
.g-title h1 { font-size: clamp(2rem, 6vw, 4rem); font-weight: 300; margin: 0; line-height: 1.1; text-shadow: 0 1px 12px rgb(0 0 0 / .4); }
.g-title p { margin: .4rem 0 0; opacity: .85; }
.g-tools { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; }
.g-tools button { background: #2a2a2a; color: #eee; border: 1px solid #444; border-radius: 6px; padding: .45rem .9rem; font: inherit; cursor: pointer; }
.g-tools button:hover { background: #333; }
.g-note { color: #999; font-size: .85rem; }
/* Justified rows: each photo grows in proportion to its shape; the filler keeps the last
   row from stretching. */
.jgrid { list-style: none; margin: 0; padding: 0 1rem; display: flex; flex-wrap: wrap; gap: 6px; }
.jgrid::after { content: ""; flex: 10 1 0; }
.jgrid li { position: relative; flex: var(--r) 1 calc(var(--r) * 220px); height: 220px; overflow: hidden; background: #222; }
.jgrid li a.lb { display: block; width: 100%; height: 100%; }
.jgrid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.jgrid li:hover img { transform: scale(1.03); }
.jgrid .dur { position: absolute; left: .4rem; bottom: .4rem; }
.jgrid .noimg { display: grid; place-items: center; height: 100%; color: #888; }
.jgrid .empty { flex: 1; height: auto; background: none; color: #999; padding: 2rem 0; }
.g-dl { position: absolute; right: .4rem; top: .4rem; background: rgb(0 0 0 / .55); color: #fff; border-radius: 6px; padding: .1rem .45rem; text-decoration: none; opacity: 0; transition: opacity .2s; }
.jgrid li:hover .g-dl, .g-dl:focus-visible { opacity: 1; }
@media (max-width: 40rem) {
  .jgrid { padding: 0 .4rem; gap: 4px; }
  .jgrid li { flex-basis: calc(var(--r) * 130px); height: 130px; }
  .g-title { padding: 3rem 1rem 1rem; }
  .g-dl { opacity: 1; }
}
