:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #15171a;
  --muted: #66686b;
  --rule: #e8e8e8;
  --matte: #f3f3f3;
  --gutter: 36px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  scroll-padding-top: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
h1, h2, p, figure { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell { width: calc(100% - var(--gutter) * 2); margin-inline: auto; }
.header-inner { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; min-height: 100px; }
.brand { grid-column: 2; grid-row: 1; font-size: 1.5rem; font-weight: 750; line-height: 1.1; text-decoration: none; }
.desktop-nav { grid-column: 1; grid-row: 1; display: flex; gap: 28px; }
.desktop-nav a { font-size: .9375rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.desktop-nav a:hover { color: var(--muted); }
.menu-toggle { display: none; }
.menu-toggle, .menu-close {
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.menu-icon { position: relative; width: 24px; height: 10px; }
.menu-icon::before, .menu-icon::after { position: absolute; inset-inline: 0; height: 1px; background: currentColor; content: ""; }
.menu-icon::before { top: 0; }
.menu-icon::after { bottom: 0; }
.menu-close .menu-icon::before { top: 50%; transform: rotate(45deg); }
.menu-close .menu-icon::after { top: 50%; transform: rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0 var(--gutter);
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.mobile-nav[open] { display: grid; grid-template-rows: 64px 1fr 64px; }
.mobile-nav::backdrop { background: var(--paper); }
.mobile-nav-header { display: flex; justify-content: space-between; align-items: center; }
.menu-close { display: grid; }
.mobile-nav nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  gap: 18px;
  padding-block: 12px;
  overflow: auto;
  animation: menu-appear .22s ease-out both;
}
.mobile-nav nav a { padding: 4px 12px; font-size: 1.625rem; font-weight: 700; line-height: 1.35; text-decoration: none; }
.mobile-nav nav a:hover { color: var(--muted); }
@keyframes menu-appear {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.gallery { width: calc(100% - var(--gutter) * 2); margin-inline: auto; padding: 64px 0 96px; }
.photo-grid { --photo-gap: 16px; position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--photo-gap); align-items: start; overflow: clip; }
.photo-grid.is-masonry { grid-auto-rows: 4px; row-gap: 0; }
.photo-grid.is-masonry .photo-card { padding-bottom: var(--photo-gap); }
.photo-card { position: relative; align-self: start; min-width: 0; }
.featured-photo { grid-column: span 2; }
.tile-link { display: block; background: var(--matte); }
.tile-link img { width: 100%; }
.featured-photo img { max-height: min(65svh, 660px); object-fit: cover; object-position: center 42%; }
.tile-link:focus-visible { outline-offset: -4px; }
.tile-zoom {
  position: absolute;
  inset: auto 15px 15px auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 6px #0003;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  transform: scale(.8);
  cursor: zoom-in;
}
.photo-grid.is-masonry .tile-zoom { bottom: calc(15px + var(--photo-gap)); }
.photo-card:hover .tile-zoom, .photo-card:focus-within .tile-zoom { opacity: 1; transform: none; }
.expand-icon { position: relative; width: 12px; height: 12px; }
.expand-icon::before, .expand-icon::after { position: absolute; width: 5px; height: 5px; border: solid currentColor; content: ""; }
.expand-icon::before { top: 0; right: 0; border-width: 1.5px 1.5px 0 0; }
.expand-icon::after { bottom: 0; left: 0; border-width: 0 0 1.5px 1.5px; }

.photo-archive { width: min(100%, 760px); margin-inline: auto; }
.photo-archive h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -.02em; }
.photo-timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline-entry {
  --marker-offset: 27px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0 14px 25px;
}
.timeline-entry::before {
  position: absolute;
  z-index: 1;
  top: calc(var(--marker-offset) - 4px);
  left: 0;
  width: 9px;
  height: 9px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: #77797c;
  box-shadow: 0 0 0 1px #a4a6a8;
  content: "";
}
.timeline-entry:not(:last-child)::after {
  position: absolute;
  inset: var(--marker-offset) auto calc(0px - var(--marker-offset)) 4px;
  width: 1px;
  background: #d9d9d9;
  content: "";
}
.timeline-copy { display: block; width: fit-content; max-width: 100%; text-decoration: none; }
.timeline-date { font-size: clamp(1rem, 2vw, 1.125rem); line-height: 1.45; font-weight: 650; font-variant-numeric: tabular-nums; }
.timeline-date time { color: inherit; font-size: inherit; }
.timeline-copy:hover .timeline-date { text-decoration: underline; text-underline-offset: .18em; }
.timeline-title { margin-top: 4px; color: var(--muted); font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.timeline-thumb { display: block; width: clamp(76px, 19vw, 112px); aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; background: var(--matte); cursor: zoom-in; }
.timeline-thumb img { width: 100%; height: 100%; object-fit: cover; }
.timeline-empty { padding-top: 16px; color: var(--muted); font-size: .9375rem; line-height: 1.6; }

.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.pagination:empty { display: none; }
.pagination a, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
}
.pagination a:hover, .button:hover { background: var(--matte); }

.photo-detail { padding-block: 44px 0; }
.detail-heading, .detail-copy { width: min(100%, 640px); margin-inline: auto; overflow-wrap: anywhere; }
.detail-heading h1, .empty-state h1 { font-size: clamp(1.75rem, 3vw, 2rem); line-height: 1.18; font-weight: 750; letter-spacing: -.03em; }
time { color: var(--muted); font-size: .875rem; }
.detail-heading time { display: block; margin-top: 14px; }
.detail-photo { margin-block: 30px 32px; }
.detail-image { display: block; width: fit-content; max-width: 100%; margin-inline: auto; cursor: zoom-in; }
.detail-image img { max-height: 78svh; width: auto; object-fit: contain; }
.detail-copy { color: var(--ink); font-size: 1rem; line-height: 1.75; white-space: pre-wrap; }

.empty-state { display: grid; align-content: center; justify-items: center; gap: 16px; min-height: 16rem; padding: 32px 0; text-align: center; }
.empty-state p { color: var(--muted); line-height: 1.6; }
.about-page { width: min(100%, 640px); margin-inline: auto; }
.about-page h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 20px; }
.about-page p { color: var(--muted); line-height: 1.7; }
.about-page p + p { margin-top: 12px; }
.site-footer { padding: 36px 0 48px; color: var(--muted); text-align: center; font-size: .875rem; }
.site-footer .shell { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.site-footer p { grid-column: 2; }
.footer-admin { grid-column: 3; justify-self: end; padding: 6px 0 6px 10px; font-size: .8125rem; text-decoration: none; }
.footer-admin:hover { text-decoration: underline; text-underline-offset: .18em; }

html:has(.viewer[open], .mobile-nav[open]) { overflow: hidden; }
.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4px 14px;
  border: 0;
  background: #101010;
  color: #fff;
}
.viewer[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "title controls close" "stage stage stage" "status status status";
  align-items: center;
  gap: 4px 8px;
}
.viewer::backdrop { background: #101010; }
.viewer h2 { grid-area: title; min-width: 0; padding-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; font-weight: 600; }
.viewer-close { grid-area: close; font-size: 1.65rem; }
.viewer button { min-width: 44px; min-height: 44px; padding: 4px 8px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.viewer button:hover { background: #ffffff1a; }
.viewer button[aria-disabled="true"] { opacity: .44; cursor: default; }
.viewer button:focus-visible, .viewer-stage:focus-visible { outline-offset: -2px; }
.viewer-stage { grid-area: stage; width: 100%; height: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-x pan-y; }
.viewer-stage::-webkit-scrollbar { display: none; }
.viewer-canvas { display: flex; justify-content: center; align-items: center; min-width: 100%; min-height: 100%; }
.viewer-stage img { flex: none; max-width: none; max-height: none; width: auto; height: auto; pointer-events: none; user-select: none; }
.viewer-stage.is-pannable { cursor: grab; }
.viewer-stage.is-dragging { cursor: grabbing; }
.viewer-controls { grid-area: controls; display: flex; gap: 2px; }
#viewer-status { grid-area: status; min-height: 1.7rem; color: #ccc; text-align: right; font-size: .875rem; font-variant-numeric: tabular-nums; }

@media (min-width: 1020px) {
  .gallery { max-width: 958px; }
  .photo-grid { --photo-gap: 32px; }
}
@media (min-width: 1350px) {
  .gallery { max-width: 1288px; }
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1680px) {
  .gallery { max-width: 1618px; }
  .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  :root { --gutter: 20px; }
  .header-inner { display: flex; justify-content: space-between; min-height: 64px; }
  .brand { font-size: 1.375rem; }
  .desktop-nav { display: none; }
  .menu-toggle { display: grid; }
  .gallery { padding-block: 48px 64px; }
  .photo-detail { padding-top: 4px; }
  .detail-photo { margin-block: 24px; }
}

@media (max-width: 640px) {
  .photo-grid { --photo-gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-zoom { right: 8px; bottom: 8px; }
  .photo-grid.is-masonry .tile-zoom { bottom: calc(8px + var(--photo-gap)); }
  .timeline-entry { gap: 12px; padding-left: 20px; }
  .viewer { padding-inline: 4px; }
}
@media (hover: none) {
  .tile-zoom { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile-zoom { transition: none; }
  .mobile-nav nav { animation: none; }
}
