/* /gallery/ editorial photo journal (tools/gallery-page.mjs): full-bleed opener, sticky chapter index, chapters with
   a large roman numeral, asymmetric pair / inset / trio blocks, a day-to-night façade scene and a swipe strip.
   Photos reveal with a short curtain wipe; large ones drift slightly on scroll (scroll-driven CSS where supported).
   Everything stays still under prefers-reduced-motion. */
.dor-gallery {
  --g-ink: #2f2a27;
  --g-text: #5c5550;
  --g-mute: #8a817a;
  --g-bg: #f6f1ea;
  --g-accent: #4a1420;
  --g-line: rgba(74, 20, 32, .18);
  --g-ease: cubic-bezier(.22, 1, .36, 1);
  --g-pad: clamp(16px, 5vw, 72px);
  --g-gap: clamp(12px, 2vw, 28px);
  --g-top: 0px; /* fixed site header height, set by dor-gallery.js */
  background: var(--g-bg);
  color: var(--g-ink);
  overflow-x: clip;
}
.dor-gallery img { display: block; width: 100%; height: auto; max-width: none; }
.dor-gallery a { color: inherit; text-decoration: none; }
.dor-gallery h1, .dor-gallery h2, .dor-gallery p { margin: 0; }

.g-kicker {
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 11px !important;
  font-weight: 500;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--g-accent);
}

/* Opener */
.g-hero { position: relative; height: 100svh; min-height: 520px; color: #fff; overflow: hidden; }
.g-hero__media, .g-hero__media .g-par { position: absolute; inset: 0; }
.g-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.g-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 8, 10, .1) 30%, rgba(20, 8, 10, .62)); }
.g-hero__text { position: absolute; z-index: 1; left: var(--g-pad); right: var(--g-pad); bottom: clamp(40px, 9vh, 96px); max-width: 820px; }
.g-hero .g-kicker { color: #f1d9b5; }
.g-hero__title {
  margin: 14px 0 18px !important;
  font-family: "EB Garamond", Georgia, serif;
  font-size: clamp(40px, 6.4vw, 92px) !important;
  font-weight: 400 !important;
  line-height: 1.02 !important;
  letter-spacing: -.01em;
  color: #fff !important;
}
.g-hero__intro { max-width: 560px; font-family: "EB Garamond", Georgia, serif; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; color: rgba(255, 255, 255, .88); }

/* Chapter index */
.g-nav { position: sticky; top: var(--g-top); z-index: 20; background: rgba(246, 241, 234, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--g-line); }
.g-nav ol { display: flex; gap: clamp(18px, 2.6vw, 40px); margin: 0 !important; padding: 0 var(--g-pad) !important; list-style: none; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.g-nav ol::-webkit-scrollbar { display: none; }
.g-nav li { flex: none; margin: 0 !important; }
.g-nav a {
  display: flex; align-items: baseline; gap: 8px; padding: 18px 0 16px;
  font-family: Montserrat, system-ui, sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: var(--g-mute) !important; border-bottom: 1px solid transparent; transition: color .3s, border-color .3s;
}
.g-nav a:hover, .g-nav a[aria-current] { color: var(--g-accent) !important; border-bottom-color: var(--g-accent); }

/* Chapters */
.g-chapter { padding: clamp(80px, 12vw, 168px) 0 0; scroll-margin-top: calc(var(--g-top) + 40px); }
.g-head { max-width: 760px; margin: 0 auto clamp(48px, 7vw, 96px); padding: 0 var(--g-pad); text-align: center; }
.g-head--solo { margin-bottom: clamp(40px, 5vw, 72px); }
.g-head--solo .g-link { margin-top: 0; }
.g-chapter--solo { padding-top: clamp(56px, 7vw, 96px); }
.g-title a { color: inherit !important; transition: color .3s; }
.g-title a:hover { color: var(--g-accent) !important; }
.g-title {
  margin: 14px 0 18px !important;
  font-family: "EB Garamond", Georgia, serif;
  font-size: clamp(32px, 4.2vw, 58px) !important;
  font-weight: 400 !important;
  line-height: 1.08 !important;
  color: var(--g-ink) !important;
}
.g-intro { font-family: "EB Garamond", Georgia, serif; font-size: clamp(17px, 1.4vw, 20px); font-style: italic; line-height: 1.6; color: var(--g-text); }
.g-link {
  display: inline-block; margin-top: 22px; padding-bottom: 4px;
  font-family: Montserrat, system-ui, sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase;
  color: var(--g-accent) !important; border-bottom: 1px solid var(--g-line); transition: border-color .3s;
}
.g-link:hover { border-bottom-color: var(--g-accent); }

/* Photo frames */
.g-fig { margin: 0 !important; }
.g-media { display: block; overflow: hidden; cursor: zoom-in; background: #e9e1d6; }
.g-par { display: block; }
.g-media img { transition: transform 1.2s var(--g-ease), filter .6s; }
.g-media:hover img { filter: brightness(1.04); }
.g-media:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 4px; }

.g-block { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--g-gap); padding: 0 var(--g-pad); margin-bottom: clamp(48px, 8vw, 120px); align-items: start; }
.g-full { display: block; padding: 0; }
.g-full .g-media { height: min(90svh, 62vw); }
.g-full .g-par { height: 100%; }
.g-full img { height: 100%; object-fit: cover; }

.g-pair .g-f1 { grid-column: 1 / 8; }
.g-pair .g-f2 { grid-column: 9 / 13; margin-top: clamp(80px, 16vw, 260px) !important; }
.g-pair.g-flip .g-f1 { grid-column: 6 / 13; grid-row: 1; }
.g-pair.g-flip .g-f2 { grid-column: 1 / 5; grid-row: 1; }

.g-inset .g-f1 { grid-column: 3 / 11; }
.g-inset.g-flip .g-f1 { grid-column: 5 / 13; }

.g-trio .g-f1 { grid-column: 1 / 8; grid-row: 1 / 3; }
.g-trio .g-f2 { grid-column: 9 / 13; grid-row: 1; }
.g-trio .g-f3 { grid-column: 9 / 12; grid-row: 2; margin-top: var(--g-gap) !important; }
.g-trio.g-flip .g-f1 { grid-column: 6 / 13; }
.g-trio.g-flip .g-f2 { grid-column: 1 / 5; }
.g-trio.g-flip .g-f3 { grid-column: 2 / 5; }

/* Day to night: the façade stays on screen while the night shot fades in with the scroll */
.g-dusk { height: 220vh; margin-bottom: clamp(48px, 8vw, 120px); }
.g-dusk__stick {
  position: sticky; top: calc(var(--g-top) + 56px); height: calc(100svh - var(--g-top) - 56px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--g-gap); align-items: center; padding: 0 var(--g-pad);
}
.g-dusk__text { grid-column: 2 / 6; }
.g-dusk__line { margin-top: 16px !important; font-family: "EB Garamond", Georgia, serif; font-size: clamp(22px, 2.4vw, 34px); line-height: 1.3; color: var(--g-ink); }
.g-dusk__media { grid-column: 7 / 12; position: relative; height: calc(100% - 48px); }
.g-dusk__media img { width: 100%; height: 100%; object-fit: cover; }
.g-dusk__night { position: absolute; inset: 0; opacity: var(--g-night, 0); }

/* Swipe strip of details */
.g-strip { margin: 0 0 clamp(48px, 8vw, 120px); }
.g-strip__track {
  display: flex; gap: var(--g-gap); padding: 0 var(--g-pad); overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--g-pad); overscroll-behavior-x: contain; scrollbar-width: none;
}
.g-strip__track::-webkit-scrollbar { display: none; }
.g-strip__item { flex: none; width: clamp(240px, 30vw, 460px); scroll-snap-align: start; }
.g-strip__item .g-media { aspect-ratio: 4 / 5; }
.g-strip__item .g-par, .g-strip__item img { height: 100%; }
.g-strip__item img { object-fit: cover; }
.g-strip__nav { display: flex; justify-content: flex-end; gap: 10px; padding: 18px var(--g-pad) 0; }
.g-strip__btn {
  width: 48px; height: 48px; border: 1px solid var(--g-line) !important; border-radius: 50% !important; background: transparent !important;
  color: var(--g-accent) !important; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 !important; transition: background .3s, color .3s;
}
.g-strip__btn:hover { background: var(--g-accent) !important; color: #fff !important; }

/* Closing */
.g-end { padding: clamp(80px, 12vw, 160px) var(--g-pad) clamp(96px, 12vw, 160px); text-align: center; border-top: 1px solid var(--g-line); margin-top: clamp(40px, 6vw, 80px); }
.g-end__links { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: center; margin-top: 8px; }
.g-end .g-link { margin-top: 0; }
.g-btn {
  display: inline-block; padding: 16px 34px; background: var(--g-accent); color: #fff !important;
  font-family: Montserrat, system-ui, sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; transition: background .3s;
}
.g-btn:hover { background: #2e0c14; }

/* Reveal (only once the script runs, so photos never stay hidden without it) */
.g-js .g-fig .g-media, .g-js .g-dusk__media { clip-path: inset(0 0 100% 0); transition: clip-path 1.1s var(--g-ease); }
.g-js .g-fig .g-media img { transform: scale(1.04); }
.g-js .g-fig.is-in .g-media, .g-js .g-dusk.is-in .g-dusk__media { clip-path: inset(0 0 0 0); }
.g-js .g-fig.is-in .g-media img { transform: none; }
.g-js .g-head > * { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--g-ease), transform .9s var(--g-ease); }
.g-js .g-head.is-in > * { opacity: 1; transform: none; }
.g-js .g-head.is-in > :nth-child(2) { transition-delay: .08s; }
.g-js .g-head.is-in > :nth-child(3) { transition-delay: .16s; }


/* Gentle drift of the big frames where the browser supports scroll-driven animations */
@supports (animation-timeline: view()) {
  /* The frame is taller than its window so the drift never shows an edge; the photo itself is never enlarged. */
  .g-full .g-media { position: relative; }
  .g-full .g-par { position: absolute; inset: -6% 0; height: auto; }
  .g-full .g-par { animation: g-drift linear both; animation-timeline: view(); }
  @keyframes g-drift { from { transform: translateY(-5%); } to { transform: translateY(5%); } }
  .g-hero__media .g-par { inset: -10% 0 0 0; animation: g-drift-hero linear both; animation-timeline: view(); animation-range: exit; }
  @keyframes g-drift-hero { to { transform: translateY(9%); } }
}

@media (max-width: 760px) {
  .g-nav ol { justify-content: flex-start; }
  .g-block { grid-template-columns: 1fr; row-gap: var(--g-gap); }
  .g-block .g-fig { grid-column: 1 !important; grid-row: auto !important; margin-top: 0 !important; }
  .g-pair .g-f2, .g-trio .g-f3 { width: 78%; justify-self: end; }
  .g-pair.g-flip .g-f2, .g-trio.g-flip .g-f3 { justify-self: start; }
  .g-full .g-media { height: 70svh; }
  .g-dusk { height: 180vh; }
  .g-dusk__stick { grid-template-columns: 1fr; grid-template-rows: auto 1fr; row-gap: 16px; align-items: stretch; padding-top: 12px; padding-bottom: 16px; }
  .g-dusk__text, .g-dusk__media { grid-column: 1; }
  .g-dusk__media { height: 100%; }
  .g-dusk__line { font-size: 20px; margin-top: 8px !important; }
  .g-strip__nav { display: none; }
  .g-strip__item { width: 78vw; }
}

@media (prefers-reduced-motion: reduce) {
  .dor-gallery *, .dor-gallery *::before { animation: none !important; transition: none !important; }
  .g-js .g-fig .g-media, .g-js .g-dusk__media { clip-path: none; }
  .g-js .g-fig .g-media img { transform: none !important; }
  .g-full .g-par, .g-hero__media .g-par { animation: none !important; transform: none !important; inset: 0 !important; }
  .g-js .g-head > * { opacity: 1; transform: none; }
  .g-dusk { height: auto; }
  .g-dusk__stick { position: static; height: auto; }
  .g-dusk__media { aspect-ratio: 2 / 3; height: auto; }
  .g-dusk__night { opacity: 1; clip-path: inset(0 0 0 50%); }
}
