*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --black: #000; --surface: #0a0a0a; --border: #1e1e1e; --border2: #2a2a2a;
  --dim: #444; --mid: #666; --light: #999; --text: #d4d0c8; --bright: #f0ece0;
  --red: #c0392b; --mono: 'Space Mono', monospace;
}
body { background: #000; color: var(--text); font-family: var(--mono); font-size: 13px; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #222; }

/* Nav layout lives in assets/nav.css. Per-page accent override below. */
.dropdown-menu a.active { color: var(--red); }
nav .nav-link.dropdown.active,
nav .nav-link.dropdown.active .bracket,
nav .nav-link.dropdown.active .caret { color: var(--red); }


.gallery-header { margin-top: 44px; padding: 32px 28px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.gh-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.gallery-title { font-family: 'Chakra Petch', sans-serif; font-size: 36px; font-weight: 700; letter-spacing: 4px; color: var(--bright); text-transform: uppercase; }
.gallery-tag { font-size: 10px; letter-spacing: 3px; color: var(--red); margin-bottom: 8px; }
.gallery-meta { font-size: 11px; color: var(--light); letter-spacing: 2px; text-align: right; }

.section-divider { padding: 14px 28px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #050505; }
.section-divider .name { font-size: 11px; letter-spacing: 3px; color: var(--dim); }
.section-divider .name span { color: var(--red); }
.section-divider .count { font-size: 10px; color: var(--dim); border: 1px solid var(--border); padding: 2px 8px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.grid-tile {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.grid-tile:nth-child(4n) { border-right: none; }
.grid-thumb {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.3s;
  filter: brightness(0.85) saturate(0.9);
  background: #0a0a0a;
  color: transparent; /* hide alt text on broken images */
  font-size: 0;
}
.grid-tile.broken { opacity: 0.4; }
.grid-tile.broken .grid-thumb { background: repeating-linear-gradient(45deg, #0a0a0a, #0a0a0a 8px, #050505 8px, #050505 16px); }
.grid-tile.broken::after { content: 'UNAVAILABLE'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 9px; letter-spacing: 2px; color: var(--mid); pointer-events: none; }
.grid-tile:hover .grid-thumb { transform: scale(1.04); filter: brightness(1) saturate(1); }
.grid-tile-label { padding: 8px 10px 10px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-title { font-size: 11px; color: var(--light); letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tile-title .br { color: var(--dim); }
.tile-plus { width: 18px; height: 18px; border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--dim); flex-shrink: 0; transition: border-color 0.2s, color 0.2s; }
.grid-tile:hover .tile-plus { border-color: var(--red); color: var(--red); }

@media (max-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } .grid-tile:nth-child(4n) { border-right: 1px solid var(--border); } .grid-tile:nth-child(3n) { border-right: none; } }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid-tile:nth-child(3n) { border-right: 1px solid var(--border); } .grid-tile:nth-child(2n) { border-right: none; } .gallery-title { font-size: 24px; } }

/* ─── ARCHIVE LOADER ─── */
#archive-loader {
  position: fixed;
  top: 44px; left: 0; right: 0;
  z-index: 90;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px 0;
  font-family: var(--mono);
  transition: opacity 0.6s, transform 0.6s;
  pointer-events: none;
}
#archive-loader.gone { opacity: 0; transform: translateY(-100%); }
.al-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; font-size: 10px; letter-spacing: 2.5px; color: var(--dim);
  padding-bottom: 6px;
}
.al-status { color: var(--bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.al-status .br { color: var(--red); }
.al-status .scramble { color: var(--red); }
.al-counter { color: var(--light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.al-counter .pct { color: var(--bright); }
.al-counter .sep { color: var(--border2); margin: 0 8px; }
.al-bar { position: relative; height: 2px; background: var(--border); overflow: hidden; }
.al-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: var(--red);
  transition: width 0.25s ease-out;
  box-shadow: 0 0 8px rgba(192,57,43,0.7);
}
.al-fill::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 40px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6));
}
.al-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border2); }
#archive-loader.complete .al-fill { background: var(--bright); box-shadow: 0 0 12px rgba(240,236,224,0.8); }
@keyframes al-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
#archive-loader.complete .al-status { animation: al-flash 0.5s 2; }
/* Initial state — gallery-header sits below the fixed archive-loader
   (loader is `position: fixed; top: 44px; height: 34px`, so the header
   needs 44 + 34 = 78px to clear it).
   Once the loader finishes its sequence and adds `.gone`, JS toggles
   `archive-loaded` on <main>, and we transition the header back UP to
   44px — matching the title position of every other gallery page
   (Evocation, Aetherz, etc.) where there's no loader.
   The swoop is the title moving up after the loader clears. */
.gallery-header {
  margin-top: 78px;
  transition: margin-top 700ms cubic-bezier(.22,.61,.36,1);
}
main.archive-loaded .gallery-header {
  margin-top: 44px;
}

