/* The folding screen transition: the page is a folding screen; on a click it folds up like a concertina against the
   left edge and the room behind it is the next page. Going back the screen opens again, panel after panel. */
:root {
  --paper: #f2eee6;
  --ink: #171615;
  --muted: #8a8479;
  --night: #161514;
  --night-ink: #ece7dd;
  --night-muted: #85807a;
  --accent: #d9452b;
  --crease: rgba(23, 22, 21, 0.17);
  --shade: #0b0a09;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  font-family: 'Bricolage Grotesque Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  /* the script writes --pad and --fs */
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--night);
}

/* ------------------------------------------------------------------ the pages */
.page {
  position: absolute;
  inset: 0;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  padding: calc(var(--pad, 40px) * 0.7) var(--pad, 40px);
}

.page.is-on {
  visibility: visible;
}

.page--a {
  /* sopra la pagina dopo anche se nel documento viene prima (il primo comando da cliccare è il suo) */
  z-index: 1;
  background: var(--paper);
  color: var(--ink);
  --soft: var(--muted);
}

.page--b {
  background: var(--night);
  color: var(--night-ink);
  --soft: var(--night-muted);
}

/* the folds of the screen, drawn on the page at rest */
.creases {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crease {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--crease);
}

.bar {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  font-stretch: 75%;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 30px);
  font-size: 14px;
}

.nav a {
  color: var(--soft);
  text-decoration: none;
  transition: color 0.25s ease;
}

.nav a[aria-current] {
  color: inherit;
}

@media (hover: hover) {
  .nav a:not([aria-current]):hover {
    color: var(--accent);
  }
}

a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 6px;
  border-radius: 2px;
}

/* ------------------------------------------------------------------ the main block */
.main {
  position: relative;
  margin-top: auto;
  padding-bottom: clamp(22px, 5vh, 56px);
}

.big {
  margin: 0;
  font-size: var(--fs, 160px);
  line-height: 0.9;
  font-weight: 640;
  font-stretch: 82%;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.ch {
  display: inline-block;
  font-stretch: calc(var(--w, 82) * 1%);
}

.below {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 40px;
  margin-top: clamp(18px, 3.2vh, 32px);
}

.lede {
  margin: 0;
  max-width: 38ch;
  text-wrap: pretty;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.5;
  color: var(--soft);
}

.go {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  font-weight: 560;
}

.go__t {
  display: inline-block;
  font-stretch: calc(var(--w, 100) * 1%);
}

.go__arrow {
  width: 26px;
  height: 12px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.go--back {
  margin-top: clamp(18px, 3.2vh, 32px);
}

.list {
  margin: clamp(16px, 3vh, 30px) 0 0;
  padding: 0;
  list-style: none;
  max-width: 760px;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 16px;
  padding: clamp(9px, 1.5vh, 13px) 0;
  font-size: clamp(14px, 1.15vw, 17px);
}

.row__rule {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: color-mix(in srgb, var(--night-ink) 22%, transparent);
  transform-origin: 0 50%;
}

.row__soft {
  color: var(--soft);
}

.row__end {
  font-variant-numeric: tabular-nums;
}

.row:first-child .row__end {
  color: var(--accent);
}

.foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 13px;
  color: var(--soft);
}

/* ------------------------------------------------------------------ the screen while it moves */
.screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  /* the 3D lives inside the screen only: the pages beside it stay flat and keep their order */
  perspective: 2200px;
  perspective-origin: 50% 50%;
  pointer-events: none;
  /* display, not visibility: the copies inside are visible on their own */
  display: none;
}

.screen.is-on {
  display: block;
}

.hinge {
  position: absolute;
  top: 0;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: 0 50%;
}

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.face > .page {
  visibility: visible;
}

/* the light on each panel: the ones turned away from the window darken */
.face__shade {
  position: absolute;
  inset: 0;
  background: var(--shade);
  opacity: 0;
}

/* the hinge line on the left edge of each panel */
.face__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--crease);
}

@media (max-width: 600px) {
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .row > .row__soft:not(.row__end) {
    display: none;
  }

  .foot {
    font-size: 12px;
  }

  .foot span:last-child {
    display: none;
  }
}
