/* blog.ocnr.org — no frameworks, no external requests */

:root {
  --bg: #fdfdfd;
  --fg: #1a1a1a;
  --muted: #667;
  --line: #e3e3e0;
  --accent: #0a5bd3;
  --chip-bg: #eeeeea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --fg: #e8e8e6;
    --muted: #9aa0a6;
    --line: #2a2d30;
    --accent: #6ea8ff;
    --chip-bg: #24272a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.75em;
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
  border-bottom: 3px solid var(--fg);
}

.site-title {
  font: 700 1.6rem Georgia, "Iowan Old Style", serif;
  color: var(--fg);
  text-decoration: none;
}

.site-tagline { color: var(--muted); font-size: 0.95rem; }

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

a { color: var(--accent); }
a.more { white-space: nowrap; }

h1, h2 { line-height: 1.25; }
h1 { font: 700 1.9rem Georgia, "Iowan Old Style", serif; margin: 0.2rem 0 0.4rem; }
h2 { font: 700 1.35rem Georgia, "Iowan Old Style", serif; margin: 0; }

.teaser { padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
.teaser h2 a { color: var(--fg); text-decoration: none; }
.teaser h2 a:hover { color: var(--accent); }
.excerpt { margin-bottom: 0; }

.meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.2rem 0 0.9rem;
}

.chip {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

a.chip:hover { background: var(--accent); color: var(--bg); }
a.chip.active { background: var(--accent); color: var(--bg); }

.filter-bar {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-bar[hidden] { display: none; }

.filter-chip { text-transform: none; letter-spacing: normal; font-size: 0.9rem; }

.filter-chip::before {
  content: "#";
  color: var(--accent);
  margin-right: 0.05em;
}

.chip-clear { margin-left: auto; }

.teaser.off { display: none; }

.breadcrumb { margin: 0 0 1.5rem; font-size: 0.9rem; }

/* gallery: justified rows — items grow in proportion to their aspect ratio
   (width_i = k * ar_i), so every image in a row gets the same height and
   each row fills edge-to-edge without holes or cropping */
.gallery {
  --row-h: 11rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.thumb {
  flex: var(--ar) 1 calc(var(--ar) * var(--row-h));
  max-width: calc(var(--row-h) * var(--ar) * 1.9);
  aspect-ratio: var(--ar);
  overflow: hidden;
  border-radius: 4px;
  background: var(--chip-bg);
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.15s;
}

.thumb:hover img { opacity: 0.82; }

@media (max-width: 40rem) {
  .gallery { --row-h: 8rem; }
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  background: rgba(8, 8, 8, 0.94);
}

.lightbox.open { display: flex; }

.lightbox img {
  margin: auto;
  max-width: 100vw;
  max-height: calc(100vh - 6.5rem);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox .caption {
  padding: 0 3.5rem 1.1rem;
  text-align: center;
  color: #ddd;
  font-size: 0.95rem;
  min-height: 1.5em;
}

.lightbox .counter {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  color: #999;
  font-size: 0.85rem;
}

.lightbox button {
  position: absolute;
  border: 0;
  background: none;
  color: #ccc;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.75rem;
  line-height: 1;
}

.lightbox button:hover, .lightbox button:focus-visible { color: #fff; }
.lightbox .close { top: 0.75rem; right: 0.9rem; }
.lightbox .prev, .lightbox .next { top: 50%; transform: translateY(-50%); }
.lightbox .prev { left: 0.35rem; }
.lightbox .next { right: 0.35rem; }

.lightbox svg { width: 2.2rem; height: 2.2rem; display: block; }

@media (max-width: 40rem) {
  .lightbox .prev, .lightbox .next { display: none; } /* swipe instead */
}

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