:root {
  --bg: #0a0a0b;
  --bg-raised: #141416;
  --fg: #f2f2f0;
  --fg-dim: #8b8b87;
  --fg-dimmer: #5a5a57;
  --line: rgba(255, 255, 255, 0.10);
  --accent: #f2f2f0;
  --gutter: 4px;
  --pad: clamp(20px, 4vw, 56px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* ---- casual download deterrent ----------------------------------------
   Blocks drag-to-desktop and drag-to-another-tab, and stops the photograph
   itself from being the right-click target. Anyone who opens dev tools can
   still get the file -- this only raises the effort above zero. */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* no save sheet on long-press in iOS Safari */
  pointer-events: none;          /* the tile button underneath still takes clicks */
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  /* Jost is a fine-stroke geometric sans -- lighter on the page than Inter,
     and it sits better under a script logo. */
  font-family: Jost, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ------------------------------------------------------------ masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
  flex-wrap: wrap;
  padding: 18px var(--pad);
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  margin-right: auto;
  gap: 3px;
}

.wordmark-logo {
  display: block;
  height: 50px;
  width: auto;
  /* The signature is white artwork on transparency, so it needs no colour
     treatment -- just a touch of restraint so it doesn't shout. */
  opacity: 0.94;
  transition: opacity 0.2s;
}

.wordmark:hover .wordmark-logo { opacity: 1; }

/* Cormorant Garamond -- an old-style serif whose stroke contrast answers the
   pen-drawn signature above it. Weight 400: the thin strokes stay delicate,
   which is the point of the face. Drop to 300 if it should be finer still. */
.wordmark-sub {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  /* A step down from --fg-dim, so it recedes behind the signature.
     --fg-dimmer (#5a5a57) if it should sit back further still. */
  color: #73736e;
  white-space: nowrap;
  line-height: 1.1;
}

.categories {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cat {
  appearance: none;
  border: 0;
  background: none;
  color: var(--fg-dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  padding: 7px 13px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}

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

.cat[aria-current="true"] {
  color: var(--bg);
  background: var(--fg);
}

/* ------------------------------------------------------------ search */

.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 210px;
  flex: 0 1 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--fg-dimmer);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}

#search {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--fg);
  font: inherit;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  text-transform: lowercase;   /* matching is case-insensitive, so this is purely visual */
  padding: 9px 32px 9px 34px;
  outline: none;
  transition: border-color 0.18s, background 0.18s;
}

#search::placeholder { color: var(--fg-dimmer); }
#search:focus { border-color: rgba(255,255,255,0.32); background: #1b1b1e; }
#search::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 8px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--fg-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { color: var(--fg); }

/* ------------------------------------------------------------ filters */

main { padding: 0 var(--pad) 80px; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--fg);
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 5px 8px 5px 13px;
  cursor: pointer;
}
.chip:hover { border-color: rgba(255,255,255,0.32); }
.chip span { color: var(--fg-dim); font-size: 15px; line-height: 1; }

.result-count {
  color: var(--fg-dimmer);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 22px 0 16px;
}

/* ------------------------------------------------------------ gallery */

.gallery { display: flex; flex-direction: column; gap: var(--gutter); }

.row { display: flex; gap: var(--gutter); }

.tile {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg-raised);
  cursor: zoom-in;
  flex-shrink: 0;
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}

.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.035); }

.tile-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.72), transparent);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-align: left;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}

.tile:hover .tile-label,
.tile:focus-visible .tile-label { opacity: 1; transform: none; }

.tile-label b { font-weight: 500; }
.tile-label i { font-style: normal; color: rgba(255,255,255,0.65); }

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

/* ------------------------------------------------------------ empty */

.empty { padding: 90px 0; text-align: center; }
.empty-title { font-size: 17px; margin: 0 0 8px; }
.empty-body { color: var(--fg-dim); margin: 0; font-size: 14px; }

/* ------------------------------------------------------------ footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px var(--pad) 64px;
  color: var(--fg-dimmer);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.site-footer p { margin: 0; }

.footer-rights { color: var(--fg-dim); }

.footer-contact { margin-top: 8px !important; }

.footer-contact a {
  color: var(--fg-dim);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  padding-bottom: 1px;
  transition: color 0.18s, border-color 0.18s;
}

.footer-contact a:hover {
  color: var(--fg);
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------------------ lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  animation: fade 0.22s var(--ease);
}

.lightbox[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } }

/* The stage fills the whole viewport and the caption bar floats over it, so
   the photograph gets every pixel available. object-fit: contain guarantees
   nothing is ever cropped. */
.lb-stage {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

/* A transparent sheet over the full-size frame. Right-clicking or long-pressing
   hits this instead of the photograph, so no "Save image as" appears. */
.lb-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

#lb-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
#lb-image.loaded { opacity: 1; }

/* Bare glyphs, no chrome. A drop shadow keeps them legible over a bright
   photograph without putting a disc in front of the picture. */
.lb-close, .lb-nav {
  position: absolute;
  z-index: 5;
  border: 0;
  background: none;
  color: var(--fg);
  cursor: pointer;
  opacity: 0.55;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85);
  transition: opacity 0.18s;
  line-height: 1;
}

.lb-close:hover, .lb-nav:hover { opacity: 1; }

.lb-close {
  top: 14px; right: 16px;
  width: 44px; height: 44px;
  font-size: 27px;
  font-weight: 200;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 64px;              /* generous target, invisible */
  height: 120px;
  font-size: 42px;
  font-weight: 200;
  padding: 0;
}

.lb-prev { left: 4px; }
.lb-next { right: 4px; }

.lb-nav[disabled] { opacity: 0; pointer-events: none; }

/* Everything at the foot of the lightbox lives in one container so the scrim
   grows only when the details panel is open. */
.lb-foot {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 34px clamp(14px, 3vw, 32px) clamp(10px, 1.6vw, 14px);
  /* Much lighter than before. The text carries its own shadow, so the scrim
     only has to lift contrast a little rather than black out the photograph. */
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.58) 0%,
    rgba(0, 0, 0, 0.34) 42%,
    transparent 100%);
  pointer-events: none;
}

/* Gradients can't be transitioned, so the deeper scrim used when details are
   open is a second layer that fades in over the first. */
.lb-foot::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.62) 0%,
    rgba(0, 0, 0, 0.34) 55%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}

.lightbox.details-open .lb-foot::before { opacity: 1; }

.lb-foot > * { position: relative; z-index: 1; pointer-events: none; }
.lb-foot button, .lb-foot .lb-line { pointer-events: auto; }

/* Width of the pinned controls, kept clear so text never runs underneath. */
:root { --lb-controls: 158px; }

.lb-bar {
  display: flex;
  align-items: baseline;
  padding-right: var(--lb-controls);
}

/* Title and place share a single line to keep the scrim shallow. */
.lb-line {
  margin: 0;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9), 0 0 22px rgba(0, 0, 0, 0.6);
}

.lb-sep { color: var(--fg-dimmer); margin: 0 8px; }

.lb-place {
  color: var(--fg-dim);
  font-size: 11.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* ---- details panel: caption, tags and EXIF, below the title line ---- */

/* Collapsed by max-height rather than display, so opening and closing can
   actually animate. The value only needs to exceed the tallest real panel. */
.lb-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease), opacity 0.22s var(--ease);
}

.lightbox.details-open .lb-panel {
  max-height: 260px;
  opacity: 1;
}

.lb-panel-inner { padding-top: 12px; padding-right: var(--lb-controls); }

.lb-caption {
  margin: 0 0 10px;
  color: var(--fg);
  font-size: 13px;
  max-width: 62ch;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
.lb-caption[hidden] { display: none; }

.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lb-tags[hidden] { display: none; }

.lb-tag {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 100px;
  color: var(--fg-dim);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.07em;
  padding: 3px 10px;
  cursor: pointer;
}
.lb-tag:hover { color: var(--fg); border-color: rgba(255,255,255,0.5); }

/* Pinned to the bottom-right of the lightbox. Because it sits outside the
   flow, expanding the details panel grows the foot upward without the button
   moving a pixel -- you can toggle it repeatedly without chasing it. */
.lb-foot > .lb-right {
  position: absolute;
  right: clamp(14px, 3vw, 32px);
  bottom: clamp(10px, 1.6vw, 14px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.lb-info-toggle {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 100px;
  color: var(--fg-dim);
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.lb-info-toggle:hover { color: var(--fg); }

.lb-info-toggle.on {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
}

.lb-index {
  color: var(--fg-dimmer);
  font-size: 11px;
  letter-spacing: 0.13em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.lb-exif {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin: 0;
  color: var(--fg-dimmer);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
.lb-exif[hidden] { display: none; }

.lb-exif div { display: flex; gap: 7px; }
.lb-exif dt { text-transform: uppercase; opacity: 0.65; }
.lb-exif dd { margin: 0; color: var(--fg-dim); }


body.lb-open { overflow: hidden; }

/* ------------------------------------------------------------ mobile */

/* ------------------------------------------------------------ mobile */

@media (max-width: 900px) {
  :root { --pad: 16px; --gutter: 3px; }

  .masthead {
    padding: 12px var(--pad) 10px;
    gap: 10px;
    /* Respect the notch and rounded corners on modern phones. */
    padding-left: max(var(--pad), env(safe-area-inset-left));
    padding-right: max(var(--pad), env(safe-area-inset-right));
  }

  .wordmark { margin: 0 auto; align-items: center; }
  .wordmark-logo { height: 36px; }
  .wordmark-sub { font-size: 15px; letter-spacing: 0.035em; }

  .search { order: 3; flex-basis: 100%; min-width: 0; }
  #search { font-size: 16px; }   /* 16px stops iOS zooming the page on focus */

  .categories {
    order: 4;
    flex-basis: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--pad) * -1);
    padding: 0 var(--pad);
    justify-content: flex-start;
  }
  .categories::-webkit-scrollbar { display: none; }
  .cat { font-size: 11.5px; padding: 6px 11px; }

  main { padding-bottom: 48px; }
  .result-count { padding: 16px 0 10px; font-size: 10px; }

  /* Captions can't rely on hover, so they stay on -- but quieter. */
  .tile-label {
    opacity: 1;
    transform: none;
    font-size: 10px;
    padding: 20px 8px 7px;
  }
  .tile-label i { display: none; }
  .tile:hover img { transform: none; }

  .site-footer { padding: 28px var(--pad) 44px; text-align: center; }
}

@media (max-width: 720px) {
  /* Swipe handles navigation on touch, so the arrows only add clutter. */
  .lb-nav { display: none; }

  .lb-close {
    top: max(10px, env(safe-area-inset-top));
    right: 8px;
    width: 44px; height: 44px;      /* comfortable touch target */
  }

  .lb-stage { padding: 2px; }

  .lb-foot {
    padding: 28px 14px max(10px, env(safe-area-inset-bottom));
  }

  /* Two rows on a phone: the title needs the width to stay readable. */
  :root { --lb-controls: 132px; }
  .lb-bar { flex-direction: column; align-items: flex-start; }
  .lb-line { white-space: normal; font-size: 13.5px; line-height: 1.35; }
  .lb-sep { display: none; }
  .lb-place { display: block; margin-top: 1px; }

  .lb-foot > .lb-right {
    right: 14px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .lb-caption { font-size: 12.5px; }
  .lb-exif { gap: 4px 16px; font-size: 10.5px; }

  /* Tags and EXIF wrap onto more rows at this width. */
  .lightbox.details-open .lb-panel { max-height: 380px; }
}

/* Phones held sideways have almost no vertical room -- give it all to the
   photograph and let the caption compress. */
@media (max-height: 460px) and (orientation: landscape) {
  .lb-foot { padding-top: 22px; padding-bottom: 6px; }
  .lb-bar { flex-direction: row; align-items: baseline; }
  .lb-line { white-space: nowrap; }
  .lb-sep { display: inline; }
  .lb-place { display: inline; }
  .lb-stage { padding: 2px; }
  .lightbox.details-open .lb-panel { max-height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
