/* Projects page. Owner: Projects director. */
body { background: var(--c-grey); }
#main:focus { outline: none; }

/* ---------- Mobile ---------- */

.gallery {
  display: flex;
  height: calc(405 * 1.25 * var(--u)); /* a 4:5 post 405 wide, so the next one shows at the edge */
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: none; /* no grey bounce past the first and last image */
  background: var(--c-black);
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery:focus-visible { outline-offset: -4px; outline-color: var(--c-highlight); }
/* Width comes from the inline aspect-ratio of each image: never cropped, never stretched. */
.gallery__slide { flex: none; height: 100%; scroll-snap-align: start; }
.gallery__slide img { width: 100%; height: 100%; }
img.gallery__slide { width: auto; max-width: none; } /* a GIF is the slide itself: its width follows the height */

.info {
  display: grid;
  grid-template-columns: calc(23 * var(--u)) calc(102 * var(--u)) calc(50 * var(--u)) 1fr auto;
  align-items: start;
  min-height: calc(17 * var(--u));
  color: var(--c-ink-strong);
  font-family: var(--f-display); font-weight: 900; font-size: var(--fs-ui);
}
.info__year { padding-top: calc(1 * var(--u)); }
.info .info__number { align-self: stretch; padding: 0 calc(1 * var(--u)) 0 0; background: var(--c-ink-muted); color: var(--c-grey); text-align: right; }
.info__name { margin-top: calc(-2 * var(--u)); padding: 0 0 0 calc(1 * var(--u)); font: inherit; font-size: var(--fs-title); line-height: inherit; letter-spacing: var(--ls-tight); text-transform: uppercase; height: calc(19 * var(--u)); }
.info__categories { padding-bottom: calc(1 * var(--u)); }
.info__more { position: relative; padding-right: calc(2 * var(--u)); padding-left: calc(6 * var(--u)); line-height: inherit; white-space: nowrap; text-align: right; }
.info__label { text-decoration: underline; text-underline-position: from-font; }
/* Larger touch area than the drawn label */
.info__more::before { content: ""; position: absolute; inset: calc(-14 * var(--u)) 0 calc(-14 * var(--u)) calc(-4 * var(--u)); }

.about { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s ease; color: var(--c-ink-strong); font-weight: 500; }
.about.is-open { grid-template-rows: 1fr; }
.about__clip { min-height: 0; overflow: hidden; }
.about p { padding: calc(1 * var(--u)) calc(4 * var(--u)) calc(2 * var(--u)) calc(2 * var(--u)); }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  body { background: var(--c-black); }

  #projects {
    display: grid;
    grid-template-columns: calc(945 * var(--u)) minmax(0, 1fr);
    height: 100svh;
    margin-left: var(--sidebar-w);
  }

  .browser {
    position: relative;
    display: flex; flex-direction: column; justify-content: space-between; gap: calc(40 * var(--u));
    min-height: 0;
    padding: calc(253 * var(--u)) calc(60 * var(--u)) calc(345 * var(--u)) calc(40 * var(--u));
  }
  /* Second vertical line */
  .browser::after {
    content: ""; position: absolute; right: 0;
    top: calc(39 * var(--u)); bottom: calc(49 * var(--u));
    border-right: var(--line);
  }

  /* Number, name, categories. The last column starts under "Select" and only
     grows to the left when a long list of categories does not fit. */
  .browser__list {
    flex: none;
    display: grid;
    grid-template-columns: calc(82 * var(--u)) minmax(max-content, 1fr) minmax(calc(439 * var(--u)), auto);
  }
  .head, .rows, .rows__item, .rows__heading, .row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }

  .head { margin-bottom: calc(206 * var(--u)); }
  .head__title { grid-column: 1 / 3; }
  .head__select { grid-column: 3; grid-row: 1; }
  .head__steps { grid-column: 3; grid-row: 1; justify-self: end; display: flex; gap: calc(22 * var(--u)); }
  .head__steps button { display: flex; align-items: baseline; position: relative; line-height: inherit; }
  .head__steps button::before { content: ""; position: absolute; inset: -10px -3px; }
  .head__steps img { width: calc(23.38 * var(--u)); height: calc(12 * var(--u)); }
  .head__steps img.is-down { transform: rotate(180deg); }

  .rows__item { row-gap: 0; margin-bottom: calc(6 * var(--u)); }
  .rows__heading { font: inherit; letter-spacing: inherit; }
  .row {
    position: relative;
    align-items: start;
    width: 100%; min-height: calc(34 * var(--u));
    color: var(--c-ink-muted);
    font-family: var(--f-display); font-weight: 900; font-size: var(--fs-small); line-height: var(--lh);
    text-align: left;
    transition: color 0.2s ease;
  }
  .row::before { content: ""; position: absolute; inset: calc(-3 * var(--u)) 0; }
  .row__number { align-self: stretch; padding: calc(1 * var(--u)) calc(6 * var(--u)) 0 0; text-align: right; }
  .row__name { align-self: stretch; padding-left: calc(4 * var(--u)); font-size: var(--fs-title); text-transform: uppercase; }
  .row__name { padding-right: calc(20 * var(--u)); height: calc(34 * var(--u)); line-height: calc(34 * var(--u)); }
  .row__categories { align-self: stretch; padding: calc(1 * var(--u)) calc(6 * var(--u)) 0 0; }

  .row:hover { color: var(--c-text-dim); }
  .is-active .row { background: var(--c-text-dim); color: var(--c-ink-strong); }
  .is-active .row__number { background: var(--c-ink-muted); color: var(--c-text-dim); }
  .is-active .row__name { color: var(--c-black); }

  .rows__about {
    grid-column: 1 / -1;
    width: 0; min-width: 100%; /* do not let the text widen the columns */
    min-height: calc(185 * var(--u));
    padding: calc(28 * var(--u)) 0 calc(20 * var(--u));
    color: var(--c-text-dim);
    font-weight: 500;
  }

  .stage { position: relative; overflow: hidden; height: 100svh; }
  /* One column per project with all its images, one under the other, scrolled
     vertically. Each image fills the width and keeps its own proportions. */
  .stage__project {
    position: absolute; inset: 0;
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: none;
    opacity: 0; visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s;
  }
  .stage__project::-webkit-scrollbar { display: none; }
  .stage__project.is-active { opacity: 1; visibility: visible; }
  .stage__project:focus-visible { outline-offset: -4px; outline-color: var(--c-highlight); }
  .stage__image { display: block; }
  img.stage__image { width: 100%; height: auto; } /* a GIF is the image itself, not a <picture> */
  .stage__image img { width: 100%; height: auto; }
}

/* ---------- Video items ---------- */
.media { position: relative; overflow: hidden; }
.media video { display: block; width: 100%; height: 100%; object-fit: cover; }
