/* Bight Matter — a museum of one word */

:root {
  --bone: #f3ead7;
  --ink: #1a1612;
  --water: #10242c;
  --copper: #8c5a32;
  --glass: #6f8f86;

  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Segoe UI", system-ui, sans-serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 38rem;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
}

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1em; }
cite { font-style: italic; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 3px;
}
.hall :focus-visible,
.masthead :focus-visible,
.room--ink :focus-visible,
.room--water :focus-visible,
.foot :focus-visible {
  outline-color: var(--bone);
}

/* Skip link */
.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  background: var(--bone);
  color: var(--ink);
  font-weight: 600;
}
.skip:focus { top: 0.75rem; }

main:focus { outline: none; }

/* Masthead */
.masthead {
  background: var(--ink);
  color: var(--bone);
  border-bottom: 1px solid rgb(243 234 215 / 0.12);
}
.masthead nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.masthead ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.masthead a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-size: 0.9375rem;
}
.masthead a:hover { text-decoration: underline; }
.masthead__name {
  font-family: var(--serif);
  font-size: 1.125rem !important;
  letter-spacing: 0.02em;
}

/* Entrance hall */
.hall {
  background: var(--ink);
  color: var(--bone);
  padding: clamp(3rem, 10vw, 7rem) 0 clamp(3rem, 8vw, 5rem);
}
.hall__text {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.eyebrow,
.room__no {
  margin: 0 0 1rem;
  font: 600 0.8125rem/1.3 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hall .eyebrow {
  color: var(--glass);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.125rem;
  letter-spacing: 0.01em;
  text-transform: none;
}
.hall h1 {
  font-size: clamp(5rem, 22vw, 15rem);
  line-height: 0.82;
  letter-spacing: -0.02em;
  margin-left: -0.04em;
  padding-bottom: 0.46em;
}
.hall__pron {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: rgb(243 234 215 / 0.82);
}
.hall__lede {
  max-width: 34rem;
  margin: 1.25rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  line-height: 1.45;
}
.hall .hall__plate {
  margin: clamp(3rem, 8vw, 5rem) 0 0;
  max-width: none;
}
.hall .hall__plate img {
  width: 100%;
  height: clamp(10rem, 19vw, 28rem);
  object-fit: cover;
}
.hall .hall__plate figcaption {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0.75rem var(--gutter) 0;
}

/* Floor plan */
.plan {
  max-width: 76rem;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  padding: 0 var(--gutter);
  list-style: none;
  columns: 16rem 3;
  column-gap: 2.5rem;
}
.plan li { break-inside: avoid; border-top: 1px solid rgb(243 234 215 / 0.16); }
.plan a {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 48px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.125rem;
}
.plan a:hover { text-decoration: underline; }
.plan span {
  flex: 0 0 2.5rem;
  color: var(--glass);
  font: 600 0.8125rem/1 var(--sans);
  letter-spacing: 0.08em;
}

/* Rooms: one idea per room, laid out on a named grid */
.room,
.credits {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, 12rem)
    [main-start] minmax(0, var(--measure))
    [main-end] minmax(0, 12rem)
    [wide-end] minmax(var(--gutter), 1fr)
    [full-end];
  row-gap: clamp(1.75rem, 4vw, 3rem);
  padding: clamp(4rem, 12vw, 8.5rem) 0;
}
.room > *, .credits > * { grid-column: main; min-width: 0; }

.room--paper { background: var(--bone); color: var(--ink); }
.room--ink   { background: var(--ink); color: var(--bone); }
.room--water { background: var(--water); color: var(--bone); }

.room--paper .room__no, .credits .room__no { color: var(--copper); }
.room--ink .room__no, .room--water .room__no { color: var(--glass); }

.room__head h2 {
  font-size: clamp(2.5rem, 7vw, 4.75rem);
  letter-spacing: -0.01em;
}

.room__body { max-width: var(--measure); }
.lede {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.35;
  margin-bottom: 1.1em;
}
.note {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid currentColor;
  font-size: 0.9375rem;
  opacity: 0.88;
}

.room--threshold .room__head h2 { font-size: clamp(3rem, 10vw, 6.5rem); }

/* Plates (figures) */
.plate { margin: 0; grid-column: wide; }
.plate img { width: 100%; background: rgb(127 127 127 / 0.12); }
.plate figcaption {
  margin-top: 0.75rem;
  max-width: 44rem;
  font-size: 0.875rem;
  line-height: 1.5;
}
.plate__no {
  display: inline-block;
  min-width: 1.75em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.room--paper .plate__no { color: var(--copper); }
.room--ink .plate__no, .room--water .plate__no, .hall .plate__no { color: var(--glass); }
.plate__credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.4em;
  opacity: 0.85;
}
.plate__credit a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.plate--full { grid-column: full; }
.plate--full figcaption { padding: 0 var(--gutter); max-width: calc(44rem + 2 * var(--gutter)); }
.plate--wide { grid-column: wide; }
.plate--square { grid-column: main; }
.plate--small { grid-column: main; }
.plate--small img { width: auto; max-width: 100%; margin: 0 auto; background: none; }
.plate--small figcaption { text-align: center; margin-inline: auto; }

/* Hangs: photographs grouped on one wall */
.hang {
  grid-column: wide;
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.5rem);
  align-items: start;
}
.hang .plate { grid-column: auto; }
@media (min-width: 48rem) {
  .hang--two { grid-template-columns: 1fr 1fr; }
  .hang--two .plate:nth-child(2) { margin-top: clamp(2rem, 8vw, 6rem); }
  .hang--portrait { align-items: end; }
  .hang--portrait .plate:nth-child(2) { margin-top: 0; }

  .hang--work { grid-template-columns: repeat(6, 1fr); }
  .hang--work .plate { grid-column: span 3; }
  .hang--work .hang__major { grid-column: 1 / -1; }
  .hang--work .plate:nth-child(4),
  .hang--work .plate:nth-child(5) { grid-column: span 3; }
  .hang--work .plate:nth-child(3) { margin-top: clamp(2rem, 6vw, 4rem); }
}
@media (min-width: 64rem) {
  .hang--work .plate:nth-child(4) { grid-column: 1 / span 4; }
  .hang--work .plate:nth-child(5) { grid-column: 5 / span 2; margin-top: clamp(2rem, 8vw, 7rem); }
  .hang--work .plate:nth-child(5) img { aspect-ratio: 1; object-fit: cover; }
}

.plate--tall img { max-height: 80vh; width: auto; margin: 0 auto; }

/* Definitions in Room I */
.meanings {
  grid-column: wide;
  display: grid;
  gap: 2rem;
  margin: 1rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--ink);
}
@media (min-width: 48rem) {
  .meanings { grid-template-columns: 1fr 1fr; gap: 3.5rem; }
}
.meanings dt {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.1;
  margin-bottom: 0.6rem;
}
.meanings dt span {
  font-style: italic;
  font-size: 0.55em;
  color: var(--copper);
}
.meanings dd { margin: 0; max-width: 30rem; }

/* Coda */
.coda { grid-column: main; }
.coda p {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.6vw, 2.4rem);
  line-height: 1.3;
  margin-bottom: 1.2em;
}
.coda__term { color: var(--copper); font-style: italic; }

/* Credits wall */
.credits { background: #e9dfc8; color: var(--ink); }
.credits > .credits__list,
.credits > .sources { grid-column: wide; }
.credits h3 { font-size: 1.75rem; }
.credits__intro { max-width: var(--measure); }
.credits__list {
  display: grid;
  gap: 1.25rem 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  line-height: 1.45;
}
@media (min-width: 56rem) {
  .credits__list { grid-template-columns: 1fr 1fr; }
}
.credits__list li {
  display: grid;
  grid-template-columns: 2rem 96px 1fr;
  gap: 0 1rem;
  align-items: start;
  padding-top: 1rem;
  border-top: 1px solid rgb(26 22 18 / 0.25);
  scroll-margin-top: 1rem;
}
.credits__list p { margin: 0; overflow-wrap: anywhere; }
.credits__no {
  color: var(--copper);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.credits__thumb { display: block; min-height: 44px; }
.credits__title { font-weight: 600; }
.credits__list a:not(.credits__thumb),
.sources a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.sources {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 18rem 2;
  column-gap: 2.5rem;
}

.plate, .credits__list li { scroll-margin-top: 1.5rem; }

/* Footer */
.foot {
  background: var(--ink);
  color: var(--bone);
  padding: 2.5rem var(--gutter);
  font-size: 0.9375rem;
  text-align: center;
}
.foot p { margin: 0.25rem 0; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }

/* Quiet reveal: only when motion is welcome and the script has run */
@media (prefers-reduced-motion: no-preference) {
  .plate.is-waiting img {
    opacity: 0;
    transition: opacity 1.4s ease;
  }
  .plate.is-waiting.is-visible img { opacity: 1; }
}

@media (max-width: 47.99rem) {
  .room,
  .credits {
    grid-template-columns:
      [full-start] 1.25rem
      [wide-start main-start] minmax(0, 1fr)
      [main-end wide-end]
      1.25rem
      [full-end];
    row-gap: 1.35rem;
    padding: 2.75rem 0 3.25rem;
  }
  .room__head h2 { font-size: clamp(2.55rem, 11vw, 3.35rem); }
  .lede { font-size: 1.3rem; line-height: 1.4; }
  .hall { padding: 2.5rem 0 2.75rem; }
  .hall h1 {
    font-size: clamp(4.4rem, 24vw, 7.5rem);
    padding-bottom: 0.36em;
  }
  .plan { columns: 1; }
}

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .credits__list li { grid-template-columns: 1.75rem 72px 1fr; gap: 0 0.75rem; }
  .credits__thumb img { width: 72px; height: 54px; }
}

@media print {
  .masthead, .plan, .skip { display: none; }
  .room, .hall, .credits { background: #fff; color: #000; padding: 1.5rem 0; }
  .plate.is-waiting img { opacity: 1; }
}
