/* La Chambre Bleue
   A technical monograph: light paper, ink type, drawings in their original colours on a neutral mat,
   numbered chapters and figures. One sans family for reading, a monospace for numbers and labels. */

/* Fonts (self-hosted, OFL; licences in assets/fonts/) */
@font-face {
  font-family: "Instrument Sans";
  src: url("assets/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* Colours, type and spacing */
:root {
  --paper: #f2f3f1;
  --mat: #e6e9e7;
  --ink: #141c1f;
  --ink-2: #3d494d;
  --muted: #6c777a;
  --rule: #d3d8d6;
  --rule-strong: #a3adae;
  --accent: #1d4d61;
  --night: #121a1d;
  --night-text: #d9dfdf;
  --night-muted: #8fa0a3;
  --night-rule: #2a3539;
  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 64px);
  --max: 1320px;
  --gap: clamp(14px, 1.5vw, 24px);
  --pad: clamp(10px, 1.6vw, 24px);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

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

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

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button {
  font: inherit;
  color: inherit;
}

sub, sup {
  font-size: .72em;
  line-height: 0;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
}

.skip-link:focus {
  top: 10px;
}

/* Small print under figures and studies */
.note {
  margin-top: 16px;
  max-width: 70ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

/* Header */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 max(var(--gutter), calc((100% - var(--max)) / 2));
  height: 56px;
  background: rgb(242 243 241 / .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .2s ease, visibility .2s;
}

/* The page title already names the project, so the wordmark waits until it scrolls away */
.site-header.at-top .wordmark {
  opacity: 0;
  visibility: hidden;
}

.site-header nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
}

.site-header nav a {
  color: var(--ink-2);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Page column */
main {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Opening */
.hero {
  padding-top: clamp(28px, 4vw, 56px);
}

.hero h1 {
  font-size: clamp(44px, 6.2vw, 88px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.035em;
}

.hero-sub {
  max-width: 52ch;
  margin-top: clamp(14px, 1.6vw, 22px);
  font-size: clamp(18px, 1.55vw, 22px);
  line-height: 1.4;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero-figure {
  margin-top: clamp(24px, 3vw, 40px);
}

.hero-figure .frame {
  padding: 0;
  background: var(--night);
}

.hero-figure .frame img {
  width: 100%;
  max-height: none;
  aspect-ratio: 2.3;
  object-fit: cover;
  object-position: 50% 55%;
}

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px);
  margin-top: clamp(40px, 5vw, 72px);
  align-items: start;
}

.lede {
  max-width: 62ch;
  font-size: clamp(18px, 1.35vw, 20px);
  line-height: 1.6;
  color: var(--ink);
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 32px;
  border-top: 1px solid var(--ink);
}

.specs div {
  padding: 11px 0 12px;
  border-bottom: 1px solid var(--rule);
}

.specs dt {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.specs dd {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Section heads */
.contributions-section, .arrangement {
  margin-top: clamp(80px, 10vw, 140px);
}

.section-head {
  padding-top: 18px;
  border-top: 1px solid var(--ink);
  margin-bottom: clamp(28px, 3.5vw, 48px);
}

.section-head h2 {
  font-size: clamp(28px, 2.8vw, 40px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.section-head p {
  max-width: 66ch;
  margin-top: 14px;
  font-size: 17px;
  color: var(--ink-2);
}

/* Contributions */
.contributions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 56px) clamp(24px, 3vw, 48px);
}

.contributions li {
  display: flex;
  flex-direction: column;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.c-num {
  font: 500 12px/1 var(--mono);
  color: var(--accent);
}

.contributions h3 {
  margin-top: 14px;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.c-text {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  flex: 1;
}

.c-link {
  margin-top: 14px;
  align-self: start;
  font: 400 12px/1.4 var(--mono);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgb(29 77 97 / .35);
}

.c-link:hover {
  text-decoration-color: currentColor;
}

/* General arrangement */
.arrangement-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}

.plan .frame {
  padding: 0;
  background: transparent;
}

.plan img {
  width: 100%;
  max-height: 720px;
  object-fit: contain;
}

.plan figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.modules {
  border-top: 1px solid var(--rule-strong);
}

.modules div {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0 15px;
  border-bottom: 1px solid var(--rule);
}

.modules dt {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}

.modules dd {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}

.material {
  display: block;
  margin-bottom: 2px;
  font: 500 11px/1.45 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Parts and chapters */
.part {
  margin-top: clamp(96px, 12vw, 168px);
  padding-top: 18px;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0 clamp(16px, 2vw, 32px);
  align-items: baseline;
}

.part-label {
  font: 500 12px/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.part-title {
  font-size: clamp(30px, 3.4vw, 48px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.025em;
}

.chapter {
  margin-top: clamp(64px, 7vw, 104px);
}

.part + .chapter {
  margin-top: clamp(40px, 5vw, 72px);
}

.chapter-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0 clamp(16px, 2vw, 32px);
  align-items: baseline;
  padding-top: 16px;
  border-top: 1px solid var(--rule-strong);
  margin-bottom: clamp(24px, 3vw, 40px);
}

.chapter-num {
  font: 500 13px/1.4 var(--mono);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.chapter-head h2 {
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.chapter-intro {
  grid-column: 2;
  max-width: 66ch;
  margin-top: 14px;
}

.chapter-intro > p {
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-2);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.facts dt {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Figures */
.figures {
  display: grid;
  gap: var(--gap);
  align-items: stretch;
}

.figures + .figures, .figures + .study, .figures + .sequence {
  margin-top: var(--gap);
}

/* A figure with a text panel beside it. */
.figures.split {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

/* Justified rows: each plate's width follows its image's aspect ratio (--ar, set inline on the figure),
   net of the mat, so every image in a row has the same height. */
.figures.row {
  display: flex;
  align-items: flex-start;
}

.figures.row > .plate {
  flex: var(--ar) 1 calc(2 * var(--pad));
}

.figures.row .frame img {
  max-height: none;
}

.plate {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.frame {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  padding: var(--pad);
  border: 0;
  background: var(--mat);
  cursor: zoom-in;
}

.frame img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  transition: opacity .2s;
}

.frame:hover img {
  opacity: .9;
}

.figures.single .frame img {
  max-height: 600px;
}

.figures.single .narrow .frame {
  padding-left: 8%;
  padding-right: 8%;
}

.figures.single .compact .frame img {
  max-height: 440px;
}

.plate figcaption {
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.fig-num {
  margin-right: 10px;
  font: 500 11px/1 var(--mono);
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

/* Interior module groups */
.group-title {
  margin-bottom: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-strong);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.module-group + .module-group {
  margin-top: clamp(40px, 5vw, 64px);
}

/* Studies, flows and sequences */
.study {
  margin-top: var(--gap);
  padding-top: 16px;
  border-top: 1px solid var(--rule-strong);
}

.study-title, .flow-title {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.study-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.study-table th, .study-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: baseline;
}

.study-table th {
  width: 30%;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-2);
}

.study-table td {
  width: 20%;
  padding-right: 24px;
  font-size: 17px;
  font-weight: 500;
}

.flow {
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2vw, 28px);
  background: var(--mat);
}

.flow-steps {
  margin-top: 18px;
  counter-reset: step;
  flex: 1;
}

.flow-steps li {
  position: relative;
  padding: 0 0 18px 38px;
  font-size: 15px;
  line-height: 1.4;
  counter-increment: step;
}

.flow-steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font: 500 12px/1.4 var(--mono);
  color: var(--accent);
}

.flow-steps li::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 22px;
  bottom: 4px;
  width: 1px;
  background: var(--rule-strong);
}

.flow-steps li:last-child::after {
  display: none;
}

.flow-steps small {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.flow figcaption {
  font-size: 13px;
  color: var(--muted);
}

.sequence {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.sequence li {
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.sequence span {
  display: block;
  margin-bottom: 6px;
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.criteria-block {
  margin-top: var(--gap);
  padding-top: 16px;
  border-top: 1px solid var(--rule-strong);
}

.criteria-block .study-title {
  margin-bottom: 12px;
}

.criteria {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding-bottom: 8px;
}

.criteria h3 {
  font-size: 16px;
  font-weight: 500;
}

.criteria p {
  margin-top: 4px;
  font-size: 15px;
  color: var(--ink-2);
}

/* Footer */
.site-footer {
  margin-top: clamp(96px, 12vw, 168px);
  padding: clamp(40px, 5vw, 72px) var(--gutter) 40px;
  background: var(--night);
  color: var(--night-text);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px clamp(32px, 6vw, 112px);
}

.site-footer > div {
  max-width: 60ch;
}

.site-footer h2 {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--night-muted);
  margin-bottom: 14px;
}

.site-footer p {
  font-size: 16px;
  line-height: 1.6;
}

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

.team li {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--night-rule);
  font-size: 15px;
}

.team span {
  color: var(--night-muted);
}

.to-top {
  grid-column: 1 / -1;
  justify-self: start;
  font-size: 14px;
  color: var(--night-muted);
}

@media (min-width: 1500px) {
  .site-footer {
    padding-left: calc((100vw - var(--max)) / 2);
    padding-right: calc((100vw - var(--max)) / 2);
  }
}

/* Image viewer */
.viewer {
  width: min(96vw, 1800px);
  height: 94svh;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}

.viewer::backdrop {
  background: rgb(10 14 16 / .86);
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 8px 12px 8px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.viewer-actions button {
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.viewer-actions button:hover {
  background: var(--mat);
}

.viewer-actions button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.viewer-image-wrap {
  height: calc(100% - 57px);
  padding: 20px;
  overflow: auto;
  background: var(--mat);
}

.viewer-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-image-wrap.actual-size .viewer-image {
  width: auto;
  height: auto;
  max-width: none;
  object-fit: initial;
  cursor: zoom-out;
}

/* Tablet */
@media (max-width: 1080px) {
  .site-header nav {
    gap: 20px;
  }

  .contributions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arrangement-grid {
    grid-template-columns: 1fr;
  }

  .part, .chapter-head {
    grid-template-columns: 56px minmax(0, 1fr);
  }
}

/* Phone */
@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  html {
    scroll-padding-top: 64px;
  }

  .site-header {
    height: 48px;
  }

  .wordmark {
    display: none;
  }

  .site-header nav {
    flex: 1;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
  }

  .site-header nav::-webkit-scrollbar {
    display: none;
  }

  .site-header nav a {
    white-space: nowrap;
  }

  .hero-foot {
    grid-template-columns: 1fr;
  }

  .hero-figure {
    margin-left: calc(-1 * var(--gutter));
    margin-right: calc(-1 * var(--gutter));
  }

  .hero-figure .frame img {
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }

  .contributions {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .modules div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .part, .chapter-head {
    grid-template-columns: 1fr;
  }

  .part-label, .chapter-num {
    margin-bottom: 6px;
  }

  .chapter-intro {
    grid-column: 1;
  }

  .chapter-intro > p {
    font-size: 16px;
  }

  .figures.split {
    grid-template-columns: 1fr;
  }

  .figures.row {
    flex-direction: column;
    align-items: stretch;
  }

  .figures.row > .plate {
    flex: none;
  }

  .frame img,
  .figures.single .frame img,
  .figures.row .frame img {
    max-height: 420px;
  }

  .figures.single .narrow .frame {
    padding-left: var(--pad);
    padding-right: var(--pad);
  }

  .study-table, .study-table tbody, .study-table tr {
    display: block;
  }

  .study-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .study-table th, .study-table td {
    width: auto;
  }

  .study-table td {
    padding-right: 0;
    text-align: right;
  }

  .sequence, .criteria {
    grid-template-columns: 1fr;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

  .team li {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .viewer {
    width: 100vw;
    height: 100svh;
  }

  .viewer-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .viewer-actions {
    justify-content: flex-end;
  }

  .viewer-image-wrap {
    height: calc(100% - 96px);
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .frame img {
    transition: none;
  }
}
