/* =========================================================
   Lester Lyons-Hookham — site styles
   Palette: cream / near-black / blue accent (functional only)
   Type: Aktiv Grotesk (display/UI) + LTC Caslon Pro (editorial)
   Aktiv Grotesk weights in use: 400 and 700 only.
   ========================================================= */

:root {
  --cream: #F1EFE8;
  --ink: #2C2C2A;
  --gray-1: #5F5E5A;
  --gray-2: #888780;
  --rule: #B4B2A9;
  --accent: #3E75FF;
  --scrim: rgba(20, 18, 14, 0.38);

  --sans: aktiv-grotesk, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: ltc-caslon-pro, "Libre Caslon Text", Georgia, serif;

  --index-size: 22px;
  --margin: 24px;
  --gutter: 16px;
  --fade: 320ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px var(--margin);
  font-size: 13px;
  transition: color var(--fade);
}
.nav__links { display: flex; gap: 18px; }
.nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
main { padding: 72px var(--margin) 64px; position: relative; z-index: 1; }

/* ---------- Full-bleed hero layer (homepage hover / tap) ---------- */
.hero {
  position: fixed; inset: 0; z-index: 0;
  opacity: 0; pointer-events: none;
  transition: opacity var(--fade);
}
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero__scrim { position: absolute; inset: 0; background: var(--scrim); }
body.has-hero .hero { opacity: 1; }
body.has-hero .nav { color: var(--cream); }

/* ---------- Homepage index ---------- */
.index { max-width: 900px; }
.index__cat { border-bottom: 0.5px solid var(--rule); transition: border-color var(--fade); }
.index__cat:first-child { border-top: 0.5px solid var(--rule); }
.index__head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 0; text-align: left;
  font-size: var(--index-size); line-height: 1.2;
}
.index__dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent);
  opacity: 0; transform: scale(.4);
  transition: opacity 200ms ease, transform 200ms ease;
}
.index__label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.01em; }
.index__count { font-size: 13px; color: var(--accent); align-self: flex-start; margin-top: 2px; }
.index__chev { width: 18px; height: 18px; flex: none; margin-left: auto; color: var(--accent); transition: transform 240ms ease; }
.index__head[aria-expanded="true"] .index__dot { opacity: 1; transform: none; }
.index__head[aria-expanded="true"] .index__chev { transform: rotate(180deg); }

.index__panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 280ms ease;
}
.index__panel > * { overflow: hidden; min-height: 0; }
.index__cat.is-open .index__panel { grid-template-rows: 1fr; }
.index__list { padding-left: 17px; }
.index__list li:last-child { padding-bottom: 10px; }
.index__item {
  display: inline-block; padding: 5px 0;
  font-size: var(--index-size); line-height: 1.2;
  transition: color var(--fade), opacity var(--fade);
}
.index__item--more { color: var(--gray-2); }
@media (hover: hover) {
  .index__item:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
  body:not(.has-hero) .index__item--more:hover { color: var(--ink); }
}

/* Over a hero image: everything goes cream; hovered title full strength */
body.has-hero .index { color: var(--cream); }
body.has-hero .index__cat { border-color: rgba(241, 239, 232, 0.35); }
body.has-hero .index__item { color: var(--cream); }
body.has-hero.is-hovering .index__item { opacity: 0.55; }
body.has-hero .index__item.is-active { opacity: 1; }

/* Mobile tap splash: only the tapped title remains, in place */
body.is-splash .nav,
body.is-splash .index__head,
body.is-splash .index__cat,
body.is-splash .index__item:not(.is-active) { color: transparent !important; border-color: transparent !important; }
body.is-splash .index__dot, body.is-splash .index__chev, body.is-splash .index__count { opacity: 0 !important; }
body.is-splash .index__item.is-active { opacity: 1; color: #fff; }

/* ---------- Project page ---------- */
.project__head { margin: 0 0 40px; max-width: 900px; }
.project__cat { margin: 0 0 4px; font-size: 13px; color: var(--gray-2); }
.project__title { margin: 0; font-size: var(--index-size); font-weight: 700; line-height: 1.2; }
.project__foot {
  display: flex; justify-content: space-between; gap: 24px;
  margin-top: 80px; padding-top: 12px;
  border-top: 0.5px solid var(--rule); font-size: 13px;
}
.project__foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Collage grid (12 columns) ----------
   Container query, not media query, so the CMS preview pane
   shows the real desktop layout even when it is narrow. */
.collage-wrap { container-type: inline-size; }
.collage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--gutter);
  align-items: start;
}
.item { min-width: 0; }
.item figure { margin: 0; }
.item__frame { background: rgba(44, 44, 42, 0.06); }
.item img { width: 100%; height: auto; }
figcaption {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 14px; color: var(--gray-1);
}

/* Row span: image stretches to the height of the rows beside it, cropped to fit */
.item--span { align-self: stretch; }
.item--span figure { height: 100%; display: flex; flex-direction: column; }
.item--span .item__frame { position: relative; flex: 1; min-height: 240px; }
.item--span .item__frame img { position: absolute; inset: 0; height: 100%; object-fit: cover; }

.prose { font-family: var(--sans); font-size: 18px; line-height: 1.45; letter-spacing: -0.005em; }
.prose p { margin: 0 0 0.8em; }
.prose p:last-child { margin-bottom: 0; }
.prose--credits {
  font-family: var(--sans);
  font-size: 13px; line-height: 1.55;
  color: var(--gray-1);
}
.prose--credits p { margin: 0 0 1.1em; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.video { position: relative; aspect-ratio: 16 / 9; background: var(--ink); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .item__empty { color: var(--rule); border: 0; }

.meta { margin: 0; font-size: 15px; line-height: 1.5; }
.meta div { display: flex; gap: 12px; }
.meta dt { width: 4.5em; color: var(--gray-2); flex: none; }
.meta dd { margin: 0; }

.item__empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px; height: 100%;
  border: 0.5px dashed var(--rule); color: var(--gray-2); font-size: 13px;
}

@container (max-width: 700px) {
  .collage { row-gap: 12px; }
  .collage > .item { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .item--span .item__frame { position: static; }
  .item--span .item__frame img { position: static; height: auto; }
}

/* Column guides (CMS preview only) */
.guides {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
}
.guides span {
  background: rgba(62, 117, 255, 0.06);
  border-left: 1px solid rgba(62, 117, 255, 0.35);
  font-size: 11px; color: var(--accent); padding: 2px 4px;
}
.guides span:last-child { border-right: 1px solid rgba(62, 117, 255, 0.35); }

/* ---------- Writing sub-index ---------- */
.writing { max-width: 1100px; }
.writing__head { margin: 0 0 16px; font-size: var(--index-size); font-weight: 700; text-transform: uppercase; }
.writing__list { border-top: 0.5px solid var(--rule); }
.writing__list li { border-bottom: 0.5px solid var(--rule); }
.post {
  position: relative;
  display: grid; grid-template-columns: 11em 1fr auto; gap: 16px; align-items: baseline;
  padding: 10px 0;
}
.post__date, .post__time { font-size: 13px; color: var(--gray-2); }
.post__title { font-size: var(--index-size); line-height: 1.2; }
.post__thumb {
  position: absolute; right: 5em; top: 50%; z-index: 2;
  width: 220px; transform: translateY(-50%);
  opacity: 0; pointer-events: none;
  transition: opacity 260ms ease;
}
@media (hover: hover) {
  .post:hover .post__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
  .post:hover .post__thumb { opacity: 1; }
}
@media (hover: none), (max-width: 700px) {
  .post__thumb { display: none; }
}

/* ---------- Info ---------- */
.info { max-width: none; }
.prose strong { font-weight: 700; }
.prose--credits strong { color: var(--ink); }

/* ---------- Small screens ---------- */
@media (max-width: 700px) {
  :root { --margin: 16px; }
  main { padding-top: 60px; }
  .nav { padding: 14px var(--margin); }
  .nav__name { max-width: 50%; }
  .post { grid-template-columns: 1fr auto; row-gap: 2px; }
  .post__date { grid-column: 1 / -1; }
}

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

/* Nav stays fixed only on the homepage index (where the hero sits behind it);
   elsewhere it scrolls away with the page instead of overlapping content. */
body:not(.is-index) .nav { position: absolute; }

/* ---------- Homepage INFO section ---------- */
.index__info > .collage-wrap { padding: 6px 0 22px 17px; }
.index__info .prose { color: inherit; }
body.has-hero .index__info .prose--credits { color: rgba(241, 239, 232, 0.78); }
body.has-hero .index__info .prose--credits strong { color: var(--cream); }
.index__info a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- Photo sequence (left ↔ right) ---------- */
.gallery { --gh: calc(100svh - 280px); position: relative; }
.gallery--large  { --gh: 72svh; }
.gallery--medium { --gh: 50svh; }

.gallery__track {
  position: relative;
  display: flex; align-items: flex-start; gap: var(--gallery-gap, var(--gutter));
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  outline: none;
}
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide { flex: none; margin: 0; scroll-snap-align: start; }
.gallery__slide img {
  display: block;
  height: auto; width: auto;
  max-height: max(260px, var(--gh));
  max-width: 100%;
  background: rgba(44, 44, 42, 0.06);
}
/* Reserve each photo's space before it loads (width/height attributes) */
.gallery__slide img[width][height] { height: max(260px, var(--gh)); max-width: none; aspect-ratio: auto; }
.gallery__slide figcaption { max-width: 40ch; }

/* Edge to edge of the window when the block spans columns 1 → 13 */
.item--bleed { margin-left: calc(-1 * var(--margin)); margin-right: calc(-1 * var(--margin)); }
.item--bleed .gallery__track { padding: 0 var(--margin); scroll-padding-inline: var(--margin); }
.item--bleed .gallery__bar { padding: 0 var(--margin); }

.gallery__bar {
  display: flex; align-items: center; gap: 14px;
  margin-top: 12px; font-size: 13px; color: var(--gray-2);
}
.gallery__count { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: center; }
.gallery__btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  color: var(--accent); border-radius: 50%;
  transition: opacity 160ms ease, background-color 160ms ease;
}
.gallery__btn svg { width: 18px; height: 18px; }
.gallery__btn:hover:not(:disabled) { background: rgba(62, 117, 255, 0.08); }
.gallery__btn:disabled { opacity: 0.25; cursor: default; }
.gallery__btn:focus-visible, .gallery__track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 700px) {
  /* Phones: each photo as large as the screen allows — portraits fill the height,
     landscapes fill the width — centred on one line so the strip still reads cleanly */
  .gallery, .gallery--large { --gh: 64svh; }
  .gallery--medium { --gh: 44svh; }
  .gallery__track { align-items: center; }
  .gallery__slide img,
  .gallery__slide img[width][height] {
    width: auto; height: auto;
    max-height: var(--gh);
    max-width: calc(100vw - 2 * var(--margin));
  }
}
}
