:root {
  --bg: #F4F3EF;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Header / menu */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 24px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.site-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.site-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.site-menu {
  position: relative;
}

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg);
  padding: 6px 2px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.menu-toggle:hover {
  opacity: 1;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 18px);
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--fg);
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 22px 0;
  z-index: 40;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

.menu-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.menu-panel a {
  padding: 11px 28px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--fg);
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.menu-panel a:hover {
  opacity: 1;
}

.menu-panel a[aria-current="page"] {
  opacity: 1;
  font-style: italic;
}

.menu-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: 11px 28px;
}

/* Work detail */

.work-detail {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.work-image {
  width: 100%;
  display: flex;
  justify-content: center;
}

.work-image img {
  width: auto;
  max-width: 100%;
  max-height: 80vh;
}

/* Work gallery masonry */

.work-masonry {
  width: 100%;
  column-count: 2;
  column-gap: 10px;
  margin-bottom: 24px;
}

@media (min-width: 900px) {
  .work-masonry {
    column-count: 3;
  }
}

@media (min-width: 1400px) {
  .work-masonry {
    column-count: 4;
  }
}

.masonry-item {
  width: 100%;
  break-inside: avoid;
  margin-bottom: 10px;
  background: #e8e6e0;
  opacity: 0;
  transition: opacity 0.9s ease;
  will-change: opacity;
}

.masonry-item.is-visible {
  opacity: 1;
  will-change: auto;
}

.image-tile {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  width: 100%;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.image-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.4s ease;
  pointer-events: none;
}

.image-tile:hover::after {
  background: rgba(0, 0, 0, 0.12);
}

.image-tile:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 3px;
}

.gallery-image {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: opacity;
}

.gallery-image.is-loaded {
  opacity: 1;
  will-change: auto;
}

.grid-image {
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: opacity;
}

.grid-image.is-loaded {
  opacity: 1;
  will-change: auto;
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  z-index: 50;
  overscroll-behavior: contain;
  touch-action: none;
  animation: lightbox-in 0.3s ease both;
}

.lightbox[hidden] {
  display: none;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.lightbox-counter {
  font-variant-numeric: tabular-nums;
}

.lightbox-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 4px;
}

.lightbox-close:hover {
  color: var(--fg);
}

.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(48px, 8vw, 96px);
  overflow: hidden;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  animation: lightbox-image-in 0.3s ease both;
}

@keyframes lightbox-image-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(44px, 6vw, 72px);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--muted);
  z-index: 1;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  color: var(--fg);
}

.lightbox-prev {
  left: 0;
}

.lightbox-next {
  right: 0;
}

.lightbox-hint {
  padding: 16px 24px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.work-meta {
  width: 100%;
  max-width: 900px;
  margin-top: 24px;
}

.work-detail--text .work-meta {
  text-align: center;
  margin-top: 72px;
}

.work-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0 0 6px;
}

.work-sub,
.work-publication {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Related works */

.section-label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
  margin: 0 0 16px;
}

.related-works {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 64px;
}

.related-row {
  display: flex;
  gap: 12px;
}

.related-tile {
  flex: 1;
  display: block;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.related-tile .related-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.related-title {
  display: block;
  margin-top: 8px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  text-align: center;
}

/* Bio */

.bio {
  max-width: 700px;
  margin: 10vh auto 64px;
  padding: 0 24px;
}

.bio-photo {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 0 32px;
}

.bio-text {
  width: 100%;
}

.bio-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.6rem;
  margin: 0 0 8px;
}

.bio-role {
  font-family: var(--font-sans);
  color: var(--muted);
  margin: 0 0 16px;
}

.bio-statement {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
}

/* Footer */

.site-footer {
  padding: 32px 24px 40px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Responsive */

@media (max-width: 640px) {
  .site-header {
    padding: 16px;
  }

  .site-title {
    font-size: 0.95rem;
  }

  .menu-panel {
    min-width: 190px;
    padding: 18px 0;
  }

  .menu-panel a {
    padding: 10px 22px;
  }

  .menu-divider {
    margin: 9px 22px;
  }

  .work-detail {
    padding: 16px;
  }

  .work-masonry {
    column-gap: 6px;
  }

  .masonry-item {
    margin-bottom: 6px;
  }

  .work-title {
    font-size: 1.25rem;
  }

  .related-works {
    padding: 32px 16px 40px;
  }

  .related-row {
    gap: 6px;
  }

  .related-title {
    font-size: 0.75rem;
    margin-top: 6px;
  }

  .bio {
    margin: 6vh auto 48px;
    padding: 0 16px;
  }

  .bio-photo {
    margin-bottom: 20px;
  }

  .bio-name {
    font-size: 1.35rem;
  }

  .lightbox-topbar {
    padding: 14px 16px;
  }

  .lightbox-stage {
    padding: 0 8px;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 60px;
    font-size: 1.2rem;
  }

  .lightbox-hint {
    padding: 12px 16px;
    font-size: 0.62rem;
  }
}

@media (max-width: 400px) {
  .work-masonry {
    column-count: 1;
  }
}
