:root {
  --background: #ffffff;
  --foreground: #0b0b0b;
  --border: #dad6d7;
  --muted: #6b6b6b;
  --maxw: 64rem;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Lora", ui-serif, Georgia, "Times New Roman", serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
}
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 640px) {
  .wrap { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* ---------- Header ---------- */
header.site { position: relative; z-index: 50; }
header.site .wrap {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

/* Name on the left of the menu, links back to the homepage */
.brand {
  color: var(--foreground);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.25;
}
.brand-name {
  display: block;
  font-size: 1.1875rem;
}
.brand:hover { opacity: 0.7; }

/* Main menu. Scoped to the header so the tables of contents
   (also <nav> elements) keep their own left-aligned style. */
header.site nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
header.site nav a {
  color: var(--muted);
  text-decoration: none;
}
header.site nav a:hover { color: var(--foreground); }
header.site nav a.active { color: var(--foreground); }

/* On wider screens the menu becomes a column down the left-hand side */
@media (min-width: 900px) {
  body { padding-left: 13rem; }
  header.site {
    position: fixed;
    top: 0;
    left: 0;
    width: 13rem;
    padding: 2.5rem 1.25rem;
    /* only as tall as the menu itself - a full-height panel would cover
       the footer line and the copyright underneath it */
  }
  header.site .wrap {
    display: block;
    max-width: none;
    padding: 0;
  }
  header.site nav {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.6rem;
    margin-top: 1.75rem;
  }
}

/* Page padding sits on <main>, so the blocks inside a page
   (title, photo, text, gallery) sit close together. */
main {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}
@media (min-width: 640px) {
  main { padding-top: 3rem; }
}

h1 {
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 1.5rem;
}
@media (min-width: 640px) {
  h1 { font-size: 2.25rem; }
}
h2 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 1rem;
}
/* Year / collaborator in brackets after a heading */
.note {
  color: var(--muted);
  font-size: 1rem;
}
h1 .note { font-size: 1.125rem; }
/* Text stays at a comfortable reading measure (~100 characters) while
   the photo galleries below it use the full width of the page. */
p {
  font-size: 17px;
  line-height: 1.625;
  margin: 0 0 1.25rem;
  max-width: 100ch;
}
a.inline {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.inline:hover { text-decoration: none; }

.meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* ---------- Table of contents (Shown & Published) ---------- */
.toc {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  margin: 0 0 3.5rem;
}
/* The Stories and Portfolio lists carry no lines */
.story-index .toc {
  border: 0;
  padding: 0;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 15px;
  text-align: left;
}
.toc li + li { margin-top: 0.5rem; }
.toc a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.toc a:hover { text-decoration: none; }

article.project {
  margin-bottom: 3.5rem;
  padding-bottom: 3.5rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1.5rem;
}
article.project:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ---------- Stories page ----------
   A list of story names; hovering a name shows that story's first photo beside it. */
.story-index { position: relative; }
.story-index .toc { margin-bottom: 0; }
.story-index .toc .note { font-size: 0.8125rem; }
.story-peek { display: none; }
@media (min-width: 760px) and (hover: hover) {
  .story-index { min-height: 70vh; }
  .story-index .toc { width: 40%; }
  .story-peek {
    position: absolute;
    top: 0;
    right: 0;
    width: 56%;
    height: 70vh;
    object-fit: contain;          /* whole photo, never cropped */
    object-position: top center;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .story-index li:hover .story-peek,
  .story-index li:focus-within .story-peek { display: block; }
}

/* Link back to all stories, and on to the next one */
.crumb {
  font-size: 0.875rem;
  margin: 0 0 1rem;
}
.crumb a {
  color: var(--muted);
  text-decoration: none;
}
.crumb a:hover { color: var(--foreground); }
.next-story {
  margin: 4rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  max-width: none;
}
.next-story a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.next-story a:hover { text-decoration: none; }

/* ---------- Music player (In between dreams) ---------- */
.listen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
  margin: 1.75rem 0 0.5rem;
}
.listen-player {
  /* 200px is the smallest YouTube's terms allow an embedded player to be */
  width: 200px;
  max-width: 100%;
  height: 200px;
  background: #f4f4f4;
}
.listen-player iframe,
.listen-player #yt-player {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
/* Shown instead of the player when YouTube can't play in the page */
.listen-fallback {
  display: block;
  width: 100%;
  height: 100%;
  background: #111 center / cover no-repeat;
}
/* Invitation line leads; the track name sits quietly under it */
.listen-info .meta {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  color: var(--foreground);
}
.listen-title {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.listen-toggle,
.listen-float {
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--foreground);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
}
.listen-toggle:hover,
.listen-float:hover {
  background: var(--foreground);
  color: var(--background);
}
.listen-toggle:disabled {
  opacity: 0.4;
  cursor: default;
}
.listen-toggle:disabled:hover {
  background: var(--background);
  color: var(--foreground);
}
.listen-float {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 90;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.listen-float[hidden] { display: none; }

/* ---------- Photo galleries ---------- */
.gallery { margin: 2rem 0 0; }

/* Story and Portfolio galleries run the full width of the window,
   with only a slim edge so photos don't touch the screen border */
.bleed {
  padding: 0 1rem;
  margin: 3rem 0;      /* a third less space around photos than before */
}
@media (min-width: 640px) {
  .bleed { padding: 0 1.25rem; }
}
.bleed .gallery { margin-top: 0; }

/* The first photo of a story, shown above the text */
.gallery.hero { margin: 0 0 1rem; }
.gallery.hero .module,
.gallery.hero .module.solo { grid-template-columns: 1fr; }
.gallery.hero .feature { justify-content: center; }
.gallery.hero .feature .photo img { max-height: 85vh; }
.photo {
  display: block;
  cursor: zoom-in;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.photo:hover img { opacity: 0.92; }
.photo:focus-visible { outline: 2px solid var(--foreground); outline-offset: 2px; }

/* Default: one large photo beside four smaller ones, then the other way round.
   Photos keep their own shape - verticals and landscapes sit side by side uncropped. */
.module {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.module + .module { margin-top: 2.5rem; }
@media (min-width: 760px) {
  .module {
    grid-template-columns: 7fr 5fr;
    gap: 2.5rem;
    align-items: start;
  }
  .module.flip { grid-template-columns: 5fr 7fr; }
  .module.flip .feature { order: 2; justify-content: flex-end; }
  /* A photo on its own keeps the size of a large photo elsewhere,
     rather than stretching across the whole page */
  .module.solo.flip { grid-template-columns: 7fr 5fr; }
  .module.solo.flip .feature { order: 0; justify-content: flex-start; }
  .module + .module { margin-top: 4rem; }
}
.feature { display: flex; }
.feature .photo { flex: 0 1 auto; }
.feature .photo img {
  width: auto;
  max-width: 100%;
  max-height: 80vh;            /* a tall photo shouldn't take more than a screen */
}
.smalls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 1.25rem;
  align-items: start;
}
.smalls:empty { display: none; }

/* Pairs: one pair per row, both at one height, centred */
.pairs {
  --pair-height: min(260px, 45vh);
  --pair-gap: 0.5rem;
}
@media (min-width: 640px) {
  .pairs {
    --pair-height: min(640px, 78vh);
    --pair-gap: 1.25rem;
  }
}
.pair {
  display: flex;
  gap: var(--pair-gap);
  max-width: calc(var(--sum, 2) * var(--pair-height) + var(--pair-gap));
  margin: 0 auto;
}
.pair + .pair { margin-top: 2rem; }
@media (min-width: 640px) {
  .pair + .pair { margin-top: 3.5rem; }
}
.pair .photo { flex: var(--ratio) 1 0; }

/* Clouds: one loose cluster of photos per photographer, side by side */
.gallery.clouds {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3.5rem;
}
@media (min-width: 760px) {
  .gallery.clouds {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
  }
}
.cloud-name {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  margin: 0 auto 1.5rem;
}
.cloud-photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.75rem 1rem;
}
.cloud-photos .photo { flex: 0 0 auto; }
/* Six sizes and small vertical shifts, repeating, so the cluster feels loose */
.cloud-photos .c0 { width: 60%; }
.cloud-photos .c1 { width: 32%; transform: translateY(0.75rem); }
.cloud-photos .c2 { width: 40%; transform: translateY(-0.5rem); }
.cloud-photos .c3 { width: 52%; }
.cloud-photos .c4 { width: 30%; transform: translateY(-0.75rem); }
.cloud-photos .c5 { width: 46%; transform: translateY(0.5rem); }

/* ---------- Larger view ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem;
}
.lightbox[hidden] { display: none; }
@media (min-width: 640px) {
  .lightbox { padding: 3.5rem 5rem; }
}
.lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  width: auto;
  height: auto;
  cursor: zoom-out;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  line-height: 1;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.lightbox button:hover { color: var(--foreground); }
.lb-close { top: 0.75rem; right: 0.75rem; font-size: 2rem; }
.lb-prev,
.lb-next { top: 50%; transform: translateY(-50%); font-size: 2.75rem; }
.lb-prev { left: 0; }
.lb-next { right: 0; }
@media (min-width: 640px) {
  .lb-prev { left: 1rem; }
  .lb-next { right: 1rem; }
}
.lb-count {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}
body.lb-open { overflow: hidden; }

/* ---------- Homepage: one photo, click for another ---------- */
/* The photo sits in the middle of the page, across and down */
main.home {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
main.home .wrap {
  max-width: none;          /* not held to the content column */
  text-align: center;
}
/* Centred on the window itself, not on the space beside the menu.
   Kept narrow enough that it never slides under the menu column. */
@media (min-width: 900px) {
  main.home { margin-left: -13rem; }
  .home-photo img { max-width: calc(100vw - 28rem); }
}
.home-photo img {
  display: block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 15rem);   /* as big as fits with the footer on one screen */
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Instagram link below the homepage photos */
.social {
  display: inline-block;
  color: var(--muted);
  margin-top: 1.5rem;
  line-height: 0;
}
.social:hover { color: var(--foreground); }

/* Portrait above the About text - lined up with the left edge of the text */
.lead-photo {
  display: block;
  width: 42%;
  height: auto;
  margin: 0 0 2.5rem;
}

/* Photos on the page shouldn't be casually saved or dragged */
.lead-photo {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

footer.site {
  border-top: 1px solid var(--border);
  margin-top: 3rem;             /* sits lower down the page */
}
/* The homepage holds to one screen: photo, link and footer all visible */
main.home + footer.site { margin-top: 0; }
footer.site .wrap {
  padding-top: 2rem;
  padding-bottom: 2rem;
  font-size: 0.75rem;
  color: var(--muted);
}
/* The line runs the full width, right to the left edge, and the copyright
   lines up with the menu */
@media (min-width: 900px) {
  footer.site { margin-left: -13rem; }
  footer.site .wrap {
    max-width: none;
    padding-left: 1.25rem;
  }
}
