/* The word prism: an architecture studio's method in three words. The words stand on three walls of a room around
   you; scrolling turns the room a quarter at a time and settles on each word. */
:root {
  --paper: #f3eee5;         /* the page */
  --ink: #1d1b18;           /* text */
  --muted: rgba(29, 27, 24, 0.55);
  --edge: clamp(18px, 3.2vw, 48px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Familjen Grotesk Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px var(--edge);
  font-size: 14px;
}

.brand {
  font-family: 'Bodoni Moda Variable', Georgia, serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 500;
}

.bar__nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 34px);
}

.bar__nav a {
  transition: opacity 0.2s;
}

@media (hover: hover) {
  .bar__nav a:hover {
    opacity: 0.55;
  }
}

.bar a:focus-visible,
.outro__link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* ---------------------------------------------------------------- before and after the room */
.intro,
.outro {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 120px var(--edge);
  text-align: center;
}

.intro__kicker {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.intro__title,
.outro__title {
  max-width: 13em;
  margin: 0;
  font-family: 'Bodoni Moda Variable', Georgia, serif;
  font-size: clamp(38px, 5.4vw, 84px);
  font-style: italic;
  font-weight: 420;
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.intro__hint {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.outro__link {
  margin-top: 10px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--ink);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- the room */
.room {
  position: relative;
}

.stage {
  position: relative;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  /* the perspective is set by the script: it is the distance of your eye from the screen */
  perspective: 900px;
}

.walls {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/* a word on a wall: the script places and turns it; the colour runs across it and shifts as it turns */
.word {
  position: absolute;
  left: 50%;
  top: 44%;
  margin: 0;
  padding: 0 0.1em 0.06em;
  font-family: 'Bodoni Moda Variable', Georgia, serif;
  font-size: clamp(92px, 17vw, 290px);
  font-style: italic;
  font-weight: 430;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.captions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13vh;
  height: 3.2em;
  pointer-events: none;
}

.caption {
  position: absolute;
  inset: 0;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: clamp(13px, 1.25vw, 18px);
  font-weight: 560;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: center;
  text-transform: uppercase;
}

.caption span {
  display: block;
  opacity: 0;
}

/* the ruler on the right edge: ticks, a mark that moves down, and how far the room has turned */
.ruler {
  position: absolute;
  top: 50%;
  right: clamp(18px, 2.2vw, 32px);
  width: 12px;
  height: 46vh;
  transform: translateY(-50%);
  background: repeating-linear-gradient(to bottom, rgba(29, 27, 24, 0.32) 0 1px, transparent 1px 9px);
}

.ruler__mark {
  position: absolute;
  left: -4px;
  top: 0;
  width: 20px;
  height: 2px;
  background: var(--ink);
}

.ruler__value {
  position: absolute;
  right: 24px;
  top: -7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .bar__nav {
    display: none;
  }

  .word {
    font-size: 21vw;
  }

  .captions {
    bottom: 16vh;
    height: 4.6em;
  }

  .ruler {
    height: 34vh;
  }

  /* on a phone the percentage would touch the end of the word: the ticks and the mark are enough */
  .ruler__value {
    display: none;
  }
}
