/* Kleuren van de oude Uploadarchief-site: blauwe kopbalk #6666ff, tabelkoppen #9999ff/#ccccff, links #000099. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #eeeeff;
  --text: #000000;
  --muted: #555577;
  --border: #9999ff;
  --border-strong: #6666ff;
  --accent: #000099;
  --button: #6666ff;
  --button-text: #ffffff;
  --head-bg: #6666ff;
  --head-border: #000099;
  --head-text: #ffffff;
  --th-bg: #9999ff;
  --th-text: #ffffff;
  --title-bg: #ccccff;
  --notice-bg: #ccccff;
  --notice-text: #000099;
  --notice-border: #9999ff;
  --shadow: none;
  --radius: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10102a;
    --surface: #181838;
    --surface-2: #222248;
    --text: #e8e8ff;
    --muted: #a4a4cc;
    --border: #3a3a7a;
    --border-strong: #6666ff;
    --accent: #aaaaff;
    --button: #6666ff;
    --button-text: #ffffff;
    --head-bg: #4a4ad0;
    --head-border: #000066;
    --head-text: #ffffff;
    --th-bg: #4a4ab0;
    --th-text: #ffffff;
    --title-bg: #2a2a66;
    --notice-bg: #2a2a66;
    --notice-text: #ddddff;
    --notice-border: #3a3a7a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Kop */
.top { background: var(--head-bg); border-bottom: 2px solid var(--head-border); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-size: 26px; color: var(--head-text); white-space: nowrap; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; color: var(--head-text); }
.search { flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; padding: 6px 10px; font: inherit; color: #000;
  background: #fff; border: 1px solid var(--head-border); border-radius: 3px;
}
.search input:focus { outline: 2px solid #ccccff; outline-offset: 0; }

.notice { background: var(--notice-bg); color: var(--notice-text); border-bottom: 1px solid var(--notice-border); font-size: 14px; }
.notice .wrap { padding-top: 8px; padding-bottom: 8px; }

main.wrap { padding-top: 24px; padding-bottom: 40px; min-height: 60vh; }
.loading, .empty { color: var(--muted); }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 {
  font-size: 14px; margin: 32px 0 12px; padding: 5px 10px; color: var(--accent);
  background: var(--title-bg); border: 1px solid var(--border-strong);
}
.sub { color: var(--muted); margin: 0 0 20px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* Categorieën */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cat {
  display: block; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text);
}
.cat:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.cat-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--accent); }
.cat-meta { color: var(--muted); font-size: 13px; }

/* Werkbalk */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.toolbar input, .toolbar select, .btn {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 10px;
}
.toolbar input { flex: 1; min-width: 180px; }
.btn { cursor: pointer; white-space: nowrap; color: var(--accent); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--button); border-color: var(--head-border); color: var(--button-text); }
.btn.primary:hover { background: var(--head-border); }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.seg .btn[aria-pressed="true"] { background: var(--title-bg); font-weight: 700; }
.count { color: var(--muted); font-size: 14px; margin-left: auto; }

/* Raster */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--head-border); text-decoration: none; }
.tile:hover .tile-name { color: var(--accent); }
.thumb {
  aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.contain { background: #fff; }
.thumb.contain img { object-fit: contain; padding: 6px; }
.ext {
  font-weight: 700; font-size: 15px; letter-spacing: .04em; color: var(--accent); text-transform: uppercase;
  border: 2px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 6px 10px; max-width: 80%;
  overflow: hidden; text-overflow: ellipsis;
}
.icon { width: 20px; height: 20px; vertical-align: -5px; margin-right: 6px; }
.tile-body { padding: 8px 10px 10px; min-width: 0; }
.tile-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: 12px; color: var(--muted); }

/* Lijst */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border-strong); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 5px 10px; border: 1px solid var(--border-strong); white-space: nowrap; }
th { background: var(--th-bg); color: var(--th-text); font-weight: 700; }
tbody tr:nth-child(even) td { background: var(--surface-2); }
tr > :first-child { border-left: 0; }
tr > :last-child { border-right: 0; }
thead th { border-top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.name { white-space: normal; word-break: break-word; min-width: 220px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

/* Paginering */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 24px 0 0; }
.pager .btn[aria-current="page"] { background: var(--button); border-color: var(--head-border); color: var(--button-text); }
.pager .gap { padding: 7px 4px; color: var(--muted); }

/* Detail */
.detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .detail { grid-template-columns: 1fr; } }
.preview {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; min-height: 240px; padding: 12px;
}
.preview img { max-width: 100%; max-height: 75vh; height: auto; }
.preview .ext { font-size: 28px; padding: 14px 22px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel h1 { font-size: 20px; word-break: break-word; }
.descr { white-space: pre-wrap; word-break: break-word; margin: 12px 0; }
dl.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0 16px; font-size: 14px; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.codes label { display: block; font-size: 12px; font-weight: 700; color: var(--accent); margin: 10px 0 4px; }
.code-row { display: flex; gap: 6px; }
.code-row input {
  flex: 1; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
.nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

.foot { color: var(--muted); font-size: 13px; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--border); }

@media (max-width: 560px) {
  .top-inner { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 8px; }
  .search { max-width: none; flex-basis: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .count { margin-left: 0; flex-basis: 100%; }
}
