/* ===========================================================================
   Chris Hubbell — Photography
   Design system + layout. No frameworks, no build step.

   Contents
     01. Tokens
     02. Reset & base
     03. Typography helpers
     04. Buttons & controls
     05. Header
     06. Mobile menu panel
     07. Hero
     08. Collections filter bar
     09. Gallery — shared tile
     10. Gallery — justified engine
     11. Gallery — masonry engine
     12. States (loading / empty / error)
     13. Lightbox
     14. Footer
     15. Back to top
     16. Motion & print
   =========================================================================== */


/* 01. TOKENS ============================================================== */

:root {
  /* Dark is the committed default. */
  --bg:            #0a0a0b;
  --bg-sunken:     #060607;
  --bg-elev:       #141417;
  --bg-elev-2:     #1c1c20;
  --tile-bg:       #17171a;

  --fg:            #f4f4f2;
  --fg-muted:      #9a9aa2;
  --fg-faint:      #6a6a72;

  --line:          rgba(255, 255, 255, .10);
  --line-strong:   rgba(255, 255, 255, .20);

  --accent:        #e3bd83;
  --accent-fg:     #17130c;

  --header-bg:     rgba(10, 10, 11, .72);
  --panel-bg:      rgba(14, 14, 17, .98);
  --shadow:        0 10px 40px rgba(0, 0, 0, .45);

  /* The lightbox stays near-black in both themes — it is the only place the
     photograph should be competing with nothing at all. */
  --lightbox-bg:   rgba(6, 6, 7, .975);
  --lightbox-fg:   #f4f4f2;
  --lightbox-ctl:  rgba(255, 255, 255, .09);
  --lightbox-ctl-h:rgba(255, 255, 255, .18);

  /* Layout */
  --header-h:      60px;
  --filter-h:      52px;
  --page-pad:      10px;
  --gap:           10px;
  --radius:        3px;
  --radius-lg:     10px;

  /* Type */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Motion */
  --ease:      cubic-bezier(.22, .61, .36, 1);
  --ease-out:  cubic-bezier(.16, 1, .3, 1);
  --dur:       .28s;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:            #fbfaf8;
  --bg-sunken:     #f2f0ec;
  --bg-elev:       #ffffff;
  --bg-elev-2:     #f5f3ef;
  --tile-bg:       #eceae5;

  --fg:            #17171a;
  --fg-muted:      #6a6a72;
  --fg-faint:      #96969e;

  --line:          rgba(0, 0, 0, .12);
  --line-strong:   rgba(0, 0, 0, .26);

  --accent:        #8a5f22;
  --accent-fg:     #ffffff;

  --header-bg:     rgba(251, 250, 248, .78);
  --panel-bg:      rgba(255, 255, 255, .99);
  --shadow:        0 10px 40px rgba(0, 0, 0, .12);

  color-scheme: light;
}

@media (min-width: 561px)  { :root { --page-pad: 12px; --gap: 8px;  } }
@media (min-width: 901px)  { :root { --page-pad: 14px; --gap: 10px; --header-h: 64px; } }


/* 02. RESET & BASE ======================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent); color: var(--accent-fg); }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.icon--sm { width: 17px; height: 17px; }
.icon--lg { width: 26px; height: 26px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

#sprite { position: absolute; width: 0; height: 0; overflow: hidden; }


/* 03. TYPOGRAPHY HELPERS ================================================== */

.eyebrow {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-muted);
}


/* 04. BUTTONS & CONTROLS ================================================== */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--fg);
  --btn-bd: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 550;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform .15s var(--ease);
}
.btn:hover { border-color: currentColor; }
.btn:active { transform: translateY(1px); }

.btn--solid {
  --btn-bg: var(--fg);
  --btn-fg: var(--bg);
  --btn-bd: var(--fg);
}
.btn--solid:hover { --btn-bg: var(--accent); --btn-fg: var(--accent-fg); --btn-bd: var(--accent); }

.btn--onphoto {
  --btn-bg: rgba(255, 255, 255, .10);
  --btn-fg: #fff;
  --btn-bd: rgba(255, 255, 255, .38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn--onphoto:hover { --btn-bg: #fff; --btn-fg: #111; --btn-bd: #fff; }

/* Square icon-only control */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  color: var(--fg-muted);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.iconbtn:hover { color: var(--fg); background: var(--bg-elev); }


/* 05. HEADER ============================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color .4s var(--ease), border-color .4s var(--ease);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding: 0 var(--page-pad) 0 max(var(--page-pad), env(safe-area-inset-left));
}

/* Wordmark ---------------------------------------------------------------- */
.wordmark {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  flex: 0 1 auto;
  margin-right: 4px;
  font-size: .8125rem;
  font-weight: 650;
  letter-spacing: .2em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wordmark__sub {
  font-size: .625rem;
  font-weight: 500;
  letter-spacing: .16em;
  color: var(--fg-faint);
}
@media (max-width: 420px) { .wordmark__sub { display: none; } }

/* Primary nav ------------------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--fg-muted);
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 13px; right: 13px; bottom: 3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .32s var(--ease-out);
}
.nav__link:hover { color: var(--fg); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link[aria-current="page"] { color: var(--fg); }
.nav__link[aria-current="page"]::after { transform: scaleX(1); background: var(--accent); }

/* Divider + utility cluster ----------------------------------------------- */
.header__divider {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--line-strong);
  flex: none;
}

.header__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding-right: env(safe-area-inset-right);
}

/* The hamburger only exists below the nav breakpoint. */
.menu-toggle { display: none; margin-left: auto; }

@media (max-width: 899px) {
  .nav             { display: none; }
  .header__divider { display: none; }
  .menu-toggle     { display: inline-flex; }
  /* .nav carried the auto margin on desktop; the tools must take it over. */
  .header__tools   { margin-left: auto; }
  /* Theme toggle lives inside the panel on mobile to keep the bar uncrowded */
  .header__tools .theme-toggle { display: none; }
}


/* 06. MOBILE MENU PANEL =================================================== */

.menu-scrim {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 55;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur);
}
.menu-scrim.is-open { opacity: 1; visibility: visible; }

.menu-panel {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 58;
  max-height: calc(100svh - var(--header-h));
  overflow-y: auto;
  padding: 8px var(--page-pad) calc(18px + env(safe-area-inset-bottom));
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateY(-101%);
  visibility: hidden;
  transition: transform .34s var(--ease-out), visibility .34s;
}
.menu-panel.is-open { transform: translateY(0); visibility: visible; }

@media (min-width: 900px) {
  .menu-panel, .menu-scrim { display: none; }
}

.menu-panel__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--fg-muted);
  transition: color .2s var(--ease), padding-left .2s var(--ease);
}
.menu-panel__link:hover,
.menu-panel__link:focus-visible { color: var(--fg); padding-left: 12px; }
.menu-panel__link[aria-current="page"] { color: var(--fg); }
.menu-panel__link[aria-current="page"]::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.menu-panel__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
}
.menu-panel__foot .btn { flex: 1; }


/* 07. HERO ================================================================ */

.hero {
  position: relative;
  height: clamp(360px, 62svh, 660px);
  margin-bottom: var(--gap);
  overflow: hidden;
  background: var(--bg-sunken);
  isolation: isolate;
}

.hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}
.hero__slide.is-active { opacity: 1; }
.hero__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
}
/* Scoped to .is-active so the drift restarts fresh each time a slide becomes
   current, rather than running once at page load (the animation would
   otherwise keep going on a hidden slide and simply be "done" by the time it
   is shown again, since it started as soon as the <img> entered the DOM). */
.hero__slide.is-active img {
  animation: heroDrift 14s var(--ease) forwards;
}
@keyframes heroDrift { to { transform: scale(1); } }

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.28) 42%, rgba(0,0,0,.06) 70%),
    linear-gradient(to right, rgba(0,0,0,.42), rgba(0,0,0,0) 60%);
  pointer-events: none;
}

.hero__content {
  position: absolute;
  z-index: 2;
  left: max(var(--page-pad), env(safe-area-inset-left));
  right: max(var(--page-pad), env(safe-area-inset-right));
  bottom: clamp(22px, 5vh, 44px);
  max-width: 620px;
  color: #fff;
}
.hero__eyebrow {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
  margin: 0 0 10px;
}
.hero__title {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 6.2vw, 3.4rem);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -.022em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}
.hero__lede {
  margin: 0 0 20px;
  max-width: 44ch;
  font-size: clamp(.9375rem, 2.2vw, 1.0625rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, .84);
  text-wrap: pretty;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.hero__dots {
  position: absolute;
  z-index: 2;
  right: max(var(--page-pad), env(safe-area-inset-right));
  bottom: clamp(22px, 5vh, 44px);
  display: flex;
  gap: 7px;
}
.hero__dot {
  width: 7px; height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .36);
  cursor: pointer;
  transition: background-color .3s var(--ease), transform .3s var(--ease);
}
.hero__dot:hover { background: rgba(255, 255, 255, .7); }
.hero__dot[aria-current="true"] { background: #fff; transform: scale(1.35); }
@media (max-width: 560px) { .hero__dots { display: none; } }


/* 08. COLLECTIONS FILTER BAR ============================================= */

.filterbar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.filterbar[hidden] { display: none; }

.filterbar__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--filter-h);
  padding: 0 var(--page-pad);
}

.chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  padding: 6px 0;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  scroll-snap-align: start;
  height: 32px;
  padding: 0 15px;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .015em;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease),
              background-color .2s var(--ease);
}
.chip:hover { color: var(--fg); border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.chip__count {
  margin-left: 7px;
  font-size: .6875rem;
  font-variant-numeric: tabular-nums;
  opacity: .6;
}

/* Fade the chip row where it runs off the edge, so it reads as scrollable. */
.chips-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.chips-wrap::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 36px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg));
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.chips-wrap.is-overflowing::after { opacity: .9; }

.filterbar__count {
  flex: none;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
  white-space: nowrap;
}
@media (max-width: 560px) { .filterbar__count { display: none; } }


/* 09. GALLERY — SHARED TILE ============================================== */

.gallery-region {
  padding: var(--gap) 0 0;
  /* Clears the sticky header + filter bar when jumped to via #gallery-start */
  scroll-margin-top: calc(var(--header-h) + var(--filter-h));
}

.gallery {
  padding: 0 max(var(--page-pad), env(safe-area-inset-left))
             calc(var(--gap) * 2)
             max(var(--page-pad), env(safe-area-inset-right));
}

.tile {
  margin: 0;
  position: relative;
  background: var(--tile-bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.tile__hit {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: inherit;
}

/* Blurred low-quality placeholder sits underneath the real photograph. */
.tile__hit::before {
  content: "";
  position: absolute;
  inset: -6%;
  background-image: var(--lqip);
  background-size: cover;
  background-position: center;
  filter: blur(14px) saturate(1.25);
  transform: scale(1.06);
  opacity: 1;
  transition: opacity .6s var(--ease);
}
.tile.is-loaded .tile__hit::before { opacity: 0; }

.tile__img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.012);
  transition: opacity .55s var(--ease), transform .7s var(--ease);
}
.tile.is-loaded .tile__img { opacity: 1; transform: scale(1); }

/* Hover: a restrained lift. No caption cards, no coloured overlays. */
@media (hover: hover) and (pointer: fine) {
  .tile__hit:hover .tile__img { transform: scale(1.035); }
  .tile__hit::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.34), rgba(0,0,0,0) 46%);
    opacity: 0;
    transition: opacity .32s var(--ease);
    pointer-events: none;
  }
  .tile__hit:hover::after { opacity: 1; }
  .tile__meta { opacity: 0; transform: translateY(6px); }
  .tile__hit:hover .tile__meta { opacity: 1; transform: translateY(0); }
}

.tile__meta {
  position: absolute;
  left: 12px; right: 12px; bottom: 10px;
  z-index: 2;
  text-align: left;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
  pointer-events: none;
  transition: opacity .32s var(--ease), transform .32s var(--ease);
}
@media (max-width: 560px) { .tile__meta { display: none; } }

.tile__hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Filter transition */
.gallery.is-swapping { opacity: 0; }
.gallery { transition: opacity .18s var(--ease); }


/* 10. GALLERY — JUSTIFIED ENGINE ========================================= */

.gallery--justified {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-content: flex-start;
}
/* Width and height are written inline by the layout engine. */
.gallery--justified .tile { flex: 0 0 auto; }


/* 11. GALLERY — MASONRY ENGINE =========================================== */

.gallery--masonry {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}
.masonry-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  flex: 1 1 0;
  min-width: 0;
}
.gallery--masonry .tile { width: 100%; }
.gallery--masonry .tile__hit { aspect-ratio: var(--ratio, 1.5); height: auto; }


/* 12. STATES ============================================================== */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52svh;
  padding: 40px var(--page-pad);
  text-align: center;
  color: var(--fg-muted);
}
.state__icon { color: var(--fg-faint); }
.state__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 550;
  color: var(--fg);
  letter-spacing: -.005em;
}
.state__body { margin: 0; max-width: 42ch; font-size: .9375rem; }
.state a, .u-link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  transition: color .2s var(--ease);
}
.state a:hover, .u-link:hover { color: var(--accent); }
.state code {
  font-family: var(--font-mono);
  font-size: .8125em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}

/* Skeleton shown while JSON is in flight — prevents an empty white flash. */
.skeleton {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: 0 var(--page-pad);
}
.skeleton__cell {
  flex: 1 1 260px;
  height: 300px;
  border-radius: var(--radius);
  background: linear-gradient(100deg,
    var(--tile-bg) 30%, var(--bg-elev-2) 50%, var(--tile-bg) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }


/* 13. LIGHTBOX ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--lightbox-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--lightbox-fg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s var(--ease), visibility .26s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

/* Top bar --------------------------------------------------------------- */
.lb__bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 max(10px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top);
  flex: none;
}
.lb__counter {
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .68);
}
.lb__collection {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid rgba(255, 255, 255, .18);
}
@media (max-width: 560px) { .lb__collection { display: none; } }
.lb__bar-spacer { flex: 1; }

.lb__ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lightbox-ctl);
  color: #fff;
  cursor: pointer;
  transition: background-color .2s var(--ease), transform .15s var(--ease);
}
.lb__ctl:hover { background: var(--lightbox-ctl-h); }
.lb__ctl:active { transform: scale(.94); }

/* Stage ------------------------------------------------------------------ */
.lb__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px 14px;
  touch-action: pan-y;
}
@media (min-width: 701px) { .lb__stage { padding: 0 64px 14px; } }

/* Photograph and its caption travel together as one centred block, so the
   caption is never marooned at the bottom of a tall phone screen. */
.lb__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
  will-change: transform;
}
.lb__img {
  flex: 0 1 auto;
  min-height: 0;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.lb__img.is-ready { opacity: 1; }

.lb__spinner {
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid rgba(255, 255, 255, .2);
  border-top-color: rgba(255, 255, 255, .85);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  opacity: 0;
  transition: opacity .2s var(--ease);
  pointer-events: none;
}
.lightbox.is-loading .lb__spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Prev / next ------------------------------------------------------------ */
.lb__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px; height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--lightbox-ctl);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s var(--ease), opacity .2s var(--ease);
}
.lb__nav:hover { background: var(--lightbox-ctl-h); }
.lb__nav--prev { left: max(12px, env(safe-area-inset-left)); }
.lb__nav--next { right: max(12px, env(safe-area-inset-right)); }
.lb__nav[disabled] { opacity: .25; cursor: default; }
@media (max-width: 700px) {
  .lb__nav { width: 42px; height: 42px; background: rgba(255,255,255,.07); }
  .lb__nav--prev { left: 6px; }
  .lb__nav--next { right: 6px; }
}

/* Caption ---------------------------------------------------------------- */
.lb__caption {
  flex: 0 0 auto;
  max-width: min(72ch, 100%);
  padding: 0 4px;
  text-align: center;
  font-size: .875rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, .74);
  text-wrap: pretty;
}
.lb__caption:empty { display: none; }
@media (max-width: 560px) { .lb__caption { font-size: .8125rem; } }

/* Filmstrip -------------------------------------------------------------- */
.lb__strip {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: flex-start;
}
.lb__strip::-webkit-scrollbar { display: none; }
.lb__thumb {
  flex: none;
  width: 58px; height: 44px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  opacity: .4;
  transform: scale(.94);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  background: #222;
}
.lb__thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb__thumb:hover { opacity: .8; }
.lb__thumb[aria-current="true"] { opacity: 1; transform: scale(1); outline: 2px solid #fff; outline-offset: -2px; }
@media (max-width: 700px) { .lb__strip { display: none; } }


/* 14. FOOTER ============================================================== */

.footer {
  margin-top: auto;
  padding: 34px max(var(--page-pad), env(safe-area-inset-left))
           calc(28px + env(safe-area-inset-bottom))
           max(var(--page-pad), env(safe-area-inset-right));
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
  transition: background-color .4s var(--ease);
}
.footer__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.footer__brand {
  font-size: .8125rem;
  font-weight: 650;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.footer__tagline {
  margin: 8px 0 0;
  font-size: .875rem;
  color: var(--fg-muted);
  max-width: 38ch;
}
.footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--fg-muted);
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.footer__link:hover { color: var(--fg); background: var(--bg-elev); }

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: .75rem;
  color: var(--fg-faint);
}

/* Dev-only layout switcher */
.layoutswitch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.layoutswitch__label {
  padding-left: 9px;
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.layoutswitch__btn {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  font-size: .75rem;
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.layoutswitch__btn:hover { color: var(--fg); }
.layoutswitch__btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); }


/* 15. BACK TO TOP ========================================================= */

.totop {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 50;
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--fg);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .26s var(--ease), transform .26s var(--ease), visibility .26s;
}
.totop.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.totop:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }


/* 16. MOTION & PRINT ====================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* !important: .hero__slide.is-active img is more specific than a bare
     .hero__slide img selector would be, so a plain override here would
     silently lose to it while a slide is active. */
  .hero__slide img { animation: none !important; transform: none !important; }
  .tile__img { opacity: 1; transform: none; }
}

@media print {
  .header, .filterbar, .menu-panel, .menu-scrim,
  .totop, .lightbox, .hero__actions { display: none !important; }
  body { background: #fff; color: #000; }
}
