@font-face {
  font-family: 'Switzer';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/switzer-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Switzer';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/switzer-800.woff2') format('woff2');
}

/* DLB, portfolio of Davide Lo Bartolo */

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

:root {
  --fondo: #0A0A0A;
  --glifo: #484846;
  --testo: #FFFFFF;
  --grigio: rgba(255, 255, 255, .5);
  --filetto: #FFFFFF;
  --filetto-2: rgba(255, 255, 255, .2);

  --px: clamp(0.6px, calc(100vw / 1440), 1.5px);
  --m: calc(var(--px) * 12);                                   /* page margin */
  --g: calc(var(--px) * 16);                                   /* gutter */
  --col: calc((100vw - 2 * var(--m) - 3 * var(--g)) / 4);      /* one column of four */
  --passo: calc(var(--col) + var(--g));

  /* type scale */
  --piccolo: max(14px, calc(var(--px) * 16));
  --medio: max(20px, calc(var(--px) * 28));
  --titolo: max(30px, calc(var(--px) * 54));
  --grande: min(6vw, 13svh);

  --font: "Switzer", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html {
  background: var(--fondo);
  color: var(--testo);
  scrollbar-width: none;
  -webkit-text-size-adjust: 100%;
}
html::-webkit-scrollbar { display: none; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: var(--font);
  font-weight: 500;
  font-size: var(--piccolo);
  line-height: 1.06;
  letter-spacing: -.01em;
  background: var(--fondo);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--testo); color: var(--fondo); }

p { text-wrap: pretty; }
.nota, .titolone-cosa, .scheda dd { line-height: 1.14; }

/* keyboard focus */
:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
[tabindex="-1"]:focus-visible { outline: none; }
html { scroll-padding-top: calc(var(--px) * 70); }

.salta { position: fixed; left: var(--m); top: var(--m); z-index: 50; transform: translateY(-400%); }
.salta:focus { transform: none; }

.par { font-weight: inherit; font-style: normal; }
.tra { position: relative; display: block; width: fit-content; }
.tra .par { position: absolute; top: .06em; line-height: 1; }
.tra .par--s { right: 100%; }
.tra .par--d { left: 100%; margin-left: .02em; }

/* optical alignment for large letters */
.ottico { margin-left: -.055em; }

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 500; font-size: inherit; }
button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; border-radius: 0; cursor: pointer; }

img, video { display: block; width: 100%; height: auto; }

.js .appare, .js .entra { opacity: 0; }
.js .sale { transform: translateY(112%); }
.js body[data-arrivo="lettere"] .glifi i { transform: translateY(104%); }
.js .glifi-pista { opacity: 0; }
.js.caratteri .glifi-pista { opacity: 1; transition: opacity .5s; }

/* giant letters behind the panels */
.glifi { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.glifi-pista {
  position: absolute;
  left: 0;
  top: 50%;
  display: flex;
  font-weight: 800;
  font-size: 150svh;
  line-height: 1;
  letter-spacing: -.05em;
  white-space: nowrap;
  color: var(--glifo);
  transform: translate3d(4vw, -52%, 0);
  animation: scorre 90s linear infinite;
  animation-delay: var(--fase, 0s);
}
.glifi-pista span { display: block; flex: none; padding-right: .2em; }
.glifi-pista i { display: inline-block; font-style: normal; }
@keyframes scorre {
  from { transform: translate3d(4vw, -52%, 0); }
  to { transform: translate3d(calc(-100% / 3 + 4vw), -52%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .glifi-pista { animation: none; }
}

/* header */
.testata {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  color: #FFFFFF;
  mix-blend-mode: difference;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  align-items: start;
  padding: calc(var(--px) * 14) var(--m) 0;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.2, .7, .1, 1), opacity .35s;
}
/* out of the way while scrolling down (main.js), plain white over the dark panels */
.testata--via { transform: translateY(-100%); opacity: 0; }
.testata--via .marchio, .testata--via .menu { pointer-events: none; }
.testata--piatto { mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) {
  .testata { transition: none; }
}
.marchio { grid-column: 1; justify-self: start; display: flex; gap: calc(var(--px) * 10); align-items: flex-start; pointer-events: auto; }
.marchio b { display: block; padding: .2em .24em .16em .2em; background: #FFFFFF; color: #000000; font-weight: 800; font-size: max(19px, calc(var(--px) * 25)); line-height: .76; letter-spacing: -.06em; white-space: nowrap; }
.menu { grid-column: 4; justify-self: end; display: flex; gap: max(14px, calc(var(--px) * 26)); pointer-events: auto; }
.menu a, .indice a, .piede a, a.torna, .film-pausa { text-decoration: underline transparent; text-underline-offset: .22em; text-decoration-thickness: 1px; transition: text-decoration-color .25s; }
.menu a:hover, .menu a[aria-current="true"], .indice a:hover, .piede a:hover, a.torna:hover, .film-pausa:hover { text-decoration-color: currentColor; }

.et {
  display: inline-block;
  padding: .5em .7em .46em;
  background: var(--testo);
  color: var(--fondo);
  box-shadow: inset 0 0 0 1px var(--testo);
  line-height: 1;
  white-space: nowrap;
  transition: background-color .25s, color .25s;
}
.et:hover, .et:focus-visible { background: transparent; color: var(--testo); }
.et:focus-visible { outline: none; }

/* panels */
.guscio { position: relative; z-index: 1; height: 200svh; margin-bottom: -100svh; }
.piatto { position: sticky; z-index: 1; height: 100svh; min-height: calc(var(--px) * 600); }
.piatto--inizio { top: 0; }
.piatto--fine { bottom: 0; }

.nota { display: grid; grid-template-columns: auto 1fr; column-gap: .6em; }
.nota .n { white-space: nowrap; }
.nota--1 { position: absolute; left: calc(var(--m) + var(--passo)); top: calc(var(--px) * 14); width: var(--col); }
.nota--2 { position: absolute; left: calc(var(--m) + var(--passo) * 2); bottom: var(--m); width: var(--col); }

.lockup {
  position: absolute;
  left: var(--m);
  right: var(--m);
  top: 58svh;
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  align-items: baseline;
  font-size: var(--grande);
  line-height: 1;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.lockup-a { grid-column: 1; }
.lockup-b { grid-column: 2 / 4; }
.lockup-c { grid-column: 4; justify-self: end; }
.maschera { display: block; overflow: hidden; padding: .06em .04em .16em .07em; margin: -.06em -.04em -.16em -.07em; }
.sale { display: block; will-change: transform; }

.indice { position: absolute; left: var(--m); bottom: var(--m); display: flex; flex-direction: column; }
.indice a { display: block; }
.indice span { display: inline-block; width: 1.5em; font-variant-numeric: tabular-nums; }

.vai { position: absolute; right: var(--m); bottom: var(--m); }
.vai span { display: inline-block; transform: translateY(-.09em); }

.posta {
  position: absolute;
  left: calc(var(--m) + var(--passo));
  top: 58svh;
  transform: translateY(-50%);
  font-size: var(--grande);
  line-height: 1;
  letter-spacing: -.04em;
  white-space: nowrap;
  text-decoration: underline transparent;
  text-underline-offset: .12em;
  text-decoration-thickness: .05em;
  transition: text-decoration-color .25s;
}
.posta:hover { text-decoration-color: currentColor; }
.piede {
  position: absolute;
  left: var(--m);
  right: var(--m);
  bottom: var(--m);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  align-items: end;
}
.piede-link { display: flex; flex-direction: column; }
.piede-anno { justify-self: end; }

/* pages */
.corpo { position: relative; }
.pagine { position: relative; z-index: 2; background: var(--fondo); padding-bottom: calc(var(--px) * 150); overflow-x: clip; }
/* the black page sliding over the black panels: a faint edge, so the giant letters read as covered, not cut */
.pagine:not(.pagine--carta) { border-top: 1px solid var(--filetto-2); border-bottom: 1px solid var(--filetto-2); }
.sezione { position: relative; padding: calc(var(--px) * 150) var(--m) 0; }

.testa {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  align-items: baseline;
  padding-top: calc(var(--px) * 12);
  border-top: 1px solid var(--filetto);
}
.testa > :nth-child(1) { grid-column: 1; }
.testa > :nth-child(2) { grid-column: 2; }
.testa-c { grid-column: 4; justify-self: end; }

.titolone {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  align-items: baseline;
  align-items: last baseline;
  margin-top: calc(var(--px) * 96);
  font-size: var(--grande);
  line-height: 1;
  letter-spacing: -.04em;
}
.titolone-nome { grid-column: 2 / 4; }
.titolone-anno { grid-column: 4; justify-self: end; }
.titolone-cosa {
  grid-column: 1;
  padding-right: .8em;
  font-size: var(--piccolo);
  line-height: 1.06;
  letter-spacing: -.01em;
  color: var(--grigio);
}
a.titolone .titolone-nome {
  text-decoration: underline transparent;
  text-underline-offset: .1em;
  text-decoration-thickness: .045em;
  transition: text-decoration-color .25s;
}
a.titolone:hover .titolone-nome, a.titolone:focus-visible .titolone-nome,
a.titolone:has(+ .vetrina .vetrina-figura:hover) .titolone-nome { text-decoration-color: currentColor; }
a.titolone:focus-visible { outline: none; }
.titolone--attesa { color: var(--grigio); }
.titolone--attesa .titolone-cosa { color: inherit; }

.vetrina {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  align-items: end;
  margin-top: calc(var(--px) * 40);
}
.vetrina-apri { display: none; grid-column: 1; grid-row: 1; justify-self: start; }
.vetrina-figura { grid-column: 2 / 5; grid-row: 1; display: block; background: #111; }
.vetrina-figura img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

.mestieri {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--g);
  margin-top: calc(var(--px) * 96);
  padding-top: calc(var(--px) * 12);
  border-top: 1px solid var(--filetto-2);
  list-style: none;
}

.dichiarazione {
  margin-top: calc(var(--px) * 96);
  font-size: var(--titolo);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-indent: var(--passo);
}
.sotto { display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--g); row-gap: calc(var(--px) * 88); align-items: baseline; margin-top: calc(var(--px) * 56); }
.sotto-testo { grid-column: 2 / 4; max-width: calc(var(--px) * 520); font-size: var(--medio); line-height: 1.1; letter-spacing: -.025em; }
/* the review on its own row, as large as the sentence above it: the only voice on the site that is not mine */
.detto { grid-column: 2 / 5; max-width: calc(var(--col) * 2 + var(--g)); }
.detto blockquote { font-size: var(--medio); line-height: 1.1; letter-spacing: -.025em; text-indent: -.4em; text-wrap: pretty; }
.detto figcaption { margin-top: .9em; color: var(--grigio); }

/* case study */
.pagine--carta {
  --fondo: #E3E2DD;
  --testo: #0A0A0A;
  --grigio: rgba(10, 10, 10, .62);
  --filetto: #0A0A0A;
  --filetto-2: rgba(10, 10, 10, .18);
  color: var(--testo);
}
.pagine--carta ::selection { background: var(--testo); color: var(--fondo); }

.apertura { padding: max(88px, 16svh) var(--m) 0; }
.apertura-riga { display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--g); align-items: baseline; }
.apertura-riga > :nth-child(2) { grid-column: 2 / 4; }
.apertura-riga > :last-child { grid-column: 4; justify-self: end; }
.nomone { margin-top: calc(var(--px) * 14); margin-bottom: var(--discesa, 0px); font-weight: 800; font-size: var(--corpo, 30vw); line-height: .78; letter-spacing: -.05em; white-space: nowrap; }
.nomone .maschera { padding: .05em .06em .22em .08em; margin: -.05em -.06em -.22em -.08em; }
.nomone .sale { margin-left: var(--rientro, 0); }
.scheda { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--g); align-items: start; margin-top: calc(var(--px) * 26); padding-top: calc(var(--px) * 12); border-top: 1px solid var(--filetto); }
.scheda dt { color: var(--grigio); }
.scheda-apri { grid-column: 4; justify-self: end; }

.scritto {
  margin-top: calc(var(--px) * 96);
  margin-left: var(--passo);
  max-width: calc(var(--col) * 2 + var(--g));
  font-size: var(--medio);
  line-height: 1.1;
  letter-spacing: -.025em;
}

.film { --largo: min(100%, calc((100svh - var(--px) * 58 - 44px) * 16 / 9)); margin-top: calc(var(--px) * 96); padding: 0 var(--m); }
.film-quadro, .film--pronto .film-barra { width: var(--largo); margin-left: auto; margin-right: auto; }
.film-quadro { position: relative; overflow: hidden; background: #111; }
.pagine--carta .film-quadro { background: #D3D2CC; }   /* a paper-toned placeholder until the poster arrives, not a dark block */

/* the sheet that slides up when a case study opens (main.js) */
.foglio { position: fixed; inset: 0; z-index: 60; background: #E3E2DD; transform: translateY(100%); pointer-events: none; }
.foglio.su { transform: none; transition: transform .62s cubic-bezier(.7, 0, .25, 1); }
.film video { aspect-ratio: 16 / 9; object-fit: cover; }

.film-via, .film-barra { display: none; }

.film--pronto .film-via { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.film-tasto {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(64px, 10.5%, 150px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  transition: transform .5s cubic-bezier(.2, .7, .1, 1), opacity .3s;
}
.film-tasto svg { display: block; width: 100%; height: 100%; fill: #FFFFFF; }
.film-via:hover .film-tasto, .film-via:focus-visible .film-tasto { transform: translate(-50%, -50%) scale(1.14); }
.film-via:focus-visible { outline: none; }
.film-via:focus-visible .film-tasto { outline: 2px solid #FFFFFF; outline-offset: 5px; border-radius: 50%; }
.film--va .film-tasto { opacity: 0; transform: translate(-50%, -50%) scale(.72); }

.film--pronto .film-barra { display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--g); align-items: center; margin-top: calc(var(--px) * 6); }
.film-pausa { grid-column: 1; justify-self: start; }
.film-coda { grid-column: 2 / 5; display: flex; align-items: center; gap: var(--g); }
.film-corsa { flex: 1; position: relative; height: calc(var(--px) * 24); cursor: pointer; touch-action: none; }
.film-corsa::before, .film-corsa i { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; }
.film-corsa::before { background: var(--filetto-2); }
.film-corsa i { background: var(--testo); transform-origin: 0 50%; transform: scaleX(0); }
.film-tempo { font-variant-numeric: tabular-nums; }

.voci { margin-top: calc(var(--px) * 150); padding: 0 var(--m); }
.voce { display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--g); align-items: baseline; padding: calc(var(--px) * 12) 0 calc(var(--px) * 112); border-top: 1px solid var(--filetto); }
.voce > :nth-child(1) { grid-column: 1; }
.voce h2 { grid-column: 2; }
.voce p { grid-column: 3 / 5; max-width: calc(var(--px) * 640); font-size: var(--medio); line-height: 1.1; letter-spacing: -.025em; }
.voce p + p { margin-top: .7em; }
.voce:last-child { padding-bottom: 0; }
.voce p a { text-decoration: underline; text-underline-offset: .12em; text-decoration-thickness: 1px; }

/* narrow screens */
.marchio span { white-space: nowrap; }
@media (max-width: 999px) {
  .marchio .ruolo { display: none; }
}

/* phone */
@media (max-width: 479px), (max-width: 899px) and (orientation: portrait) {
  .marchio span { display: none; }
  :root {
    --m: 14px;
    --g: 10px;
    --piccolo: clamp(15px, 2.1vw, 18px);
    --medio: clamp(22px, 3.4vw, 30px);
    --titolo: 8.2vw;
    --grande: 15vw;
  }

  .glifi-pista { font-size: 118svh; }

  .testata { padding-top: 14px; }
  .marchio b { font-size: 20px; }
  .menu { grid-column: 2 / 5; gap: 16px; }
  .testata .menu a { padding-block: 12px; margin-block: -12px; }

  .piatto { display: flex; flex-direction: column; min-height: 560px; padding: 68px var(--m) calc(var(--m) + env(safe-area-inset-bottom, 0px)); }
  .nota--1, .nota--2, .lockup, .vai, .posta, .piede { position: static; width: auto; transform: none; }
  .indice { display: none; }
  .nota--1, .nota--2 { margin-left: var(--passo); max-width: 36ch; }
  .nota--1 { order: 1; }

  .lockup { order: 2; margin: auto 0; grid-template-columns: 1fr auto; font-size: 17vw; line-height: .95; white-space: normal; }
  .lockup-a { grid-column: 1; grid-row: 1; }
  .lockup-c { grid-column: 2; grid-row: 1; }
  .lockup-b { grid-column: 1 / 3; grid-row: 2; }
  .tra { width: auto; }
  .tra .par { display: none; }

  .nota--2 { order: 3; }
  .vai, .vetrina-apri { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 17px 14px 16px; font-size: clamp(16px, 2.2vw, 19px); }
  /* outlined, not filled: the buttons stay thumb-sized without outweighing the pictures */
  .vai, .vetrina-apri { background: transparent; color: var(--testo); }
  .vai:active, .vetrina-apri:active { background: var(--testo); color: var(--fondo); }
  .vai { order: 4; margin-top: 20px; }

  .posta { order: 2; margin: auto 0 auto -.055em; font-size: 9.5vw; line-height: .98; white-space: normal; }
  .piede { order: 3; position: relative; inset: auto; grid-template-columns: 1fr auto; row-gap: 8px; padding-top: 12px; align-items: start; }
  /* the footer stands on its own black base: the edge of the giant letters stops at its rule
     instead of running through the name */
  .piede::before { content: ""; position: absolute; z-index: -1; top: 0; left: calc(var(--m) * -1); right: calc(var(--m) * -1); bottom: calc(-1 * (var(--m) + env(safe-area-inset-bottom, 0px))); border-top: 1px solid var(--filetto); background: var(--fondo); }
  .piede > span:nth-child(1) { display: none; }
  .piede > span:nth-child(2) { grid-column: 1; grid-row: 1; }
  .piede-anno { grid-column: 2; grid-row: 1; }
  .piede-link { grid-column: 1 / 3; grid-row: 2; flex-direction: row; gap: 24px; }
  .piede-link a { padding: 10px 0 6px; }

  .pagine { padding-bottom: 88px; }
  .sezione { padding-top: 88px; }
  .testa { grid-template-columns: 2.2em 1fr auto; }
  .testa > :nth-child(1) { grid-column: 1; }
  .testa > :nth-child(2) { grid-column: 2; }
  .testa-c { grid-column: 3; }

  .titolone { grid-template-columns: 1fr auto; row-gap: 12px; margin-top: 40px; }
  .titolone-nome { grid-column: 1; grid-row: 1; }
  .titolone-anno { grid-column: 2; grid-row: 1; align-self: start; }
  .titolone-cosa { grid-column: 1 / 3; grid-row: 2; align-self: start; }
  .vetrina { display: flex; flex-direction: column; align-items: flex-start; gap: var(--m); margin-top: 26px; }
  .vetrina-figura { order: 1; width: calc(100% + 2 * var(--m)); margin: 0 calc(var(--m) * -1); }
  .vetrina-apri { order: 2; }

  .mestieri { grid-template-columns: 1fr 1fr; row-gap: 6px; margin-top: 40px; }

  .dichiarazione { margin-top: 40px; line-height: 1.02; }
  .sotto { display: flex; flex-direction: column; row-gap: 0; margin-top: 26px; }
  .sotto-testo { padding-left: var(--passo); }
  .sotto-testo { max-width: none; }
  .detto { order: 2; margin-top: 32px; max-width: none; }   /* the review uses the full width: 17 letters a line was too narrow */

  .apertura { padding-top: 92px; }
  .apertura-riga { grid-template-columns: 1fr auto; }
  .apertura-riga > :nth-child(2) { display: none; }
  .apertura-riga > :last-child { grid-column: 2; }
  .nomone { margin-top: 10px; }
  .scheda { grid-template-columns: 1fr 1fr; row-gap: 16px; margin-top: 18px; }
  .scheda-apri { grid-column: 2; justify-self: start; }
  .scritto { margin: 40px 0 0; max-width: 24ch; }
  .film { --largo: 100%; margin-top: 40px; padding: 0; }
  .film--pronto .film-barra { width: auto; }
  .film-tasto { width: clamp(76px, 12vw, 110px); }
  .film--pronto .film-barra { display: flex; gap: 12px; margin-top: 4px; padding: 0 var(--m); }
  .film-pausa { min-width: 3.2em; text-align: left; }
  .film-coda { flex: 1; gap: 12px; }
  .film-corsa { height: 36px; }
  .voci { margin-top: 88px; }
  .voce { grid-template-columns: 2.2em 1fr; row-gap: 18px; padding-bottom: 64px; }
  .voce > :nth-child(1) { grid-column: 1; }
  .voce h2 { grid-column: 2; }
  .voce p { grid-column: 1 / 3; }
}
/* short phones */
@media (max-width: 479px) and (max-height: 620px) {
  .copertina .nota--2 { display: none; }
}

/* low landscape screens */
@media (max-width: 479px) and (max-height: 559px), (max-width: 559px) and (orientation: portrait) and (max-height: 559px) {
  .guscio { height: auto; margin-bottom: 0; }
  .piatto--inizio { position: relative; height: 560px; }
}

/* hit areas of at least 24px for the small text links, without moving them */
.menu a, .film-pausa, a.torna { padding-block: 4px; margin-block: -4px; }
