:root {
  --bg: #ffffff;
  --surface: #f6f5f3;
  --text: #2b2b2b;
  --muted: #606060;      /* the old picweb grey */
  --line: #dddad5;
  --accent: #993333;     /* old comment colour */
  --danger: #b3261e;
  --ok: #2e6b3a;
  --radius: 6px;
  font-family: Tahoma, "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --surface: #202020;
    --text: #e6e6e6;
    --muted: #a0a0a0;
    --line: #383838;
    --accent: #e08a8a;
    --danger: #ff8a80;
    --ok: #8fd19e;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--muted); text-decoration: none; }
a:hover { color: var(--text); text-decoration: underline; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
h1, h2 { font-weight: normal; color: var(--muted); margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
.sc { font-variant: small-caps; letter-spacing: .04em; }
.muted, .hint { color: var(--muted); }
.keys { font-size: .75rem; margin-top: 1.5rem; }
code { background: var(--surface); padding: 1px 4px; border-radius: 3px; }

/* header */
header.site {
  display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.brand { font-variant: small-caps; font-size: 1.3rem; letter-spacing: .06em; color: var(--text); }
.brand span { color: var(--muted); }
header nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; font-variant: small-caps; }
form.inline { display: inline; }

/* forms */
input, textarea, button, .button {
  font: inherit; font-size: 1rem; border-radius: var(--radius);
}
input:not([type=checkbox]):not([type=file]), textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
button, .button {
  display: inline-block; padding: 8px 16px; border: 1px solid var(--muted);
  background: var(--muted); color: var(--bg); cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.15); text-decoration: none; color: var(--bg); }
button.secondary, .button.secondary { background: transparent; color: var(--muted); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font-variant: small-caps; }
button.link:hover { text-decoration: underline; filter: none; color: var(--text); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.stack label.check { flex-direction: row; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
small { color: var(--muted); }

.card { background: var(--surface); border-radius: var(--radius); padding: 20px; max-width: 720px; margin: 0 auto 20px; }
.card.narrow { max-width: 380px; margin-top: 8vh; }
.danger-zone { border: 1px solid var(--danger); }

.flash { max-width: 1400px; margin: 12px auto 0; padding: 10px 16px; border-left: 4px solid var(--ok); background: var(--surface); }
.flash-error { border-color: var(--danger); }

/* gallery list */
.gallery-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.gallery-card { display: block; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.gallery-card:hover { text-decoration: none; outline: 2px solid var(--muted); }
.gallery-card .cover { aspect-ratio: 4 / 3; background: var(--line); }
.gallery-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-card .meta { display: flex; flex-direction: column; padding: 10px 12px; }
.gallery-card .meta strong { color: var(--text); font-weight: normal; font-size: 1.1rem; }
.gallery-card .meta span { font-size: .85rem; }

/* gallery grid: 7 x 4 like the old index pages */
.gallery-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.description { margin: 0 0 .3em; max-width: 60ch; }
.grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
}
.grid li { aspect-ratio: 1; background: var(--surface); border-radius: 4px; }
.grid a { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; padding: 6px; }
.grid img { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.grid a:hover img { outline: 2px solid var(--accent); }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }

.pager { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; margin: 20px 0 0; }
.pager strong { color: var(--text); }

/* upload */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  color: var(--muted);
}
.dropzone p { margin: 4px 0; }
.dropzone.over { border-color: var(--accent); background: var(--surface); }
.filepick { text-decoration: underline; cursor: pointer; }
.filepick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone progress { width: 100%; }

/* single picture: info column right-aligned on the left, like vorlage1 */
.photo-layout { display: grid; grid-template-columns: 260px 1fr; gap: 0 32px; }
.photo-info { text-align: right; border-right: 1px solid var(--line); padding-right: 24px; color: var(--muted); }
.photo-info h1 { font-size: 1.3rem; margin-bottom: .2em; }
.photo-info p { margin: .4em 0; }
.photo-info .comment { color: var(--accent); font-size: 1.05rem; }
.photo-info dl { margin: 1em 0; font-size: .85rem; }
.photo-info dt { color: var(--muted); opacity: .75; margin-top: .4em; }
.photo-info dd { margin: 0; color: var(--text); }
.photo-nav { display: flex; justify-content: flex-end; gap: 16px; margin: 1em 0 .4em; font-size: 1.05rem; }
.photo { margin: 0; display: flex; justify-content: flex-start; }
.photo img { max-width: 100%; max-height: calc(100vh - 110px); width: auto; height: auto; display: block; }
.admin-box { text-align: left; margin-top: 1.5em; }
.admin-box summary { cursor: pointer; text-align: right; }
.admin-box form { margin-top: 12px; }
@media (max-width: 800px) {
  .photo-layout { grid-template-columns: 1fr; }
  .photo { order: -1; justify-content: center; margin-bottom: 16px; }
  .photo-info { text-align: left; border-right: 0; padding-right: 0; }
  .photo-nav { justify-content: space-between; }
  .admin-box summary { text-align: left; }
}

table.users { width: 100%; border-collapse: collapse; }
table.users th, table.users td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users input { min-width: 120px; }
@media (max-width: 600px) {
  table.users thead { display: none; }
  table.users tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.users td { display: block; border: 0; padding: 4px 0; }
}
