:root {
  --groen: #4a7729;
  --donker: #2e2e2e;
  --grijs: #6b6b6b;
  --lijn: #e4e4e0;
  --bg: #fafaf8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--donker);
  background: var(--bg);
}

/* ---------- wachtwoordscherm ---------- */
#gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.gate-box { text-align: center; padding: 2rem; }
.gate-box h1 { font-size: 1.6rem; font-weight: 600; margin-bottom: .4rem; }
.gate-box h1 span { color: var(--groen); font-weight: 400; }
.gate-box p { color: var(--grijs); margin-bottom: 1.2rem; }
.gate-box input {
  padding: .55rem .8rem; font-size: 1rem; border: 1px solid var(--lijn);
  border-radius: 6px 0 0 6px; outline: none; width: 220px;
}
.gate-box input:focus { border-color: var(--groen); }
.gate-box button {
  padding: .55rem 1.1rem; font-size: 1rem; border: none; cursor: pointer;
  background: var(--groen); color: #fff; border-radius: 0 6px 6px 0;
}
.gate-msg { color: #b03030; min-height: 1.2em; margin-top: .8rem; }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.4rem; background: #fff; border-bottom: 1px solid var(--lijn);
}
.brand { font-size: 1.15rem; font-weight: 600; }
.brand span { color: var(--groen); font-weight: 400; }
.header-right { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--grijs); }
#counter { margin-right: .6rem; white-space: nowrap; }
.sort-label { white-space: nowrap; }
#sort_by {
  padding: .3rem .4rem; border: 1px solid var(--lijn); border-radius: 6px;
  background: #fff; font-size: .85rem; color: var(--donker);
}
#order_toggle {
  padding: .3rem .5rem; border: 1px solid var(--lijn); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: .85rem; color: var(--donker);
}
#order_toggle:hover { border-color: var(--groen); color: var(--groen); }

/* ---------- layout ---------- */
.layout { display: flex; align-items: flex-start; }
aside {
  width: 250px; flex: 0 0 250px;
  position: sticky; top: 53px; max-height: calc(100vh - 53px); overflow-y: auto;
  padding: 1rem 1.1rem 2rem; background: #fff; border-right: 1px solid var(--lijn);
}
main { flex: 1; padding: 1.1rem 1.4rem 3rem; min-width: 0; }

/* ---------- filters ---------- */
.reset-filters {
  display: inline-block; margin-bottom: 1rem; font-size: .8rem; color: var(--groen);
  cursor: pointer; text-decoration: underline;
}
.filter { margin-bottom: 1.05rem; }
.filter h3 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--grijs); margin-bottom: .35rem; font-weight: 600;
}
.filter select, .filter input[type=text] {
  width: 100%; padding: .35rem .45rem; font-size: .85rem;
  border: 1px solid var(--lijn); border-radius: 6px; background: #fff; color: var(--donker);
}
.filter select:focus, .filter input[type=text]:focus { outline: none; border-color: var(--groen); }
.filter-line { display: flex; align-items: center; gap: .45rem; margin-bottom: .25rem; font-size: .88rem; }
.filter-line input[type=checkbox] { accent-color: var(--groen); width: 15px; height: 15px; }
.filter-line label { cursor: pointer; }
.search-wrap { display: flex; }
.search-wrap input { border-radius: 6px 0 0 6px; }
.search-wrap button {
  border: none; background: var(--groen); color: #fff; padding: 0 .7rem;
  border-radius: 0 6px 6px 0; cursor: pointer;
}

/* ---------- grid ---------- */
#grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.tile {
  background: #fff; border: 1px solid var(--lijn); border-radius: 10px;
  overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.tile:hover { box-shadow: 0 4px 16px rgba(0,0,0,.10); transform: translateY(-2px); }
.tile img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: #eee; }
.tile .cap { padding: .5rem .65rem .6rem; font-size: .8rem; line-height: 1.35; }
.tile .cap b { display: block; font-size: .85rem; font-weight: 600; }
.tile .cap span { color: var(--grijs); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sentinel { height: 1px; }
#empty { color: var(--grijs); padding: 2rem 0; text-align: center; }

/* ---------- lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,20,20,.93);
  display: flex; align-items: center; justify-content: center;
}
#lightbox figure {
  max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center;
}
#lb-img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 4px; }
#lb-info {
  color: #ddd; font-size: .85rem; margin-top: .7rem; text-align: center; line-height: 1.5;
}
#lb-info b { color: #fff; }
#lb-info a { color: #9c6; }
.lb-close, .lb-prev, .lb-next {
  position: fixed; background: none; border: none; color: #fff; cursor: pointer;
  font-size: 2.6rem; line-height: 1; opacity: .75; z-index: 51;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; }
.lb-close { top: 14px; right: 22px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); font-size: 3.4rem; }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); font-size: 3.4rem; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  aside { position: static; width: 100%; flex: none; max-height: none; border-right: none; border-bottom: 1px solid var(--lijn); }
}
