:root {
  --ink: #0a0a0a;
  --paper: #fff;
  --line: #dfdfdf;
  --muted: #747474;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a { color: inherit; }
button { font: inherit; }
a { text-decoration: none; }

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}
.brand { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.index-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.gallery-section { padding: 68px 10px 10px; }

.masonry { columns: 4 260px; column-gap: 10px; }
.card { position: relative; display: inline-block; width: 100%; margin: 0 0 10px; break-inside: avoid; scroll-margin-top: 68px; transition: opacity .65s ease, filter .65s ease; }
.card:focus { outline: none; }
.card:target .image-wrap { outline: none; }
.card.is-located { z-index: 6; transform-origin: 50% 50%; }
.masonry.is-locating .card:not(.is-located) { opacity: .24; filter: grayscale(.58) brightness(.76); }
.card.is-located .image-wrap { animation: locate-focus 5.2s cubic-bezier(.22,.7,.2,1) 1 both; }
.card.is-located .image-wrap::before { content: ""; position: absolute; z-index: 3; inset: -30% -70%; pointer-events: none; background: linear-gradient(108deg, transparent 42%, rgba(255,255,255,.1) 46%, rgba(255,255,255,.72) 50%, rgba(99,190,255,.2) 54%, transparent 58%); transform: translateX(-58%); animation: locate-scan 3.6s .45s cubic-bezier(.3,.7,.2,1) 1 both; }
.card.is-located .image-wrap::after { content: ""; position: absolute; z-index: 4; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.08), rgba(36,143,255,.18) 68%, rgba(20,104,255,.24)); animation: locate-haze 5.2s ease-out 1 both; }
@keyframes locate-focus { 0% { transform: translateY(4px) scale(.975); filter: saturate(.88) brightness(.9); box-shadow: 0 8px 20px rgba(20,104,255,0); } 14% { transform: translateY(-7px) scale(1.028); filter: saturate(1.16) brightness(1.06); box-shadow: 0 28px 78px rgba(20,104,255,.62), 0 0 42px rgba(75,195,255,.4); } 36% { transform: translateY(-5px) scale(1.022); } 72% { transform: translateY(-4px) scale(1.018); filter: saturate(1.1) brightness(1.035); box-shadow: 0 24px 66px rgba(20,104,255,.48), 0 0 30px rgba(75,195,255,.3); } 100% { transform: none; filter: none; box-shadow: 0 8px 24px rgba(20,104,255,0); } }
@keyframes locate-scan { 0% { transform: translateX(-58%); opacity: 0; } 18% { opacity: 1; } 82% { opacity: .6; } 100% { transform: translateX(58%); opacity: 0; } }
@keyframes locate-haze { 0%, 100% { opacity: 0; } 18% { opacity: 1; } 72% { opacity: .7; } }
.card-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; cursor: zoom-in; }
.image-wrap { position: relative; overflow: hidden; background: #ececec; }
.card img { display: block; width: 100%; height: auto; transition: transform .45s cubic-bezier(.2,.65,.3,1); }
.card-copy { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; gap: 12px; padding: 44px 12px 11px; color: white; background: linear-gradient(transparent, rgba(0,0,0,.72)); opacity: 0; transform: translateY(5px); transition: opacity .2s, transform .2s; pointer-events: none; font-size: 12px; }
.card-meta { color: rgba(255,255,255,.74); font-size: 10px; }
.card-button:hover img { transform: scale(1.018); }
.card-button:hover .card-copy, .card-button:focus-visible .card-copy { opacity: 1; transform: none; }
.card-button:focus-visible { outline: 2px solid #1468ff; outline-offset: 2px; }
.card-actions { position: absolute; z-index: 5; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; }
.card-action { display: grid; place-items: center; width: 34px; height: 34px; padding: 8px; border: 0; border-radius: 50%; color: #111; background: rgba(255,255,255,.92); box-shadow: 0 2px 12px rgba(0,0,0,.12); cursor: pointer; transition: background .2s; }
.card-action svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.card:hover .card-actions, .card-actions:focus-within { opacity: 1; transform: none; }
.card-action:hover { background: #fff; }
.card-action:focus-visible { outline: 2px solid #1468ff; outline-offset: 2px; }
.permalink.is-copied { color: #087733; background: #dcffe8; }
.download-button.is-loading { opacity: .55; cursor: wait; }

.load-sentinel { height: 84px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 11px; }
.load-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); animation: breathe 1s ease-in-out infinite alternate; }
.load-sentinel.is-complete .load-dot { display: none; }
@keyframes breathe { to { opacity: .18; transform: scale(.7); } }

.back-to-top { position: fixed; z-index: 30; right: 24px; bottom: 24px; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 1px solid rgba(0,0,0,.12); border-radius: 50%; color: #111; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.18); cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(18px) scale(.88); transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .2s; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top.is-visible:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,.24); }
.back-to-top:focus-visible { outline: 3px solid #5ddaff; outline-offset: 3px; }
.back-to-top svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.lightbox { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; border: 0; padding: 50px 5vw 28px; color: white; background: rgba(0,0,0,.96); }
.lightbox::backdrop { background: rgba(0,0,0,.5); }
.lightbox[open] { display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; }
.lightbox figure { margin: 0; height: calc(100vh - 78px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: calc(100% - 58px); object-fit: contain; }
.lightbox figcaption { width: min(100%, 900px); display: flex; justify-content: space-between; padding-top: 16px; font-size: 12px; }
.lightbox-meta { color: #aaa; }
.lightbox-close, .lightbox-nav { color: white; border: 0; background: transparent; cursor: pointer; }
.lightbox-close { position: absolute; top: 18px; right: 3vw; font-size: 32px; font-weight: 200; }
.lightbox-nav { font-size: 25px; padding: 12px; }

@media (max-width: 720px) {
  .masonry { columns: 2 140px; gap: 6px; }
  .card { margin-bottom: 6px; }
  .card-copy { position: static; padding: 7px 2px 9px; color: var(--ink); background: none; opacity: 1; transform: none; flex-direction: column; gap: 3px; }
  .card-meta { color: var(--muted); }
  .card-actions { top: 8px; right: 8px; opacity: 1; transform: none; }
  .card-action { width: 32px; height: 32px; }
  .back-to-top { right: 14px; bottom: 14px; width: 46px; height: 46px; }
  .gallery-section { padding-inline: 6px; }
  .lightbox { padding: 48px 12px 20px; }
  .lightbox[open] { grid-template-columns: 36px 1fr 36px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .card.is-located .image-wrap::before, .card.is-located .image-wrap::after { display: none; }
  .card.is-located .image-wrap { box-shadow: 0 14px 38px rgba(20,104,255,.28); }
  .masonry.is-locating .card:not(.is-located) { opacity: .72; filter: none; }
}
