/* COMPA — stile del sito */

:root {
  /* Inter prima: una "Helvetica Neue" installata male su Windows può uscire in corsivo. */
  --font: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1440px;
  --gap: clamp(12px, 2vw, 24px);
  --tile-ratio: 4 / 3;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="light"] {
  --bg: #f4f2ee;
  --surface: #e9e6e0;
  --text: #141414;
  --muted: #6a6862;
  --line: #d6d2ca;
  --accent: #e8431a;
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --text: #edebe7;
  --muted: #8d8b86;
  --line: #2a2a2a;
  --accent: #ff6236;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}

img, video { display: block; max-width: 100%; }

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

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: var(--gutter); top: -100px;
  background: var(--text); color: var(--bg); padding: 8px 12px; z-index: 20;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Intestazione */

.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.top .wrap {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px 32px; min-height: 64px; padding-top: 12px; padding-bottom: 12px;
}
.logo { font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.menu { display: flex; gap: 24px; margin-left: auto; }
.menu a { font-size: 14px; color: var(--muted); transition: color .15s var(--ease); }
.menu a:hover, .menu a[aria-current] { color: var(--text); }
.menu a[aria-current] { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.toggles { display: flex; gap: 4px; }
.toggle {
  min-width: 40px; height: 40px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; font-weight: 500; letter-spacing: .04em;
  transition: border-color .15s var(--ease);
}
.toggle:hover { border-color: var(--text); }
.toggle svg { width: 16px; height: 16px; }

@media (max-width: 599px) {
  .menu { order: 3; width: 100%; margin-left: 0; gap: 20px; }
  .toggles { margin-left: auto; }
}

/* Contenuto */

html { scroll-behavior: smooth; }
main { flex: 1; }

section[id] { scroll-margin-top: var(--header-h, 72px); }

.section { border-top: 1px solid var(--line); padding: clamp(48px, 8vw, 112px) 0; }

.section-title {
  margin: 0 0 clamp(24px, 4vw, 40px);
  font-size: 14px; font-weight: 500; color: var(--muted);
  letter-spacing: .04em; text-transform: uppercase;
}

/* Scritta COMPA a gravità */

.hero { position: relative; overflow: hidden; }
.hero-stage { padding-top: clamp(96px, 18vh, 220px); }
.hero-word {
  margin: 0; display: flex; justify-content: space-between;
  font-size: 23.2vw; font-weight: 800; line-height: .8; letter-spacing: -.03em;
  padding-bottom: .06em;
  user-select: none; -webkit-user-select: none;
}
@media (min-width: 1440px) { .hero-word { font-size: calc((var(--max) - 96px) * .25); } }
.letter { display: inline-block; will-change: transform; }
.hero.is-physics .letter { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; cursor: grab; }
.hero.is-physics .letter:active { cursor: grabbing; }
.hero-floor { border-top: 2px solid var(--text); }

/* Griglia dei lavori */

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr; gap: calc(var(--gap) * 2) var(--gap);
}
@media (min-width: 700px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.tile { display: block; width: 100%; text-align: left; }
.tile-media {
  position: relative; overflow: hidden;
  aspect-ratio: var(--tile-ratio);
  background: var(--surface);
}
.tile-media video {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s var(--ease);
}
.tile:hover .tile-media video { transform: scale(1.02); }
.tile-play {
  position: absolute; right: 12px; bottom: 12px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; letter-spacing: .04em;
  opacity: 0; transition: opacity .2s var(--ease);
}
.tile:hover .tile-play, .tile:focus-visible .tile-play { opacity: 1; }
@media (hover: none) { .tile-play { opacity: 1; } }

.tile-title, .tile-meta, .tile-media { display: block; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 14px 0 2px; }
.tile-anno { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-title { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.tile-meta { margin: 0; font-size: 14px; color: var(--muted); }

/* Finestra video */

.player {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent; color: #fff;
}
.player::backdrop { background: rgba(0, 0, 0, .9); }
.player[open] { display: flex; align-items: center; justify-content: center; animation: fade .2s var(--ease); }
.player-close {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 22px; line-height: 1;
}
.player-close:hover { background: rgba(255, 255, 255, .24); }
.player-body { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.player-frame { background: #000; }
.player-frame iframe, .player-frame video { display: block; width: 100%; height: 100%; border: 0; }
.player-frame.is-orizzontale { aspect-ratio: 16 / 9; width: min(90vw, calc(85vh * 16 / 9)); width: min(90vw, calc(85dvh * 16 / 9)); }
.player-frame.is-verticale { aspect-ratio: 9 / 16; height: min(85vh, calc(90vw * 16 / 9)); height: min(85dvh, calc(90vw * 16 / 9)); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Chi sono */

.about { max-width: 900px; }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: minmax(96px, 160px) 1fr; gap: 16px; align-items: baseline; padding: clamp(16px, 2vw, 24px) 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-size: clamp(20px, 2.4vw, 30px); line-height: 1.3; letter-spacing: -.01em; }

/* Contatti */

.contact { max-width: 900px; }
.contact-invite { margin: 0 0 32px; font-size: clamp(24px, 3.2vw, 40px); line-height: 1.3; letter-spacing: -.02em; max-width: 20ch; }
.contact-links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.contact-links li { border-bottom: 1px solid var(--line); }
.contact-links a { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; flex-wrap: wrap; }
.contact-links span:first-child { color: var(--muted); font-size: 14px; }
.contact-links a:hover span:last-child { color: var(--accent); }
.contact-links span:last-child { font-size: clamp(16px, 2vw, 22px); word-break: break-all; transition: color .15s var(--ease); }

/* Piè di pagina */

.foot { border-top: 1px solid var(--line); }
.foot .wrap { padding-top: 20px; padding-bottom: 20px; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Logo: la O diventa 6 e torna O, in loop, scorrendo verso il basso */
.logo-o {
  display: inline-grid; overflow: hidden; vertical-align: top;
}
.logo-o > span { grid-area: 1 / 1; text-align: center; }
.logo-o-a { animation: logo-o-a 6.4s var(--ease) infinite; }
.logo-o-b { transform: translateY(-100%); animation: logo-o-b 6.4s var(--ease) infinite; }
@keyframes logo-o-a {
  0%, 38% { transform: translateY(0); }
  50%, 88% { transform: translateY(100%); }
  88.1% { transform: translateY(-100%); }
  100% { transform: translateY(0); }
}
@keyframes logo-o-b {
  0%, 38% { transform: translateY(-100%); }
  50%, 88% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}
