

:root {
  --ink: #000;
  --ink-soft: #383838;
  --paper: #ffffff;
  --rule: #dadada;

  --type: "garamond-premier-pro-caption", "Garamond Premier Pro Caption", Garamond, "Times New Roman", serif;
  --size: 17px;
  --track: -.1px;

  --gutter: 30px;
  --gutter-sm: 20px;

  --fade: 260ms;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--type);
  font-size: var(--size);
  font-weight: 400;
  line-height: 26px;
  letter-spacing: var(--track);
}

img {
  display: block;
}

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

/* Shared text link, used for real links and for button-links alike ---------- */

.link,
.site-nav__caption a,
.index__link,
.info__about a,
.index__contact-list a,
.info__coda a {
  font: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0 0 0 0;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.info__coda a {
  border-bottom: 0;
}

.link:hover,
.site-nav__caption a:hover,
.info__about a:hover,
.index__contact-list a:hover,
.info__coda a:hover {
  color: #626262;
}

.link:focus-visible,
.site-nav__caption a:focus-visible,
.index__link:focus-visible,
.info__about a:focus-visible,
.index__contact-list a:focus-visible,
.info__coda a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  border-bottom-color: transparent;
}

/* ---------------------------------------------------------------------------
   Global nav — name, caption and Index on one baseline, shared by both pages
   --------------------------------------------------------------------------- */

.site-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  background-color: transparent;
  display: grid;
  grid-template-columns: 160px auto 160px;
  align-items: flex-end;
  column-gap: var(--gutter);
  padding: 25px 60px;
  /* Empty parts of the strip must not block the photograph or Index rows. */
  pointer-events: none;
}

.site-nav a {
  pointer-events: auto;
}

/* Name, Index, Info: no underline. Caption title keeps the shared link rule. */
.site-nav__name a,
.site-nav__name a:hover,
.site-nav__name a:focus-visible,
.site-nav__links a,
.site-nav__links a:hover,
.site-nav__links a:focus-visible {
  border-bottom: 0;
  padding-bottom: 0;
}

.site-nav__name,
.site-nav__caption,
.site-nav__links {
  margin: 0;
}

.site-nav__name {
  justify-self: start;
}

.site-nav__caption {
  justify-self: center;
  text-align: center;
  text-wrap: pretty;
}

/* Caption: NAME / for Title written by NAME
   Photo Booth: AUTHOR / on Title */
.credit__name {
  font-size: calc(1em - 1pt);
  text-transform: uppercase;
  letter-spacing: .1px;
}

.credit__photographer,
.credit__rest {
  display: block;
}

.credit__join {
  font-style: italic;
  text-transform: none;
  letter-spacing: normal;
}

.site-nav__links {
  justify-self: end;
  display: flex;
  gap: 1em;
}

/* On the Index page the credit line has nowhere to live. */
body:has(#viewer[hidden]) .site-nav__caption {
  visibility: hidden;
}

/* Desktop viewer: the foot strip must catch clicks so prev/next underneath
   do not fire. Index keeps pointer-events: none so empty nav stays pass-through. */
@media (min-width: 56.01rem) {
  body:not(:has(#viewer[hidden])) .site-nav {
    pointer-events: auto;
  }
}

/* ---------------------------------------------------------------------------
   Viewer
   --------------------------------------------------------------------------- */

.viewer {
  position: relative;
  /* A fixed height, not a minimum, so the picture row is bounded by the
     window and the photograph can be scaled down to fit inside it. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 25px 60px;
  /* Leave the bottom free for the shared nav (name / caption / Index). */
  padding-bottom: 4.5rem;
}

.viewer__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Fill the picture area rather than the photograph's own height, so that
     max-height on the image has a real number to measure against. */
  height: 100%;
  min-height: 0;
  padding: 80px 0;
}

.viewer__photo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  opacity: 1;
  transition: opacity var(--fade) ease;
}

.viewer.is-changing .viewer__photo {
  opacity: 0;
}

/* Click halves. Nothing visible, but the cursor announces them on hover. ---- */

.viewer__step {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 1;
  padding: 0;
  border: 0;
  background: transparent;
  /* Without this, tapping darkens half the window on iOS. */
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.viewer__step--prev {
  left: 0;
  cursor: w-resize;
}

.viewer__step--next {
  right: 0;
  cursor: e-resize;
}

.viewer__step:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -2px;
}

/* ---------------------------------------------------------------------------
   Index — a normal scrolling page, not an overlay on the viewer
   --------------------------------------------------------------------------- */

.index {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 100px 60px 25px 60px;
  /* Clear the fixed nav at the foot of the window. */
  padding-bottom: 5rem;
  background: var(--paper);
}

.index[hidden],
.info[hidden],
.viewer[hidden] {
  display: none;
}

.index__body {
  max-width: 100rem;
}

.index__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.index__head,
.index__row {
  display: grid;
  grid-template-columns:
    minmax(8rem, 1fr)
    minmax(0, 2fr)
    minmax(6rem, 1fr);
  gap: var(--gutter);
  align-items: baseline;
}

/* On wide screens the wrapper dissolves so photographer / story / writer
   still fill the three columns. Mobile turns it into a single text stack. */
.index__text {
  display: contents;
}

.index__lede {
  margin: 0 0 30px;
}

.index__head {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #626262;
}

.index__row {
  position: relative;
  padding: 0;
}

/* Pointing at a row leaves it black and fades every other row.
   Touch / coarse pointers skip this so a tap does not leave rows grey. */
@media (hover: hover) and (pointer: fine) {
  .index__list:has(.index__row:hover) .index__row:not(:hover),
  .index__list:has(.index__row:focus-within) .index__row:not(:focus-within) {
    color: #626262;
  }

  .index__list:has(.index__row:hover) .index__row:not(:hover) .index__link,
  .index__list:has(.index__row:focus-within) .index__row:not(:focus-within) .index__link {
    color: #626262;
  }

  .index__link:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
  }
}

/* An invisible link over the whole row: pointing anywhere and clicking opens
   the photograph. The headline sits above it and still reaches the article. */
.index__open {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.index__open:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.index__link {
  position: relative;
  z-index: 1;
}

/* Per-row thumbs are for the stacked mobile layout; desktop uses the preview. */
.index__thumb {
  display: none;
}

/* The hovered photograph, in its own column to the left of the table.
   Hidden until there is room for it — see the wide-screen block below. */
.index__preview {
  display: none;
}

.index__preview-image {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  opacity: 0;
  transition: opacity 180ms ease;
}

.index__preview.is-visible .index__preview-image {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   Info — bio and contact
   --------------------------------------------------------------------------- */

.info {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 25px 60px;
  /* Clear the fixed coda + nav at the foot of the window. */
  padding-bottom: 7rem;
  background: var(--paper);
}

.info__about {
  max-width: 34rem;
  text-wrap: pretty;
}

.info__codas {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  padding: 25px 60px;
  max-width: none;
  /* Sit in the same foot strip as the nav; links stay clickable above. */
  pointer-events: none;
}

.info__coda {
  margin: 0;
  max-width: 34rem;
  font-size: 15px;
  color: #626262;
  pointer-events: auto;
}

.index__bio {
  margin: 0;
}

.index__bio p {
  margin: 0;
}

.index__bio p + p {
  margin-top: 1em;
}

.index__bio em,
.index__bio a {
  white-space: nowrap;
}

/* Letter-style sign-off under the bio. */
.index__signoff {
  margin: 1.5em 0 0;
}

.index__invite {
  margin: 0 0 0.75em;
}

.index__contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.index__contact-list li {
  margin: 0;
}

.index__bullet {
  display: inline-block;
  width: 0.85em;
  height: 0.75em;
  margin-right: 0.35em;
  vertical-align: -0.05em;
}

.noscript {
  padding: var(--gutter);
}

/* ---------------------------------------------------------------------------
   Narrow viewports — stacked Index, caption under the photograph
   --------------------------------------------------------------------------- */

@media (max-width: 60rem) {

  /* Name and Index at the top; caption stays at the foot of the photograph.
     Prefer this over squeezing the side columns of the desktop nav. */
  .site-nav {
    top: 0;
    bottom: auto;
    display: flex;
    justify-content: space-between;
    padding: var(--gutter);
  }

  .site-nav__caption {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    justify-self: stretch;
    padding: var(--gutter);
  }

  /* One flowing credit line (desktop keeps photographer on its own row). */
  .credit__photographer,
  .credit__rest {
    display: inline;
  }

  .viewer {
    padding: var(--gutter);
    padding-top: 4rem;
    padding-bottom: 5.2rem;
  }

  .info {
    padding: var(--gutter);
    padding-top: 4rem;
    padding-bottom: 6rem;
  }

  .info__codas {
    /* Mobile nav is at the top; coda stays at the foot. */
    padding: var(--gutter);
  }

  .viewer__stage {
    padding: 0;
  }

  /* Tap zones stop short of the caption and the top nav. */
  .viewer__step {
    top: 3rem;
    bottom: 7rem;
  }

  .index {
    padding: var(--gutter);
    padding-top: 4rem;
    padding-bottom: var(--gutter);
  }

  .index__row {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--gutter-sm);
    /* One text column, so wrapped titles and missing authors share one rhythm. */
    grid-template-rows: auto;
    align-items: center;
    border-bottom: 1px solid var(--rule);
    padding: 10px 0;
  }

  .index__text {
    display: block;
    grid-column: 1;
    grid-row: 1;
    /* Block flow + one line-height: wrapped titles and 2/3-line stacks share
       the same spacing, with no extra gap when the author line is missing. */
    line-height: 1.5;
  }

  .index__photographer,
  .index__story,
  .index__link {
    display: block;
    margin: 0;
    padding: 0;
    line-height: inherit;
    border-bottom: 0;
  }

  /* Article URLs stay desktop-only; a tap opens the photograph instead. */
  .index__link {
    pointer-events: none;
  }

  /* Mobile Index keeps the smaller uppercase photographer line. */
  .index__photographer {
    font-size: calc(1em - 1pt);
    text-transform: uppercase;
    letter-spacing: .1px;
  }

  .index__thumb {
    display: block;
    grid-column: 2;
    grid-row: 1;
    width: 88px;
    height: 88px;
    object-fit: cover;
    object-position: center;
  }

  /* Headings cannot label lines that no longer sit in columns. */
  .index__head {
    display: none;
  }

  .index__writer {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Phones — tighter gutters
   --------------------------------------------------------------------------- */

@media (max-width: 40rem) {

  body {
    font-size: 17px;
    line-height: 24px;
    letter-spacing: 0;
  }

  .site-nav__caption {
    text-align: left;
  }

  .site-nav {
    background-color: #ffffff;
  }

  .site-nav,
  .site-nav__caption {
    padding: 15px 20px;
  }

  .viewer {
    padding: var(--gutter-sm);
    padding-top: 50px;
    padding-bottom: 90px;
  }

  .index {
    padding: var(--gutter-sm);
    padding-top: 4rem;
    padding-bottom: var(--gutter-sm);
  }

  .info {
    padding: var(--gutter-sm);
    padding-top: 4rem;
    padding-bottom: 5.5rem;
  }

  .info__codas {
    padding: var(--gutter-sm);
  }
}

/* ---------------------------------------------------------------------------
   Wide enough for the table and a preview of the hovered photograph
   --------------------------------------------------------------------------- */

@media (min-width: 70rem) {

  .index__body {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    column-gap: var(--gutter);
    align-items: start;
  }

  /* Sit beside the first row; stay put while the list scrolls. */
  .index__preview {
    display: block;
    position: sticky;
    top: 164px;
    grid-column: 1;
    grid-row: 1;
  }

  .index__table {
    grid-column: 2;
    grid-row: 1;
  }

  /* Align with the Index table column (past the preview gutter). */
  .info {
    padding-left: calc(60px + 16rem + var(--gutter) * 2);
  }

  .info__codas {
    padding-left: calc(60px + 16rem + var(--gutter) * 2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .viewer__photo,
  .index__preview-image {
    transition: none;
  }
}
