:root {
  --bg: #000;
  --fg: #fff;
  --muted: #666;
  --card: #222;
  --accent: #ffdd44;
  --border: #2c2c2a;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  display: flex;
  flex-flow: column;
  gap: 0.3125em;
  font-size: clamp(2rem, 5vw, 6rem);
  padding: 1em 1.5em 0.75em;
  text-align: center;
}

h1 {
  font-size: 1em;
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1;
}

h2 {
  font-size: 0.54em;
  font-weight: 100;
  line-height: 1;
}

.meta {
  color: var(--muted);
  font-size: clamp(0.75rem, 0.25em, 1.25rem);
}
/* --- gallery --- */

.progress {
  display: flex;
  flex-flow: column;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.25em;
  font-size: clamp(0.75rem, 0.25em, 1.25rem);
  color: var(--muted);
}

.progress[hidden] {
  display: none;
}

.progress progress {
  width: min(100%, 24rem);
  height: 0.375em;
  accent-color: var(--accent);
}

.progress-close {
  padding: 0.2em 0.8em;
  border: 1px solid currentColor;
  border-radius: 1em;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.progress-close:hover {
  color: var(--fg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(10rem, 33%, 20rem), 1fr));
  gap: 0.0625rem;
}

.grid a {
  display: block;
  aspect-ratio: 3 / 2;
  background: var(--card);
  overflow: hidden;
  position: relative;
}

@media (hover: hover) {
  .grid a:focus-visible::after {
    box-shadow: inset 0 0 0 clamp(0.25rem, 0.75vw, 0.5rem) hsl(from var(--accent) h s l / 0.9);
    content: '';
    position: absolute;
    inset: 0;
  }
}

.grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease, opacity .3s;
  opacity: 0;
}

.grid img.loaded {
  opacity: 1;
}

@media (hover: hover) {
  .grid a:hover img {
    transform: scale(1.05);
  }
}

/* --- admin folder list (/?list) --- */
.folder-list {
  list-style: none;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  max-width: 48rem;
}

.folder-list li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--card);
}

.folder-list a {
  color: var(--fg);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.folder-list a:hover,
.folder-list a:focus-visible {
  color: var(--accent);
}

.folder-meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.folder-meta .folder-action {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.folder-meta .folder-action:hover,
.folder-meta .folder-action:focus-visible {
  color: var(--fg);
}

.folder-meta .folder-remove:hover,
.folder-meta .folder-remove:focus-visible {
  color: #ff6b6b;
}

.folder-add {
  display: flex;
  gap: 0.5rem;
  margin: 0 auto;
  padding: 0 1.5rem 1rem;
  max-width: 48rem;
}

.folder-add input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card);
  color: var(--fg);
  font: inherit;
}

.folder-add input:focus-visible {
  border-color: var(--muted);
}

.folder-add input[aria-invalid="true"] {
  border-color: #ff6b6b;
}

.folder-add button {
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0.375rem;
  background: var(--accent);
  color: #000;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* list filter: title search and year pills (assets/admin.js) */
.folder-filter {
  margin: 0 auto;
  padding: 0 1.5rem 0.5rem;
  max-width: 48rem;
}

.folder-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card);
  color: var(--fg);
  font: inherit;
}

.folder-search:focus-visible {
  border-color: var(--muted);
}

.folder-years {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.625rem;
}

.folder-years button {
  padding: 0.125rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.folder-years button span {
  opacity: 0.7;
}

.folder-years button:hover,
.folder-years button:focus-visible {
  border-color: var(--muted);
  color: var(--fg);
}

.folder-years button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}

.folder-empty {
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  max-width: 48rem;
  color: var(--muted);
}

/* --- admin toolbar (gallery pages in admin mode) --- */
.admin-bar {
  padding: 0.375rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}

.admin-bar .admin-label {
  color: var(--accent);
  font-weight: 700;
}

.admin-bar a,
.admin-bar button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.admin-bar a:hover,
.admin-bar a:focus-visible,
.admin-bar button:hover,
.admin-bar button:focus-visible {
  color: var(--fg);
}

.admin-bar .folder-remove:hover,
.admin-bar .folder-remove:focus-visible {
  color: #ff6b6b;
}
