/* Futura PT è il font del portfolio (Adobe Fonts): se si aggiunge il kit Typekit con "futura-pt"
   viene usato quello, altrimenti Jost (Google Fonts), che ne è una riproduzione molto fedele. */
:root {
  --font: "futura-pt", "Jost", "Futura", "Century Gothic", sans-serif;
  --white: #fff;
  --ink: #000;
  --grey: #a6a6a6;
  --room-bg: #120f0c;
  --radius: 16px;
  --gutter: clamp(16px, 2vw, 40px);
  --ease: cubic-bezier(.7, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: var(--room-bg);
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---------- Barra superiore ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  color: var(--white);
  text-transform: uppercase;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
  background: linear-gradient(rgba(0, 0, 0, .45), transparent);
  transition: color .3s, background .3s;
}
.brand { text-decoration: none; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: clamp(14px, 2vw, 32px); }
.topnav > a { text-decoration: none; }
.topnav > a:hover, .brand:hover { opacity: .7; }
.view-toggle { display: flex; border: 1px solid currentColor; border-radius: 999px; padding: 2px; }
.view-toggle button { padding: 4px 14px; border-radius: 999px; text-transform: uppercase; letter-spacing: inherit; font-weight: 500; }
.view-toggle button[aria-pressed="true"] { background: var(--white); color: var(--ink); }
body[data-view="list"] .topbar { color: var(--ink); background: var(--white); border-bottom: 1px solid var(--ink); }
body[data-view="list"] .view-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--white); }

/* Tendina contatti */
.contacts { position: relative; }
.contacts-toggle { text-transform: uppercase; letter-spacing: inherit; font-weight: 500; }
.contacts-toggle:hover { opacity: .7; }
.contacts-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 14px);
  width: min(360px, calc(100vw - 32px));
  padding: 6px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
}
.contacts-panel[hidden] { display: none; }
.contact-list { max-width: 520px; }
.contact-row { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; padding: 12px 0; }
.contact-row + .contact-row { border-top: 1px solid rgba(0, 0, 0, .15); }
.contact-label { grid-column: 1 / -1; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; opacity: .6; }
.contact-value { font-size: 16px; font-weight: 400; text-decoration: none; overflow-wrap: anywhere; }
.contact-value:hover { text-decoration: underline; }
.contact-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  transition: background .2s, color .2s;
}
.contact-copy svg { width: 15px; height: 15px; }
.contact-copy:hover, .contact-copy.is-copied { background: var(--ink); color: var(--white); }
.about .contact-row { border-color: currentColor; }

/* ---------- Stanza ---------- */
.room-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--room-bg);
}
.room-view::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: url("assets/room-1721.webp") center / cover;
  filter: blur(40px) brightness(.45);
}
.room-stage {
  position: relative;
  width: min(100vw, calc(100vh * 3442 / 1828));
  aspect-ratio: 3442 / 1828;
  transition: transform 1s var(--ease);
  will-change: transform;
}
.room-img { width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.room-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.room-svg .dim { fill: #000; opacity: 0; pointer-events: none; transition: opacity .35s; }
.room-svg.has-active .dim { opacity: .55; }
.zone { cursor: pointer; outline: none; }
.zone polygon {
  fill: transparent;
  stroke: transparent;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: fill .3s, stroke .3s;
}
.zone.is-active polygon { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .9); }
.hint-dot { pointer-events: none; transition: opacity .3s; }
.hint-dot circle { fill: #fff; }
.hint-dot .pulse { fill: none; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
.room-svg.has-active .hint-dot, body.is-zoomed .hint-dot { opacity: 0; }
@keyframes pulse { from { transform: scale(.4); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }

.room-label {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  color: var(--white);
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
  border-radius: 10px;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
}
.room-label.is-visible { opacity: 1; }
.room-label-kicker { font-size: 12px; letter-spacing: .06em; opacity: .75; }
.room-label-title { font-size: 17px; font-weight: 500; }

.room-hint {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 18px;
  color: var(--white);
  background: rgba(0, 0, 0, .45);
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity .4s;
}
body.is-zoomed .room-hint, body.has-explored .room-hint { opacity: 0; }

body[data-view="list"] .room-view { display: none; }

/* ---------- Elenco (come l'indice del PDF) ---------- */
.list-view { display: none; min-height: 100vh; padding-top: 58px; }
body[data-view="list"] .list-view { display: grid; grid-template-columns: 1fr 1fr; }
body[data-view="list"] { background: var(--white); }
.list-half { padding: clamp(24px, 3vw, 48px) var(--gutter) clamp(32px, 4vw, 64px); display: flex; flex-direction: column; }
.list-product { background: var(--white); color: var(--ink); }
.list-graphic { background: var(--grey); color: var(--white); }
.list-heading {
  margin: 0 0 clamp(24px, 4vw, 56px);
  font-size: clamp(30px, 3.4vw, 64px);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 1;
}
.list-product .list-heading::after { content: ""; display: block; width: 30%; height: 1px; margin-top: clamp(20px, 3vw, 48px); background: currentColor; }
.list-graphic .list-heading { text-align: right; }
.list-graphic .list-heading::after { content: ""; display: block; width: 30%; height: 1px; margin: clamp(20px, 3vw, 48px) 0 0 auto; background: currentColor; }
.list-cards { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.card { position: relative; display: flex; flex-direction: column; }
.card-main { flex: 1; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.card-img { aspect-ratio: 298 / 362; border-radius: var(--radius); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .card-img img { transform: scale(1.04); }
.card-num {
  align-self: flex-end;
  margin-top: -.62em;
  font-size: clamp(48px, 5.4vw, 104px);
  font-weight: 500;
  line-height: 1;
  position: relative;
}
.card-line { flex: 1; min-height: 40px; align-self: flex-end; width: 1px; margin-right: 2px; background: currentColor; }
.card-title {
  align-self: flex-end;
  text-align: right;
  margin-top: 6px;
  margin-right: 10px;
  font-size: clamp(15px, 1.3vw, 22px);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 1.2;
}
.card-items { list-style: none; margin: 10px 10px 0 0; padding: 0; text-align: right; font-size: 13px; line-height: 1.5; }
.card-items a { text-decoration: none; opacity: .85; }
.card-items a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Scheda progetto / about ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--white);
  color: var(--ink);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .45s ease, transform .45s ease;
}
.sheet.is-open { opacity: 1; transform: none; }
.sheet:focus { outline: none; }
.sheet.theme-grey { background: var(--grey); color: var(--white); }
.sheet.theme-dark { background: #000; color: var(--white); }

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px var(--gutter);
  background: inherit;
  text-transform: uppercase;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
}
.sheet-close { display: inline-flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: inherit; font-weight: 500; }
.sheet-close:hover { opacity: .7; }
.sheet-close svg { width: 18px; height: 18px; }

.proj-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.75fr);
  gap: clamp(28px, 4vw, 72px);
  max-width: 1800px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 48px) var(--gutter) clamp(40px, 5vw, 80px);
}
.proj-text { position: relative; padding: 28px 0 28px 0; }
/* le parentesi angolari delle pagine introduttive del PDF */
.proj-text::before, .proj-text::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 22px;
  border-left: 1px solid currentColor;
}
.proj-text::before { top: 0; border-top: 1px solid currentColor; border-top-left-radius: 8px; }
.proj-text::after { bottom: 0; border-bottom: 1px solid currentColor; border-bottom-left-radius: 8px; }

.proj-title { display: flex; align-items: flex-end; gap: 18px; margin: 10px 0 28px; }
.proj-title h1 {
  margin: 0;
  font-size: clamp(26px, 2.3vw, 42px);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.15;
}
.proj-title .rule { flex: 1; min-width: 40px; height: 1px; margin-bottom: .55em; background: currentColor; }
.proj-title .num { font-size: clamp(64px, 6.5vw, 128px); font-weight: 500; line-height: .8; }

.prose { font-size: clamp(15px, 1vw, 17px); line-height: 1.5; }
.prose p { margin: 0 0 1em; text-align: justify; hyphens: auto; }
.prose ul { margin: 0 0 1em; padding: 0; list-style: none; }
.prose li::before { content: "- "; }
.proj-section-title { margin: 1.8em 0 .7em; font-size: clamp(15px, 1vw, 17px); font-weight: 600; text-transform: uppercase; }
.software { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; column-gap: 40px; }

.proj-hero img { width: 100%; border-radius: var(--radius); }
.theme-dark .proj-hero img { border-radius: 0; }

.proj-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-content: start; }
.proj-item-link { text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.proj-item-link img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); transition: transform .5s var(--ease); }
.proj-item-link:hover img { transform: scale(1.02); }
.proj-item-link span { font-size: 15px; text-transform: uppercase; font-weight: 500; }
.proj-item-link small { display: block; font-size: 12px; opacity: .8; font-weight: 400; }

.item-head { max-width: 1920px; margin: 0 auto; padding: clamp(20px, 3vw, 48px) var(--gutter) clamp(8px, 1vw, 16px); }
.item-collection { display: inline-block; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; margin-bottom: clamp(16px, 2vw, 28px); }
.item-collection:hover { text-decoration: underline; }
.item-head .kicker { display: block; font-size: clamp(18px, 1.6vw, 28px); font-weight: 500; margin-bottom: 4px; }
.item-head h1 { display: flex; align-items: center; gap: 24px; margin: 0; font-size: clamp(28px, 3.2vw, 58px); font-weight: 500; line-height: 1.1; }
.item-head h1::after { content: ""; flex: 1; min-width: 40px; height: 1px; background: currentColor; }

.pages { max-width: 1920px; margin: 0 auto; }
.pages img { width: 100%; height: auto; }

.nda { max-width: 1100px; margin: 0 auto; padding: clamp(40px, 6vw, 100px) var(--gutter); }
.nda-kicker { font-size: clamp(22px, 2vw, 36px); text-transform: uppercase; font-weight: 500; margin: 0 0 1em; }
.nda h2 { font-size: clamp(18px, 1.4vw, 24px); font-weight: 400; margin: 0 0 1em; }
.btn {
  display: inline-block;
  margin-top: 12px;
  padding: 12px 26px;
  border: 1px solid currentColor;
  border-radius: 999px;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: .03em;
  transition: background .25s, color .25s;
}
.btn:hover { background: var(--white); color: var(--ink); }
.theme-light .btn:hover { background: var(--ink); color: var(--white); }

.proj-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
  max-width: 1800px;
  margin: clamp(40px, 6vw, 100px) auto 0;
  padding: 28px var(--gutter) 48px;
  border-top: 1px solid currentColor;
}
.proj-nav a { text-decoration: none; display: flex; flex-direction: column; gap: 4px; text-transform: uppercase; }
.proj-nav a:hover { opacity: .7; }
.proj-nav .next { text-align: right; }
.proj-nav small { font-size: 13px; letter-spacing: .06em; opacity: .8; }
.proj-nav strong { font-size: clamp(20px, 2vw, 34px); font-weight: 500; }

/* About (pagina 2 del PDF) */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .55fr) 1px minmax(0, 1.4fr);
  gap: clamp(20px, 2.4vw, 44px);
  max-width: 1800px;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 32px) var(--gutter) clamp(40px, 5vw, 80px);
}
.about-photo { position: relative; }
.about-photo img { width: 100%; }
.about-ciao { margin: -.62em 0 0; font-size: clamp(64px, 7vw, 132px); font-weight: 300; line-height: 1; position: relative; }
.about-iam { margin-top: clamp(28px, 6vw, 110px); font-size: clamp(30px, 3.2vw, 60px); line-height: 1.12; text-transform: uppercase; font-weight: 300; }
.about-iam strong { display: block; font-weight: 500; }
.about-bio { font-size: clamp(15px, 1vw, 17px); line-height: 1.45; }
.about-bio p { margin: 0 0 .9em; text-align: justify; hyphens: auto; }
.about-sep { background: currentColor; }
.about-side h2 { margin: 0 0 .8em; font-size: clamp(22px, 2vw, 36px); font-weight: 500; text-transform: uppercase; }
.about-side section + section { margin-top: clamp(28px, 3vw, 52px); }
.about-side .software { grid-template-columns: repeat(3, auto); column-gap: 56px; }
.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 18px; list-style: none; margin: 0; padding: 0; }
.skills li::before { content: none; }
.skills li { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 14px; line-height: 1.35; }
.skills img { width: clamp(52px, 4.2vw, 80px); height: auto; margin-bottom: 10px; }
.skills span { align-self: stretch; border-top: 1px solid currentColor; padding-top: 10px; }
.about-contact { margin-top: clamp(28px, 3vw, 52px); }

/* ---------- Copertina ---------- */
/* La copertina sfoca la stanza che c'è sotto e, uscendo, la mette a fuoco. */
.cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: var(--white);
  background: rgba(12, 9, 6, .35);
  -webkit-backdrop-filter: blur(28px);
  backdrop-filter: blur(28px);
  cursor: pointer;
  text-shadow: 0 1px 24px rgba(0, 0, 0, .35);
  transition: backdrop-filter 1.3s var(--ease), -webkit-backdrop-filter 1.3s var(--ease), background 1.3s var(--ease), opacity .5s ease 1s;
}
.cover.is-leaving { -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); background: rgba(12, 9, 6, 0); opacity: 0; }
.cover.is-leaving .cover-inner { opacity: 0; transform: scale(1.03); }
.cover.is-gone { display: none; }
/* Su telefono la stanza non c'è: si usa la sua immagine sfocata come sfondo. */
body.is-compact .cover::before {
  content: "";
  position: absolute;
  inset: -60px;
  z-index: -1;
  background: url("assets/room-1721.webp") center / cover;
  filter: blur(28px) brightness(.7);
}
body.is-compact .cover.is-leaving { transition: opacity .8s ease; }
.cover-inner { width: 100%; display: flex; flex-direction: column; text-transform: uppercase; transition: opacity .6s ease, transform 1.3s var(--ease); }
.cover-name, .cover-sub { font-size: clamp(13px, 1.45vw, 28px); font-weight: 500; }
.cover-name { margin-left: 1.9vw; }
.cover-rule { display: block; height: 1px; background: currentColor; transform: scaleX(0); transition: transform 1.1s var(--ease); }
.cover-rule-1 { width: 31.7vw; margin: 1.2vw 0 .2vw 1.9vw; transform-origin: left; }
.cover-rule-2 { margin: .3vw 1.9vw 1.4vw 34.2vw; transform-origin: right; }
.cover-title { margin: 0 0 0 18.2vw; font-size: clamp(44px, 7vw, 136px); font-weight: 500; line-height: 1; opacity: 0; transform: translateY(20px); transition: opacity .9s ease .25s, transform .9s ease .25s; }
.cover-sub { align-self: flex-end; margin-right: 1.9vw; }
.cover.is-ready .cover-rule { transform: scaleX(1); }
.cover.is-ready .cover-title { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  body[data-view="list"] .list-view { grid-template-columns: 1fr; }
  .proj-head { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr 1fr; }
  .about-sep { display: none; }
  .about-side { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar { font-size: 13px; padding: 14px 16px; }
  .list-view { padding-top: 50px; }
  .list-cards { grid-template-columns: 1fr; gap: 28px; }
  .card-img { aspect-ratio: 4 / 3; }
  .card-line { min-height: 24px; }
  .software, .about-side .software { grid-template-columns: repeat(2, auto); }
  .about { grid-template-columns: 1fr; }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .proj-nav strong { font-size: 18px; }
  .cover-name { margin-left: 16px; }
  .cover-sub { margin-right: 16px; }
  .cover-rule-1 { width: 55vw; margin-left: 16px; }
  .cover-title { margin-left: 10vw; }
  .cover-rule-2 { margin: 4px 16px 10px 30vw; }
}
/* Su telefono si mostra solo l'elenco */
body.is-compact .view-toggle { display: none; }

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

/* Tasto "Indietro" nelle schede: solo in overview (e quindi sempre su telefono) */
.sheet-bar-left { display: flex; align-items: center; gap: clamp(16px, 2vw, 32px); }
.sheet-back { display: none; text-transform: uppercase; letter-spacing: inherit; font-weight: 500; }
.sheet-back:hover { opacity: .7; }
body[data-view="list"] .sheet-back { display: inline-block; }
body[data-view="list"] .sheet-bar .brand { display: none; }
