/* Public site: dark, quiet frame so the photographs lead.
   Gallery thumbnails are greyscale and turn to colour on hover (kept from the original site). */

:root {
  --bg: #0d0d0d;
  --fg: #d4d4d4;
  --fg-strong: #fff;
  --muted: #8c8c8c;
  --line: #262626;
  --field: #161616;
  --error: #f19999;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gap: 12px;
  --pad: clamp(1rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
/* The texture is on html, so it fills the whole window (also below short pages). */
/* Pages are laid out on the full window width whether a scrollbar is shown or not, so the
   header does not jump between long and short pages; the scrollbar sits over the page margin.
   (scrollbar-gutter would leave a plain strip without the texture.) */
html { -webkit-text-size-adjust: 100%; background: var(--bg) url("../img/backgd.jpg") repeat; width: 100vw; overflow-x: hidden; }
body { margin: 0; color: var(--fg); font: 1rem/1.65 var(--sans); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--fg-strong); }
:focus-visible { outline: 2px solid var(--fg-strong); outline-offset: 3px; }
p { margin: 0 0 1em; }
h1, h2 { font-family: var(--serif); font-weight: 400; color: var(--fg-strong); line-height: 1.2; }

.skip, .visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { width: auto; height: auto; clip-path: none; left: 1rem; top: 1rem; z-index: 10; background: #000; padding: .5rem 1rem; }

/* At least the window height, so the footer sits at the bottom of the screen on short pages. */
.page {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh;
  max-width: 1600px; margin: 0 auto; padding: 0 var(--pad);
}

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.25rem 2.5rem; padding: 1rem 0 1.5rem; border-bottom: 1px solid var(--line);
}
.brand { margin: 0; font: inherit; color: var(--fg-strong); }
.brand a { display: flex; flex-direction: column; color: inherit; }
.brand .name { font-family: var(--serif); font-size: clamp(2rem, 1.3rem + 2.4vw, 3.1rem); line-height: 1; letter-spacing: .01em; }
.brand .tagline { margin-top: .6rem; font-size: .72rem; letter-spacing: .42em; text-transform: uppercase; color: var(--muted); }
.menu ul { display: flex; flex-wrap: wrap; gap: .25rem clamp(1rem, 3vw, 2.25rem); margin: 0; padding: 0; list-style: none; }
.menu a {
  display: inline-block; padding: .35rem 0; border-bottom: 1px solid transparent;
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  transition: color .2s, border-color .2s;
}
.menu a:hover { color: var(--fg-strong); }
.menu a[aria-current] { color: var(--fg-strong); border-bottom-color: currentColor; }

.site-main { --main-top: clamp(1.5rem, 4vw, 3rem); flex: 1 0 auto; padding: var(--main-top) 0 4rem; min-height: 50vh; }
.site-footer { padding: .5rem 0; text-align: center; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.site-footer p { margin: 0; }

.page-head { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: .25rem 1rem; margin-bottom: 1.5rem; }
.page-title { margin: 0 0 1.5rem; text-align: center; font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.6rem); }
.page-head .page-title { margin: 0; }
.page-head .count { color: var(--muted); font-size: .9rem; letter-spacing: .05em; }
.intro { max-width: 42rem; margin: -.5rem auto 2rem; text-align: center; color: var(--muted); }

/* Justified rows: every row fills the width, photos keep their proportions.
   site.js sizes each item; without JavaScript the thumbnails sit in rows of equal height. */
.justified { --h: 260px; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.justified > * { display: block; flex: none; overflow: hidden; background: #151515; }
.justified img { height: var(--h); width: auto; }
.justified.is-ready img { width: 100%; height: 100%; object-fit: cover; }

/* Greyscale thumbnails that turn colour on hover or keyboard focus. Only on devices
   with a mouse or touchpad: on touch screens there is no hover, so photos stay in colour. */
@media (hover: hover) and (pointer: fine) {
  .thumbs img, .strip img, .gallery-cards img { filter: grayscale(1); transition: filter .5s ease; }
  .thumbs a:hover img, .thumbs a:focus-visible img,
  .strip a:hover img, .strip a:focus-visible img,
  .gallery-cards a:hover img, .gallery-cards a:focus-visible img { filter: none; }
}

/* Home page: three sections, each with a small label */
.featured { --h: 340px; }
.home-section + .home-section { margin-top: clamp(2.5rem, 6vw, 4rem); padding-top: clamp(2rem, 4vw, 2.75rem); border-top: 1px solid var(--line); }
.section-label {
  margin: 0 0 1.25rem; text-align: center; font-family: var(--sans); font-size: .75rem; font-weight: 400;
  letter-spacing: .3em; text-transform: uppercase; color: var(--muted);
}
/* The first label sits halfway between the header line and the photos; the photos stay put. */
.home-section:first-child > .section-label {
  margin-top: calc((1.25rem - var(--main-top)) / 2); margin-bottom: calc((var(--main-top) + 1.25rem) / 2);
}
.gallery-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem clamp(1rem, 3vw, 2rem); margin: 0; padding: 0; list-style: none; }
.gallery-cards a { display: block; color: var(--fg); text-align: center; }
.gallery-cards img { margin: 0 auto; height: 200px; width: auto; }
.gallery-cards .name { display: block; margin-top: .7rem; font-family: var(--serif); font-size: 1.4rem; color: var(--fg-strong); }
.gallery-cards .count { font-size: .85rem; color: var(--muted); }
.home-about { display: grid; grid-template-columns: 180px minmax(0, 36rem); justify-content: center; align-items: end; gap: clamp(1.5rem, 4vw, 3rem); }
.home-about .portrait { width: 180px; }
.home-about .section-label { text-align: left; }
.home-about .teaser p:last-child { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 0; }
.button {
  display: inline-block; padding: .6rem 1.3rem; border: 1px solid #555; border-radius: 2px;
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--fg-strong);
  background: none; font-family: var(--sans); cursor: pointer; transition: background .2s, border-color .2s;
}
.button:hover { background: #222; border-color: #888; }

/* Gallery list: one row with the first photos of each gallery (lightbox per gallery) */
.gallery-row:first-of-type { margin-top: .5rem; }
.gallery-row { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.gallery-row .row-head { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: .25rem 1rem; margin-bottom: .9rem; }
.gallery-row h2 { margin: 0; font-size: 1.7rem; }
.gallery-row .count { color: var(--muted); font-size: .9rem; }
.gallery-row .more { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.gallery-row .more:hover { color: var(--fg-strong); }
/* Carousel: one row of photos at their own proportions, scrolled sideways (swipe, ‹ ›).
   site.js makes it loop and adds the buttons; without JavaScript it is a plain scrolling row.
   A row that fits the width is centred and does not scroll. */
.strip {
  --h: 220px; position: relative; display: flex; gap: var(--gap); overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
}
.strip > * { flex: none; scroll-snap-align: start; }
.strip > :first-child { margin-left: auto; }
.strip > :last-child { margin-right: auto; }
.strip img { height: var(--h); width: auto; max-width: none; }
.carousel { position: relative; }
.carousel.is-loop { padding: 0 3rem; }
.carousel.is-loop .strip { scrollbar-width: none; }
.carousel.is-loop .strip::-webkit-scrollbar { display: none; }
.carousel button {
  position: absolute; top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; padding: 0; border: 0; background: none;
  color: var(--muted); font-size: 2.2rem; font-weight: 200; line-height: 1; cursor: pointer; transition: color .2s;
}
.carousel button:hover { color: var(--fg-strong); }
.carousel .carousel-prev { left: 0; }
.carousel .carousel-next { right: 0; }

/* Single photo page */
/* Less space above the photo on wide screens (phones keep the usual 1.5rem) and below the gallery link. */
.site-main:has(> .photo) { padding: 1.5rem 0 .5rem; }
.photo { margin: 0; }
/* site.js sets --photo-room to the height of everything above the photo plus the ‹ › row
   (phones), the title, one line of the description, the gallery link and the footer, so the
   whole page fits the screen. Without JavaScript the photo takes 82% of the window. */
.photo img {
  margin: 0 auto; width: auto;
  max-height: 82vh; max-height: max(240px, calc(100svh - var(--photo-room, 18svh)));
}
.photo figcaption { margin-top: .6rem; text-align: center; }
.photo h1 { margin: 0; font-size: 1.5rem; }
.photo .caption { max-width: 40rem; margin: .3rem auto 0; color: var(--muted); }
.photo .caption p:last-child { margin-bottom: 0; }
/* ‹ › beside the photo, shaped like the lightbox buttons; the margins keep them off the photo. */
.photo-frame { position: relative; padding: 0 3.5rem; }
.photo-prev, .photo-next {
  position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; color: var(--muted); font-size: 2.2rem; font-weight: 200; line-height: 1; transition: color .2s;
}
.photo-prev:hover, .photo-next:hover { color: var(--fg-strong); }
.photo-prev { left: 0; }
.photo-next { right: 0; }
.photo-nav { margin: .75rem 0 0; text-align: center; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; }
.photo-nav a { color: var(--muted); }
.photo-nav a:hover { color: var(--fg-strong); }

/* About page */
.about { display: grid; grid-template-columns: auto minmax(0, 40rem); justify-content: center; gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.about .portrait { width: 200px; }
.text { font-size: 1.05rem; }
.text a, .teaser a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #666; }

/* Contact form */
.contact { max-width: 36rem; margin: 0 auto; }
.contact button { display: block; margin: 0 auto; }
.field { margin-bottom: 1.4rem; }
.field label { display: block; margin-bottom: .3rem; font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.contact input, .contact textarea {
  width: 100%; padding: .7rem .8rem; border: 1px solid #333; border-radius: 2px;
  background: var(--field); color: var(--fg-strong); font: inherit; transition: border-color .2s;
}
.contact input:focus, .contact textarea:focus { border-color: #888; outline: none; }
.contact [aria-invalid="true"] { border-color: var(--error); }
.error { color: var(--error); margin: .3rem 0 0; font-size: .9rem; }
.notice { text-align: center; font-family: var(--serif); font-size: 1.4rem; color: var(--fg-strong); }
.privacy { font-size: .85rem; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.back { margin-top: 2.5rem; text-align: center; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; }
.back a { color: var(--muted); }
.back-top { margin: 0 0 1.25rem; }

/* Lightbox */
html.lb-open { overflow: hidden; }
.lb {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 8, 8, .97); touch-action: pan-y pinch-zoom;
}
.lb[hidden] { display: none; }
.lb figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.lb img { max-width: 94vw; max-height: calc(100vh - 6rem); max-height: calc(100dvh - 6rem); width: auto; height: auto; user-select: none; }
.lb figcaption { padding: .9rem 1rem 0; text-align: center; color: var(--fg); font-family: var(--serif); font-size: 1.1rem; }
.lb-count { margin-left: 1rem; color: var(--muted); font-family: var(--sans); font-size: .8rem; letter-spacing: .1em; }
.lb button {
  position: absolute; width: 3rem; height: 3rem; border: 0; background: none;
  color: #bbb; font-size: 2.2rem; font-weight: 200; line-height: 1; cursor: pointer; transition: color .2s;
}
.lb button:hover { color: #fff; }
.lb-close { top: .75rem; right: .75rem; }
.lb-prev { left: .5rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: .5rem; top: 50%; transform: translateY(-50%); }

/* Tablets and phones */
@media (max-width: 900px) {
  .justified { --h: 200px; }
  .featured { --h: 280px; }
}
@media (max-width: 640px) {
  :root { --gap: 6px; }
  .site-header { align-items: flex-start; flex-direction: column; gap: 1.1rem; padding-bottom: 1rem; }
  .justified { --h: 140px; }
  .featured { --h: 230px; }
  .home-about, .about { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .home-about .actions { justify-content: center; }
  .home-about .section-label { text-align: center; }
  .gallery-cards { gap: 1.25rem .75rem; }
  .gallery-cards li { width: calc(50% - .375rem); }
  .gallery-cards img { height: 150px; max-width: 100%; object-fit: contain; object-position: center bottom; }
  .home-about .portrait, .about .portrait { width: 130px; }
  .strip { --h: 120px; }
  .carousel.is-loop { padding: 0 2rem; }
  .carousel button { width: 2rem; }
  .lb-prev, .lb-next { top: auto; bottom: .5rem; transform: none; }
  /* As in the lightbox: under the photo on phones, which leaves it the full width. */
  .photo-frame { padding: 0 0 3rem; }
  .photo-prev, .photo-next { top: auto; bottom: 0; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .thumbs img, .strip img, .gallery-cards img, .menu a { transition: none; }
}
