:root {
  --bg: #ffffff;
  --ink: #0f0f0f;
  --muted: #767676;
  --placeholder: #f4f4f4;
  --border: #e5e5e5;
  --gutter: 16px;
  --pad-x: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

a,
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 3px;
}

/* Sticky translucent compact header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 var(--pad-x);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.brand {
  justify-self: start;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.filter-bar {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.nav-link sup {
  font-size: 10px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  font-weight: 500;
}

.nav-link.active::before {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--ink);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.about-trigger {
  justify-self: end;
}

.about-trigger.active::before {
  display: none;
}

.about-trigger.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Main gallery */
.site-main {
  padding: 8px var(--pad-x) 64px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 140px);
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: start;
}

.masonry-grid[hidden] {
  display: none;
}

.masonry-col {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  min-width: 0;
}

.photo-item {
  width: 100%;
  min-width: 0;
}

.photo-btn {
  display: block;
  width: 100%;
  background: var(--placeholder);
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
  border: 0;
}

.photo-btn picture {
  display: block;
  width: 100%;
}

.photo-btn img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  transition: opacity 0.2s ease;
}

.photo-btn img.is-pending {
  visibility: hidden;
}

.photo-btn:hover img {
  opacity: 0.9;
}

.status-message {
  margin: 64px 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* About view */
.about-view {
  max-width: 580px;
  margin: 48px 0 96px;
}

.about-view[hidden] {
  display: none;
}

.about-view h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.14em;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.about-view p {
  font-size: 14px;
  line-height: 1.85;
  color: #333333;
  margin-bottom: 14px;
}

.about-contact {
  color: var(--muted);
  font-size: 13px;
  margin-top: 20px;
}

.sample-tag {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #888888;
  border: 1px solid var(--border);
  padding: 1px 6px;
}

/* Footer */
.site-footer {
  padding: 20px var(--pad-x) 36px;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: #8c8c8c;
  letter-spacing: 0.06em;
}

/* Pure white fullscreen lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}

.lightbox.open {
  display: flex;
}

.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 72px 64px;
}

.lb-picture {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-stage img {
  max-width: calc(100vw - 144px);
  max-height: calc(100vh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-ctrl {
  position: fixed;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111111;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  z-index: 102;
}

.lb-ctrl:hover {
  opacity: 1;
}

#lb-close {
  top: 14px;
  right: 16px;
}

#lb-prev {
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

#lb-next {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-counter {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #777777;
  font-variant-numeric: tabular-nums;
  z-index: 102;
}

/* Mobile <= 640px: 2-column masonry, 10px gap */
@media (max-width: 640px) {
  :root {
    --gutter: 10px;
    --pad-x: 12px;
  }

  .site-header {
    height: auto;
    padding: 14px var(--pad-x) 10px;
    grid-template-columns: 1fr auto;
    row-gap: 10px;
  }

  .brand {
    font-size: 13.5px;
    grid-row: 1;
    grid-column: 1;
  }

  .about-trigger {
    grid-row: 1;
    grid-column: 2;
    font-size: 12.5px;
  }

  .filter-bar {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: start;
    gap: 18px;
    flex-wrap: wrap;
  }

  .nav-link {
    font-size: 13px;
  }

  .masonry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lb-stage {
    padding: 52px 12px 54px;
  }

  .lb-stage img {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 106px);
  }

  #lb-prev {
    left: 2px;
  }

  #lb-next {
    right: 2px;
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
  }
}
