:root {
  --sans-font: 'Istok Web', sans-serif;
  font-family: var(--sans-font);
  --color-fg: #eeddcc;
  --color-bg: #000000;
  --color-fg-muted: color-mix(in oklch, var(--color-bg) 30%, var(--color-fg) 70%);
  --color-bg-muted: color-mix(in oklch, var(--color-bg) 70%, var(--color-fg) 30%);
}

h1 {
  font-size: 1.3em;
}

h2 {
  font-size: 1.2em;
}

h3 {
  font-size: 1.1em;
}

a {
  color: inherit;
  text-decoration-style: dotted;
  transition: color 200ms ease-in-out;
}

a:hover {
  color: oklch(from var(--color-fg) calc(l + 0.15) c h);
}

body {
  margin: auto;
  padding: 0.5em 0.5em 2em 0.5em;
  background-color: var(--color-bg);
  color: var(--color-fg);
}

nav {
  margin: auto;
  max-width: 100em;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0.5em -0.5em;
  padding: 0;
}

nav ul li a {
  padding: 0.5em;
  text-transform: lowercase;
}

main {
  margin: auto;
  display: block;
  max-width: 100em;
}

footer {
  text-align: center;
}

footer a {
  margin: 1em 0;
  padding: 0.5em;
  text-transform: lowercase;
}

article {
  padding: 1.5em 0;
  /* Establishes the query container for the photo grid below: .photos cannot
     query its own width, and an article is exactly as wide as its grid. */
  container-type: inline-size;
}

article:not(:last-child) {
  border-bottom: 1px dotted #80776e;
}

header {
  margin-bottom: 1em;
}

header h1 {
  margin: 0;
}

header h1 a:not(:hover) {
  text-decoration: none;
}

header .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5em;
  color: var(--color-fg-muted);
}

header .meta p {
  margin: 0;
}

/* tags + count travel together: grow to fill the row (count flush right via
   margin-left:auto), and wrap to a line of their own — leaving location • date
   above — when they can't fit beside it. */
header .meta .tagrow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5em;
  flex: 1 0 auto;
  max-width: 100%;
}

header .meta .count {
  margin-left: auto;
}

header .meta .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375em;
  list-style: none;
  padding: 0;
  margin: 0;
}

header .meta .tags a {
  background-color: var(--color-bg-muted);
  color: var(--color-fg-muted);
  border-radius: 0.25em;
  padding: 0.05em 0.5em;
  font-size: 0.875em;
  text-decoration: none;
  transition: all 200ms ease-in-out;
  transition-property: background-color, color;
}

header .meta .tags a:hover {
  background-color: oklch(from var(--color-bg-muted) calc(l + 0.15) c h);
  color: oklch(from var(--color-fg) calc(l + 0.15) c h);
}

header .meta .location::after {
  content: "•";
  margin-left: 0.5em;
}

header .meta .location svg {
  vertical-align: -0.125em;
}

/* Compact blog listing: dated rows, the date muted and fixed-width so titles
   align into a column. */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1em;
}

.post-list time {
  flex: 0 0 auto;
  color: var(--color-fg-muted);
  font-variant-numeric: tabular-nums;
}

/* Masonry without JS: the build precomputes a greedy shortest-column packing for
   both the 2- and 3-column layouts and emits each item's column + top offset as
   custom properties (cqw = width-relative, em = the fixed 0.5em gap term). Items
   are absolutely positioned; the @container query swaps layouts on the grid's own
   width. Column width and the per-column left step are constants derived from the
   column count, so only the per-item offsets need to be variables. */
.photos {
  position: relative;
  height: calc(var(--h2c) * 1cqw + var(--h2e) * 1em);
}

.photos a {
  position: absolute;
  width: calc((100cqw - 0.5em) / 2);
  left: calc(var(--col2) * (50cqw + 0.25em));
  top: calc(var(--t2c) * 1cqw + var(--t2e) * 1em);
}

@container (min-width: 53em) {
  .photos {
    height: calc(var(--h3c) * 1cqw + var(--h3e) * 1em);
  }
  .photos a {
    width: calc((100cqw - 1em) / 3);
    left: calc(var(--col3) * (33.3333cqw + 0.16667em));
    top: calc(var(--t3c) * 1cqw + var(--t3e) * 1em);
  }
}

.photos img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 200ms ease-in-out;
}

.photos a {
  border-radius: 0.25em;
  overflow: clip;
}

.photos .more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #eeddcc;
  font-size: 2em;
  font-weight: 700;
}

.photos a:hover img {
  transform: scale(1.02);
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.lightbox .track {
  display: flex;
  height: 100%;
  transition: transform 300ms ease;
}

.lightbox .slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.lightbox .slide img {
  max-width: 100vw;
  max-height: 100vh;
  cursor: zoom-in;
}

.lightbox .slide img.zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.lightbox button {
  position: fixed;
  z-index: 1;
  background: none;
  border: 0;
  color: #eeddcc;
  cursor: pointer;
  font-size: 3em;
  line-height: 1;
  padding: 0.2em 0.4em;
  transition: color 200ms ease-in-out;
}

.lightbox button[hidden] {
  display: none;
}

.lightbox button:hover {
  color: #ffffff;
}

.lightbox button.close {
  top: 0;
  right: 0;
}

.lightbox button.prev {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox button.next {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.lightbox-meta {
  padding: 0.4rem 1.25rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.4;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.lightbox-meta p {
  margin: 0.15rem 0;
}
.lightbox-meta .camera,
.lightbox-meta .lens,
.lightbox-meta .specs,
.lightbox-meta .when,
.lightbox-meta .place {
  opacity: 0.85;
}
/* The overlay is pointer-events:none so a tap on it reaches the backdrop and
   closes the lightbox; re-enable events on the place link so it stays clickable. */
.lightbox-meta a {
  pointer-events: auto;
}

/* Current post's title, shown just above the meta panel so all overlay text
   clusters at the bottom. */
.lightbox-title {
  padding: 0 1.25rem;
  color: #eeddcc;
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
.lightbox-title[hidden] {
  display: none;
}

#map {
  height: 100%;
  width: 100%;
  background: #262626;
}

/* Map page only: nav at top, map fills the rest of the viewport, no scroll.
   Scoped via :has so no other page is affected (.map-wrap is map-only). */
body:has(.map-wrap) {
  padding: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body:has(.map-wrap) nav {
  margin: 0;
  max-width: none;
  padding: 0.5em 0.5em 0;
}

body:has(.map-wrap) main {
  margin: 0;
  max-width: none;
  flex: 1;
  display: flex;
  min-height: 0;
}

body:has(.map-wrap) footer {
  display: none;
}

div.map-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-fg);
  border: 2px solid var(--color-bg);
  box-sizing: border-box;
}

.maplink {
  margin: 0 0 1em;
}

.map-wrap {
  position: relative;
  flex: 1;
}

#map-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 30vw;
  overflow-y: auto;
  z-index: 1100;
  background: var(--color-bg);
}

#map-panel[hidden] {
  display: none;
}

#map-panel ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5em;
  list-style: none;
  margin: 0;
  padding: 0;
  padding-right: 0.5em;
}

#map-panel img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.25em;
}

@media (max-width: 40em) {
  #map-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    height: 30vh;
    padding: 0.5em;
    overflow-y: hidden;
  }

  #map-panel ul {
    display: flex;
    height: 100%;
    overflow-x: auto;
    padding-right: 0;
    padding-top: 0.5em;
  }

  #map-panel li {
    flex: 0 0 auto;
    height: 100%;
  }

  #map-panel img {
    width: auto;
    height: 100%;
  }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
  margin: 2rem 0 0;
}
.pagination [aria-current="page"] {
  font-weight: 700;
}
