:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-soft: #eef2ed;
  --ink: #1f2522;
  --muted: #667068;
  --line: #d9dfd8;
  --line-strong: #b8c2b7;
  --green: #2f6655;
  --claret: #8b2635;
  --brass: #b88727;
  --shadow: 0 18px 60px rgb(31 37 34 / 10%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.55;
}

body.has-modal {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  font-size: 16px;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--claret);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgb(245 246 242 / 92%);
  backdrop-filter: blur(16px);
  overflow-anchor: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
  will-change: transform;
}

.site-header__inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 0 18px;
  transition: padding 180ms ease;
}

.header-spacer {
  height: var(--header-spacer-height, 286px);
  overflow-anchor: none;
}

.eyebrow {
  max-height: 24px;
  margin: 0 0 6px;
  overflow: hidden;
  color: var(--claret);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  transition: max-height 180ms ease, margin 180ms ease, opacity 160ms ease, transform 180ms ease;
}

.site-title-row {
  max-height: 260px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  transition: max-height 220ms ease, opacity 160ms ease, transform 220ms ease;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-size: 3.8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.archive-stats {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 210px) 44px;
  gap: 10px;
  margin-top: 22px;
  transition: margin 180ms ease;
}

.site-header.is-condensed {
  background: rgb(245 246 242 / 96%);
  box-shadow: 0 12px 42px rgb(31 37 34 / 10%);
}

.site-header.is-condensed .site-header__inner {
  padding: calc(10px + env(safe-area-inset-top, 0px)) 0 10px;
}

.site-header.is-condensed .eyebrow,
.site-header.is-condensed .site-title-row {
  max-height: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.site-header.is-condensed .toolbar {
  margin-top: 0;
}

.site-header.is-condensed.is-toolbar-hidden {
  box-shadow: none;
  pointer-events: none;
  transform: translateY(calc(-100% - 2px));
}

.search-field,
.select-field {
  min-width: 0;
}

.search-field input,
.select-field select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.search-field input {
  padding: 0 16px;
}

.select-field select {
  padding: 0 38px 0 14px;
}

.search-field input:focus,
.select-field select:focus,
.header-link-button:focus-visible,
.intro-popup__close:focus-visible,
.intro-popup__accept:focus-visible,
.icon-button:focus-visible,
.load-more:focus-visible,
.image-button:focus-visible,
.lightbox__button:focus-visible {
  border-color: var(--green);
  outline: 3px solid rgb(47 102 85 / 18%);
  outline-offset: 1px;
}

.icon-button,
.lightbox__button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.icon-button {
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}

.header-link-button {
  min-height: 36px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
}

.header-link-button:hover {
  border-bottom-color: var(--green);
  color: var(--claret);
}

.archive-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.timeline-shell {
  position: relative;
}

.timeline {
  --entry-gap: 28px;
  display: block;
}

.timeline-spacer {
  pointer-events: none;
}

.entry + .entry {
  margin-top: var(--entry-gap);
}

.entry {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.entry__header {
  position: sticky;
  top: 180px;
  align-self: start;
}

.entry__date {
  display: block;
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 800;
}

.entry__id {
  margin: 6px 0 0;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-size: 1.65rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.entry__meta span {
  border-bottom: 2px solid var(--surface-soft);
}

.entry__lead {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.entry__content {
  min-width: 0;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.image-button {
  position: relative;
  display: block;
  width: 100%;
  min-height: 160px;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202521;
}

.image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 180ms ease, opacity 180ms ease;
}

.image-button:hover img {
  transform: scale(1.02);
}

.image-button::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgb(255 255 255 / 92%);
  color: var(--ink);
  content: "+";
  font-weight: 900;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.image-button:hover::after,
.image-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 22px;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
}

.attachment-link:hover {
  border-color: var(--brass);
  color: var(--claret);
}

.markdown-slot {
  min-height: 72px;
}

.markdown-loading,
.markdown-error {
  margin: 0;
  padding: 16px 18px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
}

.markdown-error {
  color: var(--claret);
}

.markdown {
  max-width: 78ch;
  color: var(--ink);
}

.markdown > *:first-child {
  margin-top: 0;
}

.markdown > *:last-child {
  margin-bottom: 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 1.35em 0 0.55em;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  line-height: 1.12;
  letter-spacing: 0;
}

.markdown h1 {
  font-size: 2rem;
}

.markdown h2 {
  font-size: 1.7rem;
}

.markdown h3 {
  font-size: 1.42rem;
}

.markdown h4,
.markdown h5,
.markdown h6 {
  font-size: 1.12rem;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre,
.markdown table {
  margin: 0 0 1rem;
}

.markdown ul,
.markdown ol {
  padding-left: 1.45rem;
}

.markdown li + li {
  margin-top: 0.36rem;
}

.markdown blockquote {
  padding: 14px 18px;
  border-left: 4px solid var(--brass);
  border-radius: 0 8px 8px 0;
  background: var(--surface-soft);
  color: #38413b;
}

.markdown code {
  padding: 0.12em 0.32em;
  border-radius: 4px;
  background: #edf0ec;
  color: #23342f;
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 0.92em;
}

.markdown pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 8px;
  background: #202521;
  color: #f3f7f0;
}

.markdown pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown .table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0 0 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.markdown table {
  width: 100%;
  min-width: 560px;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.markdown th,
.markdown td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown th {
  background: var(--surface-soft);
  color: var(--green);
  font-weight: 800;
}

.markdown tr:last-child td {
  border-bottom: 0;
}

.markdown hr {
  height: 1px;
  margin: 28px 0;
  border: 0;
  background: var(--line);
}

.empty-state,
.end-note {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 42px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgb(255 255 255 / 62%);
}

.sentinel {
  height: 1px;
}

.load-row {
  display: grid;
  place-items: center;
  gap: 10px;
  margin-top: 30px;
}

.load-more {
  min-width: 190px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.load-more:hover {
  background: #244f42;
}

.end-note {
  min-height: 1.4em;
  margin: 0;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgb(18 21 19 / 94%);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__bar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(92px, auto) 44px 44px 54px 44px 44px;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgb(255 255 255 / 14%);
}

.lightbox__button {
  width: 44px;
  height: 44px;
  border-color: rgb(255 255 255 / 28%);
  background: rgb(255 255 255 / 10%);
  color: #fff;
}

.lightbox__download {
  min-width: 92px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 8px;
  background: rgb(255 255 255 / 10%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.lightbox__button:hover {
  background: rgb(255 255 255 / 18%);
}

.lightbox__download:hover {
  background: rgb(255 255 255 / 18%);
  color: #fff;
}

.lightbox__caption {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox__stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: block;
  padding: 24px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
}

.lightbox__canvas {
  width: max(100%, var(--lightbox-image-width, 0px));
  height: max(100%, var(--lightbox-image-height, 0px));
  min-width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
}

.lightbox__stage img {
  width: var(--lightbox-image-width, auto);
  height: var(--lightbox-image-height, auto);
  max-width: none;
  max-height: none;
  object-fit: contain;
  user-select: none;
}

.intro-popup {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(18 21 19 / 58%);
  backdrop-filter: blur(10px);
}

.intro-popup[hidden] {
  display: none;
}

.intro-popup__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  max-height: min(820px, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 26px 88px rgb(18 21 19 / 28%);
}

.intro-popup__content {
  overflow-y: auto;
  padding: 30px 32px 12px;
}

.intro-popup__content h2 {
  margin: 0 40px 18px 0;
  font-family:
    Georgia,
    "Times New Roman",
    serif;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.intro-popup__content p {
  margin: 0 0 1rem;
}

.intro-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
}

.intro-popup__accept {
  min-height: 48px;
  margin: 0 32px 28px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  animation: acceptPulse 1800ms ease-in-out infinite;
  box-shadow: 0 0 0 0 rgb(47 102 85 / 34%);
}

.intro-popup__accept:hover {
  background: #244f42;
  animation-play-state: paused;
  box-shadow: 0 0 0 6px rgb(47 102 85 / 12%);
}

@keyframes acceptPulse {
  0% {
    box-shadow: 0 0 0 0 rgb(47 102 85 / 34%);
    transform: scale(1);
  }

  55% {
    box-shadow: 0 0 0 10px rgb(47 102 85 / 0%);
    transform: scale(1.018);
  }

  100% {
    box-shadow: 0 0 0 0 rgb(47 102 85 / 0%);
    transform: scale(1);
  }
}

@media (max-width: 820px) {
  .site-header__inner,
  .archive-layout {
    width: min(100% - 22px, 1180px);
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .select-field {
    grid-column: 1;
  }

  .icon-button {
    grid-column: 2;
    width: 44px;
  }

  h1 {
    font-size: 3.3rem;
  }

  .site-title-row {
    max-height: 320px;
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .entry__header {
    position: static;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .image-button {
    min-height: 220px;
  }

  .lightbox__bar {
    grid-template-columns: 40px minmax(0, 1fr) minmax(82px, auto) 40px 40px 48px 40px 40px;
    gap: 5px;
    padding: 8px;
  }

  .lightbox__button {
    width: 40px;
    height: 40px;
  }

  .lightbox__download {
    min-width: 82px;
    height: 40px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .lightbox__stage {
    padding: 10px;
  }

  .intro-popup__content {
    padding: 26px 20px 8px;
  }

  .intro-popup__accept {
    margin: 0 20px 20px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.5rem;
  }

  .site-title-row {
    max-height: 300px;
  }

  .archive-layout {
    padding-top: 22px;
  }

  .entry__id {
    font-size: 1.35rem;
  }

  .image-button {
    min-height: 180px;
  }

  .markdown {
    font-size: 0.97rem;
  }

  .lightbox__bar {
    grid-template-columns: 38px 1fr minmax(74px, auto) 38px 38px 38px;
  }

  .lightbox__button {
    width: 38px;
    height: 38px;
  }

  .lightbox__button[data-action="resetZoom"],
  .lightbox__button[data-action="prev"] {
    display: none;
  }

  .lightbox__download {
    min-width: 74px;
    height: 38px;
    padding: 0 8px;
    font-size: 0.82rem;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .intro-popup__accept {
    animation: none;
  }
}
