*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --muted: #888;
  --border: #e0ddd8;
  --accent: #7a6a5a;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.6;
}

/* ── Header ── */
header {
  padding: 2.5rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  font-size: 1.6rem;
  font-weight: normal;
  letter-spacing: 0.04em;
}

header h1 a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

nav {
  display: flex;
  gap: 1.75rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}

nav a:hover,
nav a.active {
  color: var(--text);
}

/* ── Main layout ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ── Gallery masonry ── */
.gallery {
  columns: 3 280px;
  column-gap: 1.25rem;
}

.gallery-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--border);
  border-radius: .6em;
}

.avail-label {
  position: absolute;
  bottom: 0.45rem;
  right: 0.45rem;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  pointer-events: none;
  font-family: Georgia, 'Times New Roman', serif;
}

.avail-label.available {
  background: rgba(74, 140, 74, 0.82);
  color: #fff;
}

.avail-label.unavailable {
  background: rgba(30, 30, 30, 0.52);
  color: #ddd;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity 0.3s;
}

.gallery-item img:hover {
  opacity: 0.92;
}

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 100;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#lightbox.open {
  display: flex;
}

#lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 4px 40px rgba(0,0,0,0.6);
}

#lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  background: none;
  border: none;
}

#lightbox-close:hover {
  opacity: 1;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 4rem 0;
  font-size: 1rem;
}

/* ── About page ── */
.about-content {
  max-width: 640px;
  margin: 0 auto;
}

.about-content h2 {
  font-size: 1.3rem;
  font-weight: normal;
  margin-bottom: 1.25rem;
  color: var(--accent);
}

.about-content p {
  margin-bottom: 1.25rem;
  color: #333;
}

/* ── Upload page ── */
.upload-form {
  max-width: 480px;
  margin: 0 auto;
}

.upload-form h2 {
  font-size: 1.2rem;
  font-weight: normal;
  margin-bottom: 2rem;
  color: var(--accent);
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.toggle-group {
  display: flex;
  border: 1px solid var(--border);
  overflow: hidden;
}

.toggle-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  margin-bottom: 0;
}

.toggle-group label:not(:last-child) {
  border-right: 1px solid var(--border);
}

.toggle-group input[type="radio"] {
  display: none;
}

.toggle-group label:has(input:checked) {
  background: var(--accent);
  color: #fff;
}

.field input[type="password"],
.field input[type="file"],
.field input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  appearance: none;
  border-radius: 0;
}

.field input[type="file"] {
  padding: 0.5rem;
  cursor: pointer;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.95rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  width: 100%;
  margin-top: 0.5rem;
  transition: background 0.2s;
}

.btn:hover {
  background: #5e5047;
}

.message {
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  border-left: 3px solid;
}

.message.success {
  background: #f0f7f0;
  border-color: #6aaa6a;
  color: #3a6e3a;
}

.message.error {
  background: #fdf0f0;
  border-color: #cc6666;
  color: #8a2a2a;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  header {
    padding: 1.5rem 1rem 1rem;
  }

  header h1 {
    font-size: 1.3rem;
  }

  .site-logo {
    height: 1.3rem;
    max-width: 80px;
  }

  nav {
    gap: 1.25rem;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .gallery {
    columns: 2 140px;
    column-gap: 0.75rem;
  }

  .gallery-item {
    margin-bottom: 0.75rem;
  }
}
