/* Fonts: Cormorant Garamond and Inter (SIL Open Font License), self-hosted, latin subset. */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/cormorant-garamond-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/cormorant-garamond-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
  --color-ground: #f5f0e6;
  --color-surface: #fffcf6;
  --color-ink: #0b1d2e;
  --color-ink-muted: #6b645b;
  --color-rule: #dacfbe;
  --color-accent: #a97e36;
  --color-accent-soft: #d5b878;
  --color-on-image: #f7f0e6;
  --color-scrim: #06121f;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --tracking-label: 0.18em;
  --gap: 12px;
  --page: clamp(16px, 4.4vw, 64px);
  --content: 1760px; /* widest the grid gets; the hero lines up with it */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-ground);
  color: var(--color-ink-muted);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
p, h1, h2, figure { margin: 0; }

.kicker {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1;
  color: var(--color-accent);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 38% 62%;
  min-height: min(760px, 88vh);
  max-width: calc(var(--content) + 2 * var(--page));
  margin-inline: auto;
  padding-left: var(--page);
  border-bottom: 1px solid var(--color-rule);
}
.hero-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 96px 56px 120px 0;
}
.hero h1 {
  margin-top: 22px;
  max-width: 470px;
  font-family: var(--font-display);
  font-size: clamp(52px, 5.4vw, 86px);
  font-weight: 500;
  /* Enough leading that descenders (the p of "maps") clear the ascenders
     of the next line. */
  line-height: 1.04;
  letter-spacing: -0.026em;
  color: var(--color-ink);
}
.hero .rule {
  width: 72px;
  height: 1px;
  margin: 30px 0;
  background: var(--color-accent-soft);
}
.hero .lede {
  max-width: 400px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 21px;
  line-height: 1.34;
}
.hero-media {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  background: var(--color-ground);
}
.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 100% center;
  /* Zoom in a little from the lower right so the poster's own printed title
     (top left) falls outside the frame; the full poster is in the grid. */
  transform: scale(1.25);
  transform-origin: 95% 55%;
  filter: saturate(0.94) brightness(0.97);
}
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--color-ground) 0, rgb(245 240 230 / 0.35) 16%, transparent 36%),
    linear-gradient(transparent 70%, rgb(245 240 230 / 0.3));
}

/* ---------- Section title ---------- */
.collection { padding: 64px var(--page) 96px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.section-title span {
  width: 90px;
  height: 1px;
  background: var(--color-accent-soft);
}
.section-title h2 {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1;
  color: var(--color-ink-muted);
}

/* ---------- Mosaic ----------
   One grid for the whole catalog, places mixed (order and tile shapes come
   from scripts/build_page.py). data-shape sets a tile's span; --crop aims
   the crop away from the poster's printed title. */
.mosaic {
  margin: 44px auto 0;
  max-width: var(--content);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* Rows a little taller than a column is wide, at every screen width. */
  grid-auto-rows: calc((min(100vw - 2 * var(--page), var(--content)) - 3 * var(--gap)) / 4 * 1.066);
  grid-auto-flow: dense;
  gap: var(--gap);
  list-style: none;
  padding: 0;
}
.tile { position: relative; min-width: 0; }
.tile[data-shape="big"] { grid-column: span 2; grid-row: span 2; }
.tile[data-shape="wide"] { grid-column: span 2; }

.tile button {
  all: unset;
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--color-rule);
}
.tile button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.tile picture, .tile img { width: 100%; height: 100%; }
.tile img {
  object-fit: cover;
  object-position: var(--crop, center);
  /* Image treatment as on the reference: a little darker at rest, darker
     still on hover, no zoom. */
  filter: saturate(0.96) contrast(0.98) brightness(0.86);
  transition: filter 0.3s ease;
}
.tile button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 44%, rgb(3 17 31 / 0.72) 100%),
    linear-gradient(90deg, rgb(3 17 31 / 0.16), transparent 38%);
}
.tile button:hover img,
.tile button:focus-visible img { filter: saturate(1) contrast(1.02) brightness(0.78); }
/* Posters with a full-width title band at the foot (Paris): zoom from the
   top so the band leaves the frame, whatever the tile's shape. */
.tile[data-plate] img { transform: scale(var(--zoom)); transform-origin: 50% 0; }
.tile .cap {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tile .cap-style {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--color-accent-soft);
}
.tile .cap-place {
  font-family: var(--font-display);
  font-size: clamp(23px, 1.55vw, 30px);
  font-weight: 500;
  line-height: 1.04;
  color: var(--color-on-image);
  text-shadow: 0 2px 18px rgb(0 0 0 / 0.38);
}
.tile[data-shape="big"] .cap { left: 26px; right: 26px; bottom: 24px; }
.tile[data-shape="big"] .cap-place { font-size: clamp(28px, 2.1vw, 38px); }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 28px var(--page) 40px;
  border-top: 1px solid var(--color-rule);
  font-size: 13px;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.foot a { color: var(--color-ink); text-decoration: none; }
.foot a:hover, .foot a:focus-visible { color: var(--color-accent); }

/* ---------- Enlarged view ---------- */
.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(6 18 31 / 0.96);
  color: var(--color-on-image);
  overscroll-behavior: contain;
}
.viewer::backdrop { background: rgb(6 18 31 / 0.6); }
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 48px 120px 16px;
}
.viewer-stage picture { display: contents; }
.viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
  background: rgb(247 240 230 / 0.06);
}
.viewer-cap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 64px 36px;
}
.viewer-cap h2 {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}
.viewer-cap .sub {
  margin-top: 8px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: rgb(247 240 230 / 0.7);
}
.viewer-count {
  font-size: 12px;
  letter-spacing: var(--tracking-label);
  color: rgb(247 240 230 / 0.6);
  white-space: nowrap;
}
.viewer-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgb(247 240 230 / 0.28);
  border-radius: 50%;
  background: rgb(6 18 31 / 0.4);
  color: var(--color-on-image);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.viewer-btn:hover, .viewer-btn:focus-visible { border-color: var(--color-accent-soft); outline: none; }
.viewer-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.viewer-prev { left: 40px; top: calc(50% - 60px); }
.viewer-next { right: 40px; top: calc(50% - 60px); }
.viewer-close { right: 40px; top: 32px; }
body:has(.viewer[open]) { overflow: hidden; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 44% 56%; }
  .hero-text { padding: 72px 36px 80px 0; }
  /* Flowing columns, every tile in its poster's own shape: a crop of only a
     few per cent would slice the printed title instead of dropping it, and
     columns stack mixed landscape and portrait posters without gaps. */
  .mosaic { display: block; columns: 2; column-gap: var(--gap); }
  .tile { aspect-ratio: var(--ratio); margin-bottom: var(--gap); break-inside: avoid; }
  /* Whole posters show their printed title. Captions stay left-aligned, so a
     poster that prints its title bottom left zooms from the top a little and
     the title leaves the frame. */
  .tile[data-title="bottom-left"]:not([data-plate]) img { transform: scale(1.22); transform-origin: 50% 0; }
}

/* ---------- Phone ----------
   One column; each tile takes its poster's own shape, so nothing is cropped. */
@media (max-width: 720px) {
  .hero { display: flex; flex-direction: column-reverse; min-height: 0; padding: 0; }
  .hero-media { height: 300px; min-height: 0; }
  .hero-media::after { background: linear-gradient(transparent 55%, var(--color-ground)); }
  .hero-text { padding: 8px 20px 44px; background: none; }
  .hero h1 { margin-top: 16px; font-size: 46px; line-height: 1.06; letter-spacing: -0.02em; }
  .hero .rule { width: 56px; margin: 22px 0; }
  .hero .lede { font-size: 19px; }
  .collection { padding: 40px 16px 56px; }
  .section-title span { width: 44px; }
  .mosaic { margin-top: 28px; columns: 1; }
  .tile { margin-bottom: 14px; }
  .tile .cap { left: 18px; right: 18px; bottom: 16px; }
  .tile .cap-place, .tile[data-shape="big"] .cap-place { font-size: 28px; }
  .foot { padding: 24px 16px 32px; }
  .viewer-stage { padding: 72px 12px 8px; }
  .viewer-cap { padding: 14px 20px calc(24px + env(safe-area-inset-bottom)); }
  .viewer-cap h2 { font-size: 28px; }
  .viewer-btn { width: 44px; height: 44px; }
  .viewer-prev, .viewer-next { top: auto; bottom: calc(28px + env(safe-area-inset-bottom)); }
  .viewer-prev { left: auto; right: 72px; }
  .viewer-next { right: 20px; }
  .viewer-close { right: 16px; top: 16px; }
  .viewer-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tile img { transition: none; }
}
