/* src/styles.css */
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  color: #fff;
  overflow-x: hidden;
  background: #080808;
  height: 100%;
}

#gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;
  gap: 3px;
  padding: 3px;
}

.cell {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: #111;
}

.cell:nth-child(7n+2) {
  grid-column: span 2;
  grid-row: span 2;
}

.cell:nth-child(11n+6) {
  grid-column: span 2;
}

.cell:nth-child(5n+4) {
  grid-row: span 2;
}

.cell img {
  object-fit: cover;
  display: block;
  opacity: 0;
  width: 100%;
  height: 100%;
  transition: opacity .35s;
}

.cell img.loaded {
  opacity: 1;
}

.cell:hover img {
  filter: brightness(.6);
  transition: filter .2s, opacity .35s;
}

#modal {
  display: none;
  position: fixed;
  z-index: 999;
  background: #000000f5;
  justify-content: center;
  align-items:  center;
  inset: 0;
}

#modal.open {
  display: flex;
}

#modal-img {
  object-fit: contain;
  display: block;
  max-width: 92vw;
  max-height: 92vh;
}

#modal-close {
  position: fixed;
  color: #fff;
  text-align: center;
  cursor: pointer;
  background: none;
  border: 1px solid #ffffff59;
  width: 2.5rem;
  height: 2.5rem;
  transition: background .15s;
  font: 1.4rem / 2.5rem monospace;
  top: 1.25rem;
  right: 1.5rem;
}

#modal-close:hover {
  background: #ffffff1f;
}

@media (width <= 900px) {
  #gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (width <= 600px) {
  #gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.page-center {
  display: flex;
  justify-content: center;
  align-items:  center;
  min-height: 100vh;
  font-family: monospace;
}

.box {
  display: flex;
  border: 1px solid #ffffff26;
  flex-direction: column;
  gap: 1rem;
  width: min(420px, 90vw);
  padding: 2rem;
}

.box h1 {
  letter-spacing: .15em;
  text-transform: uppercase;
  opacity: .5;
  font-size: .9rem;
}

input[type="file"] {
  color: #fff;
  font: inherit;
  cursor: pointer;
}

input[type="password"] {
  color: #fff;
  font: inherit;
  outline: none;
  background: none;
  border: 1px solid #ffffff40;
  width: 100%;
  padding: .5rem;
}

input[type="password"]:focus {
  border-color: #fff9;
}

.actions {
  display: flex;
  gap: .75rem;
}

.box button, .actions button {
  color: #fff;
  font: inherit;
  cursor: pointer;
  background: none;
  border: 1px solid #ffffff59;
  flex: 1;
  padding: .5rem 1rem;
  transition: background .15s;
}

.box button:hover, .actions button:hover {
  background: #ffffff14;
}

.err {
  color: #f66;
  font-size: .85rem;
}

.wrap {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: min(720px, 94vw);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
}

.thumb img {
  object-fit: cover;
  display: block;
  width: 100%;
  height: 100%;
}

.thumb button.del {
  position: absolute;
  color: #fff;
  cursor: pointer;
  background: #000000b3;
  border: 1px solid #fff6;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1;
  top: 4px;
  right: 4px;
}

.thumb button.del:hover {
  background: #a22;
}

#secret-modal {
  display: none;
  position: fixed;
  z-index: 10;
  background: #000000d9;
  justify-content: center;
  align-items:  center;
  inset: 0;
}

#secret-modal.open {
  display: flex;
}

#secret-modal .box {
  background: #0e0e0e;
}
