/* Shared styles for the gallery, popular and favorites pages. */

/* ---- colours: change these to restyle everything ---- */
:root {
  --green: rgb(46, 204, 113);     /* bright text */
  --green-dim: rgb(20, 100, 50);  /* faint text, borders */
  --red: rgb(231, 76, 60);        /* errors */
  --yellow: rgb(241, 196, 15);    /* favourites */
  --bg: #000;
  --tile: 140px;                  /* minimum avatar size; columns = window width / this */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--green);
  font-family: monospace;
  min-height: 100vh;
  padding: 2rem 2rem 4rem;
}
::selection { background: var(--green); color: #000; }

.ascii {
  font-size: 11px;
  line-height: 1.2;
  white-space: pre;
  text-shadow: 0 0 5px #000, 0 0 8px var(--green), 0 0 20px rgb(20, 140, 70);
  margin-bottom: .5rem;
}

/* logo + subtitle block, as wide as the ASCII art so the subtitle centres under it */
.logo { display: block; width: fit-content; max-width: 100%; color: inherit; text-decoration: none; }

/* logo on the left; page links bottom right, level with the subtitle */
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0 1rem; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-bottom: 1rem; /* same as .subtitle, so they sit on one line */ }
.nav-link {
  flex-shrink: 0;
  color: var(--green);
  font-size: 13px;
  letter-spacing: 1px;
  text-decoration: none;
  text-shadow: 0 0 6px var(--green-dim);
}
.nav-link:hover, .nav-link:focus-visible { outline: none; text-shadow: 0 0 8px var(--green); }

/* text under the logo */
.subtitle {
  text-align: center;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--green);
  text-shadow: 0 0 6px var(--green-dim);
  margin-bottom: 1rem;
}

/* full-width divider, same as the table header line in 666.html */
.divider {
  border: 0;
  border-bottom: 1px solid rgb(20, 80, 40);
  margin-bottom: .75rem;
}

.stats {
  font-size: 12px;
  color: var(--green-dim);
  letter-spacing: 1px;
  min-height: 1.5em;
}
.stats b {
  font-weight: normal;
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

/* errors: same red as "DOWN" in 666.html */
.err {
  display: inline-block;
  color: var(--red);
  text-shadow: 0 0 6px var(--red);
  border: 1px solid var(--red);
  background: rgba(231, 76, 60, .08);
  padding: .35rem .75rem;
  font-size: 13px;
  letter-spacing: 1px;
}

/* avatar grid */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); /* replaced by JS with an exact column count */
  gap: 8px;
}
#grid a {
  display: block;
  aspect-ratio: 1;
  border: 1px solid var(--green-dim);
  background: #031208;
  overflow: hidden;
}
#grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#grid a:hover { border-color: var(--green); box-shadow: 0 0 10px var(--green); }

.controls { margin: 1.25rem 0; text-align: center; }
button {
  background: none;
  border: 1px solid var(--green-dim);
  color: var(--green);
  font: 14px monospace;
  padding: .6rem 1.4rem;
  cursor: pointer;
  text-shadow: 0 0 6px var(--green-dim);
}
button:hover { border-color: var(--green); box-shadow: 0 0 10px var(--green-dim); background: rgba(46, 204, 113, .06); }


/* content warning shown on first visit */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.overlay[hidden] { display: none; }
.warn-box {
  max-width: 560px;
  width: 100%;
  border: 1px solid var(--green-dim);
  background: #000;
  padding: 1.5rem 1.75rem;
  font-size: 13px;
  line-height: 1.7;
}
.warn-title {
  color: var(--red);
  font-weight: bold;
  font-size: 17px;
  text-align: center;
  text-shadow: 0 0 6px var(--red);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.warn-box p { margin-bottom: .9rem; }
.warn-box ul { list-style: none; margin: 0 0 .9rem; color: var(--green); }
.warn-box li::before { content: "- "; color: var(--green); }
.warn-box .dim { color: var(--green-dim); }
button:focus-visible { outline: 1px solid var(--green); outline-offset: 2px; }
.warn-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.25rem; }

/* ---- favourite star on tiles ---- */
.tile { position: relative; }
.tile.is-fav::after {
  content: "★";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 15px;
  color: var(--yellow);
  text-shadow: 0 0 4px #000, 0 0 6px #000;
  pointer-events: none;
}

/* ---- leaderboard labels (popular page) ---- */
.tile .label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: .2rem .4rem;
  font-size: 11px;
  background: rgba(0, 0, 0, .78);
  color: var(--green);
  pointer-events: none;
}
.tile .label .rank { color: var(--green-dim); }

/* ---- picture viewer ---- */
.viewer .v-box {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--green-dim);
  background: #000;
  padding: 1rem 1.25rem 1.25rem;
  font-size: 13px;
}
.v-top { display: flex; justify-content: space-between; align-items: center; color: var(--green-dim); margin-bottom: .75rem; letter-spacing: 1px; }
.v-stage { display: flex; align-items: center; justify-content: center; gap: .75rem; }
.v-img {
  width: min(368px, 62vw, 55vh);
  aspect-ratio: 1;
  border: 1px solid var(--green-dim);
  background: #031208;
  display: block;
}
.v-img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.v-info { text-align: center; color: var(--green-dim); margin: .75rem 0; letter-spacing: 1px; min-height: 1.4em; }
.v-info b { font-weight: normal; color: var(--green); }
.v-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; }
/* viewer controls: plain [ text ] links, like the page links in the header */
.v-link,
.v-link:hover {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  font: 13px monospace;
  letter-spacing: 1px;
  color: var(--green);
  text-decoration: none;
  text-shadow: 0 0 6px var(--green-dim);
  cursor: pointer;
}
.v-link:hover, .v-link:focus-visible { outline: none; text-shadow: 0 0 8px var(--green); }
.v-link:disabled { color: var(--green-dim); text-decoration: none; text-shadow: none; cursor: default; }
.v-stage .v-link { font-size: 15px; }
.v-fav.on { color: var(--yellow); text-shadow: 0 0 6px var(--yellow); }
.v-report { color: var(--red); text-shadow: 0 0 6px rgba(231, 76, 60, .5); }
.v-report:hover, .v-report:focus-visible { color: var(--red); text-shadow: 0 0 8px var(--red); }
.v-report:disabled { color: rgba(231, 76, 60, .55); text-shadow: none; }

.empty { color: var(--green-dim); font-size: 13px; letter-spacing: 1px; line-height: 1.8; margin-top: 1rem; }
