/* =========================================================
   Editorial Monograph — Zhi (Leo) Wang
   Dark editorial / gallery-on-black
   ========================================================= */

:root {
  --bg:            #0a0a0b;
  --bg-soft:       #121214;
  --ink:           #ece7df;   /* warm off-white */
  --ink-dim:       #9a958c;
  --ink-faint:     #6a665f;
  --hair:          rgba(236, 231, 223, 0.13);
  --hair-soft:     rgba(236, 231, 223, 0.07);
  --accent:        #c8a978;   /* restrained warm gold */
  --accent-dim:    rgba(200, 169, 120, 0.55);

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --maxw: 1500px;
  --pad: clamp(20px, 5vw, 76px);
  --rail-w: 188px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

::selection { background: var(--accent); color: #11100d; }

.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 2px;
  font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  transition: top .25s var(--ease);
}
.skip-link:focus { top: 16px; }

/* ---------- scroll progress (top hairline) ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 120; background: var(--hair-soft); pointer-events: none;
}
.scroll-progress__bar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transform-origin: left;
}

/* =========================================================
   Right-rail Table of Contents
   ========================================================= */
.toc {
  position: fixed;
  top: 0; right: 0;
  width: var(--rail-w);
  height: 100vh;
  z-index: 90;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 30px 40px 18px;
  border-left: 1px solid var(--hair-soft);
}
.toc__label {
  margin: 0 0 22px;
  font: 600 10px/1 var(--sans);
  letter-spacing: .34em; text-transform: uppercase;
  color: var(--ink-faint);
  padding-left: 18px;
}
.toc__list { display: flex; flex-direction: column; gap: 1px; }

.toc__item {
  position: relative;
  display: flex; align-items: baseline; gap: 9px;
  padding: 5px 4px 5px 18px;
  cursor: pointer;
  color: var(--ink-faint);
  transition: color .4s var(--ease);
}
.toc__item:hover { color: var(--ink-dim); }

/* moving tick */
.toc__item::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 11px; height: 1px;
  background: currentColor;
  transform: translateY(-50%) scaleX(0.4);
  transform-origin: left;
  opacity: .35;
  transition: transform .45s var(--ease), opacity .45s var(--ease), background-color .45s var(--ease);
}
.toc__num {
  font: 400 11px/1 var(--sans);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  opacity: .7;
}
.toc__name {
  font: 500 10.5px/1.2 var(--sans);
  letter-spacing: .14em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toc__item.is-active {
  color: var(--ink);
}
.toc__item.is-active::before {
  background: var(--accent);
  transform: translateY(-50%) scaleX(1.7);
  opacity: 1;
}
.toc__item.is-active .toc__num { color: var(--accent); opacity: 1; }

/* =========================================================
   Mobile index sheet
   ========================================================= */
.toc-toggle {
  position: fixed; right: 16px; bottom: 18px; z-index: 95;
  display: none;
  align-items: center; gap: 8px;
  padding: 11px 18px;
  background: rgba(18,18,20,.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hair);
  border-radius: 40px;
  color: var(--ink);
  font: 600 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase;
  cursor: pointer;
}
.toc-toggle::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

.toc-sheet {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(8,8,9,.55);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s var(--ease);
}
.toc-sheet.is-open { opacity: 1; visibility: visible; }
.toc-sheet__inner {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 82vh; overflow-y: auto;
  background: var(--bg-soft);
  border-top: 1px solid var(--hair);
  border-radius: 16px 16px 0 0;
  padding: 22px var(--pad) calc(28px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .42s var(--ease);
}
.toc-sheet.is-open .toc-sheet__inner { transform: translateY(0); }
.toc-sheet__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--hair-soft);
}
.toc-sheet__label {
  margin: 0; font: 600 11px/1 var(--sans);
  letter-spacing: .3em; text-transform: uppercase; color: var(--ink-faint);
}
.toc-sheet__close {
  background: none; border: none; color: var(--ink-dim);
  font: 600 11px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
  cursor: pointer; padding: 6px;
}
.toc-sheet__list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; }
.toc-sheet__item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hair-soft);
  color: var(--ink-dim); cursor: pointer;
}
.toc-sheet__item .n {
  font: 400 11px/1 var(--sans); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.toc-sheet__item .t {
  font: 500 12px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase;
}
.toc-sheet__item.is-active { color: var(--ink); }
.toc-sheet__item.is-active .t { color: var(--ink); }

/* =========================================================
   Page shell
   ========================================================= */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  padding-right: calc(var(--rail-w) + var(--pad) * 0.4);
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 16vh 0 13vh;
}
.hero__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #060607; }
.hero__bg::before {
  content: ""; position: absolute; inset: -6%;
  background-image: url("gallery/church/chapel-of-the-transfiguration-grand-teton-national-park.jpg");
  background-size: cover; background-position: center 50%;
  filter: saturate(1.03) brightness(.82) contrast(1.03);
  transform: scale(1.05);
  animation: heroDrift 28s ease-in-out infinite alternate;
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(95deg, rgba(8,8,9,.95) 0%, rgba(8,8,9,.80) 32%, rgba(8,8,9,.34) 60%, rgba(8,8,9,.52) 84%, rgba(8,8,9,.82) 100%),
    linear-gradient(0deg, rgba(8,8,9,.97) 0%, rgba(8,8,9,.30) 38%, rgba(8,8,9,.06) 62%, rgba(8,8,9,.46) 100%);
}
@keyframes heroDrift {
  from { transform: scale(1.05); }
  to   { transform: scale(1.13) translate(-1.6%, -1.4%); }
}
.hero__inner {
  position: relative; z-index: 1;
  width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: 0 var(--pad);
}
.hero__subtitle, .hero__index { max-width: 940px; }
.hero__kicker {
  margin: 0 0 28px;
  font: 600 11px/1 var(--sans);
  letter-spacing: .42em; text-transform: uppercase;
  color: var(--ink-dim);
}
.hero__name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(44px, 9vw, 116px);
  line-height: 0.96;
  letter-spacing: -0.012em;
  text-shadow: 0 2px 40px rgba(0,0,0,.45);
}
.hero__paren { color: var(--ink-dim); font-weight: 300; font-style: italic; }
.hero__display {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-weight: 300; font-style: italic;
  font-size: clamp(28px, 5.4vw, 64px);
  line-height: 1;
  color: var(--accent);
  letter-spacing: .005em;
  text-shadow: 0 2px 30px rgba(0,0,0,.4);
}
.hero__subtitle {
  margin: 32px 0 0;
  max-width: 40ch;
  font-family: var(--serif);
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.5;
  color: var(--ink);
}
.hero__stats {
  margin: 30px 0 0;
  font: 500 12px/1 var(--sans);
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-dim);
}
.hero__index {
  margin: clamp(36px, 5.5vh, 60px) 0 0;
  display: flex; flex-wrap: wrap; gap: 11px 28px;
}
.hero__index-link {
  display: inline-flex; align-items: baseline; gap: 7px;
  color: var(--ink-dim);
  transition: color .3s var(--ease);
}
.hero__index-link:hover { color: var(--ink); }
.hero__index-num {
  font: 400 10px/1 var(--sans);
  color: var(--accent); opacity: .75;
  font-variant-numeric: tabular-nums;
}
.hero__index-name {
  font: 500 11px/1 var(--sans);
  letter-spacing: .15em; text-transform: uppercase;
}
.hero__scroll {
  position: absolute; bottom: 5vh; z-index: 1;
  left: max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad)));
  font: 500 10px/1 var(--sans);
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--ink-dim);
  display: flex; align-items: center; gap: 12px;
}
.hero__scroll::after {
  content: ""; width: 46px; height: 1px; background: var(--ink-faint);
  animation: scrollPulse 2.6s var(--ease) infinite;
}
@keyframes scrollPulse {
  0%,100% { opacity: .3; transform: scaleX(.6); transform-origin: left; }
  50%     { opacity: 1;  transform: scaleX(1);  transform-origin: left; }
}

/* =========================================================
   Section
   ========================================================= */
.section {
  padding: clamp(56px, 9vh, 120px) 0 clamp(40px, 6vh, 72px);
  scroll-margin-top: 40px;
}
.section__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0 28px;
  padding-bottom: 26px;
  margin-bottom: clamp(22px, 3vw, 40px);
  border-bottom: 1px solid var(--hair);
}
.section__num {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(15px, 1.5vw, 19px);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  align-self: start;
  padding-top: .55em;
}
.section__title-wrap { min-width: 0; }
.section__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.01em;
}
.section__blurb {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 2vw, 22px);
  color: var(--ink-dim);
  line-height: 1.45;
  max-width: 46ch;
}
.section__count {
  align-self: start;
  padding-top: 1.1em;
  white-space: nowrap;
  font: 500 11px/1 var(--sans);
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* =========================================================
   Masonry (balanced columns) grid
   ========================================================= */
.grid { display: flex; align-items: flex-start; gap: var(--gap, 26px); }
.grid__col {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: var(--gap, 26px);
}

.tile {
  margin: 0;
  display: flex; flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  will-change: opacity, transform;
}
.tile.is-in { opacity: 1; transform: none; }

.tile__media {
  position: relative; display: block;
  overflow: hidden; background: var(--bg-soft);
}
.tile__media img {
  width: 100%; height: auto; display: block;
  transition: transform 1s var(--ease), filter .8s var(--ease);
  filter: saturate(.97) brightness(.96);
}
.tile__media:hover img { transform: scale(1.04); filter: saturate(1.04) brightness(1.04); }
.tile__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--hair-soft);
  transition: box-shadow .4s var(--ease);
}
.tile__media:hover::after { box-shadow: inset 0 0 0 1px var(--accent-dim); }
.tile__media:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* caption beneath the image, always visible — like a museum label */
.tile__cap {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 2px 4px;
}
.tile__cap-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(17px, 1.25vw, 20px);
  line-height: 1.25;
  letter-spacing: .005em;
  color: var(--ink);
}
.tile__cap-place {
  display: inline-flex; align-items: center;
  font: 500 10px/1 var(--sans);
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent);
}
.tile__cap-place::before {
  content: ""; width: 16px; height: 1px; margin-right: 10px;
  background: var(--accent-dim);
}

/* =========================================================
   Footer
   ========================================================= */
.footer { padding: clamp(70px,12vh,140px) 0 clamp(40px,7vh,80px); }
.footer__rule { width: 100%; height: 1px; background: var(--hair); margin-bottom: 40px; }
.footer__inner {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 24px 48px;
}
.footer__name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 500;
  letter-spacing: -.01em;
  flex: 1 1 auto;
}
.footer__links { display: flex; gap: 26px; flex-wrap: wrap; }
.footer__links a {
  position: relative;
  font: 500 11px/1 var(--sans);
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-dim);
  padding-bottom: 4px;
  transition: color .35s var(--ease);
}
.footer__links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease);
}
.footer__links a:hover { color: var(--ink); }
.footer__links a:hover::after { transform: scaleX(1); }
.footer__legal {
  flex-basis: 100%;
  margin: 18px 0 0;
  font: 400 11px/1.5 var(--sans);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* =========================================================
   PhotoSwipe caption
   ========================================================= */
.pswp__custom-caption {
  position: absolute; left: 0; right: 0; bottom: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
}
.pswp__custom-caption:empty { display: none; }
.pswp-cap-title {
  font-family: var(--serif); font-style: italic;
  font-size: 18px; color: var(--ink); letter-spacing: .01em;
}
.pswp-cap-place {
  font: 500 10px/1 var(--sans);
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--accent);
}
.pswp { --pswp-bg: #060607; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  :root { --rail-w: 168px; }
}
@media (max-width: 900px) {
  .toc { display: none; }
  .toc-toggle { display: inline-flex; }
  .page { padding-right: var(--pad); }
  .section__head {
    grid-template-columns: auto 1fr;
    column-gap: 18px;
  }
  .section__count {
    grid-column: 1 / -1;
    padding-top: 14px;
    align-self: auto;
  }
}
@media (max-width: 560px) {
  .section__head {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .section__num { padding-top: 0; margin-bottom: 10px; }
  .toc-sheet__list { grid-template-columns: 1fr; }
  .hero { padding: 15vh 0 12vh; }
  .hero__index { gap: 9px 18px; margin-top: 30px; }
  .tile__cap { padding-top: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .tile { opacity: 1; transform: none; }
}