:root {
  --bg: #faf8f3;
  --ink: #1a1816;
  --muted: #6b6660;
  --rule: #e6e0d6;
  --gap: 14px;
  --radius: 2px;
  --max: 1400px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-serif, Georgia, "Iowan Old Style", "Charter", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px 24px 18px;
  border-bottom: 1px solid var(--rule);
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: 0.005em;
  margin: 0 0 22px;
}

nav#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
  color: var(--muted);
}
nav#filters button {
  background: none;
  border: 0;
  padding: 4px 0;
  margin: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
nav#filters button:hover { color: var(--ink); }
nav#filters button.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

main#album {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 72px;
}

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

.tile {
  display: block;
  position: relative;
  background: var(--rule);
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: var(--ar, 1);
  transition: opacity .2s ease;
  text-decoration: none;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  header { padding: 22px 16px 14px; }
  main#album { padding: 18px 16px 48px; }
}

/* image page */
body.image-page header {
  padding: 16px 24px;
}
body.image-page #back {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
body.image-page #back:hover { color: var(--ink); }

#image-view {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#image-view .image-wrap {
  display: flex;
  justify-content: center;
}
#image-view img.art {
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  width: auto;
  border-radius: var(--radius);
}
#image-view .meta {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}
#image-view .meta .title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
  margin-right: auto;
}
#image-view .nav-arrows {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}
#image-view .nav-arrows a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
}
#image-view .nav-arrows a:hover { color: var(--ink); }
#image-view .nav-arrows a.disabled {
  visibility: hidden;
}

@media (max-width: 600px) {
  body.image-page header { padding: 12px 16px; }
  #image-view { padding: 16px; gap: 12px; }
  #image-view img.art { max-height: 70vh; }
}
