/* The two typefaces, served from the site itself (fonts/, with their OFL licences): Newsreader for
   the text, Schibsted Grotesk for titles and labels. They are the files Google Fonts serves, in
   their latin and latin-ext subsets (the second for a few names such as Wojtyła); a browser only
   fetches a subset when the page uses one of its characters. */
@font-face {
  font-family: "Newsreader"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/newsreader-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/newsreader-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/newsreader-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/newsreader-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* A gallery wall: neutral ground, ink text, one ultramarine accent taken from the miniatures. */
  --wall: #ededeb;
  --paper: #f8f8f6;
  --ink: #15171c;
  --ink-soft: #5a5e68;
  --line: #cfcfca;
  --accent: #2a3eb1;
  --accent-deep: #1f2f8c;
  --display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --text: "Newsreader", "Iowan Old Style", Georgia, serif;
  --gutter: clamp(16px, 3.4vw, 48px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--wall);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
em { font-style: italic; }
/* Read by screen readers and search engines, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
strong { font-weight: 600; }

.btn-primary {
  display: inline-block;
  background: var(--accent); color: #fff;
  border: 0; padding: .95em 1.7em; border-radius: 999px;
  font: 600 1rem/1 var(--display); text-decoration: none;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-deep); }

/* ---------- Home ---------- */
/* One screen: the credits box and the bar on one line, the stage (the title above the entrance photo
   and the text beside it), the plan. */
.home {
  /* Height of the picture: what the screen leaves once the bar, the title and the plan are placed,
     within the width kept for it. Measured on the small viewport (svh), which does not change when
     a phone's address bar folds away on scroll: with dvh the picture grew under the finger. */
  --ratio: 1.507;
  --title: clamp(2.6rem, 6vw, 6.8rem);
  --hero-h: clamp(220px, min(100svh - 350px - var(--title), 56vw / var(--ratio)), 760px);
  min-height: 100vh; min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.home-bar {
  grid-area: 1 / 2;
  display: flex; justify-content: flex-end; align-items: baseline; gap: 8px 24px; flex-wrap: wrap;
  padding: 18px var(--gutter) 0 0;
  font: 500 .9rem/1.3 var(--display);
}
.home-bar p { margin: 0; color: var(--ink-soft); }
.home-bar a { color: var(--ink); text-underline-offset: 4px; text-decoration-color: var(--line); }
.home-bar a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* Who put the exhibition online, who translated it, and whose permission it has: a framed note at
   the top left, facing the bar. It comes last in the page, where narrow screens show it. */
.credits {
  grid-area: 1 / 1; justify-self: start;
  margin: 14px 20px 0 var(--gutter); padding: 10px 16px 11px;
  background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  font: 400 clamp(.82rem, .9vw, .95rem)/1.4 var(--display); color: var(--ink);
}
.credits p { margin: 0; }
.credits p + p { margin-top: .25em; }
.credits a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line); }
.credits a:hover { color: var(--accent); text-decoration-color: currentColor; }
.home .stage, .home .plan { grid-column: 1 / -1; }
.home .stage { grid-row: 2; }
.home .plan { grid-row: 3; }

/* A centred block: the title on one line, then the picture with, to its right, the exhibition's own name
   at the picture's top and what the tour is, with its start, at the picture's bottom. */
.stage {
  display: grid;
  grid-template-columns: auto minmax(0, 27rem);
  grid-template-rows: auto auto auto;
  column-gap: clamp(24px, 3.6vw, 60px);
  justify-content: center; align-content: center;
  padding: 24px var(--gutter);
}
.stage h1 {
  grid-column: 1 / -1; grid-row: 1;
  margin: 0 0 .32em;
  font: 800 var(--title)/.92 var(--display);
  letter-spacing: -.045em;
}
.hero {
  grid-column: 1; grid-row: 2 / -1;
  margin: 0;
  height: var(--hero-h); width: calc(var(--hero-h) * var(--ratio));
  background: #b98a4c;
  box-shadow: 0 1px 2px rgba(21,23,28,.18), 0 40px 80px -30px rgba(21,23,28,.55);
}
.hero img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  /* The one orchestrated moment: the picture emerges from behind a veil. */
  animation: unveil 2.6s cubic-bezier(.2,.6,.2,1) both;
}
@keyframes unveil {
  from { opacity: 0; filter: blur(16px) brightness(1.5); }
  to   { opacity: 1; filter: none; }
}
.origin {
  grid-column: 2; grid-row: 2;
  margin: 0 0 1.4em;
  font: 500 clamp(.95rem, 1.2vw, 1.15rem)/1.35 var(--display); color: var(--ink-soft);
}
.origin span { display: block; font-weight: 700; color: var(--ink); }
.start { grid-column: 2; grid-row: 3; align-self: end; }
.lede {
  max-width: 24em; margin: 0 0 1.5em;
  font-size: clamp(.98rem, 1.2vw, 1.15rem); line-height: 1.5;
  color: var(--ink-soft);
}
.start .scale { margin: 1em 0 0; font: 500 .9rem/1.3 var(--display); color: var(--ink-soft); }

/* The plan of the exhibition: one segment per room, the same segments as the tour's progress bar. */
.plan ol {
  list-style: none; margin: 0; padding: 0 var(--gutter) 18px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px;
}
.plan a {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 10px 0 0; border-top: 3px solid var(--line);
  text-decoration: none; color: var(--ink);
  font: 600 .92rem/1.2 var(--display); letter-spacing: -.01em;
  transition: border-color .15s, color .15s;
}
.plan a:hover { border-top-color: var(--accent); color: var(--accent); }
.plan .num { font-weight: 500; font-size: .82rem; color: var(--ink-soft); min-height: 1.2em; }
.plan .count { font-weight: 400; font-size: .82rem; color: var(--ink-soft); }
.plan a:hover .num, .plan a:hover .count { color: inherit; }

/* ---------- Tour ---------- */
/* The tour fills the screen and its content stretches, so the nav sits at the bottom on short stops. */
.tour { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#stop { flex: 1; display: flex; flex-direction: column; }
.tour-head { position: sticky; top: 0; z-index: 5; background: var(--wall); }
.topbar {
  display: flex; align-items: baseline; gap: 20px;
  padding: 14px var(--gutter) 10px;
  font-family: var(--display);
}
.topbar .home-link { font-weight: 800; font-size: 1.05rem; letter-spacing: -.03em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.topbar .home-link:hover { color: var(--accent); }
.topbar .where { flex: 1; min-width: 0; font-size: .9rem; font-weight: 500; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Progress: one segment per room, filled up to the current stop. */
.progress { display: flex; gap: 4px; padding: 0 var(--gutter); }
.progress a { flex: var(--w) 1 0; height: 3px; background: var(--line); position: relative; }
.progress a::before { content: ""; position: absolute; inset: -8px 0; }
.progress a span { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--p)); transition: transform .4s; }

.stop {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(24px, 4.5vw, 72px);
  padding: clamp(24px, 4vw, 56px) var(--gutter);
  max-width: 1500px; width: 100%; margin: 0 auto;
  /* Rows keep their own height: the album sits right under its title instead of sharing the spare room. */
  align-content: start;
}
.stop.single { grid-template-columns: minmax(0, 44rem); justify-content: center; }
.figure { margin: 0; display: flex; align-items: flex-start; justify-content: center; }
.figure img {
  max-width: 100%; max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px);
  /* --w and --h are the picture's pixel size: its box is known before the file arrives, so the text
     below it does not jump. Never wider than its column, taller than the screen leaves, or larger
     than the file itself. */
  width: min(100%, var(--w) * 1px, (100vh - 210px) * var(--w) / var(--h));
  width: min(100%, var(--w) * 1px, (100dvh - 210px) * var(--w) / var(--h));
  height: auto; aspect-ratio: var(--w) / var(--h);
  box-shadow: 0 1px 2px rgba(21,23,28,.16), 0 30px 60px -28px rgba(21,23,28,.5);
  cursor: zoom-in; background: var(--paper);
}
.lead-figure { flex-direction: column; align-items: center; }
.lead-figure figcaption, .room-figure figcaption, .room-photo figcaption, .album figcaption {
  font: 400 .85rem/1.4 var(--display); color: var(--ink-soft); margin-top: .7em;
}
.lead-figure figcaption p { margin: 0; }
/* Every video is 16:9: its place is kept while its first data loads. */
.figure video { width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); background: #000; }
.copy { max-width: 38rem; }
.copy .kicker { font: 600 .9rem/1.3 var(--display); color: var(--accent); margin: 0 0 .7em; }
.copy h1:not(.sr-only) { font: 800 clamp(2rem, 3.6vw, 3.2rem)/1 var(--display); letter-spacing: -.04em; margin: 0 0 .6em; }
/* Beside an image or a video the column is narrow: a long title stays a few lines. */
.stop:not(.single) .copy h1:not(.sr-only) { font-size: clamp(1.6rem, 2.5vw, 2.3rem); line-height: 1.05; }
.copy h3 { font: 700 1.3rem/1.2 var(--display); letter-spacing: -.02em; margin: 1.8em 0 .5em; }
.copy p { margin: 0 0 1em; }
.copy .desc { color: var(--ink-soft); font-style: italic; }
.copy blockquote { margin: 0 0 1em; padding-left: 1.1em; border-left: 3px solid var(--accent); }
.copy .muted { color: var(--ink-soft); font-size: .95rem; }
.copy ul { margin: 0 0 1em; padding-left: 1.2em; }
.copy li { margin-bottom: .4em; }

/* Text of a room's panel: title, opening quote, then sections; the Italian original folds away. */
.panel-text { margin-top: 2em; }
.panel-text .panel-title { font: 800 clamp(1.6rem, 2.8vw, 2.2rem)/1.05 var(--display); letter-spacing: -.035em; margin: 0 0 1em; }
.panel-text .panel-subtitle { display: block; font: 500 clamp(1.05rem, 1.7vw, 1.25rem)/1.3 var(--display); letter-spacing: -.01em; color: var(--ink-soft); margin-top: .35em; }
.panel-text blockquote { margin: 0 0 1.6em; }
.panel-text blockquote p { font-style: italic; margin: 0 0 .5em; }
.panel-text blockquote footer { font: 400 .88rem/1.4 var(--display); color: var(--ink-soft); }
.original { margin-top: 2.4em; border-top: 1px solid var(--line); padding-top: 1em; }
.original summary { font: 600 .95rem/1.3 var(--display); color: var(--accent); cursor: pointer; }
.original[open] summary { margin-bottom: .6em; }
.transcript { max-height: 55vh; overflow: auto; padding-right: .5em; }

.room-figure { margin: 2em 0 0; }
.room-figure img, .room-photo img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.room-photo { margin: 0; }

/* The album's photos are already framed: each is shown whole, in its own proportions. */
.album { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 540px)); gap: 28px 20px; align-items: start; grid-column: 1 / -1; max-width: 1100px; }
.album-head { grid-column: 1 / -1; }
.album figure { margin: 0; }
.album img { display: block; width: 100%; height: auto; cursor: zoom-in; }

.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--wall);
  position: sticky; bottom: 0;
  font-family: var(--display);
}
/* Previous and next: links, or plain text at either end of the tour. */
.nav .prev, .nav .next {
  border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  padding: .7em 1.4em; border-radius: 999px; font-weight: 600; font-size: .95rem; line-height: 1;
  transition: background .15s, border-color .15s;
}
.nav a:hover { border-color: var(--ink); }
.nav .next { background: var(--accent); color: #fff; border-color: var(--accent); }
.nav a.next:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.nav span[aria-disabled] { opacity: .3; }
.nav .count { font-size: .85rem; font-weight: 500; color: var(--ink-soft); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 20; background: rgba(21,23,28,.96);
  display: flex; align-items: center; justify-content: center; overflow: auto; cursor: zoom-out;
}
.lightbox img { max-width: 96vw; max-height: 96vh; }
.lightbox.zoomed { align-items: flex-start; justify-content: flex-start; }
.lightbox.zoomed img { max-width: none; max-height: none; width: 200vw; }
.lightbox .close { position: fixed; top: 12px; right: 16px; background: none; border: 0; font-size: 2rem; color: #fff; }

/* Side-by-side home on a low screen (a small laptop): the introduction keeps its first sentence,
   as on narrow screens, so the credits box does not push the plan off the screen. */
@media (min-width: 1280px) and (max-height: 700px) {
  .lede .more { display: none; }
}
/* Home below 1280px, phones included: title, picture, a sentence and the button fill the first screen
   in one centred column; the picture takes the width it is given, and the first line of the plan shows
   at the bottom to invite scrolling. The side-by-side home needs the width of a desktop screen. */
@media (max-width: 1279px) {
  .home {
    --hero-h: min(clamp(160px, 100svh - 440px, 340px), (100vw - 2 * var(--gutter)) / var(--ratio));
    grid-template-columns: minmax(0, 1fr);
  }
  .home .home-bar, .home .credits, .home .stage, .home .plan { grid-area: auto; }
  .home-bar { padding: 12px var(--gutter) 0; font-size: .85rem; }
  /* The credits box closes the page, under the plan and as wide as its lines. */
  .credits {
    justify-self: center; width: calc(100% - 2 * var(--gutter)); max-width: calc(38rem - 2 * var(--gutter));
    margin: 0 0 32px;
  }
  .home-bar p { display: none; }
  .stage {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 14px var(--gutter) 18px; text-align: center;
  }
  .stage h1 { margin: 0; font-size: clamp(2rem, 9.6vw, 3.6rem); }
  .origin { order: 1; margin: -8px 0 0; font-size: .9rem; }
  .hero { order: 2; }
  .start { order: 3; align-self: auto; display: flex; flex-direction: column; align-items: center; }
  .lede { max-width: 30em; margin-bottom: 1.1em; font-size: .98rem; line-height: 1.45; }
  .lede .more { display: none; }
  .start .scale { margin-top: .7em; }
  /* The plan becomes a plain list under the first screen: one room per line, read by scrolling down. */
  .plan ol { display: block; max-width: 38rem; margin: 0 auto; padding-bottom: 32px; }
  .plan a {
    display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: baseline; gap: 0 10px;
    height: auto; padding: 14px 0; border-top: 1px solid var(--line); font-size: 1rem;
  }
  .plan li:last-child a { border-bottom: 1px solid var(--line); }
  .plan .num { min-height: 0; }
}
/* Tour on a narrow screen: the picture above its text. */
@media (max-width: 900px) {
  .stop { grid-template-columns: 1fr; }
  .figure img, .figure video { max-height: 60vh; }
  .figure img { width: min(100%, var(--w) * 1px, 60vh * var(--w) / var(--h)); }
  .transcript { max-height: none; }
  .topbar .where { display: none; }
}
/* The narrowest phones (320px): the two buttons and the counter still share one line. */
@media (max-width: 380px) {
  .nav { gap: 8px; }
  .nav .prev, .nav .next { padding: .7em 1em; }
}
@media (prefers-reduced-motion: reduce) {
  .hero img { animation: none; }
  .progress a span, .btn-primary, .plan a, .nav .prev, .nav .next { transition: none; }
}
