/*
 * Sebastiano Falcone — portfolio
 *
 * Skeleton borrowed from juliusvonbismarck.com/bank: a fixed text index on the
 * left, one column of images on the right, white ground, no ornament, and an
 * inverted black highlight on index hover.
 * Typography borrowed from the printed portfolio: EB Garamond, italic titles,
 * the English title in green under the original, a solid black dot as the
 * only mark on the page.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  --ink: #000;
  --grey: #6f6f6f;
  --grey-2: #8c8c8c;
  --rule: #e3e3e3;
  --bg: #fff;

  /* Sampled from the PDF (#afd5a0), darkened enough to be readable on screen. */
  --green: #679a55;
  --green-deep: #4c7a3d;
  --green-pale: #afd5a0;

  --nav-w: 19rem;
  --content-max: 61rem;
  --pad: 2.25rem;

  --serif: 'EB Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

@media (min-width: 1500px) {
  :root {
    --nav-w: 21.5rem;
    --pad: 3rem;
  }
}

/* -------------------------------------------------------------------- base */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.45;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

cite {
  font-style: italic;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  z-index: 200;
}

.skip:focus {
  left: 0;
}

/* ------------------------------------------------------------------- index */

.bar {
  display: none;
}

.index {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  padding: var(--pad) 1.25rem var(--pad) var(--pad);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  z-index: 20;
}

.index__name {
  font-style: italic;
  font-size: 1.0625rem;
  margin-bottom: 1.9rem;
}

.index__section {
  margin-bottom: 1.55rem;
}

.index__group {
  font-family: var(--serif);
  font-size: 0.6875rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
  margin-bottom: 0.4rem;
}

.index li {
  font-size: 0.9375rem;
  line-height: 1.42;
  margin-bottom: 0.18rem;
}

/* The inverted highlight is the one gesture the reference site allows itself. */
.index a {
  display: inline;
  padding: 0 0.22em;
  margin: 0 -0.22em;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.16em;
}

.index a:hover,
.index a:focus-visible {
  background: var(--ink);
  color: #fff;
  outline-color: var(--green);
}

.index .is-current > a,
.index__name a[aria-current] {
  text-decoration: underline;
}

.index__section--meta {
  margin-top: 2.25rem;
}

.index__bot {
  margin-top: 2.5rem;
  font-size: 0.75rem;
  color: var(--grey-2);
}

/* ----------------------------------------------------------------- content */

.exhibit {
  margin-left: var(--nav-w);
  padding: var(--pad) var(--pad) 7rem 0;
  max-width: calc(var(--content-max) + var(--pad));
}

/* -------------------------------------------------------------------- cover */

/* The cover of the printed portfolio: two words on a diagonal, one black dot. */
.cover {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.2em 0.55em;
  font-style: italic;
  /* vw, not cqw: the viewport is what the sidebar leaves room in. */
  font-size: clamp(2rem, 4.4vw, 4rem);
  line-height: 1.02;
  margin: max(3vh, 1rem) 0 clamp(4rem, 12vh, 8rem);
}

.cover__word--a {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.cover__dot {
  grid-column: 2;
  grid-row: 2;
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: var(--ink);
}

.cover__word--b {
  grid-column: 3;
  grid-row: 3;
  justify-self: start;
  text-align: right;
}

/* ------------------------------------------------------------------ index feed */

.entry {
  margin-bottom: 3.25rem;
}

.entry__link {
  display: block;
}

.entry__caption {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--grey);
}

.entry__caption cite {
  color: var(--ink);
  font-size: 0.9375rem;
}

.entry__link:hover .entry__caption cite,
.entry__link:focus-visible .entry__caption cite {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

/* ------------------------------------------------------------------- work */

.work__head {
  margin-bottom: 2.75rem;
}

.work__title {
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.75rem, 3.4vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: -0.005em;
  max-width: 22ch;
}

.work__title-en {
  font-style: italic;
  font-size: clamp(1.75rem, 3.4vw, 2.35rem);
  line-height: 1.12;
  color: var(--green);
  max-width: 24ch;
}

.work__details {
  margin-top: 0.5rem;
  font-style: italic;
  font-size: 0.8125rem;
  color: var(--grey);
}

.work__details span {
  display: block;
}

.work__text {
  margin-top: 1.6rem;
  max-width: 46ch;
  text-align: justify;
  hyphens: auto;
}

.work__text em {
  font-style: italic;
}

/* ------------------------------------------------------------------ media */

.shot {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
}

.has-js .shot {
  cursor: zoom-in;
}

.work__media--stack .shot + .shot {
  margin-top: 1.5rem;
}

/* Tight, like the contact sheets in the printed portfolio. */
.work__media--grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), 1fr);
  align-items: start;
  gap: 0.25rem;
}

/* ------------------------------------------------------------------ pager */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--grey);
}

.pager a:hover,
.pager a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.pager__next {
  text-align: right;
  margin-left: auto;
}

/* ------------------------------------------------------------------- info */

.info {
  max-width: 34rem;
}

.info__title {
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.75rem, 3.4vw, 2.35rem);
  line-height: 1.12;
}

.info__lead {
  margin-top: 1.4rem;
  max-width: 44ch;
  text-align: justify;
  hyphens: auto;
}

.info__block {
  margin-top: 2.5rem;
}

.info__block h2 {
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
  margin-bottom: 0.5rem;
}

/* Each entry is a title line plus one or two grey lines under it. */
.info__block li {
  margin-bottom: 1rem;
  line-height: 1.3;
}

.info__block li:last-child {
  margin-bottom: 0;
}

/* Contact: one line per entry, so it does not need the entry spacing. */
.info__block--tight li {
  margin-bottom: 0.3rem;
}

.info__block li span {
  display: block;
  color: var(--grey);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.info__block a {
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--green-pale);
  text-decoration-thickness: 1px;
}

.info__block a:hover {
  text-decoration-color: var(--ink);
}

/* --------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.975);
  visibility: hidden;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.28s, transform 0.28s, visibility 0.28s;
}

.lightbox[data-open] {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.lightbox__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 5.5rem 0;
}

.lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox__foot {
  flex: none;
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  padding: 1rem 1.5rem 1.6rem;
  font-size: 0.8125rem;
  color: var(--grey);
}

.lightbox__count {
  font-variant-numeric: tabular-nums;
}

.lightbox button {
  border: 0;
  background: none;
  font: inherit;
  color: var(--grey);
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s;
}

.lightbox button:hover {
  color: var(--ink);
}

.lightbox__close {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  font-size: 1.5rem !important;
}

.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5.5rem;
  font-size: 1.5rem !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__prev {
  left: 0;
}

.lightbox__next {
  right: 0;
}

.lightbox button[hidden] {
  display: none;
}

body.is-locked {
  overflow: hidden;
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 900px) {
  :root {
    --pad: 1.25rem;
  }

  .bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 0.95rem var(--pad);
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
  }

  .bar__name {
    font-style: italic;
    font-size: 1.0625rem;
  }

  .bar__toggle {
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--grey);
    padding: 0.25rem 0;
    cursor: pointer;
  }

  .bar__toggle[aria-expanded='true'] {
    color: var(--ink);
  }

  .index {
    position: static;
    width: auto;
    padding: 1.5rem var(--pad) 2rem;
    border-bottom: 1px solid var(--rule);
  }

  /* Collapsed only once the toggle exists, so the list stays reachable without JS. */
  .has-js .index {
    display: none;
  }

  .has-js .index.is-open {
    display: block;
  }

  .index__name {
    display: none;
  }

  .index li {
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }

  .exhibit {
    margin-left: 0;
    padding: 1.75rem var(--pad) 4.5rem;
    max-width: none;
  }

  /* Not enough width for the diagonal: keep the dot beside "Portfolio"
     and drop the name to its own line, still ranged right. */
  .cover {
    grid-template-columns: auto auto 1fr;
    gap: 0.12em 0.4em;
    font-size: clamp(1.9rem, 9vw, 3rem);
    margin: 0.5rem 0 3.25rem;
  }

  .cover__word--a {
    grid-column: 1;
    justify-self: start;
  }

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

  .cover__word--b {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
  }

  .entry {
    margin-bottom: 2.5rem;
  }

  .work__media--grid {
    grid-template-columns: repeat(min(var(--cols, 2), 2), 1fr);
  }

  .lightbox__stage {
    padding: 3.5rem 1rem 0;
  }

  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: 0;
    width: 4rem;
    height: 3.6rem;
  }
}

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

@media print {
  .index,
  .bar,
  .pager,
  .lightbox {
    display: none !important;
  }

  .exhibit {
    margin: 0;
    padding: 0;
  }
}
