/* Project archive, each window opening like a shutter: the archive page of Halde, a made-up architecture studio. Warm
   paper, black ink, one clay accent for the swing drawn in plan. In a tall section a stage stays still while you
   scroll: the thin column of the project on the left (under the window on a phone), the window on the right. The
   shutter is drawn by the script in perspective, the photo behind it never moves. */
:root {
  --carta: #f1ece3;        /* the paper of the page, and the face of a closed shutter */
  --anta: #efe9df;         /* the face of the shutter in the light */
  --anta-retro: #d9d1c4;   /* the back of the shutter, seen once it swings past the hinge */
  --inchiostro: #161412;   /* the words and the hinges */
  --tenue: #8a8278;        /* the small words */
  --sottile: #d4ccbf;      /* the frame the window will reach, the hairlines */
  --accento: #b4462c;      /* clay: the swing drawn in plan */
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the fine grain over the whole page, so the paper is never flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ the bar at the top */
.barra {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 3vh, 26px) clamp(16px, 4.4vw, 56px);
}

.marchio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 660;
  font-variation-settings: 'wdth' 108;
  letter-spacing: -0.02em;
}

.marchio__segno {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
}

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

.barra__voci a {
  color: var(--tenue);
  text-decoration: none;
  transition: color 0.3s ease;
}

.barra__voci a[aria-current] {
  color: var(--inchiostro);
}

@media (hover: hover) {
  .barra__voci a:hover {
    color: var(--inchiostro);
  }
}

/* ------------------------------------------------------------ the opening and the end */
.apertura {
  display: grid;
  align-content: center;
  gap: clamp(12px, 3vh, 22px);
  height: 100vh;
  height: 100lvh;
  padding: 64px clamp(16px, 5vw, 72px) 32px;
}

.apertura--fine {
  justify-items: start;
}

.piccolo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.piccolo--tenue {
  color: var(--tenue);
}

.giu {
  width: 10px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.titolo {
  margin: 0;
  max-width: 10em;
  font-size: clamp(38px, min(8vw, 12vh), 116px);
  font-weight: 340;
  font-variation-settings: 'wdth' 90;
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.titolo em {
  font-style: normal;
  color: var(--tenue);
}

.titolo--medio {
  font-size: clamp(34px, min(6vw, 9vh), 84px);
}

.pulsante {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--inchiostro);
  color: var(--carta);
  font-size: 14px;
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 10px 24px -12px rgba(22, 20, 18, 0.6);
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pulsante svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {
  .pulsante:hover {
    font-variation-settings: 'wdth' 118;
    transform: scale(1.03);
  }

  .pulsante:hover svg {
    transform: translateX(3px);
  }
}

.pulsante:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------ the stage */
.archivio {
  position: relative;
  height: 620vh;
}

.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(52px, 10vh, 92px) clamp(16px, 4.4vw, 56px) clamp(14px, 4vh, 40px);
}

/* the column and the window side by side on a computer; the shutter reaches above and below the frame as it
   swings towards you, so the window keeps a margin of 13% of its height */
.scena {
  --h: min(560px, calc((100vh - 170px) / 1.3), calc(46vw * 1.25));
  --w: calc(var(--h) * 0.8);
  display: grid;
  grid-template-columns: minmax(170px, 230px) var(--w);
  align-items: center;
  gap: clamp(28px, 5vw, 80px);
}

/* ------------------------------------------------------------ the thin column */
.colonna {
  display: grid;
  gap: 16px;
  align-self: center;
}

.etichetta {
  margin: 0;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0.02em;
  color: var(--tenue);
}

.schede {
  position: relative;
  height: 9.6em;
  font-size: 14px;
}

.scheda {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.nome {
  margin: 0 0 14px;
  font-size: clamp(20px, min(2.2vw, 3.6vh), 28px);
  font-weight: 460;
  font-variation-settings: 'wdth' 88;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.dati {
  margin: 0;
  border-top: 1px solid var(--sottile);
}

.dati > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--sottile);
}

.dati dt {
  color: var(--tenue);
  font-size: 12px;
}

.dati dd {
  margin: 0;
  font-size: 13px;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
}

/* every line in its own window, so it can rise from below and leave upwards */
.riga {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.riga > span {
  display: inline-block;
  will-change: transform;
}

/* the swing in plan, like on a drawing */
.pianta {
  width: 72px;
  height: 45px;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
}

.pianta__muro {
  stroke: var(--inchiostro);
  stroke-width: 2;
}

.pianta__arco {
  stroke: var(--accento);
  stroke-width: 0.8;
  stroke-dasharray: 1.4 2.2;
}

.pianta__anta {
  stroke: var(--accento);
  stroke-width: 1.6;
}

.pianta__cardine {
  fill: var(--carta);
  stroke: var(--inchiostro);
  stroke-width: 1;
}

/* ------------------------------------------------------------ the window */
.cornice {
  position: relative;
  width: var(--w);
  height: var(--h);
  margin-block: calc(var(--h) * 0.13);
}

/* the full frame the window will reach, a hairline as on a drawing */
.telaio {
  position: absolute;
  inset: 0;
  border: 1px solid var(--sottile);
}

/* two hinges on the right edge */
.cardini::before,
.cardini::after {
  content: '';
  position: absolute;
  right: -1.5px;
  width: 3px;
  height: clamp(8px, 2.4vh, 14px);
  border-radius: 1px;
  background: var(--inchiostro);
  z-index: 6;
}

.cardini::before {
  top: 16%;
}

.cardini::after {
  bottom: 16%;
}

.vano {
  position: absolute;
  inset: 0;
  margin: 0;
  visibility: hidden;
}

/* the photo: still, always the size of the whole frame; only the opening in front of it changes */
.vano__foto {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #1c1a18;
  clip-path: inset(100% 100% 0 0);
}

.vano__foto img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* the soft shadow the shutter throws into the room, next to its edge */
.vano__ombra {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(270deg, rgba(14, 10, 6, 0.5), rgba(14, 10, 6, 0.16) 38%, rgba(14, 10, 6, 0));
  transform-origin: 100% 50%;
  opacity: 0;
  pointer-events: none;
}

/* a hairline of light on the inside of the opening */
.vano__foto::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

/* the shutter, drawn by the script in perspective */
.anta {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}

.anta__faccia {
  stroke: none;
}

.anta__pannello {
  fill: none;
  stroke: rgba(22, 20, 18, 0.16);
  stroke-width: 0.8;
}

.anta__bordo {
  fill: none;
  stroke: #fffaf2;
  stroke-width: 1.2;
  stroke-linecap: round;
}

/* ------------------------------------------------------------ narrower screens: the window on top, the column under it */
@media (max-width: 760px) {
  .scena {
    --h: min(calc((100vh - 176px) / 1.26), calc((100vw - 40px) * 1.25));
    grid-template-columns: max(var(--w), min(300px, calc(100vw - 40px)));
    gap: 4px;
  }

  .cornice {
    justify-self: center;
  }

  .colonna {
    order: 2;
    gap: 6px;
  }

  .etichetta,
  .pianta {
    display: none;
  }

  .schede {
    height: 66px;
    font-size: 12px;
  }

  .nome {
    margin-bottom: 6px;
    font-size: clamp(17px, min(4.6vw, 4.6vh), 22px);
  }

  .dati {
    display: grid;
    grid-template-columns: repeat(3, auto);
    border-top: 0;
  }

  .dati > div {
    display: grid;
    gap: 1px;
    padding: 4px 8px 0 0;
    border-bottom: 0;
    border-top: 1px solid var(--sottile);
  }

  .dati dt {
    font-size: 10.5px;
  }

  .dati dd {
    font-size: 12px;
  }
}
