/* Zeitoun Apparitions — local htmx gallery */
:root {
  --bg: #12151a;
  --bg2: #1a1f27;
  --panel: #20262f;
  --line: #2e3641;
  --text: #e8e6e1;
  --dim: #9aa3ad;
  --accent: #d4a95c;
  --accent2: #8fb573;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 18px 28px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
body::before {
  content: ""; display: block; height: 2px;
  background: var(--accent);
}
.topbar h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: .2px; }
.topbar h1 .thin { font-weight: 400; color: var(--dim); font-size: 16px; }
.topbar .sub { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.dl-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--accent);
  padding: 10px 16px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  white-space: nowrap;
}
.dl-btn:hover { border-color: var(--accent); text-decoration: none; background: #262d37; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: calc(100vh - 130px); }
.sidenav {
  width: 300px; flex: 0 0 auto;
  border-right: 1px solid var(--line);
  background: var(--bg2);
  padding: 14px 10px 40px;
  overflow-y: auto;
  max-height: calc(100vh - 130px);
  position: sticky; top: 76px;
}
.nav-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px;
  cursor: pointer; border: 1px solid transparent;
}
.nav-item:hover { background: var(--panel); text-decoration: none; }
.nav-item.active { background: var(--panel); border-color: var(--line); color: var(--accent); }
.nav-count { color: var(--dim); font-size: 11.5px; flex: 0 0 auto; }
.content { flex: 1 1 auto; padding: 22px 28px 60px; min-width: 0; }

/* ---------- section head ---------- */
.sec-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.sec-head .count { color: var(--dim); font-size: 13px; }
.sec-head input[type="search"] {
  margin-left: auto; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 7px 12px; border-radius: 8px; font-size: 13px; width: 220px; outline: none;
}
.sec-head input[type="search"]:focus { border-color: var(--accent); }

/* ---------- grid ---------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.card {
  margin: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
}
.thumb-btn {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  background: #0c0e12; aspect-ratio: 4 / 3; overflow: hidden;
}
.thumb-btn img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform .18s ease;
}
.thumb-btn:hover img { transform: scale(1.04); }
.badge {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff;
  border-radius: 6px; padding: 1px 7px; font-size: 12px;
}
.badge.play { padding: 0; width: 22px; height: 18px; display: flex; align-items: center; justify-content: center; }
.badge.play::before {
  content: ""; display: block; margin-left: 2px;
  border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.dur {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #ffd894;
  border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.card figcaption {
  padding: 7px 10px; font-size: 12px; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card.hide { display: none; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 10, 13, .92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.lb-box {
  position: relative; width: min(94vw, 1200px); max-height: 94vh;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.lb-media {
  display: flex; align-items: center; justify-content: center;
  max-width: 100%; max-height: calc(94vh - 90px);
}
.lb-media img {
  max-width: 100%; max-height: calc(94vh - 90px);
  min-width: min(640px, 86vw); height: auto;
  object-fit: contain; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lb-media video {
  max-width: 100%; max-height: calc(94vh - 90px);
  min-width: min(640px, 86vw); height: auto;
  border-radius: 6px; background: #000;
}
.lb-media .pdf-frame {
  width: min(900px, 90vw); height: calc(94vh - 160px);
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.pdf-hint {
  font-size: 13px; color: var(--dim); display: flex; gap: 8px; align-items: center;
  justify-content: center; margin: -2px 0 0;
}
.lb-close {
  position: absolute; top: -38px; right: 0; background: none; border: 0; color: var(--dim);
  font-size: 22px; cursor: pointer;
}
.lb-close:hover { color: #fff; }
.lb-nav {
  position: absolute; top: 42%; background: rgba(0,0,0,.5); border: 1px solid var(--line);
  color: var(--text); font-size: 30px; line-height: 1; width: 46px; height: 64px;
  border-radius: 10px; cursor: pointer;
}
.lb-nav:hover { background: rgba(0,0,0,.75); color: var(--accent); }
.lb-prev { left: -58px; }
.lb-next { right: -58px; }
.lb-meta {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
}
.lb-caption { font-size: 14.5px; }
.lb-pos { font-size: 12px; color: var(--dim); }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line); color: var(--dim); font-size: 12px;
  padding: 14px 28px 22px;
}
.foot p { margin: 0; max-width: 110ch; }

.about { max-width: 110ch; color: var(--dim); }
.about p { margin-top: 0; }

/* ---------- htmx indicator / responsive ---------- */
.htmx-request.content::before, .content.htmx-request::before {
  content: "Loading…"; color: var(--dim); display: block; padding: 30px 0;
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidenav { width: 100%; max-height: 40vh; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .content { padding: 18px 14px 50px; }
}


/* ---------- notice (downloads & integrity) ---------- */
.notice {
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  padding: 0 28px;
  font-size: 13.5px;
}
.notice summary {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline;
  cursor: pointer; list-style: none; padding: 9px 0; color: var(--dim);
}
.notice summary::-webkit-details-marker { display: none; }
.notice summary::before {
  content: ""; display: inline-block; width: 0; height: 0; margin-right: 8px;
  border-left: 5px solid var(--dim); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
.notice[open] summary::before { transform: rotate(90deg); }
.notice summary:hover { color: var(--text); }
.notice-brief { color: var(--dim); }
.notice summary .mono { color: var(--accent); }
.notice-body { padding: 2px 0 16px; max-width: 110ch; color: var(--dim); }
.notice-body p { margin: 6px 0; }
.notice-body a { color: var(--accent); }
.notice pre.mono {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 14px; overflow-x: auto; color: var(--text); font-size: 12.5px; margin: 8px 0;
}
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }

/* ---------- a11y & motion ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  .thumb-btn img { transition: none; }
  .thumb-btn:hover img { transform: none; }
  .notice summary::before { transition: none; }
  .lb-box { animation: none; }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a434f; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes lbIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.lb-box { animation: lbIn .16s ease; }
