:root {
  color-scheme: dark;
  --bg: #222;
  --text: #eee;
  --muted: #bbb;
  --line: #3a3a3a;
  --panel: #2a2a2a;
  --max: 1200px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Libre Franklin", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.65;
}

img { max-width: 100%; }

a { color: #fff; }
a:visited { color: #fff; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: #fff;
  color: #111;
  padding: 0.4rem 0.7rem;
  z-index: 30;
}

.skip:focus { top: 0.5rem; }

.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin-inline: auto;
}

.site-header { position: relative; z-index: 5; background: #111; }

.header-photo {
  display: block;
  width: 100%;
  height: clamp(200px, 42vw, 460px);
  object-fit: cover;
  object-position: center 42%;
}

.header-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.6rem 0 0.9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.28) 72%, transparent);
}

.site-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.1;
  font-weight: 700;
}

.site-title a { color: #fff; text-decoration: none; }

.tagline { margin: 0.2rem 0 0.55rem; color: #ddd; }

.menu-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1.25rem;
}

.menu-bar nav {
  flex: 1 1 auto;
  min-width: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.2rem; }

main { padding: 1.6rem 0 3rem; }

.search {
  position: relative;
  z-index: 3;
  flex: 0 1 18rem;
  width: min(18rem, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 0 0 auto;
}

.search .pagefind-ui,
.search .pagefind-ui__form,
.search .pagefind-ui__search-input {
  max-width: 100%;
  min-width: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 0.4rem;
}

h2 { font-size: 1.45rem; line-height: 1.3; margin: 1.6rem 0 0.5rem; }
h3 { font-size: 1.15rem; margin: 1.3rem 0 0.4rem; }

.meta { color: var(--muted); margin: 0 0 1rem; }

.post-body a,
.page-body a,
.featured .more { text-underline-offset: 0.18rem; }

.post-body p,
.page-body p { margin: 0.8rem 0; }

.post-body ul,
.page-body ul { padding-left: 1.25rem; }

.post-body li,
.page-body li { margin: 0.25rem 0; }

.post-body img,
.page-body img,
.hero img {
  display: block;
  height: auto;
  margin: 1rem 0;
}

figure { margin: 1rem 0; }
figcaption { color: var(--muted); font-size: 0.92rem; }

.hero { margin: 0 0 1.2rem; }
.hero img { width: 100%; margin: 0; }

.featured { margin: 0 0 2rem; }
.featured img { width: 100%; height: auto; display: block; margin: 0 0 0.8rem; }
.featured h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin: 0.2rem 0; }
.featured h2 a { text-decoration: none; }
.featured h2 a:hover { text-decoration: underline; }
.featured .excerpt { margin: 0.4rem 0 0.6rem; }

.post-lines { list-style: none; margin: 0; padding: 0; }

.post-line { border-top: 1px solid var(--line); }
.post-line:last-child { border-bottom: 1px solid var(--line); }

.post-line a {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 0.35rem 1rem;
  align-items: center;
  padding: 0.75rem 0;
  color: inherit;
  text-decoration: none;
}

.post-line a:hover .line-title { text-decoration: underline; }

.post-line img,
.thumb-placeholder {
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: #111;
  margin: 0;
}

.line-title { font-weight: 600; }

.line-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.home-list .post-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0.75rem 1.25rem;
  align-items: start;
  padding: 1.15rem 0;
}

.home-list .post-line a {
  padding: 0;
  gap: 0;
  grid-template-columns: none;
}

.home-list .line-thumb { display: block; }

.home-list .post-line img,
.home-list .thumb-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
}

.home-list .line-title {
  display: block;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.home-list .line-title:hover { text-decoration: underline; }

.home-list .line-excerpt {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.home-list .line-more { margin: 0.15rem 0 0; }

.home-list .more {
  display: inline;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.post-line time { color: var(--muted); font-size: 0.92rem; white-space: nowrap; }

.home-list .post-line time { white-space: normal; font-size: 1rem; }

.kind {
  display: inline-block;
  margin-left: 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
}

.tags a {
  display: inline-block;
  border: 1px solid #555;
  padding: 0.12rem 0.55rem;
  text-decoration: none;
  font-size: 0.9rem;
}

.tags a:hover { background: #333; }

.pager,
.post-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.4rem;
  align-items: center;
  margin-top: 1.6rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 1rem 0 1.4rem;
}

.gallery a {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: #111;
}

.gallery img {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
}

.video {
  position: relative;
  margin: 1.2rem 0;
  aspect-ratio: 16 / 9;
  background: #111;
}

.video iframe { width: 100%; height: 100%; border: 0; }

.download-link {
  display: inline-block;
  margin: 0.4rem 0;
  padding: 0.55rem 1rem;
  background: #fff;
  color: #222;
  font-weight: 700;
  text-decoration: none;
}

.download-link:visited { color: #222; }
.download-link:hover { background: #ddd; }

.missing-file {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid #665;
}

.social { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.social li { margin: 0.7rem 0; }
.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}
.social a:hover span { text-decoration: underline; }
.social img {
  width: 40px;
  height: 40px;
  margin: 0;
  flex: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2rem;
  color: var(--muted);
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
}

.footer-copy { margin: 0; }

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-social a { display: flex; line-height: 0; }

.footer-social img {
  width: 40px;
  height: 40px;
  margin: 0;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  padding: 3rem 0.4rem 1rem;
  background: rgba(0, 0, 0, 0.9);
}

.lightbox[hidden] { display: none; }

.lightbox figure { margin: 0; text-align: center; }

.lightbox img {
  max-width: min(960px, 100%);
  max-height: 82vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.lightbox figcaption { margin-top: 0.45rem; color: #ddd; }

.lightbox button {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.lightbox button:disabled { opacity: 0.35; cursor: default; }

.lightbox-nav {
  width: 44px;
  height: 64px;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
}

body.lightbox-open { overflow: hidden; }

.pagefind-ui__form { position: relative; }

.search .pagefind-ui__drawer {
  position: absolute;
  z-index: 6;
  top: calc(100% + 0.4rem);
  right: 0;
  left: auto;
  width: max(100%, min(32rem, calc(100vw - 2rem)));
  max-height: min(70vh, 32rem);
  overflow: auto;
  margin: 0;
  padding: 0.35rem 0.9rem 0.55rem;
  background: var(--panel);
  color: var(--text);
  --pagefind-ui-text: #fff;
  border: 1px solid #555;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.search .pagefind-ui__drawer .pagefind-ui__results-area {
  min-width: 0;
  width: 100%;
  margin-top: 0;
}

.search .pagefind-ui__drawer .pagefind-ui__result {
  padding: 0.75rem 0;
}

.search .pagefind-ui__drawer .pagefind-ui__result-excerpt {
  color: #ccc;
}

.pagefind-ui__search-input {
  width: 100%;
  background: #111;
  color: #eee;
  border: 1px solid #555;
  border-radius: 0;
  font: inherit;
  padding: 0.55rem 0.7rem;
}
.pagefind-ui__search-clear { background: transparent; color: #eee; }
.pagefind-ui__result { border-color: #444; }
.pagefind-ui__result-title,
.pagefind-ui__result-link { color: #fff; }
.pagefind-ui__result-excerpt { color: #ccc; }
.pagefind-ui__message { color: #bbb; }

@media (max-width: 760px) {
  .menu-bar nav { flex-basis: 100%; }
  .search {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .post-line a { grid-template-columns: 64px minmax(0, 1fr); }
  .post-line time { grid-column: 2; }
  .post-line img,
  .thumb-placeholder { width: 64px; height: 64px; }
  .home-list .post-line { grid-template-columns: minmax(0, 1fr); }
  .home-list .post-line a { grid-template-columns: none; }
  .home-list .post-line time { grid-column: auto; }
  .home-list .post-line img,
  .home-list .thumb-placeholder { width: 100%; height: auto; aspect-ratio: 3 / 2; }
  .header-panel { padding-top: 1.6rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .lightbox { grid-template-columns: 44px minmax(0, 1fr) 44px; padding-top: 3.2rem; }
  .lightbox img { max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
