/* The gallery: dark (the photos stand out), rows of photos like Flickr (pure CSS),
   phone first - three row heights by the screen. */
:root {
  --bg: #0c0c0d;
  --panel: #151517;
  --fg: #f1efea;
  --muted: #9a978f;
  --line: #262628;
  --accent: #e7c27d;
  --row: 300px;
  --gap: 6px;
  --side: clamp(12px, 3vw, 40px);
  --radius: 6px;
}
@media (max-width: 900px) { :root { --row: 220px; } }
@media (max-width: 600px) { :root { --row: 150px; --gap: 3px; --radius: 3px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
main { flex: 1; width: 100%; }

/* --- the bar on top ------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) var(--side) 12px;
  background: rgba(12, 12, 13, .78);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { font-size: 1.05rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.top nav { display: flex; gap: 4px; }
.top nav a {
  padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: .95rem;
  transition: color .2s, background .2s;
}
.top nav a:hover { color: var(--fg); }
.top nav a.on { color: var(--fg); background: rgba(255, 255, 255, .08); }

/* --- headings ------------------------------------------------------------------------- */
.hero { padding: clamp(28px, 6vw, 72px) var(--side) clamp(16px, 3vw, 28px); max-width: 1100px; }
.hero h1 {
  margin: 0; font-size: clamp(2rem, 6vw, 3.6rem); font-weight: 300; letter-spacing: -.02em;
  line-height: 1.1;
}
.lead { margin: 14px 0 0; color: #d6d3cc; font-size: clamp(1rem, 2.2vw, 1.2rem); max-width: 60ch; }
.count { margin: 10px 0 0; color: var(--muted); font-size: .9rem; letter-spacing: .04em; }
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: .9rem; }
.back:hover { color: var(--fg); }
.empty { padding: 0 var(--side); color: var(--muted); }

/* --- genres --------------------------------------------------------------------------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--side) 18px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 15px; border-radius: 999px; font-size: .9rem; white-space: nowrap;
  border: 1px solid var(--line); color: #cfccc5; transition: all .2s;
}
.chip:hover { border-color: #46464a; color: var(--fg); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #17140e; font-weight: 600; }

/* --- rows of photos: each grows by its aspect ratio; the last row does not stretch ------ */
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); padding: 0 var(--side); }
.grid::after { content: ""; flex-grow: 999999; }
.tile {
  position: relative; overflow: hidden; border-radius: var(--radius); background: var(--panel);
  flex-grow: calc(var(--w) / var(--h));
  width: calc(var(--w) / var(--h) * var(--row));
}
.tile i { display: block; padding-bottom: calc(var(--h) / var(--w) * 100%); }
.tile img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .3s;
}
.tile:hover img { transform: scale(1.035); }
.tile-title {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 12px 10px;
  font-size: .85rem; background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  opacity: 0; transition: opacity .25s;
}
.tile:hover .tile-title { opacity: 1; }
@media (hover: none) { .tile-title { display: none; } }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.more {
  display: block; width: fit-content; margin: 28px auto; padding: 10px 22px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}
.more:hover { color: var(--fg); border-color: #46464a; }
.more.loading { opacity: .5; pointer-events: none; }

/* --- albums --------------------------------------------------------------------------- */
.cards {
  display: grid; gap: clamp(14px, 2.5vw, 28px); padding: 0 var(--side);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.card { display: flex; flex-direction: column; gap: 12px; }
.card-img {
  display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 14px; background: var(--panel);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card-img img { transform: scale(1.04); }
.card-text { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.card-text strong { font-size: 1.15rem; font-weight: 500; }
.card-desc {
  color: #c9c6bf; font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-count { color: var(--muted); font-size: .82rem; letter-spacing: .03em; }

/* --- one photo (its own page) --------------------------------------------------------- */
.single { padding: 20px var(--side) 0; }
.single figure { margin: 0; display: flex; justify-content: center; }
.single figure img {
  max-width: 100%; max-height: calc(100vh - 160px); width: auto; height: auto; border-radius: var(--radius);
}
.pager { display: flex; justify-content: space-between; align-items: center; margin: 16px auto 0; max-width: 1100px; }
.pager .back { margin: 0; }
.pager span { display: flex; gap: 8px; }
.pager span a {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); font-size: 1.6rem; line-height: 1;
}
.pager span a:hover { background: rgba(255, 255, 255, .14); }
.about { max-width: 1100px; margin: 18px auto 0; }
.about h1 { margin: 0; font-weight: 400; font-size: clamp(1.4rem, 3.5vw, 2rem); }
.exif { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 18px 0; font-size: .92rem; }
.exif dt { color: var(--muted); }
.exif dd { margin: 0; }
.button {
  display: inline-block; padding: 10px 20px; border-radius: 999px; font-size: .92rem;
  background: var(--fg); color: #111; font-weight: 600;
}
.button:hover { background: #fff; }
.message { text-align: left; }
.message .button { margin-top: 24px; }

.foot {
  padding: 48px var(--side) calc(28px + env(safe-area-inset-bottom));
  color: #57554f; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
}

/* --- the lightbox (gallery.js) -------------------------------------------------------- */
body.lb-open { overflow: hidden; }
.lb {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: #060607; color: var(--fg);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.lb.open { display: block; animation: lb-in .2s ease-out; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.lb-stage img {
  max-width: 100vw; max-height: 100vh; width: auto; height: auto; object-fit: contain;
  transition: transform .25s ease-out, opacity .2s;
}
.lb-stage img.loading { opacity: .35; }
.lb-bar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 4; display: flex; align-items: center; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent);
}
.lb-count { flex: 1; color: #bdb9b1; font-size: .9rem; padding-left: 6px; font-variant-numeric: tabular-nums; }
.lb button, .lb a.lb-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 999px;
  background: rgba(18, 18, 20, .55); color: var(--fg); font-size: 1.15rem; cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lb button:hover, .lb a.lb-btn:hover { background: rgba(60, 60, 64, .75); }
.lb button[aria-pressed="true"] { background: var(--accent); color: #17140e; }
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 52px !important; height: 52px !important; font-size: 1.8rem !important;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
@media (hover: none) { .lb-prev, .lb-next { display: none !important; } }
.lb-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; text-align: center;
  padding: 40px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .6)); font-size: .95rem;
}
.lb-caption:empty { display: none; }
.lb-caption small { display: block; color: #c4c0b8; margin-top: 2px; }
.lb-info {
  position: absolute; z-index: 3; top: 0; right: 0; bottom: 0; width: min(340px, 100%);
  padding: calc(72px + env(safe-area-inset-top)) 22px 22px;
  background: rgba(21, 21, 23, .96); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .25s ease-out; overflow-y: auto;
}
.lb.info .lb-info { transform: none; }
.lb-info h2 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 500; }
.lb-info p { margin: 0 0 14px; color: #cfcbc3; font-size: .92rem; }
@media (max-width: 600px) {
  .lb-info {
    top: auto; left: 0; width: 100%; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
