/* The people of Halden & Roe, a made-up architecture studio: a warm paper page, a short heading and a row of six
   narrow strips with real portraits in black and white. The strip under the pointer widens on a spring, takes its
   colour and shows the name, the role and a detail. On a phone the strips sit in a grid of three by two. The width of
   every strip (flex-grow), its colour (--c) and its veil (--a) are written by the script. */
:root {
  --carta: #f2ede5;        /* the warm paper of the page */
  --luce: #fbf8f3;         /* the soft light on the paper */
  --inchiostro: #191612;   /* the heading and the small words */
  --tenue: #8a8278;        /* the quiet words */
  --bordo: rgba(25, 22, 18, 0.14); /* the 1px edge of every strip */
  --vuoto: #d8d0c4;        /* the strip behind a photo still loading */
  --accento: #d0713f;      /* terracotta: the thread over the name and the small detail */
  --chiaro: #fbf6ef;       /* the name and the initials over the photo */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(110% 80% at 10% -12%, var(--luce) 0%, rgba(251, 248, 243, 0) 60%),
    radial-gradient(80% 60% at 100% 112%, rgba(208, 113, 63, 0.07), rgba(208, 113, 63, 0) 70%),
    var(--carta);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
}

/* a fine grain on the paper, so the page is never flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  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.3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.palco {
  width: min(1080px, 92vw);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.6vh, 26px);
}

/* the heading */
.testa {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  column-gap: 24px;
  row-gap: clamp(4px, 1vh, 10px);
}

.marchio {
  grid-column: 1 / -1;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(11px, 1.8vh, 13px);
  font-weight: 600;
  font-variation-settings: 'wdth' 110;
  letter-spacing: 0.01em;
}

.marchio__segno {
  width: 1.35em;
  height: 1.35em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.titolo {
  margin: 0;
  font-size: clamp(19px, min(3.4vw, 5.4vh), 46px);
  line-height: 1.02;
  font-weight: 560;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.025em;
}

.titolo em {
  font-style: normal;
  font-weight: 330;
  font-variation-settings: 'wdth' 118;
  color: var(--tenue);
}

.sotto {
  margin: 0;
  font-size: clamp(11px, 1.8vh, 14px);
  color: var(--tenue);
  text-align: right;
  max-width: 28ch;
  line-height: 1.35;
}

/* the row of strips: on a wide screen the two halves vanish and the six strips share one row */
.fila {
  display: flex;
  gap: clamp(5px, 0.8vw, 10px);
  height: clamp(200px, 56vh, 520px);
}

.mezza {
  display: contents;
}

.persona {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  border-radius: 14px;
  background: var(--vuoto);
  border: 1px solid var(--bordo);
  box-shadow:
    0 1px 1px rgba(40, 30, 20, 0.05),
    0 6px 14px -6px rgba(40, 30, 20, 0.16),
    0 calc(10px + 22px * var(--a, 0)) calc(24px + 30px * var(--a, 0)) -16px rgba(40, 30, 20, calc(0.18 + 0.2 * var(--a, 0)));
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.persona:focus-visible {
  box-shadow: 0 0 0 2px var(--carta), 0 0 0 3.5px var(--accento);
}

/* the photo: wider than a narrow strip and centred in it, so a strip that opens shows more of the same picture */
.persona__foto {
  position: absolute;
  inset: 0;
}

.persona__foto img {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: var(--largo, 100%);
  max-width: none;
  object-fit: cover;
  object-position: 50% 22%;
  filter:
    grayscale(calc(1 - var(--c, 0)))
    contrast(calc(1.1 - 0.08 * var(--c, 0)))
    brightness(calc(0.94 + 0.06 * var(--c, 0)));
}

/* film grain over the photo, tiled from a small canvas painted once by the script */
.persona::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: var(--grana, none);
  background-size: 160px 160px;
  mix-blend-mode: overlay;
  opacity: var(--grana-forza, 0.3);
}

/* the light caught by the top edge, and a soft inner rim */
.persona::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 22%);
}

/* the veil at the bottom, so the initials and the name always read */
.persona__velo {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(14, 11, 8, calc(0.42 + 0.28 * var(--a, 0))) 0%, rgba(14, 11, 8, calc(0.1 + 0.1 * var(--a, 0))) 34%, rgba(14, 11, 8, 0) 55%);
}

.persona__iniziali {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: clamp(10px, 2vh, 18px);
  margin-left: -0.6em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--chiaro);
  font-size: clamp(11px, 1.9vh, 15px);
  font-weight: 600;
  font-variation-settings: 'wdth' 80;
  letter-spacing: 0.22em;
  line-height: 1.2;
}

.persona__freccia {
  position: absolute;
  z-index: 3;
  top: clamp(8px, 1.4vh, 14px);
  right: clamp(8px, 1.4vh, 14px);
  width: clamp(24px, 4vh, 32px);
  height: clamp(24px, 4vh, 32px);
  padding: 7px;
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  fill: none;
  stroke: var(--chiaro);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.persona__scheda {
  position: absolute;
  z-index: 3;
  left: clamp(10px, 1.6vw, 20px);
  bottom: clamp(10px, 2vh, 20px);
  width: var(--largo-scheda, 220px);
  color: var(--chiaro);
  white-space: nowrap;
}

.persona__filo {
  display: block;
  width: 28px;
  height: 1px;
  margin-bottom: clamp(6px, 1.2vh, 10px);
  background: var(--accento);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.riga {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.riga > span {
  display: block;
}

.nome {
  font-size: clamp(15px, min(1.9vw, 3.4vh), 25px);
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.ruolo {
  margin-top: 2px;
  font-size: clamp(11px, 1.8vh, 14px);
  font-weight: 400;
  opacity: 0.86;
}

.dettaglio {
  margin-top: 6px;
  font-size: clamp(9.5px, 1.5vh, 11.5px);
  font-weight: 560;
  font-variation-settings: 'wdth' 118;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f2b48f;
}

/* the foot: a quiet line under the row */
.piede {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(10px, 1.6vh, 12.5px);
  color: var(--tenue);
  font-variation-settings: 'wdth' 108;
}

.piede__riga {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--bordo), rgba(25, 22, 18, 0.05));
}

/* the drawn pointer of the autopilot */
.pilota {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.22));
}

.pilota path {
  fill: #141210;
  stroke: #fff;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

/* a phone: two rows of three, each row widening its own strip */
@media (max-width: 640px) {
  .palco {
    width: 92vw;
    gap: clamp(8px, 2vh, 16px);
  }

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

  .sotto {
    text-align: left;
    max-width: none;
  }

  .fila {
    flex-direction: column;
    height: clamp(200px, 60vh, 560px);
    gap: 6px;
  }

  .mezza {
    display: flex;
    gap: 6px;
    flex: 1 1 0;
    min-height: 0;
  }

  .persona {
    border-radius: 11px;
  }

  /* on a short tile the initials stand in the corner, off the face */
  .persona__iniziali {
    left: 9px;
    margin-left: 0;
    bottom: 9px;
  }

  .piede {
    display: none;
  }
}

@media (max-height: 460px) {
  .sotto {
    display: none;
  }
}
