@font-face {
  font-family: "Jost";
  src: url("../fonts/Jost-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

/* Michele Rho: stile del sito
   Identità mantenuta dal sito precedente: logo M/R, nome spaziato,
   home a tutta immagine, pagine interne bianche.

   Font: Futura se presente (Mac, iPhone, iPad), altrimenti Jost,
   Century Gothic o un sans di sistema. Per avere sempre lo stesso
   carattere su tutti i dispositivi, vedi LEGGIMI.txt ("Font"). */

:root {
  --paper: #fbfbf9;
  --ink: #1d1d1f;
  --muted: #686868;
  --line: #d9d9d4;
  --font: "Jost", "Futura", "Century Gothic", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --max: 1480px;
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html:has(dialog[open]) { overflow: hidden; }

a { color: inherit; }
img { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--paper);
  color: var(--ink);
}

/* ---------- Testata delle pagine interne ---------- */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) 0;
}

.brand { display: block; text-decoration: none; }

.brand-name {
  display: block;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.3em;
  line-height: 1.1;
}

.brand-role {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu { display: flex; gap: clamp(1.25rem, 3vw, 2.5rem); }

.menu a {
  padding: 0.4rem 0;
  font-size: 0.8rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.menu a:hover { color: var(--ink); }
.menu a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) var(--gutter) 5rem;
}

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 2.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.privacy-link {
  position: fixed;
  right: 1.25rem;
  bottom: 0.9rem;
  z-index: 2;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}
.privacy-link:hover { color: #fff; }
.prose h2 { margin: 0 0 1rem; font-size: 1.5rem; font-weight: 400; letter-spacing: 0.04em; }
.prose h3 { margin: 2rem 0 0.4rem; font-size: 1rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Home ---------- */

body.home { background: #000; color: #fff; }

.stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(2rem, 6vh, 4rem) 1.25rem calc(1.75rem + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(ellipse at 50% 35%, #34404f 0%, #14181d 70%);
}

.slides { position: absolute; inset: 0; z-index: -2; }

.slides img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.slides img.on { opacity: 1; }

/* Velo scuro leggero dietro al testo, perché resti leggibile su ogni foto */
.scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 40% at 50% 52%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 72%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0) 28%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.4));
}

.mark {
  align-self: start;
  display: block;
  width: clamp(3.6rem, 7vw, 5rem);
  color: #fff;
}
.mark svg { display: block; width: 100%; height: auto; }

.hero { text-align: center; }

.hero .name {
  margin: 0;
  padding-left: 0.32em;
  font-size: clamp(1.9rem, 7vw, 5.2rem);
  font-weight: 400;
  letter-spacing: 0.32em;
  line-height: 1.1;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.hero .role {
  margin: 1.1rem 0 2.4rem;
  padding-left: 0.28em;
  font-size: clamp(0.85rem, 1.6vw, 1.1rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4);
}

.hero .menu { justify-content: center; }

.hero .menu a {
  color: #fff;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4);
}
.hero .menu a:hover { border-bottom-color: #fff; }

.social {
  align-self: end;
  display: flex;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
.social svg { width: 1.25rem; height: 1.25rem; }

/* ---------- Work ---------- */

.filterbar { margin: 0 0 clamp(1.75rem, 3vw, 2.75rem); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.filters button {
  padding: 0.35rem 0;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.warn {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #5c1a15;
  background: #f6e9e8;
  border-left: 3px solid #b3261e;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 2.5rem 1.75rem;
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile { display: block; color: inherit; text-decoration: none; }

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1c1c1c;
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.thumb img.ready { opacity: 1; }

.count {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
}

/* Segnaposto visibile solo in bozza (file locale o indirizzo di prova) */
.todo {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  padding: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-align: center;
  color: #bdbdbd;
}
.draft .pending .todo { display: grid; }

.cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.75rem;
}
.cap .t { font-size: 1rem; letter-spacing: 0.02em; }
.cap .m { flex: 0 1 auto; max-width: 50%; font-size: 0.8rem; color: var(--muted); text-align: right; }

.tile:hover .t { text-decoration: underline; text-underline-offset: 0.3em; text-decoration-thickness: 1px; }

/* ---------- Finestra del video ---------- */

#viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  color: #fff;
  background: #000;
  border: 0;
}
#viewer::backdrop { background: transparent; }

.v-panel {
  width: min(1120px, 100% - 2rem);
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.v-close {
  display: block;
  margin: 0 0 0.75rem auto;
  padding: 0.5rem 0;
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
.v-close:hover { border-bottom-color: #fff; }

.v-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.v-photo { display: block; width: 100%; height: 100%; object-fit: contain; }

.v-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 4.5rem;
  padding: 0;
  font: inherit;
  font-size: 2.4rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 0;
  cursor: pointer;
}
.v-nav:hover { background: rgba(0, 0, 0, 0.75); }
.v-prev { left: 0; }
.v-next { right: 0; }

.v-count {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
}
.v-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

.v-missing {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  padding: 2rem;
  text-align: center;
  color: #cfcfcf;
}

.v-info { padding-top: 1.25rem; }
.v-info h2 { margin: 0; font-size: clamp(1.2rem, 2.4vw, 1.7rem); font-weight: 400; letter-spacing: 0.06em; }
.v-sub { margin: 0.3rem 0 0; color: #d0d0d0; }
.v-meta { margin: 0.5rem 0 0; font-size: 0.85rem; color: #ababab; }
.v-text { max-width: 42rem; margin: 1rem 0 0; color: #e6e6e6; white-space: pre-line; }

.v-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.v-list button {
  padding: 0.3rem 0;
  font: inherit;
  font-size: 0.95rem;
  color: #b9b9b9;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
.v-list button:hover { color: #fff; }
.v-list button[aria-current="true"] { color: #fff; border-bottom-color: #fff; }

/* ---------- About e Contact ---------- */

.about { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
.about:has(figure) {
  grid-template-columns: minmax(0, 24rem) minmax(0, 38rem);
  justify-content: start;
  gap: clamp(2rem, 6vw, 5rem);
}
.about figure { margin: 0; }
.about figure img { width: 100%; height: auto; }

.prose { max-width: 38rem; font-size: 1.125rem; line-height: 1.75; }
.prose p { margin: 0 0 1.35em; }

.contact:has(.portrait) {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}
.contact .portrait { margin: 0; }
.contact .portrait img { width: 100%; height: auto; }

.contact .lead { margin: 0 0 1rem; color: var(--muted); }

.contact .mail {
  display: inline-block;
  font-size: clamp(1.3rem, 3.2vw, 2.2rem);
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  overflow-wrap: anywhere;
}

.links {
  display: grid;
  gap: 0.6rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}
.links a { text-underline-offset: 0.25em; text-decoration-thickness: 1px; }

/* ---------- Schermi piccoli e movimento ridotto ---------- */

@media (max-width: 760px) {
  .about:has(figure) { grid-template-columns: minmax(0, 1fr); }
  .contact:has(.portrait) { grid-template-columns: minmax(0, 1fr); }
  .hero .name { letter-spacing: 0.22em; padding-left: 0.22em; }
  .hero .menu { gap: 1.4rem; }
  .cap { flex-direction: column; gap: 0.1rem; }
  .cap .m { max-width: none; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .slides img, .thumb img { transition: none; }
}
