/* Goodgallery 2.0 default stylesheet — dark, dense, mobile-first.
   Place a `goodgallery.css` in the gallery root to override (TODO: wire up). */

:root {
  --bg: #0a0a0a;
  --fg: #cfcfcf;
  --muted: #888;
  --accent: #fff;
  --thumb-pad: 2px;
  --thumb-bg: #000;
  --border: #2a2a2a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }

img { border: 0; max-width: 100%; height: auto; vertical-align: middle; }

button {
  background: #000;
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 3px;
  min-width: 64px;
  min-height: 36px;
}
button:hover { background: var(--fg); color: #000; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10,10,10,0.96);
  backdrop-filter: blur(6px);
  z-index: 10;
}
#breadcrumb {
  flex: 1;
  font-size: 14px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}
#breadcrumb a { padding: 2px 4px; }
#breadcrumb a:not(:last-child)::after { content: '›'; padding-left: 8px; color: var(--muted); }
#adminlink { font-size: 18px; padding: 4px 8px; opacity: 0.6; }
#adminlink:hover { opacity: 1; }

#adminnotify {
  padding: 8px 14px;
  background: #1a1a1a;
  border-bottom: 1px solid var(--border);
  display: none;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
#adminnotify.on { display: flex; }

#folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
}
#folders .folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 8px;
  background: #141414;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  word-break: break-word;
  min-height: 100px;
  transition: background .15s;
}
#folders .folder:hover { background: #1c1c1c; color: var(--accent); }
#folders .folder-icon { font-size: 32px; line-height: 1; }
#folders .folder-name { margin-top: 6px; font-size: 13px; }

#prevnext {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px;
}
#prevnext a {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
}
#prevnext a:hover { color: var(--accent); }

#counter { text-align: center; padding: 4px; font-size: 12px; color: var(--muted); }
#realtime {
  text-align: center;
  padding: 8px 12px;
  color: var(--accent);
  font-size: 13px;
  min-height: 0;
}
#realtime:empty { padding: 0; }

#thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}
#thumbs a {
  background: var(--thumb-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--thumb-pad);
  border-radius: 2px;
}
#thumbs a:hover img { opacity: 0.8; }
#thumbs img {
  display: block;
  height: 120px;       /* fixed display height -> uniform rows */
  width: auto;         /* width follows aspect ratio */
  max-width: 320px;    /* sanity cap for ultra-wide panoramas */
}

#preloader { display: none; }

#photodiv { padding: 12px 8px; text-align: center; }
#photospot { display: inline-block; cursor: zoom-in; }
#photospot img { max-height: 92vh; max-width: 100%; }
#photodiv.fullres #photospot { cursor: zoom-out; }
#photodiv.fullres #photospot img { max-height: none; max-width: none; }

#login { padding: 14px; text-align: center; }
#login form { display: inline-flex; gap: 8px; }
#login input[type="password"] {
  background: #000; color: var(--fg); border: 1px solid var(--fg);
  padding: 6px 10px; font: inherit;
}

#bottomlink {
  text-align: center;
  padding: 18px 8px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  margin-top: 24px;
}
#bottomlink a { color: var(--muted); }
#bottomlink a:hover { color: var(--accent); }

/* mobile */
@media (max-width: 700px) {
  #folders { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); padding: 8px; }
  #thumbs img { height: 90px; max-width: 220px; }
  #prevnext button { min-width: 88px; }
  #photospot img { max-height: 78vh; }
}

/* Variable-width sprite thumbs (CSS-sliced from a single atlas JPEG) */
#thumbs .sprite-thumb {
  border-radius: 2px;
  background-color: var(--thumb-bg);
  background-repeat: no-repeat;
  margin: 1px;
  transition: opacity .12s, transform .12s;
}
#thumbs .sprite-thumb:hover { opacity: 0.85; transform: scale(1.04); }
